diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-11-22 14:47:44 +0800 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-11-22 13:06:21 +0000 |
commit | 5c4b2aa3fd1dc30af098de5dec766a817621ace2 (patch) | |
tree | e30d44721abb95d6f6945437c27138218fc2ba8c /sound | |
parent | 72531c9434fa884d20cb3c36fcec83752f32fdf4 (diff) | |
download | op-kernel-dev-5c4b2aa3fd1dc30af098de5dec766a817621ace2.zip op-kernel-dev-5c4b2aa3fd1dc30af098de5dec766a817621ace2.tar.gz |
ASoC: max9877: Update register if either val or val2 is changed
In the case of ((max9877_regs[reg] >> shift) & mask) != val
but ((max9877_regs[reg2] >> shift) & mask) == val2,
current code does not update the registers.
Fix the logic to update registers if either val or val2 is changed.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/max9877.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sound/soc/codecs/max9877.c b/sound/soc/codecs/max9877.c index 9e7e964..dcf6f2a 100644 --- a/sound/soc/codecs/max9877.c +++ b/sound/soc/codecs/max9877.c @@ -106,13 +106,13 @@ static int max9877_set_2reg(struct snd_kcontrol *kcontrol, unsigned int mask = mc->max; unsigned int val = (ucontrol->value.integer.value[0] & mask); unsigned int val2 = (ucontrol->value.integer.value[1] & mask); - unsigned int change = 1; + unsigned int change = 0; - if (((max9877_regs[reg] >> shift) & mask) == val) - change = 0; + if (((max9877_regs[reg] >> shift) & mask) != val) + change = 1; - if (((max9877_regs[reg2] >> shift) & mask) == val2) - change = 0; + if (((max9877_regs[reg2] >> shift) & mask) != val2) + change = 1; if (change) { max9877_regs[reg] &= ~(mask << shift); |