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 <[email protected]> Tested-by: Johan Hovold <[email protected]> Reviewed-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent e238b68 commit fb9ad24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)