aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/max9877.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-11-22 01:47:44 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-22 08:06:21 -0500
commit5c4b2aa3fd1dc30af098de5dec766a817621ace2 (patch)
treee30d44721abb95d6f6945437c27138218fc2ba8c /sound/soc/codecs/max9877.c
parent72531c9434fa884d20cb3c36fcec83752f32fdf4 (diff)
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/soc/codecs/max9877.c')
-rw-r--r--sound/soc/codecs/max9877.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sound/soc/codecs/max9877.c b/sound/soc/codecs/max9877.c
index 9e7e964a5fa3..dcf6f2a1600a 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,
106 unsigned int mask = mc->max; 106 unsigned int mask = mc->max;
107 unsigned int val = (ucontrol->value.integer.value[0] & mask); 107 unsigned int val = (ucontrol->value.integer.value[0] & mask);
108 unsigned int val2 = (ucontrol->value.integer.value[1] & mask); 108 unsigned int val2 = (ucontrol->value.integer.value[1] & mask);
109 unsigned int change = 1; 109 unsigned int change = 0;
110 110
111 if (((max9877_regs[reg] >> shift) & mask) == val) 111 if (((max9877_regs[reg] >> shift) & mask) != val)
112 change = 0; 112 change = 1;
113 113
114 if (((max9877_regs[reg2] >> shift) & mask) == val2) 114 if (((max9877_regs[reg2] >> shift) & mask) != val2)
115 change = 0; 115 change = 1;
116 116
117 if (change) { 117 if (change) {
118 max9877_regs[reg] &= ~(mask << shift); 118 max9877_regs[reg] &= ~(mask << shift);