]> git.ipfire.org Git - thirdparty/kernel/stable.git/blobdiff - sound/pci/hda/patch_realtek.c
Merge tag 'sound-5.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[thirdparty/kernel/stable.git] / sound / pci / hda / patch_realtek.c
index 9742449785094c994f7174a4bad976c2656e0c47..5b3c26991f26b07474a8481b588982432fd7fdbe 100644 (file)
@@ -4120,18 +4120,19 @@ static struct coef_fw alc225_pre_hsmode[] = {
 static void alc_headset_mode_unplugged(struct hda_codec *codec)
 {
        static struct coef_fw coef0255[] = {
+               WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
                WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
                UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
                WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
                WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
                {}
        };
-       static struct coef_fw coef0255_1[] = {
-               WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
-               {}
-       };
        static struct coef_fw coef0256[] = {
                WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
+               WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
+               WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
+               WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
+               UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
                {}
        };
        static struct coef_fw coef0233[] = {
@@ -4194,13 +4195,11 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
 
        switch (codec->core.vendor_id) {
        case 0x10ec0255:
-               alc_process_coef_fw(codec, coef0255_1);
                alc_process_coef_fw(codec, coef0255);
                break;
        case 0x10ec0236:
        case 0x10ec0256:
                alc_process_coef_fw(codec, coef0256);
-               alc_process_coef_fw(codec, coef0255);
                break;
        case 0x10ec0234:
        case 0x10ec0274:
@@ -4253,6 +4252,12 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
                WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
                {}
        };
+       static struct coef_fw coef0256[] = {
+               UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
+               WRITE_COEFEX(0x57, 0x03, 0x09a3),
+               WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
+               {}
+       };
        static struct coef_fw coef0233[] = {
                UPDATE_COEF(0x35, 0, 1<<14),
                WRITE_COEF(0x06, 0x2100),
@@ -4300,14 +4305,19 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
        };
 
        switch (codec->core.vendor_id) {
-       case 0x10ec0236:
        case 0x10ec0255:
-       case 0x10ec0256:
                alc_write_coef_idx(codec, 0x45, 0xc489);
                snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
                alc_process_coef_fw(codec, coef0255);
                snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
                break;
+       case 0x10ec0236:
+       case 0x10ec0256:
+               alc_write_coef_idx(codec, 0x45, 0xc489);
+               snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
+               alc_process_coef_fw(codec, coef0256);
+               snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
+               break;
        case 0x10ec0234:
        case 0x10ec0274:
        case 0x10ec0294:
@@ -4389,6 +4399,14 @@ static void alc_headset_mode_default(struct hda_codec *codec)
                WRITE_COEF(0x49, 0x0049),
                {}
        };
+       static struct coef_fw coef0256[] = {
+               WRITE_COEF(0x45, 0xc489),
+               WRITE_COEFEX(0x57, 0x03, 0x0da3),
+               WRITE_COEF(0x49, 0x0049),
+               UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
+               WRITE_COEF(0x06, 0x6100),
+               {}
+       };
        static struct coef_fw coef0233[] = {
                WRITE_COEF(0x06, 0x2100),
                WRITE_COEF(0x32, 0x4ea3),
@@ -4439,11 +4457,16 @@ static void alc_headset_mode_default(struct hda_codec *codec)
                alc_process_coef_fw(codec, alc225_pre_hsmode);
                alc_process_coef_fw(codec, coef0225);
                break;
-       case 0x10ec0236:
        case 0x10ec0255:
-       case 0x10ec0256:
                alc_process_coef_fw(codec, coef0255);
                break;
+       case 0x10ec0236:
+       case 0x10ec0256:
+               alc_write_coef_idx(codec, 0x1b, 0x0e4b);
+               alc_write_coef_idx(codec, 0x45, 0xc089);
+               msleep(50);
+               alc_process_coef_fw(codec, coef0256);
+               break;
        case 0x10ec0234:
        case 0x10ec0274:
        case 0x10ec0294:
@@ -4487,8 +4510,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
        };
        static struct coef_fw coef0256[] = {
                WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
-               WRITE_COEF(0x1b, 0x0c6b),
-               WRITE_COEFEX(0x57, 0x03, 0x8ea6),
+               WRITE_COEF(0x1b, 0x0e6b),
                {}
        };
        static struct coef_fw coef0233[] = {
@@ -4606,8 +4628,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)
        };
        static struct coef_fw coef0256[] = {
                WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
-               WRITE_COEF(0x1b, 0x0c6b),
-               WRITE_COEFEX(0x57, 0x03, 0x8ea6),
+               WRITE_COEF(0x1b, 0x0e6b),
                {}
        };
        static struct coef_fw coef0233[] = {
@@ -4739,13 +4760,37 @@ static void alc_determine_headset_type(struct hda_codec *codec)
        };
 
        switch (codec->core.vendor_id) {
-       case 0x10ec0236:
        case 0x10ec0255:
+               alc_process_coef_fw(codec, coef0255);
+               msleep(300);
+               val = alc_read_coef_idx(codec, 0x46);
+               is_ctia = (val & 0x0070) == 0x0070;
+               break;
+       case 0x10ec0236:
        case 0x10ec0256:
+               alc_write_coef_idx(codec, 0x1b, 0x0e4b);
+               alc_write_coef_idx(codec, 0x06, 0x6104);
+               alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
+
+               snd_hda_codec_write(codec, 0x21, 0,
+                           AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+               msleep(80);
+               snd_hda_codec_write(codec, 0x21, 0,
+                           AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
+
                alc_process_coef_fw(codec, coef0255);
                msleep(300);
                val = alc_read_coef_idx(codec, 0x46);
                is_ctia = (val & 0x0070) == 0x0070;
+
+               alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
+               alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
+
+               snd_hda_codec_write(codec, 0x21, 0,
+                           AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
+               msleep(80);
+               snd_hda_codec_write(codec, 0x21, 0,
+                           AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
                break;
        case 0x10ec0234:
        case 0x10ec0274:
@@ -6210,15 +6255,13 @@ static const struct hda_fixup alc269_fixups[] = {
                .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
        },
        [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
-               .type = HDA_FIXUP_VERBS,
-               .v.verbs = (const struct hda_verb[]) {
-                       /* Enable the Mic */
-                       { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
-                       { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
-                       {}
+               .type = HDA_FIXUP_PINS,
+               .v.pins = (const struct hda_pintbl[]) {
+                       { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
+                       { }
                },
                .chained = true,
-               .chain_id = ALC269_FIXUP_LIFEBOOK_EXTMIC
+               .chain_id = ALC255_FIXUP_HEADSET_MODE
        },
        [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
                .type = HDA_FIXUP_PINS,
@@ -7262,10 +7305,6 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
                {0x18, 0x02a11030},
                {0x19, 0x0181303F},
                {0x21, 0x0221102f}),
-       SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
-               {0x12, 0x90a60140},
-               {0x14, 0x90170120},
-               {0x21, 0x02211030}),
        SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
                {0x12, 0x90a601c0},
                {0x14, 0x90171120},