Skip to content

Commit

Permalink
ASoC: dapm: Fix dapm_set_path_status() connect
Browse files Browse the repository at this point in the history
dapm_set_path_status() sets connect incorrectly in the case max > 1 with invert.
In that case, the raw disconnect value should be max, which corresponds to the
userspace value 0.

This use case currently does not appear upstream, but it could break
SOC_DAPM_SINGLE() or SOC_DAPM_SINGLE_TLV() elsewhere or in the future.

This patch completes commit 3a9abe8.

Cc: Liam Girdwood <lrg@ti.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: <alsa-devel@alsa-project.org>
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Benoît Thébaudeau authored and Mark Brown committed Jul 3, 2012
1 parent 890255e commit 32fee7a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,10 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,

val = soc_widget_read(w, reg);
val = (val >> shift) & mask;
if (invert)
val = max - val;

if ((invert && !val) || (!invert && val))
p->connect = 1;
else
p->connect = 0;
p->connect = !!val;
}
break;
case snd_soc_dapm_mux: {
Expand Down

0 comments on commit 32fee7a

Please sign in to comment.