diff options
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 127 |
1 files changed, 104 insertions, 23 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 141ff446104..f628c33d80b 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1097,6 +1097,16 @@ static void alc889_coef_init(struct hda_codec *codec) | |||
1097 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); | 1097 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | /* turn on/off EAPD control (only if available) */ | ||
1101 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) | ||
1102 | { | ||
1103 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) | ||
1104 | return; | ||
1105 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) | ||
1106 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | ||
1107 | on ? 2 : 0); | ||
1108 | } | ||
1109 | |||
1100 | static void alc_auto_init_amp(struct hda_codec *codec, int type) | 1110 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
1101 | { | 1111 | { |
1102 | unsigned int tmp; | 1112 | unsigned int tmp; |
@@ -1114,25 +1124,22 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) | |||
1114 | case ALC_INIT_DEFAULT: | 1124 | case ALC_INIT_DEFAULT: |
1115 | switch (codec->vendor_id) { | 1125 | switch (codec->vendor_id) { |
1116 | case 0x10ec0260: | 1126 | case 0x10ec0260: |
1117 | snd_hda_codec_write(codec, 0x0f, 0, | 1127 | set_eapd(codec, 0x0f, 1); |
1118 | AC_VERB_SET_EAPD_BTLENABLE, 2); | 1128 | set_eapd(codec, 0x10, 1); |
1119 | snd_hda_codec_write(codec, 0x10, 0, | ||
1120 | AC_VERB_SET_EAPD_BTLENABLE, 2); | ||
1121 | break; | 1129 | break; |
1122 | case 0x10ec0262: | 1130 | case 0x10ec0262: |
1123 | case 0x10ec0267: | 1131 | case 0x10ec0267: |
1124 | case 0x10ec0268: | 1132 | case 0x10ec0268: |
1125 | case 0x10ec0269: | 1133 | case 0x10ec0269: |
1134 | case 0x10ec0270: | ||
1126 | case 0x10ec0272: | 1135 | case 0x10ec0272: |
1127 | case 0x10ec0660: | 1136 | case 0x10ec0660: |
1128 | case 0x10ec0662: | 1137 | case 0x10ec0662: |
1129 | case 0x10ec0663: | 1138 | case 0x10ec0663: |
1130 | case 0x10ec0862: | 1139 | case 0x10ec0862: |
1131 | case 0x10ec0889: | 1140 | case 0x10ec0889: |
1132 | snd_hda_codec_write(codec, 0x14, 0, | 1141 | set_eapd(codec, 0x14, 1); |
1133 | AC_VERB_SET_EAPD_BTLENABLE, 2); | 1142 | set_eapd(codec, 0x15, 1); |
1134 | snd_hda_codec_write(codec, 0x15, 0, | ||
1135 | AC_VERB_SET_EAPD_BTLENABLE, 2); | ||
1136 | break; | 1143 | break; |
1137 | } | 1144 | } |
1138 | switch (codec->vendor_id) { | 1145 | switch (codec->vendor_id) { |
@@ -1234,6 +1241,8 @@ static void alc_init_auto_mic(struct hda_codec *codec) | |||
1234 | return; /* invalid entry */ | 1241 | return; /* invalid entry */ |
1235 | } | 1242 | } |
1236 | } | 1243 | } |
1244 | if (!ext || !fixed) | ||
1245 | return; | ||
1237 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) | 1246 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
1238 | return; /* no unsol support */ | 1247 | return; /* no unsol support */ |
1239 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", | 1248 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
@@ -4917,6 +4926,49 @@ static void fixup_automic_adc(struct hda_codec *codec) | |||
4917 | spec->auto_mic = 0; /* disable auto-mic to be sure */ | 4926 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
4918 | } | 4927 | } |
4919 | 4928 | ||
4929 | /* choose the ADC/MUX containing the input pin and initialize the setup */ | ||
4930 | static void fixup_single_adc(struct hda_codec *codec) | ||
4931 | { | ||
4932 | struct alc_spec *spec = codec->spec; | ||
4933 | hda_nid_t pin; | ||
4934 | int i; | ||
4935 | |||
4936 | /* search for the input pin; there must be only one */ | ||
4937 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
4938 | if (spec->autocfg.input_pins[i]) { | ||
4939 | pin = spec->autocfg.input_pins[i]; | ||
4940 | break; | ||
4941 | } | ||
4942 | } | ||
4943 | if (!pin) | ||
4944 | return; | ||
4945 | |||
4946 | /* set the default connection to that pin */ | ||
4947 | for (i = 0; i < spec->num_adc_nids; i++) { | ||
4948 | hda_nid_t cap = spec->capsrc_nids ? | ||
4949 | spec->capsrc_nids[i] : spec->adc_nids[i]; | ||
4950 | int idx; | ||
4951 | |||
4952 | idx = get_connection_index(codec, cap, pin); | ||
4953 | if (idx < 0) | ||
4954 | continue; | ||
4955 | /* use only this ADC */ | ||
4956 | if (spec->capsrc_nids) | ||
4957 | spec->capsrc_nids += i; | ||
4958 | spec->adc_nids += i; | ||
4959 | spec->num_adc_nids = 1; | ||
4960 | /* select or unmute this route */ | ||
4961 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { | ||
4962 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, | ||
4963 | HDA_AMP_MUTE, 0); | ||
4964 | } else { | ||
4965 | snd_hda_codec_write_cache(codec, cap, 0, | ||
4966 | AC_VERB_SET_CONNECT_SEL, idx); | ||
4967 | } | ||
4968 | return; | ||
4969 | } | ||
4970 | } | ||
4971 | |||
4920 | static void set_capture_mixer(struct hda_codec *codec) | 4972 | static void set_capture_mixer(struct hda_codec *codec) |
4921 | { | 4973 | { |
4922 | struct alc_spec *spec = codec->spec; | 4974 | struct alc_spec *spec = codec->spec; |
@@ -4929,14 +4981,15 @@ static void set_capture_mixer(struct hda_codec *codec) | |||
4929 | alc_capture_mixer3 }, | 4981 | alc_capture_mixer3 }, |
4930 | }; | 4982 | }; |
4931 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { | 4983 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
4932 | int mux; | 4984 | int mux = 0; |
4933 | if (spec->auto_mic) { | 4985 | if (spec->auto_mic) |
4934 | mux = 0; | ||
4935 | fixup_automic_adc(codec); | 4986 | fixup_automic_adc(codec); |
4936 | } else if (spec->input_mux && spec->input_mux->num_items > 1) | 4987 | else if (spec->input_mux) { |
4937 | mux = 1; | 4988 | if (spec->input_mux->num_items > 1) |
4938 | else | 4989 | mux = 1; |
4939 | mux = 0; | 4990 | else if (spec->input_mux->num_items == 1) |
4991 | fixup_single_adc(codec); | ||
4992 | } | ||
4940 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; | 4993 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
4941 | } | 4994 | } |
4942 | } | 4995 | } |
@@ -7201,8 +7254,8 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = { | |||
7201 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | 7254 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
7202 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | 7255 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
7203 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | 7256 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
7204 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | 7257 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
7205 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), | 7258 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
7206 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | 7259 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
7207 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | 7260 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
7208 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 7261 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
@@ -7603,6 +7656,7 @@ static struct hda_verb alc885_mb5_init_verbs[] = { | |||
7603 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 7656 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
7604 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 7657 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
7605 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | 7658 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
7659 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
7606 | /* Front Mic pin: input vref at 80% */ | 7660 | /* Front Mic pin: input vref at 80% */ |
7607 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 7661 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
7608 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 7662 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
@@ -7787,6 +7841,27 @@ static void alc885_mbp3_setup(struct hda_codec *codec) | |||
7787 | spec->autocfg.speaker_pins[0] = 0x14; | 7841 | spec->autocfg.speaker_pins[0] = 0x14; |
7788 | } | 7842 | } |
7789 | 7843 | ||
7844 | static void alc885_mb5_automute(struct hda_codec *codec) | ||
7845 | { | ||
7846 | unsigned int present; | ||
7847 | |||
7848 | present = snd_hda_codec_read(codec, 0x14, 0, | ||
7849 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
7850 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, | ||
7851 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
7852 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | ||
7853 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
7854 | |||
7855 | } | ||
7856 | |||
7857 | static void alc885_mb5_unsol_event(struct hda_codec *codec, | ||
7858 | unsigned int res) | ||
7859 | { | ||
7860 | /* Headphone insertion or removal. */ | ||
7861 | if ((res >> 26) == ALC880_HP_EVENT) | ||
7862 | alc885_mb5_automute(codec); | ||
7863 | } | ||
7864 | |||
7790 | static void alc885_imac91_automute(struct hda_codec *codec) | 7865 | static void alc885_imac91_automute(struct hda_codec *codec) |
7791 | { | 7866 | { |
7792 | unsigned int present; | 7867 | unsigned int present; |
@@ -9233,6 +9308,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
9233 | .input_mux = &mb5_capture_source, | 9308 | .input_mux = &mb5_capture_source, |
9234 | .dig_out_nid = ALC882_DIGOUT_NID, | 9309 | .dig_out_nid = ALC882_DIGOUT_NID, |
9235 | .dig_in_nid = ALC882_DIGIN_NID, | 9310 | .dig_in_nid = ALC882_DIGIN_NID, |
9311 | .unsol_event = alc885_mb5_unsol_event, | ||
9312 | .init_hook = alc885_mb5_automute, | ||
9236 | }, | 9313 | }, |
9237 | [ALC885_MACPRO] = { | 9314 | [ALC885_MACPRO] = { |
9238 | .mixers = { alc882_macpro_mixer }, | 9315 | .mixers = { alc882_macpro_mixer }, |
@@ -9510,6 +9587,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9510 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | 9587 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
9511 | .channel_mode = alc883_3ST_6ch_modes, | 9588 | .channel_mode = alc883_3ST_6ch_modes, |
9512 | .need_dac_fix = 1, | 9589 | .need_dac_fix = 1, |
9590 | .const_channel_count = 6, | ||
9513 | .num_mux_defs = | 9591 | .num_mux_defs = |
9514 | ARRAY_SIZE(alc888_2_capture_sources), | 9592 | ARRAY_SIZE(alc888_2_capture_sources), |
9515 | .input_mux = alc888_2_capture_sources, | 9593 | .input_mux = alc888_2_capture_sources, |
@@ -10420,7 +10498,7 @@ static void alc262_hp_t5735_setup(struct hda_codec *codec) | |||
10420 | struct alc_spec *spec = codec->spec; | 10498 | struct alc_spec *spec = codec->spec; |
10421 | 10499 | ||
10422 | spec->autocfg.hp_pins[0] = 0x15; | 10500 | spec->autocfg.hp_pins[0] = 0x15; |
10423 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ | 10501 | spec->autocfg.speaker_pins[0] = 0x14; |
10424 | } | 10502 | } |
10425 | 10503 | ||
10426 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | 10504 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
@@ -11310,7 +11388,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
11310 | } | 11388 | } |
11311 | 11389 | ||
11312 | #define alc262_auto_create_input_ctls \ | 11390 | #define alc262_auto_create_input_ctls \ |
11313 | alc880_auto_create_input_ctls | 11391 | alc882_auto_create_input_ctls |
11314 | 11392 | ||
11315 | /* | 11393 | /* |
11316 | * generic initialization of ADC, input mixers and output mixers | 11394 | * generic initialization of ADC, input mixers and output mixers |
@@ -11849,9 +11927,9 @@ static struct alc_config_preset alc262_presets[] = { | |||
11849 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | 11927 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
11850 | .channel_mode = alc262_modes, | 11928 | .channel_mode = alc262_modes, |
11851 | .input_mux = &alc262_capture_source, | 11929 | .input_mux = &alc262_capture_source, |
11852 | .unsol_event = alc_automute_amp_unsol_event, | 11930 | .unsol_event = alc_sku_unsol_event, |
11853 | .setup = alc262_hp_t5735_setup, | 11931 | .setup = alc262_hp_t5735_setup, |
11854 | .init_hook = alc_automute_amp, | 11932 | .init_hook = alc_inithook, |
11855 | }, | 11933 | }, |
11856 | [ALC262_HP_RP5700] = { | 11934 | [ALC262_HP_RP5700] = { |
11857 | .mixers = { alc262_hp_rp5700_mixer }, | 11935 | .mixers = { alc262_hp_rp5700_mixer }, |
@@ -12605,6 +12683,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |||
12605 | dac = 0x02; | 12683 | dac = 0x02; |
12606 | break; | 12684 | break; |
12607 | case 0x15: | 12685 | case 0x15: |
12686 | case 0x21: | ||
12608 | dac = 0x03; | 12687 | dac = 0x03; |
12609 | break; | 12688 | break; |
12610 | default: | 12689 | default: |
@@ -14991,6 +15070,8 @@ static int patch_alc861(struct hda_codec *codec) | |||
14991 | spec->stream_digital_playback = &alc861_pcm_digital_playback; | 15070 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
14992 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | 15071 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
14993 | 15072 | ||
15073 | if (!spec->cap_mixer) | ||
15074 | set_capture_mixer(codec); | ||
14994 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); | 15075 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
14995 | 15076 | ||
14996 | spec->vmaster_nid = 0x03; | 15077 | spec->vmaster_nid = 0x03; |
@@ -15633,7 +15714,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15633 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, | 15714 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
15634 | const struct auto_pin_cfg *cfg) | 15715 | const struct auto_pin_cfg *cfg) |
15635 | { | 15716 | { |
15636 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); | 15717 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0); |
15637 | } | 15718 | } |
15638 | 15719 | ||
15639 | 15720 | ||
@@ -17391,7 +17472,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = { | |||
17391 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | 17472 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
17392 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", | 17473 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
17393 | ALC662_3ST_6ch_DIG), | 17474 | ALC662_3ST_6ch_DIG), |
17394 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4), | 17475 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
17395 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), | 17476 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
17396 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", | 17477 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
17397 | ALC662_3ST_6ch_DIG), | 17478 | ALC662_3ST_6ch_DIG), |