[alsa-devel] [PATCH 2/2] ASoC: tlv320aic3x: Fix Left/Rigth PGA mixer widgets/kcontrols

Peter Ujfalusi peter.ujfalusi at ti.com
Tue May 27 12:53:06 CEST 2014


Commit "cf7c1de20c576 ASoC: dapm: Move 'value' field from widget to
control" changed the way how the 'value' has been stored for a widget.
Since the driver is not updated following the mentioned commit it is mostly
broken when we try to change mixers for Left/Right PGA since the value is
not going to be updated correctly.
This can be seen when trying to switch of one of the routes for the first
time (the second try will succeed):
amixer sset 'Left PGA Mixer Line1L' off
amixer: Invalid command!

Signed-off-by: Peter Ujfalusi <peter.ujfalusi at ti.com>
---
 sound/soc/codecs/tlv320aic3x.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index d7349bc89ad3..167c95bdf289 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -156,21 +156,21 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
 	int connect, change;
 
 	val = (ucontrol->value.integer.value[0] & mask);
+	connect = !!val;
+
+	if (invert)
+		val = max - val;
+
+	change = dapm_kcontrol_set_value(kcontrol, val);
 
 	mask = 0xf;
 	if (val)
 		val = mask;
 
-	connect = !!val;
-
-	if (invert)
-		val = mask - val;
-
 	mask <<= shift;
 	val <<= shift;
 
-	change = snd_soc_test_bits(codec, val, mask, reg);
-	if (change) {
+	if (change && snd_soc_test_bits(codec, val, mask, reg)) {
 		update.kcontrol = kcontrol;
 		update.reg = reg;
 		update.mask = mask;
-- 
1.9.3



More information about the Alsa-devel mailing list