Skip to content

Commit 716d4e5

Browse files
Srinivas-Kandagatlabroonie
authored andcommitted
ASoC: qcom: sc8280xp: Limit speaker digital volumes
Limit the speaker digital gains to 0dB so that the users will not damage them. Currently there is a limit in UCM, but this does not stop the user form changing the digital gains from command line. So limit this in driver which makes the speakers more safer without active speaker protection in place. Signed-off-by: Srinivas Kandagatla <[email protected]> Reviewed-by: Johan Hovold <[email protected]> Tested-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent fb9ad24 commit 716d4e5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

sound/soc/qcom/sc8280xp.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,23 @@ struct sc8280xp_snd_data {
2727
static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
2828
{
2929
struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
30+
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
31+
struct snd_soc_card *card = rtd->card;
32+
33+
switch (cpu_dai->id) {
34+
case WSA_CODEC_DMA_RX_0:
35+
case WSA_CODEC_DMA_RX_1:
36+
/*
37+
* set limit of 0dB on Digital Volume for Speakers,
38+
* this can prevent damage of speakers to some extent without
39+
* active speaker protection
40+
*/
41+
snd_soc_limit_volume(card, "WSA_RX0 Digital Volume", 84);
42+
snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 84);
43+
break;
44+
default:
45+
break;
46+
}
3047

3148
return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
3249
}

0 commit comments

Comments
 (0)