Skip to content

Commit

Permalink
ASoC: Fix mask/val_mask confusion snd_soc_dapm_put_volsw()
Browse files Browse the repository at this point in the history
snd_soc_dapm_put_volsw() has variables for both the unshifted and
shifted mask for updates commit 97404f (ASoC: Do DAPM control updates in
the middle of DAPM sequences) got confused between the two of these.
Since there's no need to keep a copy of the unshifted mask fix this and
simplify the code by using only one mask variable.

[Completely rewrote the changelog to describe the issue -- broonie.]

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Stephen Warren authored and Mark Brown committed Jan 28, 2011
1 parent 0fa63b6 commit e9cf704
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1742,21 +1742,21 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
int max = mc->max;
unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert;
unsigned int val, val_mask;
unsigned int val;
int connect, change;
struct snd_soc_dapm_update update;

val = (ucontrol->value.integer.value[0] & mask);

if (invert)
val = max - val;
val_mask = mask << shift;
mask = mask << shift;
val = val << shift;

mutex_lock(&widget->codec->mutex);
widget->value = val;

change = snd_soc_test_bits(widget->codec, reg, val_mask, val);
change = snd_soc_test_bits(widget->codec, reg, mask, val);
if (change) {
if (val)
/* new connection */
Expand Down

0 comments on commit e9cf704

Please sign in to comment.