Skip to content

Commit c481016

Browse files
jhovoldbroonie
authored andcommitted
ASoC: qcom: sc8280xp: limit speaker volumes
The UCM configuration for the Lenovo ThinkPad X13s has up until now been setting the speaker PA volume to the minimum -3 dB when enabling the speakers, but this does not prevent the user from increasing the volume further. Limit the digital gain and PA volumes to a combined -3 dB in the machine driver to reduce the risk of speaker damage until we have active speaker protection in place (or higher safe levels have been established). Note that the PA volume limit cannot be set lower than 0 dB or PulseAudio gets confused when the first 16 levels all map to -3 dB. Also note that this will probably need to be generalised using machine-specific limits, but a common limit should do for now. Cc: <stable@vger.kernel.org> # 6.5 Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://msgid.link/r/20240122181819.4038-3-johan+linaro@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 92c02d7 commit c481016

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

sound/soc/qcom/sc8280xp.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
3232
case WSA_CODEC_DMA_RX_0:
3333
case WSA_CODEC_DMA_RX_1:
3434
/*
35-
* set limit of 0dB on Digital Volume for Speakers,
36-
* this can prevent damage of speakers to some extent without
37-
* active speaker protection
35+
* Set limit of -3 dB on Digital Volume and 0 dB on PA Volume
36+
* to reduce the risk of speaker damage until we have active
37+
* speaker protection in place.
3838
*/
39-
snd_soc_limit_volume(card, "WSA_RX0 Digital Volume", 84);
40-
snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 84);
39+
snd_soc_limit_volume(card, "WSA_RX0 Digital Volume", 81);
40+
snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 81);
41+
snd_soc_limit_volume(card, "SpkrLeft PA Volume", 17);
42+
snd_soc_limit_volume(card, "SpkrRight PA Volume", 17);
4143
break;
4244
default:
4345
break;

0 commit comments

Comments
 (0)