summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorBenoît Thébaudeau2012-06-18 22:41:28 +0200
committerMark Brown2012-06-29 09:13:32 +0200
commit8a720718b37d00cf8ab311902705ae7c7890bb95 (patch)
tree7a5a4378432af0ee9d970114fb29e9d3e5ed5c6b /sound/soc/soc-dapm.c
parentASoC: spdif: Build separate RX and TX objects (diff)
downloadkernel-qcow2-linux-8a720718b37d00cf8ab311902705ae7c7890bb95.tar.gz
kernel-qcow2-linux-8a720718b37d00cf8ab311902705ae7c7890bb95.tar.xz
kernel-qcow2-linux-8a720718b37d00cf8ab311902705ae7c7890bb95.zip
ASoC: dapm: Fix snd_soc_dapm_put_volsw() connect
snd_soc_dapm_put_volsw() sets connect incorrectly in the case max > 1 with invert. In that case, the raw disconnect value should be max, which corresponds to the userspace value 0. This use case currently does not appear upstream, but it could break SOC_DAPM_SINGLE() or SOC_DAPM_SINGLE_TLV() elsewhere or in the future. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index c2206bc835da..967066873aad 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2515,19 +2515,13 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
int wi;
val = (ucontrol->value.integer.value[0] & mask);
+ connect = !!val;
if (invert)
val = max - val;
mask = mask << shift;
val = val << shift;
- if (val)
- /* new connection */
- connect = invert ? 0 : 1;
- else
- /* old connection must be powered down */
- connect = invert ? 1 : 0;
-
mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
change = snd_soc_test_bits(widget->codec, reg, mask, val);