[alsa-devel] Problem setting mixer switch with amixer/alsactl.

Mark Brown broonie at sirena.org.uk
Thu Oct 30 12:40:57 CET 2008

On Wed, Oct 29, 2008 at 04:04:51PM +0000, Mark Brown wrote:

> I won't be able to fix it today since I have to go and get my eyes
> examined (no wonder it took me so long to spot this!) but I expect I'll
> have a patch tomorrow.

Please try this, it resolves the problems I'm seeing here:

commit 9fafa720f6dd4a7a9476bef0d78fee14af401c14
Author: Mark Brown <broonie at opensource.wolfsonmicro.com>
Date:   Thu Oct 30 11:32:47 2008 +0000

    ASoC: Fix mono controls after conversion to support full int masks
    When ASoC was converted to support full int width masks SOC_SINGLE_VALUE()
    omitted the assignment of rshift, causing the control operatins to report
    some mono controls as stereo. This happened to work some of the time due
    to a confusion between shift and min in snd_soc_info_volsw().
    Signed-off-by: Mark Brown <broonie at opensource.wolfsonmicro.com>

diff --git a/include/sound/soc.h b/include/sound/soc.h
index d33825d..da0040b 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -28,7 +28,8 @@
 #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
 	((unsigned long)&(struct soc_mixer_control) \
-	{.reg = xreg, .shift = xshift, .max = xmax, .invert = xinvert})
+	{.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \
+	.invert = xinvert})
 #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
 	((unsigned long)&(struct soc_mixer_control) \
 	{.reg = xreg, .max = xmax, .invert = xinvert})
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 0399fff..a17f864 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1563,7 +1563,7 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
 	struct soc_mixer_control *mc =
 		(struct soc_mixer_control *)kcontrol->private_value;
 	int max = mc->max;
-	unsigned int shift = mc->min;
+	unsigned int shift = mc->shift;
 	unsigned int rshift = mc->rshift;
 	if (max == 1)

More information about the Alsa-devel mailing list