All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: dapm: Remove stereo from snd_soc_dapm_get_volsw()
       [not found] <1942519503.529549.1341242344149.JavaMail.root@advansee.com>
@ 2012-07-02 15:19 ` Benoît Thébaudeau
  2012-07-03 18:18   ` [PATCH v2] ASoC: dapm: Remove incomplete stereo code Benoît Thébaudeau
  0 siblings, 1 reply; 3+ messages in thread
From: Benoît Thébaudeau @ 2012-07-02 15:19 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Takashi Iwai, alsa-devel

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

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>
---
 .../sound/soc/soc-dapm.c                           |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git linux-next-HEAD-5d2b7d6.orig/sound/soc/soc-dapm.c linux-next-HEAD-5d2b7d6/sound/soc/soc-dapm.c
index c93e832..9333e01 100644
--- linux-next-HEAD-5d2b7d6.orig/sound/soc/soc-dapm.c
+++ linux-next-HEAD-5d2b7d6/sound/soc/soc-dapm.c
@@ -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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] ASoC: dapm: Remove incomplete stereo code
  2012-07-02 15:19 ` [PATCH] ASoC: dapm: Remove stereo from snd_soc_dapm_get_volsw() Benoît Thébaudeau
@ 2012-07-03 18:18   ` Benoît Thébaudeau
  2012-07-03 18:54     ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Benoît Thébaudeau @ 2012-07-03 18:18 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Takashi Iwai, alsa-devel

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.

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>
---
 .../sound/soc/soc-dapm.c                           |   22 +++++++++++---------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git linux-next-HEAD-f9637ba.orig/sound/soc/soc-dapm.c linux-next-HEAD-f9637ba/sound/soc/soc-dapm.c
index c93e832..e80f2e3 100644
--- linux-next-HEAD-f9637ba.orig/sound/soc/soc-dapm.c
+++ linux-next-HEAD-f9637ba/sound/soc/soc-dapm.c
@@ -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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ASoC: dapm: Remove incomplete stereo code
  2012-07-03 18:18   ` [PATCH v2] ASoC: dapm: Remove incomplete stereo code Benoît Thébaudeau
@ 2012-07-03 18:54     ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-07-03 18:54 UTC (permalink / raw)
  To: Benoît Thébaudeau; +Cc: Takashi Iwai, alsa-devel, Liam Girdwood


[-- Attachment #1.1: Type: text/plain, Size: 234 bytes --]

On Tue, Jul 03, 2012 at 08:18:17PM +0200, Benoît Thébaudeau wrote:
> 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.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-07-03 18:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1942519503.529549.1341242344149.JavaMail.root@advansee.com>
2012-07-02 15:19 ` [PATCH] ASoC: dapm: Remove stereo from snd_soc_dapm_get_volsw() Benoît Thébaudeau
2012-07-03 18:18   ` [PATCH v2] ASoC: dapm: Remove incomplete stereo code Benoît Thébaudeau
2012-07-03 18:54     ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.