提交 8a720718 编写于 作者: B Benoît Thébaudeau 提交者: Mark Brown

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: NBenoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 adf643ab
...@@ -2515,19 +2515,13 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, ...@@ -2515,19 +2515,13 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
int wi; int wi;
val = (ucontrol->value.integer.value[0] & mask); val = (ucontrol->value.integer.value[0] & mask);
connect = !!val;
if (invert) if (invert)
val = max - val; val = max - val;
mask = mask << shift; mask = mask << shift;
val = val << 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); mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
change = snd_soc_test_bits(widget->codec, reg, mask, val); change = snd_soc_test_bits(widget->codec, reg, mask, val);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册