* ASoC: max9877: Update register if either val or val2 is changed
@ 2011-11-22 6:47 Axel Lin
2011-11-22 13:06 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-11-22 6:47 UTC (permalink / raw)
To: alsa-devel; +Cc: Mark Brown, Joonyoung Shim, Liam Girdwood
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>
---
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);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: ASoC: max9877: Update register if either val or val2 is changed
2011-11-22 6:47 ASoC: max9877: Update register if either val or val2 is changed Axel Lin
@ 2011-11-22 13:06 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2011-11-22 13:06 UTC (permalink / raw)
To: Axel Lin; +Cc: alsa-devel, Joonyoung Shim, Liam Girdwood
On Tue, Nov 22, 2011 at 02:47:44PM +0800, Axel Lin wrote:
> In the case of ((max9877_regs[reg] >> shift) & mask) != val
> but ((max9877_regs[reg2] >> shift) & mask) == val2,
> current code does not update the registers.
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-22 13:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-22 6:47 ASoC: max9877: Update register if either val or val2 is changed Axel Lin
2011-11-22 13:06 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.