mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-22 05:44:31 +08:00
ASoC: ops: add correct range check for limiting volume
commit fb9ad24485
upstream.
Volume can have ranges that start with negative values, ex: -84dB to
+40dB. Apply correct range check in snd_soc_limit_volume before setting
the platform_max. Without this patch, for example setting a 0dB limit on
a volume range of -84dB to +40dB would fail.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20231204124736.132185-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6df51c525a
commit
395e52b7a1
@ -661,7 +661,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card,
|
||||
kctl = snd_soc_card_get_kcontrol(card, name);
|
||||
if (kctl) {
|
||||
struct soc_mixer_control *mc = (struct soc_mixer_control *)kctl->private_value;
|
||||
if (max <= mc->max) {
|
||||
if (max <= mc->max - mc->min) {
|
||||
mc->platform_max = max;
|
||||
ret = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user