Skip to content

Commit 622464c

Browse files
committed
ALSA: hda/realtek: Fix speaker amp on HP Envy AiO 32
HP Envy AiO 32-a12xxx has an external amp that is controlled via GPIO bit 0x04. However, unlike other devices, this amp seems to shut down itself after the certain period, hence the OS needs to up/down the bit dynamically only during the actual playback. This patch adds the control of the GPIO bit via the existing pcm_hook mechanism. Ideally it should be triggered at the actual stream start, but we have only the state change at prepare/cleanup, so use those for switching the GPIO bit on/off. This should be good enough for the purpose, and was actually confirmed to work fine. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212873 Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 8eedd3a commit 622464c

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

sound/pci/hda/patch_realtek.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4338,6 +4338,35 @@ static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
43384338
}
43394339
}
43404340

4341+
/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4342+
static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4343+
struct hda_codec *codec,
4344+
struct snd_pcm_substream *substream,
4345+
int action)
4346+
{
4347+
switch (action) {
4348+
case HDA_GEN_PCM_ACT_PREPARE:
4349+
alc_update_gpio_data(codec, 0x04, true);
4350+
break;
4351+
case HDA_GEN_PCM_ACT_CLEANUP:
4352+
alc_update_gpio_data(codec, 0x04, false);
4353+
break;
4354+
}
4355+
}
4356+
4357+
static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4358+
const struct hda_fixup *fix,
4359+
int action)
4360+
{
4361+
struct alc_spec *spec = codec->spec;
4362+
4363+
if (action == HDA_FIXUP_ACT_PROBE) {
4364+
spec->gpio_mask |= 0x04;
4365+
spec->gpio_dir |= 0x04;
4366+
spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4367+
}
4368+
}
4369+
43414370
static void alc_update_coef_led(struct hda_codec *codec,
43424371
struct alc_coef_led *led,
43434372
bool polarity, bool on)
@@ -6465,6 +6494,7 @@ enum {
64656494
ALC255_FIXUP_XIAOMI_HEADSET_MIC,
64666495
ALC274_FIXUP_HP_MIC,
64676496
ALC274_FIXUP_HP_HEADSET_MIC,
6497+
ALC274_FIXUP_HP_ENVY_GPIO,
64686498
ALC256_FIXUP_ASUS_HPE,
64696499
ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
64706500
ALC287_FIXUP_HP_GPIO_LED,
@@ -7907,6 +7937,10 @@ static const struct hda_fixup alc269_fixups[] = {
79077937
.chained = true,
79087938
.chain_id = ALC274_FIXUP_HP_MIC
79097939
},
7940+
[ALC274_FIXUP_HP_ENVY_GPIO] = {
7941+
.type = HDA_FIXUP_FUNC,
7942+
.v.func = alc274_fixup_hp_envy_gpio,
7943+
},
79107944
[ALC256_FIXUP_ASUS_HPE] = {
79117945
.type = HDA_FIXUP_VERBS,
79127946
.v.verbs = (const struct hda_verb[]) {
@@ -8140,6 +8174,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
81408174
SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
81418175
SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
81428176
SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
8177+
SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
81438178
SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
81448179
SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
81458180
SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),

0 commit comments

Comments
 (0)