提交 5c4b2aa3 编写于 作者: A Axel Lin 提交者: Mark Brown

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: NAxel Lin <axel.lin@gmail.com>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 72531c94
...@@ -106,13 +106,13 @@ static int max9877_set_2reg(struct snd_kcontrol *kcontrol, ...@@ -106,13 +106,13 @@ static int max9877_set_2reg(struct snd_kcontrol *kcontrol,
unsigned int mask = mc->max; unsigned int mask = mc->max;
unsigned int val = (ucontrol->value.integer.value[0] & mask); unsigned int val = (ucontrol->value.integer.value[0] & mask);
unsigned int val2 = (ucontrol->value.integer.value[1] & 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) if (((max9877_regs[reg] >> shift) & mask) != val)
change = 0; change = 1;
if (((max9877_regs[reg2] >> shift) & mask) == val2) if (((max9877_regs[reg2] >> shift) & mask) != val2)
change = 0; change = 1;
if (change) { if (change) {
max9877_regs[reg] &= ~(mask << shift); max9877_regs[reg] &= ~(mask << shift);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册