[PATCH] ALSA: hda/realtek - Fix headset mic problem for a HP machine with alc671
On a HP 288 Pro G8, the front Mic could not be detected.
Signed-off-by: huangwenhui huangwenhuia@uniontech.com --- sound/pci/hda/patch_realtek.c | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 3a42457984e9..bcd56cdc07af 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -10519,6 +10519,37 @@ static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, } }
+static void alc671_fixup_hp288_headset_mic2(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + struct alc_spec *spec = codec->spec; + hda_nid_t hp_pin = alc_get_hp_pin(spec); + + static const struct hda_pintbl pincfgs[] = { + { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */ + { 0x1b, 0x0181304f }, + { } + }; + + if (!hp_pin) + hp_pin = 0x21; + + switch (action) { + case HDA_FIXUP_ACT_PRE_PROBE: + spec->gen.mixer_nid = 0; + spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; + snd_hda_apply_pincfgs(codec, pincfgs); + break; + case HDA_FIXUP_ACT_INIT: + alc_write_coef_idx(codec, 0x19, 0xa054); + msleep(80); + snd_hda_codec_write(codec, hp_pin, 0, + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); + msleep(100); + break; + } +} + static void alc897_hp_automute_hook(struct hda_codec *codec, struct hda_jack_callback *jack) { @@ -10615,6 +10646,7 @@ enum { ALC669_FIXUP_ACER_ASPIRE_ETHOS, ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET, ALC671_FIXUP_HP_HEADSET_MIC2, + ALC671_FIXUP_HP288_HEADSET_MIC2, ALC662_FIXUP_ACER_X2660G_HEADSET_MODE, ALC662_FIXUP_ACER_NITRO_HEADSET_MODE, ALC668_FIXUP_ASUS_NO_HEADSET_MIC, @@ -10986,6 +11018,10 @@ static const struct hda_fixup alc662_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc671_fixup_hp_headset_mic2, }, + [ALC671_FIXUP_HP288_HEADSET_MIC2] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc671_fixup_hp288_headset_mic2, + }, [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) { @@ -11067,6 +11103,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2), + SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP288_HEADSET_MIC2), SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE), SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50), SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
On Thu, 10 Mar 2022 14:03:01 +0100, huangwenhui wrote:
On a HP 288 Pro G8, the front Mic could not be detected.
Signed-off-by: huangwenhui huangwenhuia@uniontech.com
Thanks for the patch. Most of the changes look OK, but one thing I still don't get:
- case HDA_FIXUP_ACT_INIT:
alc_write_coef_idx(codec, 0x19, 0xa054);
msleep(80);
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Why this unconditional unmute is required for fixing the mic problem?
Takashi
Hi Takashi,
Thank you for your reply.
When booting with plugged headset, the headphone will be muted.
Thanks. ------------------ Original ------------------ From: "Takashi Iwai"<tiwai@suse.de>; Date: Thu, Mar 10, 2022 09:29 PM To: "huangwenhui"<huangwenhuia@uniontech.com>; Cc: "perex"<perex@perex.cz>; "tiwai"<tiwai@suse.com>; "jeremy.szu"<jeremy.szu@canonical.com>; "hui.wang"<hui.wang@canonical.com>; "wse"<wse@tuxedocomputers.com>; "cam"<cam@neo-zeon.de>; "kailang"<kailang@realtek.com>; "tanureal"<tanureal@opensource.cirrus.com>; "sami"<sami@loone.fi>; "alsa-devel"<alsa-devel@alsa-project.org>; "linux-kernel"<linux-kernel@vger.kernel.org>; Subject: Re: [PATCH] ALSA: hda/realtek - Fix headset mic problem for a HP machine with alc671
On Thu, 10 Mar 2022 14:03:01 +0100, huangwenhui wrote: > > On a HP 288 Pro G8, the front Mic could not be detected. > > Signed-off-by: huangwenhui <huangwenhuia@uniontech.com>
Thanks for the patch. Most of the changes look OK, but one thing I still don't get:
> + case HDA_FIXUP_ACT_INIT: > + alc_write_coef_idx(codec, 0x19, 0xa054); > + msleep(80); > + snd_hda_codec_write(codec, hp_pin, 0, > + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Why this unconditional unmute is required for fixing the mic problem?
Takashi
On Thu, 10 Mar 2022 14:58:36 +0100, 黄文辉 wrote:
Hi Takashi,
Thank you for your reply.
When booting with plugged headset, the headphone will be muted.
The muted state is the default behavior. Wouldn't it be unmuted if you adjust the corresponding mixer element?
Takashi
Thanks.
------------------ Original ------------------ From: "Takashi Iwai"tiwai@suse.de; Date: Thu, Mar 10, 2022 09:29 PM To: "huangwenhui"huangwenhuia@uniontech.com; Cc: "perex"perex@perex.cz; "tiwai"tiwai@suse.com; "jeremy.szu" jeremy.szu@canonical.com; "hui.wang"hui.wang@canonical.com; "wse" wse@tuxedocomputers.com; "cam"cam@neo-zeon.de; "kailang" kailang@realtek.com; "tanureal"tanureal@opensource.cirrus.com; "sami" sami@loone.fi; "alsa-devel"alsa-devel@alsa-project.org; "linux-kernel" linux-kernel@vger.kernel.org; Subject: Re: [PATCH] ALSA: hda/realtek - Fix headset mic problem for a HP machine with alc671
On Thu, 10 Mar 2022 14:03:01 +0100, huangwenhui wrote:
On a HP 288 Pro G8, the front Mic could not be detected.
Signed-off-by: huangwenhui huangwenhuia@uniontech.com
Thanks for the patch. Most of the changes look OK, but one thing I still don't get:
- case HDA_FIXUP_ACT_INIT:
- alc_write_coef_idx(codec, 0x19, 0xa054);
- msleep(80);
- snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Why this unconditional unmute is required for fixing the mic problem?
Takashi
participants (3)
-
huangwenhui
-
Takashi Iwai
-
黄文辉