]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - sound/pci/hda/patch_realtek.c
ALSA: hda - add an instance to use snd_hda_pick_pin_fixup
[mirror_ubuntu-bionic-kernel.git] / sound / pci / hda / patch_realtek.c
index 40f9b5d712eb9c5b47aac32777a34931a2bf9e82..951017168e37c3af4b4ceab0eb13c32d6b5e261c 100644 (file)
@@ -3524,6 +3524,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
                /* Direct Drive HP Amp control */
                alc_write_coefex_idx(codec, 0x57, 0x03, 0x8aa6);
                break;
+       case 0x10ec0233:
        case 0x10ec0283:
                alc_write_coef_idx(codec, 0x1b, 0x0c0b);
                alc_write_coef_idx(codec, 0x45, 0xc429);
@@ -3582,6 +3583,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
                alc_write_coef_idx(codec, 0x06, 0x6100);
                snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
                break;
+       case 0x10ec0233:
        case 0x10ec0283:
                alc_write_coef_idx(codec, 0x45, 0xc429);
                snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
@@ -3636,6 +3638,7 @@ static void alc_headset_mode_default(struct hda_codec *codec)
                alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
                alc_write_coef_idx(codec, 0x49, 0x0049);
                break;
+       case 0x10ec0233:
        case 0x10ec0283:
                alc_write_coef_idx(codec, 0x06, 0x2100);
                alc_write_coef_idx(codec, 0x32, 0x4ea3);
@@ -3677,6 +3680,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
                alc_write_coef_idx(codec, 0x1b, 0x0c2b);
                alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
                break;
+       case 0x10ec0233:
        case 0x10ec0283:
                alc_write_coef_idx(codec, 0x45, 0xd429);
                alc_write_coef_idx(codec, 0x1b, 0x0c2b);
@@ -3715,6 +3719,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)
                alc_write_coef_idx(codec, 0x1b, 0x0c2b);
                alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
                break;
+       case 0x10ec0233:
        case 0x10ec0283:
                alc_write_coef_idx(codec, 0x45, 0xe429);
                alc_write_coef_idx(codec, 0x1b, 0x0c2b);
@@ -3757,6 +3762,7 @@ static void alc_determine_headset_type(struct hda_codec *codec)
                val = alc_read_coef_idx(codec, 0x46);
                is_ctia = (val & 0x0070) == 0x0070;
                break;
+       case 0x10ec0233:
        case 0x10ec0283:
                alc_write_coef_idx(codec, 0x45, 0xd029);
                msleep(300);
@@ -3970,6 +3976,16 @@ static void alc_fixup_no_shutup(struct hda_codec *codec,
        }
 }
 
+static void alc_fixup_disable_aamix(struct hda_codec *codec,
+                                   const struct hda_fixup *fix, int action)
+{
+       if (action == HDA_FIXUP_ACT_PRE_PROBE) {
+               struct alc_spec *spec = codec->spec;
+               /* Disable AA-loopback as it causes white noise */
+               spec->gen.mixer_nid = 0;
+       }
+}
+
 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
                                const struct hda_fixup *fix, int action)
 {
@@ -4186,6 +4202,7 @@ enum {
        ALC269_FIXUP_ASUS_G73JW,
        ALC269_FIXUP_LENOVO_EAPD,
        ALC275_FIXUP_SONY_HWEQ,
+       ALC275_FIXUP_SONY_DISABLE_AAMIX,
        ALC271_FIXUP_DMIC,
        ALC269_FIXUP_PCM_44K,
        ALC269_FIXUP_STEREO_DMIC,
@@ -4291,6 +4308,12 @@ static const struct hda_fixup alc269_fixups[] = {
                .chained = true,
                .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
        },
+       [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc_fixup_disable_aamix,
+               .chained = true,
+               .chain_id = ALC269_FIXUP_SONY_VAIO
+       },
        [ALC271_FIXUP_DMIC] = {
                .type = HDA_FIXUP_FUNC,
                .v.func = alc271_fixup_dmic,
@@ -4702,8 +4725,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x0629, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x062c, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
-       SND_PCI_QUIRK(0x1028, 0x062e, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
-       SND_PCI_QUIRK(0x1028, 0x0632, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
        SND_PCI_QUIRK(0x1028, 0x063e, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
@@ -4801,6 +4822,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
        SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
        SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
+       SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
        SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
        SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
        SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
@@ -4897,6 +4919,50 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
        {}
 };
 
+static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
+       {
+               .codec = 0x10ec0293,
+               .subvendor = 0x1028,
+#ifdef CONFIG_SND_DEBUG_VERBOSE
+               .name = "Dell",
+#endif
+               .pins = (const struct hda_pintbl[]) {
+                       {0x12, 0x40000000},
+                       {0x13, 0x90a60140},
+                       {0x14, 0x90170110},
+                       {0x15, 0x0221401f},
+                       {0x16, 0x21014020},
+                       {0x18, 0x411111f0},
+                       {0x19, 0x21a19030},
+                       {0x1a, 0x411111f0},
+                       {0x1b, 0x411111f0},
+                       {0x1d, 0x40700001},
+                       {0x1e, 0x411111f0},
+               },
+               .value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
+       },
+       {
+               .codec = 0x10ec0255,
+               .subvendor = 0x1028,
+#ifdef CONFIG_SND_DEBUG_VERBOSE
+               .name = "Dell",
+#endif
+               .pins = (const struct hda_pintbl[]) {
+                       {0x12, 0x90a60140},
+                       {0x14, 0x90170110},
+                       {0x17, 0x40000000},
+                       {0x18, 0x411111f0},
+                       {0x19, 0x411111f0},
+                       {0x1a, 0x411111f0},
+                       {0x1b, 0x411111f0},
+                       {0x1d, 0x40700001},
+                       {0x1e, 0x411111f0},
+                       {0x21, 0x02211020},
+               },
+               .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+       },
+       {}
+};
 
 static void alc269_fill_coef(struct hda_codec *codec)
 {
@@ -4958,6 +5024,7 @@ static int patch_alc269(struct hda_codec *codec)
 
        snd_hda_pick_fixup(codec, alc269_fixup_models,
                       alc269_fixup_tbl, alc269_fixups);
+       snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
        snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
 
        alc_auto_parse_customize_define(codec);
@@ -5414,6 +5481,7 @@ enum {
        ALC662_FIXUP_BASS_1A,
        ALC662_FIXUP_BASS_CHMAP,
        ALC668_FIXUP_AUTO_MUTE,
+       ALC668_FIXUP_DELL_DISABLE_AAMIX,
 };
 
 static const struct hda_fixup alc662_fixups[] = {
@@ -5580,6 +5648,12 @@ static const struct hda_fixup alc662_fixups[] = {
                .type = HDA_FIXUP_FUNC,
                .v.func = alc_fixup_inv_dmic_0x12,
        },
+       [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc_fixup_disable_aamix,
+               .chained = true,
+               .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
+       },
        [ALC668_FIXUP_AUTO_MUTE] = {
                .type = HDA_FIXUP_FUNC,
                .v.func = alc_fixup_auto_mute_via_amp,
@@ -5640,7 +5714,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
        SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
-       SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_DISABLE_AAMIX),
        SND_PCI_QUIRK(0x1028, 0x0623, "Dell", ALC668_FIXUP_AUTO_MUTE),
        SND_PCI_QUIRK(0x1028, 0x0624, "Dell", ALC668_FIXUP_AUTO_MUTE),
        SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),