This is a note to let you know that I've just added the patch titled ALSA: hda/realtek: Fix speaker amp on HP Envy AiO 32 to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: alsa-hda-realtek-fix-speaker-amp-on-hp-envy-aio-32.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 622464c893142f7beac89f5ba8c9773bca5e5004 Mon Sep 17 00:00:00 2001 From: Takashi Iwai <tiwai@xxxxxxx> Date: Tue, 4 May 2021 11:18:02 +0200 Subject: ALSA: hda/realtek: Fix speaker amp on HP Envy AiO 32 From: Takashi Iwai <tiwai@xxxxxxx> commit 622464c893142f7beac89f5ba8c9773bca5e5004 upstream. 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: <stable@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20210504091802.13200-1-tiwai@xxxxxxx Signed-off-by: Takashi Iwai <tiwai@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- sound/pci/hda/patch_realtek.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4331,6 +4331,35 @@ static void alc245_fixup_hp_x360_amp(str } } +/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */ +static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo, + struct hda_codec *codec, + struct snd_pcm_substream *substream, + int action) +{ + switch (action) { + case HDA_GEN_PCM_ACT_PREPARE: + alc_update_gpio_data(codec, 0x04, true); + break; + case HDA_GEN_PCM_ACT_CLEANUP: + alc_update_gpio_data(codec, 0x04, false); + break; + } +} + +static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec, + const struct hda_fixup *fix, + int action) +{ + struct alc_spec *spec = codec->spec; + + if (action == HDA_FIXUP_ACT_PROBE) { + spec->gpio_mask |= 0x04; + spec->gpio_dir |= 0x04; + spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook; + } +} + static void alc_update_coef_led(struct hda_codec *codec, struct alc_coef_led *led, bool polarity, bool on) @@ -6443,6 +6472,7 @@ enum { ALC255_FIXUP_XIAOMI_HEADSET_MIC, ALC274_FIXUP_HP_MIC, ALC274_FIXUP_HP_HEADSET_MIC, + ALC274_FIXUP_HP_ENVY_GPIO, ALC256_FIXUP_ASUS_HPE, ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK, ALC287_FIXUP_HP_GPIO_LED, @@ -7882,6 +7912,10 @@ static const struct hda_fixup alc269_fix .chained = true, .chain_id = ALC274_FIXUP_HP_MIC }, + [ALC274_FIXUP_HP_ENVY_GPIO] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc274_fixup_hp_envy_gpio, + }, [ALC256_FIXUP_ASUS_HPE] = { .type = HDA_FIXUP_VERBS, .v.verbs = (const struct hda_verb[]) { @@ -8099,6 +8133,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), + SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO), SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF), Patches currently in stable-queue which might be from tiwai@xxxxxxx are queue-5.10/alsa-hda-realtek-alc285-thinkpad-jack-pin-quirk-is-unreachable.patch queue-5.10/alsa-hda-realtek-re-order-alc269-asus-quirk-table-entries.patch queue-5.10/alsa-hda-realtek-re-order-remaining-alc269-quirk-table-entries.patch queue-5.10/alsa-hda-realtek-re-order-alc882-clevo-quirk-table-entries.patch queue-5.10/alsa-hda-realtek-fix-speaker-amp-on-hp-envy-aio-32.patch queue-5.10/alsa-hda-realtek-re-order-alc269-sony-quirk-table-entries.patch queue-5.10/alsa-hda-realtek-re-order-alc269-lenovo-quirk-table-entries.patch queue-5.10/alsa-hda-realtek-re-order-alc269-dell-quirk-table-entries.patch queue-5.10/alsa-hda-realtek-re-order-alc882-sony-quirk-table-entries.patch queue-5.10/alsa-hda-realtek-re-order-alc662-quirk-table-entries.patch queue-5.10/alsa-hda-realtek-re-order-alc269-hp-quirk-table-entries.patch queue-5.10/alsa-hda-realtek-re-order-alc269-acer-quirk-table-entries.patch queue-5.10/alsa-hda-realtek-remove-redundant-entry-for-alc861-haier-uniwill-devices.patch queue-5.10/alsa-hda-realtek-re-order-alc882-acer-quirk-table-entries.patch