Skip to content

Commit 1e5dc39

Browse files
jason77-wangtiwai
authored andcommitted
ALSA: hda/realtek: fix the hp playback volume issue for LG machines
Recently we tested the headphone playback on 2 LG machines, if we set the volume to the max value or near to the max value, the sound is too loud, it could even bring harm to listeners. A workaround is to decrease the max volume to a reasonable value for the headphone's amplifier, then the users couldn't set the volume bigger than that value from the userspace. Signed-off-by: Hui Wang <hui.wang@canonical.com> Message-ID: <20240318011128.156023-1-hui.wang@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 585f5bf commit 1e5dc39

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

sound/pci/hda/patch_realtek.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6964,6 +6964,25 @@ static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
69646964
}
69656965
}
69666966

6967+
static void alc256_decrease_headphone_amp_val(struct hda_codec *codec,
6968+
const struct hda_fixup *fix, int action)
6969+
{
6970+
u32 caps;
6971+
u8 nsteps, offs;
6972+
6973+
if (action != HDA_FIXUP_ACT_PRE_PROBE)
6974+
return;
6975+
6976+
caps = query_amp_caps(codec, 0x3, HDA_OUTPUT);
6977+
nsteps = ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) - 10;
6978+
offs = ((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT) - 10;
6979+
caps &= ~AC_AMPCAP_NUM_STEPS & ~AC_AMPCAP_OFFSET;
6980+
caps |= (nsteps << AC_AMPCAP_NUM_STEPS_SHIFT) | (offs << AC_AMPCAP_OFFSET_SHIFT);
6981+
6982+
if (snd_hda_override_amp_caps(codec, 0x3, HDA_OUTPUT, caps))
6983+
codec_warn(codec, "failed to override amp caps for NID 0x3\n");
6984+
}
6985+
69676986
static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
69686987
const struct hda_fixup *fix,
69696988
int action)
@@ -7382,6 +7401,7 @@ enum {
73827401
ALC294_FIXUP_CS35L41_I2C_2,
73837402
ALC245_FIXUP_CS35L56_SPI_4_HP_GPIO_LED,
73847403
ALC256_FIXUP_ACER_SFG16_MICMUTE_LED,
7404+
ALC256_FIXUP_HEADPHONE_AMP_VOL,
73857405
};
73867406

73877407
/* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -9581,6 +9601,10 @@ static const struct hda_fixup alc269_fixups[] = {
95819601
.type = HDA_FIXUP_FUNC,
95829602
.v.func = alc256_fixup_acer_sfg16_micmute_led,
95839603
},
9604+
[ALC256_FIXUP_HEADPHONE_AMP_VOL] = {
9605+
.type = HDA_FIXUP_FUNC,
9606+
.v.func = alc256_decrease_headphone_amp_val,
9607+
},
95849608
};
95859609

95869610
static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -10319,6 +10343,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1031910343
SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
1032010344
SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
1032110345
SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10346+
SND_PCI_QUIRK(0x1854, 0x0440, "LG CQ6", ALC256_FIXUP_HEADPHONE_AMP_VOL),
10347+
SND_PCI_QUIRK(0x1854, 0x0441, "LG CQ6 AIO", ALC256_FIXUP_HEADPHONE_AMP_VOL),
1032210348
SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
1032310349
SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
1032410350
SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),

0 commit comments

Comments
 (0)