Skip to content

Commit fb9ad24

Browse files
Srinivas-Kandagatlabroonie
authored andcommitted
ASoC: ops: add correct range check for limiting volume
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>
1 parent e238b68 commit fb9ad24

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sound/soc/soc-ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card,
661661
kctl = snd_soc_card_get_kcontrol(card, name);
662662
if (kctl) {
663663
struct soc_mixer_control *mc = (struct soc_mixer_control *)kctl->private_value;
664-
if (max <= mc->max) {
664+
if (max <= mc->max - mc->min) {
665665
mc->platform_max = max;
666666
ret = 0;
667667
}

0 commit comments

Comments
 (0)