[alsa-devel] [PATCH] ASoC: dapm: Fix dapm_set_path_status() connect

Benoît Thébaudeau benoit.thebaudeau at advansee.com
Mon Jul 2 13:45:21 CEST 2012


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 at ti.com>
Cc: Mark Brown <broonie at opensource.wolfsonmicro.com>
Cc: <alsa-devel at alsa-project.org>
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau at advansee.com>
---
 .../sound/soc/soc-dapm.c                           |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git linux-next-HEAD-d1d2d3a.orig/sound/soc/soc-dapm.c linux-next-HEAD-d1d2d3a/sound/soc/soc-dapm.c
index 9670668..7f2a4bb 100644
--- linux-next-HEAD-d1d2d3a.orig/sound/soc/soc-dapm.c
+++ linux-next-HEAD-d1d2d3a/sound/soc/soc-dapm.c
@@ -324,11 +324,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: {


More information about the Alsa-devel mailing list