From: Mark Brown <broonie@opensource.wolfsonmicro.com>
Date: Thu, 30 Oct 2008 12:37:08 +0000 (+0000)
Subject: ALSA: ASoC: Fix mono controls after conversion to support full int masks
X-Git-Tag: firefly_0821_release~16888^2~2^3~2
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=762b8df748d83c14070afbf0c6f8c0f4a91a13bf;p=firefly-linux-kernel-4.4.55.git

ALSA: 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@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---

diff --git a/include/sound/soc.h b/include/sound/soc.h
index a1e0357a84d7..5e0189876afd 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 462e635dfc74..a3adbf06b1e5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1462,7 +1462,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)