diff mbox series

ALSA: hda/realtek - Fix headset mic problem for a HP machine with alc671

Message ID 20220310130301.22827-1-huangwenhuia@uniontech.com (mailing list archive)
State Superseded
Headers show
Series ALSA: hda/realtek - Fix headset mic problem for a HP machine with alc671 | expand

Commit Message

huangwenhui March 10, 2022, 1:03 p.m. UTC
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(+)

Comments

huangwenhui March 10, 2022, 1:58 p.m. UTC | #1
Hi&nbsp; Takashi,


Thank you for your reply.


When booting with plugged headset, the headphone will be muted.


Thanks.
&nbsp;
------------------&nbsp;Original&nbsp;------------------
From: &nbsp;"Takashi&nbsp;Iwai"<tiwai@suse.de&gt;;
Date: &nbsp;Thu, Mar 10, 2022 09:29 PM
To: &nbsp;"huangwenhui"<huangwenhuia@uniontech.com&gt;; 
Cc: &nbsp;"perex"<perex@perex.cz&gt;; "tiwai"<tiwai@suse.com&gt;; "jeremy.szu"<jeremy.szu@canonical.com&gt;; "hui.wang"<hui.wang@canonical.com&gt;; "wse"<wse@tuxedocomputers.com&gt;; "cam"<cam@neo-zeon.de&gt;; "kailang"<kailang@realtek.com&gt;; "tanureal"<tanureal@opensource.cirrus.com&gt;; "sami"<sami@loone.fi&gt;; "alsa-devel"<alsa-devel@alsa-project.org&gt;; "linux-kernel"<linux-kernel@vger.kernel.org&gt;; 
Subject: &nbsp;Re: [PATCH] ALSA: hda/realtek - Fix headset mic problem for a HP machine with alc671

&nbsp;

On Thu, 10 Mar 2022 14:03:01 +0100,
huangwenhui wrote:
&gt; 
&gt; On a HP 288 Pro G8, the front Mic could not be detected.
&gt; 
&gt; Signed-off-by: huangwenhui <huangwenhuia@uniontech.com&gt;

Thanks for the patch.&nbsp; Most of the changes look OK, but one thing I
still don't get:

&gt; +	case HDA_FIXUP_ACT_INIT:
&gt; +		alc_write_coef_idx(codec, 0x19, 0xa054);
&gt; +		msleep(80);
&gt; +		snd_hda_codec_write(codec, hp_pin, 0,
&gt; +			&nbsp;&nbsp;&nbsp; AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);

Why this unconditional unmute is required for fixing the mic problem?


Takashi
diff mbox series

Patch

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),