ALSA: hda/realtek: Enable audio jacks of ASUS D700SA with ALC887
authorJian-Hong Pan <jhp@endlessos.org>
Wed, 7 Oct 2020 05:22:25 +0000 (13:22 +0800)
committerTakashi Iwai <tiwai@suse.de>
Wed, 7 Oct 2020 15:31:59 +0000 (17:31 +0200)
The ASUS D700SA desktop's audio (1043:2390) with ALC887 cannot detect
the headset microphone and another headphone jack until
ALC887_FIXUP_ASUS_HMIC and ALC887_FIXUP_ASUS_AUDIO quirks are applied.
The NID 0x15 maps as the headset microphone and NID 0x19 maps as another
headphone jack. Also need the function like alc887_fixup_asus_jack to
enable the audio jacks.

Signed-off-by: Jian-Hong Pan <jhp@endlessos.org>
Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201007052224.22611-1-jhp@endlessos.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_realtek.c

index cf896f398ae7d0bc1ce310b2c9ffbea33e48342c..c18077b39449c98ebf588c245aeed81a81bbf5b8 100644 (file)
@@ -1929,6 +1929,8 @@ enum {
        ALC1220_FIXUP_CLEVO_P950,
        ALC1220_FIXUP_CLEVO_PB51ED,
        ALC1220_FIXUP_CLEVO_PB51ED_PINS,
+       ALC887_FIXUP_ASUS_AUDIO,
+       ALC887_FIXUP_ASUS_HMIC,
 };
 
 static void alc889_fixup_coef(struct hda_codec *codec,
@@ -2141,6 +2143,31 @@ static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
        alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
 }
 
+static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
+                                        struct hda_jack_callback *jack)
+{
+       struct alc_spec *spec = codec->spec;
+       unsigned int vref;
+
+       snd_hda_gen_hp_automute(codec, jack);
+
+       if (spec->gen.hp_jack_present)
+               vref = AC_PINCTL_VREF_80;
+       else
+               vref = AC_PINCTL_VREF_HIZ;
+       snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
+}
+
+static void alc887_fixup_asus_jack(struct hda_codec *codec,
+                                    const struct hda_fixup *fix, int action)
+{
+       struct alc_spec *spec = codec->spec;
+       if (action != HDA_FIXUP_ACT_PROBE)
+               return;
+       snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
+       spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
+}
+
 static const struct hda_fixup alc882_fixups[] = {
        [ALC882_FIXUP_ABIT_AW9D_MAX] = {
                .type = HDA_FIXUP_PINS,
@@ -2398,6 +2425,20 @@ static const struct hda_fixup alc882_fixups[] = {
                .chained = true,
                .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
        },
+       [ALC887_FIXUP_ASUS_AUDIO] = {
+               .type = HDA_FIXUP_PINS,
+               .v.pins = (const struct hda_pintbl[]) {
+                       { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
+                       { 0x19, 0x22219420 },
+                       {}
+               },
+       },
+       [ALC887_FIXUP_ASUS_HMIC] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc887_fixup_asus_jack,
+               .chained = true,
+               .chain_id = ALC887_FIXUP_ASUS_AUDIO,
+       },
 };
 
 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -2431,6 +2472,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
        SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
        SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
+       SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
        SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
        SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
        SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),