Skip to contentSkip to conversation

ASoC: dapm: Remove stereo from snd_soc_dapm_get_volsw()

PATCH New Benoît Thébaudeau 2 participants 3 messages Jul 2, 2012 – Jul 3, 2012 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 ASoC: dapm: Remove stereo from snd_soc_dapm_get_volsw()

Stereo is not yet supported by dapm widgets, so remove stereo code from snd_soc_dapm_get_volsw().

---
 .../sound/soc/soc-dapm.c                           |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
sound/soc/soc-dapm.c +2 -10
index c93e832..9333e01 100644
@@ -2464,23 +2464,15 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
 		(struct soc_mixer_control *)kcontrol->private_value;
 	unsigned int reg = mc->reg;
 	unsigned int shift = mc->shift;
-	unsigned int rshift = mc->rshift;
 	int max = mc->max;
-	unsigned int invert = mc->invert;
 	unsigned int mask = (1 << fls(max)) - 1;
+	unsigned int invert = mc->invert;
 
 	ucontrol->value.integer.value[0] =
 		(snd_soc_read(widget->codec, reg) >> shift) & mask;
-	if (shift != rshift)
-		ucontrol->value.integer.value[1] =
-			(snd_soc_read(widget->codec, reg) >> rshift) & mask;
-	if (invert) {
+	if (invert)
 		ucontrol->value.integer.value[0] =
 			max - ucontrol->value.integer.value[0];
-		if (shift != rshift)
-			ucontrol->value.integer.value[1] =
-				max - ucontrol->value.integer.value[1];
-	}
 
 	return 0;
 }

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw

PATCH v2 1/1 ASoC: dapm: Remove incomplete stereo code

Stereo is not yet supported by dapm widgets, so remove stereo code from snd_soc_dapm_get_volsw(), and warn if stereo controls are detected.

---
 .../sound/soc/soc-dapm.c                           |   22 +++++++++++---------
 1 file changed, 12 insertions(+), 10 deletions(-)
sound/soc/soc-dapm.c +12 -10
index c93e832..e80f2e3 100644
@@ -2464,23 +2464,20 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
 		(struct soc_mixer_control *)kcontrol->private_value;
 	unsigned int reg = mc->reg;
 	unsigned int shift = mc->shift;
-	unsigned int rshift = mc->rshift;
 	int max = mc->max;
-	unsigned int invert = mc->invert;
 	unsigned int mask = (1 << fls(max)) - 1;
+	unsigned int invert = mc->invert;
+
+	if (snd_soc_volsw_is_stereo(mc))
+		dev_warn(widget->dapm->dev,
+			 "Control '%s' is stereo, which is not supported\n",
+			 kcontrol->id.name);
 
 	ucontrol->value.integer.value[0] =
 		(snd_soc_read(widget->codec, reg) >> shift) & mask;
-	if (shift != rshift)
-		ucontrol->value.integer.value[1] =
-			(snd_soc_read(widget->codec, reg) >> rshift) & mask;
-	if (invert) {
+	if (invert)
 		ucontrol->value.integer.value[0] =
 			max - ucontrol->value.integer.value[0];
-		if (shift != rshift)
-			ucontrol->value.integer.value[1] =
-				max - ucontrol->value.integer.value[1];
-	}
 
 	return 0;
 }
@@ -2514,6 +2511,11 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
 	struct snd_soc_dapm_update update;
 	int wi;
 
+	if (snd_soc_volsw_is_stereo(mc))
+		dev_warn(widget->dapm->dev,
+			 "Control '%s' is stereo, which is not supported\n",
+			 kcontrol->id.name);
+
 	val = (ucontrol->value.integer.value[0] & mask);
 	connect = !!val;
 

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Applied
#3 lore raw

Re: [PATCH v2] ASoC: dapm: Remove incomplete stereo code

Quoted 2 lines · Benoît Thébaudeau

Stereo is not yet supported by dapm widgets, so remove stereo code from snd_soc_dapm_get_volsw(), and warn if stereo controls are detected.

Applied, thanks.