diff options
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 4144 |
1 files changed, 2034 insertions, 2110 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 30eeb304351c..7ed47f66ddd1 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -208,12 +208,6 @@ enum { | |||
208 | ALC885_MBP3, | 208 | ALC885_MBP3, |
209 | ALC885_MB5, | 209 | ALC885_MB5, |
210 | ALC885_IMAC24, | 210 | ALC885_IMAC24, |
211 | ALC882_AUTO, | ||
212 | ALC882_MODEL_LAST, | ||
213 | }; | ||
214 | |||
215 | /* ALC883 models */ | ||
216 | enum { | ||
217 | ALC883_3ST_2ch_DIG, | 211 | ALC883_3ST_2ch_DIG, |
218 | ALC883_3ST_6ch_DIG, | 212 | ALC883_3ST_6ch_DIG, |
219 | ALC883_3ST_6ch, | 213 | ALC883_3ST_6ch, |
@@ -226,6 +220,7 @@ enum { | |||
226 | ALC888_ACER_ASPIRE_4930G, | 220 | ALC888_ACER_ASPIRE_4930G, |
227 | ALC888_ACER_ASPIRE_6530G, | 221 | ALC888_ACER_ASPIRE_6530G, |
228 | ALC888_ACER_ASPIRE_8930G, | 222 | ALC888_ACER_ASPIRE_8930G, |
223 | ALC888_ACER_ASPIRE_7730G, | ||
229 | ALC883_MEDION, | 224 | ALC883_MEDION, |
230 | ALC883_MEDION_MD2, | 225 | ALC883_MEDION_MD2, |
231 | ALC883_LAPTOP_EAPD, | 226 | ALC883_LAPTOP_EAPD, |
@@ -237,17 +232,20 @@ enum { | |||
237 | ALC888_3ST_HP, | 232 | ALC888_3ST_HP, |
238 | ALC888_6ST_DELL, | 233 | ALC888_6ST_DELL, |
239 | ALC883_MITAC, | 234 | ALC883_MITAC, |
235 | ALC883_CLEVO_M540R, | ||
240 | ALC883_CLEVO_M720, | 236 | ALC883_CLEVO_M720, |
241 | ALC883_FUJITSU_PI2515, | 237 | ALC883_FUJITSU_PI2515, |
242 | ALC888_FUJITSU_XA3530, | 238 | ALC888_FUJITSU_XA3530, |
243 | ALC883_3ST_6ch_INTEL, | 239 | ALC883_3ST_6ch_INTEL, |
240 | ALC889A_INTEL, | ||
241 | ALC889_INTEL, | ||
244 | ALC888_ASUS_M90V, | 242 | ALC888_ASUS_M90V, |
245 | ALC888_ASUS_EEE1601, | 243 | ALC888_ASUS_EEE1601, |
246 | ALC889A_MB31, | 244 | ALC889A_MB31, |
247 | ALC1200_ASUS_P5Q, | 245 | ALC1200_ASUS_P5Q, |
248 | ALC883_SONY_VAIO_TT, | 246 | ALC883_SONY_VAIO_TT, |
249 | ALC883_AUTO, | 247 | ALC882_AUTO, |
250 | ALC883_MODEL_LAST, | 248 | ALC882_MODEL_LAST, |
251 | }; | 249 | }; |
252 | 250 | ||
253 | /* for GPIO Poll */ | 251 | /* for GPIO Poll */ |
@@ -262,6 +260,14 @@ enum { | |||
262 | ALC_INIT_GPIO3, | 260 | ALC_INIT_GPIO3, |
263 | }; | 261 | }; |
264 | 262 | ||
263 | struct alc_mic_route { | ||
264 | hda_nid_t pin; | ||
265 | unsigned char mux_idx; | ||
266 | unsigned char amix_idx; | ||
267 | }; | ||
268 | |||
269 | #define MUX_IDX_UNDEF ((unsigned char)-1) | ||
270 | |||
265 | struct alc_spec { | 271 | struct alc_spec { |
266 | /* codec parameterization */ | 272 | /* codec parameterization */ |
267 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ | 273 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
@@ -304,6 +310,8 @@ struct alc_spec { | |||
304 | unsigned int num_mux_defs; | 310 | unsigned int num_mux_defs; |
305 | const struct hda_input_mux *input_mux; | 311 | const struct hda_input_mux *input_mux; |
306 | unsigned int cur_mux[3]; | 312 | unsigned int cur_mux[3]; |
313 | struct alc_mic_route ext_mic; | ||
314 | struct alc_mic_route int_mic; | ||
307 | 315 | ||
308 | /* channel model */ | 316 | /* channel model */ |
309 | const struct hda_channel_mode *channel_mode; | 317 | const struct hda_channel_mode *channel_mode; |
@@ -320,6 +328,8 @@ struct alc_spec { | |||
320 | struct snd_array kctls; | 328 | struct snd_array kctls; |
321 | struct hda_input_mux private_imux[3]; | 329 | struct hda_input_mux private_imux[3]; |
322 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; | 330 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
331 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; | ||
332 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; | ||
323 | 333 | ||
324 | /* hooks */ | 334 | /* hooks */ |
325 | void (*init_hook)(struct hda_codec *codec); | 335 | void (*init_hook)(struct hda_codec *codec); |
@@ -329,6 +339,7 @@ struct alc_spec { | |||
329 | unsigned int sense_updated: 1; | 339 | unsigned int sense_updated: 1; |
330 | unsigned int jack_present: 1; | 340 | unsigned int jack_present: 1; |
331 | unsigned int master_sw: 1; | 341 | unsigned int master_sw: 1; |
342 | unsigned int auto_mic:1; | ||
332 | 343 | ||
333 | /* other flags */ | 344 | /* other flags */ |
334 | unsigned int no_analog :1; /* digital I/O only */ | 345 | unsigned int no_analog :1; /* digital I/O only */ |
@@ -370,6 +381,7 @@ struct alc_config_preset { | |||
370 | unsigned int num_mux_defs; | 381 | unsigned int num_mux_defs; |
371 | const struct hda_input_mux *input_mux; | 382 | const struct hda_input_mux *input_mux; |
372 | void (*unsol_event)(struct hda_codec *, unsigned int); | 383 | void (*unsol_event)(struct hda_codec *, unsigned int); |
384 | void (*setup)(struct hda_codec *); | ||
373 | void (*init_hook)(struct hda_codec *); | 385 | void (*init_hook)(struct hda_codec *); |
374 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 386 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
375 | struct hda_amp_list *loopbacks; | 387 | struct hda_amp_list *loopbacks; |
@@ -417,7 +429,7 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
417 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | 429 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
418 | imux = &spec->input_mux[mux_idx]; | 430 | imux = &spec->input_mux[mux_idx]; |
419 | 431 | ||
420 | type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 432 | type = get_wcaps_type(get_wcaps(codec, nid)); |
421 | if (type == AC_WID_AUD_MIX) { | 433 | if (type == AC_WID_AUD_MIX) { |
422 | /* Matrix-mixer style (e.g. ALC882) */ | 434 | /* Matrix-mixer style (e.g. ALC882) */ |
423 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | 435 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
@@ -842,9 +854,10 @@ static void print_realtek_coef(struct snd_info_buffer *buffer, | |||
842 | /* | 854 | /* |
843 | * set up from the preset table | 855 | * set up from the preset table |
844 | */ | 856 | */ |
845 | static void setup_preset(struct alc_spec *spec, | 857 | static void setup_preset(struct hda_codec *codec, |
846 | const struct alc_config_preset *preset) | 858 | const struct alc_config_preset *preset) |
847 | { | 859 | { |
860 | struct alc_spec *spec = codec->spec; | ||
848 | int i; | 861 | int i; |
849 | 862 | ||
850 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | 863 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
@@ -886,6 +899,9 @@ static void setup_preset(struct alc_spec *spec, | |||
886 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 899 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
887 | spec->loopback.amplist = preset->loopbacks; | 900 | spec->loopback.amplist = preset->loopbacks; |
888 | #endif | 901 | #endif |
902 | |||
903 | if (preset->setup) | ||
904 | preset->setup(codec); | ||
889 | } | 905 | } |
890 | 906 | ||
891 | /* Enable GPIO mask and set output */ | 907 | /* Enable GPIO mask and set output */ |
@@ -965,30 +981,64 @@ static void alc_automute_pin(struct hda_codec *codec) | |||
965 | } | 981 | } |
966 | } | 982 | } |
967 | 983 | ||
968 | #if 0 /* it's broken in some cases -- temporarily disabled */ | 984 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
985 | hda_nid_t nid) | ||
986 | { | ||
987 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | ||
988 | int i, nums; | ||
989 | |||
990 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); | ||
991 | for (i = 0; i < nums; i++) | ||
992 | if (conn[i] == nid) | ||
993 | return i; | ||
994 | return -1; | ||
995 | } | ||
996 | |||
969 | static void alc_mic_automute(struct hda_codec *codec) | 997 | static void alc_mic_automute(struct hda_codec *codec) |
970 | { | 998 | { |
971 | struct alc_spec *spec = codec->spec; | 999 | struct alc_spec *spec = codec->spec; |
972 | unsigned int present; | 1000 | struct alc_mic_route *dead, *alive; |
973 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | 1001 | unsigned int present, type; |
974 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | 1002 | hda_nid_t cap_nid; |
975 | unsigned int mix_nid = spec->capsrc_nids[0]; | 1003 | |
976 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; | 1004 | if (!spec->auto_mic) |
977 | 1005 | return; | |
978 | capsrc_idx_mic = mic_nid - 0x18; | 1006 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
979 | capsrc_idx_fmic = fmic_nid - 0x18; | 1007 | return; |
980 | present = snd_hda_codec_read(codec, mic_nid, 0, | 1008 | if (snd_BUG_ON(!spec->adc_nids)) |
981 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 1009 | return; |
982 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 1010 | |
983 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); | 1011 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
984 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 1012 | |
985 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); | 1013 | present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0, |
986 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, | 1014 | AC_VERB_GET_PIN_SENSE, 0); |
987 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | 1015 | present &= AC_PINSENSE_PRESENCE; |
1016 | if (present) { | ||
1017 | alive = &spec->ext_mic; | ||
1018 | dead = &spec->int_mic; | ||
1019 | } else { | ||
1020 | alive = &spec->int_mic; | ||
1021 | dead = &spec->ext_mic; | ||
1022 | } | ||
1023 | |||
1024 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); | ||
1025 | if (type == AC_WID_AUD_MIX) { | ||
1026 | /* Matrix-mixer style (e.g. ALC882) */ | ||
1027 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | ||
1028 | alive->mux_idx, | ||
1029 | HDA_AMP_MUTE, 0); | ||
1030 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | ||
1031 | dead->mux_idx, | ||
1032 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
1033 | } else { | ||
1034 | /* MUX style (e.g. ALC880) */ | ||
1035 | snd_hda_codec_write_cache(codec, cap_nid, 0, | ||
1036 | AC_VERB_SET_CONNECT_SEL, | ||
1037 | alive->mux_idx); | ||
1038 | } | ||
1039 | |||
1040 | /* FIXME: analog mixer */ | ||
988 | } | 1041 | } |
989 | #else | ||
990 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ | ||
991 | #endif /* disabled */ | ||
992 | 1042 | ||
993 | /* unsolicited event for HP jack sensing */ | 1043 | /* unsolicited event for HP jack sensing */ |
994 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | 1044 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
@@ -1031,6 +1081,16 @@ static void alc888_coef_init(struct hda_codec *codec) | |||
1031 | AC_VERB_SET_PROC_COEF, 0x3030); | 1081 | AC_VERB_SET_PROC_COEF, 0x3030); |
1032 | } | 1082 | } |
1033 | 1083 | ||
1084 | static void alc889_coef_init(struct hda_codec *codec) | ||
1085 | { | ||
1086 | unsigned int tmp; | ||
1087 | |||
1088 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | ||
1089 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | ||
1090 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | ||
1091 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); | ||
1092 | } | ||
1093 | |||
1034 | static void alc_auto_init_amp(struct hda_codec *codec, int type) | 1094 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
1035 | { | 1095 | { |
1036 | unsigned int tmp; | 1096 | unsigned int tmp; |
@@ -1088,15 +1148,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) | |||
1088 | case 0x10ec0885: | 1148 | case 0x10ec0885: |
1089 | case 0x10ec0887: | 1149 | case 0x10ec0887: |
1090 | case 0x10ec0889: | 1150 | case 0x10ec0889: |
1091 | snd_hda_codec_write(codec, 0x20, 0, | 1151 | alc889_coef_init(codec); |
1092 | AC_VERB_SET_COEF_INDEX, 7); | ||
1093 | tmp = snd_hda_codec_read(codec, 0x20, 0, | ||
1094 | AC_VERB_GET_PROC_COEF, 0); | ||
1095 | snd_hda_codec_write(codec, 0x20, 0, | ||
1096 | AC_VERB_SET_COEF_INDEX, 7); | ||
1097 | snd_hda_codec_write(codec, 0x20, 0, | ||
1098 | AC_VERB_SET_PROC_COEF, | ||
1099 | tmp | 0x2010); | ||
1100 | break; | 1152 | break; |
1101 | case 0x10ec0888: | 1153 | case 0x10ec0888: |
1102 | alc888_coef_init(codec); | 1154 | alc888_coef_init(codec); |
@@ -1142,6 +1194,55 @@ static void alc_init_auto_hp(struct hda_codec *codec) | |||
1142 | spec->unsol_event = alc_sku_unsol_event; | 1194 | spec->unsol_event = alc_sku_unsol_event; |
1143 | } | 1195 | } |
1144 | 1196 | ||
1197 | static void alc_init_auto_mic(struct hda_codec *codec) | ||
1198 | { | ||
1199 | struct alc_spec *spec = codec->spec; | ||
1200 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
1201 | hda_nid_t fixed, ext; | ||
1202 | int i; | ||
1203 | |||
1204 | /* there must be only two mic inputs exclusively */ | ||
1205 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) | ||
1206 | if (cfg->input_pins[i]) | ||
1207 | return; | ||
1208 | |||
1209 | fixed = ext = 0; | ||
1210 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { | ||
1211 | hda_nid_t nid = cfg->input_pins[i]; | ||
1212 | unsigned int defcfg; | ||
1213 | if (!nid) | ||
1214 | return; | ||
1215 | defcfg = snd_hda_codec_get_pincfg(codec, nid); | ||
1216 | switch (get_defcfg_connect(defcfg)) { | ||
1217 | case AC_JACK_PORT_FIXED: | ||
1218 | if (fixed) | ||
1219 | return; /* already occupied */ | ||
1220 | fixed = nid; | ||
1221 | break; | ||
1222 | case AC_JACK_PORT_COMPLEX: | ||
1223 | if (ext) | ||
1224 | return; /* already occupied */ | ||
1225 | ext = nid; | ||
1226 | break; | ||
1227 | default: | ||
1228 | return; /* invalid entry */ | ||
1229 | } | ||
1230 | } | ||
1231 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) | ||
1232 | return; /* no unsol support */ | ||
1233 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", | ||
1234 | ext, fixed); | ||
1235 | spec->ext_mic.pin = ext; | ||
1236 | spec->int_mic.pin = fixed; | ||
1237 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | ||
1238 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | ||
1239 | spec->auto_mic = 1; | ||
1240 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, | ||
1241 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
1242 | AC_USRSP_EN | ALC880_MIC_EVENT); | ||
1243 | spec->unsol_event = alc_sku_unsol_event; | ||
1244 | } | ||
1245 | |||
1145 | /* check subsystem ID and set up device-specific initialization; | 1246 | /* check subsystem ID and set up device-specific initialization; |
1146 | * return 1 if initialized, 0 if invalid SSID | 1247 | * return 1 if initialized, 0 if invalid SSID |
1147 | */ | 1248 | */ |
@@ -1243,6 +1344,7 @@ do_sku: | |||
1243 | } | 1344 | } |
1244 | 1345 | ||
1245 | alc_init_auto_hp(codec); | 1346 | alc_init_auto_hp(codec); |
1347 | alc_init_auto_mic(codec); | ||
1246 | return 1; | 1348 | return 1; |
1247 | } | 1349 | } |
1248 | 1350 | ||
@@ -1255,6 +1357,7 @@ static void alc_ssid_check(struct hda_codec *codec, | |||
1255 | "Enable default setup for auto mode as fallback\n"); | 1357 | "Enable default setup for auto mode as fallback\n"); |
1256 | spec->init_amp = ALC_INIT_DEFAULT; | 1358 | spec->init_amp = ALC_INIT_DEFAULT; |
1257 | alc_init_auto_hp(codec); | 1359 | alc_init_auto_hp(codec); |
1360 | alc_init_auto_mic(codec); | ||
1258 | } | 1361 | } |
1259 | } | 1362 | } |
1260 | 1363 | ||
@@ -1436,7 +1539,25 @@ static void alc_automute_amp_unsol_event(struct hda_codec *codec, | |||
1436 | alc_automute_amp(codec); | 1539 | alc_automute_amp(codec); |
1437 | } | 1540 | } |
1438 | 1541 | ||
1439 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) | 1542 | static void alc889_automute_setup(struct hda_codec *codec) |
1543 | { | ||
1544 | struct alc_spec *spec = codec->spec; | ||
1545 | |||
1546 | spec->autocfg.hp_pins[0] = 0x15; | ||
1547 | spec->autocfg.speaker_pins[0] = 0x14; | ||
1548 | spec->autocfg.speaker_pins[1] = 0x16; | ||
1549 | spec->autocfg.speaker_pins[2] = 0x17; | ||
1550 | spec->autocfg.speaker_pins[3] = 0x19; | ||
1551 | spec->autocfg.speaker_pins[4] = 0x1a; | ||
1552 | } | ||
1553 | |||
1554 | static void alc889_intel_init_hook(struct hda_codec *codec) | ||
1555 | { | ||
1556 | alc889_coef_init(codec); | ||
1557 | alc_automute_amp(codec); | ||
1558 | } | ||
1559 | |||
1560 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) | ||
1440 | { | 1561 | { |
1441 | struct alc_spec *spec = codec->spec; | 1562 | struct alc_spec *spec = codec->spec; |
1442 | 1563 | ||
@@ -1444,7 +1565,6 @@ static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) | |||
1444 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ | 1565 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
1445 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ | 1566 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
1446 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ | 1567 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
1447 | alc_automute_amp(codec); | ||
1448 | } | 1568 | } |
1449 | 1569 | ||
1450 | /* | 1570 | /* |
@@ -1643,16 +1763,15 @@ static struct snd_kcontrol_new alc888_base_mixer[] = { | |||
1643 | { } /* end */ | 1763 | { } /* end */ |
1644 | }; | 1764 | }; |
1645 | 1765 | ||
1646 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) | 1766 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
1647 | { | 1767 | { |
1648 | struct alc_spec *spec = codec->spec; | 1768 | struct alc_spec *spec = codec->spec; |
1649 | 1769 | ||
1650 | spec->autocfg.hp_pins[0] = 0x15; | 1770 | spec->autocfg.hp_pins[0] = 0x15; |
1651 | spec->autocfg.speaker_pins[0] = 0x14; | 1771 | spec->autocfg.speaker_pins[0] = 0x14; |
1652 | alc_automute_amp(codec); | ||
1653 | } | 1772 | } |
1654 | 1773 | ||
1655 | static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec) | 1774 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
1656 | { | 1775 | { |
1657 | struct alc_spec *spec = codec->spec; | 1776 | struct alc_spec *spec = codec->spec; |
1658 | 1777 | ||
@@ -1660,10 +1779,9 @@ static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec) | |||
1660 | spec->autocfg.speaker_pins[0] = 0x14; | 1779 | spec->autocfg.speaker_pins[0] = 0x14; |
1661 | spec->autocfg.speaker_pins[1] = 0x16; | 1780 | spec->autocfg.speaker_pins[1] = 0x16; |
1662 | spec->autocfg.speaker_pins[2] = 0x17; | 1781 | spec->autocfg.speaker_pins[2] = 0x17; |
1663 | alc_automute_amp(codec); | ||
1664 | } | 1782 | } |
1665 | 1783 | ||
1666 | static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) | 1784 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
1667 | { | 1785 | { |
1668 | struct alc_spec *spec = codec->spec; | 1786 | struct alc_spec *spec = codec->spec; |
1669 | 1787 | ||
@@ -1671,7 +1789,6 @@ static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) | |||
1671 | spec->autocfg.speaker_pins[0] = 0x14; | 1789 | spec->autocfg.speaker_pins[0] = 0x14; |
1672 | spec->autocfg.speaker_pins[1] = 0x16; | 1790 | spec->autocfg.speaker_pins[1] = 0x16; |
1673 | spec->autocfg.speaker_pins[2] = 0x1b; | 1791 | spec->autocfg.speaker_pins[2] = 0x1b; |
1674 | alc_automute_amp(codec); | ||
1675 | } | 1792 | } |
1676 | 1793 | ||
1677 | /* | 1794 | /* |
@@ -2651,13 +2768,17 @@ static void alc880_uniwill_mic_automute(struct hda_codec *codec) | |||
2651 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | 2768 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
2652 | } | 2769 | } |
2653 | 2770 | ||
2654 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | 2771 | static void alc880_uniwill_setup(struct hda_codec *codec) |
2655 | { | 2772 | { |
2656 | struct alc_spec *spec = codec->spec; | 2773 | struct alc_spec *spec = codec->spec; |
2657 | 2774 | ||
2658 | spec->autocfg.hp_pins[0] = 0x14; | 2775 | spec->autocfg.hp_pins[0] = 0x14; |
2659 | spec->autocfg.speaker_pins[0] = 0x15; | 2776 | spec->autocfg.speaker_pins[0] = 0x15; |
2660 | spec->autocfg.speaker_pins[0] = 0x16; | 2777 | spec->autocfg.speaker_pins[0] = 0x16; |
2778 | } | ||
2779 | |||
2780 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | ||
2781 | { | ||
2661 | alc_automute_amp(codec); | 2782 | alc_automute_amp(codec); |
2662 | alc880_uniwill_mic_automute(codec); | 2783 | alc880_uniwill_mic_automute(codec); |
2663 | } | 2784 | } |
@@ -2678,13 +2799,12 @@ static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |||
2678 | } | 2799 | } |
2679 | } | 2800 | } |
2680 | 2801 | ||
2681 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) | 2802 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
2682 | { | 2803 | { |
2683 | struct alc_spec *spec = codec->spec; | 2804 | struct alc_spec *spec = codec->spec; |
2684 | 2805 | ||
2685 | spec->autocfg.hp_pins[0] = 0x14; | 2806 | spec->autocfg.hp_pins[0] = 0x14; |
2686 | spec->autocfg.speaker_pins[0] = 0x15; | 2807 | spec->autocfg.speaker_pins[0] = 0x15; |
2687 | alc_automute_amp(codec); | ||
2688 | } | 2808 | } |
2689 | 2809 | ||
2690 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | 2810 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
@@ -2947,13 +3067,12 @@ static struct hda_verb alc880_lg_init_verbs[] = { | |||
2947 | }; | 3067 | }; |
2948 | 3068 | ||
2949 | /* toggle speaker-output according to the hp-jack state */ | 3069 | /* toggle speaker-output according to the hp-jack state */ |
2950 | static void alc880_lg_init_hook(struct hda_codec *codec) | 3070 | static void alc880_lg_setup(struct hda_codec *codec) |
2951 | { | 3071 | { |
2952 | struct alc_spec *spec = codec->spec; | 3072 | struct alc_spec *spec = codec->spec; |
2953 | 3073 | ||
2954 | spec->autocfg.hp_pins[0] = 0x1b; | 3074 | spec->autocfg.hp_pins[0] = 0x1b; |
2955 | spec->autocfg.speaker_pins[0] = 0x17; | 3075 | spec->autocfg.speaker_pins[0] = 0x17; |
2956 | alc_automute_amp(codec); | ||
2957 | } | 3076 | } |
2958 | 3077 | ||
2959 | /* | 3078 | /* |
@@ -3032,13 +3151,12 @@ static struct hda_verb alc880_lg_lw_init_verbs[] = { | |||
3032 | }; | 3151 | }; |
3033 | 3152 | ||
3034 | /* toggle speaker-output according to the hp-jack state */ | 3153 | /* toggle speaker-output according to the hp-jack state */ |
3035 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) | 3154 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
3036 | { | 3155 | { |
3037 | struct alc_spec *spec = codec->spec; | 3156 | struct alc_spec *spec = codec->spec; |
3038 | 3157 | ||
3039 | spec->autocfg.hp_pins[0] = 0x1b; | 3158 | spec->autocfg.hp_pins[0] = 0x1b; |
3040 | spec->autocfg.speaker_pins[0] = 0x14; | 3159 | spec->autocfg.speaker_pins[0] = 0x14; |
3041 | alc_automute_amp(codec); | ||
3042 | } | 3160 | } |
3043 | 3161 | ||
3044 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { | 3162 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
@@ -3104,13 +3222,12 @@ static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | |||
3104 | alc880_medion_rim_automute(codec); | 3222 | alc880_medion_rim_automute(codec); |
3105 | } | 3223 | } |
3106 | 3224 | ||
3107 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) | 3225 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
3108 | { | 3226 | { |
3109 | struct alc_spec *spec = codec->spec; | 3227 | struct alc_spec *spec = codec->spec; |
3110 | 3228 | ||
3111 | spec->autocfg.hp_pins[0] = 0x14; | 3229 | spec->autocfg.hp_pins[0] = 0x14; |
3112 | spec->autocfg.speaker_pins[0] = 0x1b; | 3230 | spec->autocfg.speaker_pins[0] = 0x1b; |
3113 | alc880_medion_rim_automute(codec); | ||
3114 | } | 3231 | } |
3115 | 3232 | ||
3116 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3233 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -3977,7 +4094,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
3977 | .channel_mode = alc880_2_jack_modes, | 4094 | .channel_mode = alc880_2_jack_modes, |
3978 | .input_mux = &alc880_f1734_capture_source, | 4095 | .input_mux = &alc880_f1734_capture_source, |
3979 | .unsol_event = alc880_uniwill_p53_unsol_event, | 4096 | .unsol_event = alc880_uniwill_p53_unsol_event, |
3980 | .init_hook = alc880_uniwill_p53_init_hook, | 4097 | .setup = alc880_uniwill_p53_setup, |
4098 | .init_hook = alc_automute_amp, | ||
3981 | }, | 4099 | }, |
3982 | [ALC880_ASUS] = { | 4100 | [ALC880_ASUS] = { |
3983 | .mixers = { alc880_asus_mixer }, | 4101 | .mixers = { alc880_asus_mixer }, |
@@ -4054,6 +4172,7 @@ static struct alc_config_preset alc880_presets[] = { | |||
4054 | .need_dac_fix = 1, | 4172 | .need_dac_fix = 1, |
4055 | .input_mux = &alc880_capture_source, | 4173 | .input_mux = &alc880_capture_source, |
4056 | .unsol_event = alc880_uniwill_unsol_event, | 4174 | .unsol_event = alc880_uniwill_unsol_event, |
4175 | .setup = alc880_uniwill_setup, | ||
4057 | .init_hook = alc880_uniwill_init_hook, | 4176 | .init_hook = alc880_uniwill_init_hook, |
4058 | }, | 4177 | }, |
4059 | [ALC880_UNIWILL_P53] = { | 4178 | [ALC880_UNIWILL_P53] = { |
@@ -4066,7 +4185,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4066 | .channel_mode = alc880_threestack_modes, | 4185 | .channel_mode = alc880_threestack_modes, |
4067 | .input_mux = &alc880_capture_source, | 4186 | .input_mux = &alc880_capture_source, |
4068 | .unsol_event = alc880_uniwill_p53_unsol_event, | 4187 | .unsol_event = alc880_uniwill_p53_unsol_event, |
4069 | .init_hook = alc880_uniwill_p53_init_hook, | 4188 | .setup = alc880_uniwill_p53_setup, |
4189 | .init_hook = alc_automute_amp, | ||
4070 | }, | 4190 | }, |
4071 | [ALC880_FUJITSU] = { | 4191 | [ALC880_FUJITSU] = { |
4072 | .mixers = { alc880_fujitsu_mixer }, | 4192 | .mixers = { alc880_fujitsu_mixer }, |
@@ -4080,7 +4200,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4080 | .channel_mode = alc880_2_jack_modes, | 4200 | .channel_mode = alc880_2_jack_modes, |
4081 | .input_mux = &alc880_capture_source, | 4201 | .input_mux = &alc880_capture_source, |
4082 | .unsol_event = alc880_uniwill_p53_unsol_event, | 4202 | .unsol_event = alc880_uniwill_p53_unsol_event, |
4083 | .init_hook = alc880_uniwill_p53_init_hook, | 4203 | .setup = alc880_uniwill_p53_setup, |
4204 | .init_hook = alc_automute_amp, | ||
4084 | }, | 4205 | }, |
4085 | [ALC880_CLEVO] = { | 4206 | [ALC880_CLEVO] = { |
4086 | .mixers = { alc880_three_stack_mixer }, | 4207 | .mixers = { alc880_three_stack_mixer }, |
@@ -4106,7 +4227,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4106 | .need_dac_fix = 1, | 4227 | .need_dac_fix = 1, |
4107 | .input_mux = &alc880_lg_capture_source, | 4228 | .input_mux = &alc880_lg_capture_source, |
4108 | .unsol_event = alc_automute_amp_unsol_event, | 4229 | .unsol_event = alc_automute_amp_unsol_event, |
4109 | .init_hook = alc880_lg_init_hook, | 4230 | .setup = alc880_lg_setup, |
4231 | .init_hook = alc_automute_amp, | ||
4110 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 4232 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4111 | .loopbacks = alc880_lg_loopbacks, | 4233 | .loopbacks = alc880_lg_loopbacks, |
4112 | #endif | 4234 | #endif |
@@ -4122,7 +4244,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4122 | .channel_mode = alc880_lg_lw_modes, | 4244 | .channel_mode = alc880_lg_lw_modes, |
4123 | .input_mux = &alc880_lg_lw_capture_source, | 4245 | .input_mux = &alc880_lg_lw_capture_source, |
4124 | .unsol_event = alc_automute_amp_unsol_event, | 4246 | .unsol_event = alc_automute_amp_unsol_event, |
4125 | .init_hook = alc880_lg_lw_init_hook, | 4247 | .setup = alc880_lg_lw_setup, |
4248 | .init_hook = alc_automute_amp, | ||
4126 | }, | 4249 | }, |
4127 | [ALC880_MEDION_RIM] = { | 4250 | [ALC880_MEDION_RIM] = { |
4128 | .mixers = { alc880_medion_rim_mixer }, | 4251 | .mixers = { alc880_medion_rim_mixer }, |
@@ -4136,7 +4259,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
4136 | .channel_mode = alc880_2_jack_modes, | 4259 | .channel_mode = alc880_2_jack_modes, |
4137 | .input_mux = &alc880_medion_rim_capture_source, | 4260 | .input_mux = &alc880_medion_rim_capture_source, |
4138 | .unsol_event = alc880_medion_rim_unsol_event, | 4261 | .unsol_event = alc880_medion_rim_unsol_event, |
4139 | .init_hook = alc880_medion_rim_init_hook, | 4262 | .setup = alc880_medion_rim_setup, |
4263 | .init_hook = alc880_medion_rim_automute, | ||
4140 | }, | 4264 | }, |
4141 | #ifdef CONFIG_SND_DEBUG | 4265 | #ifdef CONFIG_SND_DEBUG |
4142 | [ALC880_TEST] = { | 4266 | [ALC880_TEST] = { |
@@ -4189,8 +4313,6 @@ static int add_control(struct alc_spec *spec, int type, const char *name, | |||
4189 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | 4313 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
4190 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | 4314 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
4191 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | 4315 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
4192 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) | ||
4193 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) | ||
4194 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) | 4316 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
4195 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | 4317 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
4196 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | 4318 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
@@ -4278,13 +4400,19 @@ static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
4278 | if (err < 0) | 4400 | if (err < 0) |
4279 | return err; | 4401 | return err; |
4280 | } else { | 4402 | } else { |
4281 | sprintf(name, "%s Playback Volume", chname[i]); | 4403 | const char *pfx; |
4404 | if (cfg->line_outs == 1 && | ||
4405 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
4406 | pfx = "Speaker"; | ||
4407 | else | ||
4408 | pfx = chname[i]; | ||
4409 | sprintf(name, "%s Playback Volume", pfx); | ||
4282 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | 4410 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
4283 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | 4411 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
4284 | HDA_OUTPUT)); | 4412 | HDA_OUTPUT)); |
4285 | if (err < 0) | 4413 | if (err < 0) |
4286 | return err; | 4414 | return err; |
4287 | sprintf(name, "%s Playback Switch", chname[i]); | 4415 | sprintf(name, "%s Playback Switch", pfx); |
4288 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | 4416 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
4289 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, | 4417 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
4290 | HDA_INPUT)); | 4418 | HDA_INPUT)); |
@@ -4358,31 +4486,61 @@ static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, | |||
4358 | return 0; | 4486 | return 0; |
4359 | } | 4487 | } |
4360 | 4488 | ||
4489 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) | ||
4490 | { | ||
4491 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | ||
4492 | return (pincap & AC_PINCAP_IN) != 0; | ||
4493 | } | ||
4494 | |||
4361 | /* create playback/capture controls for input pins */ | 4495 | /* create playback/capture controls for input pins */ |
4362 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, | 4496 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
4363 | const struct auto_pin_cfg *cfg) | 4497 | const struct auto_pin_cfg *cfg, |
4498 | hda_nid_t mixer, | ||
4499 | hda_nid_t cap1, hda_nid_t cap2) | ||
4364 | { | 4500 | { |
4501 | struct alc_spec *spec = codec->spec; | ||
4365 | struct hda_input_mux *imux = &spec->private_imux[0]; | 4502 | struct hda_input_mux *imux = &spec->private_imux[0]; |
4366 | int i, err, idx; | 4503 | int i, err, idx; |
4367 | 4504 | ||
4368 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 4505 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
4369 | if (alc880_is_input_pin(cfg->input_pins[i])) { | 4506 | hda_nid_t pin; |
4370 | idx = alc880_input_pin_idx(cfg->input_pins[i]); | 4507 | |
4371 | err = new_analog_input(spec, cfg->input_pins[i], | 4508 | pin = cfg->input_pins[i]; |
4372 | auto_pin_cfg_labels[i], | 4509 | if (!alc_is_input_pin(codec, pin)) |
4373 | idx, 0x0b); | 4510 | continue; |
4374 | if (err < 0) | 4511 | |
4375 | return err; | 4512 | if (mixer) { |
4513 | idx = get_connection_index(codec, mixer, pin); | ||
4514 | if (idx >= 0) { | ||
4515 | err = new_analog_input(spec, pin, | ||
4516 | auto_pin_cfg_labels[i], | ||
4517 | idx, mixer); | ||
4518 | if (err < 0) | ||
4519 | return err; | ||
4520 | } | ||
4521 | } | ||
4522 | |||
4523 | if (!cap1) | ||
4524 | continue; | ||
4525 | idx = get_connection_index(codec, cap1, pin); | ||
4526 | if (idx < 0 && cap2) | ||
4527 | idx = get_connection_index(codec, cap2, pin); | ||
4528 | if (idx >= 0) { | ||
4376 | imux->items[imux->num_items].label = | 4529 | imux->items[imux->num_items].label = |
4377 | auto_pin_cfg_labels[i]; | 4530 | auto_pin_cfg_labels[i]; |
4378 | imux->items[imux->num_items].index = | 4531 | imux->items[imux->num_items].index = idx; |
4379 | alc880_input_pin_idx(cfg->input_pins[i]); | ||
4380 | imux->num_items++; | 4532 | imux->num_items++; |
4381 | } | 4533 | } |
4382 | } | 4534 | } |
4383 | return 0; | 4535 | return 0; |
4384 | } | 4536 | } |
4385 | 4537 | ||
4538 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, | ||
4539 | const struct auto_pin_cfg *cfg) | ||
4540 | { | ||
4541 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); | ||
4542 | } | ||
4543 | |||
4386 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, | 4544 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
4387 | unsigned int pin_type) | 4545 | unsigned int pin_type) |
4388 | { | 4546 | { |
@@ -4448,7 +4606,7 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec) | |||
4448 | 4606 | ||
4449 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 4607 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
4450 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 4608 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
4451 | if (alc880_is_input_pin(nid)) { | 4609 | if (alc_is_input_pin(codec, nid)) { |
4452 | alc_set_input_pin(codec, nid, i); | 4610 | alc_set_input_pin(codec, nid, i); |
4453 | if (nid != ALC880_PIN_CD_NID && | 4611 | if (nid != ALC880_PIN_CD_NID && |
4454 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | 4612 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
@@ -4491,7 +4649,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
4491 | "Headphone"); | 4649 | "Headphone"); |
4492 | if (err < 0) | 4650 | if (err < 0) |
4493 | return err; | 4651 | return err; |
4494 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); | 4652 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
4495 | if (err < 0) | 4653 | if (err < 0) |
4496 | return err; | 4654 | return err; |
4497 | 4655 | ||
@@ -4505,12 +4663,6 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
4505 | &dig_nid, 1); | 4663 | &dig_nid, 1); |
4506 | if (err < 0) | 4664 | if (err < 0) |
4507 | continue; | 4665 | continue; |
4508 | if (dig_nid > 0x7f) { | ||
4509 | printk(KERN_ERR "alc880_auto: invalid dig_nid " | ||
4510 | "connection 0x%x for NID 0x%x\n", dig_nid, | ||
4511 | spec->autocfg.dig_out_pins[i]); | ||
4512 | continue; | ||
4513 | } | ||
4514 | if (!i) | 4666 | if (!i) |
4515 | spec->multiout.dig_out_nid = dig_nid; | 4667 | spec->multiout.dig_out_nid = dig_nid; |
4516 | else { | 4668 | else { |
@@ -4547,8 +4699,42 @@ static void alc880_auto_init(struct hda_codec *codec) | |||
4547 | alc_inithook(codec); | 4699 | alc_inithook(codec); |
4548 | } | 4700 | } |
4549 | 4701 | ||
4550 | static void set_capture_mixer(struct alc_spec *spec) | 4702 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
4703 | * one of two digital mic pins, e.g. on ALC272 | ||
4704 | */ | ||
4705 | static void fixup_automic_adc(struct hda_codec *codec) | ||
4551 | { | 4706 | { |
4707 | struct alc_spec *spec = codec->spec; | ||
4708 | int i; | ||
4709 | |||
4710 | for (i = 0; i < spec->num_adc_nids; i++) { | ||
4711 | hda_nid_t cap = spec->capsrc_nids ? | ||
4712 | spec->capsrc_nids[i] : spec->adc_nids[i]; | ||
4713 | int iidx, eidx; | ||
4714 | |||
4715 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); | ||
4716 | if (iidx < 0) | ||
4717 | continue; | ||
4718 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); | ||
4719 | if (eidx < 0) | ||
4720 | continue; | ||
4721 | spec->int_mic.mux_idx = iidx; | ||
4722 | spec->ext_mic.mux_idx = eidx; | ||
4723 | if (spec->capsrc_nids) | ||
4724 | spec->capsrc_nids += i; | ||
4725 | spec->adc_nids += i; | ||
4726 | spec->num_adc_nids = 1; | ||
4727 | return; | ||
4728 | } | ||
4729 | snd_printd(KERN_INFO "hda_codec: %s: " | ||
4730 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", | ||
4731 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); | ||
4732 | spec->auto_mic = 0; /* disable auto-mic to be sure */ | ||
4733 | } | ||
4734 | |||
4735 | static void set_capture_mixer(struct hda_codec *codec) | ||
4736 | { | ||
4737 | struct alc_spec *spec = codec->spec; | ||
4552 | static struct snd_kcontrol_new *caps[2][3] = { | 4738 | static struct snd_kcontrol_new *caps[2][3] = { |
4553 | { alc_capture_mixer_nosrc1, | 4739 | { alc_capture_mixer_nosrc1, |
4554 | alc_capture_mixer_nosrc2, | 4740 | alc_capture_mixer_nosrc2, |
@@ -4559,7 +4745,10 @@ static void set_capture_mixer(struct alc_spec *spec) | |||
4559 | }; | 4745 | }; |
4560 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { | 4746 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
4561 | int mux; | 4747 | int mux; |
4562 | if (spec->input_mux && spec->input_mux->num_items > 1) | 4748 | if (spec->auto_mic) { |
4749 | mux = 0; | ||
4750 | fixup_automic_adc(codec); | ||
4751 | } else if (spec->input_mux && spec->input_mux->num_items > 1) | ||
4563 | mux = 1; | 4752 | mux = 1; |
4564 | else | 4753 | else |
4565 | mux = 0; | 4754 | mux = 0; |
@@ -4590,8 +4779,8 @@ static int patch_alc880(struct hda_codec *codec) | |||
4590 | alc880_models, | 4779 | alc880_models, |
4591 | alc880_cfg_tbl); | 4780 | alc880_cfg_tbl); |
4592 | if (board_config < 0) { | 4781 | if (board_config < 0) { |
4593 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 4782 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
4594 | "trying auto-probe from BIOS...\n", codec->chip_name); | 4783 | codec->chip_name); |
4595 | board_config = ALC880_AUTO; | 4784 | board_config = ALC880_AUTO; |
4596 | } | 4785 | } |
4597 | 4786 | ||
@@ -4616,7 +4805,7 @@ static int patch_alc880(struct hda_codec *codec) | |||
4616 | } | 4805 | } |
4617 | 4806 | ||
4618 | if (board_config != ALC880_AUTO) | 4807 | if (board_config != ALC880_AUTO) |
4619 | setup_preset(spec, &alc880_presets[board_config]); | 4808 | setup_preset(codec, &alc880_presets[board_config]); |
4620 | 4809 | ||
4621 | spec->stream_analog_playback = &alc880_pcm_analog_playback; | 4810 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
4622 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | 4811 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
@@ -4629,7 +4818,7 @@ static int patch_alc880(struct hda_codec *codec) | |||
4629 | /* check whether NID 0x07 is valid */ | 4818 | /* check whether NID 0x07 is valid */ |
4630 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); | 4819 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
4631 | /* get type */ | 4820 | /* get type */ |
4632 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 4821 | wcap = get_wcaps_type(wcap); |
4633 | if (wcap != AC_WID_AUD_IN) { | 4822 | if (wcap != AC_WID_AUD_IN) { |
4634 | spec->adc_nids = alc880_adc_nids_alt; | 4823 | spec->adc_nids = alc880_adc_nids_alt; |
4635 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | 4824 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
@@ -4638,7 +4827,7 @@ static int patch_alc880(struct hda_codec *codec) | |||
4638 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | 4827 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
4639 | } | 4828 | } |
4640 | } | 4829 | } |
4641 | set_capture_mixer(spec); | 4830 | set_capture_mixer(codec); |
4642 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 4831 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
4643 | 4832 | ||
4644 | spec->vmaster_nid = 0x0c; | 4833 | spec->vmaster_nid = 0x0c; |
@@ -5830,7 +6019,14 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
5830 | 6019 | ||
5831 | nid = cfg->line_out_pins[0]; | 6020 | nid = cfg->line_out_pins[0]; |
5832 | if (nid) { | 6021 | if (nid) { |
5833 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); | 6022 | const char *pfx; |
6023 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) | ||
6024 | pfx = "Master"; | ||
6025 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
6026 | pfx = "Speaker"; | ||
6027 | else | ||
6028 | pfx = "Front"; | ||
6029 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); | ||
5834 | if (err < 0) | 6030 | if (err < 0) |
5835 | return err; | 6031 | return err; |
5836 | } | 6032 | } |
@@ -5853,39 +6049,10 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
5853 | } | 6049 | } |
5854 | 6050 | ||
5855 | /* create playback/capture controls for input pins */ | 6051 | /* create playback/capture controls for input pins */ |
5856 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, | 6052 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
5857 | const struct auto_pin_cfg *cfg) | 6053 | const struct auto_pin_cfg *cfg) |
5858 | { | 6054 | { |
5859 | struct hda_input_mux *imux = &spec->private_imux[0]; | 6055 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
5860 | int i, err, idx; | ||
5861 | |||
5862 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
5863 | if (cfg->input_pins[i] >= 0x12) { | ||
5864 | idx = cfg->input_pins[i] - 0x12; | ||
5865 | err = new_analog_input(spec, cfg->input_pins[i], | ||
5866 | auto_pin_cfg_labels[i], idx, | ||
5867 | 0x07); | ||
5868 | if (err < 0) | ||
5869 | return err; | ||
5870 | imux->items[imux->num_items].label = | ||
5871 | auto_pin_cfg_labels[i]; | ||
5872 | imux->items[imux->num_items].index = idx; | ||
5873 | imux->num_items++; | ||
5874 | } | ||
5875 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ | ||
5876 | idx = cfg->input_pins[i] - 0x09; | ||
5877 | err = new_analog_input(spec, cfg->input_pins[i], | ||
5878 | auto_pin_cfg_labels[i], idx, | ||
5879 | 0x07); | ||
5880 | if (err < 0) | ||
5881 | return err; | ||
5882 | imux->items[imux->num_items].label = | ||
5883 | auto_pin_cfg_labels[i]; | ||
5884 | imux->items[imux->num_items].index = idx; | ||
5885 | imux->num_items++; | ||
5886 | } | ||
5887 | } | ||
5888 | return 0; | ||
5889 | } | 6056 | } |
5890 | 6057 | ||
5891 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | 6058 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
@@ -5999,7 +6166,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec) | |||
5999 | return err; | 6166 | return err; |
6000 | if (!spec->kctls.list) | 6167 | if (!spec->kctls.list) |
6001 | return 0; /* can't find valid BIOS pin config */ | 6168 | return 0; /* can't find valid BIOS pin config */ |
6002 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); | 6169 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
6003 | if (err < 0) | 6170 | if (err < 0) |
6004 | return err; | 6171 | return err; |
6005 | 6172 | ||
@@ -6234,8 +6401,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
6234 | alc260_models, | 6401 | alc260_models, |
6235 | alc260_cfg_tbl); | 6402 | alc260_cfg_tbl); |
6236 | if (board_config < 0) { | 6403 | if (board_config < 0) { |
6237 | snd_printd(KERN_INFO "hda_codec: Unknown model for %s, " | 6404 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
6238 | "trying auto-probe from BIOS...\n", | ||
6239 | codec->chip_name); | 6405 | codec->chip_name); |
6240 | board_config = ALC260_AUTO; | 6406 | board_config = ALC260_AUTO; |
6241 | } | 6407 | } |
@@ -6261,7 +6427,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
6261 | } | 6427 | } |
6262 | 6428 | ||
6263 | if (board_config != ALC260_AUTO) | 6429 | if (board_config != ALC260_AUTO) |
6264 | setup_preset(spec, &alc260_presets[board_config]); | 6430 | setup_preset(codec, &alc260_presets[board_config]); |
6265 | 6431 | ||
6266 | spec->stream_analog_playback = &alc260_pcm_analog_playback; | 6432 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
6267 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | 6433 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
@@ -6272,7 +6438,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
6272 | if (!spec->adc_nids && spec->input_mux) { | 6438 | if (!spec->adc_nids && spec->input_mux) { |
6273 | /* check whether NID 0x04 is valid */ | 6439 | /* check whether NID 0x04 is valid */ |
6274 | unsigned int wcap = get_wcaps(codec, 0x04); | 6440 | unsigned int wcap = get_wcaps(codec, 0x04); |
6275 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 6441 | wcap = get_wcaps_type(wcap); |
6276 | /* get type */ | 6442 | /* get type */ |
6277 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | 6443 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
6278 | spec->adc_nids = alc260_adc_nids_alt; | 6444 | spec->adc_nids = alc260_adc_nids_alt; |
@@ -6282,7 +6448,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
6282 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | 6448 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
6283 | } | 6449 | } |
6284 | } | 6450 | } |
6285 | set_capture_mixer(spec); | 6451 | set_capture_mixer(codec); |
6286 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); | 6452 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
6287 | 6453 | ||
6288 | spec->vmaster_nid = 0x08; | 6454 | spec->vmaster_nid = 0x08; |
@@ -6301,7 +6467,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
6301 | 6467 | ||
6302 | 6468 | ||
6303 | /* | 6469 | /* |
6304 | * ALC882 support | 6470 | * ALC882/883/885/888/889 support |
6305 | * | 6471 | * |
6306 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | 6472 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
6307 | * configuration. Each pin widget can choose any input DACs and a mixer. | 6473 | * configuration. Each pin widget can choose any input DACs and a mixer. |
@@ -6313,22 +6479,35 @@ static int patch_alc260(struct hda_codec *codec) | |||
6313 | */ | 6479 | */ |
6314 | #define ALC882_DIGOUT_NID 0x06 | 6480 | #define ALC882_DIGOUT_NID 0x06 |
6315 | #define ALC882_DIGIN_NID 0x0a | 6481 | #define ALC882_DIGIN_NID 0x0a |
6482 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID | ||
6483 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID | ||
6484 | #define ALC1200_DIGOUT_NID 0x10 | ||
6485 | |||
6316 | 6486 | ||
6317 | static struct hda_channel_mode alc882_ch_modes[1] = { | 6487 | static struct hda_channel_mode alc882_ch_modes[1] = { |
6318 | { 8, NULL } | 6488 | { 8, NULL } |
6319 | }; | 6489 | }; |
6320 | 6490 | ||
6491 | /* DACs */ | ||
6321 | static hda_nid_t alc882_dac_nids[4] = { | 6492 | static hda_nid_t alc882_dac_nids[4] = { |
6322 | /* front, rear, clfe, rear_surr */ | 6493 | /* front, rear, clfe, rear_surr */ |
6323 | 0x02, 0x03, 0x04, 0x05 | 6494 | 0x02, 0x03, 0x04, 0x05 |
6324 | }; | 6495 | }; |
6496 | #define alc883_dac_nids alc882_dac_nids | ||
6325 | 6497 | ||
6326 | /* identical with ALC880 */ | 6498 | /* ADCs */ |
6327 | #define alc882_adc_nids alc880_adc_nids | 6499 | #define alc882_adc_nids alc880_adc_nids |
6328 | #define alc882_adc_nids_alt alc880_adc_nids_alt | 6500 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
6501 | #define alc883_adc_nids alc882_adc_nids_alt | ||
6502 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; | ||
6503 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; | ||
6504 | #define alc889_adc_nids alc880_adc_nids | ||
6329 | 6505 | ||
6330 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; | 6506 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
6331 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | 6507 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
6508 | #define alc883_capsrc_nids alc882_capsrc_nids_alt | ||
6509 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | ||
6510 | #define alc889_capsrc_nids alc882_capsrc_nids | ||
6332 | 6511 | ||
6333 | /* input MUX */ | 6512 | /* input MUX */ |
6334 | /* FIXME: should be a matrix-type input source selection */ | 6513 | /* FIXME: should be a matrix-type input source selection */ |
@@ -6343,6 +6522,17 @@ static struct hda_input_mux alc882_capture_source = { | |||
6343 | }, | 6522 | }, |
6344 | }; | 6523 | }; |
6345 | 6524 | ||
6525 | #define alc883_capture_source alc882_capture_source | ||
6526 | |||
6527 | static struct hda_input_mux alc889_capture_source = { | ||
6528 | .num_items = 3, | ||
6529 | .items = { | ||
6530 | { "Front Mic", 0x0 }, | ||
6531 | { "Mic", 0x3 }, | ||
6532 | { "Line", 0x2 }, | ||
6533 | }, | ||
6534 | }; | ||
6535 | |||
6346 | static struct hda_input_mux mb5_capture_source = { | 6536 | static struct hda_input_mux mb5_capture_source = { |
6347 | .num_items = 3, | 6537 | .num_items = 3, |
6348 | .items = { | 6538 | .items = { |
@@ -6352,6 +6542,77 @@ static struct hda_input_mux mb5_capture_source = { | |||
6352 | }, | 6542 | }, |
6353 | }; | 6543 | }; |
6354 | 6544 | ||
6545 | static struct hda_input_mux alc883_3stack_6ch_intel = { | ||
6546 | .num_items = 4, | ||
6547 | .items = { | ||
6548 | { "Mic", 0x1 }, | ||
6549 | { "Front Mic", 0x0 }, | ||
6550 | { "Line", 0x2 }, | ||
6551 | { "CD", 0x4 }, | ||
6552 | }, | ||
6553 | }; | ||
6554 | |||
6555 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { | ||
6556 | .num_items = 2, | ||
6557 | .items = { | ||
6558 | { "Mic", 0x1 }, | ||
6559 | { "Line", 0x2 }, | ||
6560 | }, | ||
6561 | }; | ||
6562 | |||
6563 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | ||
6564 | .num_items = 4, | ||
6565 | .items = { | ||
6566 | { "Mic", 0x0 }, | ||
6567 | { "iMic", 0x1 }, | ||
6568 | { "Line", 0x2 }, | ||
6569 | { "CD", 0x4 }, | ||
6570 | }, | ||
6571 | }; | ||
6572 | |||
6573 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | ||
6574 | .num_items = 2, | ||
6575 | .items = { | ||
6576 | { "Mic", 0x0 }, | ||
6577 | { "Int Mic", 0x1 }, | ||
6578 | }, | ||
6579 | }; | ||
6580 | |||
6581 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | ||
6582 | .num_items = 3, | ||
6583 | .items = { | ||
6584 | { "Mic", 0x0 }, | ||
6585 | { "Front Mic", 0x1 }, | ||
6586 | { "Line", 0x4 }, | ||
6587 | }, | ||
6588 | }; | ||
6589 | |||
6590 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | ||
6591 | .num_items = 2, | ||
6592 | .items = { | ||
6593 | { "Mic", 0x0 }, | ||
6594 | { "Line", 0x2 }, | ||
6595 | }, | ||
6596 | }; | ||
6597 | |||
6598 | static struct hda_input_mux alc889A_mb31_capture_source = { | ||
6599 | .num_items = 2, | ||
6600 | .items = { | ||
6601 | { "Mic", 0x0 }, | ||
6602 | /* Front Mic (0x01) unused */ | ||
6603 | { "Line", 0x2 }, | ||
6604 | /* Line 2 (0x03) unused */ | ||
6605 | /* CD (0x04) unsused? */ | ||
6606 | }, | ||
6607 | }; | ||
6608 | |||
6609 | /* | ||
6610 | * 2ch mode | ||
6611 | */ | ||
6612 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | ||
6613 | { 2, NULL } | ||
6614 | }; | ||
6615 | |||
6355 | /* | 6616 | /* |
6356 | * 2ch mode | 6617 | * 2ch mode |
6357 | */ | 6618 | */ |
@@ -6364,6 +6625,18 @@ static struct hda_verb alc882_3ST_ch2_init[] = { | |||
6364 | }; | 6625 | }; |
6365 | 6626 | ||
6366 | /* | 6627 | /* |
6628 | * 4ch mode | ||
6629 | */ | ||
6630 | static struct hda_verb alc882_3ST_ch4_init[] = { | ||
6631 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6632 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6633 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6634 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6635 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6636 | { } /* end */ | ||
6637 | }; | ||
6638 | |||
6639 | /* | ||
6367 | * 6ch mode | 6640 | * 6ch mode |
6368 | */ | 6641 | */ |
6369 | static struct hda_verb alc882_3ST_ch6_init[] = { | 6642 | static struct hda_verb alc882_3ST_ch6_init[] = { |
@@ -6376,11 +6649,60 @@ static struct hda_verb alc882_3ST_ch6_init[] = { | |||
6376 | { } /* end */ | 6649 | { } /* end */ |
6377 | }; | 6650 | }; |
6378 | 6651 | ||
6379 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { | 6652 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
6380 | { 2, alc882_3ST_ch2_init }, | 6653 | { 2, alc882_3ST_ch2_init }, |
6654 | { 4, alc882_3ST_ch4_init }, | ||
6381 | { 6, alc882_3ST_ch6_init }, | 6655 | { 6, alc882_3ST_ch6_init }, |
6382 | }; | 6656 | }; |
6383 | 6657 | ||
6658 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes | ||
6659 | |||
6660 | /* | ||
6661 | * 2ch mode | ||
6662 | */ | ||
6663 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { | ||
6664 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | ||
6665 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6666 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6667 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
6668 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6669 | { } /* end */ | ||
6670 | }; | ||
6671 | |||
6672 | /* | ||
6673 | * 4ch mode | ||
6674 | */ | ||
6675 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { | ||
6676 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6677 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6678 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6679 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6680 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6681 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6682 | { } /* end */ | ||
6683 | }; | ||
6684 | |||
6685 | /* | ||
6686 | * 6ch mode | ||
6687 | */ | ||
6688 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { | ||
6689 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6690 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6691 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6692 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
6693 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6694 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6695 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6696 | { } /* end */ | ||
6697 | }; | ||
6698 | |||
6699 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { | ||
6700 | { 2, alc883_3ST_ch2_clevo_init }, | ||
6701 | { 4, alc883_3ST_ch4_clevo_init }, | ||
6702 | { 6, alc883_3ST_ch6_clevo_init }, | ||
6703 | }; | ||
6704 | |||
6705 | |||
6384 | /* | 6706 | /* |
6385 | * 6ch mode | 6707 | * 6ch mode |
6386 | */ | 6708 | */ |
@@ -6468,6 +6790,189 @@ static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { | |||
6468 | { 6, alc885_mb5_ch6_init }, | 6790 | { 6, alc885_mb5_ch6_init }, |
6469 | }; | 6791 | }; |
6470 | 6792 | ||
6793 | |||
6794 | /* | ||
6795 | * 2ch mode | ||
6796 | */ | ||
6797 | static struct hda_verb alc883_4ST_ch2_init[] = { | ||
6798 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6799 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6800 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6801 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6802 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
6803 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6804 | { } /* end */ | ||
6805 | }; | ||
6806 | |||
6807 | /* | ||
6808 | * 4ch mode | ||
6809 | */ | ||
6810 | static struct hda_verb alc883_4ST_ch4_init[] = { | ||
6811 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6812 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6813 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6814 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6815 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6816 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6817 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6818 | { } /* end */ | ||
6819 | }; | ||
6820 | |||
6821 | /* | ||
6822 | * 6ch mode | ||
6823 | */ | ||
6824 | static struct hda_verb alc883_4ST_ch6_init[] = { | ||
6825 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6826 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6827 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6828 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6829 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
6830 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6831 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6832 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6833 | { } /* end */ | ||
6834 | }; | ||
6835 | |||
6836 | /* | ||
6837 | * 8ch mode | ||
6838 | */ | ||
6839 | static struct hda_verb alc883_4ST_ch8_init[] = { | ||
6840 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6841 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6842 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
6843 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6844 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6845 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
6846 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6847 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6848 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6849 | { } /* end */ | ||
6850 | }; | ||
6851 | |||
6852 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { | ||
6853 | { 2, alc883_4ST_ch2_init }, | ||
6854 | { 4, alc883_4ST_ch4_init }, | ||
6855 | { 6, alc883_4ST_ch6_init }, | ||
6856 | { 8, alc883_4ST_ch8_init }, | ||
6857 | }; | ||
6858 | |||
6859 | |||
6860 | /* | ||
6861 | * 2ch mode | ||
6862 | */ | ||
6863 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | ||
6864 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6865 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6866 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
6867 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6868 | { } /* end */ | ||
6869 | }; | ||
6870 | |||
6871 | /* | ||
6872 | * 4ch mode | ||
6873 | */ | ||
6874 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | ||
6875 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
6876 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6877 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6878 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6879 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6880 | { } /* end */ | ||
6881 | }; | ||
6882 | |||
6883 | /* | ||
6884 | * 6ch mode | ||
6885 | */ | ||
6886 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | ||
6887 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6888 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6889 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
6890 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6891 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6892 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6893 | { } /* end */ | ||
6894 | }; | ||
6895 | |||
6896 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | ||
6897 | { 2, alc883_3ST_ch2_intel_init }, | ||
6898 | { 4, alc883_3ST_ch4_intel_init }, | ||
6899 | { 6, alc883_3ST_ch6_intel_init }, | ||
6900 | }; | ||
6901 | |||
6902 | /* | ||
6903 | * 2ch mode | ||
6904 | */ | ||
6905 | static struct hda_verb alc889_ch2_intel_init[] = { | ||
6906 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
6907 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
6908 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
6909 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
6910 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
6911 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6912 | { } /* end */ | ||
6913 | }; | ||
6914 | |||
6915 | /* | ||
6916 | * 6ch mode | ||
6917 | */ | ||
6918 | static struct hda_verb alc889_ch6_intel_init[] = { | ||
6919 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
6920 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6921 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
6922 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
6923 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
6924 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
6925 | { } /* end */ | ||
6926 | }; | ||
6927 | |||
6928 | /* | ||
6929 | * 8ch mode | ||
6930 | */ | ||
6931 | static struct hda_verb alc889_ch8_intel_init[] = { | ||
6932 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
6933 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
6934 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
6935 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
6936 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
6937 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6938 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
6939 | { } /* end */ | ||
6940 | }; | ||
6941 | |||
6942 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { | ||
6943 | { 2, alc889_ch2_intel_init }, | ||
6944 | { 6, alc889_ch6_intel_init }, | ||
6945 | { 8, alc889_ch8_intel_init }, | ||
6946 | }; | ||
6947 | |||
6948 | /* | ||
6949 | * 6ch mode | ||
6950 | */ | ||
6951 | static struct hda_verb alc883_sixstack_ch6_init[] = { | ||
6952 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
6953 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6954 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6955 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6956 | { } /* end */ | ||
6957 | }; | ||
6958 | |||
6959 | /* | ||
6960 | * 8ch mode | ||
6961 | */ | ||
6962 | static struct hda_verb alc883_sixstack_ch8_init[] = { | ||
6963 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6964 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6965 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6966 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
6967 | { } /* end */ | ||
6968 | }; | ||
6969 | |||
6970 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | ||
6971 | { 6, alc883_sixstack_ch6_init }, | ||
6972 | { 8, alc883_sixstack_ch8_init }, | ||
6973 | }; | ||
6974 | |||
6975 | |||
6471 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | 6976 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
6472 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | 6977 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
6473 | */ | 6978 | */ |
@@ -6604,7 +7109,7 @@ static struct snd_kcontrol_new alc882_chmode_mixer[] = { | |||
6604 | { } /* end */ | 7109 | { } /* end */ |
6605 | }; | 7110 | }; |
6606 | 7111 | ||
6607 | static struct hda_verb alc882_init_verbs[] = { | 7112 | static struct hda_verb alc882_base_init_verbs[] = { |
6608 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | 7113 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
6609 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 7114 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
6610 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 7115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
@@ -6622,6 +7127,13 @@ static struct hda_verb alc882_init_verbs[] = { | |||
6622 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 7127 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6623 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 7128 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
6624 | 7129 | ||
7130 | /* mute analog input loopbacks */ | ||
7131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7133 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7135 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
7136 | |||
6625 | /* Front Pin: output 0 (0x0c) */ | 7137 | /* Front Pin: output 0 (0x0c) */ |
6626 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 7138 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
6627 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 7139 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
@@ -6656,11 +7168,6 @@ static struct hda_verb alc882_init_verbs[] = { | |||
6656 | 7168 | ||
6657 | /* FIXME: use matrix-type input source selection */ | 7169 | /* FIXME: use matrix-type input source selection */ |
6658 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | 7170 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
6659 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
6660 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
6661 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
6662 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
6663 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
6664 | /* Input mixer2 */ | 7171 | /* Input mixer2 */ |
6665 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 7172 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
6666 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | 7173 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
@@ -6671,9 +7178,6 @@ static struct hda_verb alc882_init_verbs[] = { | |||
6671 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | 7178 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
6672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | 7179 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
6673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | 7180 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
6674 | /* ADC1: mute amp left and right */ | ||
6675 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
6676 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
6677 | /* ADC2: mute amp left and right */ | 7181 | /* ADC2: mute amp left and right */ |
6678 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 7182 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6679 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | 7183 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -6684,6 +7188,18 @@ static struct hda_verb alc882_init_verbs[] = { | |||
6684 | { } | 7188 | { } |
6685 | }; | 7189 | }; |
6686 | 7190 | ||
7191 | static struct hda_verb alc882_adc1_init_verbs[] = { | ||
7192 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
7193 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7194 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7195 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7196 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
7197 | /* ADC1: mute amp left and right */ | ||
7198 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7199 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7200 | { } | ||
7201 | }; | ||
7202 | |||
6687 | static struct hda_verb alc882_eapd_verbs[] = { | 7203 | static struct hda_verb alc882_eapd_verbs[] = { |
6688 | /* change to EAPD mode */ | 7204 | /* change to EAPD mode */ |
6689 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | 7205 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
@@ -6691,6 +7207,110 @@ static struct hda_verb alc882_eapd_verbs[] = { | |||
6691 | { } | 7207 | { } |
6692 | }; | 7208 | }; |
6693 | 7209 | ||
7210 | static struct hda_verb alc889_eapd_verbs[] = { | ||
7211 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
7212 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
7213 | { } | ||
7214 | }; | ||
7215 | |||
7216 | static struct hda_verb alc_hp15_unsol_verbs[] = { | ||
7217 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
7218 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
7219 | {} | ||
7220 | }; | ||
7221 | |||
7222 | static struct hda_verb alc885_init_verbs[] = { | ||
7223 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | ||
7224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7225 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7226 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7227 | /* Rear mixer */ | ||
7228 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7229 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7230 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7231 | /* CLFE mixer */ | ||
7232 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7233 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7234 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7235 | /* Side mixer */ | ||
7236 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7237 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7238 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7239 | |||
7240 | /* mute analog input loopbacks */ | ||
7241 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7242 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7243 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7244 | |||
7245 | /* Front HP Pin: output 0 (0x0c) */ | ||
7246 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
7247 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7248 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7249 | /* Front Pin: output 0 (0x0c) */ | ||
7250 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7251 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7252 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7253 | /* Rear Pin: output 1 (0x0d) */ | ||
7254 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7255 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7256 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
7257 | /* CLFE Pin: output 2 (0x0e) */ | ||
7258 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7259 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7260 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
7261 | /* Side Pin: output 3 (0x0f) */ | ||
7262 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7263 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7264 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
7265 | /* Mic (rear) pin: input vref at 80% */ | ||
7266 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
7267 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7268 | /* Front Mic pin: input vref at 80% */ | ||
7269 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
7270 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7271 | /* Line In pin: input */ | ||
7272 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
7273 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7274 | |||
7275 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ | ||
7276 | /* Input mixer1 */ | ||
7277 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
7278 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7279 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7280 | /* Input mixer2 */ | ||
7281 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7282 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7283 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7284 | /* Input mixer3 */ | ||
7285 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
7286 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7287 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7288 | /* ADC2: mute amp left and right */ | ||
7289 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7290 | /* ADC3: mute amp left and right */ | ||
7291 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7292 | |||
7293 | { } | ||
7294 | }; | ||
7295 | |||
7296 | static struct hda_verb alc885_init_input_verbs[] = { | ||
7297 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7298 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
7299 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
7300 | { } | ||
7301 | }; | ||
7302 | |||
7303 | |||
7304 | /* Unmute Selector 24h and set the default input to front mic */ | ||
7305 | static struct hda_verb alc889_init_input_verbs[] = { | ||
7306 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7307 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7308 | { } | ||
7309 | }; | ||
7310 | |||
7311 | |||
7312 | #define alc883_init_verbs alc882_base_init_verbs | ||
7313 | |||
6694 | /* Mac Pro test */ | 7314 | /* Mac Pro test */ |
6695 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | 7315 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
6696 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 7316 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -6898,23 +7518,21 @@ static struct hda_verb alc885_imac24_init_verbs[] = { | |||
6898 | }; | 7518 | }; |
6899 | 7519 | ||
6900 | /* Toggle speaker-output according to the hp-jack state */ | 7520 | /* Toggle speaker-output according to the hp-jack state */ |
6901 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) | 7521 | static void alc885_imac24_setup(struct hda_codec *codec) |
6902 | { | 7522 | { |
6903 | struct alc_spec *spec = codec->spec; | 7523 | struct alc_spec *spec = codec->spec; |
6904 | 7524 | ||
6905 | spec->autocfg.hp_pins[0] = 0x14; | 7525 | spec->autocfg.hp_pins[0] = 0x14; |
6906 | spec->autocfg.speaker_pins[0] = 0x18; | 7526 | spec->autocfg.speaker_pins[0] = 0x18; |
6907 | spec->autocfg.speaker_pins[1] = 0x1a; | 7527 | spec->autocfg.speaker_pins[1] = 0x1a; |
6908 | alc_automute_amp(codec); | ||
6909 | } | 7528 | } |
6910 | 7529 | ||
6911 | static void alc885_mbp3_init_hook(struct hda_codec *codec) | 7530 | static void alc885_mbp3_setup(struct hda_codec *codec) |
6912 | { | 7531 | { |
6913 | struct alc_spec *spec = codec->spec; | 7532 | struct alc_spec *spec = codec->spec; |
6914 | 7533 | ||
6915 | spec->autocfg.hp_pins[0] = 0x15; | 7534 | spec->autocfg.hp_pins[0] = 0x15; |
6916 | spec->autocfg.speaker_pins[0] = 0x14; | 7535 | spec->autocfg.speaker_pins[0] = 0x14; |
6917 | alc_automute_amp(codec); | ||
6918 | } | 7536 | } |
6919 | 7537 | ||
6920 | 7538 | ||
@@ -6942,13 +7560,12 @@ static void alc882_targa_automute(struct hda_codec *codec) | |||
6942 | spec->jack_present ? 1 : 3); | 7560 | spec->jack_present ? 1 : 3); |
6943 | } | 7561 | } |
6944 | 7562 | ||
6945 | static void alc882_targa_init_hook(struct hda_codec *codec) | 7563 | static void alc882_targa_setup(struct hda_codec *codec) |
6946 | { | 7564 | { |
6947 | struct alc_spec *spec = codec->spec; | 7565 | struct alc_spec *spec = codec->spec; |
6948 | 7566 | ||
6949 | spec->autocfg.hp_pins[0] = 0x14; | 7567 | spec->autocfg.hp_pins[0] = 0x14; |
6950 | spec->autocfg.speaker_pins[0] = 0x1b; | 7568 | spec->autocfg.speaker_pins[0] = 0x1b; |
6951 | alc882_targa_automute(codec); | ||
6952 | } | 7569 | } |
6953 | 7570 | ||
6954 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | 7571 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
@@ -7036,18 +7653,16 @@ static void alc885_macpro_init_hook(struct hda_codec *codec) | |||
7036 | static void alc885_imac24_init_hook(struct hda_codec *codec) | 7653 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
7037 | { | 7654 | { |
7038 | alc885_macpro_init_hook(codec); | 7655 | alc885_macpro_init_hook(codec); |
7039 | alc885_imac24_automute_init_hook(codec); | 7656 | alc_automute_amp(codec); |
7040 | } | 7657 | } |
7041 | 7658 | ||
7042 | /* | 7659 | /* |
7043 | * generic initialization of ADC, input mixers and output mixers | 7660 | * generic initialization of ADC, input mixers and output mixers |
7044 | */ | 7661 | */ |
7045 | static struct hda_verb alc882_auto_init_verbs[] = { | 7662 | static struct hda_verb alc883_auto_init_verbs[] = { |
7046 | /* | 7663 | /* |
7047 | * Unmute ADC0-2 and set the default input to mic-in | 7664 | * Unmute ADC0-2 and set the default input to mic-in |
7048 | */ | 7665 | */ |
7049 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7050 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7051 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | 7666 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
7052 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 7667 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7053 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | 7668 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -7088,11 +7703,6 @@ static struct hda_verb alc882_auto_init_verbs[] = { | |||
7088 | 7703 | ||
7089 | /* FIXME: use matrix-type input source selection */ | 7704 | /* FIXME: use matrix-type input source selection */ |
7090 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | 7705 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
7091 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
7092 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
7093 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
7094 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
7095 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
7096 | /* Input mixer2 */ | 7706 | /* Input mixer2 */ |
7097 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | 7707 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
7098 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | 7708 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
@@ -7107,821 +7717,6 @@ static struct hda_verb alc882_auto_init_verbs[] = { | |||
7107 | { } | 7717 | { } |
7108 | }; | 7718 | }; |
7109 | 7719 | ||
7110 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
7111 | #define alc882_loopbacks alc880_loopbacks | ||
7112 | #endif | ||
7113 | |||
7114 | /* pcm configuration: identical with ALC880 */ | ||
7115 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback | ||
7116 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | ||
7117 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | ||
7118 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | ||
7119 | |||
7120 | /* | ||
7121 | * configuration and preset | ||
7122 | */ | ||
7123 | static const char *alc882_models[ALC882_MODEL_LAST] = { | ||
7124 | [ALC882_3ST_DIG] = "3stack-dig", | ||
7125 | [ALC882_6ST_DIG] = "6stack-dig", | ||
7126 | [ALC882_ARIMA] = "arima", | ||
7127 | [ALC882_W2JC] = "w2jc", | ||
7128 | [ALC882_TARGA] = "targa", | ||
7129 | [ALC882_ASUS_A7J] = "asus-a7j", | ||
7130 | [ALC882_ASUS_A7M] = "asus-a7m", | ||
7131 | [ALC885_MACPRO] = "macpro", | ||
7132 | [ALC885_MB5] = "mb5", | ||
7133 | [ALC885_MBP3] = "mbp3", | ||
7134 | [ALC885_IMAC24] = "imac24", | ||
7135 | [ALC882_AUTO] = "auto", | ||
7136 | }; | ||
7137 | |||
7138 | static struct snd_pci_quirk alc882_cfg_tbl[] = { | ||
7139 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | ||
7140 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), | ||
7141 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), | ||
7142 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), | ||
7143 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), | ||
7144 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), | ||
7145 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), | ||
7146 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), | ||
7147 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), | ||
7148 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ | ||
7149 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | ||
7150 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), | ||
7151 | {} | ||
7152 | }; | ||
7153 | |||
7154 | static struct alc_config_preset alc882_presets[] = { | ||
7155 | [ALC882_3ST_DIG] = { | ||
7156 | .mixers = { alc882_base_mixer }, | ||
7157 | .init_verbs = { alc882_init_verbs }, | ||
7158 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7159 | .dac_nids = alc882_dac_nids, | ||
7160 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7161 | .dig_in_nid = ALC882_DIGIN_NID, | ||
7162 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
7163 | .channel_mode = alc882_ch_modes, | ||
7164 | .need_dac_fix = 1, | ||
7165 | .input_mux = &alc882_capture_source, | ||
7166 | }, | ||
7167 | [ALC882_6ST_DIG] = { | ||
7168 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | ||
7169 | .init_verbs = { alc882_init_verbs }, | ||
7170 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7171 | .dac_nids = alc882_dac_nids, | ||
7172 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7173 | .dig_in_nid = ALC882_DIGIN_NID, | ||
7174 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | ||
7175 | .channel_mode = alc882_sixstack_modes, | ||
7176 | .input_mux = &alc882_capture_source, | ||
7177 | }, | ||
7178 | [ALC882_ARIMA] = { | ||
7179 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | ||
7180 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, | ||
7181 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7182 | .dac_nids = alc882_dac_nids, | ||
7183 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | ||
7184 | .channel_mode = alc882_sixstack_modes, | ||
7185 | .input_mux = &alc882_capture_source, | ||
7186 | }, | ||
7187 | [ALC882_W2JC] = { | ||
7188 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | ||
7189 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, | ||
7190 | alc880_gpio1_init_verbs }, | ||
7191 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7192 | .dac_nids = alc882_dac_nids, | ||
7193 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
7194 | .channel_mode = alc880_threestack_modes, | ||
7195 | .need_dac_fix = 1, | ||
7196 | .input_mux = &alc882_capture_source, | ||
7197 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7198 | }, | ||
7199 | [ALC885_MBP3] = { | ||
7200 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | ||
7201 | .init_verbs = { alc885_mbp3_init_verbs, | ||
7202 | alc880_gpio1_init_verbs }, | ||
7203 | .num_dacs = 2, | ||
7204 | .dac_nids = alc882_dac_nids, | ||
7205 | .hp_nid = 0x04, | ||
7206 | .channel_mode = alc885_mbp_4ch_modes, | ||
7207 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | ||
7208 | .input_mux = &alc882_capture_source, | ||
7209 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7210 | .dig_in_nid = ALC882_DIGIN_NID, | ||
7211 | .unsol_event = alc_automute_amp_unsol_event, | ||
7212 | .init_hook = alc885_mbp3_init_hook, | ||
7213 | }, | ||
7214 | [ALC885_MB5] = { | ||
7215 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, | ||
7216 | .init_verbs = { alc885_mb5_init_verbs, | ||
7217 | alc880_gpio1_init_verbs }, | ||
7218 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7219 | .dac_nids = alc882_dac_nids, | ||
7220 | .channel_mode = alc885_mb5_6ch_modes, | ||
7221 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), | ||
7222 | .input_mux = &mb5_capture_source, | ||
7223 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7224 | .dig_in_nid = ALC882_DIGIN_NID, | ||
7225 | }, | ||
7226 | [ALC885_MACPRO] = { | ||
7227 | .mixers = { alc882_macpro_mixer }, | ||
7228 | .init_verbs = { alc882_macpro_init_verbs }, | ||
7229 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7230 | .dac_nids = alc882_dac_nids, | ||
7231 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7232 | .dig_in_nid = ALC882_DIGIN_NID, | ||
7233 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
7234 | .channel_mode = alc882_ch_modes, | ||
7235 | .input_mux = &alc882_capture_source, | ||
7236 | .init_hook = alc885_macpro_init_hook, | ||
7237 | }, | ||
7238 | [ALC885_IMAC24] = { | ||
7239 | .mixers = { alc885_imac24_mixer }, | ||
7240 | .init_verbs = { alc885_imac24_init_verbs }, | ||
7241 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7242 | .dac_nids = alc882_dac_nids, | ||
7243 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7244 | .dig_in_nid = ALC882_DIGIN_NID, | ||
7245 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
7246 | .channel_mode = alc882_ch_modes, | ||
7247 | .input_mux = &alc882_capture_source, | ||
7248 | .unsol_event = alc_automute_amp_unsol_event, | ||
7249 | .init_hook = alc885_imac24_init_hook, | ||
7250 | }, | ||
7251 | [ALC882_TARGA] = { | ||
7252 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | ||
7253 | .init_verbs = { alc882_init_verbs, alc880_gpio3_init_verbs, | ||
7254 | alc882_targa_verbs}, | ||
7255 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7256 | .dac_nids = alc882_dac_nids, | ||
7257 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7258 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | ||
7259 | .adc_nids = alc882_adc_nids, | ||
7260 | .capsrc_nids = alc882_capsrc_nids, | ||
7261 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | ||
7262 | .channel_mode = alc882_3ST_6ch_modes, | ||
7263 | .need_dac_fix = 1, | ||
7264 | .input_mux = &alc882_capture_source, | ||
7265 | .unsol_event = alc882_targa_unsol_event, | ||
7266 | .init_hook = alc882_targa_init_hook, | ||
7267 | }, | ||
7268 | [ALC882_ASUS_A7J] = { | ||
7269 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | ||
7270 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, | ||
7271 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7272 | .dac_nids = alc882_dac_nids, | ||
7273 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7274 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | ||
7275 | .adc_nids = alc882_adc_nids, | ||
7276 | .capsrc_nids = alc882_capsrc_nids, | ||
7277 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | ||
7278 | .channel_mode = alc882_3ST_6ch_modes, | ||
7279 | .need_dac_fix = 1, | ||
7280 | .input_mux = &alc882_capture_source, | ||
7281 | }, | ||
7282 | [ALC882_ASUS_A7M] = { | ||
7283 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | ||
7284 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, | ||
7285 | alc880_gpio1_init_verbs, | ||
7286 | alc882_asus_a7m_verbs }, | ||
7287 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
7288 | .dac_nids = alc882_dac_nids, | ||
7289 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
7290 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
7291 | .channel_mode = alc880_threestack_modes, | ||
7292 | .need_dac_fix = 1, | ||
7293 | .input_mux = &alc882_capture_source, | ||
7294 | }, | ||
7295 | }; | ||
7296 | |||
7297 | |||
7298 | /* | ||
7299 | * Pin config fixes | ||
7300 | */ | ||
7301 | enum { | ||
7302 | PINFIX_ABIT_AW9D_MAX | ||
7303 | }; | ||
7304 | |||
7305 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { | ||
7306 | { 0x15, 0x01080104 }, /* side */ | ||
7307 | { 0x16, 0x01011012 }, /* rear */ | ||
7308 | { 0x17, 0x01016011 }, /* clfe */ | ||
7309 | { } | ||
7310 | }; | ||
7311 | |||
7312 | static const struct alc_pincfg *alc882_pin_fixes[] = { | ||
7313 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, | ||
7314 | }; | ||
7315 | |||
7316 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { | ||
7317 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | ||
7318 | {} | ||
7319 | }; | ||
7320 | |||
7321 | /* | ||
7322 | * BIOS auto configuration | ||
7323 | */ | ||
7324 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | ||
7325 | hda_nid_t nid, int pin_type, | ||
7326 | int dac_idx) | ||
7327 | { | ||
7328 | /* set as output */ | ||
7329 | struct alc_spec *spec = codec->spec; | ||
7330 | int idx; | ||
7331 | |||
7332 | alc_set_pin_output(codec, nid, pin_type); | ||
7333 | if (spec->multiout.dac_nids[dac_idx] == 0x25) | ||
7334 | idx = 4; | ||
7335 | else | ||
7336 | idx = spec->multiout.dac_nids[dac_idx] - 2; | ||
7337 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | ||
7338 | |||
7339 | } | ||
7340 | |||
7341 | static void alc882_auto_init_multi_out(struct hda_codec *codec) | ||
7342 | { | ||
7343 | struct alc_spec *spec = codec->spec; | ||
7344 | int i; | ||
7345 | |||
7346 | for (i = 0; i <= HDA_SIDE; i++) { | ||
7347 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | ||
7348 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | ||
7349 | if (nid) | ||
7350 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, | ||
7351 | i); | ||
7352 | } | ||
7353 | } | ||
7354 | |||
7355 | static void alc882_auto_init_hp_out(struct hda_codec *codec) | ||
7356 | { | ||
7357 | struct alc_spec *spec = codec->spec; | ||
7358 | hda_nid_t pin; | ||
7359 | |||
7360 | pin = spec->autocfg.hp_pins[0]; | ||
7361 | if (pin) /* connect to front */ | ||
7362 | /* use dac 0 */ | ||
7363 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | ||
7364 | pin = spec->autocfg.speaker_pins[0]; | ||
7365 | if (pin) | ||
7366 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | ||
7367 | } | ||
7368 | |||
7369 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) | ||
7370 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID | ||
7371 | |||
7372 | static void alc882_auto_init_analog_input(struct hda_codec *codec) | ||
7373 | { | ||
7374 | struct alc_spec *spec = codec->spec; | ||
7375 | int i; | ||
7376 | |||
7377 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
7378 | hda_nid_t nid = spec->autocfg.input_pins[i]; | ||
7379 | if (!nid) | ||
7380 | continue; | ||
7381 | alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); | ||
7382 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) | ||
7383 | snd_hda_codec_write(codec, nid, 0, | ||
7384 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
7385 | AMP_OUT_MUTE); | ||
7386 | } | ||
7387 | } | ||
7388 | |||
7389 | static void alc882_auto_init_input_src(struct hda_codec *codec) | ||
7390 | { | ||
7391 | struct alc_spec *spec = codec->spec; | ||
7392 | int c; | ||
7393 | |||
7394 | for (c = 0; c < spec->num_adc_nids; c++) { | ||
7395 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | ||
7396 | hda_nid_t nid = spec->capsrc_nids[c]; | ||
7397 | unsigned int mux_idx; | ||
7398 | const struct hda_input_mux *imux; | ||
7399 | int conns, mute, idx, item; | ||
7400 | |||
7401 | conns = snd_hda_get_connections(codec, nid, conn_list, | ||
7402 | ARRAY_SIZE(conn_list)); | ||
7403 | if (conns < 0) | ||
7404 | continue; | ||
7405 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | ||
7406 | imux = &spec->input_mux[mux_idx]; | ||
7407 | for (idx = 0; idx < conns; idx++) { | ||
7408 | /* if the current connection is the selected one, | ||
7409 | * unmute it as default - otherwise mute it | ||
7410 | */ | ||
7411 | mute = AMP_IN_MUTE(idx); | ||
7412 | for (item = 0; item < imux->num_items; item++) { | ||
7413 | if (imux->items[item].index == idx) { | ||
7414 | if (spec->cur_mux[c] == item) | ||
7415 | mute = AMP_IN_UNMUTE(idx); | ||
7416 | break; | ||
7417 | } | ||
7418 | } | ||
7419 | /* check if we have a selector or mixer | ||
7420 | * we could check for the widget type instead, but | ||
7421 | * just check for Amp-In presence (in case of mixer | ||
7422 | * without amp-in there is something wrong, this | ||
7423 | * function shouldn't be used or capsrc nid is wrong) | ||
7424 | */ | ||
7425 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | ||
7426 | snd_hda_codec_write(codec, nid, 0, | ||
7427 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
7428 | mute); | ||
7429 | else if (mute != AMP_IN_MUTE(idx)) | ||
7430 | snd_hda_codec_write(codec, nid, 0, | ||
7431 | AC_VERB_SET_CONNECT_SEL, | ||
7432 | idx); | ||
7433 | } | ||
7434 | } | ||
7435 | } | ||
7436 | |||
7437 | /* add mic boosts if needed */ | ||
7438 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | ||
7439 | { | ||
7440 | struct alc_spec *spec = codec->spec; | ||
7441 | int err; | ||
7442 | hda_nid_t nid; | ||
7443 | |||
7444 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | ||
7445 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | ||
7446 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
7447 | "Mic Boost", | ||
7448 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
7449 | if (err < 0) | ||
7450 | return err; | ||
7451 | } | ||
7452 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | ||
7453 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | ||
7454 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
7455 | "Front Mic Boost", | ||
7456 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
7457 | if (err < 0) | ||
7458 | return err; | ||
7459 | } | ||
7460 | return 0; | ||
7461 | } | ||
7462 | |||
7463 | /* almost identical with ALC880 parser... */ | ||
7464 | static int alc882_parse_auto_config(struct hda_codec *codec) | ||
7465 | { | ||
7466 | struct alc_spec *spec = codec->spec; | ||
7467 | int err = alc880_parse_auto_config(codec); | ||
7468 | |||
7469 | if (err < 0) | ||
7470 | return err; | ||
7471 | else if (!err) | ||
7472 | return 0; /* no config found */ | ||
7473 | |||
7474 | err = alc_auto_add_mic_boost(codec); | ||
7475 | if (err < 0) | ||
7476 | return err; | ||
7477 | |||
7478 | /* hack - override the init verbs */ | ||
7479 | spec->init_verbs[0] = alc882_auto_init_verbs; | ||
7480 | |||
7481 | return 1; /* config found */ | ||
7482 | } | ||
7483 | |||
7484 | /* additional initialization for auto-configuration model */ | ||
7485 | static void alc882_auto_init(struct hda_codec *codec) | ||
7486 | { | ||
7487 | struct alc_spec *spec = codec->spec; | ||
7488 | alc882_auto_init_multi_out(codec); | ||
7489 | alc882_auto_init_hp_out(codec); | ||
7490 | alc882_auto_init_analog_input(codec); | ||
7491 | alc882_auto_init_input_src(codec); | ||
7492 | if (spec->unsol_event) | ||
7493 | alc_inithook(codec); | ||
7494 | } | ||
7495 | |||
7496 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ | ||
7497 | |||
7498 | static int patch_alc882(struct hda_codec *codec) | ||
7499 | { | ||
7500 | struct alc_spec *spec; | ||
7501 | int err, board_config; | ||
7502 | |||
7503 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
7504 | if (spec == NULL) | ||
7505 | return -ENOMEM; | ||
7506 | |||
7507 | codec->spec = spec; | ||
7508 | |||
7509 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, | ||
7510 | alc882_models, | ||
7511 | alc882_cfg_tbl); | ||
7512 | |||
7513 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | ||
7514 | /* Pick up systems that don't supply PCI SSID */ | ||
7515 | switch (codec->subsystem_id) { | ||
7516 | case 0x106b0c00: /* Mac Pro */ | ||
7517 | board_config = ALC885_MACPRO; | ||
7518 | break; | ||
7519 | case 0x106b1000: /* iMac 24 */ | ||
7520 | case 0x106b2800: /* AppleTV */ | ||
7521 | case 0x106b3e00: /* iMac 24 Aluminium */ | ||
7522 | board_config = ALC885_IMAC24; | ||
7523 | break; | ||
7524 | case 0x106b00a0: /* MacBookPro3,1 - Another revision */ | ||
7525 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ | ||
7526 | case 0x106b00a4: /* MacbookPro4,1 */ | ||
7527 | case 0x106b2c00: /* Macbook Pro rev3 */ | ||
7528 | /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */ | ||
7529 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ | ||
7530 | board_config = ALC885_MBP3; | ||
7531 | break; | ||
7532 | case 0x106b3f00: /* Macbook 5,1 */ | ||
7533 | case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense | ||
7534 | * seems not working, so apparently | ||
7535 | * no perfect solution yet | ||
7536 | */ | ||
7537 | board_config = ALC885_MB5; | ||
7538 | break; | ||
7539 | default: | ||
7540 | /* ALC889A is handled better as ALC888-compatible */ | ||
7541 | if (codec->revision_id == 0x100101 || | ||
7542 | codec->revision_id == 0x100103) { | ||
7543 | alc_free(codec); | ||
7544 | return patch_alc883(codec); | ||
7545 | } | ||
7546 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | ||
7547 | "trying auto-probe from BIOS...\n", | ||
7548 | codec->chip_name); | ||
7549 | board_config = ALC882_AUTO; | ||
7550 | } | ||
7551 | } | ||
7552 | |||
7553 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); | ||
7554 | |||
7555 | if (board_config == ALC882_AUTO) { | ||
7556 | /* automatic parse from the BIOS config */ | ||
7557 | err = alc882_parse_auto_config(codec); | ||
7558 | if (err < 0) { | ||
7559 | alc_free(codec); | ||
7560 | return err; | ||
7561 | } else if (!err) { | ||
7562 | printk(KERN_INFO | ||
7563 | "hda_codec: Cannot set up configuration " | ||
7564 | "from BIOS. Using base mode...\n"); | ||
7565 | board_config = ALC882_3ST_DIG; | ||
7566 | } | ||
7567 | } | ||
7568 | |||
7569 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
7570 | if (err < 0) { | ||
7571 | alc_free(codec); | ||
7572 | return err; | ||
7573 | } | ||
7574 | |||
7575 | if (board_config != ALC882_AUTO) | ||
7576 | setup_preset(spec, &alc882_presets[board_config]); | ||
7577 | |||
7578 | spec->stream_analog_playback = &alc882_pcm_analog_playback; | ||
7579 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | ||
7580 | /* FIXME: setup DAC5 */ | ||
7581 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ | ||
7582 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | ||
7583 | |||
7584 | spec->stream_digital_playback = &alc882_pcm_digital_playback; | ||
7585 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | ||
7586 | |||
7587 | if (!spec->adc_nids && spec->input_mux) { | ||
7588 | /* check whether NID 0x07 is valid */ | ||
7589 | unsigned int wcap = get_wcaps(codec, 0x07); | ||
7590 | /* get type */ | ||
7591 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | ||
7592 | if (wcap != AC_WID_AUD_IN) { | ||
7593 | spec->adc_nids = alc882_adc_nids_alt; | ||
7594 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); | ||
7595 | spec->capsrc_nids = alc882_capsrc_nids_alt; | ||
7596 | } else { | ||
7597 | spec->adc_nids = alc882_adc_nids; | ||
7598 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); | ||
7599 | spec->capsrc_nids = alc882_capsrc_nids; | ||
7600 | } | ||
7601 | } | ||
7602 | set_capture_mixer(spec); | ||
7603 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
7604 | |||
7605 | spec->vmaster_nid = 0x0c; | ||
7606 | |||
7607 | codec->patch_ops = alc_patch_ops; | ||
7608 | if (board_config == ALC882_AUTO) | ||
7609 | spec->init_hook = alc882_auto_init; | ||
7610 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
7611 | if (!spec->loopback.amplist) | ||
7612 | spec->loopback.amplist = alc882_loopbacks; | ||
7613 | #endif | ||
7614 | codec->proc_widget_hook = print_realtek_coef; | ||
7615 | |||
7616 | return 0; | ||
7617 | } | ||
7618 | |||
7619 | /* | ||
7620 | * ALC883 support | ||
7621 | * | ||
7622 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible | ||
7623 | * configuration. Each pin widget can choose any input DACs and a mixer. | ||
7624 | * Each ADC is connected from a mixer of all inputs. This makes possible | ||
7625 | * 6-channel independent captures. | ||
7626 | * | ||
7627 | * In addition, an independent DAC for the multi-playback (not used in this | ||
7628 | * driver yet). | ||
7629 | */ | ||
7630 | #define ALC883_DIGOUT_NID 0x06 | ||
7631 | #define ALC883_DIGIN_NID 0x0a | ||
7632 | |||
7633 | #define ALC1200_DIGOUT_NID 0x10 | ||
7634 | |||
7635 | static hda_nid_t alc883_dac_nids[4] = { | ||
7636 | /* front, rear, clfe, rear_surr */ | ||
7637 | 0x02, 0x03, 0x04, 0x05 | ||
7638 | }; | ||
7639 | |||
7640 | static hda_nid_t alc883_adc_nids[2] = { | ||
7641 | /* ADC1-2 */ | ||
7642 | 0x08, 0x09, | ||
7643 | }; | ||
7644 | |||
7645 | static hda_nid_t alc883_adc_nids_alt[1] = { | ||
7646 | /* ADC1 */ | ||
7647 | 0x08, | ||
7648 | }; | ||
7649 | |||
7650 | static hda_nid_t alc883_adc_nids_rev[2] = { | ||
7651 | /* ADC2-1 */ | ||
7652 | 0x09, 0x08 | ||
7653 | }; | ||
7654 | |||
7655 | #define alc889_adc_nids alc880_adc_nids | ||
7656 | |||
7657 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; | ||
7658 | |||
7659 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | ||
7660 | |||
7661 | #define alc889_capsrc_nids alc882_capsrc_nids | ||
7662 | |||
7663 | /* input MUX */ | ||
7664 | /* FIXME: should be a matrix-type input source selection */ | ||
7665 | |||
7666 | static struct hda_input_mux alc883_capture_source = { | ||
7667 | .num_items = 4, | ||
7668 | .items = { | ||
7669 | { "Mic", 0x0 }, | ||
7670 | { "Front Mic", 0x1 }, | ||
7671 | { "Line", 0x2 }, | ||
7672 | { "CD", 0x4 }, | ||
7673 | }, | ||
7674 | }; | ||
7675 | |||
7676 | static struct hda_input_mux alc883_3stack_6ch_intel = { | ||
7677 | .num_items = 4, | ||
7678 | .items = { | ||
7679 | { "Mic", 0x1 }, | ||
7680 | { "Front Mic", 0x0 }, | ||
7681 | { "Line", 0x2 }, | ||
7682 | { "CD", 0x4 }, | ||
7683 | }, | ||
7684 | }; | ||
7685 | |||
7686 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { | ||
7687 | .num_items = 2, | ||
7688 | .items = { | ||
7689 | { "Mic", 0x1 }, | ||
7690 | { "Line", 0x2 }, | ||
7691 | }, | ||
7692 | }; | ||
7693 | |||
7694 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | ||
7695 | .num_items = 4, | ||
7696 | .items = { | ||
7697 | { "Mic", 0x0 }, | ||
7698 | { "iMic", 0x1 }, | ||
7699 | { "Line", 0x2 }, | ||
7700 | { "CD", 0x4 }, | ||
7701 | }, | ||
7702 | }; | ||
7703 | |||
7704 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | ||
7705 | .num_items = 2, | ||
7706 | .items = { | ||
7707 | { "Mic", 0x0 }, | ||
7708 | { "Int Mic", 0x1 }, | ||
7709 | }, | ||
7710 | }; | ||
7711 | |||
7712 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | ||
7713 | .num_items = 3, | ||
7714 | .items = { | ||
7715 | { "Mic", 0x0 }, | ||
7716 | { "Front Mic", 0x1 }, | ||
7717 | { "Line", 0x4 }, | ||
7718 | }, | ||
7719 | }; | ||
7720 | |||
7721 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | ||
7722 | .num_items = 2, | ||
7723 | .items = { | ||
7724 | { "Mic", 0x0 }, | ||
7725 | { "Line", 0x2 }, | ||
7726 | }, | ||
7727 | }; | ||
7728 | |||
7729 | static struct hda_input_mux alc889A_mb31_capture_source = { | ||
7730 | .num_items = 2, | ||
7731 | .items = { | ||
7732 | { "Mic", 0x0 }, | ||
7733 | /* Front Mic (0x01) unused */ | ||
7734 | { "Line", 0x2 }, | ||
7735 | /* Line 2 (0x03) unused */ | ||
7736 | /* CD (0x04) unsused? */ | ||
7737 | }, | ||
7738 | }; | ||
7739 | |||
7740 | /* | ||
7741 | * 2ch mode | ||
7742 | */ | ||
7743 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | ||
7744 | { 2, NULL } | ||
7745 | }; | ||
7746 | |||
7747 | /* | ||
7748 | * 2ch mode | ||
7749 | */ | ||
7750 | static struct hda_verb alc883_3ST_ch2_init[] = { | ||
7751 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
7752 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7753 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
7754 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7755 | { } /* end */ | ||
7756 | }; | ||
7757 | |||
7758 | /* | ||
7759 | * 4ch mode | ||
7760 | */ | ||
7761 | static struct hda_verb alc883_3ST_ch4_init[] = { | ||
7762 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
7763 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7764 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7765 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7766 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7767 | { } /* end */ | ||
7768 | }; | ||
7769 | |||
7770 | /* | ||
7771 | * 6ch mode | ||
7772 | */ | ||
7773 | static struct hda_verb alc883_3ST_ch6_init[] = { | ||
7774 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7775 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7776 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
7777 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7778 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7779 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7780 | { } /* end */ | ||
7781 | }; | ||
7782 | |||
7783 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { | ||
7784 | { 2, alc883_3ST_ch2_init }, | ||
7785 | { 4, alc883_3ST_ch4_init }, | ||
7786 | { 6, alc883_3ST_ch6_init }, | ||
7787 | }; | ||
7788 | |||
7789 | |||
7790 | /* | ||
7791 | * 2ch mode | ||
7792 | */ | ||
7793 | static struct hda_verb alc883_4ST_ch2_init[] = { | ||
7794 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7795 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7796 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
7797 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7798 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
7799 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7800 | { } /* end */ | ||
7801 | }; | ||
7802 | |||
7803 | /* | ||
7804 | * 4ch mode | ||
7805 | */ | ||
7806 | static struct hda_verb alc883_4ST_ch4_init[] = { | ||
7807 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7808 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7809 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
7810 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7811 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7812 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7813 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7814 | { } /* end */ | ||
7815 | }; | ||
7816 | |||
7817 | /* | ||
7818 | * 6ch mode | ||
7819 | */ | ||
7820 | static struct hda_verb alc883_4ST_ch6_init[] = { | ||
7821 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7822 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7823 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7824 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7825 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
7826 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7827 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7828 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7829 | { } /* end */ | ||
7830 | }; | ||
7831 | |||
7832 | /* | ||
7833 | * 8ch mode | ||
7834 | */ | ||
7835 | static struct hda_verb alc883_4ST_ch8_init[] = { | ||
7836 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7837 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7838 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
7839 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7840 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7841 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
7842 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7843 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7844 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7845 | { } /* end */ | ||
7846 | }; | ||
7847 | |||
7848 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { | ||
7849 | { 2, alc883_4ST_ch2_init }, | ||
7850 | { 4, alc883_4ST_ch4_init }, | ||
7851 | { 6, alc883_4ST_ch6_init }, | ||
7852 | { 8, alc883_4ST_ch8_init }, | ||
7853 | }; | ||
7854 | |||
7855 | |||
7856 | /* | ||
7857 | * 2ch mode | ||
7858 | */ | ||
7859 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | ||
7860 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
7861 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7862 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
7863 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7864 | { } /* end */ | ||
7865 | }; | ||
7866 | |||
7867 | /* | ||
7868 | * 4ch mode | ||
7869 | */ | ||
7870 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | ||
7871 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
7872 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
7873 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7874 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7875 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7876 | { } /* end */ | ||
7877 | }; | ||
7878 | |||
7879 | /* | ||
7880 | * 6ch mode | ||
7881 | */ | ||
7882 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | ||
7883 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7884 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7885 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
7886 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7887 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
7888 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
7889 | { } /* end */ | ||
7890 | }; | ||
7891 | |||
7892 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | ||
7893 | { 2, alc883_3ST_ch2_intel_init }, | ||
7894 | { 4, alc883_3ST_ch4_intel_init }, | ||
7895 | { 6, alc883_3ST_ch6_intel_init }, | ||
7896 | }; | ||
7897 | |||
7898 | /* | ||
7899 | * 6ch mode | ||
7900 | */ | ||
7901 | static struct hda_verb alc883_sixstack_ch6_init[] = { | ||
7902 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
7903 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7904 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7905 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7906 | { } /* end */ | ||
7907 | }; | ||
7908 | |||
7909 | /* | ||
7910 | * 8ch mode | ||
7911 | */ | ||
7912 | static struct hda_verb alc883_sixstack_ch8_init[] = { | ||
7913 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7914 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7915 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7916 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
7917 | { } /* end */ | ||
7918 | }; | ||
7919 | |||
7920 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | ||
7921 | { 6, alc883_sixstack_ch6_init }, | ||
7922 | { 8, alc883_sixstack_ch8_init }, | ||
7923 | }; | ||
7924 | |||
7925 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ | 7720 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
7926 | static struct hda_verb alc889A_mb31_ch2_init[] = { | 7721 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
7927 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | 7722 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
@@ -7972,34 +7767,7 @@ static struct hda_verb alc883_medion_eapd_verbs[] = { | |||
7972 | { } | 7767 | { } |
7973 | }; | 7768 | }; |
7974 | 7769 | ||
7975 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | 7770 | #define alc883_base_mixer alc882_base_mixer |
7976 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | ||
7977 | */ | ||
7978 | |||
7979 | static struct snd_kcontrol_new alc883_base_mixer[] = { | ||
7980 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
7981 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
7982 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
7983 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
7984 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
7985 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
7986 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
7987 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
7988 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
7989 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
7990 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
7991 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
7992 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
7993 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
7994 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
7995 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
7996 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
7997 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
7998 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
7999 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
8000 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
8001 | { } /* end */ | ||
8002 | }; | ||
8003 | 7771 | ||
8004 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { | 7772 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
8005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 7773 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -8110,6 +7878,30 @@ static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { | |||
8110 | { } /* end */ | 7878 | { } /* end */ |
8111 | }; | 7879 | }; |
8112 | 7880 | ||
7881 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { | ||
7882 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
7883 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
7884 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
7885 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
7886 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
7887 | HDA_OUTPUT), | ||
7888 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
7889 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
7890 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
7891 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
7892 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), | ||
7893 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
7894 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
7895 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
7896 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | ||
7897 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), | ||
7898 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | ||
7899 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
7900 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | ||
7901 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
7902 | { } /* end */ | ||
7903 | }; | ||
7904 | |||
8113 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { | 7905 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
8114 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 7906 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8115 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 7907 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
@@ -8350,93 +8142,14 @@ static struct snd_kcontrol_new alc883_chmode_mixer[] = { | |||
8350 | { } /* end */ | 8142 | { } /* end */ |
8351 | }; | 8143 | }; |
8352 | 8144 | ||
8353 | static struct hda_verb alc883_init_verbs[] = { | ||
8354 | /* ADC1: mute amp left and right */ | ||
8355 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8356 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8357 | /* ADC2: mute amp left and right */ | ||
8358 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8359 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8360 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | ||
8361 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8362 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8364 | /* Rear mixer */ | ||
8365 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8366 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8367 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8368 | /* CLFE mixer */ | ||
8369 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8370 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8371 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8372 | /* Side mixer */ | ||
8373 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8374 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8375 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8376 | |||
8377 | /* mute analog input loopbacks */ | ||
8378 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8379 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8380 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
8381 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
8382 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
8383 | |||
8384 | /* Front Pin: output 0 (0x0c) */ | ||
8385 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
8386 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
8387 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8388 | /* Rear Pin: output 1 (0x0d) */ | ||
8389 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
8390 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
8391 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
8392 | /* CLFE Pin: output 2 (0x0e) */ | ||
8393 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
8394 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
8395 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
8396 | /* Side Pin: output 3 (0x0f) */ | ||
8397 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
8398 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
8399 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
8400 | /* Mic (rear) pin: input vref at 80% */ | ||
8401 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
8402 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
8403 | /* Front Mic pin: input vref at 80% */ | ||
8404 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
8405 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
8406 | /* Line In pin: input */ | ||
8407 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
8408 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
8409 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | ||
8410 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
8411 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
8412 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8413 | /* CD pin widget for input */ | ||
8414 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
8415 | |||
8416 | /* FIXME: use matrix-type input source selection */ | ||
8417 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
8418 | /* Input mixer2 */ | ||
8419 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8420 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8421 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
8422 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
8423 | /* Input mixer3 */ | ||
8424 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8425 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8426 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
8427 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
8428 | { } | ||
8429 | }; | ||
8430 | |||
8431 | /* toggle speaker-output according to the hp-jack state */ | 8145 | /* toggle speaker-output according to the hp-jack state */ |
8432 | static void alc883_mitac_init_hook(struct hda_codec *codec) | 8146 | static void alc883_mitac_setup(struct hda_codec *codec) |
8433 | { | 8147 | { |
8434 | struct alc_spec *spec = codec->spec; | 8148 | struct alc_spec *spec = codec->spec; |
8435 | 8149 | ||
8436 | spec->autocfg.hp_pins[0] = 0x15; | 8150 | spec->autocfg.hp_pins[0] = 0x15; |
8437 | spec->autocfg.speaker_pins[0] = 0x14; | 8151 | spec->autocfg.speaker_pins[0] = 0x14; |
8438 | spec->autocfg.speaker_pins[1] = 0x17; | 8152 | spec->autocfg.speaker_pins[1] = 0x17; |
8439 | alc_automute_amp(codec); | ||
8440 | } | 8153 | } |
8441 | 8154 | ||
8442 | /* auto-toggle front mic */ | 8155 | /* auto-toggle front mic */ |
@@ -8468,6 +8181,22 @@ static struct hda_verb alc883_mitac_verbs[] = { | |||
8468 | { } /* end */ | 8181 | { } /* end */ |
8469 | }; | 8182 | }; |
8470 | 8183 | ||
8184 | static struct hda_verb alc883_clevo_m540r_verbs[] = { | ||
8185 | /* HP */ | ||
8186 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8187 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
8188 | /* Int speaker */ | ||
8189 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ | ||
8190 | |||
8191 | /* enable unsolicited event */ | ||
8192 | /* | ||
8193 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
8194 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
8195 | */ | ||
8196 | |||
8197 | { } /* end */ | ||
8198 | }; | ||
8199 | |||
8471 | static struct hda_verb alc883_clevo_m720_verbs[] = { | 8200 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
8472 | /* HP */ | 8201 | /* HP */ |
8473 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | 8202 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -8591,7 +8320,7 @@ static struct hda_verb alc883_vaiott_verbs[] = { | |||
8591 | { } /* end */ | 8320 | { } /* end */ |
8592 | }; | 8321 | }; |
8593 | 8322 | ||
8594 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) | 8323 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
8595 | { | 8324 | { |
8596 | struct alc_spec *spec = codec->spec; | 8325 | struct alc_spec *spec = codec->spec; |
8597 | 8326 | ||
@@ -8599,7 +8328,6 @@ static void alc888_3st_hp_init_hook(struct hda_codec *codec) | |||
8599 | spec->autocfg.speaker_pins[0] = 0x14; | 8328 | spec->autocfg.speaker_pins[0] = 0x14; |
8600 | spec->autocfg.speaker_pins[1] = 0x16; | 8329 | spec->autocfg.speaker_pins[1] = 0x16; |
8601 | spec->autocfg.speaker_pins[2] = 0x18; | 8330 | spec->autocfg.speaker_pins[2] = 0x18; |
8602 | alc_automute_amp(codec); | ||
8603 | } | 8331 | } |
8604 | 8332 | ||
8605 | static struct hda_verb alc888_3st_hp_verbs[] = { | 8333 | static struct hda_verb alc888_3st_hp_verbs[] = { |
@@ -8696,13 +8424,12 @@ static struct hda_verb alc883_medion_md2_verbs[] = { | |||
8696 | }; | 8424 | }; |
8697 | 8425 | ||
8698 | /* toggle speaker-output according to the hp-jack state */ | 8426 | /* toggle speaker-output according to the hp-jack state */ |
8699 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) | 8427 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
8700 | { | 8428 | { |
8701 | struct alc_spec *spec = codec->spec; | 8429 | struct alc_spec *spec = codec->spec; |
8702 | 8430 | ||
8703 | spec->autocfg.hp_pins[0] = 0x14; | 8431 | spec->autocfg.hp_pins[0] = 0x14; |
8704 | spec->autocfg.speaker_pins[0] = 0x15; | 8432 | spec->autocfg.speaker_pins[0] = 0x15; |
8705 | alc_automute_amp(codec); | ||
8706 | } | 8433 | } |
8707 | 8434 | ||
8708 | /* toggle speaker-output according to the hp-jack state */ | 8435 | /* toggle speaker-output according to the hp-jack state */ |
@@ -8719,12 +8446,16 @@ static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) | |||
8719 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | 8446 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
8720 | } | 8447 | } |
8721 | 8448 | ||
8722 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | 8449 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
8723 | { | 8450 | { |
8724 | struct alc_spec *spec = codec->spec; | 8451 | struct alc_spec *spec = codec->spec; |
8725 | 8452 | ||
8726 | spec->autocfg.hp_pins[0] = 0x15; | 8453 | spec->autocfg.hp_pins[0] = 0x15; |
8727 | spec->autocfg.speaker_pins[0] = 0x14; | 8454 | spec->autocfg.speaker_pins[0] = 0x14; |
8455 | } | ||
8456 | |||
8457 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | ||
8458 | { | ||
8728 | alc_automute_amp(codec); | 8459 | alc_automute_amp(codec); |
8729 | alc883_clevo_m720_mic_automute(codec); | 8460 | alc883_clevo_m720_mic_automute(codec); |
8730 | } | 8461 | } |
@@ -8743,22 +8474,20 @@ static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | |||
8743 | } | 8474 | } |
8744 | 8475 | ||
8745 | /* toggle speaker-output according to the hp-jack state */ | 8476 | /* toggle speaker-output according to the hp-jack state */ |
8746 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) | 8477 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
8747 | { | 8478 | { |
8748 | struct alc_spec *spec = codec->spec; | 8479 | struct alc_spec *spec = codec->spec; |
8749 | 8480 | ||
8750 | spec->autocfg.hp_pins[0] = 0x14; | 8481 | spec->autocfg.hp_pins[0] = 0x14; |
8751 | spec->autocfg.speaker_pins[0] = 0x15; | 8482 | spec->autocfg.speaker_pins[0] = 0x15; |
8752 | alc_automute_amp(codec); | ||
8753 | } | 8483 | } |
8754 | 8484 | ||
8755 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) | 8485 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
8756 | { | 8486 | { |
8757 | struct alc_spec *spec = codec->spec; | 8487 | struct alc_spec *spec = codec->spec; |
8758 | 8488 | ||
8759 | spec->autocfg.hp_pins[0] = 0x1b; | 8489 | spec->autocfg.hp_pins[0] = 0x1b; |
8760 | spec->autocfg.speaker_pins[0] = 0x14; | 8490 | spec->autocfg.speaker_pins[0] = 0x14; |
8761 | alc_automute_amp(codec); | ||
8762 | } | 8491 | } |
8763 | 8492 | ||
8764 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | 8493 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
@@ -8797,14 +8526,13 @@ static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |||
8797 | } | 8526 | } |
8798 | 8527 | ||
8799 | /* toggle speaker-output according to the hp-jack state */ | 8528 | /* toggle speaker-output according to the hp-jack state */ |
8800 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) | 8529 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
8801 | { | 8530 | { |
8802 | struct alc_spec *spec = codec->spec; | 8531 | struct alc_spec *spec = codec->spec; |
8803 | 8532 | ||
8804 | spec->autocfg.hp_pins[0] = 0x14; | 8533 | spec->autocfg.hp_pins[0] = 0x14; |
8805 | spec->autocfg.speaker_pins[0] = 0x15; | 8534 | spec->autocfg.speaker_pins[0] = 0x15; |
8806 | spec->autocfg.speaker_pins[1] = 0x16; | 8535 | spec->autocfg.speaker_pins[1] = 0x16; |
8807 | alc_automute_amp(codec); | ||
8808 | } | 8536 | } |
8809 | 8537 | ||
8810 | static struct hda_verb alc883_acer_eapd_verbs[] = { | 8538 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
@@ -8825,7 +8553,14 @@ static struct hda_verb alc883_acer_eapd_verbs[] = { | |||
8825 | { } | 8553 | { } |
8826 | }; | 8554 | }; |
8827 | 8555 | ||
8828 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) | 8556 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
8557 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8558 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
8559 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
8560 | { } /* end */ | ||
8561 | }; | ||
8562 | |||
8563 | static void alc888_6st_dell_setup(struct hda_codec *codec) | ||
8829 | { | 8564 | { |
8830 | struct alc_spec *spec = codec->spec; | 8565 | struct alc_spec *spec = codec->spec; |
8831 | 8566 | ||
@@ -8834,10 +8569,9 @@ static void alc888_6st_dell_init_hook(struct hda_codec *codec) | |||
8834 | spec->autocfg.speaker_pins[1] = 0x15; | 8569 | spec->autocfg.speaker_pins[1] = 0x15; |
8835 | spec->autocfg.speaker_pins[2] = 0x16; | 8570 | spec->autocfg.speaker_pins[2] = 0x16; |
8836 | spec->autocfg.speaker_pins[3] = 0x17; | 8571 | spec->autocfg.speaker_pins[3] = 0x17; |
8837 | alc_automute_amp(codec); | ||
8838 | } | 8572 | } |
8839 | 8573 | ||
8840 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) | 8574 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
8841 | { | 8575 | { |
8842 | struct alc_spec *spec = codec->spec; | 8576 | struct alc_spec *spec = codec->spec; |
8843 | 8577 | ||
@@ -8847,82 +8581,17 @@ static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) | |||
8847 | spec->autocfg.speaker_pins[2] = 0x16; | 8581 | spec->autocfg.speaker_pins[2] = 0x16; |
8848 | spec->autocfg.speaker_pins[3] = 0x17; | 8582 | spec->autocfg.speaker_pins[3] = 0x17; |
8849 | spec->autocfg.speaker_pins[4] = 0x1a; | 8583 | spec->autocfg.speaker_pins[4] = 0x1a; |
8850 | alc_automute_amp(codec); | ||
8851 | } | 8584 | } |
8852 | 8585 | ||
8853 | static void alc883_vaiott_init_hook(struct hda_codec *codec) | 8586 | static void alc883_vaiott_setup(struct hda_codec *codec) |
8854 | { | 8587 | { |
8855 | struct alc_spec *spec = codec->spec; | 8588 | struct alc_spec *spec = codec->spec; |
8856 | 8589 | ||
8857 | spec->autocfg.hp_pins[0] = 0x15; | 8590 | spec->autocfg.hp_pins[0] = 0x15; |
8858 | spec->autocfg.speaker_pins[0] = 0x14; | 8591 | spec->autocfg.speaker_pins[0] = 0x14; |
8859 | spec->autocfg.speaker_pins[1] = 0x17; | 8592 | spec->autocfg.speaker_pins[1] = 0x17; |
8860 | alc_automute_amp(codec); | ||
8861 | } | 8593 | } |
8862 | 8594 | ||
8863 | /* | ||
8864 | * generic initialization of ADC, input mixers and output mixers | ||
8865 | */ | ||
8866 | static struct hda_verb alc883_auto_init_verbs[] = { | ||
8867 | /* | ||
8868 | * Unmute ADC0-2 and set the default input to mic-in | ||
8869 | */ | ||
8870 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8871 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8872 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8873 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8874 | |||
8875 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | ||
8876 | * mixer widget | ||
8877 | * Note: PASD motherboards uses the Line In 2 as the input for | ||
8878 | * front panel mic (mic 2) | ||
8879 | */ | ||
8880 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
8881 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8882 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8883 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
8884 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
8885 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
8886 | |||
8887 | /* | ||
8888 | * Set up output mixers (0x0c - 0x0f) | ||
8889 | */ | ||
8890 | /* set vol=0 to output mixers */ | ||
8891 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8892 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8893 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8894 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8895 | /* set up input amps for analog loopback */ | ||
8896 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
8897 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8898 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8899 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8900 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8901 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8902 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8903 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8904 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8905 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8906 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8907 | |||
8908 | /* FIXME: use matrix-type input source selection */ | ||
8909 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
8910 | /* Input mixer1 */ | ||
8911 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8912 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8913 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
8914 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ | ||
8915 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | ||
8916 | /* Input mixer2 */ | ||
8917 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8918 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8919 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
8920 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ | ||
8921 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | ||
8922 | |||
8923 | { } | ||
8924 | }; | ||
8925 | |||
8926 | static struct hda_verb alc888_asus_m90v_verbs[] = { | 8595 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
8927 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 8596 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8928 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 8597 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
@@ -8933,19 +8602,7 @@ static struct hda_verb alc888_asus_m90v_verbs[] = { | |||
8933 | { } /* end */ | 8602 | { } /* end */ |
8934 | }; | 8603 | }; |
8935 | 8604 | ||
8936 | static void alc883_nb_mic_automute(struct hda_codec *codec) | 8605 | static void alc883_mode2_setup(struct hda_codec *codec) |
8937 | { | ||
8938 | unsigned int present; | ||
8939 | |||
8940 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
8941 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
8942 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
8943 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
8944 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
8945 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
8946 | } | ||
8947 | |||
8948 | static void alc883_M90V_init_hook(struct hda_codec *codec) | ||
8949 | { | 8606 | { |
8950 | struct alc_spec *spec = codec->spec; | 8607 | struct alc_spec *spec = codec->spec; |
8951 | 8608 | ||
@@ -8953,26 +8610,11 @@ static void alc883_M90V_init_hook(struct hda_codec *codec) | |||
8953 | spec->autocfg.speaker_pins[0] = 0x14; | 8610 | spec->autocfg.speaker_pins[0] = 0x14; |
8954 | spec->autocfg.speaker_pins[1] = 0x15; | 8611 | spec->autocfg.speaker_pins[1] = 0x15; |
8955 | spec->autocfg.speaker_pins[2] = 0x16; | 8612 | spec->autocfg.speaker_pins[2] = 0x16; |
8956 | alc_automute_pin(codec); | 8613 | spec->ext_mic.pin = 0x18; |
8957 | } | 8614 | spec->int_mic.pin = 0x19; |
8958 | 8615 | spec->ext_mic.mux_idx = 0; | |
8959 | static void alc883_mode2_unsol_event(struct hda_codec *codec, | 8616 | spec->int_mic.mux_idx = 1; |
8960 | unsigned int res) | 8617 | spec->auto_mic = 1; |
8961 | { | ||
8962 | switch (res >> 26) { | ||
8963 | case ALC880_MIC_EVENT: | ||
8964 | alc883_nb_mic_automute(codec); | ||
8965 | break; | ||
8966 | default: | ||
8967 | alc_sku_unsol_event(codec, res); | ||
8968 | break; | ||
8969 | } | ||
8970 | } | ||
8971 | |||
8972 | static void alc883_mode2_inithook(struct hda_codec *codec) | ||
8973 | { | ||
8974 | alc883_M90V_init_hook(codec); | ||
8975 | alc883_nb_mic_automute(codec); | ||
8976 | } | 8618 | } |
8977 | 8619 | ||
8978 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | 8620 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
@@ -9033,25 +8675,44 @@ static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) | |||
9033 | alc889A_mb31_automute(codec); | 8675 | alc889A_mb31_automute(codec); |
9034 | } | 8676 | } |
9035 | 8677 | ||
8678 | |||
9036 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 8679 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
9037 | #define alc883_loopbacks alc880_loopbacks | 8680 | #define alc882_loopbacks alc880_loopbacks |
9038 | #endif | 8681 | #endif |
9039 | 8682 | ||
9040 | /* pcm configuration: identical with ALC880 */ | 8683 | /* pcm configuration: identical with ALC880 */ |
9041 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback | 8684 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
9042 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture | 8685 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
9043 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture | 8686 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
9044 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback | 8687 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
9045 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture | 8688 | |
8689 | static hda_nid_t alc883_slave_dig_outs[] = { | ||
8690 | ALC1200_DIGOUT_NID, 0, | ||
8691 | }; | ||
8692 | |||
8693 | static hda_nid_t alc1200_slave_dig_outs[] = { | ||
8694 | ALC883_DIGOUT_NID, 0, | ||
8695 | }; | ||
9046 | 8696 | ||
9047 | /* | 8697 | /* |
9048 | * configuration and preset | 8698 | * configuration and preset |
9049 | */ | 8699 | */ |
9050 | static const char *alc883_models[ALC883_MODEL_LAST] = { | 8700 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
9051 | [ALC883_3ST_2ch_DIG] = "3stack-dig", | 8701 | [ALC882_3ST_DIG] = "3stack-dig", |
8702 | [ALC882_6ST_DIG] = "6stack-dig", | ||
8703 | [ALC882_ARIMA] = "arima", | ||
8704 | [ALC882_W2JC] = "w2jc", | ||
8705 | [ALC882_TARGA] = "targa", | ||
8706 | [ALC882_ASUS_A7J] = "asus-a7j", | ||
8707 | [ALC882_ASUS_A7M] = "asus-a7m", | ||
8708 | [ALC885_MACPRO] = "macpro", | ||
8709 | [ALC885_MB5] = "mb5", | ||
8710 | [ALC885_MBP3] = "mbp3", | ||
8711 | [ALC885_IMAC24] = "imac24", | ||
8712 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", | ||
9052 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | 8713 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
9053 | [ALC883_3ST_6ch] = "3stack-6ch", | 8714 | [ALC883_3ST_6ch] = "3stack-6ch", |
9054 | [ALC883_6ST_DIG] = "6stack-dig", | 8715 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
9055 | [ALC883_TARGA_DIG] = "targa-dig", | 8716 | [ALC883_TARGA_DIG] = "targa-dig", |
9056 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | 8717 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
9057 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", | 8718 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
@@ -9060,6 +8721,7 @@ static const char *alc883_models[ALC883_MODEL_LAST] = { | |||
9060 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", | 8721 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
9061 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", | 8722 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
9062 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", | 8723 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
8724 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", | ||
9063 | [ALC883_MEDION] = "medion", | 8725 | [ALC883_MEDION] = "medion", |
9064 | [ALC883_MEDION_MD2] = "medion-md2", | 8726 | [ALC883_MEDION_MD2] = "medion-md2", |
9065 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", | 8727 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
@@ -9071,18 +8733,22 @@ static const char *alc883_models[ALC883_MODEL_LAST] = { | |||
9071 | [ALC888_3ST_HP] = "3stack-hp", | 8733 | [ALC888_3ST_HP] = "3stack-hp", |
9072 | [ALC888_6ST_DELL] = "6stack-dell", | 8734 | [ALC888_6ST_DELL] = "6stack-dell", |
9073 | [ALC883_MITAC] = "mitac", | 8735 | [ALC883_MITAC] = "mitac", |
8736 | [ALC883_CLEVO_M540R] = "clevo-m540r", | ||
9074 | [ALC883_CLEVO_M720] = "clevo-m720", | 8737 | [ALC883_CLEVO_M720] = "clevo-m720", |
9075 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", | 8738 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
9076 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", | 8739 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
9077 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", | 8740 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
8741 | [ALC889A_INTEL] = "intel-alc889a", | ||
8742 | [ALC889_INTEL] = "intel-x58", | ||
9078 | [ALC1200_ASUS_P5Q] = "asus-p5q", | 8743 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
9079 | [ALC889A_MB31] = "mb31", | 8744 | [ALC889A_MB31] = "mb31", |
9080 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", | 8745 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
9081 | [ALC883_AUTO] = "auto", | 8746 | [ALC882_AUTO] = "auto", |
9082 | }; | 8747 | }; |
9083 | 8748 | ||
9084 | static struct snd_pci_quirk alc883_cfg_tbl[] = { | 8749 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
9085 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), | 8750 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
8751 | |||
9086 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), | 8752 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
9087 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), | 8753 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
9088 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), | 8754 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
@@ -9097,40 +8763,56 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
9097 | ALC888_ACER_ASPIRE_8930G), | 8763 | ALC888_ACER_ASPIRE_8930G), |
9098 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", | 8764 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
9099 | ALC888_ACER_ASPIRE_8930G), | 8765 | ALC888_ACER_ASPIRE_8930G), |
9100 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), | 8766 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
9101 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), | 8767 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
9102 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | 8768 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
9103 | ALC888_ACER_ASPIRE_6530G), | 8769 | ALC888_ACER_ASPIRE_6530G), |
9104 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | 8770 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
9105 | ALC888_ACER_ASPIRE_6530G), | 8771 | ALC888_ACER_ASPIRE_6530G), |
8772 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", | ||
8773 | ALC888_ACER_ASPIRE_7730G), | ||
9106 | /* default Acer -- disabled as it causes more problems. | 8774 | /* default Acer -- disabled as it causes more problems. |
9107 | * model=auto should work fine now | 8775 | * model=auto should work fine now |
9108 | */ | 8776 | */ |
9109 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ | 8777 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
8778 | |||
9110 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), | 8779 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
8780 | |||
9111 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), | 8781 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
9112 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), | 8782 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
9113 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | 8783 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
9114 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), | 8784 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
9115 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), | 8785 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
9116 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), | 8786 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
8787 | |||
8788 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), | ||
8789 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), | ||
8790 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), | ||
9117 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), | 8791 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
8792 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), | ||
8793 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), | ||
8794 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), | ||
9118 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | 8795 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
9119 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), | 8796 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
9120 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), | 8797 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
9121 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), | 8798 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
8799 | |||
8800 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), | ||
9122 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), | 8801 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
9123 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), | 8802 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
9124 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), | 8803 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
9125 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), | 8804 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
9126 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | 8805 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
9127 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), | 8806 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
9128 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), | 8807 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
9129 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), | 8808 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
8809 | |||
9130 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), | 8810 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
9131 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), | 8811 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
9132 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | 8812 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
8813 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ | ||
9133 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), | 8814 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
8815 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | ||
9134 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), | 8816 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
9135 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), | 8817 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
9136 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), | 8818 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
@@ -9139,6 +8821,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
9139 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | 8821 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
9140 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), | 8822 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
9141 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), | 8823 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
8824 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), | ||
9142 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), | 8825 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
9143 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | 8826 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
9144 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | 8827 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
@@ -9152,11 +8835,15 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
9152 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | 8835 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
9153 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), | 8836 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
9154 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), | 8837 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
8838 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), | ||
8839 | |||
9155 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), | 8840 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
9156 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), | 8841 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
9157 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | 8842 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
8843 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), | ||
9158 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), | 8844 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
9159 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | 8845 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
8846 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ | ||
9160 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | 8847 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
9161 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", | 8848 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
9162 | ALC883_FUJITSU_PI2515), | 8849 | ALC883_FUJITSU_PI2515), |
@@ -9171,24 +8858,186 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
9171 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), | 8858 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
9172 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), | 8859 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
9173 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | 8860 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
8861 | |||
9174 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), | 8862 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
9175 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | 8863 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
9176 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), | 8864 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
9177 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), | 8865 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
8866 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), | ||
8867 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), | ||
9178 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), | 8868 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
9179 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), | ||
9180 | {} | ||
9181 | }; | ||
9182 | 8869 | ||
9183 | static hda_nid_t alc883_slave_dig_outs[] = { | 8870 | {} |
9184 | ALC1200_DIGOUT_NID, 0, | ||
9185 | }; | 8871 | }; |
9186 | 8872 | ||
9187 | static hda_nid_t alc1200_slave_dig_outs[] = { | 8873 | /* codec SSID table for Intel Mac */ |
9188 | ALC883_DIGOUT_NID, 0, | 8874 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
8875 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), | ||
8876 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), | ||
8877 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), | ||
8878 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), | ||
8879 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), | ||
8880 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), | ||
8881 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), | ||
8882 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), | ||
8883 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | ||
8884 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | ||
8885 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), | ||
8886 | /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently | ||
8887 | * no perfect solution yet | ||
8888 | */ | ||
8889 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), | ||
8890 | {} /* terminator */ | ||
9189 | }; | 8891 | }; |
9190 | 8892 | ||
9191 | static struct alc_config_preset alc883_presets[] = { | 8893 | static struct alc_config_preset alc882_presets[] = { |
8894 | [ALC882_3ST_DIG] = { | ||
8895 | .mixers = { alc882_base_mixer }, | ||
8896 | .init_verbs = { alc882_base_init_verbs, | ||
8897 | alc882_adc1_init_verbs }, | ||
8898 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8899 | .dac_nids = alc882_dac_nids, | ||
8900 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8901 | .dig_in_nid = ALC882_DIGIN_NID, | ||
8902 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
8903 | .channel_mode = alc882_ch_modes, | ||
8904 | .need_dac_fix = 1, | ||
8905 | .input_mux = &alc882_capture_source, | ||
8906 | }, | ||
8907 | [ALC882_6ST_DIG] = { | ||
8908 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | ||
8909 | .init_verbs = { alc882_base_init_verbs, | ||
8910 | alc882_adc1_init_verbs }, | ||
8911 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8912 | .dac_nids = alc882_dac_nids, | ||
8913 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8914 | .dig_in_nid = ALC882_DIGIN_NID, | ||
8915 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | ||
8916 | .channel_mode = alc882_sixstack_modes, | ||
8917 | .input_mux = &alc882_capture_source, | ||
8918 | }, | ||
8919 | [ALC882_ARIMA] = { | ||
8920 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | ||
8921 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
8922 | alc882_eapd_verbs }, | ||
8923 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8924 | .dac_nids = alc882_dac_nids, | ||
8925 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | ||
8926 | .channel_mode = alc882_sixstack_modes, | ||
8927 | .input_mux = &alc882_capture_source, | ||
8928 | }, | ||
8929 | [ALC882_W2JC] = { | ||
8930 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | ||
8931 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
8932 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, | ||
8933 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8934 | .dac_nids = alc882_dac_nids, | ||
8935 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
8936 | .channel_mode = alc880_threestack_modes, | ||
8937 | .need_dac_fix = 1, | ||
8938 | .input_mux = &alc882_capture_source, | ||
8939 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8940 | }, | ||
8941 | [ALC885_MBP3] = { | ||
8942 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | ||
8943 | .init_verbs = { alc885_mbp3_init_verbs, | ||
8944 | alc880_gpio1_init_verbs }, | ||
8945 | .num_dacs = 2, | ||
8946 | .dac_nids = alc882_dac_nids, | ||
8947 | .hp_nid = 0x04, | ||
8948 | .channel_mode = alc885_mbp_4ch_modes, | ||
8949 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | ||
8950 | .input_mux = &alc882_capture_source, | ||
8951 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8952 | .dig_in_nid = ALC882_DIGIN_NID, | ||
8953 | .unsol_event = alc_automute_amp_unsol_event, | ||
8954 | .setup = alc885_mbp3_setup, | ||
8955 | .init_hook = alc_automute_amp, | ||
8956 | }, | ||
8957 | [ALC885_MB5] = { | ||
8958 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, | ||
8959 | .init_verbs = { alc885_mb5_init_verbs, | ||
8960 | alc880_gpio1_init_verbs }, | ||
8961 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8962 | .dac_nids = alc882_dac_nids, | ||
8963 | .channel_mode = alc885_mb5_6ch_modes, | ||
8964 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), | ||
8965 | .input_mux = &mb5_capture_source, | ||
8966 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8967 | .dig_in_nid = ALC882_DIGIN_NID, | ||
8968 | }, | ||
8969 | [ALC885_MACPRO] = { | ||
8970 | .mixers = { alc882_macpro_mixer }, | ||
8971 | .init_verbs = { alc882_macpro_init_verbs }, | ||
8972 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8973 | .dac_nids = alc882_dac_nids, | ||
8974 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8975 | .dig_in_nid = ALC882_DIGIN_NID, | ||
8976 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
8977 | .channel_mode = alc882_ch_modes, | ||
8978 | .input_mux = &alc882_capture_source, | ||
8979 | .init_hook = alc885_macpro_init_hook, | ||
8980 | }, | ||
8981 | [ALC885_IMAC24] = { | ||
8982 | .mixers = { alc885_imac24_mixer }, | ||
8983 | .init_verbs = { alc885_imac24_init_verbs }, | ||
8984 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
8985 | .dac_nids = alc882_dac_nids, | ||
8986 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
8987 | .dig_in_nid = ALC882_DIGIN_NID, | ||
8988 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
8989 | .channel_mode = alc882_ch_modes, | ||
8990 | .input_mux = &alc882_capture_source, | ||
8991 | .unsol_event = alc_automute_amp_unsol_event, | ||
8992 | .setup = alc885_imac24_setup, | ||
8993 | .init_hook = alc885_imac24_init_hook, | ||
8994 | }, | ||
8995 | [ALC882_TARGA] = { | ||
8996 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | ||
8997 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
8998 | alc880_gpio3_init_verbs, alc882_targa_verbs}, | ||
8999 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
9000 | .dac_nids = alc882_dac_nids, | ||
9001 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
9002 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | ||
9003 | .adc_nids = alc882_adc_nids, | ||
9004 | .capsrc_nids = alc882_capsrc_nids, | ||
9005 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | ||
9006 | .channel_mode = alc882_3ST_6ch_modes, | ||
9007 | .need_dac_fix = 1, | ||
9008 | .input_mux = &alc882_capture_source, | ||
9009 | .unsol_event = alc882_targa_unsol_event, | ||
9010 | .setup = alc882_targa_setup, | ||
9011 | .init_hook = alc882_targa_automute, | ||
9012 | }, | ||
9013 | [ALC882_ASUS_A7J] = { | ||
9014 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | ||
9015 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
9016 | alc882_asus_a7j_verbs}, | ||
9017 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
9018 | .dac_nids = alc882_dac_nids, | ||
9019 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
9020 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | ||
9021 | .adc_nids = alc882_adc_nids, | ||
9022 | .capsrc_nids = alc882_capsrc_nids, | ||
9023 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | ||
9024 | .channel_mode = alc882_3ST_6ch_modes, | ||
9025 | .need_dac_fix = 1, | ||
9026 | .input_mux = &alc882_capture_source, | ||
9027 | }, | ||
9028 | [ALC882_ASUS_A7M] = { | ||
9029 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | ||
9030 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
9031 | alc882_eapd_verbs, alc880_gpio1_init_verbs, | ||
9032 | alc882_asus_a7m_verbs }, | ||
9033 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
9034 | .dac_nids = alc882_dac_nids, | ||
9035 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
9036 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
9037 | .channel_mode = alc880_threestack_modes, | ||
9038 | .need_dac_fix = 1, | ||
9039 | .input_mux = &alc882_capture_source, | ||
9040 | }, | ||
9192 | [ALC883_3ST_2ch_DIG] = { | 9041 | [ALC883_3ST_2ch_DIG] = { |
9193 | .mixers = { alc883_3ST_2ch_mixer }, | 9042 | .mixers = { alc883_3ST_2ch_mixer }, |
9194 | .init_verbs = { alc883_init_verbs }, | 9043 | .init_verbs = { alc883_init_verbs }, |
@@ -9235,6 +9084,46 @@ static struct alc_config_preset alc883_presets[] = { | |||
9235 | .need_dac_fix = 1, | 9084 | .need_dac_fix = 1, |
9236 | .input_mux = &alc883_3stack_6ch_intel, | 9085 | .input_mux = &alc883_3stack_6ch_intel, |
9237 | }, | 9086 | }, |
9087 | [ALC889A_INTEL] = { | ||
9088 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | ||
9089 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, | ||
9090 | alc_hp15_unsol_verbs }, | ||
9091 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
9092 | .dac_nids = alc883_dac_nids, | ||
9093 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | ||
9094 | .adc_nids = alc889_adc_nids, | ||
9095 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
9096 | .dig_in_nid = ALC883_DIGIN_NID, | ||
9097 | .slave_dig_outs = alc883_slave_dig_outs, | ||
9098 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | ||
9099 | .channel_mode = alc889_8ch_intel_modes, | ||
9100 | .capsrc_nids = alc889_capsrc_nids, | ||
9101 | .input_mux = &alc889_capture_source, | ||
9102 | .setup = alc889_automute_setup, | ||
9103 | .init_hook = alc_automute_amp, | ||
9104 | .unsol_event = alc_automute_amp_unsol_event, | ||
9105 | .need_dac_fix = 1, | ||
9106 | }, | ||
9107 | [ALC889_INTEL] = { | ||
9108 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | ||
9109 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, | ||
9110 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, | ||
9111 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
9112 | .dac_nids = alc883_dac_nids, | ||
9113 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | ||
9114 | .adc_nids = alc889_adc_nids, | ||
9115 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
9116 | .dig_in_nid = ALC883_DIGIN_NID, | ||
9117 | .slave_dig_outs = alc883_slave_dig_outs, | ||
9118 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | ||
9119 | .channel_mode = alc889_8ch_intel_modes, | ||
9120 | .capsrc_nids = alc889_capsrc_nids, | ||
9121 | .input_mux = &alc889_capture_source, | ||
9122 | .setup = alc889_automute_setup, | ||
9123 | .init_hook = alc889_intel_init_hook, | ||
9124 | .unsol_event = alc_automute_amp_unsol_event, | ||
9125 | .need_dac_fix = 1, | ||
9126 | }, | ||
9238 | [ALC883_6ST_DIG] = { | 9127 | [ALC883_6ST_DIG] = { |
9239 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | 9128 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
9240 | .init_verbs = { alc883_init_verbs }, | 9129 | .init_verbs = { alc883_init_verbs }, |
@@ -9258,7 +9147,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9258 | .need_dac_fix = 1, | 9147 | .need_dac_fix = 1, |
9259 | .input_mux = &alc883_capture_source, | 9148 | .input_mux = &alc883_capture_source, |
9260 | .unsol_event = alc883_targa_unsol_event, | 9149 | .unsol_event = alc883_targa_unsol_event, |
9261 | .init_hook = alc883_targa_init_hook, | 9150 | .setup = alc882_targa_setup, |
9151 | .init_hook = alc882_targa_automute, | ||
9262 | }, | 9152 | }, |
9263 | [ALC883_TARGA_2ch_DIG] = { | 9153 | [ALC883_TARGA_2ch_DIG] = { |
9264 | .mixers = { alc883_targa_2ch_mixer}, | 9154 | .mixers = { alc883_targa_2ch_mixer}, |
@@ -9273,7 +9163,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9273 | .channel_mode = alc883_3ST_2ch_modes, | 9163 | .channel_mode = alc883_3ST_2ch_modes, |
9274 | .input_mux = &alc883_capture_source, | 9164 | .input_mux = &alc883_capture_source, |
9275 | .unsol_event = alc883_targa_unsol_event, | 9165 | .unsol_event = alc883_targa_unsol_event, |
9276 | .init_hook = alc883_targa_init_hook, | 9166 | .setup = alc882_targa_setup, |
9167 | .init_hook = alc882_targa_automute, | ||
9277 | }, | 9168 | }, |
9278 | [ALC883_TARGA_8ch_DIG] = { | 9169 | [ALC883_TARGA_8ch_DIG] = { |
9279 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | 9170 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
@@ -9291,7 +9182,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9291 | .need_dac_fix = 1, | 9182 | .need_dac_fix = 1, |
9292 | .input_mux = &alc883_capture_source, | 9183 | .input_mux = &alc883_capture_source, |
9293 | .unsol_event = alc883_targa_unsol_event, | 9184 | .unsol_event = alc883_targa_unsol_event, |
9294 | .init_hook = alc883_targa_init_hook, | 9185 | .setup = alc882_targa_setup, |
9186 | .init_hook = alc882_targa_automute, | ||
9295 | }, | 9187 | }, |
9296 | [ALC883_ACER] = { | 9188 | [ALC883_ACER] = { |
9297 | .mixers = { alc883_base_mixer }, | 9189 | .mixers = { alc883_base_mixer }, |
@@ -9317,7 +9209,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9317 | .channel_mode = alc883_3ST_2ch_modes, | 9209 | .channel_mode = alc883_3ST_2ch_modes, |
9318 | .input_mux = &alc883_capture_source, | 9210 | .input_mux = &alc883_capture_source, |
9319 | .unsol_event = alc_automute_amp_unsol_event, | 9211 | .unsol_event = alc_automute_amp_unsol_event, |
9320 | .init_hook = alc883_acer_aspire_init_hook, | 9212 | .setup = alc883_acer_aspire_setup, |
9213 | .init_hook = alc_automute_amp, | ||
9321 | }, | 9214 | }, |
9322 | [ALC888_ACER_ASPIRE_4930G] = { | 9215 | [ALC888_ACER_ASPIRE_4930G] = { |
9323 | .mixers = { alc888_base_mixer, | 9216 | .mixers = { alc888_base_mixer, |
@@ -9337,7 +9230,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9337 | ARRAY_SIZE(alc888_2_capture_sources), | 9230 | ARRAY_SIZE(alc888_2_capture_sources), |
9338 | .input_mux = alc888_2_capture_sources, | 9231 | .input_mux = alc888_2_capture_sources, |
9339 | .unsol_event = alc_automute_amp_unsol_event, | 9232 | .unsol_event = alc_automute_amp_unsol_event, |
9340 | .init_hook = alc888_acer_aspire_4930g_init_hook, | 9233 | .setup = alc888_acer_aspire_4930g_setup, |
9234 | .init_hook = alc_automute_amp, | ||
9341 | }, | 9235 | }, |
9342 | [ALC888_ACER_ASPIRE_6530G] = { | 9236 | [ALC888_ACER_ASPIRE_6530G] = { |
9343 | .mixers = { alc888_acer_aspire_6530_mixer }, | 9237 | .mixers = { alc888_acer_aspire_6530_mixer }, |
@@ -9355,7 +9249,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9355 | ARRAY_SIZE(alc888_2_capture_sources), | 9249 | ARRAY_SIZE(alc888_2_capture_sources), |
9356 | .input_mux = alc888_acer_aspire_6530_sources, | 9250 | .input_mux = alc888_acer_aspire_6530_sources, |
9357 | .unsol_event = alc_automute_amp_unsol_event, | 9251 | .unsol_event = alc_automute_amp_unsol_event, |
9358 | .init_hook = alc888_acer_aspire_6530g_init_hook, | 9252 | .setup = alc888_acer_aspire_6530g_setup, |
9253 | .init_hook = alc_automute_amp, | ||
9359 | }, | 9254 | }, |
9360 | [ALC888_ACER_ASPIRE_8930G] = { | 9255 | [ALC888_ACER_ASPIRE_8930G] = { |
9361 | .mixers = { alc888_base_mixer, | 9256 | .mixers = { alc888_base_mixer, |
@@ -9376,7 +9271,28 @@ static struct alc_config_preset alc883_presets[] = { | |||
9376 | ARRAY_SIZE(alc889_capture_sources), | 9271 | ARRAY_SIZE(alc889_capture_sources), |
9377 | .input_mux = alc889_capture_sources, | 9272 | .input_mux = alc889_capture_sources, |
9378 | .unsol_event = alc_automute_amp_unsol_event, | 9273 | .unsol_event = alc_automute_amp_unsol_event, |
9379 | .init_hook = alc889_acer_aspire_8930g_init_hook, | 9274 | .setup = alc889_acer_aspire_8930g_setup, |
9275 | .init_hook = alc_automute_amp, | ||
9276 | }, | ||
9277 | [ALC888_ACER_ASPIRE_7730G] = { | ||
9278 | .mixers = { alc883_3ST_6ch_mixer, | ||
9279 | alc883_chmode_mixer }, | ||
9280 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | ||
9281 | alc888_acer_aspire_7730G_verbs }, | ||
9282 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
9283 | .dac_nids = alc883_dac_nids, | ||
9284 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | ||
9285 | .adc_nids = alc883_adc_nids_rev, | ||
9286 | .capsrc_nids = alc883_capsrc_nids_rev, | ||
9287 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
9288 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
9289 | .channel_mode = alc883_3ST_6ch_modes, | ||
9290 | .need_dac_fix = 1, | ||
9291 | .const_channel_count = 6, | ||
9292 | .input_mux = &alc883_capture_source, | ||
9293 | .unsol_event = alc_automute_amp_unsol_event, | ||
9294 | .setup = alc888_acer_aspire_6530g_setup, | ||
9295 | .init_hook = alc_automute_amp, | ||
9380 | }, | 9296 | }, |
9381 | [ALC883_MEDION] = { | 9297 | [ALC883_MEDION] = { |
9382 | .mixers = { alc883_fivestack_mixer, | 9298 | .mixers = { alc883_fivestack_mixer, |
@@ -9401,7 +9317,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9401 | .channel_mode = alc883_3ST_2ch_modes, | 9317 | .channel_mode = alc883_3ST_2ch_modes, |
9402 | .input_mux = &alc883_capture_source, | 9318 | .input_mux = &alc883_capture_source, |
9403 | .unsol_event = alc_automute_amp_unsol_event, | 9319 | .unsol_event = alc_automute_amp_unsol_event, |
9404 | .init_hook = alc883_medion_md2_init_hook, | 9320 | .setup = alc883_medion_md2_setup, |
9321 | .init_hook = alc_automute_amp, | ||
9405 | }, | 9322 | }, |
9406 | [ALC883_LAPTOP_EAPD] = { | 9323 | [ALC883_LAPTOP_EAPD] = { |
9407 | .mixers = { alc883_base_mixer }, | 9324 | .mixers = { alc883_base_mixer }, |
@@ -9412,6 +9329,21 @@ static struct alc_config_preset alc883_presets[] = { | |||
9412 | .channel_mode = alc883_3ST_2ch_modes, | 9329 | .channel_mode = alc883_3ST_2ch_modes, |
9413 | .input_mux = &alc883_capture_source, | 9330 | .input_mux = &alc883_capture_source, |
9414 | }, | 9331 | }, |
9332 | [ALC883_CLEVO_M540R] = { | ||
9333 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
9334 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, | ||
9335 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
9336 | .dac_nids = alc883_dac_nids, | ||
9337 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
9338 | .dig_in_nid = ALC883_DIGIN_NID, | ||
9339 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), | ||
9340 | .channel_mode = alc883_3ST_6ch_clevo_modes, | ||
9341 | .need_dac_fix = 1, | ||
9342 | .input_mux = &alc883_capture_source, | ||
9343 | /* This machine has the hardware HP auto-muting, thus | ||
9344 | * we need no software mute via unsol event | ||
9345 | */ | ||
9346 | }, | ||
9415 | [ALC883_CLEVO_M720] = { | 9347 | [ALC883_CLEVO_M720] = { |
9416 | .mixers = { alc883_clevo_m720_mixer }, | 9348 | .mixers = { alc883_clevo_m720_mixer }, |
9417 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | 9349 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
@@ -9422,6 +9354,7 @@ static struct alc_config_preset alc883_presets[] = { | |||
9422 | .channel_mode = alc883_3ST_2ch_modes, | 9354 | .channel_mode = alc883_3ST_2ch_modes, |
9423 | .input_mux = &alc883_capture_source, | 9355 | .input_mux = &alc883_capture_source, |
9424 | .unsol_event = alc883_clevo_m720_unsol_event, | 9356 | .unsol_event = alc883_clevo_m720_unsol_event, |
9357 | .setup = alc883_clevo_m720_setup, | ||
9425 | .init_hook = alc883_clevo_m720_init_hook, | 9358 | .init_hook = alc883_clevo_m720_init_hook, |
9426 | }, | 9359 | }, |
9427 | [ALC883_LENOVO_101E_2ch] = { | 9360 | [ALC883_LENOVO_101E_2ch] = { |
@@ -9447,7 +9380,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9447 | .need_dac_fix = 1, | 9380 | .need_dac_fix = 1, |
9448 | .input_mux = &alc883_lenovo_nb0763_capture_source, | 9381 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
9449 | .unsol_event = alc_automute_amp_unsol_event, | 9382 | .unsol_event = alc_automute_amp_unsol_event, |
9450 | .init_hook = alc883_medion_md2_init_hook, | 9383 | .setup = alc883_medion_md2_setup, |
9384 | .init_hook = alc_automute_amp, | ||
9451 | }, | 9385 | }, |
9452 | [ALC888_LENOVO_MS7195_DIG] = { | 9386 | [ALC888_LENOVO_MS7195_DIG] = { |
9453 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | 9387 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
@@ -9472,7 +9406,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9472 | .channel_mode = alc883_3ST_2ch_modes, | 9406 | .channel_mode = alc883_3ST_2ch_modes, |
9473 | .input_mux = &alc883_capture_source, | 9407 | .input_mux = &alc883_capture_source, |
9474 | .unsol_event = alc_automute_amp_unsol_event, | 9408 | .unsol_event = alc_automute_amp_unsol_event, |
9475 | .init_hook = alc883_haier_w66_init_hook, | 9409 | .setup = alc883_haier_w66_setup, |
9410 | .init_hook = alc_automute_amp, | ||
9476 | }, | 9411 | }, |
9477 | [ALC888_3ST_HP] = { | 9412 | [ALC888_3ST_HP] = { |
9478 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | 9413 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
@@ -9484,7 +9419,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9484 | .need_dac_fix = 1, | 9419 | .need_dac_fix = 1, |
9485 | .input_mux = &alc883_capture_source, | 9420 | .input_mux = &alc883_capture_source, |
9486 | .unsol_event = alc_automute_amp_unsol_event, | 9421 | .unsol_event = alc_automute_amp_unsol_event, |
9487 | .init_hook = alc888_3st_hp_init_hook, | 9422 | .setup = alc888_3st_hp_setup, |
9423 | .init_hook = alc_automute_amp, | ||
9488 | }, | 9424 | }, |
9489 | [ALC888_6ST_DELL] = { | 9425 | [ALC888_6ST_DELL] = { |
9490 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | 9426 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
@@ -9497,7 +9433,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9497 | .channel_mode = alc883_sixstack_modes, | 9433 | .channel_mode = alc883_sixstack_modes, |
9498 | .input_mux = &alc883_capture_source, | 9434 | .input_mux = &alc883_capture_source, |
9499 | .unsol_event = alc_automute_amp_unsol_event, | 9435 | .unsol_event = alc_automute_amp_unsol_event, |
9500 | .init_hook = alc888_6st_dell_init_hook, | 9436 | .setup = alc888_6st_dell_setup, |
9437 | .init_hook = alc_automute_amp, | ||
9501 | }, | 9438 | }, |
9502 | [ALC883_MITAC] = { | 9439 | [ALC883_MITAC] = { |
9503 | .mixers = { alc883_mitac_mixer }, | 9440 | .mixers = { alc883_mitac_mixer }, |
@@ -9508,7 +9445,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9508 | .channel_mode = alc883_3ST_2ch_modes, | 9445 | .channel_mode = alc883_3ST_2ch_modes, |
9509 | .input_mux = &alc883_capture_source, | 9446 | .input_mux = &alc883_capture_source, |
9510 | .unsol_event = alc_automute_amp_unsol_event, | 9447 | .unsol_event = alc_automute_amp_unsol_event, |
9511 | .init_hook = alc883_mitac_init_hook, | 9448 | .setup = alc883_mitac_setup, |
9449 | .init_hook = alc_automute_amp, | ||
9512 | }, | 9450 | }, |
9513 | [ALC883_FUJITSU_PI2515] = { | 9451 | [ALC883_FUJITSU_PI2515] = { |
9514 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | 9452 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
@@ -9521,7 +9459,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9521 | .channel_mode = alc883_3ST_2ch_modes, | 9459 | .channel_mode = alc883_3ST_2ch_modes, |
9522 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | 9460 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
9523 | .unsol_event = alc_automute_amp_unsol_event, | 9461 | .unsol_event = alc_automute_amp_unsol_event, |
9524 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, | 9462 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
9463 | .init_hook = alc_automute_amp, | ||
9525 | }, | 9464 | }, |
9526 | [ALC888_FUJITSU_XA3530] = { | 9465 | [ALC888_FUJITSU_XA3530] = { |
9527 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, | 9466 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
@@ -9539,7 +9478,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9539 | ARRAY_SIZE(alc888_2_capture_sources), | 9478 | ARRAY_SIZE(alc888_2_capture_sources), |
9540 | .input_mux = alc888_2_capture_sources, | 9479 | .input_mux = alc888_2_capture_sources, |
9541 | .unsol_event = alc_automute_amp_unsol_event, | 9480 | .unsol_event = alc_automute_amp_unsol_event, |
9542 | .init_hook = alc888_fujitsu_xa3530_init_hook, | 9481 | .setup = alc888_fujitsu_xa3530_setup, |
9482 | .init_hook = alc_automute_amp, | ||
9543 | }, | 9483 | }, |
9544 | [ALC888_LENOVO_SKY] = { | 9484 | [ALC888_LENOVO_SKY] = { |
9545 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | 9485 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
@@ -9552,7 +9492,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9552 | .need_dac_fix = 1, | 9492 | .need_dac_fix = 1, |
9553 | .input_mux = &alc883_lenovo_sky_capture_source, | 9493 | .input_mux = &alc883_lenovo_sky_capture_source, |
9554 | .unsol_event = alc_automute_amp_unsol_event, | 9494 | .unsol_event = alc_automute_amp_unsol_event, |
9555 | .init_hook = alc888_lenovo_sky_init_hook, | 9495 | .setup = alc888_lenovo_sky_setup, |
9496 | .init_hook = alc_automute_amp, | ||
9556 | }, | 9497 | }, |
9557 | [ALC888_ASUS_M90V] = { | 9498 | [ALC888_ASUS_M90V] = { |
9558 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | 9499 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
@@ -9565,8 +9506,9 @@ static struct alc_config_preset alc883_presets[] = { | |||
9565 | .channel_mode = alc883_3ST_6ch_modes, | 9506 | .channel_mode = alc883_3ST_6ch_modes, |
9566 | .need_dac_fix = 1, | 9507 | .need_dac_fix = 1, |
9567 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | 9508 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
9568 | .unsol_event = alc883_mode2_unsol_event, | 9509 | .unsol_event = alc_sku_unsol_event, |
9569 | .init_hook = alc883_mode2_inithook, | 9510 | .setup = alc883_mode2_setup, |
9511 | .init_hook = alc_inithook, | ||
9570 | }, | 9512 | }, |
9571 | [ALC888_ASUS_EEE1601] = { | 9513 | [ALC888_ASUS_EEE1601] = { |
9572 | .mixers = { alc883_asus_eee1601_mixer }, | 9514 | .mixers = { alc883_asus_eee1601_mixer }, |
@@ -9619,15 +9561,45 @@ static struct alc_config_preset alc883_presets[] = { | |||
9619 | .channel_mode = alc883_3ST_2ch_modes, | 9561 | .channel_mode = alc883_3ST_2ch_modes, |
9620 | .input_mux = &alc883_capture_source, | 9562 | .input_mux = &alc883_capture_source, |
9621 | .unsol_event = alc_automute_amp_unsol_event, | 9563 | .unsol_event = alc_automute_amp_unsol_event, |
9622 | .init_hook = alc883_vaiott_init_hook, | 9564 | .setup = alc883_vaiott_setup, |
9565 | .init_hook = alc_automute_amp, | ||
9623 | }, | 9566 | }, |
9624 | }; | 9567 | }; |
9625 | 9568 | ||
9626 | 9569 | ||
9627 | /* | 9570 | /* |
9571 | * Pin config fixes | ||
9572 | */ | ||
9573 | enum { | ||
9574 | PINFIX_ABIT_AW9D_MAX | ||
9575 | }; | ||
9576 | |||
9577 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { | ||
9578 | { 0x15, 0x01080104 }, /* side */ | ||
9579 | { 0x16, 0x01011012 }, /* rear */ | ||
9580 | { 0x17, 0x01016011 }, /* clfe */ | ||
9581 | { } | ||
9582 | }; | ||
9583 | |||
9584 | static const struct alc_pincfg *alc882_pin_fixes[] = { | ||
9585 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, | ||
9586 | }; | ||
9587 | |||
9588 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { | ||
9589 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | ||
9590 | {} | ||
9591 | }; | ||
9592 | |||
9593 | /* | ||
9628 | * BIOS auto configuration | 9594 | * BIOS auto configuration |
9629 | */ | 9595 | */ |
9630 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, | 9596 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
9597 | const struct auto_pin_cfg *cfg) | ||
9598 | { | ||
9599 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); | ||
9600 | } | ||
9601 | |||
9602 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | ||
9631 | hda_nid_t nid, int pin_type, | 9603 | hda_nid_t nid, int pin_type, |
9632 | int dac_idx) | 9604 | int dac_idx) |
9633 | { | 9605 | { |
@@ -9644,7 +9616,7 @@ static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, | |||
9644 | 9616 | ||
9645 | } | 9617 | } |
9646 | 9618 | ||
9647 | static void alc883_auto_init_multi_out(struct hda_codec *codec) | 9619 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
9648 | { | 9620 | { |
9649 | struct alc_spec *spec = codec->spec; | 9621 | struct alc_spec *spec = codec->spec; |
9650 | int i; | 9622 | int i; |
@@ -9653,12 +9625,12 @@ static void alc883_auto_init_multi_out(struct hda_codec *codec) | |||
9653 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | 9625 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
9654 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | 9626 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
9655 | if (nid) | 9627 | if (nid) |
9656 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, | 9628 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
9657 | i); | 9629 | i); |
9658 | } | 9630 | } |
9659 | } | 9631 | } |
9660 | 9632 | ||
9661 | static void alc883_auto_init_hp_out(struct hda_codec *codec) | 9633 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
9662 | { | 9634 | { |
9663 | struct alc_spec *spec = codec->spec; | 9635 | struct alc_spec *spec = codec->spec; |
9664 | hda_nid_t pin; | 9636 | hda_nid_t pin; |
@@ -9666,91 +9638,191 @@ static void alc883_auto_init_hp_out(struct hda_codec *codec) | |||
9666 | pin = spec->autocfg.hp_pins[0]; | 9638 | pin = spec->autocfg.hp_pins[0]; |
9667 | if (pin) /* connect to front */ | 9639 | if (pin) /* connect to front */ |
9668 | /* use dac 0 */ | 9640 | /* use dac 0 */ |
9669 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | 9641 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
9670 | pin = spec->autocfg.speaker_pins[0]; | 9642 | pin = spec->autocfg.speaker_pins[0]; |
9671 | if (pin) | 9643 | if (pin) |
9672 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | 9644 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
9673 | } | 9645 | } |
9674 | 9646 | ||
9675 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) | 9647 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
9676 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID | ||
9677 | |||
9678 | static void alc883_auto_init_analog_input(struct hda_codec *codec) | ||
9679 | { | 9648 | { |
9680 | struct alc_spec *spec = codec->spec; | 9649 | struct alc_spec *spec = codec->spec; |
9681 | int i; | 9650 | int i; |
9682 | 9651 | ||
9683 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 9652 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
9684 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 9653 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
9685 | if (alc883_is_input_pin(nid)) { | 9654 | if (!nid) |
9686 | alc_set_input_pin(codec, nid, i); | 9655 | continue; |
9687 | if (nid != ALC883_PIN_CD_NID && | 9656 | alc_set_input_pin(codec, nid, i); |
9688 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | 9657 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
9658 | snd_hda_codec_write(codec, nid, 0, | ||
9659 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
9660 | AMP_OUT_MUTE); | ||
9661 | } | ||
9662 | } | ||
9663 | |||
9664 | static void alc882_auto_init_input_src(struct hda_codec *codec) | ||
9665 | { | ||
9666 | struct alc_spec *spec = codec->spec; | ||
9667 | int c; | ||
9668 | |||
9669 | for (c = 0; c < spec->num_adc_nids; c++) { | ||
9670 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | ||
9671 | hda_nid_t nid = spec->capsrc_nids[c]; | ||
9672 | unsigned int mux_idx; | ||
9673 | const struct hda_input_mux *imux; | ||
9674 | int conns, mute, idx, item; | ||
9675 | |||
9676 | conns = snd_hda_get_connections(codec, nid, conn_list, | ||
9677 | ARRAY_SIZE(conn_list)); | ||
9678 | if (conns < 0) | ||
9679 | continue; | ||
9680 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | ||
9681 | imux = &spec->input_mux[mux_idx]; | ||
9682 | for (idx = 0; idx < conns; idx++) { | ||
9683 | /* if the current connection is the selected one, | ||
9684 | * unmute it as default - otherwise mute it | ||
9685 | */ | ||
9686 | mute = AMP_IN_MUTE(idx); | ||
9687 | for (item = 0; item < imux->num_items; item++) { | ||
9688 | if (imux->items[item].index == idx) { | ||
9689 | if (spec->cur_mux[c] == item) | ||
9690 | mute = AMP_IN_UNMUTE(idx); | ||
9691 | break; | ||
9692 | } | ||
9693 | } | ||
9694 | /* check if we have a selector or mixer | ||
9695 | * we could check for the widget type instead, but | ||
9696 | * just check for Amp-In presence (in case of mixer | ||
9697 | * without amp-in there is something wrong, this | ||
9698 | * function shouldn't be used or capsrc nid is wrong) | ||
9699 | */ | ||
9700 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | ||
9689 | snd_hda_codec_write(codec, nid, 0, | 9701 | snd_hda_codec_write(codec, nid, 0, |
9690 | AC_VERB_SET_AMP_GAIN_MUTE, | 9702 | AC_VERB_SET_AMP_GAIN_MUTE, |
9691 | AMP_OUT_MUTE); | 9703 | mute); |
9704 | else if (mute != AMP_IN_MUTE(idx)) | ||
9705 | snd_hda_codec_write(codec, nid, 0, | ||
9706 | AC_VERB_SET_CONNECT_SEL, | ||
9707 | idx); | ||
9692 | } | 9708 | } |
9693 | } | 9709 | } |
9694 | } | 9710 | } |
9695 | 9711 | ||
9696 | #define alc883_auto_init_input_src alc882_auto_init_input_src | 9712 | /* add mic boosts if needed */ |
9713 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | ||
9714 | { | ||
9715 | struct alc_spec *spec = codec->spec; | ||
9716 | int err; | ||
9717 | hda_nid_t nid; | ||
9718 | |||
9719 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | ||
9720 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | ||
9721 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
9722 | "Mic Boost", | ||
9723 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
9724 | if (err < 0) | ||
9725 | return err; | ||
9726 | } | ||
9727 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | ||
9728 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | ||
9729 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
9730 | "Front Mic Boost", | ||
9731 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
9732 | if (err < 0) | ||
9733 | return err; | ||
9734 | } | ||
9735 | return 0; | ||
9736 | } | ||
9697 | 9737 | ||
9698 | /* almost identical with ALC880 parser... */ | 9738 | /* almost identical with ALC880 parser... */ |
9699 | static int alc883_parse_auto_config(struct hda_codec *codec) | 9739 | static int alc882_parse_auto_config(struct hda_codec *codec) |
9700 | { | 9740 | { |
9701 | struct alc_spec *spec = codec->spec; | 9741 | struct alc_spec *spec = codec->spec; |
9702 | int err = alc880_parse_auto_config(codec); | 9742 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
9703 | struct auto_pin_cfg *cfg = &spec->autocfg; | 9743 | int i, err; |
9704 | int i; | ||
9705 | 9744 | ||
9745 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
9746 | alc882_ignore); | ||
9706 | if (err < 0) | 9747 | if (err < 0) |
9707 | return err; | 9748 | return err; |
9708 | else if (!err) | 9749 | if (!spec->autocfg.line_outs) |
9709 | return 0; /* no config found */ | 9750 | return 0; /* can't find valid BIOS pin config */ |
9710 | 9751 | ||
9711 | err = alc_auto_add_mic_boost(codec); | 9752 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
9753 | if (err < 0) | ||
9754 | return err; | ||
9755 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | ||
9756 | if (err < 0) | ||
9757 | return err; | ||
9758 | err = alc880_auto_create_extra_out(spec, | ||
9759 | spec->autocfg.speaker_pins[0], | ||
9760 | "Speaker"); | ||
9761 | if (err < 0) | ||
9762 | return err; | ||
9763 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | ||
9764 | "Headphone"); | ||
9765 | if (err < 0) | ||
9766 | return err; | ||
9767 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); | ||
9712 | if (err < 0) | 9768 | if (err < 0) |
9713 | return err; | 9769 | return err; |
9714 | 9770 | ||
9715 | /* hack - override the init verbs */ | 9771 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
9716 | spec->init_verbs[0] = alc883_auto_init_verbs; | ||
9717 | 9772 | ||
9718 | /* setup input_mux for ALC889 */ | 9773 | /* check multiple SPDIF-out (for recent codecs) */ |
9719 | if (codec->vendor_id == 0x10ec0889) { | 9774 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
9720 | /* digital-mic input pin is excluded in alc880_auto_create..() | 9775 | hda_nid_t dig_nid; |
9721 | * because it's under 0x18 | 9776 | err = snd_hda_get_connections(codec, |
9722 | */ | 9777 | spec->autocfg.dig_out_pins[i], |
9723 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || | 9778 | &dig_nid, 1); |
9724 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { | 9779 | if (err < 0) |
9725 | struct hda_input_mux *imux = &spec->private_imux[0]; | 9780 | continue; |
9726 | for (i = 1; i < 3; i++) | 9781 | if (!i) |
9727 | memcpy(&spec->private_imux[i], | 9782 | spec->multiout.dig_out_nid = dig_nid; |
9728 | &spec->private_imux[0], | 9783 | else { |
9729 | sizeof(spec->private_imux[0])); | 9784 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
9730 | imux->items[imux->num_items].label = "Int DMic"; | 9785 | spec->slave_dig_outs[i - 1] = dig_nid; |
9731 | imux->items[imux->num_items].index = 0x0b; | 9786 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
9732 | imux->num_items++; | 9787 | break; |
9733 | spec->num_mux_defs = 3; | ||
9734 | spec->input_mux = spec->private_imux; | ||
9735 | } | 9788 | } |
9736 | } | 9789 | } |
9790 | if (spec->autocfg.dig_in_pin) | ||
9791 | spec->dig_in_nid = ALC880_DIGIN_NID; | ||
9792 | |||
9793 | if (spec->kctls.list) | ||
9794 | add_mixer(spec, spec->kctls.list); | ||
9795 | |||
9796 | add_verb(spec, alc883_auto_init_verbs); | ||
9797 | /* if ADC 0x07 is available, initialize it, too */ | ||
9798 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) | ||
9799 | add_verb(spec, alc882_adc1_init_verbs); | ||
9800 | |||
9801 | spec->num_mux_defs = 1; | ||
9802 | spec->input_mux = &spec->private_imux[0]; | ||
9803 | |||
9804 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); | ||
9805 | |||
9806 | err = alc_auto_add_mic_boost(codec); | ||
9807 | if (err < 0) | ||
9808 | return err; | ||
9737 | 9809 | ||
9738 | return 1; /* config found */ | 9810 | return 1; /* config found */ |
9739 | } | 9811 | } |
9740 | 9812 | ||
9741 | /* additional initialization for auto-configuration model */ | 9813 | /* additional initialization for auto-configuration model */ |
9742 | static void alc883_auto_init(struct hda_codec *codec) | 9814 | static void alc882_auto_init(struct hda_codec *codec) |
9743 | { | 9815 | { |
9744 | struct alc_spec *spec = codec->spec; | 9816 | struct alc_spec *spec = codec->spec; |
9745 | alc883_auto_init_multi_out(codec); | 9817 | alc882_auto_init_multi_out(codec); |
9746 | alc883_auto_init_hp_out(codec); | 9818 | alc882_auto_init_hp_out(codec); |
9747 | alc883_auto_init_analog_input(codec); | 9819 | alc882_auto_init_analog_input(codec); |
9748 | alc883_auto_init_input_src(codec); | 9820 | alc882_auto_init_input_src(codec); |
9749 | if (spec->unsol_event) | 9821 | if (spec->unsol_event) |
9750 | alc_inithook(codec); | 9822 | alc_inithook(codec); |
9751 | } | 9823 | } |
9752 | 9824 | ||
9753 | static int patch_alc883(struct hda_codec *codec) | 9825 | static int patch_alc882(struct hda_codec *codec) |
9754 | { | 9826 | { |
9755 | struct alc_spec *spec; | 9827 | struct alc_spec *spec; |
9756 | int err, board_config; | 9828 | int err, board_config; |
@@ -9761,28 +9833,35 @@ static int patch_alc883(struct hda_codec *codec) | |||
9761 | 9833 | ||
9762 | codec->spec = spec; | 9834 | codec->spec = spec; |
9763 | 9835 | ||
9764 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | 9836 | switch (codec->vendor_id) { |
9837 | case 0x10ec0882: | ||
9838 | case 0x10ec0885: | ||
9839 | break; | ||
9840 | default: | ||
9841 | /* ALC883 and variants */ | ||
9842 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | ||
9843 | break; | ||
9844 | } | ||
9765 | 9845 | ||
9766 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, | 9846 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
9767 | alc883_models, | 9847 | alc882_models, |
9768 | alc883_cfg_tbl); | 9848 | alc882_cfg_tbl); |
9769 | if (board_config < 0 || board_config >= ALC883_MODEL_LAST) { | 9849 | |
9770 | /* Pick up systems that don't supply PCI SSID */ | 9850 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
9771 | switch (codec->subsystem_id) { | 9851 | board_config = snd_hda_check_board_codec_sid_config(codec, |
9772 | case 0x106b3600: /* Macbook 3.1 */ | 9852 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
9773 | board_config = ALC889A_MB31; | 9853 | |
9774 | break; | 9854 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
9775 | default: | 9855 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
9776 | printk(KERN_INFO | 9856 | codec->chip_name); |
9777 | "hda_codec: Unknown model for %s, trying " | 9857 | board_config = ALC882_AUTO; |
9778 | "auto-probe from BIOS...\n", codec->chip_name); | ||
9779 | board_config = ALC883_AUTO; | ||
9780 | } | ||
9781 | } | 9858 | } |
9782 | 9859 | ||
9783 | if (board_config == ALC883_AUTO) { | 9860 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
9861 | |||
9862 | if (board_config == ALC882_AUTO) { | ||
9784 | /* automatic parse from the BIOS config */ | 9863 | /* automatic parse from the BIOS config */ |
9785 | err = alc883_parse_auto_config(codec); | 9864 | err = alc882_parse_auto_config(codec); |
9786 | if (err < 0) { | 9865 | if (err < 0) { |
9787 | alc_free(codec); | 9866 | alc_free(codec); |
9788 | return err; | 9867 | return err; |
@@ -9790,7 +9869,7 @@ static int patch_alc883(struct hda_codec *codec) | |||
9790 | printk(KERN_INFO | 9869 | printk(KERN_INFO |
9791 | "hda_codec: Cannot set up configuration " | 9870 | "hda_codec: Cannot set up configuration " |
9792 | "from BIOS. Using base mode...\n"); | 9871 | "from BIOS. Using base mode...\n"); |
9793 | board_config = ALC883_3ST_2ch_DIG; | 9872 | board_config = ALC882_3ST_DIG; |
9794 | } | 9873 | } |
9795 | } | 9874 | } |
9796 | 9875 | ||
@@ -9800,63 +9879,61 @@ static int patch_alc883(struct hda_codec *codec) | |||
9800 | return err; | 9879 | return err; |
9801 | } | 9880 | } |
9802 | 9881 | ||
9803 | if (board_config != ALC883_AUTO) | 9882 | if (board_config != ALC882_AUTO) |
9804 | setup_preset(spec, &alc883_presets[board_config]); | 9883 | setup_preset(codec, &alc882_presets[board_config]); |
9805 | 9884 | ||
9806 | switch (codec->vendor_id) { | 9885 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
9807 | case 0x10ec0888: | 9886 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
9808 | if (!spec->num_adc_nids) { | 9887 | /* FIXME: setup DAC5 */ |
9809 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); | 9888 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
9810 | spec->adc_nids = alc883_adc_nids; | 9889 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
9811 | } | 9890 | |
9812 | if (!spec->capsrc_nids) | 9891 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
9813 | spec->capsrc_nids = alc883_capsrc_nids; | 9892 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
9893 | |||
9894 | if (codec->vendor_id == 0x10ec0888) | ||
9814 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ | 9895 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
9815 | break; | 9896 | |
9816 | case 0x10ec0889: | 9897 | if (!spec->adc_nids && spec->input_mux) { |
9817 | if (!spec->num_adc_nids) { | 9898 | int i; |
9818 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); | 9899 | spec->num_adc_nids = 0; |
9819 | spec->adc_nids = alc889_adc_nids; | 9900 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
9820 | } | 9901 | hda_nid_t cap; |
9821 | if (!spec->capsrc_nids) | 9902 | hda_nid_t nid = alc882_adc_nids[i]; |
9822 | spec->capsrc_nids = alc889_capsrc_nids; | 9903 | unsigned int wcap = get_wcaps(codec, nid); |
9823 | break; | 9904 | /* get type */ |
9824 | default: | 9905 | wcap = get_wcaps_type(wcap); |
9825 | if (!spec->num_adc_nids) { | 9906 | if (wcap != AC_WID_AUD_IN) |
9826 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); | 9907 | continue; |
9827 | spec->adc_nids = alc883_adc_nids; | 9908 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
9909 | err = snd_hda_get_connections(codec, nid, &cap, 1); | ||
9910 | if (err < 0) | ||
9911 | continue; | ||
9912 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; | ||
9913 | spec->num_adc_nids++; | ||
9828 | } | 9914 | } |
9829 | if (!spec->capsrc_nids) | 9915 | spec->adc_nids = spec->private_adc_nids; |
9830 | spec->capsrc_nids = alc883_capsrc_nids; | 9916 | spec->capsrc_nids = spec->private_capsrc_nids; |
9831 | break; | ||
9832 | } | 9917 | } |
9833 | 9918 | ||
9834 | spec->stream_analog_playback = &alc883_pcm_analog_playback; | 9919 | set_capture_mixer(codec); |
9835 | spec->stream_analog_capture = &alc883_pcm_analog_capture; | ||
9836 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; | ||
9837 | |||
9838 | spec->stream_digital_playback = &alc883_pcm_digital_playback; | ||
9839 | spec->stream_digital_capture = &alc883_pcm_digital_capture; | ||
9840 | |||
9841 | if (!spec->cap_mixer) | ||
9842 | set_capture_mixer(spec); | ||
9843 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 9920 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
9844 | 9921 | ||
9845 | spec->vmaster_nid = 0x0c; | 9922 | spec->vmaster_nid = 0x0c; |
9846 | 9923 | ||
9847 | codec->patch_ops = alc_patch_ops; | 9924 | codec->patch_ops = alc_patch_ops; |
9848 | if (board_config == ALC883_AUTO) | 9925 | if (board_config == ALC882_AUTO) |
9849 | spec->init_hook = alc883_auto_init; | 9926 | spec->init_hook = alc882_auto_init; |
9850 | |||
9851 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 9927 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
9852 | if (!spec->loopback.amplist) | 9928 | if (!spec->loopback.amplist) |
9853 | spec->loopback.amplist = alc883_loopbacks; | 9929 | spec->loopback.amplist = alc882_loopbacks; |
9854 | #endif | 9930 | #endif |
9855 | codec->proc_widget_hook = print_realtek_coef; | 9931 | codec->proc_widget_hook = print_realtek_coef; |
9856 | 9932 | ||
9857 | return 0; | 9933 | return 0; |
9858 | } | 9934 | } |
9859 | 9935 | ||
9936 | |||
9860 | /* | 9937 | /* |
9861 | * ALC262 support | 9938 | * ALC262 support |
9862 | */ | 9939 | */ |
@@ -10032,13 +10109,12 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |||
10032 | }; | 10109 | }; |
10033 | 10110 | ||
10034 | /* mute/unmute internal speaker according to the hp jack and mute state */ | 10111 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
10035 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) | 10112 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
10036 | { | 10113 | { |
10037 | struct alc_spec *spec = codec->spec; | 10114 | struct alc_spec *spec = codec->spec; |
10038 | 10115 | ||
10039 | spec->autocfg.hp_pins[0] = 0x15; | 10116 | spec->autocfg.hp_pins[0] = 0x15; |
10040 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ | 10117 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
10041 | alc_automute_amp(codec); | ||
10042 | } | 10118 | } |
10043 | 10119 | ||
10044 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | 10120 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
@@ -10195,22 +10271,20 @@ static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) | |||
10195 | alc262_hippo_automute(codec); | 10271 | alc262_hippo_automute(codec); |
10196 | } | 10272 | } |
10197 | 10273 | ||
10198 | static void alc262_hippo_init_hook(struct hda_codec *codec) | 10274 | static void alc262_hippo_setup(struct hda_codec *codec) |
10199 | { | 10275 | { |
10200 | struct alc_spec *spec = codec->spec; | 10276 | struct alc_spec *spec = codec->spec; |
10201 | 10277 | ||
10202 | spec->autocfg.hp_pins[0] = 0x15; | 10278 | spec->autocfg.hp_pins[0] = 0x15; |
10203 | spec->autocfg.speaker_pins[0] = 0x14; | 10279 | spec->autocfg.speaker_pins[0] = 0x14; |
10204 | alc262_hippo_automute(codec); | ||
10205 | } | 10280 | } |
10206 | 10281 | ||
10207 | static void alc262_hippo1_init_hook(struct hda_codec *codec) | 10282 | static void alc262_hippo1_setup(struct hda_codec *codec) |
10208 | { | 10283 | { |
10209 | struct alc_spec *spec = codec->spec; | 10284 | struct alc_spec *spec = codec->spec; |
10210 | 10285 | ||
10211 | spec->autocfg.hp_pins[0] = 0x1b; | 10286 | spec->autocfg.hp_pins[0] = 0x1b; |
10212 | spec->autocfg.speaker_pins[0] = 0x14; | 10287 | spec->autocfg.speaker_pins[0] = 0x14; |
10213 | alc262_hippo_automute(codec); | ||
10214 | } | 10288 | } |
10215 | 10289 | ||
10216 | 10290 | ||
@@ -10267,13 +10341,12 @@ static struct hda_verb alc262_tyan_verbs[] = { | |||
10267 | }; | 10341 | }; |
10268 | 10342 | ||
10269 | /* unsolicited event for HP jack sensing */ | 10343 | /* unsolicited event for HP jack sensing */ |
10270 | static void alc262_tyan_init_hook(struct hda_codec *codec) | 10344 | static void alc262_tyan_setup(struct hda_codec *codec) |
10271 | { | 10345 | { |
10272 | struct alc_spec *spec = codec->spec; | 10346 | struct alc_spec *spec = codec->spec; |
10273 | 10347 | ||
10274 | spec->autocfg.hp_pins[0] = 0x1b; | 10348 | spec->autocfg.hp_pins[0] = 0x1b; |
10275 | spec->autocfg.speaker_pins[0] = 0x15; | 10349 | spec->autocfg.speaker_pins[0] = 0x15; |
10276 | alc_automute_amp(codec); | ||
10277 | } | 10350 | } |
10278 | 10351 | ||
10279 | 10352 | ||
@@ -10365,12 +10438,6 @@ static struct hda_verb alc262_eapd_verbs[] = { | |||
10365 | { } | 10438 | { } |
10366 | }; | 10439 | }; |
10367 | 10440 | ||
10368 | static struct hda_verb alc262_hippo_unsol_verbs[] = { | ||
10369 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
10370 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
10371 | {} | ||
10372 | }; | ||
10373 | |||
10374 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { | 10441 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
10375 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | 10442 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
10376 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | 10443 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -10391,14 +10458,6 @@ static struct hda_verb alc262_sony_unsol_verbs[] = { | |||
10391 | {} | 10458 | {} |
10392 | }; | 10459 | }; |
10393 | 10460 | ||
10394 | static struct hda_input_mux alc262_dmic_capture_source = { | ||
10395 | .num_items = 2, | ||
10396 | .items = { | ||
10397 | { "Int DMic", 0x9 }, | ||
10398 | { "Mic", 0x0 }, | ||
10399 | }, | ||
10400 | }; | ||
10401 | |||
10402 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { | 10461 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
10403 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 10462 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
10404 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | 10463 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
@@ -10420,35 +10479,17 @@ static struct hda_verb alc262_toshiba_s06_verbs[] = { | |||
10420 | {} | 10479 | {} |
10421 | }; | 10480 | }; |
10422 | 10481 | ||
10423 | static void alc262_dmic_automute(struct hda_codec *codec) | 10482 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
10424 | { | ||
10425 | unsigned int present; | ||
10426 | |||
10427 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
10428 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
10429 | snd_hda_codec_write(codec, 0x22, 0, | ||
10430 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); | ||
10431 | } | ||
10432 | |||
10433 | |||
10434 | /* unsolicited event for HP jack sensing */ | ||
10435 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, | ||
10436 | unsigned int res) | ||
10437 | { | ||
10438 | if ((res >> 26) == ALC880_MIC_EVENT) | ||
10439 | alc262_dmic_automute(codec); | ||
10440 | else | ||
10441 | alc_sku_unsol_event(codec, res); | ||
10442 | } | ||
10443 | |||
10444 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) | ||
10445 | { | 10483 | { |
10446 | struct alc_spec *spec = codec->spec; | 10484 | struct alc_spec *spec = codec->spec; |
10447 | 10485 | ||
10448 | spec->autocfg.hp_pins[0] = 0x15; | 10486 | spec->autocfg.hp_pins[0] = 0x15; |
10449 | spec->autocfg.speaker_pins[0] = 0x14; | 10487 | spec->autocfg.speaker_pins[0] = 0x14; |
10450 | alc_automute_pin(codec); | 10488 | spec->ext_mic.pin = 0x18; |
10451 | alc262_dmic_automute(codec); | 10489 | spec->ext_mic.mux_idx = 0; |
10490 | spec->int_mic.pin = 0x12; | ||
10491 | spec->int_mic.mux_idx = 9; | ||
10492 | spec->auto_mic = 1; | ||
10452 | } | 10493 | } |
10453 | 10494 | ||
10454 | /* | 10495 | /* |
@@ -10866,104 +10907,111 @@ static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | |||
10866 | { } /* end */ | 10907 | { } /* end */ |
10867 | }; | 10908 | }; |
10868 | 10909 | ||
10910 | /* We use two mixers depending on the output pin; 0x16 is a mono output | ||
10911 | * and thus it's bound with a different mixer. | ||
10912 | * This function returns which mixer amp should be used. | ||
10913 | */ | ||
10914 | static int alc262_check_volbit(hda_nid_t nid) | ||
10915 | { | ||
10916 | if (!nid) | ||
10917 | return 0; | ||
10918 | else if (nid == 0x16) | ||
10919 | return 2; | ||
10920 | else | ||
10921 | return 1; | ||
10922 | } | ||
10923 | |||
10924 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, | ||
10925 | const char *pfx, int *vbits) | ||
10926 | { | ||
10927 | char name[32]; | ||
10928 | unsigned long val; | ||
10929 | int vbit; | ||
10930 | |||
10931 | vbit = alc262_check_volbit(nid); | ||
10932 | if (!vbit) | ||
10933 | return 0; | ||
10934 | if (*vbits & vbit) /* a volume control for this mixer already there */ | ||
10935 | return 0; | ||
10936 | *vbits |= vbit; | ||
10937 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); | ||
10938 | if (vbit == 2) | ||
10939 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); | ||
10940 | else | ||
10941 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); | ||
10942 | return add_control(spec, ALC_CTL_WIDGET_VOL, name, val); | ||
10943 | } | ||
10944 | |||
10945 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, | ||
10946 | const char *pfx) | ||
10947 | { | ||
10948 | char name[32]; | ||
10949 | unsigned long val; | ||
10950 | |||
10951 | if (!nid) | ||
10952 | return 0; | ||
10953 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); | ||
10954 | if (nid == 0x16) | ||
10955 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | ||
10956 | else | ||
10957 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | ||
10958 | return add_control(spec, ALC_CTL_WIDGET_MUTE, name, val); | ||
10959 | } | ||
10960 | |||
10869 | /* add playback controls from the parsed DAC table */ | 10961 | /* add playback controls from the parsed DAC table */ |
10870 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, | 10962 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
10871 | const struct auto_pin_cfg *cfg) | 10963 | const struct auto_pin_cfg *cfg) |
10872 | { | 10964 | { |
10873 | hda_nid_t nid; | 10965 | const char *pfx; |
10966 | int vbits; | ||
10874 | int err; | 10967 | int err; |
10875 | 10968 | ||
10876 | spec->multiout.num_dacs = 1; /* only use one dac */ | 10969 | spec->multiout.num_dacs = 1; /* only use one dac */ |
10877 | spec->multiout.dac_nids = spec->private_dac_nids; | 10970 | spec->multiout.dac_nids = spec->private_dac_nids; |
10878 | spec->multiout.dac_nids[0] = 2; | 10971 | spec->multiout.dac_nids[0] = 2; |
10879 | 10972 | ||
10880 | nid = cfg->line_out_pins[0]; | 10973 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
10881 | if (nid) { | 10974 | pfx = "Master"; |
10882 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | 10975 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
10883 | "Front Playback Volume", | 10976 | pfx = "Speaker"; |
10884 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); | 10977 | else |
10885 | if (err < 0) | 10978 | pfx = "Front"; |
10886 | return err; | 10979 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
10887 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | 10980 | if (err < 0) |
10888 | "Front Playback Switch", | 10981 | return err; |
10889 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | 10982 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
10890 | if (err < 0) | 10983 | if (err < 0) |
10891 | return err; | 10984 | return err; |
10892 | } | 10985 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
10893 | 10986 | if (err < 0) | |
10894 | nid = cfg->speaker_pins[0]; | 10987 | return err; |
10895 | if (nid) { | ||
10896 | if (nid == 0x16) { | ||
10897 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
10898 | "Speaker Playback Volume", | ||
10899 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, | ||
10900 | HDA_OUTPUT)); | ||
10901 | if (err < 0) | ||
10902 | return err; | ||
10903 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
10904 | "Speaker Playback Switch", | ||
10905 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | ||
10906 | HDA_OUTPUT)); | ||
10907 | if (err < 0) | ||
10908 | return err; | ||
10909 | } else { | ||
10910 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
10911 | "Speaker Playback Switch", | ||
10912 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | ||
10913 | HDA_OUTPUT)); | ||
10914 | if (err < 0) | ||
10915 | return err; | ||
10916 | } | ||
10917 | } | ||
10918 | nid = cfg->hp_pins[0]; | ||
10919 | if (nid) { | ||
10920 | /* spec->multiout.hp_nid = 2; */ | ||
10921 | if (nid == 0x16) { | ||
10922 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
10923 | "Headphone Playback Volume", | ||
10924 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, | ||
10925 | HDA_OUTPUT)); | ||
10926 | if (err < 0) | ||
10927 | return err; | ||
10928 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
10929 | "Headphone Playback Switch", | ||
10930 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | ||
10931 | HDA_OUTPUT)); | ||
10932 | if (err < 0) | ||
10933 | return err; | ||
10934 | } else { | ||
10935 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
10936 | "Headphone Playback Switch", | ||
10937 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | ||
10938 | HDA_OUTPUT)); | ||
10939 | if (err < 0) | ||
10940 | return err; | ||
10941 | } | ||
10942 | } | ||
10943 | return 0; | ||
10944 | } | ||
10945 | |||
10946 | static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec, | ||
10947 | const struct auto_pin_cfg *cfg) | ||
10948 | { | ||
10949 | int err; | ||
10950 | 10988 | ||
10951 | err = alc880_auto_create_analog_input_ctls(spec, cfg); | 10989 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
10990 | alc262_check_volbit(cfg->speaker_pins[0]) | | ||
10991 | alc262_check_volbit(cfg->hp_pins[0]); | ||
10992 | if (vbits == 1 || vbits == 2) | ||
10993 | pfx = "Master"; /* only one mixer is used */ | ||
10994 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
10995 | pfx = "Speaker"; | ||
10996 | else | ||
10997 | pfx = "Front"; | ||
10998 | vbits = 0; | ||
10999 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); | ||
11000 | if (err < 0) | ||
11001 | return err; | ||
11002 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", | ||
11003 | &vbits); | ||
11004 | if (err < 0) | ||
11005 | return err; | ||
11006 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", | ||
11007 | &vbits); | ||
10952 | if (err < 0) | 11008 | if (err < 0) |
10953 | return err; | 11009 | return err; |
10954 | /* digital-mic input pin is excluded in alc880_auto_create..() | ||
10955 | * because it's under 0x18 | ||
10956 | */ | ||
10957 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || | ||
10958 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { | ||
10959 | struct hda_input_mux *imux = &spec->private_imux[0]; | ||
10960 | imux->items[imux->num_items].label = "Int Mic"; | ||
10961 | imux->items[imux->num_items].index = 0x09; | ||
10962 | imux->num_items++; | ||
10963 | } | ||
10964 | return 0; | 11010 | return 0; |
10965 | } | 11011 | } |
10966 | 11012 | ||
11013 | #define alc262_auto_create_input_ctls \ | ||
11014 | alc880_auto_create_input_ctls | ||
10967 | 11015 | ||
10968 | /* | 11016 | /* |
10969 | * generic initialization of ADC, input mixers and output mixers | 11017 | * generic initialization of ADC, input mixers and output mixers |
@@ -11281,7 +11329,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec) | |||
11281 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); | 11329 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
11282 | if (err < 0) | 11330 | if (err < 0) |
11283 | return err; | 11331 | return err; |
11284 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); | 11332 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
11285 | if (err < 0) | 11333 | if (err < 0) |
11286 | return err; | 11334 | return err; |
11287 | 11335 | ||
@@ -11412,7 +11460,7 @@ static struct alc_config_preset alc262_presets[] = { | |||
11412 | }, | 11460 | }, |
11413 | [ALC262_HIPPO] = { | 11461 | [ALC262_HIPPO] = { |
11414 | .mixers = { alc262_hippo_mixer }, | 11462 | .mixers = { alc262_hippo_mixer }, |
11415 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, | 11463 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
11416 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | 11464 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
11417 | .dac_nids = alc262_dac_nids, | 11465 | .dac_nids = alc262_dac_nids, |
11418 | .hp_nid = 0x03, | 11466 | .hp_nid = 0x03, |
@@ -11421,7 +11469,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11421 | .channel_mode = alc262_modes, | 11469 | .channel_mode = alc262_modes, |
11422 | .input_mux = &alc262_capture_source, | 11470 | .input_mux = &alc262_capture_source, |
11423 | .unsol_event = alc262_hippo_unsol_event, | 11471 | .unsol_event = alc262_hippo_unsol_event, |
11424 | .init_hook = alc262_hippo_init_hook, | 11472 | .setup = alc262_hippo_setup, |
11473 | .init_hook = alc262_hippo_automute, | ||
11425 | }, | 11474 | }, |
11426 | [ALC262_HIPPO_1] = { | 11475 | [ALC262_HIPPO_1] = { |
11427 | .mixers = { alc262_hippo1_mixer }, | 11476 | .mixers = { alc262_hippo1_mixer }, |
@@ -11434,7 +11483,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11434 | .channel_mode = alc262_modes, | 11483 | .channel_mode = alc262_modes, |
11435 | .input_mux = &alc262_capture_source, | 11484 | .input_mux = &alc262_capture_source, |
11436 | .unsol_event = alc262_hippo_unsol_event, | 11485 | .unsol_event = alc262_hippo_unsol_event, |
11437 | .init_hook = alc262_hippo1_init_hook, | 11486 | .setup = alc262_hippo1_setup, |
11487 | .init_hook = alc262_hippo_automute, | ||
11438 | }, | 11488 | }, |
11439 | [ALC262_FUJITSU] = { | 11489 | [ALC262_FUJITSU] = { |
11440 | .mixers = { alc262_fujitsu_mixer }, | 11490 | .mixers = { alc262_fujitsu_mixer }, |
@@ -11497,7 +11547,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11497 | .channel_mode = alc262_modes, | 11547 | .channel_mode = alc262_modes, |
11498 | .input_mux = &alc262_capture_source, | 11548 | .input_mux = &alc262_capture_source, |
11499 | .unsol_event = alc_automute_amp_unsol_event, | 11549 | .unsol_event = alc_automute_amp_unsol_event, |
11500 | .init_hook = alc262_hp_t5735_init_hook, | 11550 | .setup = alc262_hp_t5735_setup, |
11551 | .init_hook = alc_automute_amp, | ||
11501 | }, | 11552 | }, |
11502 | [ALC262_HP_RP5700] = { | 11553 | [ALC262_HP_RP5700] = { |
11503 | .mixers = { alc262_hp_rp5700_mixer }, | 11554 | .mixers = { alc262_hp_rp5700_mixer }, |
@@ -11528,11 +11579,13 @@ static struct alc_config_preset alc262_presets[] = { | |||
11528 | .channel_mode = alc262_modes, | 11579 | .channel_mode = alc262_modes, |
11529 | .input_mux = &alc262_capture_source, | 11580 | .input_mux = &alc262_capture_source, |
11530 | .unsol_event = alc262_hippo_unsol_event, | 11581 | .unsol_event = alc262_hippo_unsol_event, |
11531 | .init_hook = alc262_hippo_init_hook, | 11582 | .setup = alc262_hippo_setup, |
11583 | .init_hook = alc262_hippo_automute, | ||
11532 | }, | 11584 | }, |
11533 | [ALC262_BENQ_T31] = { | 11585 | [ALC262_BENQ_T31] = { |
11534 | .mixers = { alc262_benq_t31_mixer }, | 11586 | .mixers = { alc262_benq_t31_mixer }, |
11535 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, | 11587 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
11588 | alc_hp15_unsol_verbs }, | ||
11536 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | 11589 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
11537 | .dac_nids = alc262_dac_nids, | 11590 | .dac_nids = alc262_dac_nids, |
11538 | .hp_nid = 0x03, | 11591 | .hp_nid = 0x03, |
@@ -11540,7 +11593,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11540 | .channel_mode = alc262_modes, | 11593 | .channel_mode = alc262_modes, |
11541 | .input_mux = &alc262_capture_source, | 11594 | .input_mux = &alc262_capture_source, |
11542 | .unsol_event = alc262_hippo_unsol_event, | 11595 | .unsol_event = alc262_hippo_unsol_event, |
11543 | .init_hook = alc262_hippo_init_hook, | 11596 | .setup = alc262_hippo_setup, |
11597 | .init_hook = alc262_hippo_automute, | ||
11544 | }, | 11598 | }, |
11545 | [ALC262_ULTRA] = { | 11599 | [ALC262_ULTRA] = { |
11546 | .mixers = { alc262_ultra_mixer }, | 11600 | .mixers = { alc262_ultra_mixer }, |
@@ -11592,9 +11646,9 @@ static struct alc_config_preset alc262_presets[] = { | |||
11592 | .dig_out_nid = ALC262_DIGOUT_NID, | 11646 | .dig_out_nid = ALC262_DIGOUT_NID, |
11593 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | 11647 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
11594 | .channel_mode = alc262_modes, | 11648 | .channel_mode = alc262_modes, |
11595 | .input_mux = &alc262_dmic_capture_source, | 11649 | .unsol_event = alc_sku_unsol_event, |
11596 | .unsol_event = alc262_toshiba_s06_unsol_event, | 11650 | .setup = alc262_toshiba_s06_setup, |
11597 | .init_hook = alc262_toshiba_s06_init_hook, | 11651 | .init_hook = alc_inithook, |
11598 | }, | 11652 | }, |
11599 | [ALC262_TOSHIBA_RX1] = { | 11653 | [ALC262_TOSHIBA_RX1] = { |
11600 | .mixers = { alc262_toshiba_rx1_mixer }, | 11654 | .mixers = { alc262_toshiba_rx1_mixer }, |
@@ -11606,7 +11660,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11606 | .channel_mode = alc262_modes, | 11660 | .channel_mode = alc262_modes, |
11607 | .input_mux = &alc262_capture_source, | 11661 | .input_mux = &alc262_capture_source, |
11608 | .unsol_event = alc262_hippo_unsol_event, | 11662 | .unsol_event = alc262_hippo_unsol_event, |
11609 | .init_hook = alc262_hippo_init_hook, | 11663 | .setup = alc262_hippo_setup, |
11664 | .init_hook = alc262_hippo_automute, | ||
11610 | }, | 11665 | }, |
11611 | [ALC262_TYAN] = { | 11666 | [ALC262_TYAN] = { |
11612 | .mixers = { alc262_tyan_mixer }, | 11667 | .mixers = { alc262_tyan_mixer }, |
@@ -11619,7 +11674,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11619 | .channel_mode = alc262_modes, | 11674 | .channel_mode = alc262_modes, |
11620 | .input_mux = &alc262_capture_source, | 11675 | .input_mux = &alc262_capture_source, |
11621 | .unsol_event = alc_automute_amp_unsol_event, | 11676 | .unsol_event = alc_automute_amp_unsol_event, |
11622 | .init_hook = alc262_tyan_init_hook, | 11677 | .setup = alc262_tyan_setup, |
11678 | .init_hook = alc_automute_amp, | ||
11623 | }, | 11679 | }, |
11624 | }; | 11680 | }; |
11625 | 11681 | ||
@@ -11654,8 +11710,8 @@ static int patch_alc262(struct hda_codec *codec) | |||
11654 | alc262_cfg_tbl); | 11710 | alc262_cfg_tbl); |
11655 | 11711 | ||
11656 | if (board_config < 0) { | 11712 | if (board_config < 0) { |
11657 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 11713 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
11658 | "trying auto-probe from BIOS...\n", codec->chip_name); | 11714 | codec->chip_name); |
11659 | board_config = ALC262_AUTO; | 11715 | board_config = ALC262_AUTO; |
11660 | } | 11716 | } |
11661 | 11717 | ||
@@ -11682,7 +11738,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
11682 | } | 11738 | } |
11683 | 11739 | ||
11684 | if (board_config != ALC262_AUTO) | 11740 | if (board_config != ALC262_AUTO) |
11685 | setup_preset(spec, &alc262_presets[board_config]); | 11741 | setup_preset(codec, &alc262_presets[board_config]); |
11686 | 11742 | ||
11687 | spec->stream_analog_playback = &alc262_pcm_analog_playback; | 11743 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
11688 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | 11744 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
@@ -11708,7 +11764,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
11708 | unsigned int wcap = get_wcaps(codec, 0x07); | 11764 | unsigned int wcap = get_wcaps(codec, 0x07); |
11709 | 11765 | ||
11710 | /* get type */ | 11766 | /* get type */ |
11711 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 11767 | wcap = get_wcaps_type(wcap); |
11712 | if (wcap != AC_WID_AUD_IN) { | 11768 | if (wcap != AC_WID_AUD_IN) { |
11713 | spec->adc_nids = alc262_adc_nids_alt; | 11769 | spec->adc_nids = alc262_adc_nids_alt; |
11714 | spec->num_adc_nids = | 11770 | spec->num_adc_nids = |
@@ -11723,7 +11779,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
11723 | } | 11779 | } |
11724 | } | 11780 | } |
11725 | if (!spec->cap_mixer && !spec->no_analog) | 11781 | if (!spec->cap_mixer && !spec->no_analog) |
11726 | set_capture_mixer(spec); | 11782 | set_capture_mixer(codec); |
11727 | if (!spec->no_analog) | 11783 | if (!spec->no_analog) |
11728 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 11784 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
11729 | 11785 | ||
@@ -11815,14 +11871,6 @@ static struct hda_verb alc268_toshiba_verbs[] = { | |||
11815 | { } /* end */ | 11871 | { } /* end */ |
11816 | }; | 11872 | }; |
11817 | 11873 | ||
11818 | static struct hda_input_mux alc268_acer_lc_capture_source = { | ||
11819 | .num_items = 2, | ||
11820 | .items = { | ||
11821 | { "i-Mic", 0x6 }, | ||
11822 | { "E-Mic", 0x0 }, | ||
11823 | }, | ||
11824 | }; | ||
11825 | |||
11826 | /* Acer specific */ | 11874 | /* Acer specific */ |
11827 | /* bind volumes of both NID 0x02 and 0x03 */ | 11875 | /* bind volumes of both NID 0x02 and 0x03 */ |
11828 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { | 11876 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
@@ -11941,7 +11989,8 @@ static struct hda_verb alc268_acer_verbs[] = { | |||
11941 | 11989 | ||
11942 | /* unsolicited event for HP jack sensing */ | 11990 | /* unsolicited event for HP jack sensing */ |
11943 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event | 11991 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
11944 | #define alc268_toshiba_init_hook alc262_hippo_init_hook | 11992 | #define alc268_toshiba_setup alc262_hippo_setup |
11993 | #define alc268_toshiba_automute alc262_hippo_automute | ||
11945 | 11994 | ||
11946 | static void alc268_acer_unsol_event(struct hda_codec *codec, | 11995 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
11947 | unsigned int res) | 11996 | unsigned int res) |
@@ -11971,30 +12020,33 @@ static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | |||
11971 | AMP_IN_MUTE(0), bits); | 12020 | AMP_IN_MUTE(0), bits); |
11972 | } | 12021 | } |
11973 | 12022 | ||
11974 | |||
11975 | static void alc268_acer_mic_automute(struct hda_codec *codec) | ||
11976 | { | ||
11977 | unsigned int present; | ||
11978 | |||
11979 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
11980 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
11981 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, | ||
11982 | present ? 0x0 : 0x6); | ||
11983 | } | ||
11984 | |||
11985 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, | 12023 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
11986 | unsigned int res) | 12024 | unsigned int res) |
11987 | { | 12025 | { |
11988 | if ((res >> 26) == ALC880_HP_EVENT) | 12026 | switch (res >> 26) { |
12027 | case ALC880_HP_EVENT: | ||
11989 | alc268_aspire_one_speaker_automute(codec); | 12028 | alc268_aspire_one_speaker_automute(codec); |
11990 | if ((res >> 26) == ALC880_MIC_EVENT) | 12029 | break; |
11991 | alc268_acer_mic_automute(codec); | 12030 | case ALC880_MIC_EVENT: |
12031 | alc_mic_automute(codec); | ||
12032 | break; | ||
12033 | } | ||
12034 | } | ||
12035 | |||
12036 | static void alc268_acer_lc_setup(struct hda_codec *codec) | ||
12037 | { | ||
12038 | struct alc_spec *spec = codec->spec; | ||
12039 | spec->ext_mic.pin = 0x18; | ||
12040 | spec->ext_mic.mux_idx = 0; | ||
12041 | spec->int_mic.pin = 0x12; | ||
12042 | spec->int_mic.mux_idx = 6; | ||
12043 | spec->auto_mic = 1; | ||
11992 | } | 12044 | } |
11993 | 12045 | ||
11994 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | 12046 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
11995 | { | 12047 | { |
11996 | alc268_aspire_one_speaker_automute(codec); | 12048 | alc268_aspire_one_speaker_automute(codec); |
11997 | alc268_acer_mic_automute(codec); | 12049 | alc_mic_automute(codec); |
11998 | } | 12050 | } |
11999 | 12051 | ||
12000 | static struct snd_kcontrol_new alc268_dell_mixer[] = { | 12052 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
@@ -12012,17 +12064,22 @@ static struct hda_verb alc268_dell_verbs[] = { | |||
12012 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 12064 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
12013 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 12065 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
12014 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | 12066 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
12067 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
12015 | { } | 12068 | { } |
12016 | }; | 12069 | }; |
12017 | 12070 | ||
12018 | /* mute/unmute internal speaker according to the hp jack and mute state */ | 12071 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
12019 | static void alc268_dell_init_hook(struct hda_codec *codec) | 12072 | static void alc268_dell_setup(struct hda_codec *codec) |
12020 | { | 12073 | { |
12021 | struct alc_spec *spec = codec->spec; | 12074 | struct alc_spec *spec = codec->spec; |
12022 | 12075 | ||
12023 | spec->autocfg.hp_pins[0] = 0x15; | 12076 | spec->autocfg.hp_pins[0] = 0x15; |
12024 | spec->autocfg.speaker_pins[0] = 0x14; | 12077 | spec->autocfg.speaker_pins[0] = 0x14; |
12025 | alc_automute_pin(codec); | 12078 | spec->ext_mic.pin = 0x18; |
12079 | spec->ext_mic.mux_idx = 0; | ||
12080 | spec->int_mic.pin = 0x19; | ||
12081 | spec->int_mic.mux_idx = 1; | ||
12082 | spec->auto_mic = 1; | ||
12026 | } | 12083 | } |
12027 | 12084 | ||
12028 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { | 12085 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
@@ -12043,38 +12100,16 @@ static struct hda_verb alc267_quanta_il1_verbs[] = { | |||
12043 | { } | 12100 | { } |
12044 | }; | 12101 | }; |
12045 | 12102 | ||
12046 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) | 12103 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
12047 | { | ||
12048 | unsigned int present; | ||
12049 | |||
12050 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
12051 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
12052 | snd_hda_codec_write(codec, 0x23, 0, | ||
12053 | AC_VERB_SET_CONNECT_SEL, | ||
12054 | present ? 0x00 : 0x01); | ||
12055 | } | ||
12056 | |||
12057 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) | ||
12058 | { | 12104 | { |
12059 | struct alc_spec *spec = codec->spec; | 12105 | struct alc_spec *spec = codec->spec; |
12060 | |||
12061 | spec->autocfg.hp_pins[0] = 0x15; | 12106 | spec->autocfg.hp_pins[0] = 0x15; |
12062 | spec->autocfg.speaker_pins[0] = 0x14; | 12107 | spec->autocfg.speaker_pins[0] = 0x14; |
12063 | alc_automute_pin(codec); | 12108 | spec->ext_mic.pin = 0x18; |
12064 | alc267_quanta_il1_mic_automute(codec); | 12109 | spec->ext_mic.mux_idx = 0; |
12065 | } | 12110 | spec->int_mic.pin = 0x19; |
12066 | 12111 | spec->int_mic.mux_idx = 1; | |
12067 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, | 12112 | spec->auto_mic = 1; |
12068 | unsigned int res) | ||
12069 | { | ||
12070 | switch (res >> 26) { | ||
12071 | case ALC880_MIC_EVENT: | ||
12072 | alc267_quanta_il1_mic_automute(codec); | ||
12073 | break; | ||
12074 | default: | ||
12075 | alc_sku_unsol_event(codec, res); | ||
12076 | break; | ||
12077 | } | ||
12078 | } | 12113 | } |
12079 | 12114 | ||
12080 | /* | 12115 | /* |
@@ -12154,21 +12189,16 @@ static struct hda_verb alc268_volume_init_verbs[] = { | |||
12154 | { } | 12189 | { } |
12155 | }; | 12190 | }; |
12156 | 12191 | ||
12192 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { | ||
12193 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
12194 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | ||
12195 | { } /* end */ | ||
12196 | }; | ||
12197 | |||
12157 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { | 12198 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
12158 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | 12199 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
12159 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | 12200 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
12160 | { | 12201 | _DEFINE_CAPSRC(1), |
12161 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
12162 | /* The multiple "Capture Source" controls confuse alsamixer | ||
12163 | * So call somewhat different.. | ||
12164 | */ | ||
12165 | /* .name = "Capture Source", */ | ||
12166 | .name = "Input Source", | ||
12167 | .count = 1, | ||
12168 | .info = alc_mux_enum_info, | ||
12169 | .get = alc_mux_enum_get, | ||
12170 | .put = alc_mux_enum_put, | ||
12171 | }, | ||
12172 | { } /* end */ | 12202 | { } /* end */ |
12173 | }; | 12203 | }; |
12174 | 12204 | ||
@@ -12177,18 +12207,7 @@ static struct snd_kcontrol_new alc268_capture_mixer[] = { | |||
12177 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | 12207 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
12178 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | 12208 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
12179 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | 12209 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
12180 | { | 12210 | _DEFINE_CAPSRC(2), |
12181 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
12182 | /* The multiple "Capture Source" controls confuse alsamixer | ||
12183 | * So call somewhat different.. | ||
12184 | */ | ||
12185 | /* .name = "Capture Source", */ | ||
12186 | .name = "Input Source", | ||
12187 | .count = 2, | ||
12188 | .info = alc_mux_enum_info, | ||
12189 | .get = alc_mux_enum_get, | ||
12190 | .put = alc_mux_enum_put, | ||
12191 | }, | ||
12192 | { } /* end */ | 12211 | { } /* end */ |
12193 | }; | 12212 | }; |
12194 | 12213 | ||
@@ -12275,26 +12294,38 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |||
12275 | const char *ctlname, int idx) | 12294 | const char *ctlname, int idx) |
12276 | { | 12295 | { |
12277 | char name[32]; | 12296 | char name[32]; |
12297 | hda_nid_t dac; | ||
12278 | int err; | 12298 | int err; |
12279 | 12299 | ||
12280 | sprintf(name, "%s Playback Volume", ctlname); | 12300 | sprintf(name, "%s Playback Volume", ctlname); |
12281 | if (nid == 0x14) { | 12301 | switch (nid) { |
12282 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | 12302 | case 0x14: |
12283 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, | 12303 | case 0x16: |
12284 | HDA_OUTPUT)); | 12304 | dac = 0x02; |
12285 | if (err < 0) | 12305 | break; |
12286 | return err; | 12306 | case 0x15: |
12287 | } else if (nid == 0x15) { | 12307 | dac = 0x03; |
12308 | break; | ||
12309 | default: | ||
12310 | return 0; | ||
12311 | } | ||
12312 | if (spec->multiout.dac_nids[0] != dac && | ||
12313 | spec->multiout.dac_nids[1] != dac) { | ||
12288 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | 12314 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
12289 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, | 12315 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
12290 | HDA_OUTPUT)); | 12316 | HDA_OUTPUT)); |
12291 | if (err < 0) | 12317 | if (err < 0) |
12292 | return err; | 12318 | return err; |
12293 | } else | 12319 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
12294 | return -1; | 12320 | } |
12321 | |||
12295 | sprintf(name, "%s Playback Switch", ctlname); | 12322 | sprintf(name, "%s Playback Switch", ctlname); |
12296 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | 12323 | if (nid != 0x16) |
12324 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | ||
12297 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | 12325 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
12326 | else /* mono */ | ||
12327 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | ||
12328 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); | ||
12298 | if (err < 0) | 12329 | if (err < 0) |
12299 | return err; | 12330 | return err; |
12300 | return 0; | 12331 | return 0; |
@@ -12307,14 +12338,19 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
12307 | hda_nid_t nid; | 12338 | hda_nid_t nid; |
12308 | int err; | 12339 | int err; |
12309 | 12340 | ||
12310 | spec->multiout.num_dacs = 2; /* only use one dac */ | ||
12311 | spec->multiout.dac_nids = spec->private_dac_nids; | 12341 | spec->multiout.dac_nids = spec->private_dac_nids; |
12312 | spec->multiout.dac_nids[0] = 2; | ||
12313 | spec->multiout.dac_nids[1] = 3; | ||
12314 | 12342 | ||
12315 | nid = cfg->line_out_pins[0]; | 12343 | nid = cfg->line_out_pins[0]; |
12316 | if (nid) | 12344 | if (nid) { |
12317 | alc268_new_analog_output(spec, nid, "Front", 0); | 12345 | const char *name; |
12346 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
12347 | name = "Speaker"; | ||
12348 | else | ||
12349 | name = "Front"; | ||
12350 | err = alc268_new_analog_output(spec, nid, name, 0); | ||
12351 | if (err < 0) | ||
12352 | return err; | ||
12353 | } | ||
12318 | 12354 | ||
12319 | nid = cfg->speaker_pins[0]; | 12355 | nid = cfg->speaker_pins[0]; |
12320 | if (nid == 0x1d) { | 12356 | if (nid == 0x1d) { |
@@ -12323,16 +12359,23 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
12323 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | 12359 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
12324 | if (err < 0) | 12360 | if (err < 0) |
12325 | return err; | 12361 | return err; |
12362 | } else { | ||
12363 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); | ||
12364 | if (err < 0) | ||
12365 | return err; | ||
12326 | } | 12366 | } |
12327 | nid = cfg->hp_pins[0]; | 12367 | nid = cfg->hp_pins[0]; |
12328 | if (nid) | 12368 | if (nid) { |
12329 | alc268_new_analog_output(spec, nid, "Headphone", 0); | 12369 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
12370 | if (err < 0) | ||
12371 | return err; | ||
12372 | } | ||
12330 | 12373 | ||
12331 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | 12374 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
12332 | if (nid == 0x16) { | 12375 | if (nid == 0x16) { |
12333 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | 12376 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
12334 | "Mono Playback Switch", | 12377 | "Mono Playback Switch", |
12335 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); | 12378 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
12336 | if (err < 0) | 12379 | if (err < 0) |
12337 | return err; | 12380 | return err; |
12338 | } | 12381 | } |
@@ -12340,38 +12383,46 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
12340 | } | 12383 | } |
12341 | 12384 | ||
12342 | /* create playback/capture controls for input pins */ | 12385 | /* create playback/capture controls for input pins */ |
12343 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, | 12386 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
12344 | const struct auto_pin_cfg *cfg) | 12387 | const struct auto_pin_cfg *cfg) |
12345 | { | 12388 | { |
12346 | struct hda_input_mux *imux = &spec->private_imux[0]; | 12389 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
12347 | int i, idx1; | 12390 | } |
12348 | 12391 | ||
12349 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 12392 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
12350 | switch(cfg->input_pins[i]) { | 12393 | hda_nid_t nid, int pin_type) |
12351 | case 0x18: | 12394 | { |
12352 | idx1 = 0; /* Mic 1 */ | 12395 | int idx; |
12353 | break; | 12396 | |
12354 | case 0x19: | 12397 | alc_set_pin_output(codec, nid, pin_type); |
12355 | idx1 = 1; /* Mic 2 */ | 12398 | if (nid == 0x14 || nid == 0x16) |
12356 | break; | 12399 | idx = 0; |
12357 | case 0x1a: | 12400 | else |
12358 | idx1 = 2; /* Line In */ | 12401 | idx = 1; |
12359 | break; | 12402 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
12360 | case 0x1c: | 12403 | } |
12361 | idx1 = 3; /* CD */ | 12404 | |
12362 | break; | 12405 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
12363 | case 0x12: | 12406 | { |
12364 | case 0x13: | 12407 | struct alc_spec *spec = codec->spec; |
12365 | idx1 = 6; /* digital mics */ | 12408 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
12366 | break; | 12409 | if (nid) { |
12367 | default: | 12410 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
12368 | continue; | 12411 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
12369 | } | ||
12370 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; | ||
12371 | imux->items[imux->num_items].index = idx1; | ||
12372 | imux->num_items++; | ||
12373 | } | 12412 | } |
12374 | return 0; | 12413 | } |
12414 | |||
12415 | static void alc268_auto_init_hp_out(struct hda_codec *codec) | ||
12416 | { | ||
12417 | struct alc_spec *spec = codec->spec; | ||
12418 | hda_nid_t pin; | ||
12419 | |||
12420 | pin = spec->autocfg.hp_pins[0]; | ||
12421 | if (pin) | ||
12422 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); | ||
12423 | pin = spec->autocfg.speaker_pins[0]; | ||
12424 | if (pin) | ||
12425 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); | ||
12375 | } | 12426 | } |
12376 | 12427 | ||
12377 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | 12428 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
@@ -12382,9 +12433,10 @@ static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | |||
12382 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | 12433 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
12383 | unsigned int dac_vol1, dac_vol2; | 12434 | unsigned int dac_vol1, dac_vol2; |
12384 | 12435 | ||
12385 | if (speaker_nid) { | 12436 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
12386 | snd_hda_codec_write(codec, speaker_nid, 0, | 12437 | snd_hda_codec_write(codec, speaker_nid, 0, |
12387 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | 12438 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
12439 | /* mute mixer inputs from 0x1d */ | ||
12388 | snd_hda_codec_write(codec, 0x0f, 0, | 12440 | snd_hda_codec_write(codec, 0x0f, 0, |
12389 | AC_VERB_SET_AMP_GAIN_MUTE, | 12441 | AC_VERB_SET_AMP_GAIN_MUTE, |
12390 | AMP_IN_UNMUTE(1)); | 12442 | AMP_IN_UNMUTE(1)); |
@@ -12392,6 +12444,7 @@ static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | |||
12392 | AC_VERB_SET_AMP_GAIN_MUTE, | 12444 | AC_VERB_SET_AMP_GAIN_MUTE, |
12393 | AMP_IN_UNMUTE(1)); | 12445 | AMP_IN_UNMUTE(1)); |
12394 | } else { | 12446 | } else { |
12447 | /* unmute mixer inputs from 0x1d */ | ||
12395 | snd_hda_codec_write(codec, 0x0f, 0, | 12448 | snd_hda_codec_write(codec, 0x0f, 0, |
12396 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | 12449 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
12397 | snd_hda_codec_write(codec, 0x10, 0, | 12450 | snd_hda_codec_write(codec, 0x10, 0, |
@@ -12448,7 +12501,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
12448 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); | 12501 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
12449 | if (err < 0) | 12502 | if (err < 0) |
12450 | return err; | 12503 | return err; |
12451 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); | 12504 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
12452 | if (err < 0) | 12505 | if (err < 0) |
12453 | return err; | 12506 | return err; |
12454 | 12507 | ||
@@ -12467,7 +12520,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
12467 | add_mixer(spec, alc268_beep_mixer); | 12520 | add_mixer(spec, alc268_beep_mixer); |
12468 | 12521 | ||
12469 | add_verb(spec, alc268_volume_init_verbs); | 12522 | add_verb(spec, alc268_volume_init_verbs); |
12470 | spec->num_mux_defs = 1; | 12523 | spec->num_mux_defs = 2; |
12471 | spec->input_mux = &spec->private_imux[0]; | 12524 | spec->input_mux = &spec->private_imux[0]; |
12472 | 12525 | ||
12473 | err = alc_auto_add_mic_boost(codec); | 12526 | err = alc_auto_add_mic_boost(codec); |
@@ -12479,8 +12532,6 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
12479 | return 1; | 12532 | return 1; |
12480 | } | 12533 | } |
12481 | 12534 | ||
12482 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out | ||
12483 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out | ||
12484 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input | 12535 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
12485 | 12536 | ||
12486 | /* init callback for auto-configuration model -- overriding the default init */ | 12537 | /* init callback for auto-configuration model -- overriding the default init */ |
@@ -12523,8 +12574,11 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = { | |||
12523 | ALC268_ACER_ASPIRE_ONE), | 12574 | ALC268_ACER_ASPIRE_ONE), |
12524 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), | 12575 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
12525 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), | 12576 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
12577 | /* almost compatible with toshiba but with optional digital outs; | ||
12578 | * auto-probing seems working fine | ||
12579 | */ | ||
12526 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", | 12580 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
12527 | ALC268_TOSHIBA), | 12581 | ALC268_AUTO), |
12528 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), | 12582 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
12529 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), | 12583 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
12530 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), | 12584 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
@@ -12545,7 +12599,8 @@ static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { | |||
12545 | 12599 | ||
12546 | static struct alc_config_preset alc268_presets[] = { | 12600 | static struct alc_config_preset alc268_presets[] = { |
12547 | [ALC267_QUANTA_IL1] = { | 12601 | [ALC267_QUANTA_IL1] = { |
12548 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, | 12602 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
12603 | alc268_capture_nosrc_mixer }, | ||
12549 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12604 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12550 | alc267_quanta_il1_verbs }, | 12605 | alc267_quanta_il1_verbs }, |
12551 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 12606 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
@@ -12555,9 +12610,9 @@ static struct alc_config_preset alc268_presets[] = { | |||
12555 | .hp_nid = 0x03, | 12610 | .hp_nid = 0x03, |
12556 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12611 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12557 | .channel_mode = alc268_modes, | 12612 | .channel_mode = alc268_modes, |
12558 | .input_mux = &alc268_capture_source, | 12613 | .unsol_event = alc_sku_unsol_event, |
12559 | .unsol_event = alc267_quanta_il1_unsol_event, | 12614 | .setup = alc267_quanta_il1_setup, |
12560 | .init_hook = alc267_quanta_il1_init_hook, | 12615 | .init_hook = alc_inithook, |
12561 | }, | 12616 | }, |
12562 | [ALC268_3ST] = { | 12617 | [ALC268_3ST] = { |
12563 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | 12618 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
@@ -12589,10 +12644,11 @@ static struct alc_config_preset alc268_presets[] = { | |||
12589 | .channel_mode = alc268_modes, | 12644 | .channel_mode = alc268_modes, |
12590 | .input_mux = &alc268_capture_source, | 12645 | .input_mux = &alc268_capture_source, |
12591 | .unsol_event = alc268_toshiba_unsol_event, | 12646 | .unsol_event = alc268_toshiba_unsol_event, |
12592 | .init_hook = alc268_toshiba_init_hook, | 12647 | .setup = alc268_toshiba_setup, |
12648 | .init_hook = alc268_toshiba_automute, | ||
12593 | }, | 12649 | }, |
12594 | [ALC268_ACER] = { | 12650 | [ALC268_ACER] = { |
12595 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, | 12651 | .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer, |
12596 | alc268_beep_mixer }, | 12652 | alc268_beep_mixer }, |
12597 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12653 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12598 | alc268_acer_verbs }, | 12654 | alc268_acer_verbs }, |
@@ -12628,7 +12684,7 @@ static struct alc_config_preset alc268_presets[] = { | |||
12628 | [ALC268_ACER_ASPIRE_ONE] = { | 12684 | [ALC268_ACER_ASPIRE_ONE] = { |
12629 | .mixers = { alc268_acer_aspire_one_mixer, | 12685 | .mixers = { alc268_acer_aspire_one_mixer, |
12630 | alc268_beep_mixer, | 12686 | alc268_beep_mixer, |
12631 | alc268_capture_alt_mixer }, | 12687 | alc268_capture_nosrc_mixer }, |
12632 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12688 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12633 | alc268_acer_aspire_one_verbs }, | 12689 | alc268_acer_aspire_one_verbs }, |
12634 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 12690 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
@@ -12639,22 +12695,26 @@ static struct alc_config_preset alc268_presets[] = { | |||
12639 | .hp_nid = 0x03, | 12695 | .hp_nid = 0x03, |
12640 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12696 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12641 | .channel_mode = alc268_modes, | 12697 | .channel_mode = alc268_modes, |
12642 | .input_mux = &alc268_acer_lc_capture_source, | ||
12643 | .unsol_event = alc268_acer_lc_unsol_event, | 12698 | .unsol_event = alc268_acer_lc_unsol_event, |
12699 | .setup = alc268_acer_lc_setup, | ||
12644 | .init_hook = alc268_acer_lc_init_hook, | 12700 | .init_hook = alc268_acer_lc_init_hook, |
12645 | }, | 12701 | }, |
12646 | [ALC268_DELL] = { | 12702 | [ALC268_DELL] = { |
12647 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, | 12703 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
12704 | alc268_capture_nosrc_mixer }, | ||
12648 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12705 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12649 | alc268_dell_verbs }, | 12706 | alc268_dell_verbs }, |
12650 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 12707 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
12651 | .dac_nids = alc268_dac_nids, | 12708 | .dac_nids = alc268_dac_nids, |
12709 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
12710 | .adc_nids = alc268_adc_nids_alt, | ||
12711 | .capsrc_nids = alc268_capsrc_nids, | ||
12652 | .hp_nid = 0x02, | 12712 | .hp_nid = 0x02, |
12653 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12713 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12654 | .channel_mode = alc268_modes, | 12714 | .channel_mode = alc268_modes, |
12655 | .unsol_event = alc_sku_unsol_event, | 12715 | .unsol_event = alc_sku_unsol_event, |
12656 | .init_hook = alc268_dell_init_hook, | 12716 | .setup = alc268_dell_setup, |
12657 | .input_mux = &alc268_capture_source, | 12717 | .init_hook = alc_inithook, |
12658 | }, | 12718 | }, |
12659 | [ALC268_ZEPTO] = { | 12719 | [ALC268_ZEPTO] = { |
12660 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | 12720 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
@@ -12671,8 +12731,8 @@ static struct alc_config_preset alc268_presets[] = { | |||
12671 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12731 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12672 | .channel_mode = alc268_modes, | 12732 | .channel_mode = alc268_modes, |
12673 | .input_mux = &alc268_capture_source, | 12733 | .input_mux = &alc268_capture_source, |
12674 | .unsol_event = alc268_toshiba_unsol_event, | 12734 | .setup = alc268_toshiba_setup, |
12675 | .init_hook = alc268_toshiba_init_hook | 12735 | .init_hook = alc268_toshiba_automute, |
12676 | }, | 12736 | }, |
12677 | #ifdef CONFIG_SND_DEBUG | 12737 | #ifdef CONFIG_SND_DEBUG |
12678 | [ALC268_TEST] = { | 12738 | [ALC268_TEST] = { |
@@ -12714,8 +12774,8 @@ static int patch_alc268(struct hda_codec *codec) | |||
12714 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); | 12774 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
12715 | 12775 | ||
12716 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { | 12776 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
12717 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 12777 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
12718 | "trying auto-probe from BIOS...\n", codec->chip_name); | 12778 | codec->chip_name); |
12719 | board_config = ALC268_AUTO; | 12779 | board_config = ALC268_AUTO; |
12720 | } | 12780 | } |
12721 | 12781 | ||
@@ -12734,7 +12794,7 @@ static int patch_alc268(struct hda_codec *codec) | |||
12734 | } | 12794 | } |
12735 | 12795 | ||
12736 | if (board_config != ALC268_AUTO) | 12796 | if (board_config != ALC268_AUTO) |
12737 | setup_preset(spec, &alc268_presets[board_config]); | 12797 | setup_preset(codec, &alc268_presets[board_config]); |
12738 | 12798 | ||
12739 | spec->stream_analog_playback = &alc268_pcm_analog_playback; | 12799 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
12740 | spec->stream_analog_capture = &alc268_pcm_analog_capture; | 12800 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
@@ -12771,11 +12831,15 @@ static int patch_alc268(struct hda_codec *codec) | |||
12771 | int i; | 12831 | int i; |
12772 | 12832 | ||
12773 | /* get type */ | 12833 | /* get type */ |
12774 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 12834 | wcap = get_wcaps_type(wcap); |
12775 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | 12835 | if (spec->auto_mic || |
12836 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | ||
12776 | spec->adc_nids = alc268_adc_nids_alt; | 12837 | spec->adc_nids = alc268_adc_nids_alt; |
12777 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | 12838 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
12778 | add_mixer(spec, alc268_capture_alt_mixer); | 12839 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
12840 | add_mixer(spec, alc268_capture_nosrc_mixer); | ||
12841 | else | ||
12842 | add_mixer(spec, alc268_capture_alt_mixer); | ||
12779 | } else { | 12843 | } else { |
12780 | spec->adc_nids = alc268_adc_nids; | 12844 | spec->adc_nids = alc268_adc_nids; |
12781 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | 12845 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
@@ -12786,6 +12850,8 @@ static int patch_alc268(struct hda_codec *codec) | |||
12786 | for (i = 0; i < spec->num_adc_nids; i++) | 12850 | for (i = 0; i < spec->num_adc_nids; i++) |
12787 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | 12851 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
12788 | 0, AC_VERB_SET_CONNECT_SEL, | 12852 | 0, AC_VERB_SET_CONNECT_SEL, |
12853 | i < spec->num_mux_defs ? | ||
12854 | spec->input_mux[i].items[0].index : | ||
12789 | spec->input_mux->items[0].index); | 12855 | spec->input_mux->items[0].index); |
12790 | } | 12856 | } |
12791 | 12857 | ||
@@ -12820,22 +12886,6 @@ static hda_nid_t alc269_capsrc_nids[1] = { | |||
12820 | * not a mux! | 12886 | * not a mux! |
12821 | */ | 12887 | */ |
12822 | 12888 | ||
12823 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { | ||
12824 | .num_items = 2, | ||
12825 | .items = { | ||
12826 | { "i-Mic", 0x5 }, | ||
12827 | { "e-Mic", 0x0 }, | ||
12828 | }, | ||
12829 | }; | ||
12830 | |||
12831 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { | ||
12832 | .num_items = 2, | ||
12833 | .items = { | ||
12834 | { "i-Mic", 0x1 }, | ||
12835 | { "e-Mic", 0x0 }, | ||
12836 | }, | ||
12837 | }; | ||
12838 | |||
12839 | #define alc269_modes alc260_modes | 12889 | #define alc269_modes alc260_modes |
12840 | #define alc269_capture_source alc880_lg_lw_capture_source | 12890 | #define alc269_capture_source alc880_lg_lw_capture_source |
12841 | 12891 | ||
@@ -12997,16 +13047,6 @@ static void alc269_lifebook_speaker_automute(struct hda_codec *codec) | |||
12997 | AC_VERB_SET_PROC_COEF, 0x480); | 13047 | AC_VERB_SET_PROC_COEF, 0x480); |
12998 | } | 13048 | } |
12999 | 13049 | ||
13000 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) | ||
13001 | { | ||
13002 | unsigned int present; | ||
13003 | |||
13004 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
13005 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
13006 | snd_hda_codec_write(codec, 0x23, 0, | ||
13007 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); | ||
13008 | } | ||
13009 | |||
13010 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) | 13050 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
13011 | { | 13051 | { |
13012 | unsigned int present_laptop; | 13052 | unsigned int present_laptop; |
@@ -13033,10 +13073,14 @@ static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) | |||
13033 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, | 13073 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
13034 | unsigned int res) | 13074 | unsigned int res) |
13035 | { | 13075 | { |
13036 | if ((res >> 26) == ALC880_HP_EVENT) | 13076 | switch (res >> 26) { |
13077 | case ALC880_HP_EVENT: | ||
13037 | alc269_quanta_fl1_speaker_automute(codec); | 13078 | alc269_quanta_fl1_speaker_automute(codec); |
13038 | if ((res >> 26) == ALC880_MIC_EVENT) | 13079 | break; |
13039 | alc269_quanta_fl1_mic_automute(codec); | 13080 | case ALC880_MIC_EVENT: |
13081 | alc_mic_automute(codec); | ||
13082 | break; | ||
13083 | } | ||
13040 | } | 13084 | } |
13041 | 13085 | ||
13042 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, | 13086 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
@@ -13048,10 +13092,20 @@ static void alc269_lifebook_unsol_event(struct hda_codec *codec, | |||
13048 | alc269_lifebook_mic_autoswitch(codec); | 13092 | alc269_lifebook_mic_autoswitch(codec); |
13049 | } | 13093 | } |
13050 | 13094 | ||
13095 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) | ||
13096 | { | ||
13097 | struct alc_spec *spec = codec->spec; | ||
13098 | spec->ext_mic.pin = 0x18; | ||
13099 | spec->ext_mic.mux_idx = 0; | ||
13100 | spec->int_mic.pin = 0x19; | ||
13101 | spec->int_mic.mux_idx = 1; | ||
13102 | spec->auto_mic = 1; | ||
13103 | } | ||
13104 | |||
13051 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) | 13105 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
13052 | { | 13106 | { |
13053 | alc269_quanta_fl1_speaker_automute(codec); | 13107 | alc269_quanta_fl1_speaker_automute(codec); |
13054 | alc269_quanta_fl1_mic_automute(codec); | 13108 | alc_mic_automute(codec); |
13055 | } | 13109 | } |
13056 | 13110 | ||
13057 | static void alc269_lifebook_init_hook(struct hda_codec *codec) | 13111 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
@@ -13096,60 +13150,44 @@ static void alc269_speaker_automute(struct hda_codec *codec) | |||
13096 | AMP_IN_MUTE(0), bits); | 13150 | AMP_IN_MUTE(0), bits); |
13097 | } | 13151 | } |
13098 | 13152 | ||
13099 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) | ||
13100 | { | ||
13101 | unsigned int present; | ||
13102 | |||
13103 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
13104 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
13105 | snd_hda_codec_write(codec, 0x23, 0, | ||
13106 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); | ||
13107 | } | ||
13108 | |||
13109 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) | ||
13110 | { | ||
13111 | unsigned int present; | ||
13112 | |||
13113 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
13114 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
13115 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
13116 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
13117 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
13118 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
13119 | } | ||
13120 | |||
13121 | /* unsolicited event for HP jack sensing */ | 13153 | /* unsolicited event for HP jack sensing */ |
13122 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, | 13154 | static void alc269_eeepc_unsol_event(struct hda_codec *codec, |
13123 | unsigned int res) | 13155 | unsigned int res) |
13124 | { | 13156 | { |
13125 | if ((res >> 26) == ALC880_HP_EVENT) | 13157 | switch (res >> 26) { |
13158 | case ALC880_HP_EVENT: | ||
13126 | alc269_speaker_automute(codec); | 13159 | alc269_speaker_automute(codec); |
13127 | 13160 | break; | |
13128 | if ((res >> 26) == ALC880_MIC_EVENT) | 13161 | case ALC880_MIC_EVENT: |
13129 | alc269_eeepc_dmic_automute(codec); | 13162 | alc_mic_automute(codec); |
13163 | break; | ||
13164 | } | ||
13130 | } | 13165 | } |
13131 | 13166 | ||
13132 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) | 13167 | static void alc269_eeepc_dmic_setup(struct hda_codec *codec) |
13133 | { | 13168 | { |
13134 | alc269_speaker_automute(codec); | 13169 | struct alc_spec *spec = codec->spec; |
13135 | alc269_eeepc_dmic_automute(codec); | 13170 | spec->ext_mic.pin = 0x18; |
13171 | spec->ext_mic.mux_idx = 0; | ||
13172 | spec->int_mic.pin = 0x12; | ||
13173 | spec->int_mic.mux_idx = 5; | ||
13174 | spec->auto_mic = 1; | ||
13136 | } | 13175 | } |
13137 | 13176 | ||
13138 | /* unsolicited event for HP jack sensing */ | 13177 | static void alc269_eeepc_amic_setup(struct hda_codec *codec) |
13139 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, | ||
13140 | unsigned int res) | ||
13141 | { | 13178 | { |
13142 | if ((res >> 26) == ALC880_HP_EVENT) | 13179 | struct alc_spec *spec = codec->spec; |
13143 | alc269_speaker_automute(codec); | 13180 | spec->ext_mic.pin = 0x18; |
13144 | 13181 | spec->ext_mic.mux_idx = 0; | |
13145 | if ((res >> 26) == ALC880_MIC_EVENT) | 13182 | spec->int_mic.pin = 0x19; |
13146 | alc269_eeepc_amic_automute(codec); | 13183 | spec->int_mic.mux_idx = 1; |
13184 | spec->auto_mic = 1; | ||
13147 | } | 13185 | } |
13148 | 13186 | ||
13149 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) | 13187 | static void alc269_eeepc_inithook(struct hda_codec *codec) |
13150 | { | 13188 | { |
13151 | alc269_speaker_automute(codec); | 13189 | alc269_speaker_automute(codec); |
13152 | alc269_eeepc_amic_automute(codec); | 13190 | alc_mic_automute(codec); |
13153 | } | 13191 | } |
13154 | 13192 | ||
13155 | /* | 13193 | /* |
@@ -13222,89 +13260,10 @@ static struct hda_verb alc269_init_verbs[] = { | |||
13222 | { } | 13260 | { } |
13223 | }; | 13261 | }; |
13224 | 13262 | ||
13225 | /* add playback controls from the parsed DAC table */ | 13263 | #define alc269_auto_create_multi_out_ctls \ |
13226 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, | 13264 | alc268_auto_create_multi_out_ctls |
13227 | const struct auto_pin_cfg *cfg) | 13265 | #define alc269_auto_create_input_ctls \ |
13228 | { | 13266 | alc268_auto_create_input_ctls |
13229 | hda_nid_t nid; | ||
13230 | int err; | ||
13231 | |||
13232 | spec->multiout.num_dacs = 1; /* only use one dac */ | ||
13233 | spec->multiout.dac_nids = spec->private_dac_nids; | ||
13234 | spec->multiout.dac_nids[0] = 2; | ||
13235 | |||
13236 | nid = cfg->line_out_pins[0]; | ||
13237 | if (nid) { | ||
13238 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
13239 | "Front Playback Volume", | ||
13240 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); | ||
13241 | if (err < 0) | ||
13242 | return err; | ||
13243 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
13244 | "Front Playback Switch", | ||
13245 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | ||
13246 | if (err < 0) | ||
13247 | return err; | ||
13248 | } | ||
13249 | |||
13250 | nid = cfg->speaker_pins[0]; | ||
13251 | if (nid) { | ||
13252 | if (!cfg->line_out_pins[0]) { | ||
13253 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
13254 | "Speaker Playback Volume", | ||
13255 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, | ||
13256 | HDA_OUTPUT)); | ||
13257 | if (err < 0) | ||
13258 | return err; | ||
13259 | } | ||
13260 | if (nid == 0x16) { | ||
13261 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
13262 | "Speaker Playback Switch", | ||
13263 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | ||
13264 | HDA_OUTPUT)); | ||
13265 | if (err < 0) | ||
13266 | return err; | ||
13267 | } else { | ||
13268 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
13269 | "Speaker Playback Switch", | ||
13270 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | ||
13271 | HDA_OUTPUT)); | ||
13272 | if (err < 0) | ||
13273 | return err; | ||
13274 | } | ||
13275 | } | ||
13276 | nid = cfg->hp_pins[0]; | ||
13277 | if (nid) { | ||
13278 | /* spec->multiout.hp_nid = 2; */ | ||
13279 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { | ||
13280 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
13281 | "Headphone Playback Volume", | ||
13282 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, | ||
13283 | HDA_OUTPUT)); | ||
13284 | if (err < 0) | ||
13285 | return err; | ||
13286 | } | ||
13287 | if (nid == 0x16) { | ||
13288 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
13289 | "Headphone Playback Switch", | ||
13290 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | ||
13291 | HDA_OUTPUT)); | ||
13292 | if (err < 0) | ||
13293 | return err; | ||
13294 | } else { | ||
13295 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | ||
13296 | "Headphone Playback Switch", | ||
13297 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | ||
13298 | HDA_OUTPUT)); | ||
13299 | if (err < 0) | ||
13300 | return err; | ||
13301 | } | ||
13302 | } | ||
13303 | return 0; | ||
13304 | } | ||
13305 | |||
13306 | #define alc269_auto_create_analog_input_ctls \ | ||
13307 | alc262_auto_create_analog_input_ctls | ||
13308 | 13267 | ||
13309 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 13268 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
13310 | #define alc269_loopbacks alc880_loopbacks | 13269 | #define alc269_loopbacks alc880_loopbacks |
@@ -13354,7 +13313,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
13354 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); | 13313 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
13355 | if (err < 0) | 13314 | if (err < 0) |
13356 | return err; | 13315 | return err; |
13357 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); | 13316 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
13358 | if (err < 0) | 13317 | if (err < 0) |
13359 | return err; | 13318 | return err; |
13360 | 13319 | ||
@@ -13379,15 +13338,15 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
13379 | return err; | 13338 | return err; |
13380 | 13339 | ||
13381 | if (!spec->cap_mixer && !spec->no_analog) | 13340 | if (!spec->cap_mixer && !spec->no_analog) |
13382 | set_capture_mixer(spec); | 13341 | set_capture_mixer(codec); |
13383 | 13342 | ||
13384 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); | 13343 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
13385 | 13344 | ||
13386 | return 1; | 13345 | return 1; |
13387 | } | 13346 | } |
13388 | 13347 | ||
13389 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out | 13348 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
13390 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out | 13349 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
13391 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input | 13350 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
13392 | 13351 | ||
13393 | 13352 | ||
@@ -13455,6 +13414,7 @@ static struct alc_config_preset alc269_presets[] = { | |||
13455 | .channel_mode = alc269_modes, | 13414 | .channel_mode = alc269_modes, |
13456 | .input_mux = &alc269_capture_source, | 13415 | .input_mux = &alc269_capture_source, |
13457 | .unsol_event = alc269_quanta_fl1_unsol_event, | 13416 | .unsol_event = alc269_quanta_fl1_unsol_event, |
13417 | .setup = alc269_quanta_fl1_setup, | ||
13458 | .init_hook = alc269_quanta_fl1_init_hook, | 13418 | .init_hook = alc269_quanta_fl1_init_hook, |
13459 | }, | 13419 | }, |
13460 | [ALC269_ASUS_EEEPC_P703] = { | 13420 | [ALC269_ASUS_EEEPC_P703] = { |
@@ -13467,9 +13427,9 @@ static struct alc_config_preset alc269_presets[] = { | |||
13467 | .hp_nid = 0x03, | 13427 | .hp_nid = 0x03, |
13468 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | 13428 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
13469 | .channel_mode = alc269_modes, | 13429 | .channel_mode = alc269_modes, |
13470 | .input_mux = &alc269_eeepc_amic_capture_source, | 13430 | .unsol_event = alc269_eeepc_unsol_event, |
13471 | .unsol_event = alc269_eeepc_amic_unsol_event, | 13431 | .setup = alc269_eeepc_amic_setup, |
13472 | .init_hook = alc269_eeepc_amic_inithook, | 13432 | .init_hook = alc269_eeepc_inithook, |
13473 | }, | 13433 | }, |
13474 | [ALC269_ASUS_EEEPC_P901] = { | 13434 | [ALC269_ASUS_EEEPC_P901] = { |
13475 | .mixers = { alc269_eeepc_mixer }, | 13435 | .mixers = { alc269_eeepc_mixer }, |
@@ -13481,9 +13441,9 @@ static struct alc_config_preset alc269_presets[] = { | |||
13481 | .hp_nid = 0x03, | 13441 | .hp_nid = 0x03, |
13482 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | 13442 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
13483 | .channel_mode = alc269_modes, | 13443 | .channel_mode = alc269_modes, |
13484 | .input_mux = &alc269_eeepc_dmic_capture_source, | 13444 | .unsol_event = alc269_eeepc_unsol_event, |
13485 | .unsol_event = alc269_eeepc_dmic_unsol_event, | 13445 | .setup = alc269_eeepc_dmic_setup, |
13486 | .init_hook = alc269_eeepc_dmic_inithook, | 13446 | .init_hook = alc269_eeepc_inithook, |
13487 | }, | 13447 | }, |
13488 | [ALC269_FUJITSU] = { | 13448 | [ALC269_FUJITSU] = { |
13489 | .mixers = { alc269_fujitsu_mixer }, | 13449 | .mixers = { alc269_fujitsu_mixer }, |
@@ -13495,9 +13455,9 @@ static struct alc_config_preset alc269_presets[] = { | |||
13495 | .hp_nid = 0x03, | 13455 | .hp_nid = 0x03, |
13496 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | 13456 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
13497 | .channel_mode = alc269_modes, | 13457 | .channel_mode = alc269_modes, |
13498 | .input_mux = &alc269_eeepc_dmic_capture_source, | 13458 | .unsol_event = alc269_eeepc_unsol_event, |
13499 | .unsol_event = alc269_eeepc_dmic_unsol_event, | 13459 | .setup = alc269_eeepc_dmic_setup, |
13500 | .init_hook = alc269_eeepc_dmic_inithook, | 13460 | .init_hook = alc269_eeepc_inithook, |
13501 | }, | 13461 | }, |
13502 | [ALC269_LIFEBOOK] = { | 13462 | [ALC269_LIFEBOOK] = { |
13503 | .mixers = { alc269_lifebook_mixer }, | 13463 | .mixers = { alc269_lifebook_mixer }, |
@@ -13532,8 +13492,8 @@ static int patch_alc269(struct hda_codec *codec) | |||
13532 | alc269_cfg_tbl); | 13492 | alc269_cfg_tbl); |
13533 | 13493 | ||
13534 | if (board_config < 0) { | 13494 | if (board_config < 0) { |
13535 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 13495 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
13536 | "trying auto-probe from BIOS...\n", codec->chip_name); | 13496 | codec->chip_name); |
13537 | board_config = ALC269_AUTO; | 13497 | board_config = ALC269_AUTO; |
13538 | } | 13498 | } |
13539 | 13499 | ||
@@ -13558,7 +13518,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
13558 | } | 13518 | } |
13559 | 13519 | ||
13560 | if (board_config != ALC269_AUTO) | 13520 | if (board_config != ALC269_AUTO) |
13561 | setup_preset(spec, &alc269_presets[board_config]); | 13521 | setup_preset(codec, &alc269_presets[board_config]); |
13562 | 13522 | ||
13563 | if (codec->subsystem_id == 0x17aa3bf8) { | 13523 | if (codec->subsystem_id == 0x17aa3bf8) { |
13564 | /* Due to a hardware problem on Lenovo Ideadpad, we need to | 13524 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
@@ -13577,7 +13537,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
13577 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | 13537 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
13578 | spec->capsrc_nids = alc269_capsrc_nids; | 13538 | spec->capsrc_nids = alc269_capsrc_nids; |
13579 | if (!spec->cap_mixer) | 13539 | if (!spec->cap_mixer) |
13580 | set_capture_mixer(spec); | 13540 | set_capture_mixer(codec); |
13581 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | 13541 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
13582 | 13542 | ||
13583 | spec->vmaster_nid = 0x02; | 13543 | spec->vmaster_nid = 0x02; |
@@ -14127,23 +14087,23 @@ static struct hda_verb alc861_auto_init_verbs[] = { | |||
14127 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | 14087 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
14128 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | 14088 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
14129 | 14089 | ||
14130 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 14090 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14131 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 14091 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
14132 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 14092 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14133 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 14093 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
14134 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 14094 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14135 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 14095 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
14136 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 14096 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14137 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 14097 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
14138 | 14098 | ||
14139 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 14099 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14140 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 14100 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
14141 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | 14101 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
14142 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | 14102 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
14143 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 14103 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14144 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 14104 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
14145 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | 14105 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
14146 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | 14106 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
14147 | 14107 | ||
14148 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ | 14108 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
14149 | 14109 | ||
@@ -14215,64 +14175,96 @@ static struct hda_input_mux alc861_capture_source = { | |||
14215 | }, | 14175 | }, |
14216 | }; | 14176 | }; |
14217 | 14177 | ||
14178 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | ||
14179 | { | ||
14180 | struct alc_spec *spec = codec->spec; | ||
14181 | hda_nid_t mix, srcs[5]; | ||
14182 | int i, j, num; | ||
14183 | |||
14184 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) | ||
14185 | return 0; | ||
14186 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | ||
14187 | if (num < 0) | ||
14188 | return 0; | ||
14189 | for (i = 0; i < num; i++) { | ||
14190 | unsigned int type; | ||
14191 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); | ||
14192 | if (type != AC_WID_AUD_OUT) | ||
14193 | continue; | ||
14194 | for (j = 0; j < spec->multiout.num_dacs; j++) | ||
14195 | if (spec->multiout.dac_nids[j] == srcs[i]) | ||
14196 | break; | ||
14197 | if (j >= spec->multiout.num_dacs) | ||
14198 | return srcs[i]; | ||
14199 | } | ||
14200 | return 0; | ||
14201 | } | ||
14202 | |||
14218 | /* fill in the dac_nids table from the parsed pin configuration */ | 14203 | /* fill in the dac_nids table from the parsed pin configuration */ |
14219 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, | 14204 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
14220 | const struct auto_pin_cfg *cfg) | 14205 | const struct auto_pin_cfg *cfg) |
14221 | { | 14206 | { |
14207 | struct alc_spec *spec = codec->spec; | ||
14222 | int i; | 14208 | int i; |
14223 | hda_nid_t nid; | 14209 | hda_nid_t nid, dac; |
14224 | 14210 | ||
14225 | spec->multiout.dac_nids = spec->private_dac_nids; | 14211 | spec->multiout.dac_nids = spec->private_dac_nids; |
14226 | for (i = 0; i < cfg->line_outs; i++) { | 14212 | for (i = 0; i < cfg->line_outs; i++) { |
14227 | nid = cfg->line_out_pins[i]; | 14213 | nid = cfg->line_out_pins[i]; |
14228 | if (nid) { | 14214 | dac = alc861_look_for_dac(codec, nid); |
14229 | if (i >= ARRAY_SIZE(alc861_dac_nids)) | 14215 | if (!dac) |
14230 | continue; | 14216 | continue; |
14231 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; | 14217 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
14232 | } | ||
14233 | } | 14218 | } |
14234 | spec->multiout.num_dacs = cfg->line_outs; | ||
14235 | return 0; | 14219 | return 0; |
14236 | } | 14220 | } |
14237 | 14221 | ||
14222 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, | ||
14223 | hda_nid_t nid, unsigned int chs) | ||
14224 | { | ||
14225 | char name[32]; | ||
14226 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); | ||
14227 | return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name, | ||
14228 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | ||
14229 | } | ||
14230 | |||
14238 | /* add playback controls from the parsed DAC table */ | 14231 | /* add playback controls from the parsed DAC table */ |
14239 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, | 14232 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
14240 | const struct auto_pin_cfg *cfg) | 14233 | const struct auto_pin_cfg *cfg) |
14241 | { | 14234 | { |
14242 | char name[32]; | 14235 | struct alc_spec *spec = codec->spec; |
14243 | static const char *chname[4] = { | 14236 | static const char *chname[4] = { |
14244 | "Front", "Surround", NULL /*CLFE*/, "Side" | 14237 | "Front", "Surround", NULL /*CLFE*/, "Side" |
14245 | }; | 14238 | }; |
14246 | hda_nid_t nid; | 14239 | hda_nid_t nid; |
14247 | int i, idx, err; | 14240 | int i, err; |
14241 | |||
14242 | if (cfg->line_outs == 1) { | ||
14243 | const char *pfx = NULL; | ||
14244 | if (!cfg->hp_outs) | ||
14245 | pfx = "Master"; | ||
14246 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
14247 | pfx = "Speaker"; | ||
14248 | if (pfx) { | ||
14249 | nid = spec->multiout.dac_nids[0]; | ||
14250 | return alc861_create_out_sw(codec, pfx, nid, 3); | ||
14251 | } | ||
14252 | } | ||
14248 | 14253 | ||
14249 | for (i = 0; i < cfg->line_outs; i++) { | 14254 | for (i = 0; i < cfg->line_outs; i++) { |
14250 | nid = spec->multiout.dac_nids[i]; | 14255 | nid = spec->multiout.dac_nids[i]; |
14251 | if (!nid) | 14256 | if (!nid) |
14252 | continue; | 14257 | continue; |
14253 | if (nid == 0x05) { | 14258 | if (i == 2) { |
14254 | /* Center/LFE */ | 14259 | /* Center/LFE */ |
14255 | err = add_control(spec, ALC_CTL_BIND_MUTE, | 14260 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
14256 | "Center Playback Switch", | ||
14257 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | ||
14258 | HDA_OUTPUT)); | ||
14259 | if (err < 0) | 14261 | if (err < 0) |
14260 | return err; | 14262 | return err; |
14261 | err = add_control(spec, ALC_CTL_BIND_MUTE, | 14263 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
14262 | "LFE Playback Switch", | ||
14263 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | ||
14264 | HDA_OUTPUT)); | ||
14265 | if (err < 0) | 14264 | if (err < 0) |
14266 | return err; | 14265 | return err; |
14267 | } else { | 14266 | } else { |
14268 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; | 14267 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
14269 | idx++) | ||
14270 | if (nid == alc861_dac_nids[idx]) | ||
14271 | break; | ||
14272 | sprintf(name, "%s Playback Switch", chname[idx]); | ||
14273 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | ||
14274 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | ||
14275 | HDA_OUTPUT)); | ||
14276 | if (err < 0) | 14268 | if (err < 0) |
14277 | return err; | 14269 | return err; |
14278 | } | 14270 | } |
@@ -14280,8 +14272,9 @@ static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
14280 | return 0; | 14272 | return 0; |
14281 | } | 14273 | } |
14282 | 14274 | ||
14283 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) | 14275 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) |
14284 | { | 14276 | { |
14277 | struct alc_spec *spec = codec->spec; | ||
14285 | int err; | 14278 | int err; |
14286 | hda_nid_t nid; | 14279 | hda_nid_t nid; |
14287 | 14280 | ||
@@ -14289,70 +14282,49 @@ static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) | |||
14289 | return 0; | 14282 | return 0; |
14290 | 14283 | ||
14291 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | 14284 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
14292 | nid = 0x03; | 14285 | nid = alc861_look_for_dac(codec, pin); |
14293 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | 14286 | if (nid) { |
14294 | "Headphone Playback Switch", | 14287 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
14295 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | 14288 | if (err < 0) |
14296 | if (err < 0) | 14289 | return err; |
14297 | return err; | 14290 | spec->multiout.hp_nid = nid; |
14298 | spec->multiout.hp_nid = nid; | 14291 | } |
14299 | } | 14292 | } |
14300 | return 0; | 14293 | return 0; |
14301 | } | 14294 | } |
14302 | 14295 | ||
14303 | /* create playback/capture controls for input pins */ | 14296 | /* create playback/capture controls for input pins */ |
14304 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, | 14297 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
14305 | const struct auto_pin_cfg *cfg) | 14298 | const struct auto_pin_cfg *cfg) |
14306 | { | 14299 | { |
14307 | struct hda_input_mux *imux = &spec->private_imux[0]; | 14300 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
14308 | int i, err, idx, idx1; | ||
14309 | |||
14310 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
14311 | switch (cfg->input_pins[i]) { | ||
14312 | case 0x0c: | ||
14313 | idx1 = 1; | ||
14314 | idx = 2; /* Line In */ | ||
14315 | break; | ||
14316 | case 0x0f: | ||
14317 | idx1 = 2; | ||
14318 | idx = 2; /* Line In */ | ||
14319 | break; | ||
14320 | case 0x0d: | ||
14321 | idx1 = 0; | ||
14322 | idx = 1; /* Mic In */ | ||
14323 | break; | ||
14324 | case 0x10: | ||
14325 | idx1 = 3; | ||
14326 | idx = 1; /* Mic In */ | ||
14327 | break; | ||
14328 | case 0x11: | ||
14329 | idx1 = 4; | ||
14330 | idx = 0; /* CD */ | ||
14331 | break; | ||
14332 | default: | ||
14333 | continue; | ||
14334 | } | ||
14335 | |||
14336 | err = new_analog_input(spec, cfg->input_pins[i], | ||
14337 | auto_pin_cfg_labels[i], idx, 0x15); | ||
14338 | if (err < 0) | ||
14339 | return err; | ||
14340 | |||
14341 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; | ||
14342 | imux->items[imux->num_items].index = idx1; | ||
14343 | imux->num_items++; | ||
14344 | } | ||
14345 | return 0; | ||
14346 | } | 14301 | } |
14347 | 14302 | ||
14348 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, | 14303 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
14349 | hda_nid_t nid, | 14304 | hda_nid_t nid, |
14350 | int pin_type, int dac_idx) | 14305 | int pin_type, hda_nid_t dac) |
14351 | { | 14306 | { |
14307 | hda_nid_t mix, srcs[5]; | ||
14308 | int i, num; | ||
14309 | |||
14352 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | 14310 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
14353 | pin_type); | 14311 | pin_type); |
14354 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 14312 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
14355 | AMP_OUT_UNMUTE); | 14313 | AMP_OUT_UNMUTE); |
14314 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) | ||
14315 | return; | ||
14316 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | ||
14317 | if (num < 0) | ||
14318 | return; | ||
14319 | for (i = 0; i < num; i++) { | ||
14320 | unsigned int mute; | ||
14321 | if (srcs[i] == dac || srcs[i] == 0x15) | ||
14322 | mute = AMP_IN_UNMUTE(i); | ||
14323 | else | ||
14324 | mute = AMP_IN_MUTE(i); | ||
14325 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
14326 | mute); | ||
14327 | } | ||
14356 | } | 14328 | } |
14357 | 14329 | ||
14358 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | 14330 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
@@ -14375,12 +14347,13 @@ static void alc861_auto_init_hp_out(struct hda_codec *codec) | |||
14375 | hda_nid_t pin; | 14347 | hda_nid_t pin; |
14376 | 14348 | ||
14377 | pin = spec->autocfg.hp_pins[0]; | 14349 | pin = spec->autocfg.hp_pins[0]; |
14378 | if (pin) /* connect to front */ | 14350 | if (pin) |
14379 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, | 14351 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
14380 | spec->multiout.dac_nids[0]); | 14352 | spec->multiout.hp_nid); |
14381 | pin = spec->autocfg.speaker_pins[0]; | 14353 | pin = spec->autocfg.speaker_pins[0]; |
14382 | if (pin) | 14354 | if (pin) |
14383 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | 14355 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
14356 | spec->multiout.dac_nids[0]); | ||
14384 | } | 14357 | } |
14385 | 14358 | ||
14386 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | 14359 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
@@ -14412,16 +14385,16 @@ static int alc861_parse_auto_config(struct hda_codec *codec) | |||
14412 | if (!spec->autocfg.line_outs) | 14385 | if (!spec->autocfg.line_outs) |
14413 | return 0; /* can't find valid BIOS pin config */ | 14386 | return 0; /* can't find valid BIOS pin config */ |
14414 | 14387 | ||
14415 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); | 14388 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
14416 | if (err < 0) | 14389 | if (err < 0) |
14417 | return err; | 14390 | return err; |
14418 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); | 14391 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
14419 | if (err < 0) | 14392 | if (err < 0) |
14420 | return err; | 14393 | return err; |
14421 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); | 14394 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
14422 | if (err < 0) | 14395 | if (err < 0) |
14423 | return err; | 14396 | return err; |
14424 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); | 14397 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
14425 | if (err < 0) | 14398 | if (err < 0) |
14426 | return err; | 14399 | return err; |
14427 | 14400 | ||
@@ -14440,7 +14413,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec) | |||
14440 | 14413 | ||
14441 | spec->adc_nids = alc861_adc_nids; | 14414 | spec->adc_nids = alc861_adc_nids; |
14442 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | 14415 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
14443 | set_capture_mixer(spec); | 14416 | set_capture_mixer(codec); |
14444 | 14417 | ||
14445 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); | 14418 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
14446 | 14419 | ||
@@ -14633,8 +14606,8 @@ static int patch_alc861(struct hda_codec *codec) | |||
14633 | alc861_cfg_tbl); | 14606 | alc861_cfg_tbl); |
14634 | 14607 | ||
14635 | if (board_config < 0) { | 14608 | if (board_config < 0) { |
14636 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 14609 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
14637 | "trying auto-probe from BIOS...\n", codec->chip_name); | 14610 | codec->chip_name); |
14638 | board_config = ALC861_AUTO; | 14611 | board_config = ALC861_AUTO; |
14639 | } | 14612 | } |
14640 | 14613 | ||
@@ -14659,7 +14632,7 @@ static int patch_alc861(struct hda_codec *codec) | |||
14659 | } | 14632 | } |
14660 | 14633 | ||
14661 | if (board_config != ALC861_AUTO) | 14634 | if (board_config != ALC861_AUTO) |
14662 | setup_preset(spec, &alc861_presets[board_config]); | 14635 | setup_preset(codec, &alc861_presets[board_config]); |
14663 | 14636 | ||
14664 | spec->stream_analog_playback = &alc861_pcm_analog_playback; | 14637 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
14665 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | 14638 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
@@ -15062,12 +15035,15 @@ static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) | |||
15062 | HDA_AMP_MUTE, bits); | 15035 | HDA_AMP_MUTE, bits); |
15063 | } | 15036 | } |
15064 | 15037 | ||
15065 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | 15038 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
15066 | { | 15039 | { |
15067 | struct alc_spec *spec = codec->spec; | 15040 | struct alc_spec *spec = codec->spec; |
15068 | |||
15069 | spec->autocfg.hp_pins[0] = 0x1b; | 15041 | spec->autocfg.hp_pins[0] = 0x1b; |
15070 | spec->autocfg.speaker_pins[0] = 0x14; | 15042 | spec->autocfg.speaker_pins[0] = 0x14; |
15043 | } | ||
15044 | |||
15045 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | ||
15046 | { | ||
15071 | alc_automute_amp(codec); | 15047 | alc_automute_amp(codec); |
15072 | alc861vd_lenovo_mic_automute(codec); | 15048 | alc861vd_lenovo_mic_automute(codec); |
15073 | } | 15049 | } |
@@ -15131,13 +15107,12 @@ static struct hda_verb alc861vd_dallas_verbs[] = { | |||
15131 | }; | 15107 | }; |
15132 | 15108 | ||
15133 | /* toggle speaker-output according to the hp-jack state */ | 15109 | /* toggle speaker-output according to the hp-jack state */ |
15134 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) | 15110 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
15135 | { | 15111 | { |
15136 | struct alc_spec *spec = codec->spec; | 15112 | struct alc_spec *spec = codec->spec; |
15137 | 15113 | ||
15138 | spec->autocfg.hp_pins[0] = 0x15; | 15114 | spec->autocfg.hp_pins[0] = 0x15; |
15139 | spec->autocfg.speaker_pins[0] = 0x14; | 15115 | spec->autocfg.speaker_pins[0] = 0x14; |
15140 | alc_automute_amp(codec); | ||
15141 | } | 15116 | } |
15142 | 15117 | ||
15143 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 15118 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -15251,6 +15226,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15251 | .channel_mode = alc861vd_3stack_2ch_modes, | 15226 | .channel_mode = alc861vd_3stack_2ch_modes, |
15252 | .input_mux = &alc861vd_capture_source, | 15227 | .input_mux = &alc861vd_capture_source, |
15253 | .unsol_event = alc861vd_lenovo_unsol_event, | 15228 | .unsol_event = alc861vd_lenovo_unsol_event, |
15229 | .setup = alc861vd_lenovo_setup, | ||
15254 | .init_hook = alc861vd_lenovo_init_hook, | 15230 | .init_hook = alc861vd_lenovo_init_hook, |
15255 | }, | 15231 | }, |
15256 | [ALC861VD_DALLAS] = { | 15232 | [ALC861VD_DALLAS] = { |
@@ -15262,7 +15238,8 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15262 | .channel_mode = alc861vd_3stack_2ch_modes, | 15238 | .channel_mode = alc861vd_3stack_2ch_modes, |
15263 | .input_mux = &alc861vd_dallas_capture_source, | 15239 | .input_mux = &alc861vd_dallas_capture_source, |
15264 | .unsol_event = alc_automute_amp_unsol_event, | 15240 | .unsol_event = alc_automute_amp_unsol_event, |
15265 | .init_hook = alc861vd_dallas_init_hook, | 15241 | .setup = alc861vd_dallas_setup, |
15242 | .init_hook = alc_automute_amp, | ||
15266 | }, | 15243 | }, |
15267 | [ALC861VD_HP] = { | 15244 | [ALC861VD_HP] = { |
15268 | .mixers = { alc861vd_hp_mixer }, | 15245 | .mixers = { alc861vd_hp_mixer }, |
@@ -15274,7 +15251,8 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15274 | .channel_mode = alc861vd_3stack_2ch_modes, | 15251 | .channel_mode = alc861vd_3stack_2ch_modes, |
15275 | .input_mux = &alc861vd_hp_capture_source, | 15252 | .input_mux = &alc861vd_hp_capture_source, |
15276 | .unsol_event = alc_automute_amp_unsol_event, | 15253 | .unsol_event = alc_automute_amp_unsol_event, |
15277 | .init_hook = alc861vd_dallas_init_hook, | 15254 | .setup = alc861vd_dallas_setup, |
15255 | .init_hook = alc_automute_amp, | ||
15278 | }, | 15256 | }, |
15279 | [ALC660VD_ASUS_V1S] = { | 15257 | [ALC660VD_ASUS_V1S] = { |
15280 | .mixers = { alc861vd_lenovo_mixer }, | 15258 | .mixers = { alc861vd_lenovo_mixer }, |
@@ -15289,6 +15267,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15289 | .channel_mode = alc861vd_3stack_2ch_modes, | 15267 | .channel_mode = alc861vd_3stack_2ch_modes, |
15290 | .input_mux = &alc861vd_capture_source, | 15268 | .input_mux = &alc861vd_capture_source, |
15291 | .unsol_event = alc861vd_lenovo_unsol_event, | 15269 | .unsol_event = alc861vd_lenovo_unsol_event, |
15270 | .setup = alc861vd_lenovo_setup, | ||
15292 | .init_hook = alc861vd_lenovo_init_hook, | 15271 | .init_hook = alc861vd_lenovo_init_hook, |
15293 | }, | 15272 | }, |
15294 | }; | 15273 | }; |
@@ -15296,6 +15275,13 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15296 | /* | 15275 | /* |
15297 | * BIOS auto configuration | 15276 | * BIOS auto configuration |
15298 | */ | 15277 | */ |
15278 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, | ||
15279 | const struct auto_pin_cfg *cfg) | ||
15280 | { | ||
15281 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); | ||
15282 | } | ||
15283 | |||
15284 | |||
15299 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, | 15285 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
15300 | hda_nid_t nid, int pin_type, int dac_idx) | 15286 | hda_nid_t nid, int pin_type, int dac_idx) |
15301 | { | 15287 | { |
@@ -15330,7 +15316,6 @@ static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | |||
15330 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | 15316 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
15331 | } | 15317 | } |
15332 | 15318 | ||
15333 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) | ||
15334 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID | 15319 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
15335 | 15320 | ||
15336 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | 15321 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
@@ -15340,7 +15325,7 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |||
15340 | 15325 | ||
15341 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 15326 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
15342 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 15327 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
15343 | if (alc861vd_is_input_pin(nid)) { | 15328 | if (alc_is_input_pin(codec, nid)) { |
15344 | alc_set_input_pin(codec, nid, i); | 15329 | alc_set_input_pin(codec, nid, i); |
15345 | if (nid != ALC861VD_PIN_CD_NID && | 15330 | if (nid != ALC861VD_PIN_CD_NID && |
15346 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | 15331 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
@@ -15404,13 +15389,25 @@ static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
15404 | if (err < 0) | 15389 | if (err < 0) |
15405 | return err; | 15390 | return err; |
15406 | } else { | 15391 | } else { |
15407 | sprintf(name, "%s Playback Volume", chname[i]); | 15392 | const char *pfx; |
15393 | if (cfg->line_outs == 1 && | ||
15394 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | ||
15395 | if (!cfg->hp_pins) | ||
15396 | pfx = "Speaker"; | ||
15397 | else | ||
15398 | pfx = "PCM"; | ||
15399 | } else | ||
15400 | pfx = chname[i]; | ||
15401 | sprintf(name, "%s Playback Volume", pfx); | ||
15408 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | 15402 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
15409 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, | 15403 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
15410 | HDA_OUTPUT)); | 15404 | HDA_OUTPUT)); |
15411 | if (err < 0) | 15405 | if (err < 0) |
15412 | return err; | 15406 | return err; |
15413 | sprintf(name, "%s Playback Switch", chname[i]); | 15407 | if (cfg->line_outs == 1 && |
15408 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
15409 | pfx = "Speaker"; | ||
15410 | sprintf(name, "%s Playback Switch", pfx); | ||
15414 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | 15411 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
15415 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, | 15412 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
15416 | HDA_INPUT)); | 15413 | HDA_INPUT)); |
@@ -15503,7 +15500,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) | |||
15503 | "Headphone"); | 15500 | "Headphone"); |
15504 | if (err < 0) | 15501 | if (err < 0) |
15505 | return err; | 15502 | return err; |
15506 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); | 15503 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
15507 | if (err < 0) | 15504 | if (err < 0) |
15508 | return err; | 15505 | return err; |
15509 | 15506 | ||
@@ -15557,8 +15554,8 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
15557 | alc861vd_cfg_tbl); | 15554 | alc861vd_cfg_tbl); |
15558 | 15555 | ||
15559 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { | 15556 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
15560 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 15557 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
15561 | "trying auto-probe from BIOS...\n", codec->chip_name); | 15558 | codec->chip_name); |
15562 | board_config = ALC861VD_AUTO; | 15559 | board_config = ALC861VD_AUTO; |
15563 | } | 15560 | } |
15564 | 15561 | ||
@@ -15583,7 +15580,7 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
15583 | } | 15580 | } |
15584 | 15581 | ||
15585 | if (board_config != ALC861VD_AUTO) | 15582 | if (board_config != ALC861VD_AUTO) |
15586 | setup_preset(spec, &alc861vd_presets[board_config]); | 15583 | setup_preset(codec, &alc861vd_presets[board_config]); |
15587 | 15584 | ||
15588 | if (codec->vendor_id == 0x10ec0660) { | 15585 | if (codec->vendor_id == 0x10ec0660) { |
15589 | /* always turn on EAPD */ | 15586 | /* always turn on EAPD */ |
@@ -15603,7 +15600,7 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
15603 | if (!spec->capsrc_nids) | 15600 | if (!spec->capsrc_nids) |
15604 | spec->capsrc_nids = alc861vd_capsrc_nids; | 15601 | spec->capsrc_nids = alc861vd_capsrc_nids; |
15605 | 15602 | ||
15606 | set_capture_mixer(spec); | 15603 | set_capture_mixer(codec); |
15607 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 15604 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
15608 | 15605 | ||
15609 | spec->vmaster_nid = 0x02; | 15606 | spec->vmaster_nid = 0x02; |
@@ -15644,9 +15641,9 @@ static hda_nid_t alc272_dac_nids[2] = { | |||
15644 | 0x02, 0x03 | 15641 | 0x02, 0x03 |
15645 | }; | 15642 | }; |
15646 | 15643 | ||
15647 | static hda_nid_t alc662_adc_nids[1] = { | 15644 | static hda_nid_t alc662_adc_nids[2] = { |
15648 | /* ADC1-2 */ | 15645 | /* ADC1-2 */ |
15649 | 0x09, | 15646 | 0x09, 0x08 |
15650 | }; | 15647 | }; |
15651 | 15648 | ||
15652 | static hda_nid_t alc272_adc_nids[1] = { | 15649 | static hda_nid_t alc272_adc_nids[1] = { |
@@ -15654,7 +15651,7 @@ static hda_nid_t alc272_adc_nids[1] = { | |||
15654 | 0x08, | 15651 | 0x08, |
15655 | }; | 15652 | }; |
15656 | 15653 | ||
15657 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; | 15654 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
15658 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; | 15655 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
15659 | 15656 | ||
15660 | 15657 | ||
@@ -15678,14 +15675,6 @@ static struct hda_input_mux alc662_lenovo_101e_capture_source = { | |||
15678 | }, | 15675 | }, |
15679 | }; | 15676 | }; |
15680 | 15677 | ||
15681 | static struct hda_input_mux alc662_eeepc_capture_source = { | ||
15682 | .num_items = 2, | ||
15683 | .items = { | ||
15684 | { "i-Mic", 0x1 }, | ||
15685 | { "e-Mic", 0x0 }, | ||
15686 | }, | ||
15687 | }; | ||
15688 | |||
15689 | static struct hda_input_mux alc663_capture_source = { | 15678 | static struct hda_input_mux alc663_capture_source = { |
15690 | .num_items = 3, | 15679 | .num_items = 3, |
15691 | .items = { | 15680 | .items = { |
@@ -15695,23 +15684,7 @@ static struct hda_input_mux alc663_capture_source = { | |||
15695 | }, | 15684 | }, |
15696 | }; | 15685 | }; |
15697 | 15686 | ||
15698 | static struct hda_input_mux alc663_m51va_capture_source = { | 15687 | #if 0 /* set to 1 for testing other input sources below */ |
15699 | .num_items = 2, | ||
15700 | .items = { | ||
15701 | { "Ext-Mic", 0x0 }, | ||
15702 | { "D-Mic", 0x9 }, | ||
15703 | }, | ||
15704 | }; | ||
15705 | |||
15706 | #if 1 /* set to 0 for testing other input sources below */ | ||
15707 | static struct hda_input_mux alc272_nc10_capture_source = { | ||
15708 | .num_items = 2, | ||
15709 | .items = { | ||
15710 | { "Autoselect Mic", 0x0 }, | ||
15711 | { "Internal Mic", 0x1 }, | ||
15712 | }, | ||
15713 | }; | ||
15714 | #else | ||
15715 | static struct hda_input_mux alc272_nc10_capture_source = { | 15688 | static struct hda_input_mux alc272_nc10_capture_source = { |
15716 | .num_items = 16, | 15689 | .num_items = 16, |
15717 | .items = { | 15690 | .items = { |
@@ -16380,47 +16353,44 @@ static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | |||
16380 | alc662_lenovo_101e_ispeaker_automute(codec); | 16353 | alc662_lenovo_101e_ispeaker_automute(codec); |
16381 | } | 16354 | } |
16382 | 16355 | ||
16383 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) | ||
16384 | { | ||
16385 | unsigned int present; | ||
16386 | |||
16387 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
16388 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
16389 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16390 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
16391 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16392 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
16393 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16394 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
16395 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16396 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
16397 | } | ||
16398 | |||
16399 | /* unsolicited event for HP jack sensing */ | 16356 | /* unsolicited event for HP jack sensing */ |
16400 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | 16357 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
16401 | unsigned int res) | 16358 | unsigned int res) |
16402 | { | 16359 | { |
16403 | if ((res >> 26) == ALC880_MIC_EVENT) | 16360 | if ((res >> 26) == ALC880_MIC_EVENT) |
16404 | alc662_eeepc_mic_automute(codec); | 16361 | alc_mic_automute(codec); |
16405 | else | 16362 | else |
16406 | alc262_hippo_unsol_event(codec, res); | 16363 | alc262_hippo_unsol_event(codec, res); |
16407 | } | 16364 | } |
16408 | 16365 | ||
16366 | static void alc662_eeepc_setup(struct hda_codec *codec) | ||
16367 | { | ||
16368 | struct alc_spec *spec = codec->spec; | ||
16369 | |||
16370 | alc262_hippo1_setup(codec); | ||
16371 | spec->ext_mic.pin = 0x18; | ||
16372 | spec->ext_mic.mux_idx = 0; | ||
16373 | spec->int_mic.pin = 0x19; | ||
16374 | spec->int_mic.mux_idx = 1; | ||
16375 | spec->auto_mic = 1; | ||
16376 | } | ||
16377 | |||
16409 | static void alc662_eeepc_inithook(struct hda_codec *codec) | 16378 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
16410 | { | 16379 | { |
16411 | alc262_hippo1_init_hook(codec); | 16380 | alc262_hippo_automute(codec); |
16412 | alc662_eeepc_mic_automute(codec); | 16381 | alc_mic_automute(codec); |
16413 | } | 16382 | } |
16414 | 16383 | ||
16415 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) | 16384 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
16416 | { | 16385 | { |
16417 | struct alc_spec *spec = codec->spec; | 16386 | struct alc_spec *spec = codec->spec; |
16418 | 16387 | ||
16419 | spec->autocfg.hp_pins[0] = 0x14; | 16388 | spec->autocfg.hp_pins[0] = 0x14; |
16420 | spec->autocfg.speaker_pins[0] = 0x1b; | 16389 | spec->autocfg.speaker_pins[0] = 0x1b; |
16421 | alc262_hippo_master_update(codec); | ||
16422 | } | 16390 | } |
16423 | 16391 | ||
16392 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update | ||
16393 | |||
16424 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) | 16394 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
16425 | { | 16395 | { |
16426 | unsigned int present; | 16396 | unsigned int present; |
@@ -16531,23 +16501,6 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |||
16531 | } | 16501 | } |
16532 | } | 16502 | } |
16533 | 16503 | ||
16534 | static void alc663_m51va_mic_automute(struct hda_codec *codec) | ||
16535 | { | ||
16536 | unsigned int present; | ||
16537 | |||
16538 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
16539 | AC_VERB_GET_PIN_SENSE, 0) | ||
16540 | & AC_PINSENSE_PRESENCE; | ||
16541 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16542 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
16543 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16544 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
16545 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16546 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); | ||
16547 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
16548 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); | ||
16549 | } | ||
16550 | |||
16551 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | 16504 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
16552 | unsigned int res) | 16505 | unsigned int res) |
16553 | { | 16506 | { |
@@ -16556,36 +16509,32 @@ static void alc663_m51va_unsol_event(struct hda_codec *codec, | |||
16556 | alc663_m51va_speaker_automute(codec); | 16509 | alc663_m51va_speaker_automute(codec); |
16557 | break; | 16510 | break; |
16558 | case ALC880_MIC_EVENT: | 16511 | case ALC880_MIC_EVENT: |
16559 | alc663_m51va_mic_automute(codec); | 16512 | alc_mic_automute(codec); |
16560 | break; | 16513 | break; |
16561 | } | 16514 | } |
16562 | } | 16515 | } |
16563 | 16516 | ||
16517 | static void alc663_m51va_setup(struct hda_codec *codec) | ||
16518 | { | ||
16519 | struct alc_spec *spec = codec->spec; | ||
16520 | spec->ext_mic.pin = 0x18; | ||
16521 | spec->ext_mic.mux_idx = 0; | ||
16522 | spec->int_mic.pin = 0x12; | ||
16523 | spec->int_mic.mux_idx = 1; | ||
16524 | spec->auto_mic = 1; | ||
16525 | } | ||
16526 | |||
16564 | static void alc663_m51va_inithook(struct hda_codec *codec) | 16527 | static void alc663_m51va_inithook(struct hda_codec *codec) |
16565 | { | 16528 | { |
16566 | alc663_m51va_speaker_automute(codec); | 16529 | alc663_m51va_speaker_automute(codec); |
16567 | alc663_m51va_mic_automute(codec); | 16530 | alc_mic_automute(codec); |
16568 | } | 16531 | } |
16569 | 16532 | ||
16570 | /* ***************** Mode1 ******************************/ | 16533 | /* ***************** Mode1 ******************************/ |
16571 | static void alc663_mode1_unsol_event(struct hda_codec *codec, | 16534 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
16572 | unsigned int res) | 16535 | #define alc663_mode1_setup alc663_m51va_setup |
16573 | { | 16536 | #define alc663_mode1_inithook alc663_m51va_inithook |
16574 | switch (res >> 26) { | ||
16575 | case ALC880_HP_EVENT: | ||
16576 | alc663_m51va_speaker_automute(codec); | ||
16577 | break; | ||
16578 | case ALC880_MIC_EVENT: | ||
16579 | alc662_eeepc_mic_automute(codec); | ||
16580 | break; | ||
16581 | } | ||
16582 | } | ||
16583 | 16537 | ||
16584 | static void alc663_mode1_inithook(struct hda_codec *codec) | ||
16585 | { | ||
16586 | alc663_m51va_speaker_automute(codec); | ||
16587 | alc662_eeepc_mic_automute(codec); | ||
16588 | } | ||
16589 | /* ***************** Mode2 ******************************/ | 16538 | /* ***************** Mode2 ******************************/ |
16590 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | 16539 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
16591 | unsigned int res) | 16540 | unsigned int res) |
@@ -16595,15 +16544,17 @@ static void alc662_mode2_unsol_event(struct hda_codec *codec, | |||
16595 | alc662_f5z_speaker_automute(codec); | 16544 | alc662_f5z_speaker_automute(codec); |
16596 | break; | 16545 | break; |
16597 | case ALC880_MIC_EVENT: | 16546 | case ALC880_MIC_EVENT: |
16598 | alc662_eeepc_mic_automute(codec); | 16547 | alc_mic_automute(codec); |
16599 | break; | 16548 | break; |
16600 | } | 16549 | } |
16601 | } | 16550 | } |
16602 | 16551 | ||
16552 | #define alc662_mode2_setup alc663_m51va_setup | ||
16553 | |||
16603 | static void alc662_mode2_inithook(struct hda_codec *codec) | 16554 | static void alc662_mode2_inithook(struct hda_codec *codec) |
16604 | { | 16555 | { |
16605 | alc662_f5z_speaker_automute(codec); | 16556 | alc662_f5z_speaker_automute(codec); |
16606 | alc662_eeepc_mic_automute(codec); | 16557 | alc_mic_automute(codec); |
16607 | } | 16558 | } |
16608 | /* ***************** Mode3 ******************************/ | 16559 | /* ***************** Mode3 ******************************/ |
16609 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | 16560 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
@@ -16614,15 +16565,17 @@ static void alc663_mode3_unsol_event(struct hda_codec *codec, | |||
16614 | alc663_two_hp_m1_speaker_automute(codec); | 16565 | alc663_two_hp_m1_speaker_automute(codec); |
16615 | break; | 16566 | break; |
16616 | case ALC880_MIC_EVENT: | 16567 | case ALC880_MIC_EVENT: |
16617 | alc662_eeepc_mic_automute(codec); | 16568 | alc_mic_automute(codec); |
16618 | break; | 16569 | break; |
16619 | } | 16570 | } |
16620 | } | 16571 | } |
16621 | 16572 | ||
16573 | #define alc663_mode3_setup alc663_m51va_setup | ||
16574 | |||
16622 | static void alc663_mode3_inithook(struct hda_codec *codec) | 16575 | static void alc663_mode3_inithook(struct hda_codec *codec) |
16623 | { | 16576 | { |
16624 | alc663_two_hp_m1_speaker_automute(codec); | 16577 | alc663_two_hp_m1_speaker_automute(codec); |
16625 | alc662_eeepc_mic_automute(codec); | 16578 | alc_mic_automute(codec); |
16626 | } | 16579 | } |
16627 | /* ***************** Mode4 ******************************/ | 16580 | /* ***************** Mode4 ******************************/ |
16628 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | 16581 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
@@ -16633,15 +16586,17 @@ static void alc663_mode4_unsol_event(struct hda_codec *codec, | |||
16633 | alc663_21jd_two_speaker_automute(codec); | 16586 | alc663_21jd_two_speaker_automute(codec); |
16634 | break; | 16587 | break; |
16635 | case ALC880_MIC_EVENT: | 16588 | case ALC880_MIC_EVENT: |
16636 | alc662_eeepc_mic_automute(codec); | 16589 | alc_mic_automute(codec); |
16637 | break; | 16590 | break; |
16638 | } | 16591 | } |
16639 | } | 16592 | } |
16640 | 16593 | ||
16594 | #define alc663_mode4_setup alc663_m51va_setup | ||
16595 | |||
16641 | static void alc663_mode4_inithook(struct hda_codec *codec) | 16596 | static void alc663_mode4_inithook(struct hda_codec *codec) |
16642 | { | 16597 | { |
16643 | alc663_21jd_two_speaker_automute(codec); | 16598 | alc663_21jd_two_speaker_automute(codec); |
16644 | alc662_eeepc_mic_automute(codec); | 16599 | alc_mic_automute(codec); |
16645 | } | 16600 | } |
16646 | /* ***************** Mode5 ******************************/ | 16601 | /* ***************** Mode5 ******************************/ |
16647 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | 16602 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
@@ -16652,15 +16607,17 @@ static void alc663_mode5_unsol_event(struct hda_codec *codec, | |||
16652 | alc663_15jd_two_speaker_automute(codec); | 16607 | alc663_15jd_two_speaker_automute(codec); |
16653 | break; | 16608 | break; |
16654 | case ALC880_MIC_EVENT: | 16609 | case ALC880_MIC_EVENT: |
16655 | alc662_eeepc_mic_automute(codec); | 16610 | alc_mic_automute(codec); |
16656 | break; | 16611 | break; |
16657 | } | 16612 | } |
16658 | } | 16613 | } |
16659 | 16614 | ||
16615 | #define alc663_mode5_setup alc663_m51va_setup | ||
16616 | |||
16660 | static void alc663_mode5_inithook(struct hda_codec *codec) | 16617 | static void alc663_mode5_inithook(struct hda_codec *codec) |
16661 | { | 16618 | { |
16662 | alc663_15jd_two_speaker_automute(codec); | 16619 | alc663_15jd_two_speaker_automute(codec); |
16663 | alc662_eeepc_mic_automute(codec); | 16620 | alc_mic_automute(codec); |
16664 | } | 16621 | } |
16665 | /* ***************** Mode6 ******************************/ | 16622 | /* ***************** Mode6 ******************************/ |
16666 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | 16623 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
@@ -16671,15 +16628,17 @@ static void alc663_mode6_unsol_event(struct hda_codec *codec, | |||
16671 | alc663_two_hp_m2_speaker_automute(codec); | 16628 | alc663_two_hp_m2_speaker_automute(codec); |
16672 | break; | 16629 | break; |
16673 | case ALC880_MIC_EVENT: | 16630 | case ALC880_MIC_EVENT: |
16674 | alc662_eeepc_mic_automute(codec); | 16631 | alc_mic_automute(codec); |
16675 | break; | 16632 | break; |
16676 | } | 16633 | } |
16677 | } | 16634 | } |
16678 | 16635 | ||
16636 | #define alc663_mode6_setup alc663_m51va_setup | ||
16637 | |||
16679 | static void alc663_mode6_inithook(struct hda_codec *codec) | 16638 | static void alc663_mode6_inithook(struct hda_codec *codec) |
16680 | { | 16639 | { |
16681 | alc663_two_hp_m2_speaker_automute(codec); | 16640 | alc663_two_hp_m2_speaker_automute(codec); |
16682 | alc662_eeepc_mic_automute(codec); | 16641 | alc_mic_automute(codec); |
16683 | } | 16642 | } |
16684 | 16643 | ||
16685 | static void alc663_g71v_hp_automute(struct hda_codec *codec) | 16644 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
@@ -16721,16 +16680,18 @@ static void alc663_g71v_unsol_event(struct hda_codec *codec, | |||
16721 | alc663_g71v_front_automute(codec); | 16680 | alc663_g71v_front_automute(codec); |
16722 | break; | 16681 | break; |
16723 | case ALC880_MIC_EVENT: | 16682 | case ALC880_MIC_EVENT: |
16724 | alc662_eeepc_mic_automute(codec); | 16683 | alc_mic_automute(codec); |
16725 | break; | 16684 | break; |
16726 | } | 16685 | } |
16727 | } | 16686 | } |
16728 | 16687 | ||
16688 | #define alc663_g71v_setup alc663_m51va_setup | ||
16689 | |||
16729 | static void alc663_g71v_inithook(struct hda_codec *codec) | 16690 | static void alc663_g71v_inithook(struct hda_codec *codec) |
16730 | { | 16691 | { |
16731 | alc663_g71v_front_automute(codec); | 16692 | alc663_g71v_front_automute(codec); |
16732 | alc663_g71v_hp_automute(codec); | 16693 | alc663_g71v_hp_automute(codec); |
16733 | alc662_eeepc_mic_automute(codec); | 16694 | alc_mic_automute(codec); |
16734 | } | 16695 | } |
16735 | 16696 | ||
16736 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | 16697 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
@@ -16741,15 +16702,17 @@ static void alc663_g50v_unsol_event(struct hda_codec *codec, | |||
16741 | alc663_m51va_speaker_automute(codec); | 16702 | alc663_m51va_speaker_automute(codec); |
16742 | break; | 16703 | break; |
16743 | case ALC880_MIC_EVENT: | 16704 | case ALC880_MIC_EVENT: |
16744 | alc662_eeepc_mic_automute(codec); | 16705 | alc_mic_automute(codec); |
16745 | break; | 16706 | break; |
16746 | } | 16707 | } |
16747 | } | 16708 | } |
16748 | 16709 | ||
16710 | #define alc663_g50v_setup alc663_m51va_setup | ||
16711 | |||
16749 | static void alc663_g50v_inithook(struct hda_codec *codec) | 16712 | static void alc663_g50v_inithook(struct hda_codec *codec) |
16750 | { | 16713 | { |
16751 | alc663_m51va_speaker_automute(codec); | 16714 | alc663_m51va_speaker_automute(codec); |
16752 | alc662_eeepc_mic_automute(codec); | 16715 | alc_mic_automute(codec); |
16753 | } | 16716 | } |
16754 | 16717 | ||
16755 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { | 16718 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
@@ -16953,8 +16916,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
16953 | .dac_nids = alc662_dac_nids, | 16916 | .dac_nids = alc662_dac_nids, |
16954 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16917 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
16955 | .channel_mode = alc662_3ST_2ch_modes, | 16918 | .channel_mode = alc662_3ST_2ch_modes, |
16956 | .input_mux = &alc662_eeepc_capture_source, | ||
16957 | .unsol_event = alc662_eeepc_unsol_event, | 16919 | .unsol_event = alc662_eeepc_unsol_event, |
16920 | .setup = alc662_eeepc_setup, | ||
16958 | .init_hook = alc662_eeepc_inithook, | 16921 | .init_hook = alc662_eeepc_inithook, |
16959 | }, | 16922 | }, |
16960 | [ALC662_ASUS_EEEPC_EP20] = { | 16923 | [ALC662_ASUS_EEEPC_EP20] = { |
@@ -16968,6 +16931,7 @@ static struct alc_config_preset alc662_presets[] = { | |||
16968 | .channel_mode = alc662_3ST_6ch_modes, | 16931 | .channel_mode = alc662_3ST_6ch_modes, |
16969 | .input_mux = &alc662_lenovo_101e_capture_source, | 16932 | .input_mux = &alc662_lenovo_101e_capture_source, |
16970 | .unsol_event = alc662_eeepc_unsol_event, | 16933 | .unsol_event = alc662_eeepc_unsol_event, |
16934 | .setup = alc662_eeepc_ep20_setup, | ||
16971 | .init_hook = alc662_eeepc_ep20_inithook, | 16935 | .init_hook = alc662_eeepc_ep20_inithook, |
16972 | }, | 16936 | }, |
16973 | [ALC662_ECS] = { | 16937 | [ALC662_ECS] = { |
@@ -16978,8 +16942,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
16978 | .dac_nids = alc662_dac_nids, | 16942 | .dac_nids = alc662_dac_nids, |
16979 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16943 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
16980 | .channel_mode = alc662_3ST_2ch_modes, | 16944 | .channel_mode = alc662_3ST_2ch_modes, |
16981 | .input_mux = &alc662_eeepc_capture_source, | ||
16982 | .unsol_event = alc662_eeepc_unsol_event, | 16945 | .unsol_event = alc662_eeepc_unsol_event, |
16946 | .setup = alc662_eeepc_setup, | ||
16983 | .init_hook = alc662_eeepc_inithook, | 16947 | .init_hook = alc662_eeepc_inithook, |
16984 | }, | 16948 | }, |
16985 | [ALC663_ASUS_M51VA] = { | 16949 | [ALC663_ASUS_M51VA] = { |
@@ -16990,8 +16954,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
16990 | .dig_out_nid = ALC662_DIGOUT_NID, | 16954 | .dig_out_nid = ALC662_DIGOUT_NID, |
16991 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16955 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
16992 | .channel_mode = alc662_3ST_2ch_modes, | 16956 | .channel_mode = alc662_3ST_2ch_modes, |
16993 | .input_mux = &alc663_m51va_capture_source, | ||
16994 | .unsol_event = alc663_m51va_unsol_event, | 16957 | .unsol_event = alc663_m51va_unsol_event, |
16958 | .setup = alc663_m51va_setup, | ||
16995 | .init_hook = alc663_m51va_inithook, | 16959 | .init_hook = alc663_m51va_inithook, |
16996 | }, | 16960 | }, |
16997 | [ALC663_ASUS_G71V] = { | 16961 | [ALC663_ASUS_G71V] = { |
@@ -17002,8 +16966,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17002 | .dig_out_nid = ALC662_DIGOUT_NID, | 16966 | .dig_out_nid = ALC662_DIGOUT_NID, |
17003 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16967 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17004 | .channel_mode = alc662_3ST_2ch_modes, | 16968 | .channel_mode = alc662_3ST_2ch_modes, |
17005 | .input_mux = &alc662_eeepc_capture_source, | ||
17006 | .unsol_event = alc663_g71v_unsol_event, | 16969 | .unsol_event = alc663_g71v_unsol_event, |
16970 | .setup = alc663_g71v_setup, | ||
17007 | .init_hook = alc663_g71v_inithook, | 16971 | .init_hook = alc663_g71v_inithook, |
17008 | }, | 16972 | }, |
17009 | [ALC663_ASUS_H13] = { | 16973 | [ALC663_ASUS_H13] = { |
@@ -17013,7 +16977,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
17013 | .dac_nids = alc662_dac_nids, | 16977 | .dac_nids = alc662_dac_nids, |
17014 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 16978 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17015 | .channel_mode = alc662_3ST_2ch_modes, | 16979 | .channel_mode = alc662_3ST_2ch_modes, |
17016 | .input_mux = &alc663_m51va_capture_source, | ||
17017 | .unsol_event = alc663_m51va_unsol_event, | 16980 | .unsol_event = alc663_m51va_unsol_event, |
17018 | .init_hook = alc663_m51va_inithook, | 16981 | .init_hook = alc663_m51va_inithook, |
17019 | }, | 16982 | }, |
@@ -17027,6 +16990,7 @@ static struct alc_config_preset alc662_presets[] = { | |||
17027 | .channel_mode = alc662_3ST_6ch_modes, | 16990 | .channel_mode = alc662_3ST_6ch_modes, |
17028 | .input_mux = &alc663_capture_source, | 16991 | .input_mux = &alc663_capture_source, |
17029 | .unsol_event = alc663_g50v_unsol_event, | 16992 | .unsol_event = alc663_g50v_unsol_event, |
16993 | .setup = alc663_g50v_setup, | ||
17030 | .init_hook = alc663_g50v_inithook, | 16994 | .init_hook = alc663_g50v_inithook, |
17031 | }, | 16995 | }, |
17032 | [ALC663_ASUS_MODE1] = { | 16996 | [ALC663_ASUS_MODE1] = { |
@@ -17040,8 +17004,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17040 | .dig_out_nid = ALC662_DIGOUT_NID, | 17004 | .dig_out_nid = ALC662_DIGOUT_NID, |
17041 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17005 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17042 | .channel_mode = alc662_3ST_2ch_modes, | 17006 | .channel_mode = alc662_3ST_2ch_modes, |
17043 | .input_mux = &alc662_eeepc_capture_source, | ||
17044 | .unsol_event = alc663_mode1_unsol_event, | 17007 | .unsol_event = alc663_mode1_unsol_event, |
17008 | .setup = alc663_mode1_setup, | ||
17045 | .init_hook = alc663_mode1_inithook, | 17009 | .init_hook = alc663_mode1_inithook, |
17046 | }, | 17010 | }, |
17047 | [ALC662_ASUS_MODE2] = { | 17011 | [ALC662_ASUS_MODE2] = { |
@@ -17054,8 +17018,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17054 | .dig_out_nid = ALC662_DIGOUT_NID, | 17018 | .dig_out_nid = ALC662_DIGOUT_NID, |
17055 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17019 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17056 | .channel_mode = alc662_3ST_2ch_modes, | 17020 | .channel_mode = alc662_3ST_2ch_modes, |
17057 | .input_mux = &alc662_eeepc_capture_source, | ||
17058 | .unsol_event = alc662_mode2_unsol_event, | 17021 | .unsol_event = alc662_mode2_unsol_event, |
17022 | .setup = alc662_mode2_setup, | ||
17059 | .init_hook = alc662_mode2_inithook, | 17023 | .init_hook = alc662_mode2_inithook, |
17060 | }, | 17024 | }, |
17061 | [ALC663_ASUS_MODE3] = { | 17025 | [ALC663_ASUS_MODE3] = { |
@@ -17069,8 +17033,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17069 | .dig_out_nid = ALC662_DIGOUT_NID, | 17033 | .dig_out_nid = ALC662_DIGOUT_NID, |
17070 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17034 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17071 | .channel_mode = alc662_3ST_2ch_modes, | 17035 | .channel_mode = alc662_3ST_2ch_modes, |
17072 | .input_mux = &alc662_eeepc_capture_source, | ||
17073 | .unsol_event = alc663_mode3_unsol_event, | 17036 | .unsol_event = alc663_mode3_unsol_event, |
17037 | .setup = alc663_mode3_setup, | ||
17074 | .init_hook = alc663_mode3_inithook, | 17038 | .init_hook = alc663_mode3_inithook, |
17075 | }, | 17039 | }, |
17076 | [ALC663_ASUS_MODE4] = { | 17040 | [ALC663_ASUS_MODE4] = { |
@@ -17084,8 +17048,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17084 | .dig_out_nid = ALC662_DIGOUT_NID, | 17048 | .dig_out_nid = ALC662_DIGOUT_NID, |
17085 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17049 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17086 | .channel_mode = alc662_3ST_2ch_modes, | 17050 | .channel_mode = alc662_3ST_2ch_modes, |
17087 | .input_mux = &alc662_eeepc_capture_source, | ||
17088 | .unsol_event = alc663_mode4_unsol_event, | 17051 | .unsol_event = alc663_mode4_unsol_event, |
17052 | .setup = alc663_mode4_setup, | ||
17089 | .init_hook = alc663_mode4_inithook, | 17053 | .init_hook = alc663_mode4_inithook, |
17090 | }, | 17054 | }, |
17091 | [ALC663_ASUS_MODE5] = { | 17055 | [ALC663_ASUS_MODE5] = { |
@@ -17099,8 +17063,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17099 | .dig_out_nid = ALC662_DIGOUT_NID, | 17063 | .dig_out_nid = ALC662_DIGOUT_NID, |
17100 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17064 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17101 | .channel_mode = alc662_3ST_2ch_modes, | 17065 | .channel_mode = alc662_3ST_2ch_modes, |
17102 | .input_mux = &alc662_eeepc_capture_source, | ||
17103 | .unsol_event = alc663_mode5_unsol_event, | 17066 | .unsol_event = alc663_mode5_unsol_event, |
17067 | .setup = alc663_mode5_setup, | ||
17104 | .init_hook = alc663_mode5_inithook, | 17068 | .init_hook = alc663_mode5_inithook, |
17105 | }, | 17069 | }, |
17106 | [ALC663_ASUS_MODE6] = { | 17070 | [ALC663_ASUS_MODE6] = { |
@@ -17114,8 +17078,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17114 | .dig_out_nid = ALC662_DIGOUT_NID, | 17078 | .dig_out_nid = ALC662_DIGOUT_NID, |
17115 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17079 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17116 | .channel_mode = alc662_3ST_2ch_modes, | 17080 | .channel_mode = alc662_3ST_2ch_modes, |
17117 | .input_mux = &alc662_eeepc_capture_source, | ||
17118 | .unsol_event = alc663_mode6_unsol_event, | 17081 | .unsol_event = alc663_mode6_unsol_event, |
17082 | .setup = alc663_mode6_setup, | ||
17119 | .init_hook = alc663_mode6_inithook, | 17083 | .init_hook = alc663_mode6_inithook, |
17120 | }, | 17084 | }, |
17121 | [ALC272_DELL] = { | 17085 | [ALC272_DELL] = { |
@@ -17129,8 +17093,8 @@ static struct alc_config_preset alc662_presets[] = { | |||
17129 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), | 17093 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
17130 | .capsrc_nids = alc272_capsrc_nids, | 17094 | .capsrc_nids = alc272_capsrc_nids, |
17131 | .channel_mode = alc662_3ST_2ch_modes, | 17095 | .channel_mode = alc662_3ST_2ch_modes, |
17132 | .input_mux = &alc663_m51va_capture_source, | ||
17133 | .unsol_event = alc663_m51va_unsol_event, | 17096 | .unsol_event = alc663_m51va_unsol_event, |
17097 | .setup = alc663_m51va_setup, | ||
17134 | .init_hook = alc663_m51va_inithook, | 17098 | .init_hook = alc663_m51va_inithook, |
17135 | }, | 17099 | }, |
17136 | [ALC272_DELL_ZM1] = { | 17100 | [ALC272_DELL_ZM1] = { |
@@ -17141,11 +17105,11 @@ static struct alc_config_preset alc662_presets[] = { | |||
17141 | .dac_nids = alc662_dac_nids, | 17105 | .dac_nids = alc662_dac_nids, |
17142 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17106 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17143 | .adc_nids = alc662_adc_nids, | 17107 | .adc_nids = alc662_adc_nids, |
17144 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | 17108 | .num_adc_nids = 1, |
17145 | .capsrc_nids = alc662_capsrc_nids, | 17109 | .capsrc_nids = alc662_capsrc_nids, |
17146 | .channel_mode = alc662_3ST_2ch_modes, | 17110 | .channel_mode = alc662_3ST_2ch_modes, |
17147 | .input_mux = &alc663_m51va_capture_source, | ||
17148 | .unsol_event = alc663_m51va_unsol_event, | 17111 | .unsol_event = alc663_m51va_unsol_event, |
17112 | .setup = alc663_m51va_setup, | ||
17149 | .init_hook = alc663_m51va_inithook, | 17113 | .init_hook = alc663_m51va_inithook, |
17150 | }, | 17114 | }, |
17151 | [ALC272_SAMSUNG_NC10] = { | 17115 | [ALC272_SAMSUNG_NC10] = { |
@@ -17156,8 +17120,9 @@ static struct alc_config_preset alc662_presets[] = { | |||
17156 | .dac_nids = alc272_dac_nids, | 17120 | .dac_nids = alc272_dac_nids, |
17157 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 17121 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
17158 | .channel_mode = alc662_3ST_2ch_modes, | 17122 | .channel_mode = alc662_3ST_2ch_modes, |
17159 | .input_mux = &alc272_nc10_capture_source, | 17123 | /*.input_mux = &alc272_nc10_capture_source,*/ |
17160 | .unsol_event = alc663_mode4_unsol_event, | 17124 | .unsol_event = alc663_mode4_unsol_event, |
17125 | .setup = alc663_mode4_setup, | ||
17161 | .init_hook = alc663_mode4_inithook, | 17126 | .init_hook = alc663_mode4_inithook, |
17162 | }, | 17127 | }, |
17163 | }; | 17128 | }; |
@@ -17209,13 +17174,25 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
17209 | if (err < 0) | 17174 | if (err < 0) |
17210 | return err; | 17175 | return err; |
17211 | } else { | 17176 | } else { |
17212 | sprintf(name, "%s Playback Volume", chname[i]); | 17177 | const char *pfx; |
17178 | if (cfg->line_outs == 1 && | ||
17179 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | ||
17180 | if (!cfg->hp_pins) | ||
17181 | pfx = "Speaker"; | ||
17182 | else | ||
17183 | pfx = "PCM"; | ||
17184 | } else | ||
17185 | pfx = chname[i]; | ||
17186 | sprintf(name, "%s Playback Volume", pfx); | ||
17213 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | 17187 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
17214 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | 17188 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
17215 | HDA_OUTPUT)); | 17189 | HDA_OUTPUT)); |
17216 | if (err < 0) | 17190 | if (err < 0) |
17217 | return err; | 17191 | return err; |
17218 | sprintf(name, "%s Playback Switch", chname[i]); | 17192 | if (cfg->line_outs == 1 && |
17193 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
17194 | pfx = "Speaker"; | ||
17195 | sprintf(name, "%s Playback Switch", pfx); | ||
17219 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | 17196 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
17220 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), | 17197 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
17221 | 3, 0, HDA_INPUT)); | 17198 | 3, 0, HDA_INPUT)); |
@@ -17277,62 +17254,9 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |||
17277 | return 0; | 17254 | return 0; |
17278 | } | 17255 | } |
17279 | 17256 | ||
17280 | /* return the index of the src widget from the connection list of the nid. | ||
17281 | * return -1 if not found | ||
17282 | */ | ||
17283 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, | ||
17284 | hda_nid_t src) | ||
17285 | { | ||
17286 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; | ||
17287 | int i, conns; | ||
17288 | |||
17289 | conns = snd_hda_get_connections(codec, nid, conn_list, | ||
17290 | ARRAY_SIZE(conn_list)); | ||
17291 | if (conns < 0) | ||
17292 | return -1; | ||
17293 | for (i = 0; i < conns; i++) | ||
17294 | if (conn_list[i] == src) | ||
17295 | return i; | ||
17296 | return -1; | ||
17297 | } | ||
17298 | |||
17299 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) | ||
17300 | { | ||
17301 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | ||
17302 | return (pincap & AC_PINCAP_IN) != 0; | ||
17303 | } | ||
17304 | |||
17305 | /* create playback/capture controls for input pins */ | 17257 | /* create playback/capture controls for input pins */ |
17306 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, | 17258 | #define alc662_auto_create_input_ctls \ |
17307 | const struct auto_pin_cfg *cfg) | 17259 | alc880_auto_create_input_ctls |
17308 | { | ||
17309 | struct alc_spec *spec = codec->spec; | ||
17310 | struct hda_input_mux *imux = &spec->private_imux[0]; | ||
17311 | int i, err, idx; | ||
17312 | |||
17313 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
17314 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { | ||
17315 | idx = alc662_input_pin_idx(codec, 0x0b, | ||
17316 | cfg->input_pins[i]); | ||
17317 | if (idx >= 0) { | ||
17318 | err = new_analog_input(spec, cfg->input_pins[i], | ||
17319 | auto_pin_cfg_labels[i], | ||
17320 | idx, 0x0b); | ||
17321 | if (err < 0) | ||
17322 | return err; | ||
17323 | } | ||
17324 | idx = alc662_input_pin_idx(codec, 0x22, | ||
17325 | cfg->input_pins[i]); | ||
17326 | if (idx >= 0) { | ||
17327 | imux->items[imux->num_items].label = | ||
17328 | auto_pin_cfg_labels[i]; | ||
17329 | imux->items[imux->num_items].index = idx; | ||
17330 | imux->num_items++; | ||
17331 | } | ||
17332 | } | ||
17333 | } | ||
17334 | return 0; | ||
17335 | } | ||
17336 | 17260 | ||
17337 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | 17261 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
17338 | hda_nid_t nid, int pin_type, | 17262 | hda_nid_t nid, int pin_type, |
@@ -17386,7 +17310,7 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec) | |||
17386 | 17310 | ||
17387 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 17311 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
17388 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 17312 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
17389 | if (alc662_is_input_pin(codec, nid)) { | 17313 | if (alc_is_input_pin(codec, nid)) { |
17390 | alc_set_input_pin(codec, nid, i); | 17314 | alc_set_input_pin(codec, nid, i); |
17391 | if (nid != ALC662_PIN_CD_NID && | 17315 | if (nid != ALC662_PIN_CD_NID && |
17392 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | 17316 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
@@ -17427,7 +17351,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec) | |||
17427 | "Headphone"); | 17351 | "Headphone"); |
17428 | if (err < 0) | 17352 | if (err < 0) |
17429 | return err; | 17353 | return err; |
17430 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); | 17354 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
17431 | if (err < 0) | 17355 | if (err < 0) |
17432 | return err; | 17356 | return err; |
17433 | 17357 | ||
@@ -17484,8 +17408,8 @@ static int patch_alc662(struct hda_codec *codec) | |||
17484 | alc662_models, | 17408 | alc662_models, |
17485 | alc662_cfg_tbl); | 17409 | alc662_cfg_tbl); |
17486 | if (board_config < 0) { | 17410 | if (board_config < 0) { |
17487 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 17411 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
17488 | "trying auto-probe from BIOS...\n", codec->chip_name); | 17412 | codec->chip_name); |
17489 | board_config = ALC662_AUTO; | 17413 | board_config = ALC662_AUTO; |
17490 | } | 17414 | } |
17491 | 17415 | ||
@@ -17510,7 +17434,7 @@ static int patch_alc662(struct hda_codec *codec) | |||
17510 | } | 17434 | } |
17511 | 17435 | ||
17512 | if (board_config != ALC662_AUTO) | 17436 | if (board_config != ALC662_AUTO) |
17513 | setup_preset(spec, &alc662_presets[board_config]); | 17437 | setup_preset(codec, &alc662_presets[board_config]); |
17514 | 17438 | ||
17515 | spec->stream_analog_playback = &alc662_pcm_analog_playback; | 17439 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
17516 | spec->stream_analog_capture = &alc662_pcm_analog_capture; | 17440 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
@@ -17526,7 +17450,7 @@ static int patch_alc662(struct hda_codec *codec) | |||
17526 | spec->capsrc_nids = alc662_capsrc_nids; | 17450 | spec->capsrc_nids = alc662_capsrc_nids; |
17527 | 17451 | ||
17528 | if (!spec->cap_mixer) | 17452 | if (!spec->cap_mixer) |
17529 | set_capture_mixer(spec); | 17453 | set_capture_mixer(codec); |
17530 | if (codec->vendor_id == 0x10ec0662) | 17454 | if (codec->vendor_id == 0x10ec0662) |
17531 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 17455 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
17532 | else | 17456 | else |
@@ -17562,23 +17486,23 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
17562 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | 17486 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
17563 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | 17487 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
17564 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", | 17488 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
17565 | .patch = patch_alc883 }, | 17489 | .patch = patch_alc882 }, |
17566 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", | 17490 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
17567 | .patch = patch_alc662 }, | 17491 | .patch = patch_alc662 }, |
17568 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, | 17492 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
17569 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, | 17493 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
17570 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, | 17494 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
17571 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, | 17495 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
17572 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", | 17496 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
17573 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | 17497 | .patch = patch_alc882 }, |
17574 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | 17498 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
17575 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | 17499 | .patch = patch_alc882 }, |
17576 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | 17500 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
17577 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, | 17501 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
17578 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | 17502 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
17579 | .patch = patch_alc883 }, | 17503 | .patch = patch_alc882 }, |
17580 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, | 17504 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
17581 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, | 17505 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
17582 | {} /* terminator */ | 17506 | {} /* terminator */ |
17583 | }; | 17507 | }; |
17584 | 17508 | ||