Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753118AbbGNT3g (ORCPT ); Tue, 14 Jul 2015 15:29:36 -0400 Received: from cantor2.suse.de ([195.135.220.15]:46579 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752993AbbGNT3e (ORCPT ); Tue, 14 Jul 2015 15:29:34 -0400 Date: Tue, 14 Jul 2015 21:29:32 +0200 Message-ID: From: Takashi Iwai To: Keith Packard Cc: Jaroslav Kysela , Kailang Yang , Hui Wang , David Henningsson , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: hda/realtek: Enable HP amp and mute LED on HP Folio 9480m In-Reply-To: <1436895871-2459-1-git-send-email-keithp@keithp.com> References: <1436892035-19589-1-git-send-email-keithp@keithp.com> <1436895871-2459-1-git-send-email-keithp@keithp.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3534 Lines: 92 On Tue, 14 Jul 2015 19:44:31 +0200, Keith Packard wrote: > > This laptop needs GPIO4 pulled high to enable the headphone amplifier, > and has a mute LED on GPIO3. I modelled the patch on the existing > GPIO4 code which pulls the line low for the same purpose; this time, > the HP amp line is pulled high. > > Signed-off-by: Keith Packard > --- > sound/pci/hda/patch_realtek.c | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c > index 6d01045..de031f7 100644 > --- a/sound/pci/hda/patch_realtek.c > +++ b/sound/pci/hda/patch_realtek.c > @@ -3436,6 +3436,29 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec, > } > } > > +static void alc280_fixup_hp_gpio4_hp_amp(struct hda_codec *codec, > + const struct hda_fixup *fix, > + int action) > +{ > + /* Pull GPIO4 high to enable headphone amp */ > + struct alc_spec *spec = codec->spec; > + static const struct hda_verb gpio_init[] = { > + { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 }, > + { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 }, > + { 0x01, AC_VERB_SET_GPIO_DATA, 0x10 }, > + {} > + }; > + > + if (action == HDA_FIXUP_ACT_PRE_PROBE) { > + spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; > + spec->gpio_led = 0x10; > + spec->mute_led_polarity = 0; > + spec->gpio_mute_led_mask = 0x08; > + snd_hda_add_verbs(codec, gpio_init); > + codec->power_filter = led_power_filter; > + } > +} > + > static void gpio2_mic_hotkey_event(struct hda_codec *codec, > struct hda_jack_callback *event) > { > @@ -4512,6 +4535,7 @@ enum { > ALC286_FIXUP_HP_GPIO_LED, > ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, > ALC280_FIXUP_HP_DOCK_PINS, > + ALC280_FIXUP_HP_GPIO4_HP_AMP, > ALC288_FIXUP_DELL_HEADSET_MODE, > ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, > ALC288_FIXUP_DELL_XPS_13_GPIO6, > @@ -5012,6 +5036,10 @@ static const struct hda_fixup alc269_fixups[] = { > .chained = true, > .chain_id = ALC280_FIXUP_HP_GPIO4 > }, > + [ALC280_FIXUP_HP_GPIO4_HP_AMP] = { > + .type = HDA_FIXUP_FUNC, > + .v.func = alc280_fixup_hp_gpio4_hp_amp, > + }, > [ALC288_FIXUP_DELL_HEADSET_MODE] = { > .type = HDA_FIXUP_FUNC, > .v.func = alc_fixup_headset_mode_dell_alc288, > @@ -5103,6 +5131,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { > SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), > SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), > SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), > + SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_GPIO4_HP_AMP), > SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), > SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), > /* ALC290 */ Thanks for the patch. But this looks suboptimal, unfortunately, since it keeps the amp always on, and more badly, it would block the power save of the widget root node. Can just using gpio_mute_led_mask=0x18 and gpio_led=0 (also drop AC_VERB_SET_GPIO_DATA in gpio_init[]) work instead? If GPIO4 is the the amp, we can associate it with the master mute control together with the mute LED. The only concern would be the possible click noise, but it doesn't happen on most machines. Takashi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/