Skip to content

Commit

Permalink
HACK: TEMP: headphone volume lowering
Browse files Browse the repository at this point in the history
This is a temporary hack from Srini to not blow out eardrums when using
headphones.

Not-signed-off-by: Steev Klimaszewski <steev@kali.org>
  • Loading branch information
0x011011110 committed Jul 15, 2023
1 parent 009af5c commit 641af7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions sound/soc/qcom/sc8280xp.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@ struct sc8280xp_snd_data {

static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
int ret;

ret = snd_soc_limit_volume(card, "RX_RX0 Digital Volume", 80);
if (ret)
dev_err(card->dev, "Unable to limit HPHL digital volume\n");

snd_soc_limit_volume(card, "RX_RX1 Digital Volume", 80);
if (ret)
dev_err(card->dev, "Unable to limit HPHR digital volume\n");

return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
}
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/soc-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 641af7b

Please sign in to comment.