ALSA: hda/realtek - Add HW8326 support
[linux-2.6-microblaze.git] / sound / pci / hda / patch_realtek.c
index 4ef5aa2..7170e08 100644 (file)
@@ -443,6 +443,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
        case 0x10ec0245:
        case 0x10ec0255:
        case 0x10ec0256:
+       case 0x19e58326:
        case 0x10ec0257:
        case 0x10ec0282:
        case 0x10ec0283:
@@ -580,6 +581,7 @@ static void alc_shutup_pins(struct hda_codec *codec)
        switch (codec->core.vendor_id) {
        case 0x10ec0236:
        case 0x10ec0256:
+       case 0x19e58326:
        case 0x10ec0283:
        case 0x10ec0286:
        case 0x10ec0288:
@@ -1981,6 +1983,7 @@ enum {
        ALC1220_FIXUP_CLEVO_PB51ED_PINS,
        ALC887_FIXUP_ASUS_AUDIO,
        ALC887_FIXUP_ASUS_HMIC,
+       ALCS1200A_FIXUP_MIC_VREF,
 };
 
 static void alc889_fixup_coef(struct hda_codec *codec,
@@ -2526,6 +2529,14 @@ static const struct hda_fixup alc882_fixups[] = {
                .chained = true,
                .chain_id = ALC887_FIXUP_ASUS_AUDIO,
        },
+       [ALCS1200A_FIXUP_MIC_VREF] = {
+               .type = HDA_FIXUP_PINCTLS,
+               .v.pins = (const struct hda_pintbl[]) {
+                       { 0x18, PIN_VREF50 }, /* rear mic */
+                       { 0x19, PIN_VREF50 }, /* front mic */
+                       {}
+               }
+       },
 };
 
 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -2563,6 +2574,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
        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),
+       SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
        SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
        SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
        SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
@@ -3131,6 +3143,7 @@ enum {
        ALC269_TYPE_ALC257,
        ALC269_TYPE_ALC215,
        ALC269_TYPE_ALC225,
+       ALC269_TYPE_ALC245,
        ALC269_TYPE_ALC287,
        ALC269_TYPE_ALC294,
        ALC269_TYPE_ALC300,
@@ -3168,6 +3181,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
        case ALC269_TYPE_ALC257:
        case ALC269_TYPE_ALC215:
        case ALC269_TYPE_ALC225:
+       case ALC269_TYPE_ALC245:
        case ALC269_TYPE_ALC287:
        case ALC269_TYPE_ALC294:
        case ALC269_TYPE_ALC300:
@@ -3235,6 +3249,7 @@ static void alc_disable_headset_jack_key(struct hda_codec *codec)
        case 0x10ec0230:
        case 0x10ec0236:
        case 0x10ec0256:
+       case 0x19e58326:
                alc_write_coef_idx(codec, 0x48, 0x0);
                alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
                break;
@@ -3263,6 +3278,7 @@ static void alc_enable_headset_jack_key(struct hda_codec *codec)
        case 0x10ec0230:
        case 0x10ec0236:
        case 0x10ec0256:
+       case 0x19e58326:
                alc_write_coef_idx(codec, 0x48, 0xd011);
                alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
                break;
@@ -3695,7 +3711,8 @@ static void alc225_init(struct hda_codec *codec)
        hda_nid_t hp_pin = alc_get_hp_pin(spec);
        bool hp1_pin_sense, hp2_pin_sense;
 
-       if (spec->codec_variant != ALC269_TYPE_ALC287)
+       if (spec->codec_variant != ALC269_TYPE_ALC287 &&
+               spec->codec_variant != ALC269_TYPE_ALC245)
                /* required only at boot or S3 and S4 resume time */
                if (!spec->done_hp_init ||
                        is_s3_resume(codec) ||
@@ -4897,6 +4914,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
        case 0x10ec0230:
        case 0x10ec0236:
        case 0x10ec0256:
+       case 0x19e58326:
                alc_process_coef_fw(codec, coef0256);
                break;
        case 0x10ec0234:
@@ -5012,6 +5030,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
        case 0x10ec0230:
        case 0x10ec0236:
        case 0x10ec0256:
+       case 0x19e58326:
                alc_write_coef_idx(codec, 0x45, 0xc489);
                snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
                alc_process_coef_fw(codec, coef0256);
@@ -5162,6 +5181,7 @@ static void alc_headset_mode_default(struct hda_codec *codec)
        case 0x10ec0230:
        case 0x10ec0236:
        case 0x10ec0256:
+       case 0x19e58326:
                alc_write_coef_idx(codec, 0x1b, 0x0e4b);
                alc_write_coef_idx(codec, 0x45, 0xc089);
                msleep(50);
@@ -5261,6 +5281,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
        case 0x10ec0230:
        case 0x10ec0236:
        case 0x10ec0256:
+       case 0x19e58326:
                alc_process_coef_fw(codec, coef0256);
                break;
        case 0x10ec0234:
@@ -5375,6 +5396,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)
        case 0x10ec0230:
        case 0x10ec0236:
        case 0x10ec0256:
+       case 0x19e58326:
                alc_process_coef_fw(codec, coef0256);
                break;
        case 0x10ec0234:
@@ -5476,6 +5498,7 @@ static void alc_determine_headset_type(struct hda_codec *codec)
        case 0x10ec0230:
        case 0x10ec0236:
        case 0x10ec0256:
+       case 0x19e58326:
                alc_write_coef_idx(codec, 0x1b, 0x0e4b);
                alc_write_coef_idx(codec, 0x06, 0x6104);
                alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
@@ -5770,6 +5793,7 @@ static void alc255_set_default_jack_type(struct hda_codec *codec)
        case 0x10ec0230:
        case 0x10ec0236:
        case 0x10ec0256:
+       case 0x19e58326:
                alc_process_coef_fw(codec, alc256fw);
                break;
        }
@@ -6372,6 +6396,7 @@ static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
        case 0x10ec0236:
        case 0x10ec0255:
        case 0x10ec0256:
+       case 0x19e58326:
                alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
                alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
                break;
@@ -8902,6 +8927,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
        SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
        SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
@@ -9244,6 +9270,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
        SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
        SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
+       SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
        SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
        SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
        SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
@@ -10081,6 +10108,7 @@ static int patch_alc269(struct hda_codec *codec)
        case 0x10ec0230:
        case 0x10ec0236:
        case 0x10ec0256:
+       case 0x19e58326:
                spec->codec_variant = ALC269_TYPE_ALC256;
                spec->shutup = alc256_shutup;
                spec->init_hook = alc256_init;
@@ -10096,7 +10124,10 @@ static int patch_alc269(struct hda_codec *codec)
        case 0x10ec0245:
        case 0x10ec0285:
        case 0x10ec0289:
-               spec->codec_variant = ALC269_TYPE_ALC215;
+               if (alc_get_coef0(codec) & 0x0010)
+                       spec->codec_variant = ALC269_TYPE_ALC245;
+               else
+                       spec->codec_variant = ALC269_TYPE_ALC215;
                spec->shutup = alc225_shutup;
                spec->init_hook = alc225_init;
                spec->gen.mixer_nid = 0;
@@ -11528,6 +11559,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
        HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
        HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
        HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
+       HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
        {} /* terminator */
 };
 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);