]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Universal Interface for Intel High Definition Audio Codec | |
3 | * | |
4 | * HD audio interface patch for ALC 260/880/882 codecs | |
5 | * | |
6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> | |
7 | * PeiSen Hou <pshou@realtek.com.tw> | |
8 | * Takashi Iwai <tiwai@suse.de> | |
9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> | |
10 | * | |
11 | * This driver is free software; you can redistribute it and/or modify | |
12 | * it under the terms of the GNU General Public License as published by | |
13 | * the Free Software Foundation; either version 2 of the License, or | |
14 | * (at your option) any later version. | |
15 | * | |
16 | * This driver is distributed in the hope that it will be useful, | |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | * GNU General Public License for more details. | |
20 | * | |
21 | * You should have received a copy of the GNU General Public License | |
22 | * along with this program; if not, write to the Free Software | |
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 | */ | |
25 | ||
26 | #include <linux/init.h> | |
27 | #include <linux/delay.h> | |
28 | #include <linux/slab.h> | |
29 | #include <linux/pci.h> | |
30 | #include <sound/core.h> | |
31 | #include <sound/jack.h> | |
32 | #include "hda_codec.h" | |
33 | #include "hda_local.h" | |
34 | #include "hda_beep.h" | |
35 | ||
36 | #define ALC880_FRONT_EVENT 0x01 | |
37 | #define ALC880_DCVOL_EVENT 0x02 | |
38 | #define ALC880_HP_EVENT 0x04 | |
39 | #define ALC880_MIC_EVENT 0x08 | |
40 | ||
41 | /* ALC880 board config type */ | |
42 | enum { | |
43 | ALC880_3ST, | |
44 | ALC880_3ST_DIG, | |
45 | ALC880_5ST, | |
46 | ALC880_5ST_DIG, | |
47 | ALC880_W810, | |
48 | ALC880_Z71V, | |
49 | ALC880_6ST, | |
50 | ALC880_6ST_DIG, | |
51 | ALC880_F1734, | |
52 | ALC880_ASUS, | |
53 | ALC880_ASUS_DIG, | |
54 | ALC880_ASUS_W1V, | |
55 | ALC880_ASUS_DIG2, | |
56 | ALC880_FUJITSU, | |
57 | ALC880_UNIWILL_DIG, | |
58 | ALC880_UNIWILL, | |
59 | ALC880_UNIWILL_P53, | |
60 | ALC880_CLEVO, | |
61 | ALC880_TCL_S700, | |
62 | ALC880_LG, | |
63 | ALC880_LG_LW, | |
64 | ALC880_MEDION_RIM, | |
65 | #ifdef CONFIG_SND_DEBUG | |
66 | ALC880_TEST, | |
67 | #endif | |
68 | ALC880_AUTO, | |
69 | ALC880_MODEL_LAST /* last tag */ | |
70 | }; | |
71 | ||
72 | /* ALC260 models */ | |
73 | enum { | |
74 | ALC260_BASIC, | |
75 | ALC260_HP, | |
76 | ALC260_HP_DC7600, | |
77 | ALC260_HP_3013, | |
78 | ALC260_FUJITSU_S702X, | |
79 | ALC260_ACER, | |
80 | ALC260_WILL, | |
81 | ALC260_REPLACER_672V, | |
82 | ALC260_FAVORIT100, | |
83 | #ifdef CONFIG_SND_DEBUG | |
84 | ALC260_TEST, | |
85 | #endif | |
86 | ALC260_AUTO, | |
87 | ALC260_MODEL_LAST /* last tag */ | |
88 | }; | |
89 | ||
90 | /* ALC262 models */ | |
91 | enum { | |
92 | ALC262_BASIC, | |
93 | ALC262_HIPPO, | |
94 | ALC262_HIPPO_1, | |
95 | ALC262_FUJITSU, | |
96 | ALC262_HP_BPC, | |
97 | ALC262_HP_BPC_D7000_WL, | |
98 | ALC262_HP_BPC_D7000_WF, | |
99 | ALC262_HP_TC_T5735, | |
100 | ALC262_HP_RP5700, | |
101 | ALC262_BENQ_ED8, | |
102 | ALC262_SONY_ASSAMD, | |
103 | ALC262_BENQ_T31, | |
104 | ALC262_ULTRA, | |
105 | ALC262_LENOVO_3000, | |
106 | ALC262_NEC, | |
107 | ALC262_TOSHIBA_S06, | |
108 | ALC262_TOSHIBA_RX1, | |
109 | ALC262_TYAN, | |
110 | ALC262_AUTO, | |
111 | ALC262_MODEL_LAST /* last tag */ | |
112 | }; | |
113 | ||
114 | /* ALC268 models */ | |
115 | enum { | |
116 | ALC267_QUANTA_IL1, | |
117 | ALC268_3ST, | |
118 | ALC268_TOSHIBA, | |
119 | ALC268_ACER, | |
120 | ALC268_ACER_DMIC, | |
121 | ALC268_ACER_ASPIRE_ONE, | |
122 | ALC268_DELL, | |
123 | ALC268_ZEPTO, | |
124 | #ifdef CONFIG_SND_DEBUG | |
125 | ALC268_TEST, | |
126 | #endif | |
127 | ALC268_AUTO, | |
128 | ALC268_MODEL_LAST /* last tag */ | |
129 | }; | |
130 | ||
131 | /* ALC269 models */ | |
132 | enum { | |
133 | ALC269_BASIC, | |
134 | ALC269_QUANTA_FL1, | |
135 | ALC269_AMIC, | |
136 | ALC269_DMIC, | |
137 | ALC269VB_AMIC, | |
138 | ALC269VB_DMIC, | |
139 | ALC269_FUJITSU, | |
140 | ALC269_LIFEBOOK, | |
141 | ALC271_ACER, | |
142 | ALC269_AUTO, | |
143 | ALC269_MODEL_LAST /* last tag */ | |
144 | }; | |
145 | ||
146 | /* ALC861 models */ | |
147 | enum { | |
148 | ALC861_3ST, | |
149 | ALC660_3ST, | |
150 | ALC861_3ST_DIG, | |
151 | ALC861_6ST_DIG, | |
152 | ALC861_UNIWILL_M31, | |
153 | ALC861_TOSHIBA, | |
154 | ALC861_ASUS, | |
155 | ALC861_ASUS_LAPTOP, | |
156 | ALC861_AUTO, | |
157 | ALC861_MODEL_LAST, | |
158 | }; | |
159 | ||
160 | /* ALC861-VD models */ | |
161 | enum { | |
162 | ALC660VD_3ST, | |
163 | ALC660VD_3ST_DIG, | |
164 | ALC660VD_ASUS_V1S, | |
165 | ALC861VD_3ST, | |
166 | ALC861VD_3ST_DIG, | |
167 | ALC861VD_6ST_DIG, | |
168 | ALC861VD_LENOVO, | |
169 | ALC861VD_DALLAS, | |
170 | ALC861VD_HP, | |
171 | ALC861VD_AUTO, | |
172 | ALC861VD_MODEL_LAST, | |
173 | }; | |
174 | ||
175 | /* ALC662 models */ | |
176 | enum { | |
177 | ALC662_3ST_2ch_DIG, | |
178 | ALC662_3ST_6ch_DIG, | |
179 | ALC662_3ST_6ch, | |
180 | ALC662_5ST_DIG, | |
181 | ALC662_LENOVO_101E, | |
182 | ALC662_ASUS_EEEPC_P701, | |
183 | ALC662_ASUS_EEEPC_EP20, | |
184 | ALC663_ASUS_M51VA, | |
185 | ALC663_ASUS_G71V, | |
186 | ALC663_ASUS_H13, | |
187 | ALC663_ASUS_G50V, | |
188 | ALC662_ECS, | |
189 | ALC663_ASUS_MODE1, | |
190 | ALC662_ASUS_MODE2, | |
191 | ALC663_ASUS_MODE3, | |
192 | ALC663_ASUS_MODE4, | |
193 | ALC663_ASUS_MODE5, | |
194 | ALC663_ASUS_MODE6, | |
195 | ALC663_ASUS_MODE7, | |
196 | ALC663_ASUS_MODE8, | |
197 | ALC272_DELL, | |
198 | ALC272_DELL_ZM1, | |
199 | ALC272_SAMSUNG_NC10, | |
200 | ALC662_AUTO, | |
201 | ALC662_MODEL_LAST, | |
202 | }; | |
203 | ||
204 | /* ALC882 models */ | |
205 | enum { | |
206 | ALC882_3ST_DIG, | |
207 | ALC882_6ST_DIG, | |
208 | ALC882_ARIMA, | |
209 | ALC882_W2JC, | |
210 | ALC882_TARGA, | |
211 | ALC882_ASUS_A7J, | |
212 | ALC882_ASUS_A7M, | |
213 | ALC885_MACPRO, | |
214 | ALC885_MBA21, | |
215 | ALC885_MBP3, | |
216 | ALC885_MB5, | |
217 | ALC885_MACMINI3, | |
218 | ALC885_IMAC24, | |
219 | ALC885_IMAC91, | |
220 | ALC883_3ST_2ch_DIG, | |
221 | ALC883_3ST_6ch_DIG, | |
222 | ALC883_3ST_6ch, | |
223 | ALC883_6ST_DIG, | |
224 | ALC883_TARGA_DIG, | |
225 | ALC883_TARGA_2ch_DIG, | |
226 | ALC883_TARGA_8ch_DIG, | |
227 | ALC883_ACER, | |
228 | ALC883_ACER_ASPIRE, | |
229 | ALC888_ACER_ASPIRE_4930G, | |
230 | ALC888_ACER_ASPIRE_6530G, | |
231 | ALC888_ACER_ASPIRE_8930G, | |
232 | ALC888_ACER_ASPIRE_7730G, | |
233 | ALC883_MEDION, | |
234 | ALC883_MEDION_WIM2160, | |
235 | ALC883_LAPTOP_EAPD, | |
236 | ALC883_LENOVO_101E_2ch, | |
237 | ALC883_LENOVO_NB0763, | |
238 | ALC888_LENOVO_MS7195_DIG, | |
239 | ALC888_LENOVO_SKY, | |
240 | ALC883_HAIER_W66, | |
241 | ALC888_3ST_HP, | |
242 | ALC888_6ST_DELL, | |
243 | ALC883_MITAC, | |
244 | ALC883_CLEVO_M540R, | |
245 | ALC883_CLEVO_M720, | |
246 | ALC883_FUJITSU_PI2515, | |
247 | ALC888_FUJITSU_XA3530, | |
248 | ALC883_3ST_6ch_INTEL, | |
249 | ALC889A_INTEL, | |
250 | ALC889_INTEL, | |
251 | ALC888_ASUS_M90V, | |
252 | ALC888_ASUS_EEE1601, | |
253 | ALC889A_MB31, | |
254 | ALC1200_ASUS_P5Q, | |
255 | ALC883_SONY_VAIO_TT, | |
256 | ALC882_AUTO, | |
257 | ALC882_MODEL_LAST, | |
258 | }; | |
259 | ||
260 | /* ALC680 models */ | |
261 | enum { | |
262 | ALC680_BASE, | |
263 | ALC680_AUTO, | |
264 | ALC680_MODEL_LAST, | |
265 | }; | |
266 | ||
267 | /* for GPIO Poll */ | |
268 | #define GPIO_MASK 0x03 | |
269 | ||
270 | /* extra amp-initialization sequence types */ | |
271 | enum { | |
272 | ALC_INIT_NONE, | |
273 | ALC_INIT_DEFAULT, | |
274 | ALC_INIT_GPIO1, | |
275 | ALC_INIT_GPIO2, | |
276 | ALC_INIT_GPIO3, | |
277 | }; | |
278 | ||
279 | struct alc_mic_route { | |
280 | hda_nid_t pin; | |
281 | unsigned char mux_idx; | |
282 | unsigned char amix_idx; | |
283 | }; | |
284 | ||
285 | struct alc_jack { | |
286 | hda_nid_t nid; | |
287 | int type; | |
288 | struct snd_jack *jack; | |
289 | }; | |
290 | ||
291 | #define MUX_IDX_UNDEF ((unsigned char)-1) | |
292 | ||
293 | struct alc_customize_define { | |
294 | unsigned int sku_cfg; | |
295 | unsigned char port_connectivity; | |
296 | unsigned char check_sum; | |
297 | unsigned char customization; | |
298 | unsigned char external_amp; | |
299 | unsigned int enable_pcbeep:1; | |
300 | unsigned int platform_type:1; | |
301 | unsigned int swap:1; | |
302 | unsigned int override:1; | |
303 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ | |
304 | }; | |
305 | ||
306 | struct alc_fixup; | |
307 | ||
308 | struct alc_spec { | |
309 | /* codec parameterization */ | |
310 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ | |
311 | unsigned int num_mixers; | |
312 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ | |
313 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ | |
314 | ||
315 | const struct hda_verb *init_verbs[10]; /* initialization verbs | |
316 | * don't forget NULL | |
317 | * termination! | |
318 | */ | |
319 | unsigned int num_init_verbs; | |
320 | ||
321 | char stream_name_analog[32]; /* analog PCM stream */ | |
322 | struct hda_pcm_stream *stream_analog_playback; | |
323 | struct hda_pcm_stream *stream_analog_capture; | |
324 | struct hda_pcm_stream *stream_analog_alt_playback; | |
325 | struct hda_pcm_stream *stream_analog_alt_capture; | |
326 | ||
327 | char stream_name_digital[32]; /* digital PCM stream */ | |
328 | struct hda_pcm_stream *stream_digital_playback; | |
329 | struct hda_pcm_stream *stream_digital_capture; | |
330 | ||
331 | /* playback */ | |
332 | struct hda_multi_out multiout; /* playback set-up | |
333 | * max_channels, dacs must be set | |
334 | * dig_out_nid and hp_nid are optional | |
335 | */ | |
336 | hda_nid_t alt_dac_nid; | |
337 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ | |
338 | int dig_out_type; | |
339 | ||
340 | /* capture */ | |
341 | unsigned int num_adc_nids; | |
342 | hda_nid_t *adc_nids; | |
343 | hda_nid_t *capsrc_nids; | |
344 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ | |
345 | ||
346 | /* capture setup for dynamic dual-adc switch */ | |
347 | unsigned int cur_adc_idx; | |
348 | hda_nid_t cur_adc; | |
349 | unsigned int cur_adc_stream_tag; | |
350 | unsigned int cur_adc_format; | |
351 | ||
352 | /* capture source */ | |
353 | unsigned int num_mux_defs; | |
354 | const struct hda_input_mux *input_mux; | |
355 | unsigned int cur_mux[3]; | |
356 | struct alc_mic_route ext_mic; | |
357 | struct alc_mic_route int_mic; | |
358 | ||
359 | /* channel model */ | |
360 | const struct hda_channel_mode *channel_mode; | |
361 | int num_channel_mode; | |
362 | int need_dac_fix; | |
363 | int const_channel_count; | |
364 | int ext_channel_count; | |
365 | ||
366 | /* PCM information */ | |
367 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ | |
368 | ||
369 | /* jack detection */ | |
370 | struct snd_array jacks; | |
371 | ||
372 | /* dynamic controls, init_verbs and input_mux */ | |
373 | struct auto_pin_cfg autocfg; | |
374 | struct alc_customize_define cdefine; | |
375 | struct snd_array kctls; | |
376 | struct hda_input_mux private_imux[3]; | |
377 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; | |
378 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; | |
379 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; | |
380 | ||
381 | /* hooks */ | |
382 | void (*init_hook)(struct hda_codec *codec); | |
383 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | |
384 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
385 | void (*power_hook)(struct hda_codec *codec); | |
386 | #endif | |
387 | ||
388 | /* for pin sensing */ | |
389 | unsigned int sense_updated: 1; | |
390 | unsigned int jack_present: 1; | |
391 | unsigned int master_sw: 1; | |
392 | unsigned int auto_mic:1; | |
393 | ||
394 | /* other flags */ | |
395 | unsigned int no_analog :1; /* digital I/O only */ | |
396 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ | |
397 | int init_amp; | |
398 | int codec_variant; /* flag for other variants */ | |
399 | ||
400 | /* for virtual master */ | |
401 | hda_nid_t vmaster_nid; | |
402 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
403 | struct hda_loopback_check loopback; | |
404 | #endif | |
405 | ||
406 | /* for PLL fix */ | |
407 | hda_nid_t pll_nid; | |
408 | unsigned int pll_coef_idx, pll_coef_bit; | |
409 | ||
410 | /* fix-up list */ | |
411 | int fixup_id; | |
412 | const struct alc_fixup *fixup_list; | |
413 | const char *fixup_name; | |
414 | }; | |
415 | ||
416 | /* | |
417 | * configuration template - to be copied to the spec instance | |
418 | */ | |
419 | struct alc_config_preset { | |
420 | struct snd_kcontrol_new *mixers[5]; /* should be identical size | |
421 | * with spec | |
422 | */ | |
423 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ | |
424 | const struct hda_verb *init_verbs[5]; | |
425 | unsigned int num_dacs; | |
426 | hda_nid_t *dac_nids; | |
427 | hda_nid_t dig_out_nid; /* optional */ | |
428 | hda_nid_t hp_nid; /* optional */ | |
429 | hda_nid_t *slave_dig_outs; | |
430 | unsigned int num_adc_nids; | |
431 | hda_nid_t *adc_nids; | |
432 | hda_nid_t *capsrc_nids; | |
433 | hda_nid_t dig_in_nid; | |
434 | unsigned int num_channel_mode; | |
435 | const struct hda_channel_mode *channel_mode; | |
436 | int need_dac_fix; | |
437 | int const_channel_count; | |
438 | unsigned int num_mux_defs; | |
439 | const struct hda_input_mux *input_mux; | |
440 | void (*unsol_event)(struct hda_codec *, unsigned int); | |
441 | void (*setup)(struct hda_codec *); | |
442 | void (*init_hook)(struct hda_codec *); | |
443 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
444 | struct hda_amp_list *loopbacks; | |
445 | void (*power_hook)(struct hda_codec *codec); | |
446 | #endif | |
447 | }; | |
448 | ||
449 | ||
450 | /* | |
451 | * input MUX handling | |
452 | */ | |
453 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, | |
454 | struct snd_ctl_elem_info *uinfo) | |
455 | { | |
456 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
457 | struct alc_spec *spec = codec->spec; | |
458 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); | |
459 | if (mux_idx >= spec->num_mux_defs) | |
460 | mux_idx = 0; | |
461 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) | |
462 | mux_idx = 0; | |
463 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); | |
464 | } | |
465 | ||
466 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, | |
467 | struct snd_ctl_elem_value *ucontrol) | |
468 | { | |
469 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
470 | struct alc_spec *spec = codec->spec; | |
471 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
472 | ||
473 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; | |
474 | return 0; | |
475 | } | |
476 | ||
477 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, | |
478 | struct snd_ctl_elem_value *ucontrol) | |
479 | { | |
480 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
481 | struct alc_spec *spec = codec->spec; | |
482 | const struct hda_input_mux *imux; | |
483 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
484 | unsigned int mux_idx; | |
485 | hda_nid_t nid = spec->capsrc_nids ? | |
486 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | |
487 | unsigned int type; | |
488 | ||
489 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | |
490 | imux = &spec->input_mux[mux_idx]; | |
491 | if (!imux->num_items && mux_idx > 0) | |
492 | imux = &spec->input_mux[0]; | |
493 | ||
494 | type = get_wcaps_type(get_wcaps(codec, nid)); | |
495 | if (type == AC_WID_AUD_MIX) { | |
496 | /* Matrix-mixer style (e.g. ALC882) */ | |
497 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | |
498 | unsigned int i, idx; | |
499 | ||
500 | idx = ucontrol->value.enumerated.item[0]; | |
501 | if (idx >= imux->num_items) | |
502 | idx = imux->num_items - 1; | |
503 | if (*cur_val == idx) | |
504 | return 0; | |
505 | for (i = 0; i < imux->num_items; i++) { | |
506 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | |
507 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | |
508 | imux->items[i].index, | |
509 | HDA_AMP_MUTE, v); | |
510 | } | |
511 | *cur_val = idx; | |
512 | return 1; | |
513 | } else { | |
514 | /* MUX style (e.g. ALC880) */ | |
515 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, | |
516 | &spec->cur_mux[adc_idx]); | |
517 | } | |
518 | } | |
519 | ||
520 | /* | |
521 | * channel mode setting | |
522 | */ | |
523 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, | |
524 | struct snd_ctl_elem_info *uinfo) | |
525 | { | |
526 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
527 | struct alc_spec *spec = codec->spec; | |
528 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, | |
529 | spec->num_channel_mode); | |
530 | } | |
531 | ||
532 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, | |
533 | struct snd_ctl_elem_value *ucontrol) | |
534 | { | |
535 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
536 | struct alc_spec *spec = codec->spec; | |
537 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, | |
538 | spec->num_channel_mode, | |
539 | spec->ext_channel_count); | |
540 | } | |
541 | ||
542 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, | |
543 | struct snd_ctl_elem_value *ucontrol) | |
544 | { | |
545 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
546 | struct alc_spec *spec = codec->spec; | |
547 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, | |
548 | spec->num_channel_mode, | |
549 | &spec->ext_channel_count); | |
550 | if (err >= 0 && !spec->const_channel_count) { | |
551 | spec->multiout.max_channels = spec->ext_channel_count; | |
552 | if (spec->need_dac_fix) | |
553 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; | |
554 | } | |
555 | return err; | |
556 | } | |
557 | ||
558 | /* | |
559 | * Control the mode of pin widget settings via the mixer. "pc" is used | |
560 | * instead of "%" to avoid consequences of accidently treating the % as | |
561 | * being part of a format specifier. Maximum allowed length of a value is | |
562 | * 63 characters plus NULL terminator. | |
563 | * | |
564 | * Note: some retasking pin complexes seem to ignore requests for input | |
565 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these | |
566 | * are requested. Therefore order this list so that this behaviour will not | |
567 | * cause problems when mixer clients move through the enum sequentially. | |
568 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of | |
569 | * March 2006. | |
570 | */ | |
571 | static char *alc_pin_mode_names[] = { | |
572 | "Mic 50pc bias", "Mic 80pc bias", | |
573 | "Line in", "Line out", "Headphone out", | |
574 | }; | |
575 | static unsigned char alc_pin_mode_values[] = { | |
576 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, | |
577 | }; | |
578 | /* The control can present all 5 options, or it can limit the options based | |
579 | * in the pin being assumed to be exclusively an input or an output pin. In | |
580 | * addition, "input" pins may or may not process the mic bias option | |
581 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to | |
582 | * accept requests for bias as of chip versions up to March 2006) and/or | |
583 | * wiring in the computer. | |
584 | */ | |
585 | #define ALC_PIN_DIR_IN 0x00 | |
586 | #define ALC_PIN_DIR_OUT 0x01 | |
587 | #define ALC_PIN_DIR_INOUT 0x02 | |
588 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | |
589 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | |
590 | ||
591 | /* Info about the pin modes supported by the different pin direction modes. | |
592 | * For each direction the minimum and maximum values are given. | |
593 | */ | |
594 | static signed char alc_pin_mode_dir_info[5][2] = { | |
595 | { 0, 2 }, /* ALC_PIN_DIR_IN */ | |
596 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ | |
597 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ | |
598 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ | |
599 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ | |
600 | }; | |
601 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) | |
602 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) | |
603 | #define alc_pin_mode_n_items(_dir) \ | |
604 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) | |
605 | ||
606 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, | |
607 | struct snd_ctl_elem_info *uinfo) | |
608 | { | |
609 | unsigned int item_num = uinfo->value.enumerated.item; | |
610 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
611 | ||
612 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
613 | uinfo->count = 1; | |
614 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); | |
615 | ||
616 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) | |
617 | item_num = alc_pin_mode_min(dir); | |
618 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); | |
619 | return 0; | |
620 | } | |
621 | ||
622 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, | |
623 | struct snd_ctl_elem_value *ucontrol) | |
624 | { | |
625 | unsigned int i; | |
626 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
627 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
628 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
629 | long *valp = ucontrol->value.integer.value; | |
630 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, | |
631 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
632 | 0x00); | |
633 | ||
634 | /* Find enumerated value for current pinctl setting */ | |
635 | i = alc_pin_mode_min(dir); | |
636 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) | |
637 | i++; | |
638 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); | |
639 | return 0; | |
640 | } | |
641 | ||
642 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, | |
643 | struct snd_ctl_elem_value *ucontrol) | |
644 | { | |
645 | signed int change; | |
646 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
647 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
648 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
649 | long val = *ucontrol->value.integer.value; | |
650 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, | |
651 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
652 | 0x00); | |
653 | ||
654 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) | |
655 | val = alc_pin_mode_min(dir); | |
656 | ||
657 | change = pinctl != alc_pin_mode_values[val]; | |
658 | if (change) { | |
659 | /* Set pin mode to that requested */ | |
660 | snd_hda_codec_write_cache(codec, nid, 0, | |
661 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
662 | alc_pin_mode_values[val]); | |
663 | ||
664 | /* Also enable the retasking pin's input/output as required | |
665 | * for the requested pin mode. Enum values of 2 or less are | |
666 | * input modes. | |
667 | * | |
668 | * Dynamically switching the input/output buffers probably | |
669 | * reduces noise slightly (particularly on input) so we'll | |
670 | * do it. However, having both input and output buffers | |
671 | * enabled simultaneously doesn't seem to be problematic if | |
672 | * this turns out to be necessary in the future. | |
673 | */ | |
674 | if (val <= 2) { | |
675 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
676 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
677 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | |
678 | HDA_AMP_MUTE, 0); | |
679 | } else { | |
680 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | |
681 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
682 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
683 | HDA_AMP_MUTE, 0); | |
684 | } | |
685 | } | |
686 | return change; | |
687 | } | |
688 | ||
689 | #define ALC_PIN_MODE(xname, nid, dir) \ | |
690 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
691 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | |
692 | .info = alc_pin_mode_info, \ | |
693 | .get = alc_pin_mode_get, \ | |
694 | .put = alc_pin_mode_put, \ | |
695 | .private_value = nid | (dir<<16) } | |
696 | ||
697 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged | |
698 | * together using a mask with more than one bit set. This control is | |
699 | * currently used only by the ALC260 test model. At this stage they are not | |
700 | * needed for any "production" models. | |
701 | */ | |
702 | #ifdef CONFIG_SND_DEBUG | |
703 | #define alc_gpio_data_info snd_ctl_boolean_mono_info | |
704 | ||
705 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, | |
706 | struct snd_ctl_elem_value *ucontrol) | |
707 | { | |
708 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
709 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
710 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
711 | long *valp = ucontrol->value.integer.value; | |
712 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
713 | AC_VERB_GET_GPIO_DATA, 0x00); | |
714 | ||
715 | *valp = (val & mask) != 0; | |
716 | return 0; | |
717 | } | |
718 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, | |
719 | struct snd_ctl_elem_value *ucontrol) | |
720 | { | |
721 | signed int change; | |
722 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
723 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
724 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
725 | long val = *ucontrol->value.integer.value; | |
726 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, | |
727 | AC_VERB_GET_GPIO_DATA, | |
728 | 0x00); | |
729 | ||
730 | /* Set/unset the masked GPIO bit(s) as needed */ | |
731 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); | |
732 | if (val == 0) | |
733 | gpio_data &= ~mask; | |
734 | else | |
735 | gpio_data |= mask; | |
736 | snd_hda_codec_write_cache(codec, nid, 0, | |
737 | AC_VERB_SET_GPIO_DATA, gpio_data); | |
738 | ||
739 | return change; | |
740 | } | |
741 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ | |
742 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
743 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | |
744 | .info = alc_gpio_data_info, \ | |
745 | .get = alc_gpio_data_get, \ | |
746 | .put = alc_gpio_data_put, \ | |
747 | .private_value = nid | (mask<<16) } | |
748 | #endif /* CONFIG_SND_DEBUG */ | |
749 | ||
750 | /* A switch control to allow the enabling of the digital IO pins on the | |
751 | * ALC260. This is incredibly simplistic; the intention of this control is | |
752 | * to provide something in the test model allowing digital outputs to be | |
753 | * identified if present. If models are found which can utilise these | |
754 | * outputs a more complete mixer control can be devised for those models if | |
755 | * necessary. | |
756 | */ | |
757 | #ifdef CONFIG_SND_DEBUG | |
758 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info | |
759 | ||
760 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, | |
761 | struct snd_ctl_elem_value *ucontrol) | |
762 | { | |
763 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
764 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
765 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
766 | long *valp = ucontrol->value.integer.value; | |
767 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
768 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); | |
769 | ||
770 | *valp = (val & mask) != 0; | |
771 | return 0; | |
772 | } | |
773 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, | |
774 | struct snd_ctl_elem_value *ucontrol) | |
775 | { | |
776 | signed int change; | |
777 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
778 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
779 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
780 | long val = *ucontrol->value.integer.value; | |
781 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | |
782 | AC_VERB_GET_DIGI_CONVERT_1, | |
783 | 0x00); | |
784 | ||
785 | /* Set/unset the masked control bit(s) as needed */ | |
786 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); | |
787 | if (val==0) | |
788 | ctrl_data &= ~mask; | |
789 | else | |
790 | ctrl_data |= mask; | |
791 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, | |
792 | ctrl_data); | |
793 | ||
794 | return change; | |
795 | } | |
796 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ | |
797 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
798 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | |
799 | .info = alc_spdif_ctrl_info, \ | |
800 | .get = alc_spdif_ctrl_get, \ | |
801 | .put = alc_spdif_ctrl_put, \ | |
802 | .private_value = nid | (mask<<16) } | |
803 | #endif /* CONFIG_SND_DEBUG */ | |
804 | ||
805 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. | |
806 | * Again, this is only used in the ALC26x test models to help identify when | |
807 | * the EAPD line must be asserted for features to work. | |
808 | */ | |
809 | #ifdef CONFIG_SND_DEBUG | |
810 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info | |
811 | ||
812 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, | |
813 | struct snd_ctl_elem_value *ucontrol) | |
814 | { | |
815 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
816 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
817 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
818 | long *valp = ucontrol->value.integer.value; | |
819 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
820 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); | |
821 | ||
822 | *valp = (val & mask) != 0; | |
823 | return 0; | |
824 | } | |
825 | ||
826 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, | |
827 | struct snd_ctl_elem_value *ucontrol) | |
828 | { | |
829 | int change; | |
830 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
831 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
832 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
833 | long val = *ucontrol->value.integer.value; | |
834 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | |
835 | AC_VERB_GET_EAPD_BTLENABLE, | |
836 | 0x00); | |
837 | ||
838 | /* Set/unset the masked control bit(s) as needed */ | |
839 | change = (!val ? 0 : mask) != (ctrl_data & mask); | |
840 | if (!val) | |
841 | ctrl_data &= ~mask; | |
842 | else | |
843 | ctrl_data |= mask; | |
844 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
845 | ctrl_data); | |
846 | ||
847 | return change; | |
848 | } | |
849 | ||
850 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ | |
851 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
852 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | |
853 | .info = alc_eapd_ctrl_info, \ | |
854 | .get = alc_eapd_ctrl_get, \ | |
855 | .put = alc_eapd_ctrl_put, \ | |
856 | .private_value = nid | (mask<<16) } | |
857 | #endif /* CONFIG_SND_DEBUG */ | |
858 | ||
859 | /* | |
860 | * set up the input pin config (depending on the given auto-pin type) | |
861 | */ | |
862 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, | |
863 | int auto_pin_type) | |
864 | { | |
865 | unsigned int val = PIN_IN; | |
866 | ||
867 | if (auto_pin_type == AUTO_PIN_MIC) { | |
868 | unsigned int pincap; | |
869 | unsigned int oldval; | |
870 | oldval = snd_hda_codec_read(codec, nid, 0, | |
871 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
872 | pincap = snd_hda_query_pin_caps(codec, nid); | |
873 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; | |
874 | /* if the default pin setup is vref50, we give it priority */ | |
875 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) | |
876 | val = PIN_VREF80; | |
877 | else if (pincap & AC_PINCAP_VREF_50) | |
878 | val = PIN_VREF50; | |
879 | else if (pincap & AC_PINCAP_VREF_100) | |
880 | val = PIN_VREF100; | |
881 | else if (pincap & AC_PINCAP_VREF_GRD) | |
882 | val = PIN_VREFGRD; | |
883 | } | |
884 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); | |
885 | } | |
886 | ||
887 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) | |
888 | { | |
889 | struct alc_spec *spec = codec->spec; | |
890 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
891 | ||
892 | if (!cfg->line_outs) { | |
893 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && | |
894 | cfg->line_out_pins[cfg->line_outs]) | |
895 | cfg->line_outs++; | |
896 | } | |
897 | if (!cfg->speaker_outs) { | |
898 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && | |
899 | cfg->speaker_pins[cfg->speaker_outs]) | |
900 | cfg->speaker_outs++; | |
901 | } | |
902 | if (!cfg->hp_outs) { | |
903 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && | |
904 | cfg->hp_pins[cfg->hp_outs]) | |
905 | cfg->hp_outs++; | |
906 | } | |
907 | } | |
908 | ||
909 | /* | |
910 | */ | |
911 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) | |
912 | { | |
913 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) | |
914 | return; | |
915 | spec->mixers[spec->num_mixers++] = mix; | |
916 | } | |
917 | ||
918 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) | |
919 | { | |
920 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) | |
921 | return; | |
922 | spec->init_verbs[spec->num_init_verbs++] = verb; | |
923 | } | |
924 | ||
925 | /* | |
926 | * set up from the preset table | |
927 | */ | |
928 | static void setup_preset(struct hda_codec *codec, | |
929 | const struct alc_config_preset *preset) | |
930 | { | |
931 | struct alc_spec *spec = codec->spec; | |
932 | int i; | |
933 | ||
934 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | |
935 | add_mixer(spec, preset->mixers[i]); | |
936 | spec->cap_mixer = preset->cap_mixer; | |
937 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; | |
938 | i++) | |
939 | add_verb(spec, preset->init_verbs[i]); | |
940 | ||
941 | spec->channel_mode = preset->channel_mode; | |
942 | spec->num_channel_mode = preset->num_channel_mode; | |
943 | spec->need_dac_fix = preset->need_dac_fix; | |
944 | spec->const_channel_count = preset->const_channel_count; | |
945 | ||
946 | if (preset->const_channel_count) | |
947 | spec->multiout.max_channels = preset->const_channel_count; | |
948 | else | |
949 | spec->multiout.max_channels = spec->channel_mode[0].channels; | |
950 | spec->ext_channel_count = spec->channel_mode[0].channels; | |
951 | ||
952 | spec->multiout.num_dacs = preset->num_dacs; | |
953 | spec->multiout.dac_nids = preset->dac_nids; | |
954 | spec->multiout.dig_out_nid = preset->dig_out_nid; | |
955 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; | |
956 | spec->multiout.hp_nid = preset->hp_nid; | |
957 | ||
958 | spec->num_mux_defs = preset->num_mux_defs; | |
959 | if (!spec->num_mux_defs) | |
960 | spec->num_mux_defs = 1; | |
961 | spec->input_mux = preset->input_mux; | |
962 | ||
963 | spec->num_adc_nids = preset->num_adc_nids; | |
964 | spec->adc_nids = preset->adc_nids; | |
965 | spec->capsrc_nids = preset->capsrc_nids; | |
966 | spec->dig_in_nid = preset->dig_in_nid; | |
967 | ||
968 | spec->unsol_event = preset->unsol_event; | |
969 | spec->init_hook = preset->init_hook; | |
970 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
971 | spec->power_hook = preset->power_hook; | |
972 | spec->loopback.amplist = preset->loopbacks; | |
973 | #endif | |
974 | ||
975 | if (preset->setup) | |
976 | preset->setup(codec); | |
977 | ||
978 | alc_fixup_autocfg_pin_nums(codec); | |
979 | } | |
980 | ||
981 | /* Enable GPIO mask and set output */ | |
982 | static struct hda_verb alc_gpio1_init_verbs[] = { | |
983 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
984 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
985 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
986 | { } | |
987 | }; | |
988 | ||
989 | static struct hda_verb alc_gpio2_init_verbs[] = { | |
990 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | |
991 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | |
992 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, | |
993 | { } | |
994 | }; | |
995 | ||
996 | static struct hda_verb alc_gpio3_init_verbs[] = { | |
997 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
998 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
999 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
1000 | { } | |
1001 | }; | |
1002 | ||
1003 | /* | |
1004 | * Fix hardware PLL issue | |
1005 | * On some codecs, the analog PLL gating control must be off while | |
1006 | * the default value is 1. | |
1007 | */ | |
1008 | static void alc_fix_pll(struct hda_codec *codec) | |
1009 | { | |
1010 | struct alc_spec *spec = codec->spec; | |
1011 | unsigned int val; | |
1012 | ||
1013 | if (!spec->pll_nid) | |
1014 | return; | |
1015 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
1016 | spec->pll_coef_idx); | |
1017 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, | |
1018 | AC_VERB_GET_PROC_COEF, 0); | |
1019 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
1020 | spec->pll_coef_idx); | |
1021 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, | |
1022 | val & ~(1 << spec->pll_coef_bit)); | |
1023 | } | |
1024 | ||
1025 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |
1026 | unsigned int coef_idx, unsigned int coef_bit) | |
1027 | { | |
1028 | struct alc_spec *spec = codec->spec; | |
1029 | spec->pll_nid = nid; | |
1030 | spec->pll_coef_idx = coef_idx; | |
1031 | spec->pll_coef_bit = coef_bit; | |
1032 | alc_fix_pll(codec); | |
1033 | } | |
1034 | ||
1035 | #ifdef CONFIG_SND_HDA_INPUT_JACK | |
1036 | static void alc_free_jack_priv(struct snd_jack *jack) | |
1037 | { | |
1038 | struct alc_jack *jacks = jack->private_data; | |
1039 | jacks->nid = 0; | |
1040 | jacks->jack = NULL; | |
1041 | } | |
1042 | ||
1043 | static int alc_add_jack(struct hda_codec *codec, | |
1044 | hda_nid_t nid, int type) | |
1045 | { | |
1046 | struct alc_spec *spec; | |
1047 | struct alc_jack *jack; | |
1048 | const char *name; | |
1049 | int err; | |
1050 | ||
1051 | spec = codec->spec; | |
1052 | snd_array_init(&spec->jacks, sizeof(*jack), 32); | |
1053 | jack = snd_array_new(&spec->jacks); | |
1054 | if (!jack) | |
1055 | return -ENOMEM; | |
1056 | ||
1057 | jack->nid = nid; | |
1058 | jack->type = type; | |
1059 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; | |
1060 | ||
1061 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); | |
1062 | if (err < 0) | |
1063 | return err; | |
1064 | jack->jack->private_data = jack; | |
1065 | jack->jack->private_free = alc_free_jack_priv; | |
1066 | return 0; | |
1067 | } | |
1068 | ||
1069 | static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) | |
1070 | { | |
1071 | struct alc_spec *spec = codec->spec; | |
1072 | struct alc_jack *jacks = spec->jacks.list; | |
1073 | ||
1074 | if (jacks) { | |
1075 | int i; | |
1076 | for (i = 0; i < spec->jacks.used; i++) { | |
1077 | if (jacks->nid == nid) { | |
1078 | unsigned int present; | |
1079 | present = snd_hda_jack_detect(codec, nid); | |
1080 | ||
1081 | present = (present) ? jacks->type : 0; | |
1082 | ||
1083 | snd_jack_report(jacks->jack, present); | |
1084 | } | |
1085 | jacks++; | |
1086 | } | |
1087 | } | |
1088 | } | |
1089 | ||
1090 | static int alc_init_jacks(struct hda_codec *codec) | |
1091 | { | |
1092 | struct alc_spec *spec = codec->spec; | |
1093 | int err; | |
1094 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; | |
1095 | unsigned int mic_nid = spec->ext_mic.pin; | |
1096 | ||
1097 | if (hp_nid) { | |
1098 | err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE); | |
1099 | if (err < 0) | |
1100 | return err; | |
1101 | alc_report_jack(codec, hp_nid); | |
1102 | } | |
1103 | ||
1104 | if (mic_nid) { | |
1105 | err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE); | |
1106 | if (err < 0) | |
1107 | return err; | |
1108 | alc_report_jack(codec, mic_nid); | |
1109 | } | |
1110 | ||
1111 | return 0; | |
1112 | } | |
1113 | #else | |
1114 | static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) | |
1115 | { | |
1116 | } | |
1117 | ||
1118 | static inline int alc_init_jacks(struct hda_codec *codec) | |
1119 | { | |
1120 | return 0; | |
1121 | } | |
1122 | #endif | |
1123 | ||
1124 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) | |
1125 | { | |
1126 | struct alc_spec *spec = codec->spec; | |
1127 | unsigned int mute; | |
1128 | hda_nid_t nid; | |
1129 | int i; | |
1130 | ||
1131 | spec->jack_present = 0; | |
1132 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { | |
1133 | nid = spec->autocfg.hp_pins[i]; | |
1134 | if (!nid) | |
1135 | break; | |
1136 | if (snd_hda_jack_detect(codec, nid)) { | |
1137 | spec->jack_present = 1; | |
1138 | break; | |
1139 | } | |
1140 | alc_report_jack(codec, spec->autocfg.hp_pins[i]); | |
1141 | } | |
1142 | ||
1143 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; | |
1144 | /* Toggle internal speakers muting */ | |
1145 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { | |
1146 | nid = spec->autocfg.speaker_pins[i]; | |
1147 | if (!nid) | |
1148 | break; | |
1149 | if (pinctl) { | |
1150 | snd_hda_codec_write(codec, nid, 0, | |
1151 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
1152 | spec->jack_present ? 0 : PIN_OUT); | |
1153 | } else { | |
1154 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
1155 | HDA_AMP_MUTE, mute); | |
1156 | } | |
1157 | } | |
1158 | } | |
1159 | ||
1160 | static void alc_automute_pin(struct hda_codec *codec) | |
1161 | { | |
1162 | alc_automute_speaker(codec, 1); | |
1163 | } | |
1164 | ||
1165 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, | |
1166 | hda_nid_t nid) | |
1167 | { | |
1168 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | |
1169 | int i, nums; | |
1170 | ||
1171 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); | |
1172 | for (i = 0; i < nums; i++) | |
1173 | if (conn[i] == nid) | |
1174 | return i; | |
1175 | return -1; | |
1176 | } | |
1177 | ||
1178 | /* switch the current ADC according to the jack state */ | |
1179 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) | |
1180 | { | |
1181 | struct alc_spec *spec = codec->spec; | |
1182 | unsigned int present; | |
1183 | hda_nid_t new_adc; | |
1184 | ||
1185 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); | |
1186 | if (present) | |
1187 | spec->cur_adc_idx = 1; | |
1188 | else | |
1189 | spec->cur_adc_idx = 0; | |
1190 | new_adc = spec->adc_nids[spec->cur_adc_idx]; | |
1191 | if (spec->cur_adc && spec->cur_adc != new_adc) { | |
1192 | /* stream is running, let's swap the current ADC */ | |
1193 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); | |
1194 | spec->cur_adc = new_adc; | |
1195 | snd_hda_codec_setup_stream(codec, new_adc, | |
1196 | spec->cur_adc_stream_tag, 0, | |
1197 | spec->cur_adc_format); | |
1198 | } | |
1199 | } | |
1200 | ||
1201 | static void alc_mic_automute(struct hda_codec *codec) | |
1202 | { | |
1203 | struct alc_spec *spec = codec->spec; | |
1204 | struct alc_mic_route *dead, *alive; | |
1205 | unsigned int present, type; | |
1206 | hda_nid_t cap_nid; | |
1207 | ||
1208 | if (!spec->auto_mic) | |
1209 | return; | |
1210 | if (!spec->int_mic.pin || !spec->ext_mic.pin) | |
1211 | return; | |
1212 | if (snd_BUG_ON(!spec->adc_nids)) | |
1213 | return; | |
1214 | ||
1215 | if (spec->dual_adc_switch) { | |
1216 | alc_dual_mic_adc_auto_switch(codec); | |
1217 | return; | |
1218 | } | |
1219 | ||
1220 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; | |
1221 | ||
1222 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); | |
1223 | if (present) { | |
1224 | alive = &spec->ext_mic; | |
1225 | dead = &spec->int_mic; | |
1226 | } else { | |
1227 | alive = &spec->int_mic; | |
1228 | dead = &spec->ext_mic; | |
1229 | } | |
1230 | ||
1231 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); | |
1232 | if (type == AC_WID_AUD_MIX) { | |
1233 | /* Matrix-mixer style (e.g. ALC882) */ | |
1234 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | |
1235 | alive->mux_idx, | |
1236 | HDA_AMP_MUTE, 0); | |
1237 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | |
1238 | dead->mux_idx, | |
1239 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
1240 | } else { | |
1241 | /* MUX style (e.g. ALC880) */ | |
1242 | snd_hda_codec_write_cache(codec, cap_nid, 0, | |
1243 | AC_VERB_SET_CONNECT_SEL, | |
1244 | alive->mux_idx); | |
1245 | } | |
1246 | alc_report_jack(codec, spec->ext_mic.pin); | |
1247 | ||
1248 | /* FIXME: analog mixer */ | |
1249 | } | |
1250 | ||
1251 | /* unsolicited event for HP jack sensing */ | |
1252 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | |
1253 | { | |
1254 | if (codec->vendor_id == 0x10ec0880) | |
1255 | res >>= 28; | |
1256 | else | |
1257 | res >>= 26; | |
1258 | switch (res) { | |
1259 | case ALC880_HP_EVENT: | |
1260 | alc_automute_pin(codec); | |
1261 | break; | |
1262 | case ALC880_MIC_EVENT: | |
1263 | alc_mic_automute(codec); | |
1264 | break; | |
1265 | } | |
1266 | } | |
1267 | ||
1268 | static void alc_inithook(struct hda_codec *codec) | |
1269 | { | |
1270 | alc_automute_pin(codec); | |
1271 | alc_mic_automute(codec); | |
1272 | } | |
1273 | ||
1274 | /* additional initialization for ALC888 variants */ | |
1275 | static void alc888_coef_init(struct hda_codec *codec) | |
1276 | { | |
1277 | unsigned int tmp; | |
1278 | ||
1279 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); | |
1280 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
1281 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1282 | if ((tmp & 0xf0) == 0x20) | |
1283 | /* alc888S-VC */ | |
1284 | snd_hda_codec_read(codec, 0x20, 0, | |
1285 | AC_VERB_SET_PROC_COEF, 0x830); | |
1286 | else | |
1287 | /* alc888-VB */ | |
1288 | snd_hda_codec_read(codec, 0x20, 0, | |
1289 | AC_VERB_SET_PROC_COEF, 0x3030); | |
1290 | } | |
1291 | ||
1292 | static void alc889_coef_init(struct hda_codec *codec) | |
1293 | { | |
1294 | unsigned int tmp; | |
1295 | ||
1296 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1297 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
1298 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1299 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); | |
1300 | } | |
1301 | ||
1302 | /* turn on/off EAPD control (only if available) */ | |
1303 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) | |
1304 | { | |
1305 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) | |
1306 | return; | |
1307 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) | |
1308 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
1309 | on ? 2 : 0); | |
1310 | } | |
1311 | ||
1312 | static void alc_auto_init_amp(struct hda_codec *codec, int type) | |
1313 | { | |
1314 | unsigned int tmp; | |
1315 | ||
1316 | switch (type) { | |
1317 | case ALC_INIT_GPIO1: | |
1318 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); | |
1319 | break; | |
1320 | case ALC_INIT_GPIO2: | |
1321 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); | |
1322 | break; | |
1323 | case ALC_INIT_GPIO3: | |
1324 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); | |
1325 | break; | |
1326 | case ALC_INIT_DEFAULT: | |
1327 | switch (codec->vendor_id) { | |
1328 | case 0x10ec0260: | |
1329 | set_eapd(codec, 0x0f, 1); | |
1330 | set_eapd(codec, 0x10, 1); | |
1331 | break; | |
1332 | case 0x10ec0262: | |
1333 | case 0x10ec0267: | |
1334 | case 0x10ec0268: | |
1335 | case 0x10ec0269: | |
1336 | case 0x10ec0270: | |
1337 | case 0x10ec0272: | |
1338 | case 0x10ec0660: | |
1339 | case 0x10ec0662: | |
1340 | case 0x10ec0663: | |
1341 | case 0x10ec0862: | |
1342 | case 0x10ec0889: | |
1343 | set_eapd(codec, 0x14, 1); | |
1344 | set_eapd(codec, 0x15, 1); | |
1345 | break; | |
1346 | } | |
1347 | switch (codec->vendor_id) { | |
1348 | case 0x10ec0260: | |
1349 | snd_hda_codec_write(codec, 0x1a, 0, | |
1350 | AC_VERB_SET_COEF_INDEX, 7); | |
1351 | tmp = snd_hda_codec_read(codec, 0x1a, 0, | |
1352 | AC_VERB_GET_PROC_COEF, 0); | |
1353 | snd_hda_codec_write(codec, 0x1a, 0, | |
1354 | AC_VERB_SET_COEF_INDEX, 7); | |
1355 | snd_hda_codec_write(codec, 0x1a, 0, | |
1356 | AC_VERB_SET_PROC_COEF, | |
1357 | tmp | 0x2010); | |
1358 | break; | |
1359 | case 0x10ec0262: | |
1360 | case 0x10ec0880: | |
1361 | case 0x10ec0882: | |
1362 | case 0x10ec0883: | |
1363 | case 0x10ec0885: | |
1364 | case 0x10ec0887: | |
1365 | case 0x10ec0889: | |
1366 | alc889_coef_init(codec); | |
1367 | break; | |
1368 | case 0x10ec0888: | |
1369 | alc888_coef_init(codec); | |
1370 | break; | |
1371 | #if 0 /* XXX: This may cause the silent output on speaker on some machines */ | |
1372 | case 0x10ec0267: | |
1373 | case 0x10ec0268: | |
1374 | snd_hda_codec_write(codec, 0x20, 0, | |
1375 | AC_VERB_SET_COEF_INDEX, 7); | |
1376 | tmp = snd_hda_codec_read(codec, 0x20, 0, | |
1377 | AC_VERB_GET_PROC_COEF, 0); | |
1378 | snd_hda_codec_write(codec, 0x20, 0, | |
1379 | AC_VERB_SET_COEF_INDEX, 7); | |
1380 | snd_hda_codec_write(codec, 0x20, 0, | |
1381 | AC_VERB_SET_PROC_COEF, | |
1382 | tmp | 0x3000); | |
1383 | break; | |
1384 | #endif /* XXX */ | |
1385 | } | |
1386 | break; | |
1387 | } | |
1388 | } | |
1389 | ||
1390 | static void alc_init_auto_hp(struct hda_codec *codec) | |
1391 | { | |
1392 | struct alc_spec *spec = codec->spec; | |
1393 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
1394 | int i; | |
1395 | ||
1396 | if (!cfg->hp_pins[0]) { | |
1397 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) | |
1398 | return; | |
1399 | } | |
1400 | ||
1401 | if (!cfg->speaker_pins[0]) { | |
1402 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) | |
1403 | return; | |
1404 | memcpy(cfg->speaker_pins, cfg->line_out_pins, | |
1405 | sizeof(cfg->speaker_pins)); | |
1406 | cfg->speaker_outs = cfg->line_outs; | |
1407 | } | |
1408 | ||
1409 | if (!cfg->hp_pins[0]) { | |
1410 | memcpy(cfg->hp_pins, cfg->line_out_pins, | |
1411 | sizeof(cfg->hp_pins)); | |
1412 | cfg->hp_outs = cfg->line_outs; | |
1413 | } | |
1414 | ||
1415 | for (i = 0; i < cfg->hp_outs; i++) { | |
1416 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", | |
1417 | cfg->hp_pins[i]); | |
1418 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, | |
1419 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
1420 | AC_USRSP_EN | ALC880_HP_EVENT); | |
1421 | } | |
1422 | spec->unsol_event = alc_sku_unsol_event; | |
1423 | } | |
1424 | ||
1425 | static void alc_init_auto_mic(struct hda_codec *codec) | |
1426 | { | |
1427 | struct alc_spec *spec = codec->spec; | |
1428 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
1429 | hda_nid_t fixed, ext; | |
1430 | int i; | |
1431 | ||
1432 | /* there must be only two mic inputs exclusively */ | |
1433 | for (i = 0; i < cfg->num_inputs; i++) | |
1434 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) | |
1435 | return; | |
1436 | ||
1437 | fixed = ext = 0; | |
1438 | for (i = 0; i < cfg->num_inputs; i++) { | |
1439 | hda_nid_t nid = cfg->inputs[i].pin; | |
1440 | unsigned int defcfg; | |
1441 | defcfg = snd_hda_codec_get_pincfg(codec, nid); | |
1442 | switch (snd_hda_get_input_pin_attr(defcfg)) { | |
1443 | case INPUT_PIN_ATTR_INT: | |
1444 | if (fixed) | |
1445 | return; /* already occupied */ | |
1446 | fixed = nid; | |
1447 | break; | |
1448 | case INPUT_PIN_ATTR_UNUSED: | |
1449 | return; /* invalid entry */ | |
1450 | default: | |
1451 | if (ext) | |
1452 | return; /* already occupied */ | |
1453 | ext = nid; | |
1454 | break; | |
1455 | } | |
1456 | } | |
1457 | if (!ext || !fixed) | |
1458 | return; | |
1459 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) | |
1460 | return; /* no unsol support */ | |
1461 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", | |
1462 | ext, fixed); | |
1463 | spec->ext_mic.pin = ext; | |
1464 | spec->int_mic.pin = fixed; | |
1465 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | |
1466 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | |
1467 | spec->auto_mic = 1; | |
1468 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, | |
1469 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
1470 | AC_USRSP_EN | ALC880_MIC_EVENT); | |
1471 | spec->unsol_event = alc_sku_unsol_event; | |
1472 | } | |
1473 | ||
1474 | /* Could be any non-zero and even value. When used as fixup, tells | |
1475 | * the driver to ignore any present sku defines. | |
1476 | */ | |
1477 | #define ALC_FIXUP_SKU_IGNORE (2) | |
1478 | ||
1479 | static int alc_auto_parse_customize_define(struct hda_codec *codec) | |
1480 | { | |
1481 | unsigned int ass, tmp, i; | |
1482 | unsigned nid = 0; | |
1483 | struct alc_spec *spec = codec->spec; | |
1484 | ||
1485 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ | |
1486 | ||
1487 | if (spec->cdefine.fixup) { | |
1488 | ass = spec->cdefine.sku_cfg; | |
1489 | if (ass == ALC_FIXUP_SKU_IGNORE) | |
1490 | return -1; | |
1491 | goto do_sku; | |
1492 | } | |
1493 | ||
1494 | ass = codec->subsystem_id & 0xffff; | |
1495 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) | |
1496 | goto do_sku; | |
1497 | ||
1498 | nid = 0x1d; | |
1499 | if (codec->vendor_id == 0x10ec0260) | |
1500 | nid = 0x17; | |
1501 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
1502 | ||
1503 | if (!(ass & 1)) { | |
1504 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", | |
1505 | codec->chip_name, ass); | |
1506 | return -1; | |
1507 | } | |
1508 | ||
1509 | /* check sum */ | |
1510 | tmp = 0; | |
1511 | for (i = 1; i < 16; i++) { | |
1512 | if ((ass >> i) & 1) | |
1513 | tmp++; | |
1514 | } | |
1515 | if (((ass >> 16) & 0xf) != tmp) | |
1516 | return -1; | |
1517 | ||
1518 | spec->cdefine.port_connectivity = ass >> 30; | |
1519 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; | |
1520 | spec->cdefine.check_sum = (ass >> 16) & 0xf; | |
1521 | spec->cdefine.customization = ass >> 8; | |
1522 | do_sku: | |
1523 | spec->cdefine.sku_cfg = ass; | |
1524 | spec->cdefine.external_amp = (ass & 0x38) >> 3; | |
1525 | spec->cdefine.platform_type = (ass & 0x4) >> 2; | |
1526 | spec->cdefine.swap = (ass & 0x2) >> 1; | |
1527 | spec->cdefine.override = ass & 0x1; | |
1528 | ||
1529 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", | |
1530 | nid, spec->cdefine.sku_cfg); | |
1531 | snd_printd("SKU: port_connectivity=0x%x\n", | |
1532 | spec->cdefine.port_connectivity); | |
1533 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); | |
1534 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); | |
1535 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); | |
1536 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); | |
1537 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); | |
1538 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); | |
1539 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); | |
1540 | ||
1541 | return 0; | |
1542 | } | |
1543 | ||
1544 | /* check subsystem ID and set up device-specific initialization; | |
1545 | * return 1 if initialized, 0 if invalid SSID | |
1546 | */ | |
1547 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. | |
1548 | * 31 ~ 16 : Manufacture ID | |
1549 | * 15 ~ 8 : SKU ID | |
1550 | * 7 ~ 0 : Assembly ID | |
1551 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 | |
1552 | */ | |
1553 | static int alc_subsystem_id(struct hda_codec *codec, | |
1554 | hda_nid_t porta, hda_nid_t porte, | |
1555 | hda_nid_t portd, hda_nid_t porti) | |
1556 | { | |
1557 | unsigned int ass, tmp, i; | |
1558 | unsigned nid; | |
1559 | struct alc_spec *spec = codec->spec; | |
1560 | ||
1561 | if (spec->cdefine.fixup) { | |
1562 | ass = spec->cdefine.sku_cfg; | |
1563 | if (ass == ALC_FIXUP_SKU_IGNORE) | |
1564 | return 0; | |
1565 | goto do_sku; | |
1566 | } | |
1567 | ||
1568 | ass = codec->subsystem_id & 0xffff; | |
1569 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) | |
1570 | goto do_sku; | |
1571 | ||
1572 | /* invalid SSID, check the special NID pin defcfg instead */ | |
1573 | /* | |
1574 | * 31~30 : port connectivity | |
1575 | * 29~21 : reserve | |
1576 | * 20 : PCBEEP input | |
1577 | * 19~16 : Check sum (15:1) | |
1578 | * 15~1 : Custom | |
1579 | * 0 : override | |
1580 | */ | |
1581 | nid = 0x1d; | |
1582 | if (codec->vendor_id == 0x10ec0260) | |
1583 | nid = 0x17; | |
1584 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
1585 | snd_printd("realtek: No valid SSID, " | |
1586 | "checking pincfg 0x%08x for NID 0x%x\n", | |
1587 | ass, nid); | |
1588 | if (!(ass & 1)) | |
1589 | return 0; | |
1590 | if ((ass >> 30) != 1) /* no physical connection */ | |
1591 | return 0; | |
1592 | ||
1593 | /* check sum */ | |
1594 | tmp = 0; | |
1595 | for (i = 1; i < 16; i++) { | |
1596 | if ((ass >> i) & 1) | |
1597 | tmp++; | |
1598 | } | |
1599 | if (((ass >> 16) & 0xf) != tmp) | |
1600 | return 0; | |
1601 | do_sku: | |
1602 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", | |
1603 | ass & 0xffff, codec->vendor_id); | |
1604 | /* | |
1605 | * 0 : override | |
1606 | * 1 : Swap Jack | |
1607 | * 2 : 0 --> Desktop, 1 --> Laptop | |
1608 | * 3~5 : External Amplifier control | |
1609 | * 7~6 : Reserved | |
1610 | */ | |
1611 | tmp = (ass & 0x38) >> 3; /* external Amp control */ | |
1612 | switch (tmp) { | |
1613 | case 1: | |
1614 | spec->init_amp = ALC_INIT_GPIO1; | |
1615 | break; | |
1616 | case 3: | |
1617 | spec->init_amp = ALC_INIT_GPIO2; | |
1618 | break; | |
1619 | case 7: | |
1620 | spec->init_amp = ALC_INIT_GPIO3; | |
1621 | break; | |
1622 | case 5: | |
1623 | default: | |
1624 | spec->init_amp = ALC_INIT_DEFAULT; | |
1625 | break; | |
1626 | } | |
1627 | ||
1628 | /* is laptop or Desktop and enable the function "Mute internal speaker | |
1629 | * when the external headphone out jack is plugged" | |
1630 | */ | |
1631 | if (!(ass & 0x8000)) | |
1632 | return 1; | |
1633 | /* | |
1634 | * 10~8 : Jack location | |
1635 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered | |
1636 | * 14~13: Resvered | |
1637 | * 15 : 1 --> enable the function "Mute internal speaker | |
1638 | * when the external headphone out jack is plugged" | |
1639 | */ | |
1640 | if (!spec->autocfg.hp_pins[0]) { | |
1641 | hda_nid_t nid; | |
1642 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ | |
1643 | if (tmp == 0) | |
1644 | nid = porta; | |
1645 | else if (tmp == 1) | |
1646 | nid = porte; | |
1647 | else if (tmp == 2) | |
1648 | nid = portd; | |
1649 | else if (tmp == 3) | |
1650 | nid = porti; | |
1651 | else | |
1652 | return 1; | |
1653 | for (i = 0; i < spec->autocfg.line_outs; i++) | |
1654 | if (spec->autocfg.line_out_pins[i] == nid) | |
1655 | return 1; | |
1656 | spec->autocfg.hp_pins[0] = nid; | |
1657 | } | |
1658 | ||
1659 | alc_init_auto_hp(codec); | |
1660 | alc_init_auto_mic(codec); | |
1661 | return 1; | |
1662 | } | |
1663 | ||
1664 | static void alc_ssid_check(struct hda_codec *codec, | |
1665 | hda_nid_t porta, hda_nid_t porte, | |
1666 | hda_nid_t portd, hda_nid_t porti) | |
1667 | { | |
1668 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { | |
1669 | struct alc_spec *spec = codec->spec; | |
1670 | snd_printd("realtek: " | |
1671 | "Enable default setup for auto mode as fallback\n"); | |
1672 | spec->init_amp = ALC_INIT_DEFAULT; | |
1673 | alc_init_auto_hp(codec); | |
1674 | alc_init_auto_mic(codec); | |
1675 | } | |
1676 | } | |
1677 | ||
1678 | /* | |
1679 | * Fix-up pin default configurations and add default verbs | |
1680 | */ | |
1681 | ||
1682 | struct alc_pincfg { | |
1683 | hda_nid_t nid; | |
1684 | u32 val; | |
1685 | }; | |
1686 | ||
1687 | struct alc_model_fixup { | |
1688 | const int id; | |
1689 | const char *name; | |
1690 | }; | |
1691 | ||
1692 | struct alc_fixup { | |
1693 | int type; | |
1694 | bool chained; | |
1695 | int chain_id; | |
1696 | union { | |
1697 | unsigned int sku; | |
1698 | const struct alc_pincfg *pins; | |
1699 | const struct hda_verb *verbs; | |
1700 | void (*func)(struct hda_codec *codec, | |
1701 | const struct alc_fixup *fix, | |
1702 | int action); | |
1703 | } v; | |
1704 | }; | |
1705 | ||
1706 | enum { | |
1707 | ALC_FIXUP_INVALID, | |
1708 | ALC_FIXUP_SKU, | |
1709 | ALC_FIXUP_PINS, | |
1710 | ALC_FIXUP_VERBS, | |
1711 | ALC_FIXUP_FUNC, | |
1712 | }; | |
1713 | ||
1714 | enum { | |
1715 | ALC_FIXUP_ACT_PRE_PROBE, | |
1716 | ALC_FIXUP_ACT_PROBE, | |
1717 | ALC_FIXUP_ACT_INIT, | |
1718 | }; | |
1719 | ||
1720 | static void alc_apply_fixup(struct hda_codec *codec, int action) | |
1721 | { | |
1722 | struct alc_spec *spec = codec->spec; | |
1723 | int id = spec->fixup_id; | |
1724 | #ifdef CONFIG_SND_DEBUG_VERBOSE | |
1725 | const char *modelname = spec->fixup_name; | |
1726 | #endif | |
1727 | int depth = 0; | |
1728 | ||
1729 | if (!spec->fixup_list) | |
1730 | return; | |
1731 | ||
1732 | while (id >= 0) { | |
1733 | const struct alc_fixup *fix = spec->fixup_list + id; | |
1734 | const struct alc_pincfg *cfg; | |
1735 | ||
1736 | switch (fix->type) { | |
1737 | case ALC_FIXUP_SKU: | |
1738 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) | |
1739 | break;; | |
1740 | snd_printdd(KERN_INFO "hda_codec: %s: " | |
1741 | "Apply sku override for %s\n", | |
1742 | codec->chip_name, modelname); | |
1743 | spec->cdefine.sku_cfg = fix->v.sku; | |
1744 | spec->cdefine.fixup = 1; | |
1745 | break; | |
1746 | case ALC_FIXUP_PINS: | |
1747 | cfg = fix->v.pins; | |
1748 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg) | |
1749 | break; | |
1750 | snd_printdd(KERN_INFO "hda_codec: %s: " | |
1751 | "Apply pincfg for %s\n", | |
1752 | codec->chip_name, modelname); | |
1753 | for (; cfg->nid; cfg++) | |
1754 | snd_hda_codec_set_pincfg(codec, cfg->nid, | |
1755 | cfg->val); | |
1756 | break; | |
1757 | case ALC_FIXUP_VERBS: | |
1758 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) | |
1759 | break; | |
1760 | snd_printdd(KERN_INFO "hda_codec: %s: " | |
1761 | "Apply fix-verbs for %s\n", | |
1762 | codec->chip_name, modelname); | |
1763 | add_verb(codec->spec, fix->v.verbs); | |
1764 | break; | |
1765 | case ALC_FIXUP_FUNC: | |
1766 | if (!fix->v.func) | |
1767 | break; | |
1768 | snd_printdd(KERN_INFO "hda_codec: %s: " | |
1769 | "Apply fix-func for %s\n", | |
1770 | codec->chip_name, modelname); | |
1771 | fix->v.func(codec, fix, action); | |
1772 | break; | |
1773 | default: | |
1774 | snd_printk(KERN_ERR "hda_codec: %s: " | |
1775 | "Invalid fixup type %d\n", | |
1776 | codec->chip_name, fix->type); | |
1777 | break; | |
1778 | } | |
1779 | if (!fix[id].chained) | |
1780 | break; | |
1781 | if (++depth > 10) | |
1782 | break; | |
1783 | id = fix[id].chain_id; | |
1784 | } | |
1785 | } | |
1786 | ||
1787 | static void alc_pick_fixup(struct hda_codec *codec, | |
1788 | const struct alc_model_fixup *models, | |
1789 | const struct snd_pci_quirk *quirk, | |
1790 | const struct alc_fixup *fixlist) | |
1791 | { | |
1792 | struct alc_spec *spec = codec->spec; | |
1793 | int id = -1; | |
1794 | const char *name = NULL; | |
1795 | ||
1796 | if (codec->modelname && models) { | |
1797 | while (models->name) { | |
1798 | if (!strcmp(codec->modelname, models->name)) { | |
1799 | id = models->id; | |
1800 | name = models->name; | |
1801 | break; | |
1802 | } | |
1803 | models++; | |
1804 | } | |
1805 | } | |
1806 | if (id < 0) { | |
1807 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | |
1808 | if (quirk) { | |
1809 | id = quirk->value; | |
1810 | #ifdef CONFIG_SND_DEBUG_VERBOSE | |
1811 | name = quirk->name; | |
1812 | #endif | |
1813 | } | |
1814 | } | |
1815 | ||
1816 | spec->fixup_id = id; | |
1817 | if (id >= 0) { | |
1818 | spec->fixup_list = fixlist; | |
1819 | spec->fixup_name = name; | |
1820 | } | |
1821 | } | |
1822 | ||
1823 | static int alc_read_coef_idx(struct hda_codec *codec, | |
1824 | unsigned int coef_idx) | |
1825 | { | |
1826 | unsigned int val; | |
1827 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, | |
1828 | coef_idx); | |
1829 | val = snd_hda_codec_read(codec, 0x20, 0, | |
1830 | AC_VERB_GET_PROC_COEF, 0); | |
1831 | return val; | |
1832 | } | |
1833 | ||
1834 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, | |
1835 | unsigned int coef_val) | |
1836 | { | |
1837 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, | |
1838 | coef_idx); | |
1839 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, | |
1840 | coef_val); | |
1841 | } | |
1842 | ||
1843 | /* set right pin controls for digital I/O */ | |
1844 | static void alc_auto_init_digital(struct hda_codec *codec) | |
1845 | { | |
1846 | struct alc_spec *spec = codec->spec; | |
1847 | int i; | |
1848 | hda_nid_t pin; | |
1849 | ||
1850 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | |
1851 | pin = spec->autocfg.dig_out_pins[i]; | |
1852 | if (pin) { | |
1853 | snd_hda_codec_write(codec, pin, 0, | |
1854 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
1855 | PIN_OUT); | |
1856 | } | |
1857 | } | |
1858 | pin = spec->autocfg.dig_in_pin; | |
1859 | if (pin) | |
1860 | snd_hda_codec_write(codec, pin, 0, | |
1861 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
1862 | PIN_IN); | |
1863 | } | |
1864 | ||
1865 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ | |
1866 | static void alc_auto_parse_digital(struct hda_codec *codec) | |
1867 | { | |
1868 | struct alc_spec *spec = codec->spec; | |
1869 | int i, err; | |
1870 | hda_nid_t dig_nid; | |
1871 | ||
1872 | /* support multiple SPDIFs; the secondary is set up as a slave */ | |
1873 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | |
1874 | err = snd_hda_get_connections(codec, | |
1875 | spec->autocfg.dig_out_pins[i], | |
1876 | &dig_nid, 1); | |
1877 | if (err < 0) | |
1878 | continue; | |
1879 | if (!i) { | |
1880 | spec->multiout.dig_out_nid = dig_nid; | |
1881 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | |
1882 | } else { | |
1883 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | |
1884 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) | |
1885 | break; | |
1886 | spec->slave_dig_outs[i - 1] = dig_nid; | |
1887 | } | |
1888 | } | |
1889 | ||
1890 | if (spec->autocfg.dig_in_pin) { | |
1891 | dig_nid = codec->start_nid; | |
1892 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { | |
1893 | unsigned int wcaps = get_wcaps(codec, dig_nid); | |
1894 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) | |
1895 | continue; | |
1896 | if (!(wcaps & AC_WCAP_DIGITAL)) | |
1897 | continue; | |
1898 | if (!(wcaps & AC_WCAP_CONN_LIST)) | |
1899 | continue; | |
1900 | err = get_connection_index(codec, dig_nid, | |
1901 | spec->autocfg.dig_in_pin); | |
1902 | if (err >= 0) { | |
1903 | spec->dig_in_nid = dig_nid; | |
1904 | break; | |
1905 | } | |
1906 | } | |
1907 | } | |
1908 | } | |
1909 | ||
1910 | /* | |
1911 | * ALC888 | |
1912 | */ | |
1913 | ||
1914 | /* | |
1915 | * 2ch mode | |
1916 | */ | |
1917 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { | |
1918 | /* Mic-in jack as mic in */ | |
1919 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1920 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1921 | /* Line-in jack as Line in */ | |
1922 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1923 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1924 | /* Line-Out as Front */ | |
1925 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1926 | { } /* end */ | |
1927 | }; | |
1928 | ||
1929 | /* | |
1930 | * 4ch mode | |
1931 | */ | |
1932 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { | |
1933 | /* Mic-in jack as mic in */ | |
1934 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1935 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1936 | /* Line-in jack as Surround */ | |
1937 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1938 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1939 | /* Line-Out as Front */ | |
1940 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1941 | { } /* end */ | |
1942 | }; | |
1943 | ||
1944 | /* | |
1945 | * 6ch mode | |
1946 | */ | |
1947 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { | |
1948 | /* Mic-in jack as CLFE */ | |
1949 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1950 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1951 | /* Line-in jack as Surround */ | |
1952 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1953 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1954 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ | |
1955 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1956 | { } /* end */ | |
1957 | }; | |
1958 | ||
1959 | /* | |
1960 | * 8ch mode | |
1961 | */ | |
1962 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { | |
1963 | /* Mic-in jack as CLFE */ | |
1964 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1965 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1966 | /* Line-in jack as Surround */ | |
1967 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1968 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1969 | /* Line-Out as Side */ | |
1970 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1971 | { } /* end */ | |
1972 | }; | |
1973 | ||
1974 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { | |
1975 | { 2, alc888_4ST_ch2_intel_init }, | |
1976 | { 4, alc888_4ST_ch4_intel_init }, | |
1977 | { 6, alc888_4ST_ch6_intel_init }, | |
1978 | { 8, alc888_4ST_ch8_intel_init }, | |
1979 | }; | |
1980 | ||
1981 | /* | |
1982 | * ALC888 Fujitsu Siemens Amillo xa3530 | |
1983 | */ | |
1984 | ||
1985 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { | |
1986 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1987 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1988 | /* Connect Internal HP to Front */ | |
1989 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1990 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1991 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1992 | /* Connect Bass HP to Front */ | |
1993 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1994 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1995 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1996 | /* Connect Line-Out side jack (SPDIF) to Side */ | |
1997 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1998 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1999 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
2000 | /* Connect Mic jack to CLFE */ | |
2001 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2002 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2003 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
2004 | /* Connect Line-in jack to Surround */ | |
2005 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2006 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2007 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2008 | /* Connect HP out jack to Front */ | |
2009 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2010 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2011 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2012 | /* Enable unsolicited event for HP jack and Line-out jack */ | |
2013 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
2014 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
2015 | {} | |
2016 | }; | |
2017 | ||
2018 | static void alc_automute_amp(struct hda_codec *codec) | |
2019 | { | |
2020 | alc_automute_speaker(codec, 0); | |
2021 | } | |
2022 | ||
2023 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, | |
2024 | unsigned int res) | |
2025 | { | |
2026 | if (codec->vendor_id == 0x10ec0880) | |
2027 | res >>= 28; | |
2028 | else | |
2029 | res >>= 26; | |
2030 | if (res == ALC880_HP_EVENT) | |
2031 | alc_automute_amp(codec); | |
2032 | } | |
2033 | ||
2034 | static void alc889_automute_setup(struct hda_codec *codec) | |
2035 | { | |
2036 | struct alc_spec *spec = codec->spec; | |
2037 | ||
2038 | spec->autocfg.hp_pins[0] = 0x15; | |
2039 | spec->autocfg.speaker_pins[0] = 0x14; | |
2040 | spec->autocfg.speaker_pins[1] = 0x16; | |
2041 | spec->autocfg.speaker_pins[2] = 0x17; | |
2042 | spec->autocfg.speaker_pins[3] = 0x19; | |
2043 | spec->autocfg.speaker_pins[4] = 0x1a; | |
2044 | } | |
2045 | ||
2046 | static void alc889_intel_init_hook(struct hda_codec *codec) | |
2047 | { | |
2048 | alc889_coef_init(codec); | |
2049 | alc_automute_amp(codec); | |
2050 | } | |
2051 | ||
2052 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) | |
2053 | { | |
2054 | struct alc_spec *spec = codec->spec; | |
2055 | ||
2056 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ | |
2057 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ | |
2058 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ | |
2059 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ | |
2060 | } | |
2061 | ||
2062 | /* | |
2063 | * ALC888 Acer Aspire 4930G model | |
2064 | */ | |
2065 | ||
2066 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { | |
2067 | /* Front Mic: set to PIN_IN (empty by default) */ | |
2068 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2069 | /* Unselect Front Mic by default in input mixer 3 */ | |
2070 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
2071 | /* Enable unsolicited event for HP jack */ | |
2072 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
2073 | /* Connect Internal HP to front */ | |
2074 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2075 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2076 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2077 | /* Connect HP out to front */ | |
2078 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2079 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2080 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2081 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
2082 | { } | |
2083 | }; | |
2084 | ||
2085 | /* | |
2086 | * ALC888 Acer Aspire 6530G model | |
2087 | */ | |
2088 | ||
2089 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { | |
2090 | /* Route to built-in subwoofer as well as speakers */ | |
2091 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2092 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2093 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2094 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2095 | /* Bias voltage on for external mic port */ | |
2096 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, | |
2097 | /* Front Mic: set to PIN_IN (empty by default) */ | |
2098 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2099 | /* Unselect Front Mic by default in input mixer 3 */ | |
2100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
2101 | /* Enable unsolicited event for HP jack */ | |
2102 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
2103 | /* Enable speaker output */ | |
2104 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2105 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2106 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
2107 | /* Enable headphone output */ | |
2108 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | |
2109 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2110 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2111 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
2112 | { } | |
2113 | }; | |
2114 | ||
2115 | /* | |
2116 | *ALC888 Acer Aspire 7730G model | |
2117 | */ | |
2118 | ||
2119 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { | |
2120 | /* Bias voltage on for external mic port */ | |
2121 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, | |
2122 | /* Front Mic: set to PIN_IN (empty by default) */ | |
2123 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2124 | /* Unselect Front Mic by default in input mixer 3 */ | |
2125 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
2126 | /* Enable unsolicited event for HP jack */ | |
2127 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
2128 | /* Enable speaker output */ | |
2129 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2130 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2131 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
2132 | /* Enable headphone output */ | |
2133 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | |
2134 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2135 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2136 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
2137 | /*Enable internal subwoofer */ | |
2138 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2139 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2140 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
2141 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
2142 | { } | |
2143 | }; | |
2144 | ||
2145 | /* | |
2146 | * ALC889 Acer Aspire 8930G model | |
2147 | */ | |
2148 | ||
2149 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { | |
2150 | /* Front Mic: set to PIN_IN (empty by default) */ | |
2151 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2152 | /* Unselect Front Mic by default in input mixer 3 */ | |
2153 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
2154 | /* Enable unsolicited event for HP jack */ | |
2155 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
2156 | /* Connect Internal Front to Front */ | |
2157 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2158 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2159 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2160 | /* Connect Internal Rear to Rear */ | |
2161 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2162 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2163 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2164 | /* Connect Internal CLFE to CLFE */ | |
2165 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2166 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2167 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
2168 | /* Connect HP out to Front */ | |
2169 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | |
2170 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2171 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2172 | /* Enable all DACs */ | |
2173 | /* DAC DISABLE/MUTE 1? */ | |
2174 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ | |
2175 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, | |
2176 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | |
2177 | /* DAC DISABLE/MUTE 2? */ | |
2178 | /* some bit here disables the other DACs. Init=0x4900 */ | |
2179 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | |
2180 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | |
2181 | /* DMIC fix | |
2182 | * This laptop has a stereo digital microphone. The mics are only 1cm apart | |
2183 | * which makes the stereo useless. However, either the mic or the ALC889 | |
2184 | * makes the signal become a difference/sum signal instead of standard | |
2185 | * stereo, which is annoying. So instead we flip this bit which makes the | |
2186 | * codec replicate the sum signal to both channels, turning it into a | |
2187 | * normal mono mic. | |
2188 | */ | |
2189 | /* DMIC_CONTROL? Init value = 0x0001 */ | |
2190 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
2191 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, | |
2192 | { } | |
2193 | }; | |
2194 | ||
2195 | static struct hda_input_mux alc888_2_capture_sources[2] = { | |
2196 | /* Front mic only available on one ADC */ | |
2197 | { | |
2198 | .num_items = 4, | |
2199 | .items = { | |
2200 | { "Mic", 0x0 }, | |
2201 | { "Line", 0x2 }, | |
2202 | { "CD", 0x4 }, | |
2203 | { "Front Mic", 0xb }, | |
2204 | }, | |
2205 | }, | |
2206 | { | |
2207 | .num_items = 3, | |
2208 | .items = { | |
2209 | { "Mic", 0x0 }, | |
2210 | { "Line", 0x2 }, | |
2211 | { "CD", 0x4 }, | |
2212 | }, | |
2213 | } | |
2214 | }; | |
2215 | ||
2216 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { | |
2217 | /* Interal mic only available on one ADC */ | |
2218 | { | |
2219 | .num_items = 5, | |
2220 | .items = { | |
2221 | { "Mic", 0x0 }, | |
2222 | { "Line In", 0x2 }, | |
2223 | { "CD", 0x4 }, | |
2224 | { "Input Mix", 0xa }, | |
2225 | { "Internal Mic", 0xb }, | |
2226 | }, | |
2227 | }, | |
2228 | { | |
2229 | .num_items = 4, | |
2230 | .items = { | |
2231 | { "Mic", 0x0 }, | |
2232 | { "Line In", 0x2 }, | |
2233 | { "CD", 0x4 }, | |
2234 | { "Input Mix", 0xa }, | |
2235 | }, | |
2236 | } | |
2237 | }; | |
2238 | ||
2239 | static struct hda_input_mux alc889_capture_sources[3] = { | |
2240 | /* Digital mic only available on first "ADC" */ | |
2241 | { | |
2242 | .num_items = 5, | |
2243 | .items = { | |
2244 | { "Mic", 0x0 }, | |
2245 | { "Line", 0x2 }, | |
2246 | { "CD", 0x4 }, | |
2247 | { "Front Mic", 0xb }, | |
2248 | { "Input Mix", 0xa }, | |
2249 | }, | |
2250 | }, | |
2251 | { | |
2252 | .num_items = 4, | |
2253 | .items = { | |
2254 | { "Mic", 0x0 }, | |
2255 | { "Line", 0x2 }, | |
2256 | { "CD", 0x4 }, | |
2257 | { "Input Mix", 0xa }, | |
2258 | }, | |
2259 | }, | |
2260 | { | |
2261 | .num_items = 4, | |
2262 | .items = { | |
2263 | { "Mic", 0x0 }, | |
2264 | { "Line", 0x2 }, | |
2265 | { "CD", 0x4 }, | |
2266 | { "Input Mix", 0xa }, | |
2267 | }, | |
2268 | } | |
2269 | }; | |
2270 | ||
2271 | static struct snd_kcontrol_new alc888_base_mixer[] = { | |
2272 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2273 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2274 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2275 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2276 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
2277 | HDA_OUTPUT), | |
2278 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2279 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2280 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2281 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
2282 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2283 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2284 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2285 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2286 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2287 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2288 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
2289 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2290 | { } /* end */ | |
2291 | }; | |
2292 | ||
2293 | static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { | |
2294 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2295 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2296 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2297 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2298 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0f, 2, 0x0, | |
2299 | HDA_OUTPUT), | |
2300 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0f, 2, 2, HDA_INPUT), | |
2301 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), | |
2302 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT), | |
2303 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
2304 | HDA_BIND_MUTE("Side Playback Switch", 0x0e, 2, HDA_INPUT), | |
2305 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2306 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2307 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2308 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2309 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2310 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
2311 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2312 | { } /* end */ | |
2313 | }; | |
2314 | ||
2315 | ||
2316 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { | |
2317 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2318 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2319 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2320 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2321 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
2322 | HDA_OUTPUT), | |
2323 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2324 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2325 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2326 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2327 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2328 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2329 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
2330 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2331 | { } /* end */ | |
2332 | }; | |
2333 | ||
2334 | ||
2335 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) | |
2336 | { | |
2337 | struct alc_spec *spec = codec->spec; | |
2338 | ||
2339 | spec->autocfg.hp_pins[0] = 0x15; | |
2340 | spec->autocfg.speaker_pins[0] = 0x14; | |
2341 | spec->autocfg.speaker_pins[1] = 0x16; | |
2342 | spec->autocfg.speaker_pins[2] = 0x17; | |
2343 | } | |
2344 | ||
2345 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) | |
2346 | { | |
2347 | struct alc_spec *spec = codec->spec; | |
2348 | ||
2349 | spec->autocfg.hp_pins[0] = 0x15; | |
2350 | spec->autocfg.speaker_pins[0] = 0x14; | |
2351 | spec->autocfg.speaker_pins[1] = 0x16; | |
2352 | spec->autocfg.speaker_pins[2] = 0x17; | |
2353 | } | |
2354 | ||
2355 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) | |
2356 | { | |
2357 | struct alc_spec *spec = codec->spec; | |
2358 | ||
2359 | spec->autocfg.hp_pins[0] = 0x15; | |
2360 | spec->autocfg.speaker_pins[0] = 0x14; | |
2361 | spec->autocfg.speaker_pins[1] = 0x16; | |
2362 | spec->autocfg.speaker_pins[2] = 0x17; | |
2363 | } | |
2364 | ||
2365 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) | |
2366 | { | |
2367 | struct alc_spec *spec = codec->spec; | |
2368 | ||
2369 | spec->autocfg.hp_pins[0] = 0x15; | |
2370 | spec->autocfg.speaker_pins[0] = 0x14; | |
2371 | spec->autocfg.speaker_pins[1] = 0x16; | |
2372 | spec->autocfg.speaker_pins[2] = 0x1b; | |
2373 | } | |
2374 | ||
2375 | /* | |
2376 | * ALC880 3-stack model | |
2377 | * | |
2378 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) | |
2379 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, | |
2380 | * F-Mic = 0x1b, HP = 0x19 | |
2381 | */ | |
2382 | ||
2383 | static hda_nid_t alc880_dac_nids[4] = { | |
2384 | /* front, rear, clfe, rear_surr */ | |
2385 | 0x02, 0x05, 0x04, 0x03 | |
2386 | }; | |
2387 | ||
2388 | static hda_nid_t alc880_adc_nids[3] = { | |
2389 | /* ADC0-2 */ | |
2390 | 0x07, 0x08, 0x09, | |
2391 | }; | |
2392 | ||
2393 | /* The datasheet says the node 0x07 is connected from inputs, | |
2394 | * but it shows zero connection in the real implementation on some devices. | |
2395 | * Note: this is a 915GAV bug, fixed on 915GLV | |
2396 | */ | |
2397 | static hda_nid_t alc880_adc_nids_alt[2] = { | |
2398 | /* ADC1-2 */ | |
2399 | 0x08, 0x09, | |
2400 | }; | |
2401 | ||
2402 | #define ALC880_DIGOUT_NID 0x06 | |
2403 | #define ALC880_DIGIN_NID 0x0a | |
2404 | ||
2405 | static struct hda_input_mux alc880_capture_source = { | |
2406 | .num_items = 4, | |
2407 | .items = { | |
2408 | { "Mic", 0x0 }, | |
2409 | { "Front Mic", 0x3 }, | |
2410 | { "Line", 0x2 }, | |
2411 | { "CD", 0x4 }, | |
2412 | }, | |
2413 | }; | |
2414 | ||
2415 | /* channel source setting (2/6 channel selection for 3-stack) */ | |
2416 | /* 2ch mode */ | |
2417 | static struct hda_verb alc880_threestack_ch2_init[] = { | |
2418 | /* set line-in to input, mute it */ | |
2419 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2420 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2421 | /* set mic-in to input vref 80%, mute it */ | |
2422 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
2423 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2424 | { } /* end */ | |
2425 | }; | |
2426 | ||
2427 | /* 6ch mode */ | |
2428 | static struct hda_verb alc880_threestack_ch6_init[] = { | |
2429 | /* set line-in to output, unmute it */ | |
2430 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2431 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2432 | /* set mic-in to output, unmute it */ | |
2433 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2434 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2435 | { } /* end */ | |
2436 | }; | |
2437 | ||
2438 | static struct hda_channel_mode alc880_threestack_modes[2] = { | |
2439 | { 2, alc880_threestack_ch2_init }, | |
2440 | { 6, alc880_threestack_ch6_init }, | |
2441 | }; | |
2442 | ||
2443 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { | |
2444 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2445 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2446 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
2447 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | |
2448 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2449 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2450 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2451 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2452 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2453 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2454 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2455 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2456 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2457 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2458 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
2459 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
2460 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), | |
2461 | { | |
2462 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2463 | .name = "Channel Mode", | |
2464 | .info = alc_ch_mode_info, | |
2465 | .get = alc_ch_mode_get, | |
2466 | .put = alc_ch_mode_put, | |
2467 | }, | |
2468 | { } /* end */ | |
2469 | }; | |
2470 | ||
2471 | /* capture mixer elements */ | |
2472 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, | |
2473 | struct snd_ctl_elem_info *uinfo) | |
2474 | { | |
2475 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2476 | struct alc_spec *spec = codec->spec; | |
2477 | int err; | |
2478 | ||
2479 | mutex_lock(&codec->control_mutex); | |
2480 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, | |
2481 | HDA_INPUT); | |
2482 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); | |
2483 | mutex_unlock(&codec->control_mutex); | |
2484 | return err; | |
2485 | } | |
2486 | ||
2487 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |
2488 | unsigned int size, unsigned int __user *tlv) | |
2489 | { | |
2490 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2491 | struct alc_spec *spec = codec->spec; | |
2492 | int err; | |
2493 | ||
2494 | mutex_lock(&codec->control_mutex); | |
2495 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, | |
2496 | HDA_INPUT); | |
2497 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); | |
2498 | mutex_unlock(&codec->control_mutex); | |
2499 | return err; | |
2500 | } | |
2501 | ||
2502 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, | |
2503 | struct snd_ctl_elem_value *ucontrol); | |
2504 | ||
2505 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, | |
2506 | struct snd_ctl_elem_value *ucontrol, | |
2507 | getput_call_t func) | |
2508 | { | |
2509 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2510 | struct alc_spec *spec = codec->spec; | |
2511 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
2512 | int err; | |
2513 | ||
2514 | mutex_lock(&codec->control_mutex); | |
2515 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], | |
2516 | 3, 0, HDA_INPUT); | |
2517 | err = func(kcontrol, ucontrol); | |
2518 | mutex_unlock(&codec->control_mutex); | |
2519 | return err; | |
2520 | } | |
2521 | ||
2522 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, | |
2523 | struct snd_ctl_elem_value *ucontrol) | |
2524 | { | |
2525 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2526 | snd_hda_mixer_amp_volume_get); | |
2527 | } | |
2528 | ||
2529 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, | |
2530 | struct snd_ctl_elem_value *ucontrol) | |
2531 | { | |
2532 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2533 | snd_hda_mixer_amp_volume_put); | |
2534 | } | |
2535 | ||
2536 | /* capture mixer elements */ | |
2537 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info | |
2538 | ||
2539 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, | |
2540 | struct snd_ctl_elem_value *ucontrol) | |
2541 | { | |
2542 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2543 | snd_hda_mixer_amp_switch_get); | |
2544 | } | |
2545 | ||
2546 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, | |
2547 | struct snd_ctl_elem_value *ucontrol) | |
2548 | { | |
2549 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2550 | snd_hda_mixer_amp_switch_put); | |
2551 | } | |
2552 | ||
2553 | #define _DEFINE_CAPMIX(num) \ | |
2554 | { \ | |
2555 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2556 | .name = "Capture Switch", \ | |
2557 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | |
2558 | .count = num, \ | |
2559 | .info = alc_cap_sw_info, \ | |
2560 | .get = alc_cap_sw_get, \ | |
2561 | .put = alc_cap_sw_put, \ | |
2562 | }, \ | |
2563 | { \ | |
2564 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2565 | .name = "Capture Volume", \ | |
2566 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | |
2567 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | |
2568 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ | |
2569 | .count = num, \ | |
2570 | .info = alc_cap_vol_info, \ | |
2571 | .get = alc_cap_vol_get, \ | |
2572 | .put = alc_cap_vol_put, \ | |
2573 | .tlv = { .c = alc_cap_vol_tlv }, \ | |
2574 | } | |
2575 | ||
2576 | #define _DEFINE_CAPSRC(num) \ | |
2577 | { \ | |
2578 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2579 | /* .name = "Capture Source", */ \ | |
2580 | .name = "Input Source", \ | |
2581 | .count = num, \ | |
2582 | .info = alc_mux_enum_info, \ | |
2583 | .get = alc_mux_enum_get, \ | |
2584 | .put = alc_mux_enum_put, \ | |
2585 | } | |
2586 | ||
2587 | #define DEFINE_CAPMIX(num) \ | |
2588 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | |
2589 | _DEFINE_CAPMIX(num), \ | |
2590 | _DEFINE_CAPSRC(num), \ | |
2591 | { } /* end */ \ | |
2592 | } | |
2593 | ||
2594 | #define DEFINE_CAPMIX_NOSRC(num) \ | |
2595 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ | |
2596 | _DEFINE_CAPMIX(num), \ | |
2597 | { } /* end */ \ | |
2598 | } | |
2599 | ||
2600 | /* up to three ADCs */ | |
2601 | DEFINE_CAPMIX(1); | |
2602 | DEFINE_CAPMIX(2); | |
2603 | DEFINE_CAPMIX(3); | |
2604 | DEFINE_CAPMIX_NOSRC(1); | |
2605 | DEFINE_CAPMIX_NOSRC(2); | |
2606 | DEFINE_CAPMIX_NOSRC(3); | |
2607 | ||
2608 | /* | |
2609 | * ALC880 5-stack model | |
2610 | * | |
2611 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), | |
2612 | * Side = 0x02 (0xd) | |
2613 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 | |
2614 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 | |
2615 | */ | |
2616 | ||
2617 | /* additional mixers to alc880_three_stack_mixer */ | |
2618 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { | |
2619 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2620 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), | |
2621 | { } /* end */ | |
2622 | }; | |
2623 | ||
2624 | /* channel source setting (6/8 channel selection for 5-stack) */ | |
2625 | /* 6ch mode */ | |
2626 | static struct hda_verb alc880_fivestack_ch6_init[] = { | |
2627 | /* set line-in to input, mute it */ | |
2628 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2629 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2630 | { } /* end */ | |
2631 | }; | |
2632 | ||
2633 | /* 8ch mode */ | |
2634 | static struct hda_verb alc880_fivestack_ch8_init[] = { | |
2635 | /* set line-in to output, unmute it */ | |
2636 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2637 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2638 | { } /* end */ | |
2639 | }; | |
2640 | ||
2641 | static struct hda_channel_mode alc880_fivestack_modes[2] = { | |
2642 | { 6, alc880_fivestack_ch6_init }, | |
2643 | { 8, alc880_fivestack_ch8_init }, | |
2644 | }; | |
2645 | ||
2646 | ||
2647 | /* | |
2648 | * ALC880 6-stack model | |
2649 | * | |
2650 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), | |
2651 | * Side = 0x05 (0x0f) | |
2652 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, | |
2653 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b | |
2654 | */ | |
2655 | ||
2656 | static hda_nid_t alc880_6st_dac_nids[4] = { | |
2657 | /* front, rear, clfe, rear_surr */ | |
2658 | 0x02, 0x03, 0x04, 0x05 | |
2659 | }; | |
2660 | ||
2661 | static struct hda_input_mux alc880_6stack_capture_source = { | |
2662 | .num_items = 4, | |
2663 | .items = { | |
2664 | { "Mic", 0x0 }, | |
2665 | { "Front Mic", 0x1 }, | |
2666 | { "Line", 0x2 }, | |
2667 | { "CD", 0x4 }, | |
2668 | }, | |
2669 | }; | |
2670 | ||
2671 | /* fixed 8-channels */ | |
2672 | static struct hda_channel_mode alc880_sixstack_modes[1] = { | |
2673 | { 8, NULL }, | |
2674 | }; | |
2675 | ||
2676 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { | |
2677 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2678 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2679 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2680 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2681 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2682 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2683 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2684 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2685 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
2686 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2687 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2688 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2689 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2690 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2692 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2693 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2694 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2695 | { | |
2696 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2697 | .name = "Channel Mode", | |
2698 | .info = alc_ch_mode_info, | |
2699 | .get = alc_ch_mode_get, | |
2700 | .put = alc_ch_mode_put, | |
2701 | }, | |
2702 | { } /* end */ | |
2703 | }; | |
2704 | ||
2705 | ||
2706 | /* | |
2707 | * ALC880 W810 model | |
2708 | * | |
2709 | * W810 has rear IO for: | |
2710 | * Front (DAC 02) | |
2711 | * Surround (DAC 03) | |
2712 | * Center/LFE (DAC 04) | |
2713 | * Digital out (06) | |
2714 | * | |
2715 | * The system also has a pair of internal speakers, and a headphone jack. | |
2716 | * These are both connected to Line2 on the codec, hence to DAC 02. | |
2717 | * | |
2718 | * There is a variable resistor to control the speaker or headphone | |
2719 | * volume. This is a hardware-only device without a software API. | |
2720 | * | |
2721 | * Plugging headphones in will disable the internal speakers. This is | |
2722 | * implemented in hardware, not via the driver using jack sense. In | |
2723 | * a similar fashion, plugging into the rear socket marked "front" will | |
2724 | * disable both the speakers and headphones. | |
2725 | * | |
2726 | * For input, there's a microphone jack, and an "audio in" jack. | |
2727 | * These may not do anything useful with this driver yet, because I | |
2728 | * haven't setup any initialization verbs for these yet... | |
2729 | */ | |
2730 | ||
2731 | static hda_nid_t alc880_w810_dac_nids[3] = { | |
2732 | /* front, rear/surround, clfe */ | |
2733 | 0x02, 0x03, 0x04 | |
2734 | }; | |
2735 | ||
2736 | /* fixed 6 channels */ | |
2737 | static struct hda_channel_mode alc880_w810_modes[1] = { | |
2738 | { 6, NULL } | |
2739 | }; | |
2740 | ||
2741 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ | |
2742 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { | |
2743 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2744 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2745 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2746 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2747 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2748 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2749 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2750 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2751 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
2752 | { } /* end */ | |
2753 | }; | |
2754 | ||
2755 | ||
2756 | /* | |
2757 | * Z710V model | |
2758 | * | |
2759 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) | |
2760 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), | |
2761 | * Line = 0x1a | |
2762 | */ | |
2763 | ||
2764 | static hda_nid_t alc880_z71v_dac_nids[1] = { | |
2765 | 0x02 | |
2766 | }; | |
2767 | #define ALC880_Z71V_HP_DAC 0x03 | |
2768 | ||
2769 | /* fixed 2 channels */ | |
2770 | static struct hda_channel_mode alc880_2_jack_modes[1] = { | |
2771 | { 2, NULL } | |
2772 | }; | |
2773 | ||
2774 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { | |
2775 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2776 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2777 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2778 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
2779 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2780 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2781 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2782 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2783 | { } /* end */ | |
2784 | }; | |
2785 | ||
2786 | ||
2787 | /* | |
2788 | * ALC880 F1734 model | |
2789 | * | |
2790 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) | |
2791 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 | |
2792 | */ | |
2793 | ||
2794 | static hda_nid_t alc880_f1734_dac_nids[1] = { | |
2795 | 0x03 | |
2796 | }; | |
2797 | #define ALC880_F1734_HP_DAC 0x02 | |
2798 | ||
2799 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { | |
2800 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2801 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2802 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2803 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2804 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2805 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2806 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2807 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2808 | { } /* end */ | |
2809 | }; | |
2810 | ||
2811 | static struct hda_input_mux alc880_f1734_capture_source = { | |
2812 | .num_items = 2, | |
2813 | .items = { | |
2814 | { "Mic", 0x1 }, | |
2815 | { "CD", 0x4 }, | |
2816 | }, | |
2817 | }; | |
2818 | ||
2819 | ||
2820 | /* | |
2821 | * ALC880 ASUS model | |
2822 | * | |
2823 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
2824 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
2825 | * Mic = 0x18, Line = 0x1a | |
2826 | */ | |
2827 | ||
2828 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ | |
2829 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ | |
2830 | ||
2831 | static struct snd_kcontrol_new alc880_asus_mixer[] = { | |
2832 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2833 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2834 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2835 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2836 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2837 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2838 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2839 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2840 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2841 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2842 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2843 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2844 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2845 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2846 | { | |
2847 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2848 | .name = "Channel Mode", | |
2849 | .info = alc_ch_mode_info, | |
2850 | .get = alc_ch_mode_get, | |
2851 | .put = alc_ch_mode_put, | |
2852 | }, | |
2853 | { } /* end */ | |
2854 | }; | |
2855 | ||
2856 | /* | |
2857 | * ALC880 ASUS W1V model | |
2858 | * | |
2859 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
2860 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
2861 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b | |
2862 | */ | |
2863 | ||
2864 | /* additional mixers to alc880_asus_mixer */ | |
2865 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { | |
2866 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
2867 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
2868 | { } /* end */ | |
2869 | }; | |
2870 | ||
2871 | /* TCL S700 */ | |
2872 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { | |
2873 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2874 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
2875 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
2876 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), | |
2877 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), | |
2878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), | |
2879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), | |
2880 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
2881 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
2882 | { } /* end */ | |
2883 | }; | |
2884 | ||
2885 | /* Uniwill */ | |
2886 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { | |
2887 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2888 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2889 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2890 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2891 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2892 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2893 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2894 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2895 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2896 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2897 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2898 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2899 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2900 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2901 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2902 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2903 | { | |
2904 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2905 | .name = "Channel Mode", | |
2906 | .info = alc_ch_mode_info, | |
2907 | .get = alc_ch_mode_get, | |
2908 | .put = alc_ch_mode_put, | |
2909 | }, | |
2910 | { } /* end */ | |
2911 | }; | |
2912 | ||
2913 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { | |
2914 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2915 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2916 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2917 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2918 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2919 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2920 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2921 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2922 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2923 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2924 | { } /* end */ | |
2925 | }; | |
2926 | ||
2927 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { | |
2928 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2929 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2930 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2931 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2932 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2933 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2934 | { } /* end */ | |
2935 | }; | |
2936 | ||
2937 | /* | |
2938 | * virtual master controls | |
2939 | */ | |
2940 | ||
2941 | /* | |
2942 | * slave controls for virtual master | |
2943 | */ | |
2944 | static const char * const alc_slave_vols[] = { | |
2945 | "Front Playback Volume", | |
2946 | "Surround Playback Volume", | |
2947 | "Center Playback Volume", | |
2948 | "LFE Playback Volume", | |
2949 | "Side Playback Volume", | |
2950 | "Headphone Playback Volume", | |
2951 | "Speaker Playback Volume", | |
2952 | "Mono Playback Volume", | |
2953 | "Line-Out Playback Volume", | |
2954 | "PCM Playback Volume", | |
2955 | NULL, | |
2956 | }; | |
2957 | ||
2958 | static const char * const alc_slave_sws[] = { | |
2959 | "Front Playback Switch", | |
2960 | "Surround Playback Switch", | |
2961 | "Center Playback Switch", | |
2962 | "LFE Playback Switch", | |
2963 | "Side Playback Switch", | |
2964 | "Headphone Playback Switch", | |
2965 | "Speaker Playback Switch", | |
2966 | "Mono Playback Switch", | |
2967 | "IEC958 Playback Switch", | |
2968 | "Line-Out Playback Switch", | |
2969 | "PCM Playback Switch", | |
2970 | NULL, | |
2971 | }; | |
2972 | ||
2973 | /* | |
2974 | * build control elements | |
2975 | */ | |
2976 | ||
2977 | #define NID_MAPPING (-1) | |
2978 | ||
2979 | #define SUBDEV_SPEAKER_ (0 << 6) | |
2980 | #define SUBDEV_HP_ (1 << 6) | |
2981 | #define SUBDEV_LINE_ (2 << 6) | |
2982 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) | |
2983 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) | |
2984 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) | |
2985 | ||
2986 | static void alc_free_kctls(struct hda_codec *codec); | |
2987 | ||
2988 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | |
2989 | /* additional beep mixers; the actual parameters are overwritten at build */ | |
2990 | static struct snd_kcontrol_new alc_beep_mixer[] = { | |
2991 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), | |
2992 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), | |
2993 | { } /* end */ | |
2994 | }; | |
2995 | #endif | |
2996 | ||
2997 | static int alc_build_controls(struct hda_codec *codec) | |
2998 | { | |
2999 | struct alc_spec *spec = codec->spec; | |
3000 | struct snd_kcontrol *kctl = NULL; | |
3001 | struct snd_kcontrol_new *knew; | |
3002 | int i, j, err; | |
3003 | unsigned int u; | |
3004 | hda_nid_t nid; | |
3005 | ||
3006 | for (i = 0; i < spec->num_mixers; i++) { | |
3007 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | |
3008 | if (err < 0) | |
3009 | return err; | |
3010 | } | |
3011 | if (spec->cap_mixer) { | |
3012 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); | |
3013 | if (err < 0) | |
3014 | return err; | |
3015 | } | |
3016 | if (spec->multiout.dig_out_nid) { | |
3017 | err = snd_hda_create_spdif_out_ctls(codec, | |
3018 | spec->multiout.dig_out_nid); | |
3019 | if (err < 0) | |
3020 | return err; | |
3021 | if (!spec->no_analog) { | |
3022 | err = snd_hda_create_spdif_share_sw(codec, | |
3023 | &spec->multiout); | |
3024 | if (err < 0) | |
3025 | return err; | |
3026 | spec->multiout.share_spdif = 1; | |
3027 | } | |
3028 | } | |
3029 | if (spec->dig_in_nid) { | |
3030 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | |
3031 | if (err < 0) | |
3032 | return err; | |
3033 | } | |
3034 | ||
3035 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | |
3036 | /* create beep controls if needed */ | |
3037 | if (spec->beep_amp) { | |
3038 | struct snd_kcontrol_new *knew; | |
3039 | for (knew = alc_beep_mixer; knew->name; knew++) { | |
3040 | struct snd_kcontrol *kctl; | |
3041 | kctl = snd_ctl_new1(knew, codec); | |
3042 | if (!kctl) | |
3043 | return -ENOMEM; | |
3044 | kctl->private_value = spec->beep_amp; | |
3045 | err = snd_hda_ctl_add(codec, 0, kctl); | |
3046 | if (err < 0) | |
3047 | return err; | |
3048 | } | |
3049 | } | |
3050 | #endif | |
3051 | ||
3052 | /* if we have no master control, let's create it */ | |
3053 | if (!spec->no_analog && | |
3054 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | |
3055 | unsigned int vmaster_tlv[4]; | |
3056 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, | |
3057 | HDA_OUTPUT, vmaster_tlv); | |
3058 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", | |
3059 | vmaster_tlv, alc_slave_vols); | |
3060 | if (err < 0) | |
3061 | return err; | |
3062 | } | |
3063 | if (!spec->no_analog && | |
3064 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | |
3065 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", | |
3066 | NULL, alc_slave_sws); | |
3067 | if (err < 0) | |
3068 | return err; | |
3069 | } | |
3070 | ||
3071 | /* assign Capture Source enums to NID */ | |
3072 | if (spec->capsrc_nids || spec->adc_nids) { | |
3073 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); | |
3074 | if (!kctl) | |
3075 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | |
3076 | for (i = 0; kctl && i < kctl->count; i++) { | |
3077 | hda_nid_t *nids = spec->capsrc_nids; | |
3078 | if (!nids) | |
3079 | nids = spec->adc_nids; | |
3080 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); | |
3081 | if (err < 0) | |
3082 | return err; | |
3083 | } | |
3084 | } | |
3085 | if (spec->cap_mixer) { | |
3086 | const char *kname = kctl ? kctl->id.name : NULL; | |
3087 | for (knew = spec->cap_mixer; knew->name; knew++) { | |
3088 | if (kname && strcmp(knew->name, kname) == 0) | |
3089 | continue; | |
3090 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); | |
3091 | for (i = 0; kctl && i < kctl->count; i++) { | |
3092 | err = snd_hda_add_nid(codec, kctl, i, | |
3093 | spec->adc_nids[i]); | |
3094 | if (err < 0) | |
3095 | return err; | |
3096 | } | |
3097 | } | |
3098 | } | |
3099 | ||
3100 | /* other nid->control mapping */ | |
3101 | for (i = 0; i < spec->num_mixers; i++) { | |
3102 | for (knew = spec->mixers[i]; knew->name; knew++) { | |
3103 | if (knew->iface != NID_MAPPING) | |
3104 | continue; | |
3105 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); | |
3106 | if (kctl == NULL) | |
3107 | continue; | |
3108 | u = knew->subdevice; | |
3109 | for (j = 0; j < 4; j++, u >>= 8) { | |
3110 | nid = u & 0x3f; | |
3111 | if (nid == 0) | |
3112 | continue; | |
3113 | switch (u & 0xc0) { | |
3114 | case SUBDEV_SPEAKER_: | |
3115 | nid = spec->autocfg.speaker_pins[nid]; | |
3116 | break; | |
3117 | case SUBDEV_LINE_: | |
3118 | nid = spec->autocfg.line_out_pins[nid]; | |
3119 | break; | |
3120 | case SUBDEV_HP_: | |
3121 | nid = spec->autocfg.hp_pins[nid]; | |
3122 | break; | |
3123 | default: | |
3124 | continue; | |
3125 | } | |
3126 | err = snd_hda_add_nid(codec, kctl, 0, nid); | |
3127 | if (err < 0) | |
3128 | return err; | |
3129 | } | |
3130 | u = knew->private_value; | |
3131 | for (j = 0; j < 4; j++, u >>= 8) { | |
3132 | nid = u & 0xff; | |
3133 | if (nid == 0) | |
3134 | continue; | |
3135 | err = snd_hda_add_nid(codec, kctl, 0, nid); | |
3136 | if (err < 0) | |
3137 | return err; | |
3138 | } | |
3139 | } | |
3140 | } | |
3141 | ||
3142 | alc_free_kctls(codec); /* no longer needed */ | |
3143 | ||
3144 | return 0; | |
3145 | } | |
3146 | ||
3147 | ||
3148 | /* | |
3149 | * initialize the codec volumes, etc | |
3150 | */ | |
3151 | ||
3152 | /* | |
3153 | * generic initialization of ADC, input mixers and output mixers | |
3154 | */ | |
3155 | static struct hda_verb alc880_volume_init_verbs[] = { | |
3156 | /* | |
3157 | * Unmute ADC0-2 and set the default input to mic-in | |
3158 | */ | |
3159 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3160 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3161 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3162 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3163 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3164 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3165 | ||
3166 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
3167 | * mixer widget | |
3168 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
3169 | * panel mic (mic 2) | |
3170 | */ | |
3171 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
3172 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3173 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3174 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
3175 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
3176 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
3177 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
3178 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
3179 | ||
3180 | /* | |
3181 | * Set up output mixers (0x0c - 0x0f) | |
3182 | */ | |
3183 | /* set vol=0 to output mixers */ | |
3184 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3185 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3186 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3187 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3188 | /* set up input amps for analog loopback */ | |
3189 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
3190 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3191 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3192 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3193 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3194 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3195 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3196 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3197 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3198 | ||
3199 | { } | |
3200 | }; | |
3201 | ||
3202 | /* | |
3203 | * 3-stack pin configuration: | |
3204 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
3205 | */ | |
3206 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { | |
3207 | /* | |
3208 | * preset connection lists of input pins | |
3209 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
3210 | */ | |
3211 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
3212 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3213 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
3214 | ||
3215 | /* | |
3216 | * Set pin mode and muting | |
3217 | */ | |
3218 | /* set front pin widgets 0x14 for output */ | |
3219 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3220 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3221 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3222 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3223 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3224 | /* Mic2 (as headphone out) for HP output */ | |
3225 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3226 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3227 | /* Line In pin widget for input */ | |
3228 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3229 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3230 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
3231 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3232 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3233 | /* CD pin widget for input */ | |
3234 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3235 | ||
3236 | { } | |
3237 | }; | |
3238 | ||
3239 | /* | |
3240 | * 5-stack pin configuration: | |
3241 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, | |
3242 | * line-in/side = 0x1a, f-mic = 0x1b | |
3243 | */ | |
3244 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { | |
3245 | /* | |
3246 | * preset connection lists of input pins | |
3247 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
3248 | */ | |
3249 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3250 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ | |
3251 | ||
3252 | /* | |
3253 | * Set pin mode and muting | |
3254 | */ | |
3255 | /* set pin widgets 0x14-0x17 for output */ | |
3256 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3257 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3258 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3259 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3260 | /* unmute pins for output (no gain on this amp) */ | |
3261 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3262 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3263 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3264 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3265 | ||
3266 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3267 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3268 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3269 | /* Mic2 (as headphone out) for HP output */ | |
3270 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3271 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3272 | /* Line In pin widget for input */ | |
3273 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3274 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3275 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
3276 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3277 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3278 | /* CD pin widget for input */ | |
3279 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3280 | ||
3281 | { } | |
3282 | }; | |
3283 | ||
3284 | /* | |
3285 | * W810 pin configuration: | |
3286 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b | |
3287 | */ | |
3288 | static struct hda_verb alc880_pin_w810_init_verbs[] = { | |
3289 | /* hphone/speaker input selector: front DAC */ | |
3290 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, | |
3291 | ||
3292 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3293 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3294 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3295 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3296 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3297 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3298 | ||
3299 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3300 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3301 | ||
3302 | { } | |
3303 | }; | |
3304 | ||
3305 | /* | |
3306 | * Z71V pin configuration: | |
3307 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) | |
3308 | */ | |
3309 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { | |
3310 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3311 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3312 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3313 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3314 | ||
3315 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3316 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3317 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3318 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3319 | ||
3320 | { } | |
3321 | }; | |
3322 | ||
3323 | /* | |
3324 | * 6-stack pin configuration: | |
3325 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, | |
3326 | * f-mic = 0x19, line = 0x1a, HP = 0x1b | |
3327 | */ | |
3328 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { | |
3329 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3330 | ||
3331 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3332 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3333 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3334 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3335 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3336 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3337 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3338 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3339 | ||
3340 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3341 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3342 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3343 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3344 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3345 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3346 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3347 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3348 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3349 | ||
3350 | { } | |
3351 | }; | |
3352 | ||
3353 | /* | |
3354 | * Uniwill pin configuration: | |
3355 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, | |
3356 | * line = 0x1a | |
3357 | */ | |
3358 | static struct hda_verb alc880_uniwill_init_verbs[] = { | |
3359 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3360 | ||
3361 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3362 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3364 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3365 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3366 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3367 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3368 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3369 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3370 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3371 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3372 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3373 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3374 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3375 | ||
3376 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3377 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3378 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3379 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3380 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3381 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3382 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ | |
3383 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
3384 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3385 | ||
3386 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3387 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
3388 | ||
3389 | { } | |
3390 | }; | |
3391 | ||
3392 | /* | |
3393 | * Uniwill P53 | |
3394 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, | |
3395 | */ | |
3396 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | |
3397 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3398 | ||
3399 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3400 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3401 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3402 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3403 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3404 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3405 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3406 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3407 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3408 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3409 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3410 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3411 | ||
3412 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3413 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3414 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3415 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3416 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3417 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3418 | ||
3419 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3420 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, | |
3421 | ||
3422 | { } | |
3423 | }; | |
3424 | ||
3425 | static struct hda_verb alc880_beep_init_verbs[] = { | |
3426 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, | |
3427 | { } | |
3428 | }; | |
3429 | ||
3430 | /* auto-toggle front mic */ | |
3431 | static void alc88x_simple_mic_automute(struct hda_codec *codec) | |
3432 | { | |
3433 | unsigned int present; | |
3434 | unsigned char bits; | |
3435 | ||
3436 | present = snd_hda_jack_detect(codec, 0x18); | |
3437 | bits = present ? HDA_AMP_MUTE : 0; | |
3438 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
3439 | } | |
3440 | ||
3441 | static void alc880_uniwill_setup(struct hda_codec *codec) | |
3442 | { | |
3443 | struct alc_spec *spec = codec->spec; | |
3444 | ||
3445 | spec->autocfg.hp_pins[0] = 0x14; | |
3446 | spec->autocfg.speaker_pins[0] = 0x15; | |
3447 | spec->autocfg.speaker_pins[0] = 0x16; | |
3448 | } | |
3449 | ||
3450 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | |
3451 | { | |
3452 | alc_automute_amp(codec); | |
3453 | alc88x_simple_mic_automute(codec); | |
3454 | } | |
3455 | ||
3456 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |
3457 | unsigned int res) | |
3458 | { | |
3459 | /* Looks like the unsol event is incompatible with the standard | |
3460 | * definition. 4bit tag is placed at 28 bit! | |
3461 | */ | |
3462 | switch (res >> 28) { | |
3463 | case ALC880_MIC_EVENT: | |
3464 | alc88x_simple_mic_automute(codec); | |
3465 | break; | |
3466 | default: | |
3467 | alc_automute_amp_unsol_event(codec, res); | |
3468 | break; | |
3469 | } | |
3470 | } | |
3471 | ||
3472 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) | |
3473 | { | |
3474 | struct alc_spec *spec = codec->spec; | |
3475 | ||
3476 | spec->autocfg.hp_pins[0] = 0x14; | |
3477 | spec->autocfg.speaker_pins[0] = 0x15; | |
3478 | } | |
3479 | ||
3480 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | |
3481 | { | |
3482 | unsigned int present; | |
3483 | ||
3484 | present = snd_hda_codec_read(codec, 0x21, 0, | |
3485 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); | |
3486 | present &= HDA_AMP_VOLMASK; | |
3487 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, | |
3488 | HDA_AMP_VOLMASK, present); | |
3489 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, | |
3490 | HDA_AMP_VOLMASK, present); | |
3491 | } | |
3492 | ||
3493 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, | |
3494 | unsigned int res) | |
3495 | { | |
3496 | /* Looks like the unsol event is incompatible with the standard | |
3497 | * definition. 4bit tag is placed at 28 bit! | |
3498 | */ | |
3499 | if ((res >> 28) == ALC880_DCVOL_EVENT) | |
3500 | alc880_uniwill_p53_dcvol_automute(codec); | |
3501 | else | |
3502 | alc_automute_amp_unsol_event(codec, res); | |
3503 | } | |
3504 | ||
3505 | /* | |
3506 | * F1734 pin configuration: | |
3507 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 | |
3508 | */ | |
3509 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { | |
3510 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3511 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
3512 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3513 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3514 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3515 | ||
3516 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3517 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3518 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3519 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3520 | ||
3521 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3522 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3523 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
3524 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3525 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3526 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3527 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3528 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3529 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3530 | ||
3531 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
3532 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, | |
3533 | ||
3534 | { } | |
3535 | }; | |
3536 | ||
3537 | /* | |
3538 | * ASUS pin configuration: | |
3539 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a | |
3540 | */ | |
3541 | static struct hda_verb alc880_pin_asus_init_verbs[] = { | |
3542 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
3543 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3544 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3545 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3546 | ||
3547 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3548 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3549 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3550 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3551 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3552 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3553 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3554 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3555 | ||
3556 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3557 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3558 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3559 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3560 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3561 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3562 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3563 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3564 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3565 | ||
3566 | { } | |
3567 | }; | |
3568 | ||
3569 | /* Enable GPIO mask and set output */ | |
3570 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs | |
3571 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs | |
3572 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs | |
3573 | ||
3574 | /* Clevo m520g init */ | |
3575 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { | |
3576 | /* headphone output */ | |
3577 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3578 | /* line-out */ | |
3579 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3580 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3581 | /* Line-in */ | |
3582 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3583 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3584 | /* CD */ | |
3585 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3586 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3587 | /* Mic1 (rear panel) */ | |
3588 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3589 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3590 | /* Mic2 (front panel) */ | |
3591 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3592 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3593 | /* headphone */ | |
3594 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3595 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3596 | /* change to EAPD mode */ | |
3597 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3598 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3599 | ||
3600 | { } | |
3601 | }; | |
3602 | ||
3603 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { | |
3604 | /* change to EAPD mode */ | |
3605 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3606 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3607 | ||
3608 | /* Headphone output */ | |
3609 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3610 | /* Front output*/ | |
3611 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3612 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3613 | ||
3614 | /* Line In pin widget for input */ | |
3615 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3616 | /* CD pin widget for input */ | |
3617 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3618 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3619 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3620 | ||
3621 | /* change to EAPD mode */ | |
3622 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3623 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
3624 | ||
3625 | { } | |
3626 | }; | |
3627 | ||
3628 | /* | |
3629 | * LG m1 express dual | |
3630 | * | |
3631 | * Pin assignment: | |
3632 | * Rear Line-In/Out (blue): 0x14 | |
3633 | * Build-in Mic-In: 0x15 | |
3634 | * Speaker-out: 0x17 | |
3635 | * HP-Out (green): 0x1b | |
3636 | * Mic-In/Out (red): 0x19 | |
3637 | * SPDIF-Out: 0x1e | |
3638 | */ | |
3639 | ||
3640 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ | |
3641 | static hda_nid_t alc880_lg_dac_nids[3] = { | |
3642 | 0x05, 0x02, 0x03 | |
3643 | }; | |
3644 | ||
3645 | /* seems analog CD is not working */ | |
3646 | static struct hda_input_mux alc880_lg_capture_source = { | |
3647 | .num_items = 3, | |
3648 | .items = { | |
3649 | { "Mic", 0x1 }, | |
3650 | { "Line", 0x5 }, | |
3651 | { "Internal Mic", 0x6 }, | |
3652 | }, | |
3653 | }; | |
3654 | ||
3655 | /* 2,4,6 channel modes */ | |
3656 | static struct hda_verb alc880_lg_ch2_init[] = { | |
3657 | /* set line-in and mic-in to input */ | |
3658 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
3659 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
3660 | { } | |
3661 | }; | |
3662 | ||
3663 | static struct hda_verb alc880_lg_ch4_init[] = { | |
3664 | /* set line-in to out and mic-in to input */ | |
3665 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3666 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
3667 | { } | |
3668 | }; | |
3669 | ||
3670 | static struct hda_verb alc880_lg_ch6_init[] = { | |
3671 | /* set line-in and mic-in to output */ | |
3672 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3673 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3674 | { } | |
3675 | }; | |
3676 | ||
3677 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { | |
3678 | { 2, alc880_lg_ch2_init }, | |
3679 | { 4, alc880_lg_ch4_init }, | |
3680 | { 6, alc880_lg_ch6_init }, | |
3681 | }; | |
3682 | ||
3683 | static struct snd_kcontrol_new alc880_lg_mixer[] = { | |
3684 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
3685 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), | |
3686 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3687 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), | |
3688 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | |
3689 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
3690 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
3691 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
3692 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3693 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3694 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
3695 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
3696 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
3697 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
3698 | { | |
3699 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3700 | .name = "Channel Mode", | |
3701 | .info = alc_ch_mode_info, | |
3702 | .get = alc_ch_mode_get, | |
3703 | .put = alc_ch_mode_put, | |
3704 | }, | |
3705 | { } /* end */ | |
3706 | }; | |
3707 | ||
3708 | static struct hda_verb alc880_lg_init_verbs[] = { | |
3709 | /* set capture source to mic-in */ | |
3710 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3711 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3712 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3713 | /* mute all amp mixer inputs */ | |
3714 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, | |
3715 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
3716 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
3717 | /* line-in to input */ | |
3718 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3719 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3720 | /* built-in mic */ | |
3721 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3722 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3723 | /* speaker-out */ | |
3724 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3725 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3726 | /* mic-in to input */ | |
3727 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3728 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3729 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3730 | /* HP-out */ | |
3731 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
3732 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3733 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3734 | /* jack sense */ | |
3735 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3736 | { } | |
3737 | }; | |
3738 | ||
3739 | /* toggle speaker-output according to the hp-jack state */ | |
3740 | static void alc880_lg_setup(struct hda_codec *codec) | |
3741 | { | |
3742 | struct alc_spec *spec = codec->spec; | |
3743 | ||
3744 | spec->autocfg.hp_pins[0] = 0x1b; | |
3745 | spec->autocfg.speaker_pins[0] = 0x17; | |
3746 | } | |
3747 | ||
3748 | /* | |
3749 | * LG LW20 | |
3750 | * | |
3751 | * Pin assignment: | |
3752 | * Speaker-out: 0x14 | |
3753 | * Mic-In: 0x18 | |
3754 | * Built-in Mic-In: 0x19 | |
3755 | * Line-In: 0x1b | |
3756 | * HP-Out: 0x1a | |
3757 | * SPDIF-Out: 0x1e | |
3758 | */ | |
3759 | ||
3760 | static struct hda_input_mux alc880_lg_lw_capture_source = { | |
3761 | .num_items = 3, | |
3762 | .items = { | |
3763 | { "Mic", 0x0 }, | |
3764 | { "Internal Mic", 0x1 }, | |
3765 | { "Line In", 0x2 }, | |
3766 | }, | |
3767 | }; | |
3768 | ||
3769 | #define alc880_lg_lw_modes alc880_threestack_modes | |
3770 | ||
3771 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { | |
3772 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3773 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
3774 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
3775 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | |
3776 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
3777 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
3778 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
3779 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
3780 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
3781 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
3782 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
3783 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3784 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
3785 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
3786 | { | |
3787 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3788 | .name = "Channel Mode", | |
3789 | .info = alc_ch_mode_info, | |
3790 | .get = alc_ch_mode_get, | |
3791 | .put = alc_ch_mode_put, | |
3792 | }, | |
3793 | { } /* end */ | |
3794 | }; | |
3795 | ||
3796 | static struct hda_verb alc880_lg_lw_init_verbs[] = { | |
3797 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3798 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
3799 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
3800 | ||
3801 | /* set capture source to mic-in */ | |
3802 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3803 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3804 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3805 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
3806 | /* speaker-out */ | |
3807 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3808 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3809 | /* HP-out */ | |
3810 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3811 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3812 | /* mic-in to input */ | |
3813 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3814 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3815 | /* built-in mic */ | |
3816 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3817 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3818 | /* jack sense */ | |
3819 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3820 | { } | |
3821 | }; | |
3822 | ||
3823 | /* toggle speaker-output according to the hp-jack state */ | |
3824 | static void alc880_lg_lw_setup(struct hda_codec *codec) | |
3825 | { | |
3826 | struct alc_spec *spec = codec->spec; | |
3827 | ||
3828 | spec->autocfg.hp_pins[0] = 0x1b; | |
3829 | spec->autocfg.speaker_pins[0] = 0x14; | |
3830 | } | |
3831 | ||
3832 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { | |
3833 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3834 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
3835 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
3836 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3837 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3838 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3839 | { } /* end */ | |
3840 | }; | |
3841 | ||
3842 | static struct hda_input_mux alc880_medion_rim_capture_source = { | |
3843 | .num_items = 2, | |
3844 | .items = { | |
3845 | { "Mic", 0x0 }, | |
3846 | { "Internal Mic", 0x1 }, | |
3847 | }, | |
3848 | }; | |
3849 | ||
3850 | static struct hda_verb alc880_medion_rim_init_verbs[] = { | |
3851 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3852 | ||
3853 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3854 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3855 | ||
3856 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3857 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3858 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3859 | /* Mic2 (as headphone out) for HP output */ | |
3860 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3861 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3862 | /* Internal Speaker */ | |
3863 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3864 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3865 | ||
3866 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3867 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3868 | ||
3869 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3870 | { } | |
3871 | }; | |
3872 | ||
3873 | /* toggle speaker-output according to the hp-jack state */ | |
3874 | static void alc880_medion_rim_automute(struct hda_codec *codec) | |
3875 | { | |
3876 | struct alc_spec *spec = codec->spec; | |
3877 | alc_automute_amp(codec); | |
3878 | /* toggle EAPD */ | |
3879 | if (spec->jack_present) | |
3880 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); | |
3881 | else | |
3882 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); | |
3883 | } | |
3884 | ||
3885 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | |
3886 | unsigned int res) | |
3887 | { | |
3888 | /* Looks like the unsol event is incompatible with the standard | |
3889 | * definition. 4bit tag is placed at 28 bit! | |
3890 | */ | |
3891 | if ((res >> 28) == ALC880_HP_EVENT) | |
3892 | alc880_medion_rim_automute(codec); | |
3893 | } | |
3894 | ||
3895 | static void alc880_medion_rim_setup(struct hda_codec *codec) | |
3896 | { | |
3897 | struct alc_spec *spec = codec->spec; | |
3898 | ||
3899 | spec->autocfg.hp_pins[0] = 0x14; | |
3900 | spec->autocfg.speaker_pins[0] = 0x1b; | |
3901 | } | |
3902 | ||
3903 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3904 | static struct hda_amp_list alc880_loopbacks[] = { | |
3905 | { 0x0b, HDA_INPUT, 0 }, | |
3906 | { 0x0b, HDA_INPUT, 1 }, | |
3907 | { 0x0b, HDA_INPUT, 2 }, | |
3908 | { 0x0b, HDA_INPUT, 3 }, | |
3909 | { 0x0b, HDA_INPUT, 4 }, | |
3910 | { } /* end */ | |
3911 | }; | |
3912 | ||
3913 | static struct hda_amp_list alc880_lg_loopbacks[] = { | |
3914 | { 0x0b, HDA_INPUT, 1 }, | |
3915 | { 0x0b, HDA_INPUT, 6 }, | |
3916 | { 0x0b, HDA_INPUT, 7 }, | |
3917 | { } /* end */ | |
3918 | }; | |
3919 | #endif | |
3920 | ||
3921 | /* | |
3922 | * Common callbacks | |
3923 | */ | |
3924 | ||
3925 | static int alc_init(struct hda_codec *codec) | |
3926 | { | |
3927 | struct alc_spec *spec = codec->spec; | |
3928 | unsigned int i; | |
3929 | ||
3930 | alc_fix_pll(codec); | |
3931 | alc_auto_init_amp(codec, spec->init_amp); | |
3932 | ||
3933 | for (i = 0; i < spec->num_init_verbs; i++) | |
3934 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | |
3935 | ||
3936 | if (spec->init_hook) | |
3937 | spec->init_hook(codec); | |
3938 | ||
3939 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); | |
3940 | ||
3941 | hda_call_check_power_status(codec, 0x01); | |
3942 | return 0; | |
3943 | } | |
3944 | ||
3945 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) | |
3946 | { | |
3947 | struct alc_spec *spec = codec->spec; | |
3948 | ||
3949 | if (spec->unsol_event) | |
3950 | spec->unsol_event(codec, res); | |
3951 | } | |
3952 | ||
3953 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3954 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) | |
3955 | { | |
3956 | struct alc_spec *spec = codec->spec; | |
3957 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); | |
3958 | } | |
3959 | #endif | |
3960 | ||
3961 | /* | |
3962 | * Analog playback callbacks | |
3963 | */ | |
3964 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
3965 | struct hda_codec *codec, | |
3966 | struct snd_pcm_substream *substream) | |
3967 | { | |
3968 | struct alc_spec *spec = codec->spec; | |
3969 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, | |
3970 | hinfo); | |
3971 | } | |
3972 | ||
3973 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3974 | struct hda_codec *codec, | |
3975 | unsigned int stream_tag, | |
3976 | unsigned int format, | |
3977 | struct snd_pcm_substream *substream) | |
3978 | { | |
3979 | struct alc_spec *spec = codec->spec; | |
3980 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, | |
3981 | stream_tag, format, substream); | |
3982 | } | |
3983 | ||
3984 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3985 | struct hda_codec *codec, | |
3986 | struct snd_pcm_substream *substream) | |
3987 | { | |
3988 | struct alc_spec *spec = codec->spec; | |
3989 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | |
3990 | } | |
3991 | ||
3992 | /* | |
3993 | * Digital out | |
3994 | */ | |
3995 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
3996 | struct hda_codec *codec, | |
3997 | struct snd_pcm_substream *substream) | |
3998 | { | |
3999 | struct alc_spec *spec = codec->spec; | |
4000 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | |
4001 | } | |
4002 | ||
4003 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
4004 | struct hda_codec *codec, | |
4005 | unsigned int stream_tag, | |
4006 | unsigned int format, | |
4007 | struct snd_pcm_substream *substream) | |
4008 | { | |
4009 | struct alc_spec *spec = codec->spec; | |
4010 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, | |
4011 | stream_tag, format, substream); | |
4012 | } | |
4013 | ||
4014 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
4015 | struct hda_codec *codec, | |
4016 | struct snd_pcm_substream *substream) | |
4017 | { | |
4018 | struct alc_spec *spec = codec->spec; | |
4019 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); | |
4020 | } | |
4021 | ||
4022 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, | |
4023 | struct hda_codec *codec, | |
4024 | struct snd_pcm_substream *substream) | |
4025 | { | |
4026 | struct alc_spec *spec = codec->spec; | |
4027 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | |
4028 | } | |
4029 | ||
4030 | /* | |
4031 | * Analog capture | |
4032 | */ | |
4033 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |
4034 | struct hda_codec *codec, | |
4035 | unsigned int stream_tag, | |
4036 | unsigned int format, | |
4037 | struct snd_pcm_substream *substream) | |
4038 | { | |
4039 | struct alc_spec *spec = codec->spec; | |
4040 | ||
4041 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], | |
4042 | stream_tag, 0, format); | |
4043 | return 0; | |
4044 | } | |
4045 | ||
4046 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
4047 | struct hda_codec *codec, | |
4048 | struct snd_pcm_substream *substream) | |
4049 | { | |
4050 | struct alc_spec *spec = codec->spec; | |
4051 | ||
4052 | snd_hda_codec_cleanup_stream(codec, | |
4053 | spec->adc_nids[substream->number + 1]); | |
4054 | return 0; | |
4055 | } | |
4056 | ||
4057 | /* analog capture with dynamic dual-adc changes */ | |
4058 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |
4059 | struct hda_codec *codec, | |
4060 | unsigned int stream_tag, | |
4061 | unsigned int format, | |
4062 | struct snd_pcm_substream *substream) | |
4063 | { | |
4064 | struct alc_spec *spec = codec->spec; | |
4065 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; | |
4066 | spec->cur_adc_stream_tag = stream_tag; | |
4067 | spec->cur_adc_format = format; | |
4068 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); | |
4069 | return 0; | |
4070 | } | |
4071 | ||
4072 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
4073 | struct hda_codec *codec, | |
4074 | struct snd_pcm_substream *substream) | |
4075 | { | |
4076 | struct alc_spec *spec = codec->spec; | |
4077 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); | |
4078 | spec->cur_adc = 0; | |
4079 | return 0; | |
4080 | } | |
4081 | ||
4082 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { | |
4083 | .substreams = 1, | |
4084 | .channels_min = 2, | |
4085 | .channels_max = 2, | |
4086 | .nid = 0, /* fill later */ | |
4087 | .ops = { | |
4088 | .prepare = dualmic_capture_pcm_prepare, | |
4089 | .cleanup = dualmic_capture_pcm_cleanup | |
4090 | }, | |
4091 | }; | |
4092 | ||
4093 | /* | |
4094 | */ | |
4095 | static struct hda_pcm_stream alc880_pcm_analog_playback = { | |
4096 | .substreams = 1, | |
4097 | .channels_min = 2, | |
4098 | .channels_max = 8, | |
4099 | /* NID is set in alc_build_pcms */ | |
4100 | .ops = { | |
4101 | .open = alc880_playback_pcm_open, | |
4102 | .prepare = alc880_playback_pcm_prepare, | |
4103 | .cleanup = alc880_playback_pcm_cleanup | |
4104 | }, | |
4105 | }; | |
4106 | ||
4107 | static struct hda_pcm_stream alc880_pcm_analog_capture = { | |
4108 | .substreams = 1, | |
4109 | .channels_min = 2, | |
4110 | .channels_max = 2, | |
4111 | /* NID is set in alc_build_pcms */ | |
4112 | }; | |
4113 | ||
4114 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { | |
4115 | .substreams = 1, | |
4116 | .channels_min = 2, | |
4117 | .channels_max = 2, | |
4118 | /* NID is set in alc_build_pcms */ | |
4119 | }; | |
4120 | ||
4121 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { | |
4122 | .substreams = 2, /* can be overridden */ | |
4123 | .channels_min = 2, | |
4124 | .channels_max = 2, | |
4125 | /* NID is set in alc_build_pcms */ | |
4126 | .ops = { | |
4127 | .prepare = alc880_alt_capture_pcm_prepare, | |
4128 | .cleanup = alc880_alt_capture_pcm_cleanup | |
4129 | }, | |
4130 | }; | |
4131 | ||
4132 | static struct hda_pcm_stream alc880_pcm_digital_playback = { | |
4133 | .substreams = 1, | |
4134 | .channels_min = 2, | |
4135 | .channels_max = 2, | |
4136 | /* NID is set in alc_build_pcms */ | |
4137 | .ops = { | |
4138 | .open = alc880_dig_playback_pcm_open, | |
4139 | .close = alc880_dig_playback_pcm_close, | |
4140 | .prepare = alc880_dig_playback_pcm_prepare, | |
4141 | .cleanup = alc880_dig_playback_pcm_cleanup | |
4142 | }, | |
4143 | }; | |
4144 | ||
4145 | static struct hda_pcm_stream alc880_pcm_digital_capture = { | |
4146 | .substreams = 1, | |
4147 | .channels_min = 2, | |
4148 | .channels_max = 2, | |
4149 | /* NID is set in alc_build_pcms */ | |
4150 | }; | |
4151 | ||
4152 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ | |
4153 | static struct hda_pcm_stream alc_pcm_null_stream = { | |
4154 | .substreams = 0, | |
4155 | .channels_min = 0, | |
4156 | .channels_max = 0, | |
4157 | }; | |
4158 | ||
4159 | static int alc_build_pcms(struct hda_codec *codec) | |
4160 | { | |
4161 | struct alc_spec *spec = codec->spec; | |
4162 | struct hda_pcm *info = spec->pcm_rec; | |
4163 | int i; | |
4164 | ||
4165 | codec->num_pcms = 1; | |
4166 | codec->pcm_info = info; | |
4167 | ||
4168 | if (spec->no_analog) | |
4169 | goto skip_analog; | |
4170 | ||
4171 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), | |
4172 | "%s Analog", codec->chip_name); | |
4173 | info->name = spec->stream_name_analog; | |
4174 | ||
4175 | if (spec->stream_analog_playback) { | |
4176 | if (snd_BUG_ON(!spec->multiout.dac_nids)) | |
4177 | return -EINVAL; | |
4178 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); | |
4179 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | |
4180 | } | |
4181 | if (spec->stream_analog_capture) { | |
4182 | if (snd_BUG_ON(!spec->adc_nids)) | |
4183 | return -EINVAL; | |
4184 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); | |
4185 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | |
4186 | } | |
4187 | ||
4188 | if (spec->channel_mode) { | |
4189 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; | |
4190 | for (i = 0; i < spec->num_channel_mode; i++) { | |
4191 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { | |
4192 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; | |
4193 | } | |
4194 | } | |
4195 | } | |
4196 | ||
4197 | skip_analog: | |
4198 | /* SPDIF for stream index #1 */ | |
4199 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { | |
4200 | snprintf(spec->stream_name_digital, | |
4201 | sizeof(spec->stream_name_digital), | |
4202 | "%s Digital", codec->chip_name); | |
4203 | codec->num_pcms = 2; | |
4204 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; | |
4205 | info = spec->pcm_rec + 1; | |
4206 | info->name = spec->stream_name_digital; | |
4207 | if (spec->dig_out_type) | |
4208 | info->pcm_type = spec->dig_out_type; | |
4209 | else | |
4210 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | |
4211 | if (spec->multiout.dig_out_nid && | |
4212 | spec->stream_digital_playback) { | |
4213 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); | |
4214 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | |
4215 | } | |
4216 | if (spec->dig_in_nid && | |
4217 | spec->stream_digital_capture) { | |
4218 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); | |
4219 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | |
4220 | } | |
4221 | /* FIXME: do we need this for all Realtek codec models? */ | |
4222 | codec->spdif_status_reset = 1; | |
4223 | } | |
4224 | ||
4225 | if (spec->no_analog) | |
4226 | return 0; | |
4227 | ||
4228 | /* If the use of more than one ADC is requested for the current | |
4229 | * model, configure a second analog capture-only PCM. | |
4230 | */ | |
4231 | /* Additional Analaog capture for index #2 */ | |
4232 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || | |
4233 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { | |
4234 | codec->num_pcms = 3; | |
4235 | info = spec->pcm_rec + 2; | |
4236 | info->name = spec->stream_name_analog; | |
4237 | if (spec->alt_dac_nid) { | |
4238 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
4239 | *spec->stream_analog_alt_playback; | |
4240 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | |
4241 | spec->alt_dac_nid; | |
4242 | } else { | |
4243 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
4244 | alc_pcm_null_stream; | |
4245 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | |
4246 | } | |
4247 | if (spec->num_adc_nids > 1) { | |
4248 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
4249 | *spec->stream_analog_alt_capture; | |
4250 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | |
4251 | spec->adc_nids[1]; | |
4252 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = | |
4253 | spec->num_adc_nids - 1; | |
4254 | } else { | |
4255 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
4256 | alc_pcm_null_stream; | |
4257 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; | |
4258 | } | |
4259 | } | |
4260 | ||
4261 | return 0; | |
4262 | } | |
4263 | ||
4264 | static inline void alc_shutup(struct hda_codec *codec) | |
4265 | { | |
4266 | snd_hda_shutup_pins(codec); | |
4267 | } | |
4268 | ||
4269 | static void alc_free_kctls(struct hda_codec *codec) | |
4270 | { | |
4271 | struct alc_spec *spec = codec->spec; | |
4272 | ||
4273 | if (spec->kctls.list) { | |
4274 | struct snd_kcontrol_new *kctl = spec->kctls.list; | |
4275 | int i; | |
4276 | for (i = 0; i < spec->kctls.used; i++) | |
4277 | kfree(kctl[i].name); | |
4278 | } | |
4279 | snd_array_free(&spec->kctls); | |
4280 | } | |
4281 | ||
4282 | static void alc_free(struct hda_codec *codec) | |
4283 | { | |
4284 | struct alc_spec *spec = codec->spec; | |
4285 | ||
4286 | if (!spec) | |
4287 | return; | |
4288 | ||
4289 | alc_shutup(codec); | |
4290 | alc_free_kctls(codec); | |
4291 | kfree(spec); | |
4292 | snd_hda_detach_beep_device(codec); | |
4293 | } | |
4294 | ||
4295 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
4296 | static void alc_power_eapd(struct hda_codec *codec) | |
4297 | { | |
4298 | /* We currently only handle front, HP */ | |
4299 | switch (codec->vendor_id) { | |
4300 | case 0x10ec0260: | |
4301 | set_eapd(codec, 0x0f, 0); | |
4302 | set_eapd(codec, 0x10, 0); | |
4303 | break; | |
4304 | case 0x10ec0262: | |
4305 | case 0x10ec0267: | |
4306 | case 0x10ec0268: | |
4307 | case 0x10ec0269: | |
4308 | case 0x10ec0270: | |
4309 | case 0x10ec0272: | |
4310 | case 0x10ec0660: | |
4311 | case 0x10ec0662: | |
4312 | case 0x10ec0663: | |
4313 | case 0x10ec0862: | |
4314 | case 0x10ec0889: | |
4315 | set_eapd(codec, 0x14, 0); | |
4316 | set_eapd(codec, 0x15, 0); | |
4317 | break; | |
4318 | } | |
4319 | } | |
4320 | ||
4321 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) | |
4322 | { | |
4323 | struct alc_spec *spec = codec->spec; | |
4324 | alc_shutup(codec); | |
4325 | if (spec && spec->power_hook) | |
4326 | spec->power_hook(codec); | |
4327 | return 0; | |
4328 | } | |
4329 | #endif | |
4330 | ||
4331 | #ifdef SND_HDA_NEEDS_RESUME | |
4332 | static int alc_resume(struct hda_codec *codec) | |
4333 | { | |
4334 | codec->patch_ops.init(codec); | |
4335 | snd_hda_codec_resume_amp(codec); | |
4336 | snd_hda_codec_resume_cache(codec); | |
4337 | hda_call_check_power_status(codec, 0x01); | |
4338 | return 0; | |
4339 | } | |
4340 | #endif | |
4341 | ||
4342 | /* | |
4343 | */ | |
4344 | static struct hda_codec_ops alc_patch_ops = { | |
4345 | .build_controls = alc_build_controls, | |
4346 | .build_pcms = alc_build_pcms, | |
4347 | .init = alc_init, | |
4348 | .free = alc_free, | |
4349 | .unsol_event = alc_unsol_event, | |
4350 | #ifdef SND_HDA_NEEDS_RESUME | |
4351 | .resume = alc_resume, | |
4352 | #endif | |
4353 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
4354 | .suspend = alc_suspend, | |
4355 | .check_power_status = alc_check_power_status, | |
4356 | #endif | |
4357 | .reboot_notify = alc_shutup, | |
4358 | }; | |
4359 | ||
4360 | /* replace the codec chip_name with the given string */ | |
4361 | static int alc_codec_rename(struct hda_codec *codec, const char *name) | |
4362 | { | |
4363 | kfree(codec->chip_name); | |
4364 | codec->chip_name = kstrdup(name, GFP_KERNEL); | |
4365 | if (!codec->chip_name) { | |
4366 | alc_free(codec); | |
4367 | return -ENOMEM; | |
4368 | } | |
4369 | return 0; | |
4370 | } | |
4371 | ||
4372 | /* | |
4373 | * Test configuration for debugging | |
4374 | * | |
4375 | * Almost all inputs/outputs are enabled. I/O pins can be configured via | |
4376 | * enum controls. | |
4377 | */ | |
4378 | #ifdef CONFIG_SND_DEBUG | |
4379 | static hda_nid_t alc880_test_dac_nids[4] = { | |
4380 | 0x02, 0x03, 0x04, 0x05 | |
4381 | }; | |
4382 | ||
4383 | static struct hda_input_mux alc880_test_capture_source = { | |
4384 | .num_items = 7, | |
4385 | .items = { | |
4386 | { "In-1", 0x0 }, | |
4387 | { "In-2", 0x1 }, | |
4388 | { "In-3", 0x2 }, | |
4389 | { "In-4", 0x3 }, | |
4390 | { "CD", 0x4 }, | |
4391 | { "Front", 0x5 }, | |
4392 | { "Surround", 0x6 }, | |
4393 | }, | |
4394 | }; | |
4395 | ||
4396 | static struct hda_channel_mode alc880_test_modes[4] = { | |
4397 | { 2, NULL }, | |
4398 | { 4, NULL }, | |
4399 | { 6, NULL }, | |
4400 | { 8, NULL }, | |
4401 | }; | |
4402 | ||
4403 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, | |
4404 | struct snd_ctl_elem_info *uinfo) | |
4405 | { | |
4406 | static char *texts[] = { | |
4407 | "N/A", "Line Out", "HP Out", | |
4408 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" | |
4409 | }; | |
4410 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
4411 | uinfo->count = 1; | |
4412 | uinfo->value.enumerated.items = 8; | |
4413 | if (uinfo->value.enumerated.item >= 8) | |
4414 | uinfo->value.enumerated.item = 7; | |
4415 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
4416 | return 0; | |
4417 | } | |
4418 | ||
4419 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, | |
4420 | struct snd_ctl_elem_value *ucontrol) | |
4421 | { | |
4422 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4423 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4424 | unsigned int pin_ctl, item = 0; | |
4425 | ||
4426 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | |
4427 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
4428 | if (pin_ctl & AC_PINCTL_OUT_EN) { | |
4429 | if (pin_ctl & AC_PINCTL_HP_EN) | |
4430 | item = 2; | |
4431 | else | |
4432 | item = 1; | |
4433 | } else if (pin_ctl & AC_PINCTL_IN_EN) { | |
4434 | switch (pin_ctl & AC_PINCTL_VREFEN) { | |
4435 | case AC_PINCTL_VREF_HIZ: item = 3; break; | |
4436 | case AC_PINCTL_VREF_50: item = 4; break; | |
4437 | case AC_PINCTL_VREF_GRD: item = 5; break; | |
4438 | case AC_PINCTL_VREF_80: item = 6; break; | |
4439 | case AC_PINCTL_VREF_100: item = 7; break; | |
4440 | } | |
4441 | } | |
4442 | ucontrol->value.enumerated.item[0] = item; | |
4443 | return 0; | |
4444 | } | |
4445 | ||
4446 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, | |
4447 | struct snd_ctl_elem_value *ucontrol) | |
4448 | { | |
4449 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4450 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4451 | static unsigned int ctls[] = { | |
4452 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, | |
4453 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, | |
4454 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, | |
4455 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, | |
4456 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, | |
4457 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, | |
4458 | }; | |
4459 | unsigned int old_ctl, new_ctl; | |
4460 | ||
4461 | old_ctl = snd_hda_codec_read(codec, nid, 0, | |
4462 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
4463 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; | |
4464 | if (old_ctl != new_ctl) { | |
4465 | int val; | |
4466 | snd_hda_codec_write_cache(codec, nid, 0, | |
4467 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4468 | new_ctl); | |
4469 | val = ucontrol->value.enumerated.item[0] >= 3 ? | |
4470 | HDA_AMP_MUTE : 0; | |
4471 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
4472 | HDA_AMP_MUTE, val); | |
4473 | return 1; | |
4474 | } | |
4475 | return 0; | |
4476 | } | |
4477 | ||
4478 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, | |
4479 | struct snd_ctl_elem_info *uinfo) | |
4480 | { | |
4481 | static char *texts[] = { | |
4482 | "Front", "Surround", "CLFE", "Side" | |
4483 | }; | |
4484 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
4485 | uinfo->count = 1; | |
4486 | uinfo->value.enumerated.items = 4; | |
4487 | if (uinfo->value.enumerated.item >= 4) | |
4488 | uinfo->value.enumerated.item = 3; | |
4489 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
4490 | return 0; | |
4491 | } | |
4492 | ||
4493 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, | |
4494 | struct snd_ctl_elem_value *ucontrol) | |
4495 | { | |
4496 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4497 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4498 | unsigned int sel; | |
4499 | ||
4500 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); | |
4501 | ucontrol->value.enumerated.item[0] = sel & 3; | |
4502 | return 0; | |
4503 | } | |
4504 | ||
4505 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, | |
4506 | struct snd_ctl_elem_value *ucontrol) | |
4507 | { | |
4508 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4509 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4510 | unsigned int sel; | |
4511 | ||
4512 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; | |
4513 | if (ucontrol->value.enumerated.item[0] != sel) { | |
4514 | sel = ucontrol->value.enumerated.item[0] & 3; | |
4515 | snd_hda_codec_write_cache(codec, nid, 0, | |
4516 | AC_VERB_SET_CONNECT_SEL, sel); | |
4517 | return 1; | |
4518 | } | |
4519 | return 0; | |
4520 | } | |
4521 | ||
4522 | #define PIN_CTL_TEST(xname,nid) { \ | |
4523 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
4524 | .name = xname, \ | |
4525 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | |
4526 | .info = alc_test_pin_ctl_info, \ | |
4527 | .get = alc_test_pin_ctl_get, \ | |
4528 | .put = alc_test_pin_ctl_put, \ | |
4529 | .private_value = nid \ | |
4530 | } | |
4531 | ||
4532 | #define PIN_SRC_TEST(xname,nid) { \ | |
4533 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
4534 | .name = xname, \ | |
4535 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | |
4536 | .info = alc_test_pin_src_info, \ | |
4537 | .get = alc_test_pin_src_get, \ | |
4538 | .put = alc_test_pin_src_put, \ | |
4539 | .private_value = nid \ | |
4540 | } | |
4541 | ||
4542 | static struct snd_kcontrol_new alc880_test_mixer[] = { | |
4543 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
4544 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
4545 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
4546 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
4547 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
4548 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
4549 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), | |
4550 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
4551 | PIN_CTL_TEST("Front Pin Mode", 0x14), | |
4552 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | |
4553 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | |
4554 | PIN_CTL_TEST("Side Pin Mode", 0x17), | |
4555 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), | |
4556 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), | |
4557 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), | |
4558 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), | |
4559 | PIN_SRC_TEST("In-1 Pin Source", 0x18), | |
4560 | PIN_SRC_TEST("In-2 Pin Source", 0x19), | |
4561 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), | |
4562 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), | |
4563 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
4564 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
4565 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
4566 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
4567 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), | |
4568 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), | |
4569 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
4570 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
4571 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), | |
4572 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
4573 | { | |
4574 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4575 | .name = "Channel Mode", | |
4576 | .info = alc_ch_mode_info, | |
4577 | .get = alc_ch_mode_get, | |
4578 | .put = alc_ch_mode_put, | |
4579 | }, | |
4580 | { } /* end */ | |
4581 | }; | |
4582 | ||
4583 | static struct hda_verb alc880_test_init_verbs[] = { | |
4584 | /* Unmute inputs of 0x0c - 0x0f */ | |
4585 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4586 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4588 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4589 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4590 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4591 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4592 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4593 | /* Vol output for 0x0c-0x0f */ | |
4594 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4595 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4596 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4597 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4598 | /* Set output pins 0x14-0x17 */ | |
4599 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4600 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4601 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4602 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4603 | /* Unmute output pins 0x14-0x17 */ | |
4604 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4605 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4606 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4607 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4608 | /* Set input pins 0x18-0x1c */ | |
4609 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
4610 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
4611 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
4612 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
4613 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
4614 | /* Mute input pins 0x18-0x1b */ | |
4615 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4616 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4617 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4618 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4619 | /* ADC set up */ | |
4620 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4621 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4622 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4623 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4624 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4625 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4626 | /* Analog input/passthru */ | |
4627 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4628 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4629 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4630 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4631 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
4632 | { } | |
4633 | }; | |
4634 | #endif | |
4635 | ||
4636 | /* | |
4637 | */ | |
4638 | ||
4639 | static const char * const alc880_models[ALC880_MODEL_LAST] = { | |
4640 | [ALC880_3ST] = "3stack", | |
4641 | [ALC880_TCL_S700] = "tcl", | |
4642 | [ALC880_3ST_DIG] = "3stack-digout", | |
4643 | [ALC880_CLEVO] = "clevo", | |
4644 | [ALC880_5ST] = "5stack", | |
4645 | [ALC880_5ST_DIG] = "5stack-digout", | |
4646 | [ALC880_W810] = "w810", | |
4647 | [ALC880_Z71V] = "z71v", | |
4648 | [ALC880_6ST] = "6stack", | |
4649 | [ALC880_6ST_DIG] = "6stack-digout", | |
4650 | [ALC880_ASUS] = "asus", | |
4651 | [ALC880_ASUS_W1V] = "asus-w1v", | |
4652 | [ALC880_ASUS_DIG] = "asus-dig", | |
4653 | [ALC880_ASUS_DIG2] = "asus-dig2", | |
4654 | [ALC880_UNIWILL_DIG] = "uniwill", | |
4655 | [ALC880_UNIWILL_P53] = "uniwill-p53", | |
4656 | [ALC880_FUJITSU] = "fujitsu", | |
4657 | [ALC880_F1734] = "F1734", | |
4658 | [ALC880_LG] = "lg", | |
4659 | [ALC880_LG_LW] = "lg-lw", | |
4660 | [ALC880_MEDION_RIM] = "medion", | |
4661 | #ifdef CONFIG_SND_DEBUG | |
4662 | [ALC880_TEST] = "test", | |
4663 | #endif | |
4664 | [ALC880_AUTO] = "auto", | |
4665 | }; | |
4666 | ||
4667 | static struct snd_pci_quirk alc880_cfg_tbl[] = { | |
4668 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), | |
4669 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), | |
4670 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), | |
4671 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), | |
4672 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), | |
4673 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), | |
4674 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), | |
4675 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), | |
4676 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), | |
4677 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), | |
4678 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), | |
4679 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), | |
4680 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), | |
4681 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), | |
4682 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), | |
4683 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), | |
4684 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), | |
4685 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), | |
4686 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ | |
4687 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), | |
4688 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), | |
4689 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), | |
4690 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), | |
4691 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), | |
4692 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), | |
4693 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ | |
4694 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), | |
4695 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), | |
4696 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), | |
4697 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), | |
4698 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), | |
4699 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), | |
4700 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), | |
4701 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), | |
4702 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), | |
4703 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), | |
4704 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), | |
4705 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), | |
4706 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), | |
4707 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), | |
4708 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), | |
4709 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), | |
4710 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), | |
4711 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), | |
4712 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), | |
4713 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), | |
4714 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), | |
4715 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), | |
4716 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), | |
4717 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), | |
4718 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), | |
4719 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), | |
4720 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), | |
4721 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), | |
4722 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), | |
4723 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), | |
4724 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), | |
4725 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ | |
4726 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), | |
4727 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), | |
4728 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), | |
4729 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), | |
4730 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), | |
4731 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), | |
4732 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), | |
4733 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), | |
4734 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), | |
4735 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), | |
4736 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), | |
4737 | /* default Intel */ | |
4738 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), | |
4739 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), | |
4740 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), | |
4741 | {} | |
4742 | }; | |
4743 | ||
4744 | /* | |
4745 | * ALC880 codec presets | |
4746 | */ | |
4747 | static struct alc_config_preset alc880_presets[] = { | |
4748 | [ALC880_3ST] = { | |
4749 | .mixers = { alc880_three_stack_mixer }, | |
4750 | .init_verbs = { alc880_volume_init_verbs, | |
4751 | alc880_pin_3stack_init_verbs }, | |
4752 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4753 | .dac_nids = alc880_dac_nids, | |
4754 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4755 | .channel_mode = alc880_threestack_modes, | |
4756 | .need_dac_fix = 1, | |
4757 | .input_mux = &alc880_capture_source, | |
4758 | }, | |
4759 | [ALC880_3ST_DIG] = { | |
4760 | .mixers = { alc880_three_stack_mixer }, | |
4761 | .init_verbs = { alc880_volume_init_verbs, | |
4762 | alc880_pin_3stack_init_verbs }, | |
4763 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4764 | .dac_nids = alc880_dac_nids, | |
4765 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4766 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4767 | .channel_mode = alc880_threestack_modes, | |
4768 | .need_dac_fix = 1, | |
4769 | .input_mux = &alc880_capture_source, | |
4770 | }, | |
4771 | [ALC880_TCL_S700] = { | |
4772 | .mixers = { alc880_tcl_s700_mixer }, | |
4773 | .init_verbs = { alc880_volume_init_verbs, | |
4774 | alc880_pin_tcl_S700_init_verbs, | |
4775 | alc880_gpio2_init_verbs }, | |
4776 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4777 | .dac_nids = alc880_dac_nids, | |
4778 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ | |
4779 | .num_adc_nids = 1, /* single ADC */ | |
4780 | .hp_nid = 0x03, | |
4781 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4782 | .channel_mode = alc880_2_jack_modes, | |
4783 | .input_mux = &alc880_capture_source, | |
4784 | }, | |
4785 | [ALC880_5ST] = { | |
4786 | .mixers = { alc880_three_stack_mixer, | |
4787 | alc880_five_stack_mixer}, | |
4788 | .init_verbs = { alc880_volume_init_verbs, | |
4789 | alc880_pin_5stack_init_verbs }, | |
4790 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4791 | .dac_nids = alc880_dac_nids, | |
4792 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), | |
4793 | .channel_mode = alc880_fivestack_modes, | |
4794 | .input_mux = &alc880_capture_source, | |
4795 | }, | |
4796 | [ALC880_5ST_DIG] = { | |
4797 | .mixers = { alc880_three_stack_mixer, | |
4798 | alc880_five_stack_mixer }, | |
4799 | .init_verbs = { alc880_volume_init_verbs, | |
4800 | alc880_pin_5stack_init_verbs }, | |
4801 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4802 | .dac_nids = alc880_dac_nids, | |
4803 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4804 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), | |
4805 | .channel_mode = alc880_fivestack_modes, | |
4806 | .input_mux = &alc880_capture_source, | |
4807 | }, | |
4808 | [ALC880_6ST] = { | |
4809 | .mixers = { alc880_six_stack_mixer }, | |
4810 | .init_verbs = { alc880_volume_init_verbs, | |
4811 | alc880_pin_6stack_init_verbs }, | |
4812 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), | |
4813 | .dac_nids = alc880_6st_dac_nids, | |
4814 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
4815 | .channel_mode = alc880_sixstack_modes, | |
4816 | .input_mux = &alc880_6stack_capture_source, | |
4817 | }, | |
4818 | [ALC880_6ST_DIG] = { | |
4819 | .mixers = { alc880_six_stack_mixer }, | |
4820 | .init_verbs = { alc880_volume_init_verbs, | |
4821 | alc880_pin_6stack_init_verbs }, | |
4822 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), | |
4823 | .dac_nids = alc880_6st_dac_nids, | |
4824 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4825 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
4826 | .channel_mode = alc880_sixstack_modes, | |
4827 | .input_mux = &alc880_6stack_capture_source, | |
4828 | }, | |
4829 | [ALC880_W810] = { | |
4830 | .mixers = { alc880_w810_base_mixer }, | |
4831 | .init_verbs = { alc880_volume_init_verbs, | |
4832 | alc880_pin_w810_init_verbs, | |
4833 | alc880_gpio2_init_verbs }, | |
4834 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), | |
4835 | .dac_nids = alc880_w810_dac_nids, | |
4836 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4837 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
4838 | .channel_mode = alc880_w810_modes, | |
4839 | .input_mux = &alc880_capture_source, | |
4840 | }, | |
4841 | [ALC880_Z71V] = { | |
4842 | .mixers = { alc880_z71v_mixer }, | |
4843 | .init_verbs = { alc880_volume_init_verbs, | |
4844 | alc880_pin_z71v_init_verbs }, | |
4845 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), | |
4846 | .dac_nids = alc880_z71v_dac_nids, | |
4847 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4848 | .hp_nid = 0x03, | |
4849 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4850 | .channel_mode = alc880_2_jack_modes, | |
4851 | .input_mux = &alc880_capture_source, | |
4852 | }, | |
4853 | [ALC880_F1734] = { | |
4854 | .mixers = { alc880_f1734_mixer }, | |
4855 | .init_verbs = { alc880_volume_init_verbs, | |
4856 | alc880_pin_f1734_init_verbs }, | |
4857 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), | |
4858 | .dac_nids = alc880_f1734_dac_nids, | |
4859 | .hp_nid = 0x02, | |
4860 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4861 | .channel_mode = alc880_2_jack_modes, | |
4862 | .input_mux = &alc880_f1734_capture_source, | |
4863 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4864 | .setup = alc880_uniwill_p53_setup, | |
4865 | .init_hook = alc_automute_amp, | |
4866 | }, | |
4867 | [ALC880_ASUS] = { | |
4868 | .mixers = { alc880_asus_mixer }, | |
4869 | .init_verbs = { alc880_volume_init_verbs, | |
4870 | alc880_pin_asus_init_verbs, | |
4871 | alc880_gpio1_init_verbs }, | |
4872 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4873 | .dac_nids = alc880_asus_dac_nids, | |
4874 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4875 | .channel_mode = alc880_asus_modes, | |
4876 | .need_dac_fix = 1, | |
4877 | .input_mux = &alc880_capture_source, | |
4878 | }, | |
4879 | [ALC880_ASUS_DIG] = { | |
4880 | .mixers = { alc880_asus_mixer }, | |
4881 | .init_verbs = { alc880_volume_init_verbs, | |
4882 | alc880_pin_asus_init_verbs, | |
4883 | alc880_gpio1_init_verbs }, | |
4884 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4885 | .dac_nids = alc880_asus_dac_nids, | |
4886 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4887 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4888 | .channel_mode = alc880_asus_modes, | |
4889 | .need_dac_fix = 1, | |
4890 | .input_mux = &alc880_capture_source, | |
4891 | }, | |
4892 | [ALC880_ASUS_DIG2] = { | |
4893 | .mixers = { alc880_asus_mixer }, | |
4894 | .init_verbs = { alc880_volume_init_verbs, | |
4895 | alc880_pin_asus_init_verbs, | |
4896 | alc880_gpio2_init_verbs }, /* use GPIO2 */ | |
4897 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4898 | .dac_nids = alc880_asus_dac_nids, | |
4899 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4900 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4901 | .channel_mode = alc880_asus_modes, | |
4902 | .need_dac_fix = 1, | |
4903 | .input_mux = &alc880_capture_source, | |
4904 | }, | |
4905 | [ALC880_ASUS_W1V] = { | |
4906 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, | |
4907 | .init_verbs = { alc880_volume_init_verbs, | |
4908 | alc880_pin_asus_init_verbs, | |
4909 | alc880_gpio1_init_verbs }, | |
4910 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4911 | .dac_nids = alc880_asus_dac_nids, | |
4912 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4913 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4914 | .channel_mode = alc880_asus_modes, | |
4915 | .need_dac_fix = 1, | |
4916 | .input_mux = &alc880_capture_source, | |
4917 | }, | |
4918 | [ALC880_UNIWILL_DIG] = { | |
4919 | .mixers = { alc880_asus_mixer }, | |
4920 | .init_verbs = { alc880_volume_init_verbs, | |
4921 | alc880_pin_asus_init_verbs }, | |
4922 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4923 | .dac_nids = alc880_asus_dac_nids, | |
4924 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4925 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4926 | .channel_mode = alc880_asus_modes, | |
4927 | .need_dac_fix = 1, | |
4928 | .input_mux = &alc880_capture_source, | |
4929 | }, | |
4930 | [ALC880_UNIWILL] = { | |
4931 | .mixers = { alc880_uniwill_mixer }, | |
4932 | .init_verbs = { alc880_volume_init_verbs, | |
4933 | alc880_uniwill_init_verbs }, | |
4934 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4935 | .dac_nids = alc880_asus_dac_nids, | |
4936 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4937 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4938 | .channel_mode = alc880_threestack_modes, | |
4939 | .need_dac_fix = 1, | |
4940 | .input_mux = &alc880_capture_source, | |
4941 | .unsol_event = alc880_uniwill_unsol_event, | |
4942 | .setup = alc880_uniwill_setup, | |
4943 | .init_hook = alc880_uniwill_init_hook, | |
4944 | }, | |
4945 | [ALC880_UNIWILL_P53] = { | |
4946 | .mixers = { alc880_uniwill_p53_mixer }, | |
4947 | .init_verbs = { alc880_volume_init_verbs, | |
4948 | alc880_uniwill_p53_init_verbs }, | |
4949 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4950 | .dac_nids = alc880_asus_dac_nids, | |
4951 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
4952 | .channel_mode = alc880_threestack_modes, | |
4953 | .input_mux = &alc880_capture_source, | |
4954 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4955 | .setup = alc880_uniwill_p53_setup, | |
4956 | .init_hook = alc_automute_amp, | |
4957 | }, | |
4958 | [ALC880_FUJITSU] = { | |
4959 | .mixers = { alc880_fujitsu_mixer }, | |
4960 | .init_verbs = { alc880_volume_init_verbs, | |
4961 | alc880_uniwill_p53_init_verbs, | |
4962 | alc880_beep_init_verbs }, | |
4963 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4964 | .dac_nids = alc880_dac_nids, | |
4965 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4966 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4967 | .channel_mode = alc880_2_jack_modes, | |
4968 | .input_mux = &alc880_capture_source, | |
4969 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4970 | .setup = alc880_uniwill_p53_setup, | |
4971 | .init_hook = alc_automute_amp, | |
4972 | }, | |
4973 | [ALC880_CLEVO] = { | |
4974 | .mixers = { alc880_three_stack_mixer }, | |
4975 | .init_verbs = { alc880_volume_init_verbs, | |
4976 | alc880_pin_clevo_init_verbs }, | |
4977 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4978 | .dac_nids = alc880_dac_nids, | |
4979 | .hp_nid = 0x03, | |
4980 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4981 | .channel_mode = alc880_threestack_modes, | |
4982 | .need_dac_fix = 1, | |
4983 | .input_mux = &alc880_capture_source, | |
4984 | }, | |
4985 | [ALC880_LG] = { | |
4986 | .mixers = { alc880_lg_mixer }, | |
4987 | .init_verbs = { alc880_volume_init_verbs, | |
4988 | alc880_lg_init_verbs }, | |
4989 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), | |
4990 | .dac_nids = alc880_lg_dac_nids, | |
4991 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4992 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), | |
4993 | .channel_mode = alc880_lg_ch_modes, | |
4994 | .need_dac_fix = 1, | |
4995 | .input_mux = &alc880_lg_capture_source, | |
4996 | .unsol_event = alc_automute_amp_unsol_event, | |
4997 | .setup = alc880_lg_setup, | |
4998 | .init_hook = alc_automute_amp, | |
4999 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
5000 | .loopbacks = alc880_lg_loopbacks, | |
5001 | #endif | |
5002 | }, | |
5003 | [ALC880_LG_LW] = { | |
5004 | .mixers = { alc880_lg_lw_mixer }, | |
5005 | .init_verbs = { alc880_volume_init_verbs, | |
5006 | alc880_lg_lw_init_verbs }, | |
5007 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
5008 | .dac_nids = alc880_dac_nids, | |
5009 | .dig_out_nid = ALC880_DIGOUT_NID, | |
5010 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), | |
5011 | .channel_mode = alc880_lg_lw_modes, | |
5012 | .input_mux = &alc880_lg_lw_capture_source, | |
5013 | .unsol_event = alc_automute_amp_unsol_event, | |
5014 | .setup = alc880_lg_lw_setup, | |
5015 | .init_hook = alc_automute_amp, | |
5016 | }, | |
5017 | [ALC880_MEDION_RIM] = { | |
5018 | .mixers = { alc880_medion_rim_mixer }, | |
5019 | .init_verbs = { alc880_volume_init_verbs, | |
5020 | alc880_medion_rim_init_verbs, | |
5021 | alc_gpio2_init_verbs }, | |
5022 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
5023 | .dac_nids = alc880_dac_nids, | |
5024 | .dig_out_nid = ALC880_DIGOUT_NID, | |
5025 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
5026 | .channel_mode = alc880_2_jack_modes, | |
5027 | .input_mux = &alc880_medion_rim_capture_source, | |
5028 | .unsol_event = alc880_medion_rim_unsol_event, | |
5029 | .setup = alc880_medion_rim_setup, | |
5030 | .init_hook = alc880_medion_rim_automute, | |
5031 | }, | |
5032 | #ifdef CONFIG_SND_DEBUG | |
5033 | [ALC880_TEST] = { | |
5034 | .mixers = { alc880_test_mixer }, | |
5035 | .init_verbs = { alc880_test_init_verbs }, | |
5036 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), | |
5037 | .dac_nids = alc880_test_dac_nids, | |
5038 | .dig_out_nid = ALC880_DIGOUT_NID, | |
5039 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), | |
5040 | .channel_mode = alc880_test_modes, | |
5041 | .input_mux = &alc880_test_capture_source, | |
5042 | }, | |
5043 | #endif | |
5044 | }; | |
5045 | ||
5046 | /* | |
5047 | * Automatic parse of I/O pins from the BIOS configuration | |
5048 | */ | |
5049 | ||
5050 | enum { | |
5051 | ALC_CTL_WIDGET_VOL, | |
5052 | ALC_CTL_WIDGET_MUTE, | |
5053 | ALC_CTL_BIND_MUTE, | |
5054 | }; | |
5055 | static struct snd_kcontrol_new alc880_control_templates[] = { | |
5056 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), | |
5057 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | |
5058 | HDA_BIND_MUTE(NULL, 0, 0, 0), | |
5059 | }; | |
5060 | ||
5061 | /* add dynamic controls */ | |
5062 | static int add_control(struct alc_spec *spec, int type, const char *name, | |
5063 | int cidx, unsigned long val) | |
5064 | { | |
5065 | struct snd_kcontrol_new *knew; | |
5066 | ||
5067 | snd_array_init(&spec->kctls, sizeof(*knew), 32); | |
5068 | knew = snd_array_new(&spec->kctls); | |
5069 | if (!knew) | |
5070 | return -ENOMEM; | |
5071 | *knew = alc880_control_templates[type]; | |
5072 | knew->name = kstrdup(name, GFP_KERNEL); | |
5073 | if (!knew->name) | |
5074 | return -ENOMEM; | |
5075 | knew->index = cidx; | |
5076 | if (get_amp_nid_(val)) | |
5077 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; | |
5078 | knew->private_value = val; | |
5079 | return 0; | |
5080 | } | |
5081 | ||
5082 | static int add_control_with_pfx(struct alc_spec *spec, int type, | |
5083 | const char *pfx, const char *dir, | |
5084 | const char *sfx, int cidx, unsigned long val) | |
5085 | { | |
5086 | char name[32]; | |
5087 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); | |
5088 | return add_control(spec, type, name, cidx, val); | |
5089 | } | |
5090 | ||
5091 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ | |
5092 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) | |
5093 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ | |
5094 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) | |
5095 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ | |
5096 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) | |
5097 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ | |
5098 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) | |
5099 | ||
5100 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) | |
5101 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | |
5102 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | |
5103 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | |
5104 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) | |
5105 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | |
5106 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | |
5107 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) | |
5108 | #define ALC880_PIN_CD_NID 0x1c | |
5109 | ||
5110 | /* fill in the dac_nids table from the parsed pin configuration */ | |
5111 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, | |
5112 | const struct auto_pin_cfg *cfg) | |
5113 | { | |
5114 | hda_nid_t nid; | |
5115 | int assigned[4]; | |
5116 | int i, j; | |
5117 | ||
5118 | memset(assigned, 0, sizeof(assigned)); | |
5119 | spec->multiout.dac_nids = spec->private_dac_nids; | |
5120 | ||
5121 | /* check the pins hardwired to audio widget */ | |
5122 | for (i = 0; i < cfg->line_outs; i++) { | |
5123 | nid = cfg->line_out_pins[i]; | |
5124 | if (alc880_is_fixed_pin(nid)) { | |
5125 | int idx = alc880_fixed_pin_idx(nid); | |
5126 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); | |
5127 | assigned[idx] = 1; | |
5128 | } | |
5129 | } | |
5130 | /* left pins can be connect to any audio widget */ | |
5131 | for (i = 0; i < cfg->line_outs; i++) { | |
5132 | nid = cfg->line_out_pins[i]; | |
5133 | if (alc880_is_fixed_pin(nid)) | |
5134 | continue; | |
5135 | /* search for an empty channel */ | |
5136 | for (j = 0; j < cfg->line_outs; j++) { | |
5137 | if (!assigned[j]) { | |
5138 | spec->multiout.dac_nids[i] = | |
5139 | alc880_idx_to_dac(j); | |
5140 | assigned[j] = 1; | |
5141 | break; | |
5142 | } | |
5143 | } | |
5144 | } | |
5145 | spec->multiout.num_dacs = cfg->line_outs; | |
5146 | return 0; | |
5147 | } | |
5148 | ||
5149 | static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg, | |
5150 | bool can_be_master) | |
5151 | { | |
5152 | if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master) | |
5153 | return "Master"; | |
5154 | ||
5155 | switch (cfg->line_out_type) { | |
5156 | case AUTO_PIN_SPEAKER_OUT: | |
5157 | return "Speaker"; | |
5158 | case AUTO_PIN_HP_OUT: | |
5159 | return "Headphone"; | |
5160 | default: | |
5161 | if (cfg->line_outs == 1) | |
5162 | return "PCM"; | |
5163 | break; | |
5164 | } | |
5165 | return NULL; | |
5166 | } | |
5167 | ||
5168 | /* add playback controls from the parsed DAC table */ | |
5169 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, | |
5170 | const struct auto_pin_cfg *cfg) | |
5171 | { | |
5172 | static const char * const chname[4] = { | |
5173 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
5174 | }; | |
5175 | const char *pfx = alc_get_line_out_pfx(cfg, false); | |
5176 | hda_nid_t nid; | |
5177 | int i, err; | |
5178 | ||
5179 | for (i = 0; i < cfg->line_outs; i++) { | |
5180 | if (!spec->multiout.dac_nids[i]) | |
5181 | continue; | |
5182 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); | |
5183 | if (!pfx && i == 2) { | |
5184 | /* Center/LFE */ | |
5185 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
5186 | "Center", | |
5187 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | |
5188 | HDA_OUTPUT)); | |
5189 | if (err < 0) | |
5190 | return err; | |
5191 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
5192 | "LFE", | |
5193 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
5194 | HDA_OUTPUT)); | |
5195 | if (err < 0) | |
5196 | return err; | |
5197 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
5198 | "Center", | |
5199 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, | |
5200 | HDA_INPUT)); | |
5201 | if (err < 0) | |
5202 | return err; | |
5203 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
5204 | "LFE", | |
5205 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, | |
5206 | HDA_INPUT)); | |
5207 | if (err < 0) | |
5208 | return err; | |
5209 | } else { | |
5210 | const char *name = pfx; | |
5211 | if (!name) | |
5212 | name = chname[i]; | |
5213 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
5214 | name, i, | |
5215 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
5216 | HDA_OUTPUT)); | |
5217 | if (err < 0) | |
5218 | return err; | |
5219 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
5220 | name, i, | |
5221 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, | |
5222 | HDA_INPUT)); | |
5223 | if (err < 0) | |
5224 | return err; | |
5225 | } | |
5226 | } | |
5227 | return 0; | |
5228 | } | |
5229 | ||
5230 | /* add playback controls for speaker and HP outputs */ | |
5231 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
5232 | const char *pfx) | |
5233 | { | |
5234 | hda_nid_t nid; | |
5235 | int err; | |
5236 | ||
5237 | if (!pin) | |
5238 | return 0; | |
5239 | ||
5240 | if (alc880_is_fixed_pin(pin)) { | |
5241 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
5242 | /* specify the DAC as the extra output */ | |
5243 | if (!spec->multiout.hp_nid) | |
5244 | spec->multiout.hp_nid = nid; | |
5245 | else | |
5246 | spec->multiout.extra_out_nid[0] = nid; | |
5247 | /* control HP volume/switch on the output mixer amp */ | |
5248 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); | |
5249 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | |
5250 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
5251 | if (err < 0) | |
5252 | return err; | |
5253 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | |
5254 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); | |
5255 | if (err < 0) | |
5256 | return err; | |
5257 | } else if (alc880_is_multi_pin(pin)) { | |
5258 | /* set manual connection */ | |
5259 | /* we have only a switch on HP-out PIN */ | |
5260 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | |
5261 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
5262 | if (err < 0) | |
5263 | return err; | |
5264 | } | |
5265 | return 0; | |
5266 | } | |
5267 | ||
5268 | /* create input playback/capture controls for the given pin */ | |
5269 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, | |
5270 | const char *ctlname, int ctlidx, | |
5271 | int idx, hda_nid_t mix_nid) | |
5272 | { | |
5273 | int err; | |
5274 | ||
5275 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, | |
5276 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | |
5277 | if (err < 0) | |
5278 | return err; | |
5279 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, | |
5280 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | |
5281 | if (err < 0) | |
5282 | return err; | |
5283 | return 0; | |
5284 | } | |
5285 | ||
5286 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) | |
5287 | { | |
5288 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | |
5289 | return (pincap & AC_PINCAP_IN) != 0; | |
5290 | } | |
5291 | ||
5292 | /* create playback/capture controls for input pins */ | |
5293 | static int alc_auto_create_input_ctls(struct hda_codec *codec, | |
5294 | const struct auto_pin_cfg *cfg, | |
5295 | hda_nid_t mixer, | |
5296 | hda_nid_t cap1, hda_nid_t cap2) | |
5297 | { | |
5298 | struct alc_spec *spec = codec->spec; | |
5299 | struct hda_input_mux *imux = &spec->private_imux[0]; | |
5300 | int i, err, idx, type_idx = 0; | |
5301 | const char *prev_label = NULL; | |
5302 | ||
5303 | for (i = 0; i < cfg->num_inputs; i++) { | |
5304 | hda_nid_t pin; | |
5305 | const char *label; | |
5306 | ||
5307 | pin = cfg->inputs[i].pin; | |
5308 | if (!alc_is_input_pin(codec, pin)) | |
5309 | continue; | |
5310 | ||
5311 | label = hda_get_autocfg_input_label(codec, cfg, i); | |
5312 | if (prev_label && !strcmp(label, prev_label)) | |
5313 | type_idx++; | |
5314 | else | |
5315 | type_idx = 0; | |
5316 | prev_label = label; | |
5317 | ||
5318 | if (mixer) { | |
5319 | idx = get_connection_index(codec, mixer, pin); | |
5320 | if (idx >= 0) { | |
5321 | err = new_analog_input(spec, pin, | |
5322 | label, type_idx, | |
5323 | idx, mixer); | |
5324 | if (err < 0) | |
5325 | return err; | |
5326 | } | |
5327 | } | |
5328 | ||
5329 | if (!cap1) | |
5330 | continue; | |
5331 | idx = get_connection_index(codec, cap1, pin); | |
5332 | if (idx < 0 && cap2) | |
5333 | idx = get_connection_index(codec, cap2, pin); | |
5334 | if (idx >= 0) | |
5335 | snd_hda_add_imux_item(imux, label, idx, NULL); | |
5336 | } | |
5337 | return 0; | |
5338 | } | |
5339 | ||
5340 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, | |
5341 | const struct auto_pin_cfg *cfg) | |
5342 | { | |
5343 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); | |
5344 | } | |
5345 | ||
5346 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, | |
5347 | unsigned int pin_type) | |
5348 | { | |
5349 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5350 | pin_type); | |
5351 | /* unmute pin */ | |
5352 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
5353 | AMP_OUT_UNMUTE); | |
5354 | } | |
5355 | ||
5356 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, | |
5357 | hda_nid_t nid, int pin_type, | |
5358 | int dac_idx) | |
5359 | { | |
5360 | alc_set_pin_output(codec, nid, pin_type); | |
5361 | /* need the manual connection? */ | |
5362 | if (alc880_is_multi_pin(nid)) { | |
5363 | struct alc_spec *spec = codec->spec; | |
5364 | int idx = alc880_multi_pin_idx(nid); | |
5365 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
5366 | AC_VERB_SET_CONNECT_SEL, | |
5367 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
5368 | } | |
5369 | } | |
5370 | ||
5371 | static int get_pin_type(int line_out_type) | |
5372 | { | |
5373 | if (line_out_type == AUTO_PIN_HP_OUT) | |
5374 | return PIN_HP; | |
5375 | else | |
5376 | return PIN_OUT; | |
5377 | } | |
5378 | ||
5379 | static void alc880_auto_init_multi_out(struct hda_codec *codec) | |
5380 | { | |
5381 | struct alc_spec *spec = codec->spec; | |
5382 | int i; | |
5383 | ||
5384 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
5385 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
5386 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
5387 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); | |
5388 | } | |
5389 | } | |
5390 | ||
5391 | static void alc880_auto_init_extra_out(struct hda_codec *codec) | |
5392 | { | |
5393 | struct alc_spec *spec = codec->spec; | |
5394 | hda_nid_t pin; | |
5395 | ||
5396 | pin = spec->autocfg.speaker_pins[0]; | |
5397 | if (pin) /* connect to front */ | |
5398 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
5399 | pin = spec->autocfg.hp_pins[0]; | |
5400 | if (pin) /* connect to front */ | |
5401 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
5402 | } | |
5403 | ||
5404 | static void alc880_auto_init_analog_input(struct hda_codec *codec) | |
5405 | { | |
5406 | struct alc_spec *spec = codec->spec; | |
5407 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
5408 | int i; | |
5409 | ||
5410 | for (i = 0; i < cfg->num_inputs; i++) { | |
5411 | hda_nid_t nid = cfg->inputs[i].pin; | |
5412 | if (alc_is_input_pin(codec, nid)) { | |
5413 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); | |
5414 | if (nid != ALC880_PIN_CD_NID && | |
5415 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
5416 | snd_hda_codec_write(codec, nid, 0, | |
5417 | AC_VERB_SET_AMP_GAIN_MUTE, | |
5418 | AMP_OUT_MUTE); | |
5419 | } | |
5420 | } | |
5421 | } | |
5422 | ||
5423 | static void alc880_auto_init_input_src(struct hda_codec *codec) | |
5424 | { | |
5425 | struct alc_spec *spec = codec->spec; | |
5426 | int c; | |
5427 | ||
5428 | for (c = 0; c < spec->num_adc_nids; c++) { | |
5429 | unsigned int mux_idx; | |
5430 | const struct hda_input_mux *imux; | |
5431 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | |
5432 | imux = &spec->input_mux[mux_idx]; | |
5433 | if (!imux->num_items && mux_idx > 0) | |
5434 | imux = &spec->input_mux[0]; | |
5435 | if (imux) | |
5436 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, | |
5437 | AC_VERB_SET_CONNECT_SEL, | |
5438 | imux->items[0].index); | |
5439 | } | |
5440 | } | |
5441 | ||
5442 | /* parse the BIOS configuration and set up the alc_spec */ | |
5443 | /* return 1 if successful, 0 if the proper config is not found, | |
5444 | * or a negative error code | |
5445 | */ | |
5446 | static int alc880_parse_auto_config(struct hda_codec *codec) | |
5447 | { | |
5448 | struct alc_spec *spec = codec->spec; | |
5449 | int err; | |
5450 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; | |
5451 | ||
5452 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
5453 | alc880_ignore); | |
5454 | if (err < 0) | |
5455 | return err; | |
5456 | if (!spec->autocfg.line_outs) | |
5457 | return 0; /* can't find valid BIOS pin config */ | |
5458 | ||
5459 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | |
5460 | if (err < 0) | |
5461 | return err; | |
5462 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
5463 | if (err < 0) | |
5464 | return err; | |
5465 | err = alc880_auto_create_extra_out(spec, | |
5466 | spec->autocfg.speaker_pins[0], | |
5467 | "Speaker"); | |
5468 | if (err < 0) | |
5469 | return err; | |
5470 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
5471 | "Headphone"); | |
5472 | if (err < 0) | |
5473 | return err; | |
5474 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); | |
5475 | if (err < 0) | |
5476 | return err; | |
5477 | ||
5478 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
5479 | ||
5480 | alc_auto_parse_digital(codec); | |
5481 | ||
5482 | if (spec->kctls.list) | |
5483 | add_mixer(spec, spec->kctls.list); | |
5484 | ||
5485 | add_verb(spec, alc880_volume_init_verbs); | |
5486 | ||
5487 | spec->num_mux_defs = 1; | |
5488 | spec->input_mux = &spec->private_imux[0]; | |
5489 | ||
5490 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
5491 | ||
5492 | return 1; | |
5493 | } | |
5494 | ||
5495 | /* additional initialization for auto-configuration model */ | |
5496 | static void alc880_auto_init(struct hda_codec *codec) | |
5497 | { | |
5498 | struct alc_spec *spec = codec->spec; | |
5499 | alc880_auto_init_multi_out(codec); | |
5500 | alc880_auto_init_extra_out(codec); | |
5501 | alc880_auto_init_analog_input(codec); | |
5502 | alc880_auto_init_input_src(codec); | |
5503 | alc_auto_init_digital(codec); | |
5504 | if (spec->unsol_event) | |
5505 | alc_inithook(codec); | |
5506 | } | |
5507 | ||
5508 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only | |
5509 | * one of two digital mic pins, e.g. on ALC272 | |
5510 | */ | |
5511 | static void fixup_automic_adc(struct hda_codec *codec) | |
5512 | { | |
5513 | struct alc_spec *spec = codec->spec; | |
5514 | int i; | |
5515 | ||
5516 | for (i = 0; i < spec->num_adc_nids; i++) { | |
5517 | hda_nid_t cap = spec->capsrc_nids ? | |
5518 | spec->capsrc_nids[i] : spec->adc_nids[i]; | |
5519 | int iidx, eidx; | |
5520 | ||
5521 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); | |
5522 | if (iidx < 0) | |
5523 | continue; | |
5524 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); | |
5525 | if (eidx < 0) | |
5526 | continue; | |
5527 | spec->int_mic.mux_idx = iidx; | |
5528 | spec->ext_mic.mux_idx = eidx; | |
5529 | if (spec->capsrc_nids) | |
5530 | spec->capsrc_nids += i; | |
5531 | spec->adc_nids += i; | |
5532 | spec->num_adc_nids = 1; | |
5533 | return; | |
5534 | } | |
5535 | snd_printd(KERN_INFO "hda_codec: %s: " | |
5536 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", | |
5537 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); | |
5538 | spec->auto_mic = 0; /* disable auto-mic to be sure */ | |
5539 | } | |
5540 | ||
5541 | /* select or unmute the given capsrc route */ | |
5542 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, | |
5543 | int idx) | |
5544 | { | |
5545 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { | |
5546 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, | |
5547 | HDA_AMP_MUTE, 0); | |
5548 | } else { | |
5549 | snd_hda_codec_write_cache(codec, cap, 0, | |
5550 | AC_VERB_SET_CONNECT_SEL, idx); | |
5551 | } | |
5552 | } | |
5553 | ||
5554 | /* set the default connection to that pin */ | |
5555 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) | |
5556 | { | |
5557 | struct alc_spec *spec = codec->spec; | |
5558 | int i; | |
5559 | ||
5560 | for (i = 0; i < spec->num_adc_nids; i++) { | |
5561 | hda_nid_t cap = spec->capsrc_nids ? | |
5562 | spec->capsrc_nids[i] : spec->adc_nids[i]; | |
5563 | int idx; | |
5564 | ||
5565 | idx = get_connection_index(codec, cap, pin); | |
5566 | if (idx < 0) | |
5567 | continue; | |
5568 | select_or_unmute_capsrc(codec, cap, idx); | |
5569 | return i; /* return the found index */ | |
5570 | } | |
5571 | return -1; /* not found */ | |
5572 | } | |
5573 | ||
5574 | /* choose the ADC/MUX containing the input pin and initialize the setup */ | |
5575 | static void fixup_single_adc(struct hda_codec *codec) | |
5576 | { | |
5577 | struct alc_spec *spec = codec->spec; | |
5578 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
5579 | int i; | |
5580 | ||
5581 | /* search for the input pin; there must be only one */ | |
5582 | if (cfg->num_inputs != 1) | |
5583 | return; | |
5584 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); | |
5585 | if (i >= 0) { | |
5586 | /* use only this ADC */ | |
5587 | if (spec->capsrc_nids) | |
5588 | spec->capsrc_nids += i; | |
5589 | spec->adc_nids += i; | |
5590 | spec->num_adc_nids = 1; | |
5591 | } | |
5592 | } | |
5593 | ||
5594 | /* initialize dual adcs */ | |
5595 | static void fixup_dual_adc_switch(struct hda_codec *codec) | |
5596 | { | |
5597 | struct alc_spec *spec = codec->spec; | |
5598 | init_capsrc_for_pin(codec, spec->ext_mic.pin); | |
5599 | init_capsrc_for_pin(codec, spec->int_mic.pin); | |
5600 | } | |
5601 | ||
5602 | static void set_capture_mixer(struct hda_codec *codec) | |
5603 | { | |
5604 | struct alc_spec *spec = codec->spec; | |
5605 | static struct snd_kcontrol_new *caps[2][3] = { | |
5606 | { alc_capture_mixer_nosrc1, | |
5607 | alc_capture_mixer_nosrc2, | |
5608 | alc_capture_mixer_nosrc3 }, | |
5609 | { alc_capture_mixer1, | |
5610 | alc_capture_mixer2, | |
5611 | alc_capture_mixer3 }, | |
5612 | }; | |
5613 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { | |
5614 | int mux = 0; | |
5615 | int num_adcs = spec->num_adc_nids; | |
5616 | if (spec->dual_adc_switch) | |
5617 | fixup_dual_adc_switch(codec); | |
5618 | else if (spec->auto_mic) | |
5619 | fixup_automic_adc(codec); | |
5620 | else if (spec->input_mux) { | |
5621 | if (spec->input_mux->num_items > 1) | |
5622 | mux = 1; | |
5623 | else if (spec->input_mux->num_items == 1) | |
5624 | fixup_single_adc(codec); | |
5625 | } | |
5626 | if (spec->dual_adc_switch) | |
5627 | num_adcs = 1; | |
5628 | spec->cap_mixer = caps[mux][num_adcs - 1]; | |
5629 | } | |
5630 | } | |
5631 | ||
5632 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ | |
5633 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, | |
5634 | int num_nids) | |
5635 | { | |
5636 | struct alc_spec *spec = codec->spec; | |
5637 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
5638 | int n; | |
5639 | hda_nid_t fallback_adc = 0, fallback_cap = 0; | |
5640 | ||
5641 | for (n = 0; n < num_nids; n++) { | |
5642 | hda_nid_t adc, cap; | |
5643 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | |
5644 | int nconns, i, j; | |
5645 | ||
5646 | adc = nids[n]; | |
5647 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) | |
5648 | continue; | |
5649 | cap = adc; | |
5650 | nconns = snd_hda_get_connections(codec, cap, conn, | |
5651 | ARRAY_SIZE(conn)); | |
5652 | if (nconns == 1) { | |
5653 | cap = conn[0]; | |
5654 | nconns = snd_hda_get_connections(codec, cap, conn, | |
5655 | ARRAY_SIZE(conn)); | |
5656 | } | |
5657 | if (nconns <= 0) | |
5658 | continue; | |
5659 | if (!fallback_adc) { | |
5660 | fallback_adc = adc; | |
5661 | fallback_cap = cap; | |
5662 | } | |
5663 | for (i = 0; i < cfg->num_inputs; i++) { | |
5664 | hda_nid_t nid = cfg->inputs[i].pin; | |
5665 | for (j = 0; j < nconns; j++) { | |
5666 | if (conn[j] == nid) | |
5667 | break; | |
5668 | } | |
5669 | if (j >= nconns) | |
5670 | break; | |
5671 | } | |
5672 | if (i >= cfg->num_inputs) { | |
5673 | int num_adcs = spec->num_adc_nids; | |
5674 | spec->private_adc_nids[num_adcs] = adc; | |
5675 | spec->private_capsrc_nids[num_adcs] = cap; | |
5676 | spec->num_adc_nids++; | |
5677 | spec->adc_nids = spec->private_adc_nids; | |
5678 | if (adc != cap) | |
5679 | spec->capsrc_nids = spec->private_capsrc_nids; | |
5680 | } | |
5681 | } | |
5682 | if (!spec->num_adc_nids) { | |
5683 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" | |
5684 | " using fallback 0x%x\n", | |
5685 | codec->chip_name, fallback_adc); | |
5686 | spec->private_adc_nids[0] = fallback_adc; | |
5687 | spec->adc_nids = spec->private_adc_nids; | |
5688 | if (fallback_adc != fallback_cap) { | |
5689 | spec->private_capsrc_nids[0] = fallback_cap; | |
5690 | spec->capsrc_nids = spec->private_adc_nids; | |
5691 | } | |
5692 | } | |
5693 | } | |
5694 | ||
5695 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | |
5696 | #define set_beep_amp(spec, nid, idx, dir) \ | |
5697 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) | |
5698 | ||
5699 | static struct snd_pci_quirk beep_white_list[] = { | |
5700 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), | |
5701 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), | |
5702 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), | |
5703 | {} | |
5704 | }; | |
5705 | ||
5706 | static inline int has_cdefine_beep(struct hda_codec *codec) | |
5707 | { | |
5708 | struct alc_spec *spec = codec->spec; | |
5709 | const struct snd_pci_quirk *q; | |
5710 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); | |
5711 | if (q) | |
5712 | return q->value; | |
5713 | return spec->cdefine.enable_pcbeep; | |
5714 | } | |
5715 | #else | |
5716 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ | |
5717 | #define has_cdefine_beep(codec) 0 | |
5718 | #endif | |
5719 | ||
5720 | /* | |
5721 | * OK, here we have finally the patch for ALC880 | |
5722 | */ | |
5723 | ||
5724 | static int patch_alc880(struct hda_codec *codec) | |
5725 | { | |
5726 | struct alc_spec *spec; | |
5727 | int board_config; | |
5728 | int err; | |
5729 | ||
5730 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
5731 | if (spec == NULL) | |
5732 | return -ENOMEM; | |
5733 | ||
5734 | codec->spec = spec; | |
5735 | ||
5736 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, | |
5737 | alc880_models, | |
5738 | alc880_cfg_tbl); | |
5739 | if (board_config < 0) { | |
5740 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
5741 | codec->chip_name); | |
5742 | board_config = ALC880_AUTO; | |
5743 | } | |
5744 | ||
5745 | if (board_config == ALC880_AUTO) { | |
5746 | /* automatic parse from the BIOS config */ | |
5747 | err = alc880_parse_auto_config(codec); | |
5748 | if (err < 0) { | |
5749 | alc_free(codec); | |
5750 | return err; | |
5751 | } else if (!err) { | |
5752 | printk(KERN_INFO | |
5753 | "hda_codec: Cannot set up configuration " | |
5754 | "from BIOS. Using 3-stack mode...\n"); | |
5755 | board_config = ALC880_3ST; | |
5756 | } | |
5757 | } | |
5758 | ||
5759 | err = snd_hda_attach_beep_device(codec, 0x1); | |
5760 | if (err < 0) { | |
5761 | alc_free(codec); | |
5762 | return err; | |
5763 | } | |
5764 | ||
5765 | if (board_config != ALC880_AUTO) | |
5766 | setup_preset(codec, &alc880_presets[board_config]); | |
5767 | ||
5768 | spec->stream_analog_playback = &alc880_pcm_analog_playback; | |
5769 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | |
5770 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | |
5771 | ||
5772 | spec->stream_digital_playback = &alc880_pcm_digital_playback; | |
5773 | spec->stream_digital_capture = &alc880_pcm_digital_capture; | |
5774 | ||
5775 | if (!spec->adc_nids && spec->input_mux) { | |
5776 | /* check whether NID 0x07 is valid */ | |
5777 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); | |
5778 | /* get type */ | |
5779 | wcap = get_wcaps_type(wcap); | |
5780 | if (wcap != AC_WID_AUD_IN) { | |
5781 | spec->adc_nids = alc880_adc_nids_alt; | |
5782 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | |
5783 | } else { | |
5784 | spec->adc_nids = alc880_adc_nids; | |
5785 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | |
5786 | } | |
5787 | } | |
5788 | set_capture_mixer(codec); | |
5789 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
5790 | ||
5791 | spec->vmaster_nid = 0x0c; | |
5792 | ||
5793 | codec->patch_ops = alc_patch_ops; | |
5794 | if (board_config == ALC880_AUTO) | |
5795 | spec->init_hook = alc880_auto_init; | |
5796 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
5797 | if (!spec->loopback.amplist) | |
5798 | spec->loopback.amplist = alc880_loopbacks; | |
5799 | #endif | |
5800 | ||
5801 | return 0; | |
5802 | } | |
5803 | ||
5804 | ||
5805 | /* | |
5806 | * ALC260 support | |
5807 | */ | |
5808 | ||
5809 | static hda_nid_t alc260_dac_nids[1] = { | |
5810 | /* front */ | |
5811 | 0x02, | |
5812 | }; | |
5813 | ||
5814 | static hda_nid_t alc260_adc_nids[1] = { | |
5815 | /* ADC0 */ | |
5816 | 0x04, | |
5817 | }; | |
5818 | ||
5819 | static hda_nid_t alc260_adc_nids_alt[1] = { | |
5820 | /* ADC1 */ | |
5821 | 0x05, | |
5822 | }; | |
5823 | ||
5824 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that | |
5825 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. | |
5826 | */ | |
5827 | static hda_nid_t alc260_dual_adc_nids[2] = { | |
5828 | /* ADC0, ADC1 */ | |
5829 | 0x04, 0x05 | |
5830 | }; | |
5831 | ||
5832 | #define ALC260_DIGOUT_NID 0x03 | |
5833 | #define ALC260_DIGIN_NID 0x06 | |
5834 | ||
5835 | static struct hda_input_mux alc260_capture_source = { | |
5836 | .num_items = 4, | |
5837 | .items = { | |
5838 | { "Mic", 0x0 }, | |
5839 | { "Front Mic", 0x1 }, | |
5840 | { "Line", 0x2 }, | |
5841 | { "CD", 0x4 }, | |
5842 | }, | |
5843 | }; | |
5844 | ||
5845 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, | |
5846 | * headphone jack and the internal CD lines since these are the only pins at | |
5847 | * which audio can appear. For flexibility, also allow the option of | |
5848 | * recording the mixer output on the second ADC (ADC0 doesn't have a | |
5849 | * connection to the mixer output). | |
5850 | */ | |
5851 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { | |
5852 | { | |
5853 | .num_items = 3, | |
5854 | .items = { | |
5855 | { "Mic/Line", 0x0 }, | |
5856 | { "CD", 0x4 }, | |
5857 | { "Headphone", 0x2 }, | |
5858 | }, | |
5859 | }, | |
5860 | { | |
5861 | .num_items = 4, | |
5862 | .items = { | |
5863 | { "Mic/Line", 0x0 }, | |
5864 | { "CD", 0x4 }, | |
5865 | { "Headphone", 0x2 }, | |
5866 | { "Mixer", 0x5 }, | |
5867 | }, | |
5868 | }, | |
5869 | ||
5870 | }; | |
5871 | ||
5872 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to | |
5873 | * the Fujitsu S702x, but jacks are marked differently. | |
5874 | */ | |
5875 | static struct hda_input_mux alc260_acer_capture_sources[2] = { | |
5876 | { | |
5877 | .num_items = 4, | |
5878 | .items = { | |
5879 | { "Mic", 0x0 }, | |
5880 | { "Line", 0x2 }, | |
5881 | { "CD", 0x4 }, | |
5882 | { "Headphone", 0x5 }, | |
5883 | }, | |
5884 | }, | |
5885 | { | |
5886 | .num_items = 5, | |
5887 | .items = { | |
5888 | { "Mic", 0x0 }, | |
5889 | { "Line", 0x2 }, | |
5890 | { "CD", 0x4 }, | |
5891 | { "Headphone", 0x6 }, | |
5892 | { "Mixer", 0x5 }, | |
5893 | }, | |
5894 | }, | |
5895 | }; | |
5896 | ||
5897 | /* Maxdata Favorit 100XS */ | |
5898 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { | |
5899 | { | |
5900 | .num_items = 2, | |
5901 | .items = { | |
5902 | { "Line/Mic", 0x0 }, | |
5903 | { "CD", 0x4 }, | |
5904 | }, | |
5905 | }, | |
5906 | { | |
5907 | .num_items = 3, | |
5908 | .items = { | |
5909 | { "Line/Mic", 0x0 }, | |
5910 | { "CD", 0x4 }, | |
5911 | { "Mixer", 0x5 }, | |
5912 | }, | |
5913 | }, | |
5914 | }; | |
5915 | ||
5916 | /* | |
5917 | * This is just place-holder, so there's something for alc_build_pcms to look | |
5918 | * at when it calculates the maximum number of channels. ALC260 has no mixer | |
5919 | * element which allows changing the channel mode, so the verb list is | |
5920 | * never used. | |
5921 | */ | |
5922 | static struct hda_channel_mode alc260_modes[1] = { | |
5923 | { 2, NULL }, | |
5924 | }; | |
5925 | ||
5926 | ||
5927 | /* Mixer combinations | |
5928 | * | |
5929 | * basic: base_output + input + pc_beep + capture | |
5930 | * HP: base_output + input + capture_alt | |
5931 | * HP_3013: hp_3013 + input + capture | |
5932 | * fujitsu: fujitsu + capture | |
5933 | * acer: acer + capture | |
5934 | */ | |
5935 | ||
5936 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { | |
5937 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5938 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | |
5939 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5940 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | |
5941 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
5942 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
5943 | { } /* end */ | |
5944 | }; | |
5945 | ||
5946 | static struct snd_kcontrol_new alc260_input_mixer[] = { | |
5947 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5948 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5949 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5950 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5951 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5952 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5953 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), | |
5954 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), | |
5955 | { } /* end */ | |
5956 | }; | |
5957 | ||
5958 | /* update HP, line and mono out pins according to the master switch */ | |
5959 | static void alc260_hp_master_update(struct hda_codec *codec, | |
5960 | hda_nid_t hp, hda_nid_t line, | |
5961 | hda_nid_t mono) | |
5962 | { | |
5963 | struct alc_spec *spec = codec->spec; | |
5964 | unsigned int val = spec->master_sw ? PIN_HP : 0; | |
5965 | /* change HP and line-out pins */ | |
5966 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5967 | val); | |
5968 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5969 | val); | |
5970 | /* mono (speaker) depending on the HP jack sense */ | |
5971 | val = (val && !spec->jack_present) ? PIN_OUT : 0; | |
5972 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5973 | val); | |
5974 | } | |
5975 | ||
5976 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, | |
5977 | struct snd_ctl_elem_value *ucontrol) | |
5978 | { | |
5979 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5980 | struct alc_spec *spec = codec->spec; | |
5981 | *ucontrol->value.integer.value = spec->master_sw; | |
5982 | return 0; | |
5983 | } | |
5984 | ||
5985 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
5986 | struct snd_ctl_elem_value *ucontrol) | |
5987 | { | |
5988 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5989 | struct alc_spec *spec = codec->spec; | |
5990 | int val = !!*ucontrol->value.integer.value; | |
5991 | hda_nid_t hp, line, mono; | |
5992 | ||
5993 | if (val == spec->master_sw) | |
5994 | return 0; | |
5995 | spec->master_sw = val; | |
5996 | hp = (kcontrol->private_value >> 16) & 0xff; | |
5997 | line = (kcontrol->private_value >> 8) & 0xff; | |
5998 | mono = kcontrol->private_value & 0xff; | |
5999 | alc260_hp_master_update(codec, hp, line, mono); | |
6000 | return 1; | |
6001 | } | |
6002 | ||
6003 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { | |
6004 | { | |
6005 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6006 | .name = "Master Playback Switch", | |
6007 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, | |
6008 | .info = snd_ctl_boolean_mono_info, | |
6009 | .get = alc260_hp_master_sw_get, | |
6010 | .put = alc260_hp_master_sw_put, | |
6011 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 | |
6012 | }, | |
6013 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6014 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | |
6015 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
6016 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | |
6017 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | |
6018 | HDA_OUTPUT), | |
6019 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
6020 | { } /* end */ | |
6021 | }; | |
6022 | ||
6023 | static struct hda_verb alc260_hp_unsol_verbs[] = { | |
6024 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6025 | {}, | |
6026 | }; | |
6027 | ||
6028 | static void alc260_hp_automute(struct hda_codec *codec) | |
6029 | { | |
6030 | struct alc_spec *spec = codec->spec; | |
6031 | ||
6032 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); | |
6033 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); | |
6034 | } | |
6035 | ||
6036 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) | |
6037 | { | |
6038 | if ((res >> 26) == ALC880_HP_EVENT) | |
6039 | alc260_hp_automute(codec); | |
6040 | } | |
6041 | ||
6042 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { | |
6043 | { | |
6044 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6045 | .name = "Master Playback Switch", | |
6046 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, | |
6047 | .info = snd_ctl_boolean_mono_info, | |
6048 | .get = alc260_hp_master_sw_get, | |
6049 | .put = alc260_hp_master_sw_put, | |
6050 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 | |
6051 | }, | |
6052 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
6053 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
6054 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), | |
6055 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), | |
6056 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6057 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
6058 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
6059 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), | |
6060 | { } /* end */ | |
6061 | }; | |
6062 | ||
6063 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { | |
6064 | .ops = &snd_hda_bind_vol, | |
6065 | .values = { | |
6066 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), | |
6067 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | |
6068 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), | |
6069 | 0 | |
6070 | }, | |
6071 | }; | |
6072 | ||
6073 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { | |
6074 | .ops = &snd_hda_bind_sw, | |
6075 | .values = { | |
6076 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), | |
6077 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
6078 | 0 | |
6079 | }, | |
6080 | }; | |
6081 | ||
6082 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { | |
6083 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), | |
6084 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), | |
6085 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), | |
6086 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
6087 | { } /* end */ | |
6088 | }; | |
6089 | ||
6090 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { | |
6091 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6092 | {}, | |
6093 | }; | |
6094 | ||
6095 | static void alc260_hp_3013_automute(struct hda_codec *codec) | |
6096 | { | |
6097 | struct alc_spec *spec = codec->spec; | |
6098 | ||
6099 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | |
6100 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); | |
6101 | } | |
6102 | ||
6103 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, | |
6104 | unsigned int res) | |
6105 | { | |
6106 | if ((res >> 26) == ALC880_HP_EVENT) | |
6107 | alc260_hp_3013_automute(codec); | |
6108 | } | |
6109 | ||
6110 | static void alc260_hp_3012_automute(struct hda_codec *codec) | |
6111 | { | |
6112 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; | |
6113 | ||
6114 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6115 | bits); | |
6116 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6117 | bits); | |
6118 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6119 | bits); | |
6120 | } | |
6121 | ||
6122 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, | |
6123 | unsigned int res) | |
6124 | { | |
6125 | if ((res >> 26) == ALC880_HP_EVENT) | |
6126 | alc260_hp_3012_automute(codec); | |
6127 | } | |
6128 | ||
6129 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | |
6130 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. | |
6131 | */ | |
6132 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { | |
6133 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6134 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), | |
6135 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
6136 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
6137 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
6138 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | |
6139 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | |
6140 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
6141 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
6142 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), | |
6143 | { } /* end */ | |
6144 | }; | |
6145 | ||
6146 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current | |
6147 | * versions of the ALC260 don't act on requests to enable mic bias from NID | |
6148 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 | |
6149 | * datasheet doesn't mention this restriction. At this stage it's not clear | |
6150 | * whether this behaviour is intentional or is a hardware bug in chip | |
6151 | * revisions available in early 2006. Therefore for now allow the | |
6152 | * "Headphone Jack Mode" control to span all choices, but if it turns out | |
6153 | * that the lack of mic bias for this NID is intentional we could change the | |
6154 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
6155 | * | |
6156 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 | |
6157 | * don't appear to make the mic bias available from the "line" jack, even | |
6158 | * though the NID used for this jack (0x14) can supply it. The theory is | |
6159 | * that perhaps Acer have included blocking capacitors between the ALC260 | |
6160 | * and the output jack. If this turns out to be the case for all such | |
6161 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT | |
6162 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
6163 | * | |
6164 | * The C20x Tablet series have a mono internal speaker which is controlled | |
6165 | * via the chip's Mono sum widget and pin complex, so include the necessary | |
6166 | * controls for such models. On models without a "mono speaker" the control | |
6167 | * won't do anything. | |
6168 | */ | |
6169 | static struct snd_kcontrol_new alc260_acer_mixer[] = { | |
6170 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6171 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
6172 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | |
6173 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | |
6174 | HDA_OUTPUT), | |
6175 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, | |
6176 | HDA_INPUT), | |
6177 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
6178 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
6179 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
6180 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
6181 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
6182 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
6183 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
6184 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
6185 | { } /* end */ | |
6186 | }; | |
6187 | ||
6188 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack | |
6189 | */ | |
6190 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { | |
6191 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6192 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
6193 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | |
6194 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
6195 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
6196 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
6197 | { } /* end */ | |
6198 | }; | |
6199 | ||
6200 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, | |
6201 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. | |
6202 | */ | |
6203 | static struct snd_kcontrol_new alc260_will_mixer[] = { | |
6204 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6205 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
6206 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
6207 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
6208 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
6209 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
6210 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
6211 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
6212 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
6213 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
6214 | { } /* end */ | |
6215 | }; | |
6216 | ||
6217 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, | |
6218 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. | |
6219 | */ | |
6220 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { | |
6221 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6222 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
6223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
6224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
6225 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
6226 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), | |
6227 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), | |
6228 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
6229 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
6230 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
6231 | { } /* end */ | |
6232 | }; | |
6233 | ||
6234 | /* | |
6235 | * initialization verbs | |
6236 | */ | |
6237 | static struct hda_verb alc260_init_verbs[] = { | |
6238 | /* Line In pin widget for input */ | |
6239 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6240 | /* CD pin widget for input */ | |
6241 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6242 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
6243 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6244 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
6245 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6246 | /* LINE-2 is used for line-out in rear */ | |
6247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6248 | /* select line-out */ | |
6249 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6250 | /* LINE-OUT pin */ | |
6251 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6252 | /* enable HP */ | |
6253 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6254 | /* enable Mono */ | |
6255 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6256 | /* mute capture amp left and right */ | |
6257 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6258 | /* set connection select to line in (default select for this ADC) */ | |
6259 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
6260 | /* mute capture amp left and right */ | |
6261 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6262 | /* set connection select to line in (default select for this ADC) */ | |
6263 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
6264 | /* set vol=0 Line-Out mixer amp left and right */ | |
6265 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6266 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
6267 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6268 | /* set vol=0 HP mixer amp left and right */ | |
6269 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6270 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
6271 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6272 | /* set vol=0 Mono mixer amp left and right */ | |
6273 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6274 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
6275 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6276 | /* unmute LINE-2 out pin */ | |
6277 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6278 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | |
6279 | * Line In 2 = 0x03 | |
6280 | */ | |
6281 | /* mute analog inputs */ | |
6282 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6283 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6284 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6285 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6286 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6287 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | |
6288 | /* mute Front out path */ | |
6289 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6290 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6291 | /* mute Headphone out path */ | |
6292 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6293 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6294 | /* mute Mono out path */ | |
6295 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6296 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6297 | { } | |
6298 | }; | |
6299 | ||
6300 | #if 0 /* should be identical with alc260_init_verbs? */ | |
6301 | static struct hda_verb alc260_hp_init_verbs[] = { | |
6302 | /* Headphone and output */ | |
6303 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
6304 | /* mono output */ | |
6305 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6306 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
6307 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6308 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
6309 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6310 | /* Line In pin widget for input */ | |
6311 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6312 | /* Line-2 pin widget for output */ | |
6313 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6314 | /* CD pin widget for input */ | |
6315 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6316 | /* unmute amp left and right */ | |
6317 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
6318 | /* set connection select to line in (default select for this ADC) */ | |
6319 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
6320 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
6321 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6322 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6323 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
6324 | /* unmute HP mixer amp left and right (volume = 0) */ | |
6325 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6326 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6327 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
6328 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | |
6329 | * Line In 2 = 0x03 | |
6330 | */ | |
6331 | /* mute analog inputs */ | |
6332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6334 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6335 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6336 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6337 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | |
6338 | /* Unmute Front out path */ | |
6339 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6340 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6341 | /* Unmute Headphone out path */ | |
6342 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6343 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6344 | /* Unmute Mono out path */ | |
6345 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6346 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6347 | { } | |
6348 | }; | |
6349 | #endif | |
6350 | ||
6351 | static struct hda_verb alc260_hp_3013_init_verbs[] = { | |
6352 | /* Line out and output */ | |
6353 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6354 | /* mono output */ | |
6355 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6356 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
6357 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6358 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
6359 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6360 | /* Line In pin widget for input */ | |
6361 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6362 | /* Headphone pin widget for output */ | |
6363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
6364 | /* CD pin widget for input */ | |
6365 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6366 | /* unmute amp left and right */ | |
6367 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
6368 | /* set connection select to line in (default select for this ADC) */ | |
6369 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
6370 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
6371 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6372 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6373 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
6374 | /* unmute HP mixer amp left and right (volume = 0) */ | |
6375 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6376 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6377 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
6378 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | |
6379 | * Line In 2 = 0x03 | |
6380 | */ | |
6381 | /* mute analog inputs */ | |
6382 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6383 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6385 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6386 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6387 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | |
6388 | /* Unmute Front out path */ | |
6389 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6390 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6391 | /* Unmute Headphone out path */ | |
6392 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6393 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6394 | /* Unmute Mono out path */ | |
6395 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6396 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6397 | { } | |
6398 | }; | |
6399 | ||
6400 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x | |
6401 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD | |
6402 | * audio = 0x16, internal speaker = 0x10. | |
6403 | */ | |
6404 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | |
6405 | /* Disable all GPIOs */ | |
6406 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, | |
6407 | /* Internal speaker is connected to headphone pin */ | |
6408 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6409 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ | |
6410 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6411 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ | |
6412 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6413 | /* Ensure all other unused pins are disabled and muted. */ | |
6414 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6415 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6416 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6417 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6418 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6419 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6420 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6421 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6422 | ||
6423 | /* Disable digital (SPDIF) pins */ | |
6424 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6425 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6426 | ||
6427 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus | |
6428 | * when acting as an output. | |
6429 | */ | |
6430 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6431 | ||
6432 | /* Start with output sum widgets muted and their output gains at min */ | |
6433 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6434 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6435 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6436 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6437 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6438 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6439 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6440 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6441 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6442 | ||
6443 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ | |
6444 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6445 | /* Unmute Line1 pin widget output buffer since it starts as an output. | |
6446 | * If the pin mode is changed by the user the pin mode control will | |
6447 | * take care of enabling the pin's input/output buffers as needed. | |
6448 | * Therefore there's no need to enable the input buffer at this | |
6449 | * stage. | |
6450 | */ | |
6451 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6452 | /* Unmute input buffer of pin widget used for Line-in (no equiv | |
6453 | * mixer ctrl) | |
6454 | */ | |
6455 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6456 | ||
6457 | /* Mute capture amp left and right */ | |
6458 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6459 | /* Set ADC connection select to match default mixer setting - line | |
6460 | * in (on mic1 pin) | |
6461 | */ | |
6462 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6463 | ||
6464 | /* Do the same for the second ADC: mute capture input amp and | |
6465 | * set ADC connection to line in (on mic1 pin) | |
6466 | */ | |
6467 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6468 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6469 | ||
6470 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6471 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6472 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6473 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6474 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6475 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6476 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6477 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6478 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6479 | ||
6480 | { } | |
6481 | }; | |
6482 | ||
6483 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and | |
6484 | * similar laptops (adapted from Fujitsu init verbs). | |
6485 | */ | |
6486 | static struct hda_verb alc260_acer_init_verbs[] = { | |
6487 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and | |
6488 | * the headphone jack. Turn this on and rely on the standard mute | |
6489 | * methods whenever the user wants to turn these outputs off. | |
6490 | */ | |
6491 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6492 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6493 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
6494 | /* Internal speaker/Headphone jack is connected to Line-out pin */ | |
6495 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6496 | /* Internal microphone/Mic jack is connected to Mic1 pin */ | |
6497 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
6498 | /* Line In jack is connected to Line1 pin */ | |
6499 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6500 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ | |
6501 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6502 | /* Ensure all other unused pins are disabled and muted. */ | |
6503 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6504 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6505 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6506 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6507 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6508 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6509 | /* Disable digital (SPDIF) pins */ | |
6510 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6511 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6512 | ||
6513 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | |
6514 | * bus when acting as outputs. | |
6515 | */ | |
6516 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6517 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6518 | ||
6519 | /* Start with output sum widgets muted and their output gains at min */ | |
6520 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6521 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6522 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6523 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6524 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6525 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6526 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6527 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6528 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6529 | ||
6530 | /* Unmute Line-out pin widget amp left and right | |
6531 | * (no equiv mixer ctrl) | |
6532 | */ | |
6533 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6534 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ | |
6535 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6536 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as | |
6537 | * inputs. If the pin mode is changed by the user the pin mode control | |
6538 | * will take care of enabling the pin's input/output buffers as needed. | |
6539 | * Therefore there's no need to enable the input buffer at this | |
6540 | * stage. | |
6541 | */ | |
6542 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6543 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6544 | ||
6545 | /* Mute capture amp left and right */ | |
6546 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6547 | /* Set ADC connection select to match default mixer setting - mic | |
6548 | * (on mic1 pin) | |
6549 | */ | |
6550 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6551 | ||
6552 | /* Do similar with the second ADC: mute capture input amp and | |
6553 | * set ADC connection to mic to match ALSA's default state. | |
6554 | */ | |
6555 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6556 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6557 | ||
6558 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6559 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6560 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6561 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6562 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6563 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6564 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6565 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6566 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6567 | ||
6568 | { } | |
6569 | }; | |
6570 | ||
6571 | /* Initialisation sequence for Maxdata Favorit 100XS | |
6572 | * (adapted from Acer init verbs). | |
6573 | */ | |
6574 | static struct hda_verb alc260_favorit100_init_verbs[] = { | |
6575 | /* GPIO 0 enables the output jack. | |
6576 | * Turn this on and rely on the standard mute | |
6577 | * methods whenever the user wants to turn these outputs off. | |
6578 | */ | |
6579 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6580 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6581 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
6582 | /* Line/Mic input jack is connected to Mic1 pin */ | |
6583 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
6584 | /* Ensure all other unused pins are disabled and muted. */ | |
6585 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6586 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6587 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6588 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6589 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6590 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6591 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6592 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6593 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6594 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6595 | /* Disable digital (SPDIF) pins */ | |
6596 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6597 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6598 | ||
6599 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | |
6600 | * bus when acting as outputs. | |
6601 | */ | |
6602 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6603 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6604 | ||
6605 | /* Start with output sum widgets muted and their output gains at min */ | |
6606 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6607 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6608 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6609 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6610 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6611 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6612 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6613 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6614 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6615 | ||
6616 | /* Unmute Line-out pin widget amp left and right | |
6617 | * (no equiv mixer ctrl) | |
6618 | */ | |
6619 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6620 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as | |
6621 | * inputs. If the pin mode is changed by the user the pin mode control | |
6622 | * will take care of enabling the pin's input/output buffers as needed. | |
6623 | * Therefore there's no need to enable the input buffer at this | |
6624 | * stage. | |
6625 | */ | |
6626 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6627 | ||
6628 | /* Mute capture amp left and right */ | |
6629 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6630 | /* Set ADC connection select to match default mixer setting - mic | |
6631 | * (on mic1 pin) | |
6632 | */ | |
6633 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6634 | ||
6635 | /* Do similar with the second ADC: mute capture input amp and | |
6636 | * set ADC connection to mic to match ALSA's default state. | |
6637 | */ | |
6638 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6639 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6640 | ||
6641 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6642 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6643 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6644 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6645 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6646 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6647 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6648 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6649 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6650 | ||
6651 | { } | |
6652 | }; | |
6653 | ||
6654 | static struct hda_verb alc260_will_verbs[] = { | |
6655 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6656 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6657 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6658 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
6659 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
6660 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, | |
6661 | {} | |
6662 | }; | |
6663 | ||
6664 | static struct hda_verb alc260_replacer_672v_verbs[] = { | |
6665 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
6666 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
6667 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, | |
6668 | ||
6669 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6670 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6671 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
6672 | ||
6673 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6674 | {} | |
6675 | }; | |
6676 | ||
6677 | /* toggle speaker-output according to the hp-jack state */ | |
6678 | static void alc260_replacer_672v_automute(struct hda_codec *codec) | |
6679 | { | |
6680 | unsigned int present; | |
6681 | ||
6682 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ | |
6683 | present = snd_hda_jack_detect(codec, 0x0f); | |
6684 | if (present) { | |
6685 | snd_hda_codec_write_cache(codec, 0x01, 0, | |
6686 | AC_VERB_SET_GPIO_DATA, 1); | |
6687 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
6688 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6689 | PIN_HP); | |
6690 | } else { | |
6691 | snd_hda_codec_write_cache(codec, 0x01, 0, | |
6692 | AC_VERB_SET_GPIO_DATA, 0); | |
6693 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
6694 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6695 | PIN_OUT); | |
6696 | } | |
6697 | } | |
6698 | ||
6699 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, | |
6700 | unsigned int res) | |
6701 | { | |
6702 | if ((res >> 26) == ALC880_HP_EVENT) | |
6703 | alc260_replacer_672v_automute(codec); | |
6704 | } | |
6705 | ||
6706 | static struct hda_verb alc260_hp_dc7600_verbs[] = { | |
6707 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6708 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6709 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6710 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6711 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6712 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6713 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6714 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6715 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6716 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6717 | {} | |
6718 | }; | |
6719 | ||
6720 | /* Test configuration for debugging, modelled after the ALC880 test | |
6721 | * configuration. | |
6722 | */ | |
6723 | #ifdef CONFIG_SND_DEBUG | |
6724 | static hda_nid_t alc260_test_dac_nids[1] = { | |
6725 | 0x02, | |
6726 | }; | |
6727 | static hda_nid_t alc260_test_adc_nids[2] = { | |
6728 | 0x04, 0x05, | |
6729 | }; | |
6730 | /* For testing the ALC260, each input MUX needs its own definition since | |
6731 | * the signal assignments are different. This assumes that the first ADC | |
6732 | * is NID 0x04. | |
6733 | */ | |
6734 | static struct hda_input_mux alc260_test_capture_sources[2] = { | |
6735 | { | |
6736 | .num_items = 7, | |
6737 | .items = { | |
6738 | { "MIC1 pin", 0x0 }, | |
6739 | { "MIC2 pin", 0x1 }, | |
6740 | { "LINE1 pin", 0x2 }, | |
6741 | { "LINE2 pin", 0x3 }, | |
6742 | { "CD pin", 0x4 }, | |
6743 | { "LINE-OUT pin", 0x5 }, | |
6744 | { "HP-OUT pin", 0x6 }, | |
6745 | }, | |
6746 | }, | |
6747 | { | |
6748 | .num_items = 8, | |
6749 | .items = { | |
6750 | { "MIC1 pin", 0x0 }, | |
6751 | { "MIC2 pin", 0x1 }, | |
6752 | { "LINE1 pin", 0x2 }, | |
6753 | { "LINE2 pin", 0x3 }, | |
6754 | { "CD pin", 0x4 }, | |
6755 | { "Mixer", 0x5 }, | |
6756 | { "LINE-OUT pin", 0x6 }, | |
6757 | { "HP-OUT pin", 0x7 }, | |
6758 | }, | |
6759 | }, | |
6760 | }; | |
6761 | static struct snd_kcontrol_new alc260_test_mixer[] = { | |
6762 | /* Output driver widgets */ | |
6763 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
6764 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
6765 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
6766 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), | |
6767 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6768 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), | |
6769 | ||
6770 | /* Modes for retasking pin widgets | |
6771 | * Note: the ALC260 doesn't seem to act on requests to enable mic | |
6772 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't | |
6773 | * mention this restriction. At this stage it's not clear whether | |
6774 | * this behaviour is intentional or is a hardware bug in chip | |
6775 | * revisions available at least up until early 2006. Therefore for | |
6776 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all | |
6777 | * choices, but if it turns out that the lack of mic bias for these | |
6778 | * NIDs is intentional we could change their modes from | |
6779 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
6780 | */ | |
6781 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), | |
6782 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), | |
6783 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
6784 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
6785 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), | |
6786 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), | |
6787 | ||
6788 | /* Loopback mixer controls */ | |
6789 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), | |
6790 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), | |
6791 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), | |
6792 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), | |
6793 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), | |
6794 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), | |
6795 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), | |
6796 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), | |
6797 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
6798 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
6799 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), | |
6800 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), | |
6801 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), | |
6802 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), | |
6803 | ||
6804 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
6805 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
6806 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
6807 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
6808 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
6809 | ||
6810 | /* Switches to allow the digital IO pins to be enabled. The datasheet | |
6811 | * is ambigious as to which NID is which; testing on laptops which | |
6812 | * make this output available should provide clarification. | |
6813 | */ | |
6814 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | |
6815 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | |
6816 | ||
6817 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | |
6818 | * this output to turn on an external amplifier. | |
6819 | */ | |
6820 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
6821 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
6822 | ||
6823 | { } /* end */ | |
6824 | }; | |
6825 | static struct hda_verb alc260_test_init_verbs[] = { | |
6826 | /* Enable all GPIOs as outputs with an initial value of 0 */ | |
6827 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, | |
6828 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
6829 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, | |
6830 | ||
6831 | /* Enable retasking pins as output, initially without power amp */ | |
6832 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6833 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6834 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6835 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6836 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6837 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6838 | ||
6839 | /* Disable digital (SPDIF) pins initially, but users can enable | |
6840 | * them via a mixer switch. In the case of SPDIF-out, this initverb | |
6841 | * payload also sets the generation to 0, output to be in "consumer" | |
6842 | * PCM format, copyright asserted, no pre-emphasis and no validity | |
6843 | * control. | |
6844 | */ | |
6845 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6846 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6847 | ||
6848 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the | |
6849 | * OUT1 sum bus when acting as an output. | |
6850 | */ | |
6851 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6852 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, | |
6853 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6854 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, | |
6855 | ||
6856 | /* Start with output sum widgets muted and their output gains at min */ | |
6857 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6858 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6859 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6860 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6861 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6862 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6863 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6864 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6865 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6866 | ||
6867 | /* Unmute retasking pin widget output buffers since the default | |
6868 | * state appears to be output. As the pin mode is changed by the | |
6869 | * user the pin mode control will take care of enabling the pin's | |
6870 | * input/output buffers as needed. | |
6871 | */ | |
6872 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6873 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6875 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6876 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6877 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6878 | /* Also unmute the mono-out pin widget */ | |
6879 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6880 | ||
6881 | /* Mute capture amp left and right */ | |
6882 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6883 | /* Set ADC connection select to match default mixer setting (mic1 | |
6884 | * pin) | |
6885 | */ | |
6886 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6887 | ||
6888 | /* Do the same for the second ADC: mute capture input amp and | |
6889 | * set ADC connection to mic1 pin | |
6890 | */ | |
6891 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6892 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6893 | ||
6894 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6895 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6896 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6897 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6898 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6899 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6900 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6901 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6902 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6903 | ||
6904 | { } | |
6905 | }; | |
6906 | #endif | |
6907 | ||
6908 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback | |
6909 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture | |
6910 | ||
6911 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback | |
6912 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture | |
6913 | ||
6914 | /* | |
6915 | * for BIOS auto-configuration | |
6916 | */ | |
6917 | ||
6918 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, | |
6919 | const char *pfx, int *vol_bits) | |
6920 | { | |
6921 | hda_nid_t nid_vol; | |
6922 | unsigned long vol_val, sw_val; | |
6923 | int err; | |
6924 | ||
6925 | if (nid >= 0x0f && nid < 0x11) { | |
6926 | nid_vol = nid - 0x7; | |
6927 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
6928 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
6929 | } else if (nid == 0x11) { | |
6930 | nid_vol = nid - 0x7; | |
6931 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); | |
6932 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
6933 | } else if (nid >= 0x12 && nid <= 0x15) { | |
6934 | nid_vol = 0x08; | |
6935 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
6936 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
6937 | } else | |
6938 | return 0; /* N/A */ | |
6939 | ||
6940 | if (!(*vol_bits & (1 << nid_vol))) { | |
6941 | /* first control for the volume widget */ | |
6942 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val); | |
6943 | if (err < 0) | |
6944 | return err; | |
6945 | *vol_bits |= (1 << nid_vol); | |
6946 | } | |
6947 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val); | |
6948 | if (err < 0) | |
6949 | return err; | |
6950 | return 1; | |
6951 | } | |
6952 | ||
6953 | /* add playback controls from the parsed DAC table */ | |
6954 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |
6955 | const struct auto_pin_cfg *cfg) | |
6956 | { | |
6957 | hda_nid_t nid; | |
6958 | int err; | |
6959 | int vols = 0; | |
6960 | ||
6961 | spec->multiout.num_dacs = 1; | |
6962 | spec->multiout.dac_nids = spec->private_dac_nids; | |
6963 | spec->multiout.dac_nids[0] = 0x02; | |
6964 | ||
6965 | nid = cfg->line_out_pins[0]; | |
6966 | if (nid) { | |
6967 | const char *pfx; | |
6968 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) | |
6969 | pfx = "Master"; | |
6970 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
6971 | pfx = "Speaker"; | |
6972 | else | |
6973 | pfx = "Front"; | |
6974 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); | |
6975 | if (err < 0) | |
6976 | return err; | |
6977 | } | |
6978 | ||
6979 | nid = cfg->speaker_pins[0]; | |
6980 | if (nid) { | |
6981 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); | |
6982 | if (err < 0) | |
6983 | return err; | |
6984 | } | |
6985 | ||
6986 | nid = cfg->hp_pins[0]; | |
6987 | if (nid) { | |
6988 | err = alc260_add_playback_controls(spec, nid, "Headphone", | |
6989 | &vols); | |
6990 | if (err < 0) | |
6991 | return err; | |
6992 | } | |
6993 | return 0; | |
6994 | } | |
6995 | ||
6996 | /* create playback/capture controls for input pins */ | |
6997 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, | |
6998 | const struct auto_pin_cfg *cfg) | |
6999 | { | |
7000 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); | |
7001 | } | |
7002 | ||
7003 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |
7004 | hda_nid_t nid, int pin_type, | |
7005 | int sel_idx) | |
7006 | { | |
7007 | alc_set_pin_output(codec, nid, pin_type); | |
7008 | /* need the manual connection? */ | |
7009 | if (nid >= 0x12) { | |
7010 | int idx = nid - 0x12; | |
7011 | snd_hda_codec_write(codec, idx + 0x0b, 0, | |
7012 | AC_VERB_SET_CONNECT_SEL, sel_idx); | |
7013 | } | |
7014 | } | |
7015 | ||
7016 | static void alc260_auto_init_multi_out(struct hda_codec *codec) | |
7017 | { | |
7018 | struct alc_spec *spec = codec->spec; | |
7019 | hda_nid_t nid; | |
7020 | ||
7021 | nid = spec->autocfg.line_out_pins[0]; | |
7022 | if (nid) { | |
7023 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
7024 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); | |
7025 | } | |
7026 | ||
7027 | nid = spec->autocfg.speaker_pins[0]; | |
7028 | if (nid) | |
7029 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | |
7030 | ||
7031 | nid = spec->autocfg.hp_pins[0]; | |
7032 | if (nid) | |
7033 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); | |
7034 | } | |
7035 | ||
7036 | #define ALC260_PIN_CD_NID 0x16 | |
7037 | static void alc260_auto_init_analog_input(struct hda_codec *codec) | |
7038 | { | |
7039 | struct alc_spec *spec = codec->spec; | |
7040 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
7041 | int i; | |
7042 | ||
7043 | for (i = 0; i < cfg->num_inputs; i++) { | |
7044 | hda_nid_t nid = cfg->inputs[i].pin; | |
7045 | if (nid >= 0x12) { | |
7046 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); | |
7047 | if (nid != ALC260_PIN_CD_NID && | |
7048 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
7049 | snd_hda_codec_write(codec, nid, 0, | |
7050 | AC_VERB_SET_AMP_GAIN_MUTE, | |
7051 | AMP_OUT_MUTE); | |
7052 | } | |
7053 | } | |
7054 | } | |
7055 | ||
7056 | #define alc260_auto_init_input_src alc880_auto_init_input_src | |
7057 | ||
7058 | /* | |
7059 | * generic initialization of ADC, input mixers and output mixers | |
7060 | */ | |
7061 | static struct hda_verb alc260_volume_init_verbs[] = { | |
7062 | /* | |
7063 | * Unmute ADC0-1 and set the default input to mic-in | |
7064 | */ | |
7065 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7066 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7067 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7068 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7069 | ||
7070 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
7071 | * mixer widget | |
7072 | * Note: PASD motherboards uses the Line In 2 as the input for | |
7073 | * front panel mic (mic 2) | |
7074 | */ | |
7075 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
7076 | /* mute analog inputs */ | |
7077 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7078 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7079 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7080 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7081 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7082 | ||
7083 | /* | |
7084 | * Set up output mixers (0x08 - 0x0a) | |
7085 | */ | |
7086 | /* set vol=0 to output mixers */ | |
7087 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7088 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7089 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7090 | /* set up input amps for analog loopback */ | |
7091 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
7092 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7093 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7094 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7095 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7096 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7097 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7098 | ||
7099 | { } | |
7100 | }; | |
7101 | ||
7102 | static int alc260_parse_auto_config(struct hda_codec *codec) | |
7103 | { | |
7104 | struct alc_spec *spec = codec->spec; | |
7105 | int err; | |
7106 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; | |
7107 | ||
7108 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
7109 | alc260_ignore); | |
7110 | if (err < 0) | |
7111 | return err; | |
7112 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
7113 | if (err < 0) | |
7114 | return err; | |
7115 | if (!spec->kctls.list) | |
7116 | return 0; /* can't find valid BIOS pin config */ | |
7117 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); | |
7118 | if (err < 0) | |
7119 | return err; | |
7120 | ||
7121 | spec->multiout.max_channels = 2; | |
7122 | ||
7123 | if (spec->autocfg.dig_outs) | |
7124 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; | |
7125 | if (spec->kctls.list) | |
7126 | add_mixer(spec, spec->kctls.list); | |
7127 | ||
7128 | add_verb(spec, alc260_volume_init_verbs); | |
7129 | ||
7130 | spec->num_mux_defs = 1; | |
7131 | spec->input_mux = &spec->private_imux[0]; | |
7132 | ||
7133 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); | |
7134 | ||
7135 | return 1; | |
7136 | } | |
7137 | ||
7138 | /* additional initialization for auto-configuration model */ | |
7139 | static void alc260_auto_init(struct hda_codec *codec) | |
7140 | { | |
7141 | struct alc_spec *spec = codec->spec; | |
7142 | alc260_auto_init_multi_out(codec); | |
7143 | alc260_auto_init_analog_input(codec); | |
7144 | alc260_auto_init_input_src(codec); | |
7145 | alc_auto_init_digital(codec); | |
7146 | if (spec->unsol_event) | |
7147 | alc_inithook(codec); | |
7148 | } | |
7149 | ||
7150 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
7151 | static struct hda_amp_list alc260_loopbacks[] = { | |
7152 | { 0x07, HDA_INPUT, 0 }, | |
7153 | { 0x07, HDA_INPUT, 1 }, | |
7154 | { 0x07, HDA_INPUT, 2 }, | |
7155 | { 0x07, HDA_INPUT, 3 }, | |
7156 | { 0x07, HDA_INPUT, 4 }, | |
7157 | { } /* end */ | |
7158 | }; | |
7159 | #endif | |
7160 | ||
7161 | /* | |
7162 | * Pin config fixes | |
7163 | */ | |
7164 | enum { | |
7165 | PINFIX_HP_DC5750, | |
7166 | }; | |
7167 | ||
7168 | static const struct alc_fixup alc260_fixups[] = { | |
7169 | [PINFIX_HP_DC5750] = { | |
7170 | .type = ALC_FIXUP_PINS, | |
7171 | .v.pins = (const struct alc_pincfg[]) { | |
7172 | { 0x11, 0x90130110 }, /* speaker */ | |
7173 | { } | |
7174 | } | |
7175 | }, | |
7176 | }; | |
7177 | ||
7178 | static struct snd_pci_quirk alc260_fixup_tbl[] = { | |
7179 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), | |
7180 | {} | |
7181 | }; | |
7182 | ||
7183 | /* | |
7184 | * ALC260 configurations | |
7185 | */ | |
7186 | static const char * const alc260_models[ALC260_MODEL_LAST] = { | |
7187 | [ALC260_BASIC] = "basic", | |
7188 | [ALC260_HP] = "hp", | |
7189 | [ALC260_HP_3013] = "hp-3013", | |
7190 | [ALC260_HP_DC7600] = "hp-dc7600", | |
7191 | [ALC260_FUJITSU_S702X] = "fujitsu", | |
7192 | [ALC260_ACER] = "acer", | |
7193 | [ALC260_WILL] = "will", | |
7194 | [ALC260_REPLACER_672V] = "replacer", | |
7195 | [ALC260_FAVORIT100] = "favorit100", | |
7196 | #ifdef CONFIG_SND_DEBUG | |
7197 | [ALC260_TEST] = "test", | |
7198 | #endif | |
7199 | [ALC260_AUTO] = "auto", | |
7200 | }; | |
7201 | ||
7202 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | |
7203 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), | |
7204 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), | |
7205 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), | |
7206 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), | |
7207 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), | |
7208 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ | |
7209 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), | |
7210 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), | |
7211 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), | |
7212 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), | |
7213 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | |
7214 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | |
7215 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), | |
7216 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), | |
7217 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), | |
7218 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), | |
7219 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), | |
7220 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), | |
7221 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), | |
7222 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), | |
7223 | {} | |
7224 | }; | |
7225 | ||
7226 | static struct alc_config_preset alc260_presets[] = { | |
7227 | [ALC260_BASIC] = { | |
7228 | .mixers = { alc260_base_output_mixer, | |
7229 | alc260_input_mixer }, | |
7230 | .init_verbs = { alc260_init_verbs }, | |
7231 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7232 | .dac_nids = alc260_dac_nids, | |
7233 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
7234 | .adc_nids = alc260_dual_adc_nids, | |
7235 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7236 | .channel_mode = alc260_modes, | |
7237 | .input_mux = &alc260_capture_source, | |
7238 | }, | |
7239 | [ALC260_HP] = { | |
7240 | .mixers = { alc260_hp_output_mixer, | |
7241 | alc260_input_mixer }, | |
7242 | .init_verbs = { alc260_init_verbs, | |
7243 | alc260_hp_unsol_verbs }, | |
7244 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7245 | .dac_nids = alc260_dac_nids, | |
7246 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | |
7247 | .adc_nids = alc260_adc_nids_alt, | |
7248 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7249 | .channel_mode = alc260_modes, | |
7250 | .input_mux = &alc260_capture_source, | |
7251 | .unsol_event = alc260_hp_unsol_event, | |
7252 | .init_hook = alc260_hp_automute, | |
7253 | }, | |
7254 | [ALC260_HP_DC7600] = { | |
7255 | .mixers = { alc260_hp_dc7600_mixer, | |
7256 | alc260_input_mixer }, | |
7257 | .init_verbs = { alc260_init_verbs, | |
7258 | alc260_hp_dc7600_verbs }, | |
7259 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7260 | .dac_nids = alc260_dac_nids, | |
7261 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | |
7262 | .adc_nids = alc260_adc_nids_alt, | |
7263 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7264 | .channel_mode = alc260_modes, | |
7265 | .input_mux = &alc260_capture_source, | |
7266 | .unsol_event = alc260_hp_3012_unsol_event, | |
7267 | .init_hook = alc260_hp_3012_automute, | |
7268 | }, | |
7269 | [ALC260_HP_3013] = { | |
7270 | .mixers = { alc260_hp_3013_mixer, | |
7271 | alc260_input_mixer }, | |
7272 | .init_verbs = { alc260_hp_3013_init_verbs, | |
7273 | alc260_hp_3013_unsol_verbs }, | |
7274 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7275 | .dac_nids = alc260_dac_nids, | |
7276 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | |
7277 | .adc_nids = alc260_adc_nids_alt, | |
7278 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7279 | .channel_mode = alc260_modes, | |
7280 | .input_mux = &alc260_capture_source, | |
7281 | .unsol_event = alc260_hp_3013_unsol_event, | |
7282 | .init_hook = alc260_hp_3013_automute, | |
7283 | }, | |
7284 | [ALC260_FUJITSU_S702X] = { | |
7285 | .mixers = { alc260_fujitsu_mixer }, | |
7286 | .init_verbs = { alc260_fujitsu_init_verbs }, | |
7287 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7288 | .dac_nids = alc260_dac_nids, | |
7289 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
7290 | .adc_nids = alc260_dual_adc_nids, | |
7291 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7292 | .channel_mode = alc260_modes, | |
7293 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), | |
7294 | .input_mux = alc260_fujitsu_capture_sources, | |
7295 | }, | |
7296 | [ALC260_ACER] = { | |
7297 | .mixers = { alc260_acer_mixer }, | |
7298 | .init_verbs = { alc260_acer_init_verbs }, | |
7299 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7300 | .dac_nids = alc260_dac_nids, | |
7301 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
7302 | .adc_nids = alc260_dual_adc_nids, | |
7303 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7304 | .channel_mode = alc260_modes, | |
7305 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), | |
7306 | .input_mux = alc260_acer_capture_sources, | |
7307 | }, | |
7308 | [ALC260_FAVORIT100] = { | |
7309 | .mixers = { alc260_favorit100_mixer }, | |
7310 | .init_verbs = { alc260_favorit100_init_verbs }, | |
7311 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7312 | .dac_nids = alc260_dac_nids, | |
7313 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
7314 | .adc_nids = alc260_dual_adc_nids, | |
7315 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7316 | .channel_mode = alc260_modes, | |
7317 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), | |
7318 | .input_mux = alc260_favorit100_capture_sources, | |
7319 | }, | |
7320 | [ALC260_WILL] = { | |
7321 | .mixers = { alc260_will_mixer }, | |
7322 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, | |
7323 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7324 | .dac_nids = alc260_dac_nids, | |
7325 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
7326 | .adc_nids = alc260_adc_nids, | |
7327 | .dig_out_nid = ALC260_DIGOUT_NID, | |
7328 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7329 | .channel_mode = alc260_modes, | |
7330 | .input_mux = &alc260_capture_source, | |
7331 | }, | |
7332 | [ALC260_REPLACER_672V] = { | |
7333 | .mixers = { alc260_replacer_672v_mixer }, | |
7334 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, | |
7335 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7336 | .dac_nids = alc260_dac_nids, | |
7337 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
7338 | .adc_nids = alc260_adc_nids, | |
7339 | .dig_out_nid = ALC260_DIGOUT_NID, | |
7340 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7341 | .channel_mode = alc260_modes, | |
7342 | .input_mux = &alc260_capture_source, | |
7343 | .unsol_event = alc260_replacer_672v_unsol_event, | |
7344 | .init_hook = alc260_replacer_672v_automute, | |
7345 | }, | |
7346 | #ifdef CONFIG_SND_DEBUG | |
7347 | [ALC260_TEST] = { | |
7348 | .mixers = { alc260_test_mixer }, | |
7349 | .init_verbs = { alc260_test_init_verbs }, | |
7350 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), | |
7351 | .dac_nids = alc260_test_dac_nids, | |
7352 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), | |
7353 | .adc_nids = alc260_test_adc_nids, | |
7354 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7355 | .channel_mode = alc260_modes, | |
7356 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), | |
7357 | .input_mux = alc260_test_capture_sources, | |
7358 | }, | |
7359 | #endif | |
7360 | }; | |
7361 | ||
7362 | static int patch_alc260(struct hda_codec *codec) | |
7363 | { | |
7364 | struct alc_spec *spec; | |
7365 | int err, board_config; | |
7366 | ||
7367 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
7368 | if (spec == NULL) | |
7369 | return -ENOMEM; | |
7370 | ||
7371 | codec->spec = spec; | |
7372 | ||
7373 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, | |
7374 | alc260_models, | |
7375 | alc260_cfg_tbl); | |
7376 | if (board_config < 0) { | |
7377 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
7378 | codec->chip_name); | |
7379 | board_config = ALC260_AUTO; | |
7380 | } | |
7381 | ||
7382 | if (board_config == ALC260_AUTO) { | |
7383 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); | |
7384 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | |
7385 | } | |
7386 | ||
7387 | if (board_config == ALC260_AUTO) { | |
7388 | /* automatic parse from the BIOS config */ | |
7389 | err = alc260_parse_auto_config(codec); | |
7390 | if (err < 0) { | |
7391 | alc_free(codec); | |
7392 | return err; | |
7393 | } else if (!err) { | |
7394 | printk(KERN_INFO | |
7395 | "hda_codec: Cannot set up configuration " | |
7396 | "from BIOS. Using base mode...\n"); | |
7397 | board_config = ALC260_BASIC; | |
7398 | } | |
7399 | } | |
7400 | ||
7401 | err = snd_hda_attach_beep_device(codec, 0x1); | |
7402 | if (err < 0) { | |
7403 | alc_free(codec); | |
7404 | return err; | |
7405 | } | |
7406 | ||
7407 | if (board_config != ALC260_AUTO) | |
7408 | setup_preset(codec, &alc260_presets[board_config]); | |
7409 | ||
7410 | spec->stream_analog_playback = &alc260_pcm_analog_playback; | |
7411 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | |
7412 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; | |
7413 | ||
7414 | spec->stream_digital_playback = &alc260_pcm_digital_playback; | |
7415 | spec->stream_digital_capture = &alc260_pcm_digital_capture; | |
7416 | ||
7417 | if (!spec->adc_nids && spec->input_mux) { | |
7418 | /* check whether NID 0x04 is valid */ | |
7419 | unsigned int wcap = get_wcaps(codec, 0x04); | |
7420 | wcap = get_wcaps_type(wcap); | |
7421 | /* get type */ | |
7422 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
7423 | spec->adc_nids = alc260_adc_nids_alt; | |
7424 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); | |
7425 | } else { | |
7426 | spec->adc_nids = alc260_adc_nids; | |
7427 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | |
7428 | } | |
7429 | } | |
7430 | set_capture_mixer(codec); | |
7431 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); | |
7432 | ||
7433 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | |
7434 | ||
7435 | spec->vmaster_nid = 0x08; | |
7436 | ||
7437 | codec->patch_ops = alc_patch_ops; | |
7438 | if (board_config == ALC260_AUTO) | |
7439 | spec->init_hook = alc260_auto_init; | |
7440 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
7441 | if (!spec->loopback.amplist) | |
7442 | spec->loopback.amplist = alc260_loopbacks; | |
7443 | #endif | |
7444 | ||
7445 | return 0; | |
7446 | } | |
7447 | ||
7448 | ||
7449 | /* | |
7450 | * ALC882/883/885/888/889 support | |
7451 | * | |
7452 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | |
7453 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
7454 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
7455 | * 6-channel independent captures. | |
7456 | * | |
7457 | * In addition, an independent DAC for the multi-playback (not used in this | |
7458 | * driver yet). | |
7459 | */ | |
7460 | #define ALC882_DIGOUT_NID 0x06 | |
7461 | #define ALC882_DIGIN_NID 0x0a | |
7462 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID | |
7463 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID | |
7464 | #define ALC1200_DIGOUT_NID 0x10 | |
7465 | ||
7466 | ||
7467 | static struct hda_channel_mode alc882_ch_modes[1] = { | |
7468 | { 8, NULL } | |
7469 | }; | |
7470 | ||
7471 | /* DACs */ | |
7472 | static hda_nid_t alc882_dac_nids[4] = { | |
7473 | /* front, rear, clfe, rear_surr */ | |
7474 | 0x02, 0x03, 0x04, 0x05 | |
7475 | }; | |
7476 | #define alc883_dac_nids alc882_dac_nids | |
7477 | ||
7478 | /* ADCs */ | |
7479 | #define alc882_adc_nids alc880_adc_nids | |
7480 | #define alc882_adc_nids_alt alc880_adc_nids_alt | |
7481 | #define alc883_adc_nids alc882_adc_nids_alt | |
7482 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; | |
7483 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; | |
7484 | #define alc889_adc_nids alc880_adc_nids | |
7485 | ||
7486 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; | |
7487 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | |
7488 | #define alc883_capsrc_nids alc882_capsrc_nids_alt | |
7489 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | |
7490 | #define alc889_capsrc_nids alc882_capsrc_nids | |
7491 | ||
7492 | /* input MUX */ | |
7493 | /* FIXME: should be a matrix-type input source selection */ | |
7494 | ||
7495 | static struct hda_input_mux alc882_capture_source = { | |
7496 | .num_items = 4, | |
7497 | .items = { | |
7498 | { "Mic", 0x0 }, | |
7499 | { "Front Mic", 0x1 }, | |
7500 | { "Line", 0x2 }, | |
7501 | { "CD", 0x4 }, | |
7502 | }, | |
7503 | }; | |
7504 | ||
7505 | #define alc883_capture_source alc882_capture_source | |
7506 | ||
7507 | static struct hda_input_mux alc889_capture_source = { | |
7508 | .num_items = 3, | |
7509 | .items = { | |
7510 | { "Front Mic", 0x0 }, | |
7511 | { "Mic", 0x3 }, | |
7512 | { "Line", 0x2 }, | |
7513 | }, | |
7514 | }; | |
7515 | ||
7516 | static struct hda_input_mux mb5_capture_source = { | |
7517 | .num_items = 3, | |
7518 | .items = { | |
7519 | { "Mic", 0x1 }, | |
7520 | { "Line", 0x7 }, | |
7521 | { "CD", 0x4 }, | |
7522 | }, | |
7523 | }; | |
7524 | ||
7525 | static struct hda_input_mux macmini3_capture_source = { | |
7526 | .num_items = 2, | |
7527 | .items = { | |
7528 | { "Line", 0x2 }, | |
7529 | { "CD", 0x4 }, | |
7530 | }, | |
7531 | }; | |
7532 | ||
7533 | static struct hda_input_mux alc883_3stack_6ch_intel = { | |
7534 | .num_items = 4, | |
7535 | .items = { | |
7536 | { "Mic", 0x1 }, | |
7537 | { "Front Mic", 0x0 }, | |
7538 | { "Line", 0x2 }, | |
7539 | { "CD", 0x4 }, | |
7540 | }, | |
7541 | }; | |
7542 | ||
7543 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { | |
7544 | .num_items = 2, | |
7545 | .items = { | |
7546 | { "Mic", 0x1 }, | |
7547 | { "Line", 0x2 }, | |
7548 | }, | |
7549 | }; | |
7550 | ||
7551 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | |
7552 | .num_items = 4, | |
7553 | .items = { | |
7554 | { "Mic", 0x0 }, | |
7555 | { "Internal Mic", 0x1 }, | |
7556 | { "Line", 0x2 }, | |
7557 | { "CD", 0x4 }, | |
7558 | }, | |
7559 | }; | |
7560 | ||
7561 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | |
7562 | .num_items = 2, | |
7563 | .items = { | |
7564 | { "Mic", 0x0 }, | |
7565 | { "Internal Mic", 0x1 }, | |
7566 | }, | |
7567 | }; | |
7568 | ||
7569 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | |
7570 | .num_items = 3, | |
7571 | .items = { | |
7572 | { "Mic", 0x0 }, | |
7573 | { "Front Mic", 0x1 }, | |
7574 | { "Line", 0x4 }, | |
7575 | }, | |
7576 | }; | |
7577 | ||
7578 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | |
7579 | .num_items = 2, | |
7580 | .items = { | |
7581 | { "Mic", 0x0 }, | |
7582 | { "Line", 0x2 }, | |
7583 | }, | |
7584 | }; | |
7585 | ||
7586 | static struct hda_input_mux alc889A_mb31_capture_source = { | |
7587 | .num_items = 2, | |
7588 | .items = { | |
7589 | { "Mic", 0x0 }, | |
7590 | /* Front Mic (0x01) unused */ | |
7591 | { "Line", 0x2 }, | |
7592 | /* Line 2 (0x03) unused */ | |
7593 | /* CD (0x04) unused? */ | |
7594 | }, | |
7595 | }; | |
7596 | ||
7597 | static struct hda_input_mux alc889A_imac91_capture_source = { | |
7598 | .num_items = 2, | |
7599 | .items = { | |
7600 | { "Mic", 0x01 }, | |
7601 | { "Line", 0x2 }, /* Not sure! */ | |
7602 | }, | |
7603 | }; | |
7604 | ||
7605 | /* | |
7606 | * 2ch mode | |
7607 | */ | |
7608 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | |
7609 | { 2, NULL } | |
7610 | }; | |
7611 | ||
7612 | /* | |
7613 | * 2ch mode | |
7614 | */ | |
7615 | static struct hda_verb alc882_3ST_ch2_init[] = { | |
7616 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7617 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7618 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7619 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7620 | { } /* end */ | |
7621 | }; | |
7622 | ||
7623 | /* | |
7624 | * 4ch mode | |
7625 | */ | |
7626 | static struct hda_verb alc882_3ST_ch4_init[] = { | |
7627 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7628 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7629 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7630 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7631 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7632 | { } /* end */ | |
7633 | }; | |
7634 | ||
7635 | /* | |
7636 | * 6ch mode | |
7637 | */ | |
7638 | static struct hda_verb alc882_3ST_ch6_init[] = { | |
7639 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7640 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7641 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7642 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7643 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7644 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7645 | { } /* end */ | |
7646 | }; | |
7647 | ||
7648 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { | |
7649 | { 2, alc882_3ST_ch2_init }, | |
7650 | { 4, alc882_3ST_ch4_init }, | |
7651 | { 6, alc882_3ST_ch6_init }, | |
7652 | }; | |
7653 | ||
7654 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes | |
7655 | ||
7656 | /* | |
7657 | * 2ch mode | |
7658 | */ | |
7659 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { | |
7660 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
7661 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7662 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7663 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7664 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7665 | { } /* end */ | |
7666 | }; | |
7667 | ||
7668 | /* | |
7669 | * 4ch mode | |
7670 | */ | |
7671 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { | |
7672 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7673 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7674 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7675 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7676 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7677 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7678 | { } /* end */ | |
7679 | }; | |
7680 | ||
7681 | /* | |
7682 | * 6ch mode | |
7683 | */ | |
7684 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { | |
7685 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7686 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7687 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7688 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7689 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7690 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7691 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7692 | { } /* end */ | |
7693 | }; | |
7694 | ||
7695 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { | |
7696 | { 2, alc883_3ST_ch2_clevo_init }, | |
7697 | { 4, alc883_3ST_ch4_clevo_init }, | |
7698 | { 6, alc883_3ST_ch6_clevo_init }, | |
7699 | }; | |
7700 | ||
7701 | ||
7702 | /* | |
7703 | * 6ch mode | |
7704 | */ | |
7705 | static struct hda_verb alc882_sixstack_ch6_init[] = { | |
7706 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7707 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7708 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7709 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7710 | { } /* end */ | |
7711 | }; | |
7712 | ||
7713 | /* | |
7714 | * 8ch mode | |
7715 | */ | |
7716 | static struct hda_verb alc882_sixstack_ch8_init[] = { | |
7717 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7718 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7719 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7720 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7721 | { } /* end */ | |
7722 | }; | |
7723 | ||
7724 | static struct hda_channel_mode alc882_sixstack_modes[2] = { | |
7725 | { 6, alc882_sixstack_ch6_init }, | |
7726 | { 8, alc882_sixstack_ch8_init }, | |
7727 | }; | |
7728 | ||
7729 | ||
7730 | /* Macbook Air 2,1 */ | |
7731 | ||
7732 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { | |
7733 | { 2, NULL }, | |
7734 | }; | |
7735 | ||
7736 | /* | |
7737 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic | |
7738 | */ | |
7739 | ||
7740 | /* | |
7741 | * 2ch mode | |
7742 | */ | |
7743 | static struct hda_verb alc885_mbp_ch2_init[] = { | |
7744 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7745 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7746 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7747 | { } /* end */ | |
7748 | }; | |
7749 | ||
7750 | /* | |
7751 | * 4ch mode | |
7752 | */ | |
7753 | static struct hda_verb alc885_mbp_ch4_init[] = { | |
7754 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7755 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7756 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7757 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7758 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7759 | { } /* end */ | |
7760 | }; | |
7761 | ||
7762 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { | |
7763 | { 2, alc885_mbp_ch2_init }, | |
7764 | { 4, alc885_mbp_ch4_init }, | |
7765 | }; | |
7766 | ||
7767 | /* | |
7768 | * 2ch | |
7769 | * Speakers/Woofer/HP = Front | |
7770 | * LineIn = Input | |
7771 | */ | |
7772 | static struct hda_verb alc885_mb5_ch2_init[] = { | |
7773 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7774 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7775 | { } /* end */ | |
7776 | }; | |
7777 | ||
7778 | /* | |
7779 | * 6ch mode | |
7780 | * Speakers/HP = Front | |
7781 | * Woofer = LFE | |
7782 | * LineIn = Surround | |
7783 | */ | |
7784 | static struct hda_verb alc885_mb5_ch6_init[] = { | |
7785 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7786 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7787 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7788 | { } /* end */ | |
7789 | }; | |
7790 | ||
7791 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { | |
7792 | { 2, alc885_mb5_ch2_init }, | |
7793 | { 6, alc885_mb5_ch6_init }, | |
7794 | }; | |
7795 | ||
7796 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes | |
7797 | ||
7798 | /* | |
7799 | * 2ch mode | |
7800 | */ | |
7801 | static struct hda_verb alc883_4ST_ch2_init[] = { | |
7802 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7803 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7804 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7805 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7806 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7807 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7808 | { } /* end */ | |
7809 | }; | |
7810 | ||
7811 | /* | |
7812 | * 4ch mode | |
7813 | */ | |
7814 | static struct hda_verb alc883_4ST_ch4_init[] = { | |
7815 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7816 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7817 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7818 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7819 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7820 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7821 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7822 | { } /* end */ | |
7823 | }; | |
7824 | ||
7825 | /* | |
7826 | * 6ch mode | |
7827 | */ | |
7828 | static struct hda_verb alc883_4ST_ch6_init[] = { | |
7829 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7830 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7831 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7832 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7833 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7834 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7835 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7836 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7837 | { } /* end */ | |
7838 | }; | |
7839 | ||
7840 | /* | |
7841 | * 8ch mode | |
7842 | */ | |
7843 | static struct hda_verb alc883_4ST_ch8_init[] = { | |
7844 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7845 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7846 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7847 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7848 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7849 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7850 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7851 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7852 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7853 | { } /* end */ | |
7854 | }; | |
7855 | ||
7856 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { | |
7857 | { 2, alc883_4ST_ch2_init }, | |
7858 | { 4, alc883_4ST_ch4_init }, | |
7859 | { 6, alc883_4ST_ch6_init }, | |
7860 | { 8, alc883_4ST_ch8_init }, | |
7861 | }; | |
7862 | ||
7863 | ||
7864 | /* | |
7865 | * 2ch mode | |
7866 | */ | |
7867 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | |
7868 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7869 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7870 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7871 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7872 | { } /* end */ | |
7873 | }; | |
7874 | ||
7875 | /* | |
7876 | * 4ch mode | |
7877 | */ | |
7878 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | |
7879 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7880 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7881 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7882 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7883 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7884 | { } /* end */ | |
7885 | }; | |
7886 | ||
7887 | /* | |
7888 | * 6ch mode | |
7889 | */ | |
7890 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | |
7891 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7892 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7893 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7894 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7895 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7896 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7897 | { } /* end */ | |
7898 | }; | |
7899 | ||
7900 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | |
7901 | { 2, alc883_3ST_ch2_intel_init }, | |
7902 | { 4, alc883_3ST_ch4_intel_init }, | |
7903 | { 6, alc883_3ST_ch6_intel_init }, | |
7904 | }; | |
7905 | ||
7906 | /* | |
7907 | * 2ch mode | |
7908 | */ | |
7909 | static struct hda_verb alc889_ch2_intel_init[] = { | |
7910 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7911 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7912 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7913 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7914 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7915 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7916 | { } /* end */ | |
7917 | }; | |
7918 | ||
7919 | /* | |
7920 | * 6ch mode | |
7921 | */ | |
7922 | static struct hda_verb alc889_ch6_intel_init[] = { | |
7923 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7924 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7925 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7926 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7927 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7928 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7929 | { } /* end */ | |
7930 | }; | |
7931 | ||
7932 | /* | |
7933 | * 8ch mode | |
7934 | */ | |
7935 | static struct hda_verb alc889_ch8_intel_init[] = { | |
7936 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7937 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7938 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7939 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7940 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7941 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7942 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7943 | { } /* end */ | |
7944 | }; | |
7945 | ||
7946 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { | |
7947 | { 2, alc889_ch2_intel_init }, | |
7948 | { 6, alc889_ch6_intel_init }, | |
7949 | { 8, alc889_ch8_intel_init }, | |
7950 | }; | |
7951 | ||
7952 | /* | |
7953 | * 6ch mode | |
7954 | */ | |
7955 | static struct hda_verb alc883_sixstack_ch6_init[] = { | |
7956 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7957 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7958 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7959 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7960 | { } /* end */ | |
7961 | }; | |
7962 | ||
7963 | /* | |
7964 | * 8ch mode | |
7965 | */ | |
7966 | static struct hda_verb alc883_sixstack_ch8_init[] = { | |
7967 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7968 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7969 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7970 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7971 | { } /* end */ | |
7972 | }; | |
7973 | ||
7974 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | |
7975 | { 6, alc883_sixstack_ch6_init }, | |
7976 | { 8, alc883_sixstack_ch8_init }, | |
7977 | }; | |
7978 | ||
7979 | ||
7980 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
7981 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
7982 | */ | |
7983 | static struct snd_kcontrol_new alc882_base_mixer[] = { | |
7984 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7985 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7986 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7987 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
7988 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7989 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7990 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7991 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7992 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
7993 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
7994 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7995 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7996 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7997 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7998 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7999 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8000 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
8001 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8002 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8003 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
8004 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8005 | { } /* end */ | |
8006 | }; | |
8007 | ||
8008 | /* Macbook Air 2,1 same control for HP and internal Speaker */ | |
8009 | ||
8010 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { | |
8011 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8012 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), | |
8013 | { } | |
8014 | }; | |
8015 | ||
8016 | ||
8017 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { | |
8018 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8019 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
8020 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
8021 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
8022 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
8023 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8024 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8025 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | |
8026 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
8027 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), | |
8028 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), | |
8029 | { } /* end */ | |
8030 | }; | |
8031 | ||
8032 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { | |
8033 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8034 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
8035 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
8036 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
8037 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
8038 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
8039 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | |
8040 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | |
8041 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
8042 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
8043 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
8044 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
8045 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), | |
8046 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), | |
8047 | { } /* end */ | |
8048 | }; | |
8049 | ||
8050 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { | |
8051 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8052 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
8053 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
8054 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
8055 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
8056 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
8057 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | |
8058 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | |
8059 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
8060 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
8061 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), | |
8062 | { } /* end */ | |
8063 | }; | |
8064 | ||
8065 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { | |
8066 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8067 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
8068 | { } /* end */ | |
8069 | }; | |
8070 | ||
8071 | ||
8072 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { | |
8073 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8074 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8075 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8076 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8077 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8078 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8079 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8080 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
8081 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8082 | { } /* end */ | |
8083 | }; | |
8084 | ||
8085 | static struct snd_kcontrol_new alc882_targa_mixer[] = { | |
8086 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8087 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8088 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8089 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8090 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8091 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8092 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8093 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8094 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8095 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
8096 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8097 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8098 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
8099 | { } /* end */ | |
8100 | }; | |
8101 | ||
8102 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? | |
8103 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c | |
8104 | */ | |
8105 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { | |
8106 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8107 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8108 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8109 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
8110 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8111 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8112 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8113 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8114 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
8115 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
8116 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8117 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8118 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
8119 | { } /* end */ | |
8120 | }; | |
8121 | ||
8122 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { | |
8123 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8124 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8125 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8126 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8127 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8128 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8129 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8130 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8131 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
8132 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8133 | { } /* end */ | |
8134 | }; | |
8135 | ||
8136 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { | |
8137 | { | |
8138 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8139 | .name = "Channel Mode", | |
8140 | .info = alc_ch_mode_info, | |
8141 | .get = alc_ch_mode_get, | |
8142 | .put = alc_ch_mode_put, | |
8143 | }, | |
8144 | { } /* end */ | |
8145 | }; | |
8146 | ||
8147 | static struct hda_verb alc882_base_init_verbs[] = { | |
8148 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
8149 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8150 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8151 | /* Rear mixer */ | |
8152 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8153 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8154 | /* CLFE mixer */ | |
8155 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8156 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8157 | /* Side mixer */ | |
8158 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8159 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8160 | ||
8161 | /* Front Pin: output 0 (0x0c) */ | |
8162 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8163 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8164 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8165 | /* Rear Pin: output 1 (0x0d) */ | |
8166 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8167 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8168 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8169 | /* CLFE Pin: output 2 (0x0e) */ | |
8170 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8171 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8172 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8173 | /* Side Pin: output 3 (0x0f) */ | |
8174 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8175 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8176 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
8177 | /* Mic (rear) pin: input vref at 80% */ | |
8178 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8179 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8180 | /* Front Mic pin: input vref at 80% */ | |
8181 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8182 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8183 | /* Line In pin: input */ | |
8184 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8185 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8186 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
8187 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8188 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8189 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8190 | /* CD pin widget for input */ | |
8191 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8192 | ||
8193 | /* FIXME: use matrix-type input source selection */ | |
8194 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8195 | /* Input mixer2 */ | |
8196 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8197 | /* Input mixer3 */ | |
8198 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8199 | /* ADC2: mute amp left and right */ | |
8200 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8201 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8202 | /* ADC3: mute amp left and right */ | |
8203 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8204 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8205 | ||
8206 | { } | |
8207 | }; | |
8208 | ||
8209 | static struct hda_verb alc882_adc1_init_verbs[] = { | |
8210 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
8211 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8212 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8213 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8214 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8215 | /* ADC1: mute amp left and right */ | |
8216 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8217 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8218 | { } | |
8219 | }; | |
8220 | ||
8221 | static struct hda_verb alc882_eapd_verbs[] = { | |
8222 | /* change to EAPD mode */ | |
8223 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
8224 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
8225 | { } | |
8226 | }; | |
8227 | ||
8228 | static struct hda_verb alc889_eapd_verbs[] = { | |
8229 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
8230 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
8231 | { } | |
8232 | }; | |
8233 | ||
8234 | static struct hda_verb alc_hp15_unsol_verbs[] = { | |
8235 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
8236 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8237 | {} | |
8238 | }; | |
8239 | ||
8240 | static struct hda_verb alc885_init_verbs[] = { | |
8241 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
8242 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8243 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8244 | /* Rear mixer */ | |
8245 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8246 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8247 | /* CLFE mixer */ | |
8248 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8249 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8250 | /* Side mixer */ | |
8251 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8252 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8253 | ||
8254 | /* Front HP Pin: output 0 (0x0c) */ | |
8255 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8256 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8257 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8258 | /* Front Pin: output 0 (0x0c) */ | |
8259 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8260 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8261 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8262 | /* Rear Pin: output 1 (0x0d) */ | |
8263 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8264 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8265 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8266 | /* CLFE Pin: output 2 (0x0e) */ | |
8267 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8268 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8269 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8270 | /* Side Pin: output 3 (0x0f) */ | |
8271 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8272 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8273 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
8274 | /* Mic (rear) pin: input vref at 80% */ | |
8275 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8276 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8277 | /* Front Mic pin: input vref at 80% */ | |
8278 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8279 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8280 | /* Line In pin: input */ | |
8281 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8282 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8283 | ||
8284 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ | |
8285 | /* Input mixer1 */ | |
8286 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8287 | /* Input mixer2 */ | |
8288 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8289 | /* Input mixer3 */ | |
8290 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8291 | /* ADC2: mute amp left and right */ | |
8292 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8293 | /* ADC3: mute amp left and right */ | |
8294 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8295 | ||
8296 | { } | |
8297 | }; | |
8298 | ||
8299 | static struct hda_verb alc885_init_input_verbs[] = { | |
8300 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8301 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
8302 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
8303 | { } | |
8304 | }; | |
8305 | ||
8306 | ||
8307 | /* Unmute Selector 24h and set the default input to front mic */ | |
8308 | static struct hda_verb alc889_init_input_verbs[] = { | |
8309 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8310 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8311 | { } | |
8312 | }; | |
8313 | ||
8314 | ||
8315 | #define alc883_init_verbs alc882_base_init_verbs | |
8316 | ||
8317 | /* Mac Pro test */ | |
8318 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | |
8319 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8320 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8321 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | |
8322 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
8323 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
8324 | /* FIXME: this looks suspicious... | |
8325 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8326 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8327 | */ | |
8328 | { } /* end */ | |
8329 | }; | |
8330 | ||
8331 | static struct hda_verb alc882_macpro_init_verbs[] = { | |
8332 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
8333 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8335 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8336 | /* Front Pin: output 0 (0x0c) */ | |
8337 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8338 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8339 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8340 | /* Front Mic pin: input vref at 80% */ | |
8341 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8342 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8343 | /* Speaker: output */ | |
8344 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8345 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8346 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | |
8347 | /* Headphone output (output 0 - 0x0c) */ | |
8348 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8349 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8350 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8351 | ||
8352 | /* FIXME: use matrix-type input source selection */ | |
8353 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8354 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
8355 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8356 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8357 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8358 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8359 | /* Input mixer2 */ | |
8360 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8361 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8362 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8363 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8364 | /* Input mixer3 */ | |
8365 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8366 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8367 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8368 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8369 | /* ADC1: mute amp left and right */ | |
8370 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8371 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8372 | /* ADC2: mute amp left and right */ | |
8373 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8374 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8375 | /* ADC3: mute amp left and right */ | |
8376 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8377 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8378 | ||
8379 | { } | |
8380 | }; | |
8381 | ||
8382 | /* Macbook 5,1 */ | |
8383 | static struct hda_verb alc885_mb5_init_verbs[] = { | |
8384 | /* DACs */ | |
8385 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8386 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8387 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8388 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8389 | /* Front mixer */ | |
8390 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8391 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8392 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8393 | /* Surround mixer */ | |
8394 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8395 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8396 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8397 | /* LFE mixer */ | |
8398 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8399 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8400 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8401 | /* HP mixer */ | |
8402 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8403 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8404 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8405 | /* Front Pin (0x0c) */ | |
8406 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8407 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8408 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8409 | /* LFE Pin (0x0e) */ | |
8410 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8411 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8412 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8413 | /* HP Pin (0x0f) */ | |
8414 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8415 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8416 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
8417 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8418 | /* Front Mic pin: input vref at 80% */ | |
8419 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8420 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8421 | /* Line In pin */ | |
8422 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8423 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8424 | ||
8425 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, | |
8426 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, | |
8427 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, | |
8428 | { } | |
8429 | }; | |
8430 | ||
8431 | /* Macmini 3,1 */ | |
8432 | static struct hda_verb alc885_macmini3_init_verbs[] = { | |
8433 | /* DACs */ | |
8434 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8435 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8436 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8437 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8438 | /* Front mixer */ | |
8439 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8440 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8441 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8442 | /* Surround mixer */ | |
8443 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8444 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8445 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8446 | /* LFE mixer */ | |
8447 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8448 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8449 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8450 | /* HP mixer */ | |
8451 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8452 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8453 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8454 | /* Front Pin (0x0c) */ | |
8455 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8456 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8457 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8458 | /* LFE Pin (0x0e) */ | |
8459 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8460 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8461 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8462 | /* HP Pin (0x0f) */ | |
8463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8464 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8465 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
8466 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8467 | /* Line In pin */ | |
8468 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8469 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8470 | ||
8471 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8472 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8473 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8474 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8475 | { } | |
8476 | }; | |
8477 | ||
8478 | ||
8479 | static struct hda_verb alc885_mba21_init_verbs[] = { | |
8480 | /*Internal and HP Speaker Mixer*/ | |
8481 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8482 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8483 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8484 | /*Internal Speaker Pin (0x0c)*/ | |
8485 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8486 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8487 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8488 | /* HP Pin: output 0 (0x0e) */ | |
8489 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | |
8490 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8491 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8492 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, | |
8493 | /* Line in (is hp when jack connected)*/ | |
8494 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, | |
8495 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8496 | ||
8497 | { } | |
8498 | }; | |
8499 | ||
8500 | ||
8501 | /* Macbook Pro rev3 */ | |
8502 | static struct hda_verb alc885_mbp3_init_verbs[] = { | |
8503 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
8504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8505 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8506 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8507 | /* Rear mixer */ | |
8508 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8509 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8510 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8511 | /* HP mixer */ | |
8512 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8513 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8514 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8515 | /* Front Pin: output 0 (0x0c) */ | |
8516 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8517 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8518 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8519 | /* HP Pin: output 0 (0x0e) */ | |
8520 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | |
8521 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8522 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8523 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8524 | /* Mic (rear) pin: input vref at 80% */ | |
8525 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8526 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8527 | /* Front Mic pin: input vref at 80% */ | |
8528 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8529 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8530 | /* Line In pin: use output 1 when in LineOut mode */ | |
8531 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8532 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8533 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8534 | ||
8535 | /* FIXME: use matrix-type input source selection */ | |
8536 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8537 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
8538 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8539 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8540 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8541 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8542 | /* Input mixer2 */ | |
8543 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8544 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8545 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8546 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8547 | /* Input mixer3 */ | |
8548 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8549 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8550 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8551 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8552 | /* ADC1: mute amp left and right */ | |
8553 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8554 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8555 | /* ADC2: mute amp left and right */ | |
8556 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8557 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8558 | /* ADC3: mute amp left and right */ | |
8559 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8560 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8561 | ||
8562 | { } | |
8563 | }; | |
8564 | ||
8565 | /* iMac 9,1 */ | |
8566 | static struct hda_verb alc885_imac91_init_verbs[] = { | |
8567 | /* Internal Speaker Pin (0x0c) */ | |
8568 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8569 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8570 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8571 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8572 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8573 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8574 | /* HP Pin: Rear */ | |
8575 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8576 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8577 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8578 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, | |
8579 | /* Line in Rear */ | |
8580 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, | |
8581 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8582 | /* Front Mic pin: input vref at 80% */ | |
8583 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8584 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8585 | /* Rear mixer */ | |
8586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8588 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8589 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ | |
8590 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8593 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ | |
8594 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8595 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8596 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8597 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8598 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ | |
8599 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8600 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8601 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8602 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8603 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ | |
8604 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8605 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8606 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8607 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8608 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ | |
8609 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8610 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8611 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ | |
8612 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8613 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8614 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ | |
8615 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8616 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8617 | { } | |
8618 | }; | |
8619 | ||
8620 | /* iMac 24 mixer. */ | |
8621 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { | |
8622 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8623 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), | |
8624 | { } /* end */ | |
8625 | }; | |
8626 | ||
8627 | /* iMac 24 init verbs. */ | |
8628 | static struct hda_verb alc885_imac24_init_verbs[] = { | |
8629 | /* Internal speakers: output 0 (0x0c) */ | |
8630 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8631 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8632 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8633 | /* Internal speakers: output 0 (0x0c) */ | |
8634 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8635 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8636 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8637 | /* Headphone: output 0 (0x0c) */ | |
8638 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8639 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8640 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8641 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8642 | /* Front Mic: input vref at 80% */ | |
8643 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8644 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8645 | { } | |
8646 | }; | |
8647 | ||
8648 | /* Toggle speaker-output according to the hp-jack state */ | |
8649 | static void alc885_imac24_setup(struct hda_codec *codec) | |
8650 | { | |
8651 | struct alc_spec *spec = codec->spec; | |
8652 | ||
8653 | spec->autocfg.hp_pins[0] = 0x14; | |
8654 | spec->autocfg.speaker_pins[0] = 0x18; | |
8655 | spec->autocfg.speaker_pins[1] = 0x1a; | |
8656 | } | |
8657 | ||
8658 | #define alc885_mb5_setup alc885_imac24_setup | |
8659 | #define alc885_macmini3_setup alc885_imac24_setup | |
8660 | ||
8661 | /* Macbook Air 2,1 */ | |
8662 | static void alc885_mba21_setup(struct hda_codec *codec) | |
8663 | { | |
8664 | struct alc_spec *spec = codec->spec; | |
8665 | ||
8666 | spec->autocfg.hp_pins[0] = 0x14; | |
8667 | spec->autocfg.speaker_pins[0] = 0x18; | |
8668 | } | |
8669 | ||
8670 | ||
8671 | ||
8672 | static void alc885_mbp3_setup(struct hda_codec *codec) | |
8673 | { | |
8674 | struct alc_spec *spec = codec->spec; | |
8675 | ||
8676 | spec->autocfg.hp_pins[0] = 0x15; | |
8677 | spec->autocfg.speaker_pins[0] = 0x14; | |
8678 | } | |
8679 | ||
8680 | static void alc885_imac91_setup(struct hda_codec *codec) | |
8681 | { | |
8682 | struct alc_spec *spec = codec->spec; | |
8683 | ||
8684 | spec->autocfg.hp_pins[0] = 0x14; | |
8685 | spec->autocfg.speaker_pins[0] = 0x18; | |
8686 | spec->autocfg.speaker_pins[1] = 0x1a; | |
8687 | } | |
8688 | ||
8689 | static struct hda_verb alc882_targa_verbs[] = { | |
8690 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8691 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8692 | ||
8693 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8694 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8695 | ||
8696 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
8697 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8698 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8699 | ||
8700 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8701 | { } /* end */ | |
8702 | }; | |
8703 | ||
8704 | /* toggle speaker-output according to the hp-jack state */ | |
8705 | static void alc882_targa_automute(struct hda_codec *codec) | |
8706 | { | |
8707 | struct alc_spec *spec = codec->spec; | |
8708 | alc_automute_amp(codec); | |
8709 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, | |
8710 | spec->jack_present ? 1 : 3); | |
8711 | } | |
8712 | ||
8713 | static void alc882_targa_setup(struct hda_codec *codec) | |
8714 | { | |
8715 | struct alc_spec *spec = codec->spec; | |
8716 | ||
8717 | spec->autocfg.hp_pins[0] = 0x14; | |
8718 | spec->autocfg.speaker_pins[0] = 0x1b; | |
8719 | } | |
8720 | ||
8721 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | |
8722 | { | |
8723 | if ((res >> 26) == ALC880_HP_EVENT) | |
8724 | alc882_targa_automute(codec); | |
8725 | } | |
8726 | ||
8727 | static struct hda_verb alc882_asus_a7j_verbs[] = { | |
8728 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8729 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8730 | ||
8731 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8733 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8734 | ||
8735 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8736 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8737 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8738 | ||
8739 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
8740 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8741 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8742 | { } /* end */ | |
8743 | }; | |
8744 | ||
8745 | static struct hda_verb alc882_asus_a7m_verbs[] = { | |
8746 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8747 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8748 | ||
8749 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8750 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8751 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8752 | ||
8753 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8754 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8755 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8756 | ||
8757 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
8758 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8759 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8760 | { } /* end */ | |
8761 | }; | |
8762 | ||
8763 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) | |
8764 | { | |
8765 | unsigned int gpiostate, gpiomask, gpiodir; | |
8766 | ||
8767 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | |
8768 | AC_VERB_GET_GPIO_DATA, 0); | |
8769 | ||
8770 | if (!muted) | |
8771 | gpiostate |= (1 << pin); | |
8772 | else | |
8773 | gpiostate &= ~(1 << pin); | |
8774 | ||
8775 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | |
8776 | AC_VERB_GET_GPIO_MASK, 0); | |
8777 | gpiomask |= (1 << pin); | |
8778 | ||
8779 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | |
8780 | AC_VERB_GET_GPIO_DIRECTION, 0); | |
8781 | gpiodir |= (1 << pin); | |
8782 | ||
8783 | ||
8784 | snd_hda_codec_write(codec, codec->afg, 0, | |
8785 | AC_VERB_SET_GPIO_MASK, gpiomask); | |
8786 | snd_hda_codec_write(codec, codec->afg, 0, | |
8787 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | |
8788 | ||
8789 | msleep(1); | |
8790 | ||
8791 | snd_hda_codec_write(codec, codec->afg, 0, | |
8792 | AC_VERB_SET_GPIO_DATA, gpiostate); | |
8793 | } | |
8794 | ||
8795 | /* set up GPIO at initialization */ | |
8796 | static void alc885_macpro_init_hook(struct hda_codec *codec) | |
8797 | { | |
8798 | alc882_gpio_mute(codec, 0, 0); | |
8799 | alc882_gpio_mute(codec, 1, 0); | |
8800 | } | |
8801 | ||
8802 | /* set up GPIO and update auto-muting at initialization */ | |
8803 | static void alc885_imac24_init_hook(struct hda_codec *codec) | |
8804 | { | |
8805 | alc885_macpro_init_hook(codec); | |
8806 | alc_automute_amp(codec); | |
8807 | } | |
8808 | ||
8809 | /* | |
8810 | * generic initialization of ADC, input mixers and output mixers | |
8811 | */ | |
8812 | static struct hda_verb alc883_auto_init_verbs[] = { | |
8813 | /* | |
8814 | * Unmute ADC0-2 and set the default input to mic-in | |
8815 | */ | |
8816 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8817 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8818 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8819 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8820 | ||
8821 | /* | |
8822 | * Set up output mixers (0x0c - 0x0f) | |
8823 | */ | |
8824 | /* set vol=0 to output mixers */ | |
8825 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8826 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8827 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8828 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8829 | /* set up input amps for analog loopback */ | |
8830 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
8831 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8832 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8833 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8834 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8835 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8836 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8837 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8838 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8839 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8840 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8841 | ||
8842 | /* FIXME: use matrix-type input source selection */ | |
8843 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8844 | /* Input mixer2 */ | |
8845 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8846 | /* Input mixer3 */ | |
8847 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8848 | { } | |
8849 | }; | |
8850 | ||
8851 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ | |
8852 | static struct hda_verb alc889A_mb31_ch2_init[] = { | |
8853 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | |
8854 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8855 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | |
8856 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | |
8857 | { } /* end */ | |
8858 | }; | |
8859 | ||
8860 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ | |
8861 | static struct hda_verb alc889A_mb31_ch4_init[] = { | |
8862 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | |
8863 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8864 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | |
8865 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | |
8866 | { } /* end */ | |
8867 | }; | |
8868 | ||
8869 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ | |
8870 | static struct hda_verb alc889A_mb31_ch5_init[] = { | |
8871 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ | |
8872 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8873 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | |
8874 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | |
8875 | { } /* end */ | |
8876 | }; | |
8877 | ||
8878 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ | |
8879 | static struct hda_verb alc889A_mb31_ch6_init[] = { | |
8880 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ | |
8881 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ | |
8882 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | |
8883 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | |
8884 | { } /* end */ | |
8885 | }; | |
8886 | ||
8887 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { | |
8888 | { 2, alc889A_mb31_ch2_init }, | |
8889 | { 4, alc889A_mb31_ch4_init }, | |
8890 | { 5, alc889A_mb31_ch5_init }, | |
8891 | { 6, alc889A_mb31_ch6_init }, | |
8892 | }; | |
8893 | ||
8894 | static struct hda_verb alc883_medion_eapd_verbs[] = { | |
8895 | /* eanable EAPD on medion laptop */ | |
8896 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
8897 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
8898 | { } | |
8899 | }; | |
8900 | ||
8901 | #define alc883_base_mixer alc882_base_mixer | |
8902 | ||
8903 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { | |
8904 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8905 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8906 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8907 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8908 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8909 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8910 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8911 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8912 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
8913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8914 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8915 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
8916 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8917 | { } /* end */ | |
8918 | }; | |
8919 | ||
8920 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { | |
8921 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8922 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
8923 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8924 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8925 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8926 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
8927 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8928 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8929 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
8930 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8931 | { } /* end */ | |
8932 | }; | |
8933 | ||
8934 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { | |
8935 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8936 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
8937 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8938 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8939 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8940 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
8941 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8942 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8943 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
8944 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8945 | { } /* end */ | |
8946 | }; | |
8947 | ||
8948 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { | |
8949 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8950 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8951 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8952 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8953 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8954 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8955 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8956 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8957 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
8958 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8959 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8960 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
8961 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8962 | { } /* end */ | |
8963 | }; | |
8964 | ||
8965 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { | |
8966 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8967 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8968 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8969 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8970 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8971 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8972 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8973 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8974 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8975 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8976 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8977 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8978 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8979 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8980 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
8981 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8982 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8983 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
8984 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8985 | { } /* end */ | |
8986 | }; | |
8987 | ||
8988 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { | |
8989 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8990 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8991 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8992 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8993 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
8994 | HDA_OUTPUT), | |
8995 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8996 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8997 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8998 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8999 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9000 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9001 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9002 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9003 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9004 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
9005 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9006 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9007 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
9008 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9009 | { } /* end */ | |
9010 | }; | |
9011 | ||
9012 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { | |
9013 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9014 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9015 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
9016 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
9017 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
9018 | HDA_OUTPUT), | |
9019 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
9020 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
9021 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
9022 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
9023 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), | |
9024 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9025 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9026 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9027 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
9028 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), | |
9029 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
9030 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9031 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
9032 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9033 | { } /* end */ | |
9034 | }; | |
9035 | ||
9036 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { | |
9037 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9038 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9039 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
9040 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
9041 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
9042 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
9043 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
9044 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
9045 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
9046 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9047 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9048 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9049 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9050 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9051 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
9052 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9053 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9054 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
9055 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9056 | { } /* end */ | |
9057 | }; | |
9058 | ||
9059 | static struct snd_kcontrol_new alc883_targa_mixer[] = { | |
9060 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9061 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9062 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
9063 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
9064 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
9065 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
9066 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
9067 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
9068 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
9069 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
9070 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9071 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9072 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9073 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9074 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9075 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
9076 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9077 | { } /* end */ | |
9078 | }; | |
9079 | ||
9080 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { | |
9081 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9082 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9083 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
9084 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
9085 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9086 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9087 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9088 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
9089 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9090 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9091 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
9092 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9093 | { } /* end */ | |
9094 | }; | |
9095 | ||
9096 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { | |
9097 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
9098 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
9099 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9100 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
9101 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9102 | { } /* end */ | |
9103 | }; | |
9104 | ||
9105 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { | |
9106 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9107 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9108 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
9109 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
9110 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
9111 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9112 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
9113 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9114 | { } /* end */ | |
9115 | }; | |
9116 | ||
9117 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { | |
9118 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9119 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
9120 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
9121 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9122 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9123 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9124 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9125 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9126 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9127 | { } /* end */ | |
9128 | }; | |
9129 | ||
9130 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { | |
9131 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9132 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9133 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9134 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | |
9135 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), | |
9136 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), | |
9137 | { } /* end */ | |
9138 | }; | |
9139 | ||
9140 | static struct hda_verb alc883_medion_wim2160_verbs[] = { | |
9141 | /* Unmute front mixer */ | |
9142 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9143 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9144 | ||
9145 | /* Set speaker pin to front mixer */ | |
9146 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9147 | ||
9148 | /* Init headphone pin */ | |
9149 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9150 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9151 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9152 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9153 | ||
9154 | { } /* end */ | |
9155 | }; | |
9156 | ||
9157 | /* toggle speaker-output according to the hp-jack state */ | |
9158 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) | |
9159 | { | |
9160 | struct alc_spec *spec = codec->spec; | |
9161 | ||
9162 | spec->autocfg.hp_pins[0] = 0x1a; | |
9163 | spec->autocfg.speaker_pins[0] = 0x15; | |
9164 | } | |
9165 | ||
9166 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | |
9167 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9168 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9169 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
9170 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9171 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9172 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9173 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
9174 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9175 | { } /* end */ | |
9176 | }; | |
9177 | ||
9178 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { | |
9179 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9180 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
9181 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9182 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9183 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9184 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9185 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9186 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
9187 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9188 | { } /* end */ | |
9189 | }; | |
9190 | ||
9191 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { | |
9192 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9193 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9194 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
9195 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | |
9196 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", | |
9197 | 0x0d, 1, 0x0, HDA_OUTPUT), | |
9198 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
9199 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
9200 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
9201 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
9202 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
9203 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9204 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9205 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9206 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9207 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9208 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
9209 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9210 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9211 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
9212 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9213 | { } /* end */ | |
9214 | }; | |
9215 | ||
9216 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { | |
9217 | /* Output mixers */ | |
9218 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
9219 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
9220 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
9221 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
9222 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, | |
9223 | HDA_OUTPUT), | |
9224 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), | |
9225 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), | |
9226 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), | |
9227 | /* Output switches */ | |
9228 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), | |
9229 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), | |
9230 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), | |
9231 | /* Boost mixers */ | |
9232 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), | |
9233 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), | |
9234 | /* Input mixers */ | |
9235 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | |
9236 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
9237 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9238 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9239 | { } /* end */ | |
9240 | }; | |
9241 | ||
9242 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { | |
9243 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9244 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9245 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9246 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9247 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
9248 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9249 | { } /* end */ | |
9250 | }; | |
9251 | ||
9252 | static struct hda_bind_ctls alc883_bind_cap_vol = { | |
9253 | .ops = &snd_hda_bind_vol, | |
9254 | .values = { | |
9255 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
9256 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
9257 | 0 | |
9258 | }, | |
9259 | }; | |
9260 | ||
9261 | static struct hda_bind_ctls alc883_bind_cap_switch = { | |
9262 | .ops = &snd_hda_bind_sw, | |
9263 | .values = { | |
9264 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
9265 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
9266 | 0 | |
9267 | }, | |
9268 | }; | |
9269 | ||
9270 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { | |
9271 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9272 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9273 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
9274 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9275 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9276 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9277 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
9278 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9279 | { } /* end */ | |
9280 | }; | |
9281 | ||
9282 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { | |
9283 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), | |
9284 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), | |
9285 | { | |
9286 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9287 | /* .name = "Capture Source", */ | |
9288 | .name = "Input Source", | |
9289 | .count = 1, | |
9290 | .info = alc_mux_enum_info, | |
9291 | .get = alc_mux_enum_get, | |
9292 | .put = alc_mux_enum_put, | |
9293 | }, | |
9294 | { } /* end */ | |
9295 | }; | |
9296 | ||
9297 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { | |
9298 | { | |
9299 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9300 | .name = "Channel Mode", | |
9301 | .info = alc_ch_mode_info, | |
9302 | .get = alc_ch_mode_get, | |
9303 | .put = alc_ch_mode_put, | |
9304 | }, | |
9305 | { } /* end */ | |
9306 | }; | |
9307 | ||
9308 | /* toggle speaker-output according to the hp-jack state */ | |
9309 | static void alc883_mitac_setup(struct hda_codec *codec) | |
9310 | { | |
9311 | struct alc_spec *spec = codec->spec; | |
9312 | ||
9313 | spec->autocfg.hp_pins[0] = 0x15; | |
9314 | spec->autocfg.speaker_pins[0] = 0x14; | |
9315 | spec->autocfg.speaker_pins[1] = 0x17; | |
9316 | } | |
9317 | ||
9318 | static struct hda_verb alc883_mitac_verbs[] = { | |
9319 | /* HP */ | |
9320 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9321 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9322 | /* Subwoofer */ | |
9323 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
9324 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9325 | ||
9326 | /* enable unsolicited event */ | |
9327 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9328 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ | |
9329 | ||
9330 | { } /* end */ | |
9331 | }; | |
9332 | ||
9333 | static struct hda_verb alc883_clevo_m540r_verbs[] = { | |
9334 | /* HP */ | |
9335 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9336 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9337 | /* Int speaker */ | |
9338 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ | |
9339 | ||
9340 | /* enable unsolicited event */ | |
9341 | /* | |
9342 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9343 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
9344 | */ | |
9345 | ||
9346 | { } /* end */ | |
9347 | }; | |
9348 | ||
9349 | static struct hda_verb alc883_clevo_m720_verbs[] = { | |
9350 | /* HP */ | |
9351 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9352 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9353 | /* Int speaker */ | |
9354 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9355 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9356 | ||
9357 | /* enable unsolicited event */ | |
9358 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9359 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
9360 | ||
9361 | { } /* end */ | |
9362 | }; | |
9363 | ||
9364 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { | |
9365 | /* HP */ | |
9366 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9367 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9368 | /* Subwoofer */ | |
9369 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9370 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9371 | ||
9372 | /* enable unsolicited event */ | |
9373 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9374 | ||
9375 | { } /* end */ | |
9376 | }; | |
9377 | ||
9378 | static struct hda_verb alc883_targa_verbs[] = { | |
9379 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9381 | ||
9382 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9383 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9384 | ||
9385 | /* Connect Line-Out side jack (SPDIF) to Side */ | |
9386 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9387 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9388 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
9389 | /* Connect Mic jack to CLFE */ | |
9390 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9391 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9392 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
9393 | /* Connect Line-in jack to Surround */ | |
9394 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9395 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9396 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9397 | /* Connect HP out jack to Front */ | |
9398 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9399 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9400 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9401 | ||
9402 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9403 | ||
9404 | { } /* end */ | |
9405 | }; | |
9406 | ||
9407 | static struct hda_verb alc883_lenovo_101e_verbs[] = { | |
9408 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9409 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, | |
9410 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, | |
9411 | { } /* end */ | |
9412 | }; | |
9413 | ||
9414 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { | |
9415 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9416 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9417 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9418 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9419 | { } /* end */ | |
9420 | }; | |
9421 | ||
9422 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { | |
9423 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9425 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9426 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, | |
9427 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9428 | { } /* end */ | |
9429 | }; | |
9430 | ||
9431 | static struct hda_verb alc883_haier_w66_verbs[] = { | |
9432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9433 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9434 | ||
9435 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9436 | ||
9437 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9438 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9439 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9440 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9441 | { } /* end */ | |
9442 | }; | |
9443 | ||
9444 | static struct hda_verb alc888_lenovo_sky_verbs[] = { | |
9445 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9446 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9447 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9448 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9449 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9450 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9451 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9452 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9453 | { } /* end */ | |
9454 | }; | |
9455 | ||
9456 | static struct hda_verb alc888_6st_dell_verbs[] = { | |
9457 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9458 | { } | |
9459 | }; | |
9460 | ||
9461 | static struct hda_verb alc883_vaiott_verbs[] = { | |
9462 | /* HP */ | |
9463 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9464 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9465 | ||
9466 | /* enable unsolicited event */ | |
9467 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9468 | ||
9469 | { } /* end */ | |
9470 | }; | |
9471 | ||
9472 | static void alc888_3st_hp_setup(struct hda_codec *codec) | |
9473 | { | |
9474 | struct alc_spec *spec = codec->spec; | |
9475 | ||
9476 | spec->autocfg.hp_pins[0] = 0x1b; | |
9477 | spec->autocfg.speaker_pins[0] = 0x14; | |
9478 | spec->autocfg.speaker_pins[1] = 0x16; | |
9479 | spec->autocfg.speaker_pins[2] = 0x18; | |
9480 | } | |
9481 | ||
9482 | static struct hda_verb alc888_3st_hp_verbs[] = { | |
9483 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ | |
9484 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ | |
9485 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | |
9486 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9487 | { } /* end */ | |
9488 | }; | |
9489 | ||
9490 | /* | |
9491 | * 2ch mode | |
9492 | */ | |
9493 | static struct hda_verb alc888_3st_hp_2ch_init[] = { | |
9494 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
9495 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
9496 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
9497 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
9498 | { } /* end */ | |
9499 | }; | |
9500 | ||
9501 | /* | |
9502 | * 4ch mode | |
9503 | */ | |
9504 | static struct hda_verb alc888_3st_hp_4ch_init[] = { | |
9505 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
9506 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
9507 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
9508 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9509 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
9510 | { } /* end */ | |
9511 | }; | |
9512 | ||
9513 | /* | |
9514 | * 6ch mode | |
9515 | */ | |
9516 | static struct hda_verb alc888_3st_hp_6ch_init[] = { | |
9517 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
9518 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9519 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
9520 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
9521 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9522 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
9523 | { } /* end */ | |
9524 | }; | |
9525 | ||
9526 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { | |
9527 | { 2, alc888_3st_hp_2ch_init }, | |
9528 | { 4, alc888_3st_hp_4ch_init }, | |
9529 | { 6, alc888_3st_hp_6ch_init }, | |
9530 | }; | |
9531 | ||
9532 | /* toggle front-jack and RCA according to the hp-jack state */ | |
9533 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | |
9534 | { | |
9535 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); | |
9536 | ||
9537 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9538 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9539 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9540 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9541 | } | |
9542 | ||
9543 | /* toggle RCA according to the front-jack state */ | |
9544 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) | |
9545 | { | |
9546 | unsigned int present = snd_hda_jack_detect(codec, 0x14); | |
9547 | ||
9548 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9549 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9550 | } | |
9551 | ||
9552 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, | |
9553 | unsigned int res) | |
9554 | { | |
9555 | if ((res >> 26) == ALC880_HP_EVENT) | |
9556 | alc888_lenovo_ms7195_front_automute(codec); | |
9557 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
9558 | alc888_lenovo_ms7195_rca_automute(codec); | |
9559 | } | |
9560 | ||
9561 | /* toggle speaker-output according to the hp-jack state */ | |
9562 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) | |
9563 | { | |
9564 | struct alc_spec *spec = codec->spec; | |
9565 | ||
9566 | spec->autocfg.hp_pins[0] = 0x14; | |
9567 | spec->autocfg.speaker_pins[0] = 0x15; | |
9568 | } | |
9569 | ||
9570 | /* toggle speaker-output according to the hp-jack state */ | |
9571 | #define alc883_targa_init_hook alc882_targa_init_hook | |
9572 | #define alc883_targa_unsol_event alc882_targa_unsol_event | |
9573 | ||
9574 | static void alc883_clevo_m720_setup(struct hda_codec *codec) | |
9575 | { | |
9576 | struct alc_spec *spec = codec->spec; | |
9577 | ||
9578 | spec->autocfg.hp_pins[0] = 0x15; | |
9579 | spec->autocfg.speaker_pins[0] = 0x14; | |
9580 | } | |
9581 | ||
9582 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | |
9583 | { | |
9584 | alc_automute_amp(codec); | |
9585 | alc88x_simple_mic_automute(codec); | |
9586 | } | |
9587 | ||
9588 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | |
9589 | unsigned int res) | |
9590 | { | |
9591 | switch (res >> 26) { | |
9592 | case ALC880_MIC_EVENT: | |
9593 | alc88x_simple_mic_automute(codec); | |
9594 | break; | |
9595 | default: | |
9596 | alc_automute_amp_unsol_event(codec, res); | |
9597 | break; | |
9598 | } | |
9599 | } | |
9600 | ||
9601 | /* toggle speaker-output according to the hp-jack state */ | |
9602 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) | |
9603 | { | |
9604 | struct alc_spec *spec = codec->spec; | |
9605 | ||
9606 | spec->autocfg.hp_pins[0] = 0x14; | |
9607 | spec->autocfg.speaker_pins[0] = 0x15; | |
9608 | } | |
9609 | ||
9610 | static void alc883_haier_w66_setup(struct hda_codec *codec) | |
9611 | { | |
9612 | struct alc_spec *spec = codec->spec; | |
9613 | ||
9614 | spec->autocfg.hp_pins[0] = 0x1b; | |
9615 | spec->autocfg.speaker_pins[0] = 0x14; | |
9616 | } | |
9617 | ||
9618 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | |
9619 | { | |
9620 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; | |
9621 | ||
9622 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9623 | HDA_AMP_MUTE, bits); | |
9624 | } | |
9625 | ||
9626 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) | |
9627 | { | |
9628 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; | |
9629 | ||
9630 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9631 | HDA_AMP_MUTE, bits); | |
9632 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9633 | HDA_AMP_MUTE, bits); | |
9634 | } | |
9635 | ||
9636 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |
9637 | unsigned int res) | |
9638 | { | |
9639 | if ((res >> 26) == ALC880_HP_EVENT) | |
9640 | alc883_lenovo_101e_all_automute(codec); | |
9641 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
9642 | alc883_lenovo_101e_ispeaker_automute(codec); | |
9643 | } | |
9644 | ||
9645 | /* toggle speaker-output according to the hp-jack state */ | |
9646 | static void alc883_acer_aspire_setup(struct hda_codec *codec) | |
9647 | { | |
9648 | struct alc_spec *spec = codec->spec; | |
9649 | ||
9650 | spec->autocfg.hp_pins[0] = 0x14; | |
9651 | spec->autocfg.speaker_pins[0] = 0x15; | |
9652 | spec->autocfg.speaker_pins[1] = 0x16; | |
9653 | } | |
9654 | ||
9655 | static struct hda_verb alc883_acer_eapd_verbs[] = { | |
9656 | /* HP Pin: output 0 (0x0c) */ | |
9657 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9658 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9659 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9660 | /* Front Pin: output 0 (0x0c) */ | |
9661 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9662 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9663 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9664 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9665 | /* eanable EAPD on medion laptop */ | |
9666 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
9667 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
9668 | /* enable unsolicited event */ | |
9669 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9670 | { } | |
9671 | }; | |
9672 | ||
9673 | static void alc888_6st_dell_setup(struct hda_codec *codec) | |
9674 | { | |
9675 | struct alc_spec *spec = codec->spec; | |
9676 | ||
9677 | spec->autocfg.hp_pins[0] = 0x1b; | |
9678 | spec->autocfg.speaker_pins[0] = 0x14; | |
9679 | spec->autocfg.speaker_pins[1] = 0x15; | |
9680 | spec->autocfg.speaker_pins[2] = 0x16; | |
9681 | spec->autocfg.speaker_pins[3] = 0x17; | |
9682 | } | |
9683 | ||
9684 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) | |
9685 | { | |
9686 | struct alc_spec *spec = codec->spec; | |
9687 | ||
9688 | spec->autocfg.hp_pins[0] = 0x1b; | |
9689 | spec->autocfg.speaker_pins[0] = 0x14; | |
9690 | spec->autocfg.speaker_pins[1] = 0x15; | |
9691 | spec->autocfg.speaker_pins[2] = 0x16; | |
9692 | spec->autocfg.speaker_pins[3] = 0x17; | |
9693 | spec->autocfg.speaker_pins[4] = 0x1a; | |
9694 | } | |
9695 | ||
9696 | static void alc883_vaiott_setup(struct hda_codec *codec) | |
9697 | { | |
9698 | struct alc_spec *spec = codec->spec; | |
9699 | ||
9700 | spec->autocfg.hp_pins[0] = 0x15; | |
9701 | spec->autocfg.speaker_pins[0] = 0x14; | |
9702 | spec->autocfg.speaker_pins[1] = 0x17; | |
9703 | } | |
9704 | ||
9705 | static struct hda_verb alc888_asus_m90v_verbs[] = { | |
9706 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9707 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9708 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9709 | /* enable unsolicited event */ | |
9710 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9711 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
9712 | { } /* end */ | |
9713 | }; | |
9714 | ||
9715 | static void alc883_mode2_setup(struct hda_codec *codec) | |
9716 | { | |
9717 | struct alc_spec *spec = codec->spec; | |
9718 | ||
9719 | spec->autocfg.hp_pins[0] = 0x1b; | |
9720 | spec->autocfg.speaker_pins[0] = 0x14; | |
9721 | spec->autocfg.speaker_pins[1] = 0x15; | |
9722 | spec->autocfg.speaker_pins[2] = 0x16; | |
9723 | spec->ext_mic.pin = 0x18; | |
9724 | spec->int_mic.pin = 0x19; | |
9725 | spec->ext_mic.mux_idx = 0; | |
9726 | spec->int_mic.mux_idx = 1; | |
9727 | spec->auto_mic = 1; | |
9728 | } | |
9729 | ||
9730 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | |
9731 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9732 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9733 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9734 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9735 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9736 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
9737 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, | |
9738 | /* enable unsolicited event */ | |
9739 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9740 | { } /* end */ | |
9741 | }; | |
9742 | ||
9743 | static void alc883_eee1601_inithook(struct hda_codec *codec) | |
9744 | { | |
9745 | struct alc_spec *spec = codec->spec; | |
9746 | ||
9747 | spec->autocfg.hp_pins[0] = 0x14; | |
9748 | spec->autocfg.speaker_pins[0] = 0x1b; | |
9749 | alc_automute_pin(codec); | |
9750 | } | |
9751 | ||
9752 | static struct hda_verb alc889A_mb31_verbs[] = { | |
9753 | /* Init rear pin (used as headphone output) */ | |
9754 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ | |
9755 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ | |
9756 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9757 | /* Init line pin (used as output in 4ch and 6ch mode) */ | |
9758 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ | |
9759 | /* Init line 2 pin (used as headphone out by default) */ | |
9760 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ | |
9761 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ | |
9762 | { } /* end */ | |
9763 | }; | |
9764 | ||
9765 | /* Mute speakers according to the headphone jack state */ | |
9766 | static void alc889A_mb31_automute(struct hda_codec *codec) | |
9767 | { | |
9768 | unsigned int present; | |
9769 | ||
9770 | /* Mute only in 2ch or 4ch mode */ | |
9771 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) | |
9772 | == 0x00) { | |
9773 | present = snd_hda_jack_detect(codec, 0x15); | |
9774 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9775 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9776 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
9777 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9778 | } | |
9779 | } | |
9780 | ||
9781 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) | |
9782 | { | |
9783 | if ((res >> 26) == ALC880_HP_EVENT) | |
9784 | alc889A_mb31_automute(codec); | |
9785 | } | |
9786 | ||
9787 | ||
9788 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
9789 | #define alc882_loopbacks alc880_loopbacks | |
9790 | #endif | |
9791 | ||
9792 | /* pcm configuration: identical with ALC880 */ | |
9793 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback | |
9794 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | |
9795 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | |
9796 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | |
9797 | ||
9798 | static hda_nid_t alc883_slave_dig_outs[] = { | |
9799 | ALC1200_DIGOUT_NID, 0, | |
9800 | }; | |
9801 | ||
9802 | static hda_nid_t alc1200_slave_dig_outs[] = { | |
9803 | ALC883_DIGOUT_NID, 0, | |
9804 | }; | |
9805 | ||
9806 | /* | |
9807 | * configuration and preset | |
9808 | */ | |
9809 | static const char * const alc882_models[ALC882_MODEL_LAST] = { | |
9810 | [ALC882_3ST_DIG] = "3stack-dig", | |
9811 | [ALC882_6ST_DIG] = "6stack-dig", | |
9812 | [ALC882_ARIMA] = "arima", | |
9813 | [ALC882_W2JC] = "w2jc", | |
9814 | [ALC882_TARGA] = "targa", | |
9815 | [ALC882_ASUS_A7J] = "asus-a7j", | |
9816 | [ALC882_ASUS_A7M] = "asus-a7m", | |
9817 | [ALC885_MACPRO] = "macpro", | |
9818 | [ALC885_MB5] = "mb5", | |
9819 | [ALC885_MACMINI3] = "macmini3", | |
9820 | [ALC885_MBA21] = "mba21", | |
9821 | [ALC885_MBP3] = "mbp3", | |
9822 | [ALC885_IMAC24] = "imac24", | |
9823 | [ALC885_IMAC91] = "imac91", | |
9824 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", | |
9825 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | |
9826 | [ALC883_3ST_6ch] = "3stack-6ch", | |
9827 | [ALC883_6ST_DIG] = "alc883-6stack-dig", | |
9828 | [ALC883_TARGA_DIG] = "targa-dig", | |
9829 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | |
9830 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", | |
9831 | [ALC883_ACER] = "acer", | |
9832 | [ALC883_ACER_ASPIRE] = "acer-aspire", | |
9833 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", | |
9834 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", | |
9835 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", | |
9836 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", | |
9837 | [ALC883_MEDION] = "medion", | |
9838 | [ALC883_MEDION_WIM2160] = "medion-wim2160", | |
9839 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", | |
9840 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", | |
9841 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", | |
9842 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | |
9843 | [ALC888_LENOVO_SKY] = "lenovo-sky", | |
9844 | [ALC883_HAIER_W66] = "haier-w66", | |
9845 | [ALC888_3ST_HP] = "3stack-hp", | |
9846 | [ALC888_6ST_DELL] = "6stack-dell", | |
9847 | [ALC883_MITAC] = "mitac", | |
9848 | [ALC883_CLEVO_M540R] = "clevo-m540r", | |
9849 | [ALC883_CLEVO_M720] = "clevo-m720", | |
9850 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", | |
9851 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", | |
9852 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", | |
9853 | [ALC889A_INTEL] = "intel-alc889a", | |
9854 | [ALC889_INTEL] = "intel-x58", | |
9855 | [ALC1200_ASUS_P5Q] = "asus-p5q", | |
9856 | [ALC889A_MB31] = "mb31", | |
9857 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", | |
9858 | [ALC882_AUTO] = "auto", | |
9859 | }; | |
9860 | ||
9861 | static struct snd_pci_quirk alc882_cfg_tbl[] = { | |
9862 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | |
9863 | ||
9864 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), | |
9865 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), | |
9866 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), | |
9867 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), | |
9868 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | |
9869 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), | |
9870 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", | |
9871 | ALC888_ACER_ASPIRE_4930G), | |
9872 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", | |
9873 | ALC888_ACER_ASPIRE_4930G), | |
9874 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", | |
9875 | ALC888_ACER_ASPIRE_8930G), | |
9876 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", | |
9877 | ALC888_ACER_ASPIRE_8930G), | |
9878 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), | |
9879 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), | |
9880 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | |
9881 | ALC888_ACER_ASPIRE_6530G), | |
9882 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | |
9883 | ALC888_ACER_ASPIRE_6530G), | |
9884 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", | |
9885 | ALC888_ACER_ASPIRE_7730G), | |
9886 | /* default Acer -- disabled as it causes more problems. | |
9887 | * model=auto should work fine now | |
9888 | */ | |
9889 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ | |
9890 | ||
9891 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), | |
9892 | ||
9893 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), | |
9894 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), | |
9895 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | |
9896 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), | |
9897 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), | |
9898 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), | |
9899 | ||
9900 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), | |
9901 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), | |
9902 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), | |
9903 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), | |
9904 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), | |
9905 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), | |
9906 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), | |
9907 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | |
9908 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), | |
9909 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), | |
9910 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), | |
9911 | ||
9912 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), | |
9913 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), | |
9914 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), | |
9915 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), | |
9916 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), | |
9917 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | |
9918 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), | |
9919 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), | |
9920 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), | |
9921 | ||
9922 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), | |
9923 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), | |
9924 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | |
9925 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ | |
9926 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), | |
9927 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | |
9928 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), | |
9929 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), | |
9930 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), | |
9931 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), | |
9932 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), | |
9933 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | |
9934 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), | |
9935 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), | |
9936 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), | |
9937 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), | |
9938 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | |
9939 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | |
9940 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), | |
9941 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), | |
9942 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), | |
9943 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | |
9944 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | |
9945 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), | |
9946 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), | |
9947 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), | |
9948 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | |
9949 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), | |
9950 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), | |
9951 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), | |
9952 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), | |
9953 | ||
9954 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), | |
9955 | SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), | |
9956 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), | |
9957 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | |
9958 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), | |
9959 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), | |
9960 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | |
9961 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ | |
9962 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | |
9963 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", | |
9964 | ALC883_FUJITSU_PI2515), | |
9965 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", | |
9966 | ALC888_FUJITSU_XA3530), | |
9967 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), | |
9968 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
9969 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
9970 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
9971 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), | |
9972 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), | |
9973 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), | |
9974 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | |
9975 | ||
9976 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), | |
9977 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | |
9978 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), | |
9979 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), | |
9980 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), | |
9981 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), | |
9982 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), | |
9983 | ||
9984 | {} | |
9985 | }; | |
9986 | ||
9987 | /* codec SSID table for Intel Mac */ | |
9988 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | |
9989 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), | |
9990 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), | |
9991 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), | |
9992 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), | |
9993 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), | |
9994 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), | |
9995 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), | |
9996 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), | |
9997 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), | |
9998 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), | |
9999 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), | |
10000 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), | |
10001 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | |
10002 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | |
10003 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), | |
10004 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), | |
10005 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), | |
10006 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, | |
10007 | * so apparently no perfect solution yet | |
10008 | */ | |
10009 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), | |
10010 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), | |
10011 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), | |
10012 | {} /* terminator */ | |
10013 | }; | |
10014 | ||
10015 | static struct alc_config_preset alc882_presets[] = { | |
10016 | [ALC882_3ST_DIG] = { | |
10017 | .mixers = { alc882_base_mixer }, | |
10018 | .init_verbs = { alc882_base_init_verbs, | |
10019 | alc882_adc1_init_verbs }, | |
10020 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10021 | .dac_nids = alc882_dac_nids, | |
10022 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10023 | .dig_in_nid = ALC882_DIGIN_NID, | |
10024 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
10025 | .channel_mode = alc882_ch_modes, | |
10026 | .need_dac_fix = 1, | |
10027 | .input_mux = &alc882_capture_source, | |
10028 | }, | |
10029 | [ALC882_6ST_DIG] = { | |
10030 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
10031 | .init_verbs = { alc882_base_init_verbs, | |
10032 | alc882_adc1_init_verbs }, | |
10033 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10034 | .dac_nids = alc882_dac_nids, | |
10035 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10036 | .dig_in_nid = ALC882_DIGIN_NID, | |
10037 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
10038 | .channel_mode = alc882_sixstack_modes, | |
10039 | .input_mux = &alc882_capture_source, | |
10040 | }, | |
10041 | [ALC882_ARIMA] = { | |
10042 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
10043 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
10044 | alc882_eapd_verbs }, | |
10045 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10046 | .dac_nids = alc882_dac_nids, | |
10047 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
10048 | .channel_mode = alc882_sixstack_modes, | |
10049 | .input_mux = &alc882_capture_source, | |
10050 | }, | |
10051 | [ALC882_W2JC] = { | |
10052 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | |
10053 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
10054 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, | |
10055 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10056 | .dac_nids = alc882_dac_nids, | |
10057 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
10058 | .channel_mode = alc880_threestack_modes, | |
10059 | .need_dac_fix = 1, | |
10060 | .input_mux = &alc882_capture_source, | |
10061 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10062 | }, | |
10063 | [ALC885_MBA21] = { | |
10064 | .mixers = { alc885_mba21_mixer }, | |
10065 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, | |
10066 | .num_dacs = 2, | |
10067 | .dac_nids = alc882_dac_nids, | |
10068 | .channel_mode = alc885_mba21_ch_modes, | |
10069 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), | |
10070 | .input_mux = &alc882_capture_source, | |
10071 | .unsol_event = alc_automute_amp_unsol_event, | |
10072 | .setup = alc885_mba21_setup, | |
10073 | .init_hook = alc_automute_amp, | |
10074 | }, | |
10075 | [ALC885_MBP3] = { | |
10076 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | |
10077 | .init_verbs = { alc885_mbp3_init_verbs, | |
10078 | alc880_gpio1_init_verbs }, | |
10079 | .num_dacs = 2, | |
10080 | .dac_nids = alc882_dac_nids, | |
10081 | .hp_nid = 0x04, | |
10082 | .channel_mode = alc885_mbp_4ch_modes, | |
10083 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | |
10084 | .input_mux = &alc882_capture_source, | |
10085 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10086 | .dig_in_nid = ALC882_DIGIN_NID, | |
10087 | .unsol_event = alc_automute_amp_unsol_event, | |
10088 | .setup = alc885_mbp3_setup, | |
10089 | .init_hook = alc_automute_amp, | |
10090 | }, | |
10091 | [ALC885_MB5] = { | |
10092 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, | |
10093 | .init_verbs = { alc885_mb5_init_verbs, | |
10094 | alc880_gpio1_init_verbs }, | |
10095 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10096 | .dac_nids = alc882_dac_nids, | |
10097 | .channel_mode = alc885_mb5_6ch_modes, | |
10098 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), | |
10099 | .input_mux = &mb5_capture_source, | |
10100 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10101 | .dig_in_nid = ALC882_DIGIN_NID, | |
10102 | .unsol_event = alc_automute_amp_unsol_event, | |
10103 | .setup = alc885_mb5_setup, | |
10104 | .init_hook = alc_automute_amp, | |
10105 | }, | |
10106 | [ALC885_MACMINI3] = { | |
10107 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, | |
10108 | .init_verbs = { alc885_macmini3_init_verbs, | |
10109 | alc880_gpio1_init_verbs }, | |
10110 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10111 | .dac_nids = alc882_dac_nids, | |
10112 | .channel_mode = alc885_macmini3_6ch_modes, | |
10113 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), | |
10114 | .input_mux = &macmini3_capture_source, | |
10115 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10116 | .dig_in_nid = ALC882_DIGIN_NID, | |
10117 | .unsol_event = alc_automute_amp_unsol_event, | |
10118 | .setup = alc885_macmini3_setup, | |
10119 | .init_hook = alc_automute_amp, | |
10120 | }, | |
10121 | [ALC885_MACPRO] = { | |
10122 | .mixers = { alc882_macpro_mixer }, | |
10123 | .init_verbs = { alc882_macpro_init_verbs }, | |
10124 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10125 | .dac_nids = alc882_dac_nids, | |
10126 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10127 | .dig_in_nid = ALC882_DIGIN_NID, | |
10128 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
10129 | .channel_mode = alc882_ch_modes, | |
10130 | .input_mux = &alc882_capture_source, | |
10131 | .init_hook = alc885_macpro_init_hook, | |
10132 | }, | |
10133 | [ALC885_IMAC24] = { | |
10134 | .mixers = { alc885_imac24_mixer }, | |
10135 | .init_verbs = { alc885_imac24_init_verbs }, | |
10136 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10137 | .dac_nids = alc882_dac_nids, | |
10138 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10139 | .dig_in_nid = ALC882_DIGIN_NID, | |
10140 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
10141 | .channel_mode = alc882_ch_modes, | |
10142 | .input_mux = &alc882_capture_source, | |
10143 | .unsol_event = alc_automute_amp_unsol_event, | |
10144 | .setup = alc885_imac24_setup, | |
10145 | .init_hook = alc885_imac24_init_hook, | |
10146 | }, | |
10147 | [ALC885_IMAC91] = { | |
10148 | .mixers = {alc885_imac91_mixer}, | |
10149 | .init_verbs = { alc885_imac91_init_verbs, | |
10150 | alc880_gpio1_init_verbs }, | |
10151 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10152 | .dac_nids = alc882_dac_nids, | |
10153 | .channel_mode = alc885_mba21_ch_modes, | |
10154 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), | |
10155 | .input_mux = &alc889A_imac91_capture_source, | |
10156 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10157 | .dig_in_nid = ALC882_DIGIN_NID, | |
10158 | .unsol_event = alc_automute_amp_unsol_event, | |
10159 | .setup = alc885_imac91_setup, | |
10160 | .init_hook = alc_automute_amp, | |
10161 | }, | |
10162 | [ALC882_TARGA] = { | |
10163 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | |
10164 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
10165 | alc880_gpio3_init_verbs, alc882_targa_verbs}, | |
10166 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10167 | .dac_nids = alc882_dac_nids, | |
10168 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10169 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
10170 | .adc_nids = alc882_adc_nids, | |
10171 | .capsrc_nids = alc882_capsrc_nids, | |
10172 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | |
10173 | .channel_mode = alc882_3ST_6ch_modes, | |
10174 | .need_dac_fix = 1, | |
10175 | .input_mux = &alc882_capture_source, | |
10176 | .unsol_event = alc882_targa_unsol_event, | |
10177 | .setup = alc882_targa_setup, | |
10178 | .init_hook = alc882_targa_automute, | |
10179 | }, | |
10180 | [ALC882_ASUS_A7J] = { | |
10181 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | |
10182 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
10183 | alc882_asus_a7j_verbs}, | |
10184 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10185 | .dac_nids = alc882_dac_nids, | |
10186 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10187 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
10188 | .adc_nids = alc882_adc_nids, | |
10189 | .capsrc_nids = alc882_capsrc_nids, | |
10190 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | |
10191 | .channel_mode = alc882_3ST_6ch_modes, | |
10192 | .need_dac_fix = 1, | |
10193 | .input_mux = &alc882_capture_source, | |
10194 | }, | |
10195 | [ALC882_ASUS_A7M] = { | |
10196 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | |
10197 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
10198 | alc882_eapd_verbs, alc880_gpio1_init_verbs, | |
10199 | alc882_asus_a7m_verbs }, | |
10200 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10201 | .dac_nids = alc882_dac_nids, | |
10202 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10203 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
10204 | .channel_mode = alc880_threestack_modes, | |
10205 | .need_dac_fix = 1, | |
10206 | .input_mux = &alc882_capture_source, | |
10207 | }, | |
10208 | [ALC883_3ST_2ch_DIG] = { | |
10209 | .mixers = { alc883_3ST_2ch_mixer }, | |
10210 | .init_verbs = { alc883_init_verbs }, | |
10211 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10212 | .dac_nids = alc883_dac_nids, | |
10213 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10214 | .dig_in_nid = ALC883_DIGIN_NID, | |
10215 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10216 | .channel_mode = alc883_3ST_2ch_modes, | |
10217 | .input_mux = &alc883_capture_source, | |
10218 | }, | |
10219 | [ALC883_3ST_6ch_DIG] = { | |
10220 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10221 | .init_verbs = { alc883_init_verbs }, | |
10222 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10223 | .dac_nids = alc883_dac_nids, | |
10224 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10225 | .dig_in_nid = ALC883_DIGIN_NID, | |
10226 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10227 | .channel_mode = alc883_3ST_6ch_modes, | |
10228 | .need_dac_fix = 1, | |
10229 | .input_mux = &alc883_capture_source, | |
10230 | }, | |
10231 | [ALC883_3ST_6ch] = { | |
10232 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10233 | .init_verbs = { alc883_init_verbs }, | |
10234 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10235 | .dac_nids = alc883_dac_nids, | |
10236 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10237 | .channel_mode = alc883_3ST_6ch_modes, | |
10238 | .need_dac_fix = 1, | |
10239 | .input_mux = &alc883_capture_source, | |
10240 | }, | |
10241 | [ALC883_3ST_6ch_INTEL] = { | |
10242 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, | |
10243 | .init_verbs = { alc883_init_verbs }, | |
10244 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10245 | .dac_nids = alc883_dac_nids, | |
10246 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10247 | .dig_in_nid = ALC883_DIGIN_NID, | |
10248 | .slave_dig_outs = alc883_slave_dig_outs, | |
10249 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), | |
10250 | .channel_mode = alc883_3ST_6ch_intel_modes, | |
10251 | .need_dac_fix = 1, | |
10252 | .input_mux = &alc883_3stack_6ch_intel, | |
10253 | }, | |
10254 | [ALC889A_INTEL] = { | |
10255 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | |
10256 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, | |
10257 | alc_hp15_unsol_verbs }, | |
10258 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10259 | .dac_nids = alc883_dac_nids, | |
10260 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
10261 | .adc_nids = alc889_adc_nids, | |
10262 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10263 | .dig_in_nid = ALC883_DIGIN_NID, | |
10264 | .slave_dig_outs = alc883_slave_dig_outs, | |
10265 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | |
10266 | .channel_mode = alc889_8ch_intel_modes, | |
10267 | .capsrc_nids = alc889_capsrc_nids, | |
10268 | .input_mux = &alc889_capture_source, | |
10269 | .setup = alc889_automute_setup, | |
10270 | .init_hook = alc_automute_amp, | |
10271 | .unsol_event = alc_automute_amp_unsol_event, | |
10272 | .need_dac_fix = 1, | |
10273 | }, | |
10274 | [ALC889_INTEL] = { | |
10275 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | |
10276 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, | |
10277 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, | |
10278 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10279 | .dac_nids = alc883_dac_nids, | |
10280 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
10281 | .adc_nids = alc889_adc_nids, | |
10282 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10283 | .dig_in_nid = ALC883_DIGIN_NID, | |
10284 | .slave_dig_outs = alc883_slave_dig_outs, | |
10285 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | |
10286 | .channel_mode = alc889_8ch_intel_modes, | |
10287 | .capsrc_nids = alc889_capsrc_nids, | |
10288 | .input_mux = &alc889_capture_source, | |
10289 | .setup = alc889_automute_setup, | |
10290 | .init_hook = alc889_intel_init_hook, | |
10291 | .unsol_event = alc_automute_amp_unsol_event, | |
10292 | .need_dac_fix = 1, | |
10293 | }, | |
10294 | [ALC883_6ST_DIG] = { | |
10295 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
10296 | .init_verbs = { alc883_init_verbs }, | |
10297 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10298 | .dac_nids = alc883_dac_nids, | |
10299 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10300 | .dig_in_nid = ALC883_DIGIN_NID, | |
10301 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10302 | .channel_mode = alc883_sixstack_modes, | |
10303 | .input_mux = &alc883_capture_source, | |
10304 | }, | |
10305 | [ALC883_TARGA_DIG] = { | |
10306 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, | |
10307 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | |
10308 | alc883_targa_verbs}, | |
10309 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10310 | .dac_nids = alc883_dac_nids, | |
10311 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10312 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10313 | .channel_mode = alc883_3ST_6ch_modes, | |
10314 | .need_dac_fix = 1, | |
10315 | .input_mux = &alc883_capture_source, | |
10316 | .unsol_event = alc883_targa_unsol_event, | |
10317 | .setup = alc882_targa_setup, | |
10318 | .init_hook = alc882_targa_automute, | |
10319 | }, | |
10320 | [ALC883_TARGA_2ch_DIG] = { | |
10321 | .mixers = { alc883_targa_2ch_mixer}, | |
10322 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | |
10323 | alc883_targa_verbs}, | |
10324 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10325 | .dac_nids = alc883_dac_nids, | |
10326 | .adc_nids = alc883_adc_nids_alt, | |
10327 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
10328 | .capsrc_nids = alc883_capsrc_nids, | |
10329 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10330 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10331 | .channel_mode = alc883_3ST_2ch_modes, | |
10332 | .input_mux = &alc883_capture_source, | |
10333 | .unsol_event = alc883_targa_unsol_event, | |
10334 | .setup = alc882_targa_setup, | |
10335 | .init_hook = alc882_targa_automute, | |
10336 | }, | |
10337 | [ALC883_TARGA_8ch_DIG] = { | |
10338 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, | |
10339 | alc883_chmode_mixer }, | |
10340 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | |
10341 | alc883_targa_verbs }, | |
10342 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10343 | .dac_nids = alc883_dac_nids, | |
10344 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10345 | .adc_nids = alc883_adc_nids_rev, | |
10346 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10347 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10348 | .dig_in_nid = ALC883_DIGIN_NID, | |
10349 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), | |
10350 | .channel_mode = alc883_4ST_8ch_modes, | |
10351 | .need_dac_fix = 1, | |
10352 | .input_mux = &alc883_capture_source, | |
10353 | .unsol_event = alc883_targa_unsol_event, | |
10354 | .setup = alc882_targa_setup, | |
10355 | .init_hook = alc882_targa_automute, | |
10356 | }, | |
10357 | [ALC883_ACER] = { | |
10358 | .mixers = { alc883_base_mixer }, | |
10359 | /* On TravelMate laptops, GPIO 0 enables the internal speaker | |
10360 | * and the headphone jack. Turn this on and rely on the | |
10361 | * standard mute methods whenever the user wants to turn | |
10362 | * these outputs off. | |
10363 | */ | |
10364 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | |
10365 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10366 | .dac_nids = alc883_dac_nids, | |
10367 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10368 | .channel_mode = alc883_3ST_2ch_modes, | |
10369 | .input_mux = &alc883_capture_source, | |
10370 | }, | |
10371 | [ALC883_ACER_ASPIRE] = { | |
10372 | .mixers = { alc883_acer_aspire_mixer }, | |
10373 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, | |
10374 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10375 | .dac_nids = alc883_dac_nids, | |
10376 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10377 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10378 | .channel_mode = alc883_3ST_2ch_modes, | |
10379 | .input_mux = &alc883_capture_source, | |
10380 | .unsol_event = alc_automute_amp_unsol_event, | |
10381 | .setup = alc883_acer_aspire_setup, | |
10382 | .init_hook = alc_automute_amp, | |
10383 | }, | |
10384 | [ALC888_ACER_ASPIRE_4930G] = { | |
10385 | .mixers = { alc888_acer_aspire_4930g_mixer, | |
10386 | alc883_chmode_mixer }, | |
10387 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10388 | alc888_acer_aspire_4930g_verbs }, | |
10389 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10390 | .dac_nids = alc883_dac_nids, | |
10391 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10392 | .adc_nids = alc883_adc_nids_rev, | |
10393 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10394 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10395 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10396 | .channel_mode = alc883_3ST_6ch_modes, | |
10397 | .need_dac_fix = 1, | |
10398 | .const_channel_count = 6, | |
10399 | .num_mux_defs = | |
10400 | ARRAY_SIZE(alc888_2_capture_sources), | |
10401 | .input_mux = alc888_2_capture_sources, | |
10402 | .unsol_event = alc_automute_amp_unsol_event, | |
10403 | .setup = alc888_acer_aspire_4930g_setup, | |
10404 | .init_hook = alc_automute_amp, | |
10405 | }, | |
10406 | [ALC888_ACER_ASPIRE_6530G] = { | |
10407 | .mixers = { alc888_acer_aspire_6530_mixer }, | |
10408 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10409 | alc888_acer_aspire_6530g_verbs }, | |
10410 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10411 | .dac_nids = alc883_dac_nids, | |
10412 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10413 | .adc_nids = alc883_adc_nids_rev, | |
10414 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10415 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10416 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10417 | .channel_mode = alc883_3ST_2ch_modes, | |
10418 | .num_mux_defs = | |
10419 | ARRAY_SIZE(alc888_2_capture_sources), | |
10420 | .input_mux = alc888_acer_aspire_6530_sources, | |
10421 | .unsol_event = alc_automute_amp_unsol_event, | |
10422 | .setup = alc888_acer_aspire_6530g_setup, | |
10423 | .init_hook = alc_automute_amp, | |
10424 | }, | |
10425 | [ALC888_ACER_ASPIRE_8930G] = { | |
10426 | .mixers = { alc889_acer_aspire_8930g_mixer, | |
10427 | alc883_chmode_mixer }, | |
10428 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10429 | alc889_acer_aspire_8930g_verbs, | |
10430 | alc889_eapd_verbs}, | |
10431 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10432 | .dac_nids = alc883_dac_nids, | |
10433 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
10434 | .adc_nids = alc889_adc_nids, | |
10435 | .capsrc_nids = alc889_capsrc_nids, | |
10436 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10437 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10438 | .channel_mode = alc883_3ST_6ch_modes, | |
10439 | .need_dac_fix = 1, | |
10440 | .const_channel_count = 6, | |
10441 | .num_mux_defs = | |
10442 | ARRAY_SIZE(alc889_capture_sources), | |
10443 | .input_mux = alc889_capture_sources, | |
10444 | .unsol_event = alc_automute_amp_unsol_event, | |
10445 | .setup = alc889_acer_aspire_8930g_setup, | |
10446 | .init_hook = alc_automute_amp, | |
10447 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
10448 | .power_hook = alc_power_eapd, | |
10449 | #endif | |
10450 | }, | |
10451 | [ALC888_ACER_ASPIRE_7730G] = { | |
10452 | .mixers = { alc883_3ST_6ch_mixer, | |
10453 | alc883_chmode_mixer }, | |
10454 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10455 | alc888_acer_aspire_7730G_verbs }, | |
10456 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10457 | .dac_nids = alc883_dac_nids, | |
10458 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10459 | .adc_nids = alc883_adc_nids_rev, | |
10460 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10461 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10462 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10463 | .channel_mode = alc883_3ST_6ch_modes, | |
10464 | .need_dac_fix = 1, | |
10465 | .const_channel_count = 6, | |
10466 | .input_mux = &alc883_capture_source, | |
10467 | .unsol_event = alc_automute_amp_unsol_event, | |
10468 | .setup = alc888_acer_aspire_7730g_setup, | |
10469 | .init_hook = alc_automute_amp, | |
10470 | }, | |
10471 | [ALC883_MEDION] = { | |
10472 | .mixers = { alc883_fivestack_mixer, | |
10473 | alc883_chmode_mixer }, | |
10474 | .init_verbs = { alc883_init_verbs, | |
10475 | alc883_medion_eapd_verbs }, | |
10476 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10477 | .dac_nids = alc883_dac_nids, | |
10478 | .adc_nids = alc883_adc_nids_alt, | |
10479 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
10480 | .capsrc_nids = alc883_capsrc_nids, | |
10481 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10482 | .channel_mode = alc883_sixstack_modes, | |
10483 | .input_mux = &alc883_capture_source, | |
10484 | }, | |
10485 | [ALC883_MEDION_WIM2160] = { | |
10486 | .mixers = { alc883_medion_wim2160_mixer }, | |
10487 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, | |
10488 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10489 | .dac_nids = alc883_dac_nids, | |
10490 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10491 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
10492 | .adc_nids = alc883_adc_nids, | |
10493 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10494 | .channel_mode = alc883_3ST_2ch_modes, | |
10495 | .input_mux = &alc883_capture_source, | |
10496 | .unsol_event = alc_automute_amp_unsol_event, | |
10497 | .setup = alc883_medion_wim2160_setup, | |
10498 | .init_hook = alc_automute_amp, | |
10499 | }, | |
10500 | [ALC883_LAPTOP_EAPD] = { | |
10501 | .mixers = { alc883_base_mixer }, | |
10502 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, | |
10503 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10504 | .dac_nids = alc883_dac_nids, | |
10505 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10506 | .channel_mode = alc883_3ST_2ch_modes, | |
10507 | .input_mux = &alc883_capture_source, | |
10508 | }, | |
10509 | [ALC883_CLEVO_M540R] = { | |
10510 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10511 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, | |
10512 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10513 | .dac_nids = alc883_dac_nids, | |
10514 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10515 | .dig_in_nid = ALC883_DIGIN_NID, | |
10516 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), | |
10517 | .channel_mode = alc883_3ST_6ch_clevo_modes, | |
10518 | .need_dac_fix = 1, | |
10519 | .input_mux = &alc883_capture_source, | |
10520 | /* This machine has the hardware HP auto-muting, thus | |
10521 | * we need no software mute via unsol event | |
10522 | */ | |
10523 | }, | |
10524 | [ALC883_CLEVO_M720] = { | |
10525 | .mixers = { alc883_clevo_m720_mixer }, | |
10526 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | |
10527 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10528 | .dac_nids = alc883_dac_nids, | |
10529 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10530 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10531 | .channel_mode = alc883_3ST_2ch_modes, | |
10532 | .input_mux = &alc883_capture_source, | |
10533 | .unsol_event = alc883_clevo_m720_unsol_event, | |
10534 | .setup = alc883_clevo_m720_setup, | |
10535 | .init_hook = alc883_clevo_m720_init_hook, | |
10536 | }, | |
10537 | [ALC883_LENOVO_101E_2ch] = { | |
10538 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | |
10539 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | |
10540 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10541 | .dac_nids = alc883_dac_nids, | |
10542 | .adc_nids = alc883_adc_nids_alt, | |
10543 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
10544 | .capsrc_nids = alc883_capsrc_nids, | |
10545 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10546 | .channel_mode = alc883_3ST_2ch_modes, | |
10547 | .input_mux = &alc883_lenovo_101e_capture_source, | |
10548 | .unsol_event = alc883_lenovo_101e_unsol_event, | |
10549 | .init_hook = alc883_lenovo_101e_all_automute, | |
10550 | }, | |
10551 | [ALC883_LENOVO_NB0763] = { | |
10552 | .mixers = { alc883_lenovo_nb0763_mixer }, | |
10553 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | |
10554 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10555 | .dac_nids = alc883_dac_nids, | |
10556 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10557 | .channel_mode = alc883_3ST_2ch_modes, | |
10558 | .need_dac_fix = 1, | |
10559 | .input_mux = &alc883_lenovo_nb0763_capture_source, | |
10560 | .unsol_event = alc_automute_amp_unsol_event, | |
10561 | .setup = alc883_lenovo_nb0763_setup, | |
10562 | .init_hook = alc_automute_amp, | |
10563 | }, | |
10564 | [ALC888_LENOVO_MS7195_DIG] = { | |
10565 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10566 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, | |
10567 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10568 | .dac_nids = alc883_dac_nids, | |
10569 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10570 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10571 | .channel_mode = alc883_3ST_6ch_modes, | |
10572 | .need_dac_fix = 1, | |
10573 | .input_mux = &alc883_capture_source, | |
10574 | .unsol_event = alc883_lenovo_ms7195_unsol_event, | |
10575 | .init_hook = alc888_lenovo_ms7195_front_automute, | |
10576 | }, | |
10577 | [ALC883_HAIER_W66] = { | |
10578 | .mixers = { alc883_targa_2ch_mixer}, | |
10579 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, | |
10580 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10581 | .dac_nids = alc883_dac_nids, | |
10582 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10583 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10584 | .channel_mode = alc883_3ST_2ch_modes, | |
10585 | .input_mux = &alc883_capture_source, | |
10586 | .unsol_event = alc_automute_amp_unsol_event, | |
10587 | .setup = alc883_haier_w66_setup, | |
10588 | .init_hook = alc_automute_amp, | |
10589 | }, | |
10590 | [ALC888_3ST_HP] = { | |
10591 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10592 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, | |
10593 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10594 | .dac_nids = alc883_dac_nids, | |
10595 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), | |
10596 | .channel_mode = alc888_3st_hp_modes, | |
10597 | .need_dac_fix = 1, | |
10598 | .input_mux = &alc883_capture_source, | |
10599 | .unsol_event = alc_automute_amp_unsol_event, | |
10600 | .setup = alc888_3st_hp_setup, | |
10601 | .init_hook = alc_automute_amp, | |
10602 | }, | |
10603 | [ALC888_6ST_DELL] = { | |
10604 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
10605 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, | |
10606 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10607 | .dac_nids = alc883_dac_nids, | |
10608 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10609 | .dig_in_nid = ALC883_DIGIN_NID, | |
10610 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10611 | .channel_mode = alc883_sixstack_modes, | |
10612 | .input_mux = &alc883_capture_source, | |
10613 | .unsol_event = alc_automute_amp_unsol_event, | |
10614 | .setup = alc888_6st_dell_setup, | |
10615 | .init_hook = alc_automute_amp, | |
10616 | }, | |
10617 | [ALC883_MITAC] = { | |
10618 | .mixers = { alc883_mitac_mixer }, | |
10619 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | |
10620 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10621 | .dac_nids = alc883_dac_nids, | |
10622 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10623 | .channel_mode = alc883_3ST_2ch_modes, | |
10624 | .input_mux = &alc883_capture_source, | |
10625 | .unsol_event = alc_automute_amp_unsol_event, | |
10626 | .setup = alc883_mitac_setup, | |
10627 | .init_hook = alc_automute_amp, | |
10628 | }, | |
10629 | [ALC883_FUJITSU_PI2515] = { | |
10630 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | |
10631 | .init_verbs = { alc883_init_verbs, | |
10632 | alc883_2ch_fujitsu_pi2515_verbs}, | |
10633 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10634 | .dac_nids = alc883_dac_nids, | |
10635 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10636 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10637 | .channel_mode = alc883_3ST_2ch_modes, | |
10638 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
10639 | .unsol_event = alc_automute_amp_unsol_event, | |
10640 | .setup = alc883_2ch_fujitsu_pi2515_setup, | |
10641 | .init_hook = alc_automute_amp, | |
10642 | }, | |
10643 | [ALC888_FUJITSU_XA3530] = { | |
10644 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, | |
10645 | .init_verbs = { alc883_init_verbs, | |
10646 | alc888_fujitsu_xa3530_verbs }, | |
10647 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10648 | .dac_nids = alc883_dac_nids, | |
10649 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10650 | .adc_nids = alc883_adc_nids_rev, | |
10651 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10652 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10653 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), | |
10654 | .channel_mode = alc888_4ST_8ch_intel_modes, | |
10655 | .num_mux_defs = | |
10656 | ARRAY_SIZE(alc888_2_capture_sources), | |
10657 | .input_mux = alc888_2_capture_sources, | |
10658 | .unsol_event = alc_automute_amp_unsol_event, | |
10659 | .setup = alc888_fujitsu_xa3530_setup, | |
10660 | .init_hook = alc_automute_amp, | |
10661 | }, | |
10662 | [ALC888_LENOVO_SKY] = { | |
10663 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | |
10664 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, | |
10665 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10666 | .dac_nids = alc883_dac_nids, | |
10667 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10668 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10669 | .channel_mode = alc883_sixstack_modes, | |
10670 | .need_dac_fix = 1, | |
10671 | .input_mux = &alc883_lenovo_sky_capture_source, | |
10672 | .unsol_event = alc_automute_amp_unsol_event, | |
10673 | .setup = alc888_lenovo_sky_setup, | |
10674 | .init_hook = alc_automute_amp, | |
10675 | }, | |
10676 | [ALC888_ASUS_M90V] = { | |
10677 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10678 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, | |
10679 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10680 | .dac_nids = alc883_dac_nids, | |
10681 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10682 | .dig_in_nid = ALC883_DIGIN_NID, | |
10683 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10684 | .channel_mode = alc883_3ST_6ch_modes, | |
10685 | .need_dac_fix = 1, | |
10686 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
10687 | .unsol_event = alc_sku_unsol_event, | |
10688 | .setup = alc883_mode2_setup, | |
10689 | .init_hook = alc_inithook, | |
10690 | }, | |
10691 | [ALC888_ASUS_EEE1601] = { | |
10692 | .mixers = { alc883_asus_eee1601_mixer }, | |
10693 | .cap_mixer = alc883_asus_eee1601_cap_mixer, | |
10694 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, | |
10695 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10696 | .dac_nids = alc883_dac_nids, | |
10697 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10698 | .dig_in_nid = ALC883_DIGIN_NID, | |
10699 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10700 | .channel_mode = alc883_3ST_2ch_modes, | |
10701 | .need_dac_fix = 1, | |
10702 | .input_mux = &alc883_asus_eee1601_capture_source, | |
10703 | .unsol_event = alc_sku_unsol_event, | |
10704 | .init_hook = alc883_eee1601_inithook, | |
10705 | }, | |
10706 | [ALC1200_ASUS_P5Q] = { | |
10707 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
10708 | .init_verbs = { alc883_init_verbs }, | |
10709 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10710 | .dac_nids = alc883_dac_nids, | |
10711 | .dig_out_nid = ALC1200_DIGOUT_NID, | |
10712 | .dig_in_nid = ALC883_DIGIN_NID, | |
10713 | .slave_dig_outs = alc1200_slave_dig_outs, | |
10714 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10715 | .channel_mode = alc883_sixstack_modes, | |
10716 | .input_mux = &alc883_capture_source, | |
10717 | }, | |
10718 | [ALC889A_MB31] = { | |
10719 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, | |
10720 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, | |
10721 | alc880_gpio1_init_verbs }, | |
10722 | .adc_nids = alc883_adc_nids, | |
10723 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
10724 | .capsrc_nids = alc883_capsrc_nids, | |
10725 | .dac_nids = alc883_dac_nids, | |
10726 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10727 | .channel_mode = alc889A_mb31_6ch_modes, | |
10728 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), | |
10729 | .input_mux = &alc889A_mb31_capture_source, | |
10730 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10731 | .unsol_event = alc889A_mb31_unsol_event, | |
10732 | .init_hook = alc889A_mb31_automute, | |
10733 | }, | |
10734 | [ALC883_SONY_VAIO_TT] = { | |
10735 | .mixers = { alc883_vaiott_mixer }, | |
10736 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, | |
10737 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10738 | .dac_nids = alc883_dac_nids, | |
10739 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10740 | .channel_mode = alc883_3ST_2ch_modes, | |
10741 | .input_mux = &alc883_capture_source, | |
10742 | .unsol_event = alc_automute_amp_unsol_event, | |
10743 | .setup = alc883_vaiott_setup, | |
10744 | .init_hook = alc_automute_amp, | |
10745 | }, | |
10746 | }; | |
10747 | ||
10748 | ||
10749 | /* | |
10750 | * Pin config fixes | |
10751 | */ | |
10752 | enum { | |
10753 | PINFIX_ABIT_AW9D_MAX, | |
10754 | PINFIX_PB_M5210, | |
10755 | PINFIX_ACER_ASPIRE_7736, | |
10756 | }; | |
10757 | ||
10758 | static const struct alc_fixup alc882_fixups[] = { | |
10759 | [PINFIX_ABIT_AW9D_MAX] = { | |
10760 | .type = ALC_FIXUP_PINS, | |
10761 | .v.pins = (const struct alc_pincfg[]) { | |
10762 | { 0x15, 0x01080104 }, /* side */ | |
10763 | { 0x16, 0x01011012 }, /* rear */ | |
10764 | { 0x17, 0x01016011 }, /* clfe */ | |
10765 | { } | |
10766 | } | |
10767 | }, | |
10768 | [PINFIX_PB_M5210] = { | |
10769 | .type = ALC_FIXUP_VERBS, | |
10770 | .v.verbs = (const struct hda_verb[]) { | |
10771 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, | |
10772 | {} | |
10773 | } | |
10774 | }, | |
10775 | [PINFIX_ACER_ASPIRE_7736] = { | |
10776 | .type = ALC_FIXUP_SKU, | |
10777 | .v.sku = ALC_FIXUP_SKU_IGNORE, | |
10778 | }, | |
10779 | }; | |
10780 | ||
10781 | static struct snd_pci_quirk alc882_fixup_tbl[] = { | |
10782 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), | |
10783 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | |
10784 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), | |
10785 | {} | |
10786 | }; | |
10787 | ||
10788 | /* | |
10789 | * BIOS auto configuration | |
10790 | */ | |
10791 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, | |
10792 | const struct auto_pin_cfg *cfg) | |
10793 | { | |
10794 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); | |
10795 | } | |
10796 | ||
10797 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | |
10798 | hda_nid_t nid, int pin_type, | |
10799 | hda_nid_t dac) | |
10800 | { | |
10801 | int idx; | |
10802 | ||
10803 | /* set as output */ | |
10804 | alc_set_pin_output(codec, nid, pin_type); | |
10805 | ||
10806 | if (dac == 0x25) | |
10807 | idx = 4; | |
10808 | else if (dac >= 0x02 && dac <= 0x05) | |
10809 | idx = dac - 2; | |
10810 | else | |
10811 | return; | |
10812 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | |
10813 | } | |
10814 | ||
10815 | static void alc882_auto_init_multi_out(struct hda_codec *codec) | |
10816 | { | |
10817 | struct alc_spec *spec = codec->spec; | |
10818 | int i; | |
10819 | ||
10820 | for (i = 0; i <= HDA_SIDE; i++) { | |
10821 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
10822 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
10823 | if (nid) | |
10824 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, | |
10825 | spec->multiout.dac_nids[i]); | |
10826 | } | |
10827 | } | |
10828 | ||
10829 | static void alc882_auto_init_hp_out(struct hda_codec *codec) | |
10830 | { | |
10831 | struct alc_spec *spec = codec->spec; | |
10832 | hda_nid_t pin, dac; | |
10833 | int i; | |
10834 | ||
10835 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { | |
10836 | pin = spec->autocfg.hp_pins[i]; | |
10837 | if (!pin) | |
10838 | break; | |
10839 | dac = spec->multiout.hp_nid; | |
10840 | if (!dac) | |
10841 | dac = spec->multiout.dac_nids[0]; /* to front */ | |
10842 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); | |
10843 | } | |
10844 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { | |
10845 | pin = spec->autocfg.speaker_pins[i]; | |
10846 | if (!pin) | |
10847 | break; | |
10848 | dac = spec->multiout.extra_out_nid[0]; | |
10849 | if (!dac) | |
10850 | dac = spec->multiout.dac_nids[0]; /* to front */ | |
10851 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); | |
10852 | } | |
10853 | } | |
10854 | ||
10855 | static void alc882_auto_init_analog_input(struct hda_codec *codec) | |
10856 | { | |
10857 | struct alc_spec *spec = codec->spec; | |
10858 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
10859 | int i; | |
10860 | ||
10861 | for (i = 0; i < cfg->num_inputs; i++) { | |
10862 | hda_nid_t nid = cfg->inputs[i].pin; | |
10863 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); | |
10864 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) | |
10865 | snd_hda_codec_write(codec, nid, 0, | |
10866 | AC_VERB_SET_AMP_GAIN_MUTE, | |
10867 | AMP_OUT_MUTE); | |
10868 | } | |
10869 | } | |
10870 | ||
10871 | static void alc882_auto_init_input_src(struct hda_codec *codec) | |
10872 | { | |
10873 | struct alc_spec *spec = codec->spec; | |
10874 | int c; | |
10875 | ||
10876 | for (c = 0; c < spec->num_adc_nids; c++) { | |
10877 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | |
10878 | hda_nid_t nid = spec->capsrc_nids[c]; | |
10879 | unsigned int mux_idx; | |
10880 | const struct hda_input_mux *imux; | |
10881 | int conns, mute, idx, item; | |
10882 | ||
10883 | conns = snd_hda_get_connections(codec, nid, conn_list, | |
10884 | ARRAY_SIZE(conn_list)); | |
10885 | if (conns < 0) | |
10886 | continue; | |
10887 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | |
10888 | imux = &spec->input_mux[mux_idx]; | |
10889 | if (!imux->num_items && mux_idx > 0) | |
10890 | imux = &spec->input_mux[0]; | |
10891 | for (idx = 0; idx < conns; idx++) { | |
10892 | /* if the current connection is the selected one, | |
10893 | * unmute it as default - otherwise mute it | |
10894 | */ | |
10895 | mute = AMP_IN_MUTE(idx); | |
10896 | for (item = 0; item < imux->num_items; item++) { | |
10897 | if (imux->items[item].index == idx) { | |
10898 | if (spec->cur_mux[c] == item) | |
10899 | mute = AMP_IN_UNMUTE(idx); | |
10900 | break; | |
10901 | } | |
10902 | } | |
10903 | /* check if we have a selector or mixer | |
10904 | * we could check for the widget type instead, but | |
10905 | * just check for Amp-In presence (in case of mixer | |
10906 | * without amp-in there is something wrong, this | |
10907 | * function shouldn't be used or capsrc nid is wrong) | |
10908 | */ | |
10909 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | |
10910 | snd_hda_codec_write(codec, nid, 0, | |
10911 | AC_VERB_SET_AMP_GAIN_MUTE, | |
10912 | mute); | |
10913 | else if (mute != AMP_IN_MUTE(idx)) | |
10914 | snd_hda_codec_write(codec, nid, 0, | |
10915 | AC_VERB_SET_CONNECT_SEL, | |
10916 | idx); | |
10917 | } | |
10918 | } | |
10919 | } | |
10920 | ||
10921 | /* add mic boosts if needed */ | |
10922 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | |
10923 | { | |
10924 | struct alc_spec *spec = codec->spec; | |
10925 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
10926 | int i, err; | |
10927 | int type_idx = 0; | |
10928 | hda_nid_t nid; | |
10929 | const char *prev_label = NULL; | |
10930 | ||
10931 | for (i = 0; i < cfg->num_inputs; i++) { | |
10932 | if (cfg->inputs[i].type > AUTO_PIN_MIC) | |
10933 | break; | |
10934 | nid = cfg->inputs[i].pin; | |
10935 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { | |
10936 | const char *label; | |
10937 | char boost_label[32]; | |
10938 | ||
10939 | label = hda_get_autocfg_input_label(codec, cfg, i); | |
10940 | if (prev_label && !strcmp(label, prev_label)) | |
10941 | type_idx++; | |
10942 | else | |
10943 | type_idx = 0; | |
10944 | prev_label = label; | |
10945 | ||
10946 | snprintf(boost_label, sizeof(boost_label), | |
10947 | "%s Boost Volume", label); | |
10948 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
10949 | boost_label, type_idx, | |
10950 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
10951 | if (err < 0) | |
10952 | return err; | |
10953 | } | |
10954 | } | |
10955 | return 0; | |
10956 | } | |
10957 | ||
10958 | /* almost identical with ALC880 parser... */ | |
10959 | static int alc882_parse_auto_config(struct hda_codec *codec) | |
10960 | { | |
10961 | struct alc_spec *spec = codec->spec; | |
10962 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; | |
10963 | int err; | |
10964 | ||
10965 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
10966 | alc882_ignore); | |
10967 | if (err < 0) | |
10968 | return err; | |
10969 | if (!spec->autocfg.line_outs) | |
10970 | return 0; /* can't find valid BIOS pin config */ | |
10971 | ||
10972 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | |
10973 | if (err < 0) | |
10974 | return err; | |
10975 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
10976 | if (err < 0) | |
10977 | return err; | |
10978 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
10979 | "Headphone"); | |
10980 | if (err < 0) | |
10981 | return err; | |
10982 | err = alc880_auto_create_extra_out(spec, | |
10983 | spec->autocfg.speaker_pins[0], | |
10984 | "Speaker"); | |
10985 | if (err < 0) | |
10986 | return err; | |
10987 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); | |
10988 | if (err < 0) | |
10989 | return err; | |
10990 | ||
10991 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
10992 | ||
10993 | alc_auto_parse_digital(codec); | |
10994 | ||
10995 | if (spec->kctls.list) | |
10996 | add_mixer(spec, spec->kctls.list); | |
10997 | ||
10998 | add_verb(spec, alc883_auto_init_verbs); | |
10999 | /* if ADC 0x07 is available, initialize it, too */ | |
11000 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) | |
11001 | add_verb(spec, alc882_adc1_init_verbs); | |
11002 | ||
11003 | spec->num_mux_defs = 1; | |
11004 | spec->input_mux = &spec->private_imux[0]; | |
11005 | ||
11006 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
11007 | ||
11008 | err = alc_auto_add_mic_boost(codec); | |
11009 | if (err < 0) | |
11010 | return err; | |
11011 | ||
11012 | return 1; /* config found */ | |
11013 | } | |
11014 | ||
11015 | /* additional initialization for auto-configuration model */ | |
11016 | static void alc882_auto_init(struct hda_codec *codec) | |
11017 | { | |
11018 | struct alc_spec *spec = codec->spec; | |
11019 | alc882_auto_init_multi_out(codec); | |
11020 | alc882_auto_init_hp_out(codec); | |
11021 | alc882_auto_init_analog_input(codec); | |
11022 | alc882_auto_init_input_src(codec); | |
11023 | alc_auto_init_digital(codec); | |
11024 | if (spec->unsol_event) | |
11025 | alc_inithook(codec); | |
11026 | } | |
11027 | ||
11028 | static int patch_alc882(struct hda_codec *codec) | |
11029 | { | |
11030 | struct alc_spec *spec; | |
11031 | int err, board_config; | |
11032 | ||
11033 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
11034 | if (spec == NULL) | |
11035 | return -ENOMEM; | |
11036 | ||
11037 | codec->spec = spec; | |
11038 | ||
11039 | switch (codec->vendor_id) { | |
11040 | case 0x10ec0882: | |
11041 | case 0x10ec0885: | |
11042 | break; | |
11043 | default: | |
11044 | /* ALC883 and variants */ | |
11045 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | |
11046 | break; | |
11047 | } | |
11048 | ||
11049 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, | |
11050 | alc882_models, | |
11051 | alc882_cfg_tbl); | |
11052 | ||
11053 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) | |
11054 | board_config = snd_hda_check_board_codec_sid_config(codec, | |
11055 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); | |
11056 | ||
11057 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | |
11058 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
11059 | codec->chip_name); | |
11060 | board_config = ALC882_AUTO; | |
11061 | } | |
11062 | ||
11063 | if (board_config == ALC882_AUTO) { | |
11064 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); | |
11065 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | |
11066 | } | |
11067 | ||
11068 | alc_auto_parse_customize_define(codec); | |
11069 | ||
11070 | if (board_config == ALC882_AUTO) { | |
11071 | /* automatic parse from the BIOS config */ | |
11072 | err = alc882_parse_auto_config(codec); | |
11073 | if (err < 0) { | |
11074 | alc_free(codec); | |
11075 | return err; | |
11076 | } else if (!err) { | |
11077 | printk(KERN_INFO | |
11078 | "hda_codec: Cannot set up configuration " | |
11079 | "from BIOS. Using base mode...\n"); | |
11080 | board_config = ALC882_3ST_DIG; | |
11081 | } | |
11082 | } | |
11083 | ||
11084 | if (has_cdefine_beep(codec)) { | |
11085 | err = snd_hda_attach_beep_device(codec, 0x1); | |
11086 | if (err < 0) { | |
11087 | alc_free(codec); | |
11088 | return err; | |
11089 | } | |
11090 | } | |
11091 | ||
11092 | if (board_config != ALC882_AUTO) | |
11093 | setup_preset(codec, &alc882_presets[board_config]); | |
11094 | ||
11095 | spec->stream_analog_playback = &alc882_pcm_analog_playback; | |
11096 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | |
11097 | /* FIXME: setup DAC5 */ | |
11098 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ | |
11099 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | |
11100 | ||
11101 | spec->stream_digital_playback = &alc882_pcm_digital_playback; | |
11102 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | |
11103 | ||
11104 | if (!spec->adc_nids && spec->input_mux) { | |
11105 | int i, j; | |
11106 | spec->num_adc_nids = 0; | |
11107 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { | |
11108 | const struct hda_input_mux *imux = spec->input_mux; | |
11109 | hda_nid_t cap; | |
11110 | hda_nid_t items[16]; | |
11111 | hda_nid_t nid = alc882_adc_nids[i]; | |
11112 | unsigned int wcap = get_wcaps(codec, nid); | |
11113 | /* get type */ | |
11114 | wcap = get_wcaps_type(wcap); | |
11115 | if (wcap != AC_WID_AUD_IN) | |
11116 | continue; | |
11117 | spec->private_adc_nids[spec->num_adc_nids] = nid; | |
11118 | err = snd_hda_get_connections(codec, nid, &cap, 1); | |
11119 | if (err < 0) | |
11120 | continue; | |
11121 | err = snd_hda_get_connections(codec, cap, items, | |
11122 | ARRAY_SIZE(items)); | |
11123 | if (err < 0) | |
11124 | continue; | |
11125 | for (j = 0; j < imux->num_items; j++) | |
11126 | if (imux->items[j].index >= err) | |
11127 | break; | |
11128 | if (j < imux->num_items) | |
11129 | continue; | |
11130 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; | |
11131 | spec->num_adc_nids++; | |
11132 | } | |
11133 | spec->adc_nids = spec->private_adc_nids; | |
11134 | spec->capsrc_nids = spec->private_capsrc_nids; | |
11135 | } | |
11136 | ||
11137 | set_capture_mixer(codec); | |
11138 | ||
11139 | if (has_cdefine_beep(codec)) | |
11140 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
11141 | ||
11142 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | |
11143 | ||
11144 | spec->vmaster_nid = 0x0c; | |
11145 | ||
11146 | codec->patch_ops = alc_patch_ops; | |
11147 | if (board_config == ALC882_AUTO) | |
11148 | spec->init_hook = alc882_auto_init; | |
11149 | ||
11150 | alc_init_jacks(codec); | |
11151 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
11152 | if (!spec->loopback.amplist) | |
11153 | spec->loopback.amplist = alc882_loopbacks; | |
11154 | #endif | |
11155 | ||
11156 | return 0; | |
11157 | } | |
11158 | ||
11159 | ||
11160 | /* | |
11161 | * ALC262 support | |
11162 | */ | |
11163 | ||
11164 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | |
11165 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | |
11166 | ||
11167 | #define alc262_dac_nids alc260_dac_nids | |
11168 | #define alc262_adc_nids alc882_adc_nids | |
11169 | #define alc262_adc_nids_alt alc882_adc_nids_alt | |
11170 | #define alc262_capsrc_nids alc882_capsrc_nids | |
11171 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | |
11172 | ||
11173 | #define alc262_modes alc260_modes | |
11174 | #define alc262_capture_source alc882_capture_source | |
11175 | ||
11176 | static hda_nid_t alc262_dmic_adc_nids[1] = { | |
11177 | /* ADC0 */ | |
11178 | 0x09 | |
11179 | }; | |
11180 | ||
11181 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; | |
11182 | ||
11183 | static struct snd_kcontrol_new alc262_base_mixer[] = { | |
11184 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11185 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11186 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11187 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11188 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11189 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11190 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11191 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11192 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
11193 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11194 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11195 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
11196 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), | |
11197 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11198 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
11199 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
11200 | { } /* end */ | |
11201 | }; | |
11202 | ||
11203 | /* update HP, line and mono-out pins according to the master switch */ | |
11204 | static void alc262_hp_master_update(struct hda_codec *codec) | |
11205 | { | |
11206 | struct alc_spec *spec = codec->spec; | |
11207 | int val = spec->master_sw; | |
11208 | ||
11209 | /* HP & line-out */ | |
11210 | snd_hda_codec_write_cache(codec, 0x1b, 0, | |
11211 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11212 | val ? PIN_HP : 0); | |
11213 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
11214 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11215 | val ? PIN_HP : 0); | |
11216 | /* mono (speaker) depending on the HP jack sense */ | |
11217 | val = val && !spec->jack_present; | |
11218 | snd_hda_codec_write_cache(codec, 0x16, 0, | |
11219 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11220 | val ? PIN_OUT : 0); | |
11221 | } | |
11222 | ||
11223 | static void alc262_hp_bpc_automute(struct hda_codec *codec) | |
11224 | { | |
11225 | struct alc_spec *spec = codec->spec; | |
11226 | ||
11227 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); | |
11228 | alc262_hp_master_update(codec); | |
11229 | } | |
11230 | ||
11231 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) | |
11232 | { | |
11233 | if ((res >> 26) != ALC880_HP_EVENT) | |
11234 | return; | |
11235 | alc262_hp_bpc_automute(codec); | |
11236 | } | |
11237 | ||
11238 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) | |
11239 | { | |
11240 | struct alc_spec *spec = codec->spec; | |
11241 | ||
11242 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | |
11243 | alc262_hp_master_update(codec); | |
11244 | } | |
11245 | ||
11246 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, | |
11247 | unsigned int res) | |
11248 | { | |
11249 | if ((res >> 26) != ALC880_HP_EVENT) | |
11250 | return; | |
11251 | alc262_hp_wildwest_automute(codec); | |
11252 | } | |
11253 | ||
11254 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get | |
11255 | ||
11256 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
11257 | struct snd_ctl_elem_value *ucontrol) | |
11258 | { | |
11259 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11260 | struct alc_spec *spec = codec->spec; | |
11261 | int val = !!*ucontrol->value.integer.value; | |
11262 | ||
11263 | if (val == spec->master_sw) | |
11264 | return 0; | |
11265 | spec->master_sw = val; | |
11266 | alc262_hp_master_update(codec); | |
11267 | return 1; | |
11268 | } | |
11269 | ||
11270 | #define ALC262_HP_MASTER_SWITCH \ | |
11271 | { \ | |
11272 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
11273 | .name = "Master Playback Switch", \ | |
11274 | .info = snd_ctl_boolean_mono_info, \ | |
11275 | .get = alc262_hp_master_sw_get, \ | |
11276 | .put = alc262_hp_master_sw_put, \ | |
11277 | }, \ | |
11278 | { \ | |
11279 | .iface = NID_MAPPING, \ | |
11280 | .name = "Master Playback Switch", \ | |
11281 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ | |
11282 | } | |
11283 | ||
11284 | ||
11285 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { | |
11286 | ALC262_HP_MASTER_SWITCH, | |
11287 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11288 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11289 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
11290 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, | |
11291 | HDA_OUTPUT), | |
11292 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
11293 | HDA_OUTPUT), | |
11294 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11295 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11296 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
11297 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11298 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11299 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
11300 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11301 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11302 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11303 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11304 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
11305 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
11306 | { } /* end */ | |
11307 | }; | |
11308 | ||
11309 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { | |
11310 | ALC262_HP_MASTER_SWITCH, | |
11311 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11312 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
11313 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11314 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11315 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, | |
11316 | HDA_OUTPUT), | |
11317 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
11318 | HDA_OUTPUT), | |
11319 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11320 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11321 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), | |
11322 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11323 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11324 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11325 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11326 | { } /* end */ | |
11327 | }; | |
11328 | ||
11329 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |
11330 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11331 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11332 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
11333 | { } /* end */ | |
11334 | }; | |
11335 | ||
11336 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
11337 | static void alc262_hp_t5735_setup(struct hda_codec *codec) | |
11338 | { | |
11339 | struct alc_spec *spec = codec->spec; | |
11340 | ||
11341 | spec->autocfg.hp_pins[0] = 0x15; | |
11342 | spec->autocfg.speaker_pins[0] = 0x14; | |
11343 | } | |
11344 | ||
11345 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | |
11346 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11347 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11348 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11349 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11350 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11351 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11352 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
11353 | { } /* end */ | |
11354 | }; | |
11355 | ||
11356 | static struct hda_verb alc262_hp_t5735_verbs[] = { | |
11357 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11358 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11359 | ||
11360 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
11361 | { } | |
11362 | }; | |
11363 | ||
11364 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { | |
11365 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11366 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
11367 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
11368 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
11369 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11370 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11371 | { } /* end */ | |
11372 | }; | |
11373 | ||
11374 | static struct hda_verb alc262_hp_rp5700_verbs[] = { | |
11375 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11376 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11377 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11378 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11379 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11380 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11381 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
11382 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
11383 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
11384 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
11385 | {} | |
11386 | }; | |
11387 | ||
11388 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { | |
11389 | .num_items = 1, | |
11390 | .items = { | |
11391 | { "Line", 0x1 }, | |
11392 | }, | |
11393 | }; | |
11394 | ||
11395 | /* bind hp and internal speaker mute (with plug check) as master switch */ | |
11396 | static void alc262_hippo_master_update(struct hda_codec *codec) | |
11397 | { | |
11398 | struct alc_spec *spec = codec->spec; | |
11399 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
11400 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
11401 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
11402 | unsigned int mute; | |
11403 | ||
11404 | /* HP */ | |
11405 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; | |
11406 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, | |
11407 | HDA_AMP_MUTE, mute); | |
11408 | /* mute internal speaker per jack sense */ | |
11409 | if (spec->jack_present) | |
11410 | mute = HDA_AMP_MUTE; | |
11411 | if (line_nid) | |
11412 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, | |
11413 | HDA_AMP_MUTE, mute); | |
11414 | if (speaker_nid && speaker_nid != line_nid) | |
11415 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, | |
11416 | HDA_AMP_MUTE, mute); | |
11417 | } | |
11418 | ||
11419 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get | |
11420 | ||
11421 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, | |
11422 | struct snd_ctl_elem_value *ucontrol) | |
11423 | { | |
11424 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11425 | struct alc_spec *spec = codec->spec; | |
11426 | int val = !!*ucontrol->value.integer.value; | |
11427 | ||
11428 | if (val == spec->master_sw) | |
11429 | return 0; | |
11430 | spec->master_sw = val; | |
11431 | alc262_hippo_master_update(codec); | |
11432 | return 1; | |
11433 | } | |
11434 | ||
11435 | #define ALC262_HIPPO_MASTER_SWITCH \ | |
11436 | { \ | |
11437 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
11438 | .name = "Master Playback Switch", \ | |
11439 | .info = snd_ctl_boolean_mono_info, \ | |
11440 | .get = alc262_hippo_master_sw_get, \ | |
11441 | .put = alc262_hippo_master_sw_put, \ | |
11442 | }, \ | |
11443 | { \ | |
11444 | .iface = NID_MAPPING, \ | |
11445 | .name = "Master Playback Switch", \ | |
11446 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ | |
11447 | (SUBDEV_SPEAKER(0) << 16), \ | |
11448 | } | |
11449 | ||
11450 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { | |
11451 | ALC262_HIPPO_MASTER_SWITCH, | |
11452 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11453 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11454 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11455 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11456 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11457 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11458 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11459 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
11460 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11461 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11462 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
11463 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11464 | { } /* end */ | |
11465 | }; | |
11466 | ||
11467 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { | |
11468 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11469 | ALC262_HIPPO_MASTER_SWITCH, | |
11470 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11471 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11472 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11473 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11474 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11475 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11476 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
11477 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11478 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11479 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
11480 | { } /* end */ | |
11481 | }; | |
11482 | ||
11483 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
11484 | static void alc262_hippo_automute(struct hda_codec *codec) | |
11485 | { | |
11486 | struct alc_spec *spec = codec->spec; | |
11487 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
11488 | ||
11489 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); | |
11490 | alc262_hippo_master_update(codec); | |
11491 | } | |
11492 | ||
11493 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) | |
11494 | { | |
11495 | if ((res >> 26) != ALC880_HP_EVENT) | |
11496 | return; | |
11497 | alc262_hippo_automute(codec); | |
11498 | } | |
11499 | ||
11500 | static void alc262_hippo_setup(struct hda_codec *codec) | |
11501 | { | |
11502 | struct alc_spec *spec = codec->spec; | |
11503 | ||
11504 | spec->autocfg.hp_pins[0] = 0x15; | |
11505 | spec->autocfg.speaker_pins[0] = 0x14; | |
11506 | } | |
11507 | ||
11508 | static void alc262_hippo1_setup(struct hda_codec *codec) | |
11509 | { | |
11510 | struct alc_spec *spec = codec->spec; | |
11511 | ||
11512 | spec->autocfg.hp_pins[0] = 0x1b; | |
11513 | spec->autocfg.speaker_pins[0] = 0x14; | |
11514 | } | |
11515 | ||
11516 | ||
11517 | static struct snd_kcontrol_new alc262_sony_mixer[] = { | |
11518 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11519 | ALC262_HIPPO_MASTER_SWITCH, | |
11520 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11521 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11522 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11523 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11524 | { } /* end */ | |
11525 | }; | |
11526 | ||
11527 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { | |
11528 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11529 | ALC262_HIPPO_MASTER_SWITCH, | |
11530 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11531 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11532 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11533 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11534 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11535 | { } /* end */ | |
11536 | }; | |
11537 | ||
11538 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { | |
11539 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11540 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
11541 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
11542 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
11543 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11544 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11545 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11546 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11547 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
11548 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11549 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11550 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
11551 | { } /* end */ | |
11552 | }; | |
11553 | ||
11554 | static struct hda_verb alc262_tyan_verbs[] = { | |
11555 | /* Headphone automute */ | |
11556 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11557 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11558 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11559 | ||
11560 | /* P11 AUX_IN, white 4-pin connector */ | |
11561 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11562 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, | |
11563 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, | |
11564 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, | |
11565 | ||
11566 | {} | |
11567 | }; | |
11568 | ||
11569 | /* unsolicited event for HP jack sensing */ | |
11570 | static void alc262_tyan_setup(struct hda_codec *codec) | |
11571 | { | |
11572 | struct alc_spec *spec = codec->spec; | |
11573 | ||
11574 | spec->autocfg.hp_pins[0] = 0x1b; | |
11575 | spec->autocfg.speaker_pins[0] = 0x15; | |
11576 | } | |
11577 | ||
11578 | ||
11579 | #define alc262_capture_mixer alc882_capture_mixer | |
11580 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | |
11581 | ||
11582 | /* | |
11583 | * generic initialization of ADC, input mixers and output mixers | |
11584 | */ | |
11585 | static struct hda_verb alc262_init_verbs[] = { | |
11586 | /* | |
11587 | * Unmute ADC0-2 and set the default input to mic-in | |
11588 | */ | |
11589 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11590 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11591 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11592 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11593 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11594 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11595 | ||
11596 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
11597 | * mixer widget | |
11598 | * Note: PASD motherboards uses the Line In 2 as the input for | |
11599 | * front panel mic (mic 2) | |
11600 | */ | |
11601 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
11602 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11603 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11604 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11605 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11606 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
11607 | ||
11608 | /* | |
11609 | * Set up output mixers (0x0c - 0x0e) | |
11610 | */ | |
11611 | /* set vol=0 to output mixers */ | |
11612 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11613 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11614 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11615 | /* set up input amps for analog loopback */ | |
11616 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
11617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11618 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11620 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11621 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11622 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11623 | ||
11624 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
11625 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11626 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
11627 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11628 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11629 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11630 | ||
11631 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11632 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11633 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11634 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11635 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11636 | ||
11637 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11638 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11639 | ||
11640 | /* FIXME: use matrix-type input source selection */ | |
11641 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
11642 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
11643 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11644 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11645 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11646 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11647 | /* Input mixer2 */ | |
11648 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11649 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11650 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11651 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11652 | /* Input mixer3 */ | |
11653 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11654 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11655 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11656 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11657 | ||
11658 | { } | |
11659 | }; | |
11660 | ||
11661 | static struct hda_verb alc262_eapd_verbs[] = { | |
11662 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
11663 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
11664 | { } | |
11665 | }; | |
11666 | ||
11667 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { | |
11668 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11669 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11670 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11671 | ||
11672 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11673 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11674 | {} | |
11675 | }; | |
11676 | ||
11677 | static struct hda_verb alc262_sony_unsol_verbs[] = { | |
11678 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11679 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11680 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic | |
11681 | ||
11682 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11683 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11684 | {} | |
11685 | }; | |
11686 | ||
11687 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { | |
11688 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11689 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11690 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11692 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11693 | { } /* end */ | |
11694 | }; | |
11695 | ||
11696 | static struct hda_verb alc262_toshiba_s06_verbs[] = { | |
11697 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11698 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11699 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11700 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11701 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, | |
11702 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11703 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
11704 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11705 | {} | |
11706 | }; | |
11707 | ||
11708 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) | |
11709 | { | |
11710 | struct alc_spec *spec = codec->spec; | |
11711 | ||
11712 | spec->autocfg.hp_pins[0] = 0x15; | |
11713 | spec->autocfg.speaker_pins[0] = 0x14; | |
11714 | spec->ext_mic.pin = 0x18; | |
11715 | spec->ext_mic.mux_idx = 0; | |
11716 | spec->int_mic.pin = 0x12; | |
11717 | spec->int_mic.mux_idx = 9; | |
11718 | spec->auto_mic = 1; | |
11719 | } | |
11720 | ||
11721 | /* | |
11722 | * nec model | |
11723 | * 0x15 = headphone | |
11724 | * 0x16 = internal speaker | |
11725 | * 0x18 = external mic | |
11726 | */ | |
11727 | ||
11728 | static struct snd_kcontrol_new alc262_nec_mixer[] = { | |
11729 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
11730 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), | |
11731 | ||
11732 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11733 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11734 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
11735 | ||
11736 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11737 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11738 | { } /* end */ | |
11739 | }; | |
11740 | ||
11741 | static struct hda_verb alc262_nec_verbs[] = { | |
11742 | /* Unmute Speaker */ | |
11743 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11744 | ||
11745 | /* Headphone */ | |
11746 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11747 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11748 | ||
11749 | /* External mic to headphone */ | |
11750 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11751 | /* External mic to speaker */ | |
11752 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11753 | {} | |
11754 | }; | |
11755 | ||
11756 | /* | |
11757 | * fujitsu model | |
11758 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, | |
11759 | * 0x1b = port replicator headphone out | |
11760 | */ | |
11761 | ||
11762 | #define ALC_HP_EVENT 0x37 | |
11763 | ||
11764 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { | |
11765 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
11766 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11767 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
11768 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11769 | {} | |
11770 | }; | |
11771 | ||
11772 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { | |
11773 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
11774 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11775 | {} | |
11776 | }; | |
11777 | ||
11778 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { | |
11779 | /* Front Mic pin: input vref at 50% */ | |
11780 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
11781 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11782 | {} | |
11783 | }; | |
11784 | ||
11785 | static struct hda_input_mux alc262_fujitsu_capture_source = { | |
11786 | .num_items = 3, | |
11787 | .items = { | |
11788 | { "Mic", 0x0 }, | |
11789 | { "Internal Mic", 0x1 }, | |
11790 | { "CD", 0x4 }, | |
11791 | }, | |
11792 | }; | |
11793 | ||
11794 | static struct hda_input_mux alc262_HP_capture_source = { | |
11795 | .num_items = 5, | |
11796 | .items = { | |
11797 | { "Mic", 0x0 }, | |
11798 | { "Front Mic", 0x1 }, | |
11799 | { "Line", 0x2 }, | |
11800 | { "CD", 0x4 }, | |
11801 | { "AUX IN", 0x6 }, | |
11802 | }, | |
11803 | }; | |
11804 | ||
11805 | static struct hda_input_mux alc262_HP_D7000_capture_source = { | |
11806 | .num_items = 4, | |
11807 | .items = { | |
11808 | { "Mic", 0x0 }, | |
11809 | { "Front Mic", 0x2 }, | |
11810 | { "Line", 0x1 }, | |
11811 | { "CD", 0x4 }, | |
11812 | }, | |
11813 | }; | |
11814 | ||
11815 | /* mute/unmute internal speaker according to the hp jacks and mute state */ | |
11816 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) | |
11817 | { | |
11818 | struct alc_spec *spec = codec->spec; | |
11819 | unsigned int mute; | |
11820 | ||
11821 | if (force || !spec->sense_updated) { | |
11822 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || | |
11823 | snd_hda_jack_detect(codec, 0x1b); | |
11824 | spec->sense_updated = 1; | |
11825 | } | |
11826 | /* unmute internal speaker only if both HPs are unplugged and | |
11827 | * master switch is on | |
11828 | */ | |
11829 | if (spec->jack_present) | |
11830 | mute = HDA_AMP_MUTE; | |
11831 | else | |
11832 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
11833 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
11834 | HDA_AMP_MUTE, mute); | |
11835 | } | |
11836 | ||
11837 | /* unsolicited event for HP jack sensing */ | |
11838 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, | |
11839 | unsigned int res) | |
11840 | { | |
11841 | if ((res >> 26) != ALC_HP_EVENT) | |
11842 | return; | |
11843 | alc262_fujitsu_automute(codec, 1); | |
11844 | } | |
11845 | ||
11846 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) | |
11847 | { | |
11848 | alc262_fujitsu_automute(codec, 1); | |
11849 | } | |
11850 | ||
11851 | /* bind volumes of both NID 0x0c and 0x0d */ | |
11852 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { | |
11853 | .ops = &snd_hda_bind_vol, | |
11854 | .values = { | |
11855 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), | |
11856 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), | |
11857 | 0 | |
11858 | }, | |
11859 | }; | |
11860 | ||
11861 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
11862 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) | |
11863 | { | |
11864 | struct alc_spec *spec = codec->spec; | |
11865 | unsigned int mute; | |
11866 | ||
11867 | if (force || !spec->sense_updated) { | |
11868 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); | |
11869 | spec->sense_updated = 1; | |
11870 | } | |
11871 | if (spec->jack_present) { | |
11872 | /* mute internal speaker */ | |
11873 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11874 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
11875 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
11876 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
11877 | } else { | |
11878 | /* unmute internal speaker if necessary */ | |
11879 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
11880 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11881 | HDA_AMP_MUTE, mute); | |
11882 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
11883 | HDA_AMP_MUTE, mute); | |
11884 | } | |
11885 | } | |
11886 | ||
11887 | /* unsolicited event for HP jack sensing */ | |
11888 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, | |
11889 | unsigned int res) | |
11890 | { | |
11891 | if ((res >> 26) != ALC_HP_EVENT) | |
11892 | return; | |
11893 | alc262_lenovo_3000_automute(codec, 1); | |
11894 | } | |
11895 | ||
11896 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, | |
11897 | int dir, int idx, long *valp) | |
11898 | { | |
11899 | int i, change = 0; | |
11900 | ||
11901 | for (i = 0; i < 2; i++, valp++) | |
11902 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, | |
11903 | HDA_AMP_MUTE, | |
11904 | *valp ? 0 : HDA_AMP_MUTE); | |
11905 | return change; | |
11906 | } | |
11907 | ||
11908 | /* bind hp and internal speaker mute (with plug check) */ | |
11909 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | |
11910 | struct snd_ctl_elem_value *ucontrol) | |
11911 | { | |
11912 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11913 | long *valp = ucontrol->value.integer.value; | |
11914 | int change; | |
11915 | ||
11916 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); | |
11917 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); | |
11918 | if (change) | |
11919 | alc262_fujitsu_automute(codec, 0); | |
11920 | return change; | |
11921 | } | |
11922 | ||
11923 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | |
11924 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
11925 | { | |
11926 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11927 | .name = "Master Playback Switch", | |
11928 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
11929 | .info = snd_hda_mixer_amp_switch_info, | |
11930 | .get = snd_hda_mixer_amp_switch_get, | |
11931 | .put = alc262_fujitsu_master_sw_put, | |
11932 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
11933 | }, | |
11934 | { | |
11935 | .iface = NID_MAPPING, | |
11936 | .name = "Master Playback Switch", | |
11937 | .private_value = 0x1b, | |
11938 | }, | |
11939 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11940 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11941 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
11942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11943 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11944 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
11945 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
11946 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
11947 | { } /* end */ | |
11948 | }; | |
11949 | ||
11950 | /* bind hp and internal speaker mute (with plug check) */ | |
11951 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, | |
11952 | struct snd_ctl_elem_value *ucontrol) | |
11953 | { | |
11954 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11955 | long *valp = ucontrol->value.integer.value; | |
11956 | int change; | |
11957 | ||
11958 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); | |
11959 | if (change) | |
11960 | alc262_lenovo_3000_automute(codec, 0); | |
11961 | return change; | |
11962 | } | |
11963 | ||
11964 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | |
11965 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
11966 | { | |
11967 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11968 | .name = "Master Playback Switch", | |
11969 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
11970 | .info = snd_hda_mixer_amp_switch_info, | |
11971 | .get = snd_hda_mixer_amp_switch_get, | |
11972 | .put = alc262_lenovo_3000_master_sw_put, | |
11973 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
11974 | }, | |
11975 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11976 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11977 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
11978 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11979 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11980 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
11981 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
11982 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
11983 | { } /* end */ | |
11984 | }; | |
11985 | ||
11986 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { | |
11987 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
11988 | ALC262_HIPPO_MASTER_SWITCH, | |
11989 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11990 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11991 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
11992 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11993 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11994 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
11995 | { } /* end */ | |
11996 | }; | |
11997 | ||
11998 | /* additional init verbs for Benq laptops */ | |
11999 | static struct hda_verb alc262_EAPD_verbs[] = { | |
12000 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
12001 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
12002 | {} | |
12003 | }; | |
12004 | ||
12005 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { | |
12006 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12007 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12008 | ||
12009 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
12010 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
12011 | {} | |
12012 | }; | |
12013 | ||
12014 | /* Samsung Q1 Ultra Vista model setup */ | |
12015 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { | |
12016 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
12017 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
12018 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
12019 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
12020 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
12021 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), | |
12022 | { } /* end */ | |
12023 | }; | |
12024 | ||
12025 | static struct hda_verb alc262_ultra_verbs[] = { | |
12026 | /* output mixer */ | |
12027 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12028 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12029 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12030 | /* speaker */ | |
12031 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12032 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12033 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12034 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12035 | /* HP */ | |
12036 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12037 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12038 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12039 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12040 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
12041 | /* internal mic */ | |
12042 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12044 | /* ADC, choose mic */ | |
12045 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12046 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12047 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12048 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12049 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12050 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12051 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
12052 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
12053 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
12054 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | |
12055 | {} | |
12056 | }; | |
12057 | ||
12058 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
12059 | static void alc262_ultra_automute(struct hda_codec *codec) | |
12060 | { | |
12061 | struct alc_spec *spec = codec->spec; | |
12062 | unsigned int mute; | |
12063 | ||
12064 | mute = 0; | |
12065 | /* auto-mute only when HP is used as HP */ | |
12066 | if (!spec->cur_mux[0]) { | |
12067 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | |
12068 | if (spec->jack_present) | |
12069 | mute = HDA_AMP_MUTE; | |
12070 | } | |
12071 | /* mute/unmute internal speaker */ | |
12072 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
12073 | HDA_AMP_MUTE, mute); | |
12074 | /* mute/unmute HP */ | |
12075 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
12076 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | |
12077 | } | |
12078 | ||
12079 | /* unsolicited event for HP jack sensing */ | |
12080 | static void alc262_ultra_unsol_event(struct hda_codec *codec, | |
12081 | unsigned int res) | |
12082 | { | |
12083 | if ((res >> 26) != ALC880_HP_EVENT) | |
12084 | return; | |
12085 | alc262_ultra_automute(codec); | |
12086 | } | |
12087 | ||
12088 | static struct hda_input_mux alc262_ultra_capture_source = { | |
12089 | .num_items = 2, | |
12090 | .items = { | |
12091 | { "Mic", 0x1 }, | |
12092 | { "Headphone", 0x7 }, | |
12093 | }, | |
12094 | }; | |
12095 | ||
12096 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | |
12097 | struct snd_ctl_elem_value *ucontrol) | |
12098 | { | |
12099 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
12100 | struct alc_spec *spec = codec->spec; | |
12101 | int ret; | |
12102 | ||
12103 | ret = alc_mux_enum_put(kcontrol, ucontrol); | |
12104 | if (!ret) | |
12105 | return 0; | |
12106 | /* reprogram the HP pin as mic or HP according to the input source */ | |
12107 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
12108 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
12109 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | |
12110 | alc262_ultra_automute(codec); /* mute/unmute HP */ | |
12111 | return ret; | |
12112 | } | |
12113 | ||
12114 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | |
12115 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | |
12116 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
12117 | { | |
12118 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12119 | .name = "Capture Source", | |
12120 | .info = alc_mux_enum_info, | |
12121 | .get = alc_mux_enum_get, | |
12122 | .put = alc262_ultra_mux_enum_put, | |
12123 | }, | |
12124 | { | |
12125 | .iface = NID_MAPPING, | |
12126 | .name = "Capture Source", | |
12127 | .private_value = 0x15, | |
12128 | }, | |
12129 | { } /* end */ | |
12130 | }; | |
12131 | ||
12132 | /* We use two mixers depending on the output pin; 0x16 is a mono output | |
12133 | * and thus it's bound with a different mixer. | |
12134 | * This function returns which mixer amp should be used. | |
12135 | */ | |
12136 | static int alc262_check_volbit(hda_nid_t nid) | |
12137 | { | |
12138 | if (!nid) | |
12139 | return 0; | |
12140 | else if (nid == 0x16) | |
12141 | return 2; | |
12142 | else | |
12143 | return 1; | |
12144 | } | |
12145 | ||
12146 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, | |
12147 | const char *pfx, int *vbits, int idx) | |
12148 | { | |
12149 | unsigned long val; | |
12150 | int vbit; | |
12151 | ||
12152 | vbit = alc262_check_volbit(nid); | |
12153 | if (!vbit) | |
12154 | return 0; | |
12155 | if (*vbits & vbit) /* a volume control for this mixer already there */ | |
12156 | return 0; | |
12157 | *vbits |= vbit; | |
12158 | if (vbit == 2) | |
12159 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); | |
12160 | else | |
12161 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); | |
12162 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val); | |
12163 | } | |
12164 | ||
12165 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, | |
12166 | const char *pfx, int idx) | |
12167 | { | |
12168 | unsigned long val; | |
12169 | ||
12170 | if (!nid) | |
12171 | return 0; | |
12172 | if (nid == 0x16) | |
12173 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
12174 | else | |
12175 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
12176 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val); | |
12177 | } | |
12178 | ||
12179 | /* add playback controls from the parsed DAC table */ | |
12180 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, | |
12181 | const struct auto_pin_cfg *cfg) | |
12182 | { | |
12183 | const char *pfx; | |
12184 | int vbits; | |
12185 | int i, err; | |
12186 | ||
12187 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
12188 | spec->multiout.dac_nids = spec->private_dac_nids; | |
12189 | spec->multiout.dac_nids[0] = 2; | |
12190 | ||
12191 | pfx = alc_get_line_out_pfx(cfg, true); | |
12192 | if (!pfx) | |
12193 | pfx = "Front"; | |
12194 | for (i = 0; i < 2; i++) { | |
12195 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); | |
12196 | if (err < 0) | |
12197 | return err; | |
12198 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { | |
12199 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], | |
12200 | "Speaker", i); | |
12201 | if (err < 0) | |
12202 | return err; | |
12203 | } | |
12204 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { | |
12205 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], | |
12206 | "Headphone", i); | |
12207 | if (err < 0) | |
12208 | return err; | |
12209 | } | |
12210 | } | |
12211 | ||
12212 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | | |
12213 | alc262_check_volbit(cfg->speaker_pins[0]) | | |
12214 | alc262_check_volbit(cfg->hp_pins[0]); | |
12215 | if (vbits == 1 || vbits == 2) | |
12216 | pfx = "Master"; /* only one mixer is used */ | |
12217 | vbits = 0; | |
12218 | for (i = 0; i < 2; i++) { | |
12219 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, | |
12220 | &vbits, i); | |
12221 | if (err < 0) | |
12222 | return err; | |
12223 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { | |
12224 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], | |
12225 | "Speaker", &vbits, i); | |
12226 | if (err < 0) | |
12227 | return err; | |
12228 | } | |
12229 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { | |
12230 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], | |
12231 | "Headphone", &vbits, i); | |
12232 | if (err < 0) | |
12233 | return err; | |
12234 | } | |
12235 | } | |
12236 | return 0; | |
12237 | } | |
12238 | ||
12239 | #define alc262_auto_create_input_ctls \ | |
12240 | alc882_auto_create_input_ctls | |
12241 | ||
12242 | /* | |
12243 | * generic initialization of ADC, input mixers and output mixers | |
12244 | */ | |
12245 | static struct hda_verb alc262_volume_init_verbs[] = { | |
12246 | /* | |
12247 | * Unmute ADC0-2 and set the default input to mic-in | |
12248 | */ | |
12249 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12250 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12251 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12252 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12253 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12254 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12255 | ||
12256 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
12257 | * mixer widget | |
12258 | * Note: PASD motherboards uses the Line In 2 as the input for | |
12259 | * front panel mic (mic 2) | |
12260 | */ | |
12261 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
12262 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12263 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12264 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12265 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12266 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12267 | ||
12268 | /* | |
12269 | * Set up output mixers (0x0c - 0x0f) | |
12270 | */ | |
12271 | /* set vol=0 to output mixers */ | |
12272 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12273 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12274 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12275 | ||
12276 | /* set up input amps for analog loopback */ | |
12277 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12278 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12279 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12280 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12281 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12282 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12283 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12284 | ||
12285 | /* FIXME: use matrix-type input source selection */ | |
12286 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
12287 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
12288 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12289 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12290 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12291 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12292 | /* Input mixer2 */ | |
12293 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12294 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12295 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12296 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12297 | /* Input mixer3 */ | |
12298 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12299 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12300 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12301 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12302 | ||
12303 | { } | |
12304 | }; | |
12305 | ||
12306 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { | |
12307 | /* | |
12308 | * Unmute ADC0-2 and set the default input to mic-in | |
12309 | */ | |
12310 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12311 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12312 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12313 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12314 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12315 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12316 | ||
12317 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
12318 | * mixer widget | |
12319 | * Note: PASD motherboards uses the Line In 2 as the input for | |
12320 | * front panel mic (mic 2) | |
12321 | */ | |
12322 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
12323 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12324 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12326 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
12329 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
12330 | ||
12331 | /* | |
12332 | * Set up output mixers (0x0c - 0x0e) | |
12333 | */ | |
12334 | /* set vol=0 to output mixers */ | |
12335 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12336 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12337 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12338 | ||
12339 | /* set up input amps for analog loopback */ | |
12340 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12341 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12342 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12343 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12344 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12345 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12346 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12347 | ||
12348 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12349 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12350 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12351 | ||
12352 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12353 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12354 | ||
12355 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12356 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12357 | ||
12358 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12359 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12360 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12361 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12362 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12363 | ||
12364 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12365 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12366 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12367 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12368 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12369 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12370 | ||
12371 | ||
12372 | /* FIXME: use matrix-type input source selection */ | |
12373 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ | |
12374 | /* Input mixer1: only unmute Mic */ | |
12375 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12376 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | |
12377 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12378 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12379 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12380 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12381 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12382 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12383 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
12384 | /* Input mixer2 */ | |
12385 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12386 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | |
12387 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12388 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12389 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12390 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12391 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12393 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
12394 | /* Input mixer3 */ | |
12395 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12396 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | |
12397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12399 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12400 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12401 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12402 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12403 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
12404 | ||
12405 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12406 | ||
12407 | { } | |
12408 | }; | |
12409 | ||
12410 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { | |
12411 | /* | |
12412 | * Unmute ADC0-2 and set the default input to mic-in | |
12413 | */ | |
12414 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12416 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12417 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12418 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12420 | ||
12421 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
12422 | * mixer widget | |
12423 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
12424 | * panel mic (mic 2) | |
12425 | */ | |
12426 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
12427 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12428 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12429 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12430 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12431 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12432 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
12433 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
12434 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
12435 | /* | |
12436 | * Set up output mixers (0x0c - 0x0e) | |
12437 | */ | |
12438 | /* set vol=0 to output mixers */ | |
12439 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12440 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12441 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12442 | ||
12443 | /* set up input amps for analog loopback */ | |
12444 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12445 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12446 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12447 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12448 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12449 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12450 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12451 | ||
12452 | ||
12453 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ | |
12454 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ | |
12455 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ | |
12456 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ | |
12457 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
12458 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ | |
12459 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ | |
12460 | ||
12461 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12462 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12463 | ||
12464 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12465 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
12466 | ||
12467 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ | |
12468 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12469 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12470 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
12471 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12472 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12473 | ||
12474 | /* FIXME: use matrix-type input source selection */ | |
12475 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
12476 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
12477 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ | |
12478 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ | |
12479 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ | |
12480 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ | |
12481 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ | |
12482 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12483 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ | |
12484 | /* Input mixer2 */ | |
12485 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12486 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
12487 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
12488 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
12489 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
12490 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12491 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
12492 | /* Input mixer3 */ | |
12493 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12494 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
12495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
12496 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
12497 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
12498 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12499 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
12500 | ||
12501 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12502 | ||
12503 | { } | |
12504 | }; | |
12505 | ||
12506 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { | |
12507 | ||
12508 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | |
12509 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12510 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
12511 | ||
12512 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ | |
12513 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
12514 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
12515 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
12516 | ||
12517 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ | |
12518 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12519 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
12520 | {} | |
12521 | }; | |
12522 | ||
12523 | /* | |
12524 | * Pin config fixes | |
12525 | */ | |
12526 | enum { | |
12527 | PINFIX_FSC_H270, | |
12528 | }; | |
12529 | ||
12530 | static const struct alc_fixup alc262_fixups[] = { | |
12531 | [PINFIX_FSC_H270] = { | |
12532 | .type = ALC_FIXUP_PINS, | |
12533 | .v.pins = (const struct alc_pincfg[]) { | |
12534 | { 0x14, 0x99130110 }, /* speaker */ | |
12535 | { 0x15, 0x0221142f }, /* front HP */ | |
12536 | { 0x1b, 0x0121141f }, /* rear HP */ | |
12537 | { } | |
12538 | } | |
12539 | }, | |
12540 | }; | |
12541 | ||
12542 | static struct snd_pci_quirk alc262_fixup_tbl[] = { | |
12543 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), | |
12544 | {} | |
12545 | }; | |
12546 | ||
12547 | ||
12548 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
12549 | #define alc262_loopbacks alc880_loopbacks | |
12550 | #endif | |
12551 | ||
12552 | /* pcm configuration: identical with ALC880 */ | |
12553 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback | |
12554 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture | |
12555 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback | |
12556 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture | |
12557 | ||
12558 | /* | |
12559 | * BIOS auto configuration | |
12560 | */ | |
12561 | static int alc262_parse_auto_config(struct hda_codec *codec) | |
12562 | { | |
12563 | struct alc_spec *spec = codec->spec; | |
12564 | int err; | |
12565 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; | |
12566 | ||
12567 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
12568 | alc262_ignore); | |
12569 | if (err < 0) | |
12570 | return err; | |
12571 | if (!spec->autocfg.line_outs) { | |
12572 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
12573 | spec->multiout.max_channels = 2; | |
12574 | spec->no_analog = 1; | |
12575 | goto dig_only; | |
12576 | } | |
12577 | return 0; /* can't find valid BIOS pin config */ | |
12578 | } | |
12579 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
12580 | if (err < 0) | |
12581 | return err; | |
12582 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); | |
12583 | if (err < 0) | |
12584 | return err; | |
12585 | ||
12586 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
12587 | ||
12588 | dig_only: | |
12589 | alc_auto_parse_digital(codec); | |
12590 | ||
12591 | if (spec->kctls.list) | |
12592 | add_mixer(spec, spec->kctls.list); | |
12593 | ||
12594 | add_verb(spec, alc262_volume_init_verbs); | |
12595 | spec->num_mux_defs = 1; | |
12596 | spec->input_mux = &spec->private_imux[0]; | |
12597 | ||
12598 | err = alc_auto_add_mic_boost(codec); | |
12599 | if (err < 0) | |
12600 | return err; | |
12601 | ||
12602 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
12603 | ||
12604 | return 1; | |
12605 | } | |
12606 | ||
12607 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out | |
12608 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out | |
12609 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input | |
12610 | #define alc262_auto_init_input_src alc882_auto_init_input_src | |
12611 | ||
12612 | ||
12613 | /* init callback for auto-configuration model -- overriding the default init */ | |
12614 | static void alc262_auto_init(struct hda_codec *codec) | |
12615 | { | |
12616 | struct alc_spec *spec = codec->spec; | |
12617 | alc262_auto_init_multi_out(codec); | |
12618 | alc262_auto_init_hp_out(codec); | |
12619 | alc262_auto_init_analog_input(codec); | |
12620 | alc262_auto_init_input_src(codec); | |
12621 | alc_auto_init_digital(codec); | |
12622 | if (spec->unsol_event) | |
12623 | alc_inithook(codec); | |
12624 | } | |
12625 | ||
12626 | /* | |
12627 | * configuration and preset | |
12628 | */ | |
12629 | static const char * const alc262_models[ALC262_MODEL_LAST] = { | |
12630 | [ALC262_BASIC] = "basic", | |
12631 | [ALC262_HIPPO] = "hippo", | |
12632 | [ALC262_HIPPO_1] = "hippo_1", | |
12633 | [ALC262_FUJITSU] = "fujitsu", | |
12634 | [ALC262_HP_BPC] = "hp-bpc", | |
12635 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", | |
12636 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", | |
12637 | [ALC262_HP_RP5700] = "hp-rp5700", | |
12638 | [ALC262_BENQ_ED8] = "benq", | |
12639 | [ALC262_BENQ_T31] = "benq-t31", | |
12640 | [ALC262_SONY_ASSAMD] = "sony-assamd", | |
12641 | [ALC262_TOSHIBA_S06] = "toshiba-s06", | |
12642 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", | |
12643 | [ALC262_ULTRA] = "ultra", | |
12644 | [ALC262_LENOVO_3000] = "lenovo-3000", | |
12645 | [ALC262_NEC] = "nec", | |
12646 | [ALC262_TYAN] = "tyan", | |
12647 | [ALC262_AUTO] = "auto", | |
12648 | }; | |
12649 | ||
12650 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | |
12651 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | |
12652 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), | |
12653 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", | |
12654 | ALC262_HP_BPC), | |
12655 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", | |
12656 | ALC262_HP_BPC), | |
12657 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", | |
12658 | ALC262_HP_BPC), | |
12659 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", | |
12660 | ALC262_HP_BPC), | |
12661 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), | |
12662 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), | |
12663 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), | |
12664 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), | |
12665 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), | |
12666 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), | |
12667 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), | |
12668 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), | |
12669 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), | |
12670 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), | |
12671 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), | |
12672 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", | |
12673 | ALC262_HP_TC_T5735), | |
12674 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), | |
12675 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), | |
12676 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), | |
12677 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), | |
12678 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ | |
12679 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), | |
12680 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), | |
12681 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), | |
12682 | #if 0 /* disable the quirk since model=auto works better in recent versions */ | |
12683 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", | |
12684 | ALC262_SONY_ASSAMD), | |
12685 | #endif | |
12686 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", | |
12687 | ALC262_TOSHIBA_RX1), | |
12688 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), | |
12689 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), | |
12690 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), | |
12691 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), | |
12692 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", | |
12693 | ALC262_ULTRA), | |
12694 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), | |
12695 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), | |
12696 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), | |
12697 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), | |
12698 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | |
12699 | {} | |
12700 | }; | |
12701 | ||
12702 | static struct alc_config_preset alc262_presets[] = { | |
12703 | [ALC262_BASIC] = { | |
12704 | .mixers = { alc262_base_mixer }, | |
12705 | .init_verbs = { alc262_init_verbs }, | |
12706 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12707 | .dac_nids = alc262_dac_nids, | |
12708 | .hp_nid = 0x03, | |
12709 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12710 | .channel_mode = alc262_modes, | |
12711 | .input_mux = &alc262_capture_source, | |
12712 | }, | |
12713 | [ALC262_HIPPO] = { | |
12714 | .mixers = { alc262_hippo_mixer }, | |
12715 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, | |
12716 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12717 | .dac_nids = alc262_dac_nids, | |
12718 | .hp_nid = 0x03, | |
12719 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12720 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12721 | .channel_mode = alc262_modes, | |
12722 | .input_mux = &alc262_capture_source, | |
12723 | .unsol_event = alc262_hippo_unsol_event, | |
12724 | .setup = alc262_hippo_setup, | |
12725 | .init_hook = alc262_hippo_automute, | |
12726 | }, | |
12727 | [ALC262_HIPPO_1] = { | |
12728 | .mixers = { alc262_hippo1_mixer }, | |
12729 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, | |
12730 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12731 | .dac_nids = alc262_dac_nids, | |
12732 | .hp_nid = 0x02, | |
12733 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12734 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12735 | .channel_mode = alc262_modes, | |
12736 | .input_mux = &alc262_capture_source, | |
12737 | .unsol_event = alc262_hippo_unsol_event, | |
12738 | .setup = alc262_hippo1_setup, | |
12739 | .init_hook = alc262_hippo_automute, | |
12740 | }, | |
12741 | [ALC262_FUJITSU] = { | |
12742 | .mixers = { alc262_fujitsu_mixer }, | |
12743 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | |
12744 | alc262_fujitsu_unsol_verbs }, | |
12745 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12746 | .dac_nids = alc262_dac_nids, | |
12747 | .hp_nid = 0x03, | |
12748 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12749 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12750 | .channel_mode = alc262_modes, | |
12751 | .input_mux = &alc262_fujitsu_capture_source, | |
12752 | .unsol_event = alc262_fujitsu_unsol_event, | |
12753 | .init_hook = alc262_fujitsu_init_hook, | |
12754 | }, | |
12755 | [ALC262_HP_BPC] = { | |
12756 | .mixers = { alc262_HP_BPC_mixer }, | |
12757 | .init_verbs = { alc262_HP_BPC_init_verbs }, | |
12758 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12759 | .dac_nids = alc262_dac_nids, | |
12760 | .hp_nid = 0x03, | |
12761 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12762 | .channel_mode = alc262_modes, | |
12763 | .input_mux = &alc262_HP_capture_source, | |
12764 | .unsol_event = alc262_hp_bpc_unsol_event, | |
12765 | .init_hook = alc262_hp_bpc_automute, | |
12766 | }, | |
12767 | [ALC262_HP_BPC_D7000_WF] = { | |
12768 | .mixers = { alc262_HP_BPC_WildWest_mixer }, | |
12769 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
12770 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12771 | .dac_nids = alc262_dac_nids, | |
12772 | .hp_nid = 0x03, | |
12773 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12774 | .channel_mode = alc262_modes, | |
12775 | .input_mux = &alc262_HP_D7000_capture_source, | |
12776 | .unsol_event = alc262_hp_wildwest_unsol_event, | |
12777 | .init_hook = alc262_hp_wildwest_automute, | |
12778 | }, | |
12779 | [ALC262_HP_BPC_D7000_WL] = { | |
12780 | .mixers = { alc262_HP_BPC_WildWest_mixer, | |
12781 | alc262_HP_BPC_WildWest_option_mixer }, | |
12782 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
12783 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12784 | .dac_nids = alc262_dac_nids, | |
12785 | .hp_nid = 0x03, | |
12786 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12787 | .channel_mode = alc262_modes, | |
12788 | .input_mux = &alc262_HP_D7000_capture_source, | |
12789 | .unsol_event = alc262_hp_wildwest_unsol_event, | |
12790 | .init_hook = alc262_hp_wildwest_automute, | |
12791 | }, | |
12792 | [ALC262_HP_TC_T5735] = { | |
12793 | .mixers = { alc262_hp_t5735_mixer }, | |
12794 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, | |
12795 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12796 | .dac_nids = alc262_dac_nids, | |
12797 | .hp_nid = 0x03, | |
12798 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12799 | .channel_mode = alc262_modes, | |
12800 | .input_mux = &alc262_capture_source, | |
12801 | .unsol_event = alc_sku_unsol_event, | |
12802 | .setup = alc262_hp_t5735_setup, | |
12803 | .init_hook = alc_inithook, | |
12804 | }, | |
12805 | [ALC262_HP_RP5700] = { | |
12806 | .mixers = { alc262_hp_rp5700_mixer }, | |
12807 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, | |
12808 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12809 | .dac_nids = alc262_dac_nids, | |
12810 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12811 | .channel_mode = alc262_modes, | |
12812 | .input_mux = &alc262_hp_rp5700_capture_source, | |
12813 | }, | |
12814 | [ALC262_BENQ_ED8] = { | |
12815 | .mixers = { alc262_base_mixer }, | |
12816 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | |
12817 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12818 | .dac_nids = alc262_dac_nids, | |
12819 | .hp_nid = 0x03, | |
12820 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12821 | .channel_mode = alc262_modes, | |
12822 | .input_mux = &alc262_capture_source, | |
12823 | }, | |
12824 | [ALC262_SONY_ASSAMD] = { | |
12825 | .mixers = { alc262_sony_mixer }, | |
12826 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, | |
12827 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12828 | .dac_nids = alc262_dac_nids, | |
12829 | .hp_nid = 0x02, | |
12830 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12831 | .channel_mode = alc262_modes, | |
12832 | .input_mux = &alc262_capture_source, | |
12833 | .unsol_event = alc262_hippo_unsol_event, | |
12834 | .setup = alc262_hippo_setup, | |
12835 | .init_hook = alc262_hippo_automute, | |
12836 | }, | |
12837 | [ALC262_BENQ_T31] = { | |
12838 | .mixers = { alc262_benq_t31_mixer }, | |
12839 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, | |
12840 | alc_hp15_unsol_verbs }, | |
12841 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12842 | .dac_nids = alc262_dac_nids, | |
12843 | .hp_nid = 0x03, | |
12844 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12845 | .channel_mode = alc262_modes, | |
12846 | .input_mux = &alc262_capture_source, | |
12847 | .unsol_event = alc262_hippo_unsol_event, | |
12848 | .setup = alc262_hippo_setup, | |
12849 | .init_hook = alc262_hippo_automute, | |
12850 | }, | |
12851 | [ALC262_ULTRA] = { | |
12852 | .mixers = { alc262_ultra_mixer }, | |
12853 | .cap_mixer = alc262_ultra_capture_mixer, | |
12854 | .init_verbs = { alc262_ultra_verbs }, | |
12855 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12856 | .dac_nids = alc262_dac_nids, | |
12857 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12858 | .channel_mode = alc262_modes, | |
12859 | .input_mux = &alc262_ultra_capture_source, | |
12860 | .adc_nids = alc262_adc_nids, /* ADC0 */ | |
12861 | .capsrc_nids = alc262_capsrc_nids, | |
12862 | .num_adc_nids = 1, /* single ADC */ | |
12863 | .unsol_event = alc262_ultra_unsol_event, | |
12864 | .init_hook = alc262_ultra_automute, | |
12865 | }, | |
12866 | [ALC262_LENOVO_3000] = { | |
12867 | .mixers = { alc262_lenovo_3000_mixer }, | |
12868 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | |
12869 | alc262_lenovo_3000_unsol_verbs, | |
12870 | alc262_lenovo_3000_init_verbs }, | |
12871 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12872 | .dac_nids = alc262_dac_nids, | |
12873 | .hp_nid = 0x03, | |
12874 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12875 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12876 | .channel_mode = alc262_modes, | |
12877 | .input_mux = &alc262_fujitsu_capture_source, | |
12878 | .unsol_event = alc262_lenovo_3000_unsol_event, | |
12879 | }, | |
12880 | [ALC262_NEC] = { | |
12881 | .mixers = { alc262_nec_mixer }, | |
12882 | .init_verbs = { alc262_nec_verbs }, | |
12883 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12884 | .dac_nids = alc262_dac_nids, | |
12885 | .hp_nid = 0x03, | |
12886 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12887 | .channel_mode = alc262_modes, | |
12888 | .input_mux = &alc262_capture_source, | |
12889 | }, | |
12890 | [ALC262_TOSHIBA_S06] = { | |
12891 | .mixers = { alc262_toshiba_s06_mixer }, | |
12892 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, | |
12893 | alc262_eapd_verbs }, | |
12894 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12895 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
12896 | .dac_nids = alc262_dac_nids, | |
12897 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ | |
12898 | .num_adc_nids = 1, /* single ADC */ | |
12899 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12900 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12901 | .channel_mode = alc262_modes, | |
12902 | .unsol_event = alc_sku_unsol_event, | |
12903 | .setup = alc262_toshiba_s06_setup, | |
12904 | .init_hook = alc_inithook, | |
12905 | }, | |
12906 | [ALC262_TOSHIBA_RX1] = { | |
12907 | .mixers = { alc262_toshiba_rx1_mixer }, | |
12908 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, | |
12909 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12910 | .dac_nids = alc262_dac_nids, | |
12911 | .hp_nid = 0x03, | |
12912 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12913 | .channel_mode = alc262_modes, | |
12914 | .input_mux = &alc262_capture_source, | |
12915 | .unsol_event = alc262_hippo_unsol_event, | |
12916 | .setup = alc262_hippo_setup, | |
12917 | .init_hook = alc262_hippo_automute, | |
12918 | }, | |
12919 | [ALC262_TYAN] = { | |
12920 | .mixers = { alc262_tyan_mixer }, | |
12921 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, | |
12922 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12923 | .dac_nids = alc262_dac_nids, | |
12924 | .hp_nid = 0x02, | |
12925 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12926 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12927 | .channel_mode = alc262_modes, | |
12928 | .input_mux = &alc262_capture_source, | |
12929 | .unsol_event = alc_automute_amp_unsol_event, | |
12930 | .setup = alc262_tyan_setup, | |
12931 | .init_hook = alc_automute_amp, | |
12932 | }, | |
12933 | }; | |
12934 | ||
12935 | static int patch_alc262(struct hda_codec *codec) | |
12936 | { | |
12937 | struct alc_spec *spec; | |
12938 | int board_config; | |
12939 | int err; | |
12940 | ||
12941 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
12942 | if (spec == NULL) | |
12943 | return -ENOMEM; | |
12944 | ||
12945 | codec->spec = spec; | |
12946 | #if 0 | |
12947 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is | |
12948 | * under-run | |
12949 | */ | |
12950 | { | |
12951 | int tmp; | |
12952 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
12953 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
12954 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
12955 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); | |
12956 | } | |
12957 | #endif | |
12958 | alc_auto_parse_customize_define(codec); | |
12959 | ||
12960 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | |
12961 | ||
12962 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, | |
12963 | alc262_models, | |
12964 | alc262_cfg_tbl); | |
12965 | ||
12966 | if (board_config < 0) { | |
12967 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
12968 | codec->chip_name); | |
12969 | board_config = ALC262_AUTO; | |
12970 | } | |
12971 | ||
12972 | if (board_config == ALC262_AUTO) { | |
12973 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); | |
12974 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | |
12975 | } | |
12976 | ||
12977 | if (board_config == ALC262_AUTO) { | |
12978 | /* automatic parse from the BIOS config */ | |
12979 | err = alc262_parse_auto_config(codec); | |
12980 | if (err < 0) { | |
12981 | alc_free(codec); | |
12982 | return err; | |
12983 | } else if (!err) { | |
12984 | printk(KERN_INFO | |
12985 | "hda_codec: Cannot set up configuration " | |
12986 | "from BIOS. Using base mode...\n"); | |
12987 | board_config = ALC262_BASIC; | |
12988 | } | |
12989 | } | |
12990 | ||
12991 | if (!spec->no_analog && has_cdefine_beep(codec)) { | |
12992 | err = snd_hda_attach_beep_device(codec, 0x1); | |
12993 | if (err < 0) { | |
12994 | alc_free(codec); | |
12995 | return err; | |
12996 | } | |
12997 | } | |
12998 | ||
12999 | if (board_config != ALC262_AUTO) | |
13000 | setup_preset(codec, &alc262_presets[board_config]); | |
13001 | ||
13002 | spec->stream_analog_playback = &alc262_pcm_analog_playback; | |
13003 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | |
13004 | ||
13005 | spec->stream_digital_playback = &alc262_pcm_digital_playback; | |
13006 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | |
13007 | ||
13008 | if (!spec->adc_nids && spec->input_mux) { | |
13009 | int i; | |
13010 | /* check whether the digital-mic has to be supported */ | |
13011 | for (i = 0; i < spec->input_mux->num_items; i++) { | |
13012 | if (spec->input_mux->items[i].index >= 9) | |
13013 | break; | |
13014 | } | |
13015 | if (i < spec->input_mux->num_items) { | |
13016 | /* use only ADC0 */ | |
13017 | spec->adc_nids = alc262_dmic_adc_nids; | |
13018 | spec->num_adc_nids = 1; | |
13019 | spec->capsrc_nids = alc262_dmic_capsrc_nids; | |
13020 | } else { | |
13021 | /* all analog inputs */ | |
13022 | /* check whether NID 0x07 is valid */ | |
13023 | unsigned int wcap = get_wcaps(codec, 0x07); | |
13024 | ||
13025 | /* get type */ | |
13026 | wcap = get_wcaps_type(wcap); | |
13027 | if (wcap != AC_WID_AUD_IN) { | |
13028 | spec->adc_nids = alc262_adc_nids_alt; | |
13029 | spec->num_adc_nids = | |
13030 | ARRAY_SIZE(alc262_adc_nids_alt); | |
13031 | spec->capsrc_nids = alc262_capsrc_nids_alt; | |
13032 | } else { | |
13033 | spec->adc_nids = alc262_adc_nids; | |
13034 | spec->num_adc_nids = | |
13035 | ARRAY_SIZE(alc262_adc_nids); | |
13036 | spec->capsrc_nids = alc262_capsrc_nids; | |
13037 | } | |
13038 | } | |
13039 | } | |
13040 | if (!spec->cap_mixer && !spec->no_analog) | |
13041 | set_capture_mixer(codec); | |
13042 | if (!spec->no_analog && has_cdefine_beep(codec)) | |
13043 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
13044 | ||
13045 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | |
13046 | ||
13047 | spec->vmaster_nid = 0x0c; | |
13048 | ||
13049 | codec->patch_ops = alc_patch_ops; | |
13050 | if (board_config == ALC262_AUTO) | |
13051 | spec->init_hook = alc262_auto_init; | |
13052 | ||
13053 | alc_init_jacks(codec); | |
13054 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
13055 | if (!spec->loopback.amplist) | |
13056 | spec->loopback.amplist = alc262_loopbacks; | |
13057 | #endif | |
13058 | ||
13059 | return 0; | |
13060 | } | |
13061 | ||
13062 | /* | |
13063 | * ALC268 channel source setting (2 channel) | |
13064 | */ | |
13065 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | |
13066 | #define alc268_modes alc260_modes | |
13067 | ||
13068 | static hda_nid_t alc268_dac_nids[2] = { | |
13069 | /* front, hp */ | |
13070 | 0x02, 0x03 | |
13071 | }; | |
13072 | ||
13073 | static hda_nid_t alc268_adc_nids[2] = { | |
13074 | /* ADC0-1 */ | |
13075 | 0x08, 0x07 | |
13076 | }; | |
13077 | ||
13078 | static hda_nid_t alc268_adc_nids_alt[1] = { | |
13079 | /* ADC0 */ | |
13080 | 0x08 | |
13081 | }; | |
13082 | ||
13083 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; | |
13084 | ||
13085 | static struct snd_kcontrol_new alc268_base_mixer[] = { | |
13086 | /* output mixer control */ | |
13087 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
13088 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13089 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
13090 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13091 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
13092 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
13093 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), | |
13094 | { } | |
13095 | }; | |
13096 | ||
13097 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { | |
13098 | /* output mixer control */ | |
13099 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
13100 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
13101 | ALC262_HIPPO_MASTER_SWITCH, | |
13102 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
13103 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
13104 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), | |
13105 | { } | |
13106 | }; | |
13107 | ||
13108 | /* bind Beep switches of both NID 0x0f and 0x10 */ | |
13109 | static struct hda_bind_ctls alc268_bind_beep_sw = { | |
13110 | .ops = &snd_hda_bind_sw, | |
13111 | .values = { | |
13112 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | |
13113 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | |
13114 | 0 | |
13115 | }, | |
13116 | }; | |
13117 | ||
13118 | static struct snd_kcontrol_new alc268_beep_mixer[] = { | |
13119 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | |
13120 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | |
13121 | { } | |
13122 | }; | |
13123 | ||
13124 | static struct hda_verb alc268_eapd_verbs[] = { | |
13125 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
13126 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
13127 | { } | |
13128 | }; | |
13129 | ||
13130 | /* Toshiba specific */ | |
13131 | static struct hda_verb alc268_toshiba_verbs[] = { | |
13132 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13133 | { } /* end */ | |
13134 | }; | |
13135 | ||
13136 | /* Acer specific */ | |
13137 | /* bind volumes of both NID 0x02 and 0x03 */ | |
13138 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { | |
13139 | .ops = &snd_hda_bind_vol, | |
13140 | .values = { | |
13141 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
13142 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
13143 | 0 | |
13144 | }, | |
13145 | }; | |
13146 | ||
13147 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
13148 | static void alc268_acer_automute(struct hda_codec *codec, int force) | |
13149 | { | |
13150 | struct alc_spec *spec = codec->spec; | |
13151 | unsigned int mute; | |
13152 | ||
13153 | if (force || !spec->sense_updated) { | |
13154 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); | |
13155 | spec->sense_updated = 1; | |
13156 | } | |
13157 | if (spec->jack_present) | |
13158 | mute = HDA_AMP_MUTE; /* mute internal speaker */ | |
13159 | else /* unmute internal speaker if necessary */ | |
13160 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
13161 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
13162 | HDA_AMP_MUTE, mute); | |
13163 | } | |
13164 | ||
13165 | ||
13166 | /* bind hp and internal speaker mute (with plug check) */ | |
13167 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, | |
13168 | struct snd_ctl_elem_value *ucontrol) | |
13169 | { | |
13170 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
13171 | long *valp = ucontrol->value.integer.value; | |
13172 | int change; | |
13173 | ||
13174 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); | |
13175 | if (change) | |
13176 | alc268_acer_automute(codec, 0); | |
13177 | return change; | |
13178 | } | |
13179 | ||
13180 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { | |
13181 | /* output mixer control */ | |
13182 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13183 | { | |
13184 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13185 | .name = "Master Playback Switch", | |
13186 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
13187 | .info = snd_hda_mixer_amp_switch_info, | |
13188 | .get = snd_hda_mixer_amp_switch_get, | |
13189 | .put = alc268_acer_master_sw_put, | |
13190 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13191 | }, | |
13192 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), | |
13193 | { } | |
13194 | }; | |
13195 | ||
13196 | static struct snd_kcontrol_new alc268_acer_mixer[] = { | |
13197 | /* output mixer control */ | |
13198 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13199 | { | |
13200 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13201 | .name = "Master Playback Switch", | |
13202 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
13203 | .info = snd_hda_mixer_amp_switch_info, | |
13204 | .get = snd_hda_mixer_amp_switch_get, | |
13205 | .put = alc268_acer_master_sw_put, | |
13206 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13207 | }, | |
13208 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
13209 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
13210 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), | |
13211 | { } | |
13212 | }; | |
13213 | ||
13214 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { | |
13215 | /* output mixer control */ | |
13216 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13217 | { | |
13218 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13219 | .name = "Master Playback Switch", | |
13220 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
13221 | .info = snd_hda_mixer_amp_switch_info, | |
13222 | .get = snd_hda_mixer_amp_switch_get, | |
13223 | .put = alc268_acer_master_sw_put, | |
13224 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13225 | }, | |
13226 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
13227 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), | |
13228 | { } | |
13229 | }; | |
13230 | ||
13231 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { | |
13232 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13233 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13234 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13235 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13236 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
13237 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, | |
13238 | { } | |
13239 | }; | |
13240 | ||
13241 | static struct hda_verb alc268_acer_verbs[] = { | |
13242 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ | |
13243 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13244 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13245 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13246 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13247 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13248 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13249 | { } | |
13250 | }; | |
13251 | ||
13252 | /* unsolicited event for HP jack sensing */ | |
13253 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event | |
13254 | #define alc268_toshiba_setup alc262_hippo_setup | |
13255 | #define alc268_toshiba_automute alc262_hippo_automute | |
13256 | ||
13257 | static void alc268_acer_unsol_event(struct hda_codec *codec, | |
13258 | unsigned int res) | |
13259 | { | |
13260 | if ((res >> 26) != ALC880_HP_EVENT) | |
13261 | return; | |
13262 | alc268_acer_automute(codec, 1); | |
13263 | } | |
13264 | ||
13265 | static void alc268_acer_init_hook(struct hda_codec *codec) | |
13266 | { | |
13267 | alc268_acer_automute(codec, 1); | |
13268 | } | |
13269 | ||
13270 | /* toggle speaker-output according to the hp-jack state */ | |
13271 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | |
13272 | { | |
13273 | unsigned int present; | |
13274 | unsigned char bits; | |
13275 | ||
13276 | present = snd_hda_jack_detect(codec, 0x15); | |
13277 | bits = present ? HDA_AMP_MUTE : 0; | |
13278 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, | |
13279 | HDA_AMP_MUTE, bits); | |
13280 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, | |
13281 | HDA_AMP_MUTE, bits); | |
13282 | } | |
13283 | ||
13284 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, | |
13285 | unsigned int res) | |
13286 | { | |
13287 | switch (res >> 26) { | |
13288 | case ALC880_HP_EVENT: | |
13289 | alc268_aspire_one_speaker_automute(codec); | |
13290 | break; | |
13291 | case ALC880_MIC_EVENT: | |
13292 | alc_mic_automute(codec); | |
13293 | break; | |
13294 | } | |
13295 | } | |
13296 | ||
13297 | static void alc268_acer_lc_setup(struct hda_codec *codec) | |
13298 | { | |
13299 | struct alc_spec *spec = codec->spec; | |
13300 | spec->ext_mic.pin = 0x18; | |
13301 | spec->ext_mic.mux_idx = 0; | |
13302 | spec->int_mic.pin = 0x12; | |
13303 | spec->int_mic.mux_idx = 6; | |
13304 | spec->auto_mic = 1; | |
13305 | } | |
13306 | ||
13307 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | |
13308 | { | |
13309 | alc268_aspire_one_speaker_automute(codec); | |
13310 | alc_mic_automute(codec); | |
13311 | } | |
13312 | ||
13313 | static struct snd_kcontrol_new alc268_dell_mixer[] = { | |
13314 | /* output mixer control */ | |
13315 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13316 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13317 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13318 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13319 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
13320 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
13321 | { } | |
13322 | }; | |
13323 | ||
13324 | static struct hda_verb alc268_dell_verbs[] = { | |
13325 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13326 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13327 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13328 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
13329 | { } | |
13330 | }; | |
13331 | ||
13332 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
13333 | static void alc268_dell_setup(struct hda_codec *codec) | |
13334 | { | |
13335 | struct alc_spec *spec = codec->spec; | |
13336 | ||
13337 | spec->autocfg.hp_pins[0] = 0x15; | |
13338 | spec->autocfg.speaker_pins[0] = 0x14; | |
13339 | spec->ext_mic.pin = 0x18; | |
13340 | spec->ext_mic.mux_idx = 0; | |
13341 | spec->int_mic.pin = 0x19; | |
13342 | spec->int_mic.mux_idx = 1; | |
13343 | spec->auto_mic = 1; | |
13344 | } | |
13345 | ||
13346 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { | |
13347 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
13348 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13349 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
13350 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13351 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13352 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), | |
13353 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
13354 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
13355 | { } | |
13356 | }; | |
13357 | ||
13358 | static struct hda_verb alc267_quanta_il1_verbs[] = { | |
13359 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13360 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
13361 | { } | |
13362 | }; | |
13363 | ||
13364 | static void alc267_quanta_il1_setup(struct hda_codec *codec) | |
13365 | { | |
13366 | struct alc_spec *spec = codec->spec; | |
13367 | spec->autocfg.hp_pins[0] = 0x15; | |
13368 | spec->autocfg.speaker_pins[0] = 0x14; | |
13369 | spec->ext_mic.pin = 0x18; | |
13370 | spec->ext_mic.mux_idx = 0; | |
13371 | spec->int_mic.pin = 0x19; | |
13372 | spec->int_mic.mux_idx = 1; | |
13373 | spec->auto_mic = 1; | |
13374 | } | |
13375 | ||
13376 | /* | |
13377 | * generic initialization of ADC, input mixers and output mixers | |
13378 | */ | |
13379 | static struct hda_verb alc268_base_init_verbs[] = { | |
13380 | /* Unmute DAC0-1 and set vol = 0 */ | |
13381 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13382 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13383 | ||
13384 | /* | |
13385 | * Set up output mixers (0x0c - 0x0e) | |
13386 | */ | |
13387 | /* set vol=0 to output mixers */ | |
13388 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13389 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13390 | ||
13391 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13392 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13393 | ||
13394 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
13395 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
13396 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
13397 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13398 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13399 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13400 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13401 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13402 | ||
13403 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13404 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13405 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13406 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13407 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13408 | ||
13409 | /* set PCBEEP vol = 0, mute connections */ | |
13410 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13411 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13412 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13413 | ||
13414 | /* Unmute Selector 23h,24h and set the default input to mic-in */ | |
13415 | ||
13416 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13417 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13418 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13419 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13420 | ||
13421 | { } | |
13422 | }; | |
13423 | ||
13424 | /* | |
13425 | * generic initialization of ADC, input mixers and output mixers | |
13426 | */ | |
13427 | static struct hda_verb alc268_volume_init_verbs[] = { | |
13428 | /* set output DAC */ | |
13429 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13430 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13431 | ||
13432 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13433 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13434 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13435 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13436 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13437 | ||
13438 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13439 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13440 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13441 | ||
13442 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13443 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13444 | ||
13445 | /* set PCBEEP vol = 0, mute connections */ | |
13446 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13447 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13448 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13449 | ||
13450 | { } | |
13451 | }; | |
13452 | ||
13453 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { | |
13454 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13455 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
13456 | { } /* end */ | |
13457 | }; | |
13458 | ||
13459 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { | |
13460 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13461 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
13462 | _DEFINE_CAPSRC(1), | |
13463 | { } /* end */ | |
13464 | }; | |
13465 | ||
13466 | static struct snd_kcontrol_new alc268_capture_mixer[] = { | |
13467 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13468 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
13469 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | |
13470 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | |
13471 | _DEFINE_CAPSRC(2), | |
13472 | { } /* end */ | |
13473 | }; | |
13474 | ||
13475 | static struct hda_input_mux alc268_capture_source = { | |
13476 | .num_items = 4, | |
13477 | .items = { | |
13478 | { "Mic", 0x0 }, | |
13479 | { "Front Mic", 0x1 }, | |
13480 | { "Line", 0x2 }, | |
13481 | { "CD", 0x3 }, | |
13482 | }, | |
13483 | }; | |
13484 | ||
13485 | static struct hda_input_mux alc268_acer_capture_source = { | |
13486 | .num_items = 3, | |
13487 | .items = { | |
13488 | { "Mic", 0x0 }, | |
13489 | { "Internal Mic", 0x1 }, | |
13490 | { "Line", 0x2 }, | |
13491 | }, | |
13492 | }; | |
13493 | ||
13494 | static struct hda_input_mux alc268_acer_dmic_capture_source = { | |
13495 | .num_items = 3, | |
13496 | .items = { | |
13497 | { "Mic", 0x0 }, | |
13498 | { "Internal Mic", 0x6 }, | |
13499 | { "Line", 0x2 }, | |
13500 | }, | |
13501 | }; | |
13502 | ||
13503 | #ifdef CONFIG_SND_DEBUG | |
13504 | static struct snd_kcontrol_new alc268_test_mixer[] = { | |
13505 | /* Volume widgets */ | |
13506 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13507 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13508 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
13509 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), | |
13510 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), | |
13511 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), | |
13512 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), | |
13513 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), | |
13514 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), | |
13515 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), | |
13516 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), | |
13517 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), | |
13518 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), | |
13519 | /* The below appears problematic on some hardwares */ | |
13520 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ | |
13521 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13522 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), | |
13523 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), | |
13524 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), | |
13525 | ||
13526 | /* Modes for retasking pin widgets */ | |
13527 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
13528 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
13529 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), | |
13530 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), | |
13531 | ||
13532 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
13533 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
13534 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
13535 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
13536 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
13537 | ||
13538 | /* Switches to allow the digital SPDIF output pin to be enabled. | |
13539 | * The ALC268 does not have an SPDIF input. | |
13540 | */ | |
13541 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), | |
13542 | ||
13543 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | |
13544 | * this output to turn on an external amplifier. | |
13545 | */ | |
13546 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
13547 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
13548 | ||
13549 | { } /* end */ | |
13550 | }; | |
13551 | #endif | |
13552 | ||
13553 | /* create input playback/capture controls for the given pin */ | |
13554 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
13555 | const char *ctlname, int idx) | |
13556 | { | |
13557 | hda_nid_t dac; | |
13558 | int err; | |
13559 | ||
13560 | switch (nid) { | |
13561 | case 0x14: | |
13562 | case 0x16: | |
13563 | dac = 0x02; | |
13564 | break; | |
13565 | case 0x15: | |
13566 | case 0x1a: /* ALC259/269 only */ | |
13567 | case 0x1b: /* ALC259/269 only */ | |
13568 | case 0x21: /* ALC269vb has this pin, too */ | |
13569 | dac = 0x03; | |
13570 | break; | |
13571 | default: | |
13572 | snd_printd(KERN_WARNING "hda_codec: " | |
13573 | "ignoring pin 0x%x as unknown\n", nid); | |
13574 | return 0; | |
13575 | } | |
13576 | if (spec->multiout.dac_nids[0] != dac && | |
13577 | spec->multiout.dac_nids[1] != dac) { | |
13578 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, | |
13579 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, | |
13580 | HDA_OUTPUT)); | |
13581 | if (err < 0) | |
13582 | return err; | |
13583 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
13584 | } | |
13585 | ||
13586 | if (nid != 0x16) | |
13587 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
13588 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | |
13589 | else /* mono */ | |
13590 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
13591 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); | |
13592 | if (err < 0) | |
13593 | return err; | |
13594 | return 0; | |
13595 | } | |
13596 | ||
13597 | /* add playback controls from the parsed DAC table */ | |
13598 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |
13599 | const struct auto_pin_cfg *cfg) | |
13600 | { | |
13601 | hda_nid_t nid; | |
13602 | int err; | |
13603 | ||
13604 | spec->multiout.dac_nids = spec->private_dac_nids; | |
13605 | ||
13606 | nid = cfg->line_out_pins[0]; | |
13607 | if (nid) { | |
13608 | const char *name; | |
13609 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
13610 | name = "Speaker"; | |
13611 | else | |
13612 | name = "Front"; | |
13613 | err = alc268_new_analog_output(spec, nid, name, 0); | |
13614 | if (err < 0) | |
13615 | return err; | |
13616 | } | |
13617 | ||
13618 | nid = cfg->speaker_pins[0]; | |
13619 | if (nid == 0x1d) { | |
13620 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", | |
13621 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
13622 | if (err < 0) | |
13623 | return err; | |
13624 | } else if (nid) { | |
13625 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); | |
13626 | if (err < 0) | |
13627 | return err; | |
13628 | } | |
13629 | nid = cfg->hp_pins[0]; | |
13630 | if (nid) { | |
13631 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); | |
13632 | if (err < 0) | |
13633 | return err; | |
13634 | } | |
13635 | ||
13636 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | |
13637 | if (nid == 0x16) { | |
13638 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", | |
13639 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); | |
13640 | if (err < 0) | |
13641 | return err; | |
13642 | } | |
13643 | return 0; | |
13644 | } | |
13645 | ||
13646 | /* create playback/capture controls for input pins */ | |
13647 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, | |
13648 | const struct auto_pin_cfg *cfg) | |
13649 | { | |
13650 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); | |
13651 | } | |
13652 | ||
13653 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, | |
13654 | hda_nid_t nid, int pin_type) | |
13655 | { | |
13656 | int idx; | |
13657 | ||
13658 | alc_set_pin_output(codec, nid, pin_type); | |
13659 | if (nid == 0x14 || nid == 0x16) | |
13660 | idx = 0; | |
13661 | else | |
13662 | idx = 1; | |
13663 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | |
13664 | } | |
13665 | ||
13666 | static void alc268_auto_init_multi_out(struct hda_codec *codec) | |
13667 | { | |
13668 | struct alc_spec *spec = codec->spec; | |
13669 | int i; | |
13670 | ||
13671 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
13672 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
13673 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
13674 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); | |
13675 | } | |
13676 | } | |
13677 | ||
13678 | static void alc268_auto_init_hp_out(struct hda_codec *codec) | |
13679 | { | |
13680 | struct alc_spec *spec = codec->spec; | |
13681 | hda_nid_t pin; | |
13682 | int i; | |
13683 | ||
13684 | for (i = 0; i < spec->autocfg.hp_outs; i++) { | |
13685 | pin = spec->autocfg.hp_pins[i]; | |
13686 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); | |
13687 | } | |
13688 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { | |
13689 | pin = spec->autocfg.speaker_pins[i]; | |
13690 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); | |
13691 | } | |
13692 | if (spec->autocfg.mono_out_pin) | |
13693 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, | |
13694 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
13695 | } | |
13696 | ||
13697 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | |
13698 | { | |
13699 | struct alc_spec *spec = codec->spec; | |
13700 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
13701 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
13702 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
13703 | unsigned int dac_vol1, dac_vol2; | |
13704 | ||
13705 | if (line_nid == 0x1d || speaker_nid == 0x1d) { | |
13706 | snd_hda_codec_write(codec, speaker_nid, 0, | |
13707 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
13708 | /* mute mixer inputs from 0x1d */ | |
13709 | snd_hda_codec_write(codec, 0x0f, 0, | |
13710 | AC_VERB_SET_AMP_GAIN_MUTE, | |
13711 | AMP_IN_UNMUTE(1)); | |
13712 | snd_hda_codec_write(codec, 0x10, 0, | |
13713 | AC_VERB_SET_AMP_GAIN_MUTE, | |
13714 | AMP_IN_UNMUTE(1)); | |
13715 | } else { | |
13716 | /* unmute mixer inputs from 0x1d */ | |
13717 | snd_hda_codec_write(codec, 0x0f, 0, | |
13718 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
13719 | snd_hda_codec_write(codec, 0x10, 0, | |
13720 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
13721 | } | |
13722 | ||
13723 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ | |
13724 | if (line_nid == 0x14) | |
13725 | dac_vol2 = AMP_OUT_ZERO; | |
13726 | else if (line_nid == 0x15) | |
13727 | dac_vol1 = AMP_OUT_ZERO; | |
13728 | if (hp_nid == 0x14) | |
13729 | dac_vol2 = AMP_OUT_ZERO; | |
13730 | else if (hp_nid == 0x15) | |
13731 | dac_vol1 = AMP_OUT_ZERO; | |
13732 | if (line_nid != 0x16 || hp_nid != 0x16 || | |
13733 | spec->autocfg.line_out_pins[1] != 0x16 || | |
13734 | spec->autocfg.line_out_pins[2] != 0x16) | |
13735 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; | |
13736 | ||
13737 | snd_hda_codec_write(codec, 0x02, 0, | |
13738 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); | |
13739 | snd_hda_codec_write(codec, 0x03, 0, | |
13740 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); | |
13741 | } | |
13742 | ||
13743 | /* pcm configuration: identical with ALC880 */ | |
13744 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback | |
13745 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture | |
13746 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture | |
13747 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback | |
13748 | ||
13749 | /* | |
13750 | * BIOS auto configuration | |
13751 | */ | |
13752 | static int alc268_parse_auto_config(struct hda_codec *codec) | |
13753 | { | |
13754 | struct alc_spec *spec = codec->spec; | |
13755 | int err; | |
13756 | static hda_nid_t alc268_ignore[] = { 0 }; | |
13757 | ||
13758 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
13759 | alc268_ignore); | |
13760 | if (err < 0) | |
13761 | return err; | |
13762 | if (!spec->autocfg.line_outs) { | |
13763 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
13764 | spec->multiout.max_channels = 2; | |
13765 | spec->no_analog = 1; | |
13766 | goto dig_only; | |
13767 | } | |
13768 | return 0; /* can't find valid BIOS pin config */ | |
13769 | } | |
13770 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
13771 | if (err < 0) | |
13772 | return err; | |
13773 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); | |
13774 | if (err < 0) | |
13775 | return err; | |
13776 | ||
13777 | spec->multiout.max_channels = 2; | |
13778 | ||
13779 | dig_only: | |
13780 | /* digital only support output */ | |
13781 | alc_auto_parse_digital(codec); | |
13782 | if (spec->kctls.list) | |
13783 | add_mixer(spec, spec->kctls.list); | |
13784 | ||
13785 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) | |
13786 | add_mixer(spec, alc268_beep_mixer); | |
13787 | ||
13788 | add_verb(spec, alc268_volume_init_verbs); | |
13789 | spec->num_mux_defs = 2; | |
13790 | spec->input_mux = &spec->private_imux[0]; | |
13791 | ||
13792 | err = alc_auto_add_mic_boost(codec); | |
13793 | if (err < 0) | |
13794 | return err; | |
13795 | ||
13796 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
13797 | ||
13798 | return 1; | |
13799 | } | |
13800 | ||
13801 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input | |
13802 | ||
13803 | /* init callback for auto-configuration model -- overriding the default init */ | |
13804 | static void alc268_auto_init(struct hda_codec *codec) | |
13805 | { | |
13806 | struct alc_spec *spec = codec->spec; | |
13807 | alc268_auto_init_multi_out(codec); | |
13808 | alc268_auto_init_hp_out(codec); | |
13809 | alc268_auto_init_mono_speaker_out(codec); | |
13810 | alc268_auto_init_analog_input(codec); | |
13811 | alc_auto_init_digital(codec); | |
13812 | if (spec->unsol_event) | |
13813 | alc_inithook(codec); | |
13814 | } | |
13815 | ||
13816 | /* | |
13817 | * configuration and preset | |
13818 | */ | |
13819 | static const char * const alc268_models[ALC268_MODEL_LAST] = { | |
13820 | [ALC267_QUANTA_IL1] = "quanta-il1", | |
13821 | [ALC268_3ST] = "3stack", | |
13822 | [ALC268_TOSHIBA] = "toshiba", | |
13823 | [ALC268_ACER] = "acer", | |
13824 | [ALC268_ACER_DMIC] = "acer-dmic", | |
13825 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", | |
13826 | [ALC268_DELL] = "dell", | |
13827 | [ALC268_ZEPTO] = "zepto", | |
13828 | #ifdef CONFIG_SND_DEBUG | |
13829 | [ALC268_TEST] = "test", | |
13830 | #endif | |
13831 | [ALC268_AUTO] = "auto", | |
13832 | }; | |
13833 | ||
13834 | static struct snd_pci_quirk alc268_cfg_tbl[] = { | |
13835 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), | |
13836 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), | |
13837 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), | |
13838 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), | |
13839 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), | |
13840 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", | |
13841 | ALC268_ACER_ASPIRE_ONE), | |
13842 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), | |
13843 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, | |
13844 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), | |
13845 | /* almost compatible with toshiba but with optional digital outs; | |
13846 | * auto-probing seems working fine | |
13847 | */ | |
13848 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", | |
13849 | ALC268_AUTO), | |
13850 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), | |
13851 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), | |
13852 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), | |
13853 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), | |
13854 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), | |
13855 | {} | |
13856 | }; | |
13857 | ||
13858 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ | |
13859 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { | |
13860 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), | |
13861 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), | |
13862 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", | |
13863 | ALC268_TOSHIBA), | |
13864 | {} | |
13865 | }; | |
13866 | ||
13867 | static struct alc_config_preset alc268_presets[] = { | |
13868 | [ALC267_QUANTA_IL1] = { | |
13869 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, | |
13870 | alc268_capture_nosrc_mixer }, | |
13871 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13872 | alc267_quanta_il1_verbs }, | |
13873 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13874 | .dac_nids = alc268_dac_nids, | |
13875 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13876 | .adc_nids = alc268_adc_nids_alt, | |
13877 | .hp_nid = 0x03, | |
13878 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13879 | .channel_mode = alc268_modes, | |
13880 | .unsol_event = alc_sku_unsol_event, | |
13881 | .setup = alc267_quanta_il1_setup, | |
13882 | .init_hook = alc_inithook, | |
13883 | }, | |
13884 | [ALC268_3ST] = { | |
13885 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | |
13886 | alc268_beep_mixer }, | |
13887 | .init_verbs = { alc268_base_init_verbs }, | |
13888 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13889 | .dac_nids = alc268_dac_nids, | |
13890 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13891 | .adc_nids = alc268_adc_nids_alt, | |
13892 | .capsrc_nids = alc268_capsrc_nids, | |
13893 | .hp_nid = 0x03, | |
13894 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13895 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13896 | .channel_mode = alc268_modes, | |
13897 | .input_mux = &alc268_capture_source, | |
13898 | }, | |
13899 | [ALC268_TOSHIBA] = { | |
13900 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, | |
13901 | alc268_beep_mixer }, | |
13902 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13903 | alc268_toshiba_verbs }, | |
13904 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13905 | .dac_nids = alc268_dac_nids, | |
13906 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13907 | .adc_nids = alc268_adc_nids_alt, | |
13908 | .capsrc_nids = alc268_capsrc_nids, | |
13909 | .hp_nid = 0x03, | |
13910 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13911 | .channel_mode = alc268_modes, | |
13912 | .input_mux = &alc268_capture_source, | |
13913 | .unsol_event = alc268_toshiba_unsol_event, | |
13914 | .setup = alc268_toshiba_setup, | |
13915 | .init_hook = alc268_toshiba_automute, | |
13916 | }, | |
13917 | [ALC268_ACER] = { | |
13918 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, | |
13919 | alc268_beep_mixer }, | |
13920 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13921 | alc268_acer_verbs }, | |
13922 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13923 | .dac_nids = alc268_dac_nids, | |
13924 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13925 | .adc_nids = alc268_adc_nids_alt, | |
13926 | .capsrc_nids = alc268_capsrc_nids, | |
13927 | .hp_nid = 0x02, | |
13928 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13929 | .channel_mode = alc268_modes, | |
13930 | .input_mux = &alc268_acer_capture_source, | |
13931 | .unsol_event = alc268_acer_unsol_event, | |
13932 | .init_hook = alc268_acer_init_hook, | |
13933 | }, | |
13934 | [ALC268_ACER_DMIC] = { | |
13935 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, | |
13936 | alc268_beep_mixer }, | |
13937 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13938 | alc268_acer_verbs }, | |
13939 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13940 | .dac_nids = alc268_dac_nids, | |
13941 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13942 | .adc_nids = alc268_adc_nids_alt, | |
13943 | .capsrc_nids = alc268_capsrc_nids, | |
13944 | .hp_nid = 0x02, | |
13945 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13946 | .channel_mode = alc268_modes, | |
13947 | .input_mux = &alc268_acer_dmic_capture_source, | |
13948 | .unsol_event = alc268_acer_unsol_event, | |
13949 | .init_hook = alc268_acer_init_hook, | |
13950 | }, | |
13951 | [ALC268_ACER_ASPIRE_ONE] = { | |
13952 | .mixers = { alc268_acer_aspire_one_mixer, | |
13953 | alc268_beep_mixer, | |
13954 | alc268_capture_nosrc_mixer }, | |
13955 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13956 | alc268_acer_aspire_one_verbs }, | |
13957 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13958 | .dac_nids = alc268_dac_nids, | |
13959 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13960 | .adc_nids = alc268_adc_nids_alt, | |
13961 | .capsrc_nids = alc268_capsrc_nids, | |
13962 | .hp_nid = 0x03, | |
13963 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13964 | .channel_mode = alc268_modes, | |
13965 | .unsol_event = alc268_acer_lc_unsol_event, | |
13966 | .setup = alc268_acer_lc_setup, | |
13967 | .init_hook = alc268_acer_lc_init_hook, | |
13968 | }, | |
13969 | [ALC268_DELL] = { | |
13970 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, | |
13971 | alc268_capture_nosrc_mixer }, | |
13972 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13973 | alc268_dell_verbs }, | |
13974 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13975 | .dac_nids = alc268_dac_nids, | |
13976 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13977 | .adc_nids = alc268_adc_nids_alt, | |
13978 | .capsrc_nids = alc268_capsrc_nids, | |
13979 | .hp_nid = 0x02, | |
13980 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13981 | .channel_mode = alc268_modes, | |
13982 | .unsol_event = alc_sku_unsol_event, | |
13983 | .setup = alc268_dell_setup, | |
13984 | .init_hook = alc_inithook, | |
13985 | }, | |
13986 | [ALC268_ZEPTO] = { | |
13987 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | |
13988 | alc268_beep_mixer }, | |
13989 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13990 | alc268_toshiba_verbs }, | |
13991 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13992 | .dac_nids = alc268_dac_nids, | |
13993 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13994 | .adc_nids = alc268_adc_nids_alt, | |
13995 | .capsrc_nids = alc268_capsrc_nids, | |
13996 | .hp_nid = 0x03, | |
13997 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13998 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13999 | .channel_mode = alc268_modes, | |
14000 | .input_mux = &alc268_capture_source, | |
14001 | .setup = alc268_toshiba_setup, | |
14002 | .init_hook = alc268_toshiba_automute, | |
14003 | }, | |
14004 | #ifdef CONFIG_SND_DEBUG | |
14005 | [ALC268_TEST] = { | |
14006 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, | |
14007 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
14008 | alc268_volume_init_verbs }, | |
14009 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
14010 | .dac_nids = alc268_dac_nids, | |
14011 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
14012 | .adc_nids = alc268_adc_nids_alt, | |
14013 | .capsrc_nids = alc268_capsrc_nids, | |
14014 | .hp_nid = 0x03, | |
14015 | .dig_out_nid = ALC268_DIGOUT_NID, | |
14016 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
14017 | .channel_mode = alc268_modes, | |
14018 | .input_mux = &alc268_capture_source, | |
14019 | }, | |
14020 | #endif | |
14021 | }; | |
14022 | ||
14023 | static int patch_alc268(struct hda_codec *codec) | |
14024 | { | |
14025 | struct alc_spec *spec; | |
14026 | int board_config; | |
14027 | int i, has_beep, err; | |
14028 | ||
14029 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
14030 | if (spec == NULL) | |
14031 | return -ENOMEM; | |
14032 | ||
14033 | codec->spec = spec; | |
14034 | ||
14035 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, | |
14036 | alc268_models, | |
14037 | alc268_cfg_tbl); | |
14038 | ||
14039 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) | |
14040 | board_config = snd_hda_check_board_codec_sid_config(codec, | |
14041 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); | |
14042 | ||
14043 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { | |
14044 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
14045 | codec->chip_name); | |
14046 | board_config = ALC268_AUTO; | |
14047 | } | |
14048 | ||
14049 | if (board_config == ALC268_AUTO) { | |
14050 | /* automatic parse from the BIOS config */ | |
14051 | err = alc268_parse_auto_config(codec); | |
14052 | if (err < 0) { | |
14053 | alc_free(codec); | |
14054 | return err; | |
14055 | } else if (!err) { | |
14056 | printk(KERN_INFO | |
14057 | "hda_codec: Cannot set up configuration " | |
14058 | "from BIOS. Using base mode...\n"); | |
14059 | board_config = ALC268_3ST; | |
14060 | } | |
14061 | } | |
14062 | ||
14063 | if (board_config != ALC268_AUTO) | |
14064 | setup_preset(codec, &alc268_presets[board_config]); | |
14065 | ||
14066 | spec->stream_analog_playback = &alc268_pcm_analog_playback; | |
14067 | spec->stream_analog_capture = &alc268_pcm_analog_capture; | |
14068 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; | |
14069 | ||
14070 | spec->stream_digital_playback = &alc268_pcm_digital_playback; | |
14071 | ||
14072 | has_beep = 0; | |
14073 | for (i = 0; i < spec->num_mixers; i++) { | |
14074 | if (spec->mixers[i] == alc268_beep_mixer) { | |
14075 | has_beep = 1; | |
14076 | break; | |
14077 | } | |
14078 | } | |
14079 | ||
14080 | if (has_beep) { | |
14081 | err = snd_hda_attach_beep_device(codec, 0x1); | |
14082 | if (err < 0) { | |
14083 | alc_free(codec); | |
14084 | return err; | |
14085 | } | |
14086 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) | |
14087 | /* override the amp caps for beep generator */ | |
14088 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | |
14089 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | | |
14090 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
14091 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
14092 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
14093 | } | |
14094 | ||
14095 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { | |
14096 | /* check whether NID 0x07 is valid */ | |
14097 | unsigned int wcap = get_wcaps(codec, 0x07); | |
14098 | int i; | |
14099 | ||
14100 | spec->capsrc_nids = alc268_capsrc_nids; | |
14101 | /* get type */ | |
14102 | wcap = get_wcaps_type(wcap); | |
14103 | if (spec->auto_mic || | |
14104 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
14105 | spec->adc_nids = alc268_adc_nids_alt; | |
14106 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | |
14107 | if (spec->auto_mic) | |
14108 | fixup_automic_adc(codec); | |
14109 | if (spec->auto_mic || spec->input_mux->num_items == 1) | |
14110 | add_mixer(spec, alc268_capture_nosrc_mixer); | |
14111 | else | |
14112 | add_mixer(spec, alc268_capture_alt_mixer); | |
14113 | } else { | |
14114 | spec->adc_nids = alc268_adc_nids; | |
14115 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | |
14116 | add_mixer(spec, alc268_capture_mixer); | |
14117 | } | |
14118 | /* set default input source */ | |
14119 | for (i = 0; i < spec->num_adc_nids; i++) | |
14120 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | |
14121 | 0, AC_VERB_SET_CONNECT_SEL, | |
14122 | i < spec->num_mux_defs ? | |
14123 | spec->input_mux[i].items[0].index : | |
14124 | spec->input_mux->items[0].index); | |
14125 | } | |
14126 | ||
14127 | spec->vmaster_nid = 0x02; | |
14128 | ||
14129 | codec->patch_ops = alc_patch_ops; | |
14130 | if (board_config == ALC268_AUTO) | |
14131 | spec->init_hook = alc268_auto_init; | |
14132 | ||
14133 | alc_init_jacks(codec); | |
14134 | ||
14135 | return 0; | |
14136 | } | |
14137 | ||
14138 | /* | |
14139 | * ALC269 channel source setting (2 channel) | |
14140 | */ | |
14141 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID | |
14142 | ||
14143 | #define alc269_dac_nids alc260_dac_nids | |
14144 | ||
14145 | static hda_nid_t alc269_adc_nids[1] = { | |
14146 | /* ADC1 */ | |
14147 | 0x08, | |
14148 | }; | |
14149 | ||
14150 | static hda_nid_t alc269_capsrc_nids[1] = { | |
14151 | 0x23, | |
14152 | }; | |
14153 | ||
14154 | static hda_nid_t alc269vb_adc_nids[1] = { | |
14155 | /* ADC1 */ | |
14156 | 0x09, | |
14157 | }; | |
14158 | ||
14159 | static hda_nid_t alc269vb_capsrc_nids[1] = { | |
14160 | 0x22, | |
14161 | }; | |
14162 | ||
14163 | static hda_nid_t alc269_adc_candidates[] = { | |
14164 | 0x08, 0x09, 0x07, | |
14165 | }; | |
14166 | ||
14167 | #define alc269_modes alc260_modes | |
14168 | #define alc269_capture_source alc880_lg_lw_capture_source | |
14169 | ||
14170 | static struct snd_kcontrol_new alc269_base_mixer[] = { | |
14171 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14172 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
14173 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
14174 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
14175 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14176 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14177 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
14178 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
14179 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
14180 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
14181 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
14182 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
14183 | { } /* end */ | |
14184 | }; | |
14185 | ||
14186 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { | |
14187 | /* output mixer control */ | |
14188 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
14189 | { | |
14190 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14191 | .name = "Master Playback Switch", | |
14192 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
14193 | .info = snd_hda_mixer_amp_switch_info, | |
14194 | .get = snd_hda_mixer_amp_switch_get, | |
14195 | .put = alc268_acer_master_sw_put, | |
14196 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14197 | }, | |
14198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14200 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
14201 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
14202 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
14203 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
14204 | { } | |
14205 | }; | |
14206 | ||
14207 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { | |
14208 | /* output mixer control */ | |
14209 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
14210 | { | |
14211 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14212 | .name = "Master Playback Switch", | |
14213 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
14214 | .info = snd_hda_mixer_amp_switch_info, | |
14215 | .get = snd_hda_mixer_amp_switch_get, | |
14216 | .put = alc268_acer_master_sw_put, | |
14217 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14218 | }, | |
14219 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14220 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14221 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
14222 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
14223 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
14224 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
14225 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
14226 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
14227 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), | |
14228 | { } | |
14229 | }; | |
14230 | ||
14231 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { | |
14232 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
14233 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14234 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
14235 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
14236 | { } /* end */ | |
14237 | }; | |
14238 | ||
14239 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { | |
14240 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
14241 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14242 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
14243 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
14244 | { } /* end */ | |
14245 | }; | |
14246 | ||
14247 | static struct snd_kcontrol_new alc269_asus_mixer[] = { | |
14248 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14249 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
14250 | { } /* end */ | |
14251 | }; | |
14252 | ||
14253 | /* capture mixer elements */ | |
14254 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { | |
14255 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
14256 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
14257 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
14258 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
14259 | { } /* end */ | |
14260 | }; | |
14261 | ||
14262 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { | |
14263 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
14264 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
14265 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
14266 | { } /* end */ | |
14267 | }; | |
14268 | ||
14269 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { | |
14270 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
14271 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
14272 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
14273 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
14274 | { } /* end */ | |
14275 | }; | |
14276 | ||
14277 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { | |
14278 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
14279 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
14280 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
14281 | { } /* end */ | |
14282 | }; | |
14283 | ||
14284 | /* FSC amilo */ | |
14285 | #define alc269_fujitsu_mixer alc269_laptop_mixer | |
14286 | ||
14287 | static struct hda_verb alc269_quanta_fl1_verbs[] = { | |
14288 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14289 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14290 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14291 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
14292 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14293 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14294 | { } | |
14295 | }; | |
14296 | ||
14297 | static struct hda_verb alc269_lifebook_verbs[] = { | |
14298 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14299 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14300 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14301 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14302 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
14303 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14304 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14305 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
14306 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14307 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14308 | { } | |
14309 | }; | |
14310 | ||
14311 | /* toggle speaker-output according to the hp-jack state */ | |
14312 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) | |
14313 | { | |
14314 | unsigned int present; | |
14315 | unsigned char bits; | |
14316 | ||
14317 | present = snd_hda_jack_detect(codec, 0x15); | |
14318 | bits = present ? HDA_AMP_MUTE : 0; | |
14319 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
14320 | HDA_AMP_MUTE, bits); | |
14321 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
14322 | HDA_AMP_MUTE, bits); | |
14323 | ||
14324 | snd_hda_codec_write(codec, 0x20, 0, | |
14325 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14326 | snd_hda_codec_write(codec, 0x20, 0, | |
14327 | AC_VERB_SET_PROC_COEF, 0x680); | |
14328 | ||
14329 | snd_hda_codec_write(codec, 0x20, 0, | |
14330 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14331 | snd_hda_codec_write(codec, 0x20, 0, | |
14332 | AC_VERB_SET_PROC_COEF, 0x480); | |
14333 | } | |
14334 | ||
14335 | /* toggle speaker-output according to the hp-jacks state */ | |
14336 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) | |
14337 | { | |
14338 | unsigned int present; | |
14339 | unsigned char bits; | |
14340 | ||
14341 | /* Check laptop headphone socket */ | |
14342 | present = snd_hda_jack_detect(codec, 0x15); | |
14343 | ||
14344 | /* Check port replicator headphone socket */ | |
14345 | present |= snd_hda_jack_detect(codec, 0x1a); | |
14346 | ||
14347 | bits = present ? HDA_AMP_MUTE : 0; | |
14348 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
14349 | HDA_AMP_MUTE, bits); | |
14350 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
14351 | HDA_AMP_MUTE, bits); | |
14352 | ||
14353 | snd_hda_codec_write(codec, 0x20, 0, | |
14354 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14355 | snd_hda_codec_write(codec, 0x20, 0, | |
14356 | AC_VERB_SET_PROC_COEF, 0x680); | |
14357 | ||
14358 | snd_hda_codec_write(codec, 0x20, 0, | |
14359 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14360 | snd_hda_codec_write(codec, 0x20, 0, | |
14361 | AC_VERB_SET_PROC_COEF, 0x480); | |
14362 | } | |
14363 | ||
14364 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) | |
14365 | { | |
14366 | unsigned int present_laptop; | |
14367 | unsigned int present_dock; | |
14368 | ||
14369 | present_laptop = snd_hda_jack_detect(codec, 0x18); | |
14370 | present_dock = snd_hda_jack_detect(codec, 0x1b); | |
14371 | ||
14372 | /* Laptop mic port overrides dock mic port, design decision */ | |
14373 | if (present_dock) | |
14374 | snd_hda_codec_write(codec, 0x23, 0, | |
14375 | AC_VERB_SET_CONNECT_SEL, 0x3); | |
14376 | if (present_laptop) | |
14377 | snd_hda_codec_write(codec, 0x23, 0, | |
14378 | AC_VERB_SET_CONNECT_SEL, 0x0); | |
14379 | if (!present_dock && !present_laptop) | |
14380 | snd_hda_codec_write(codec, 0x23, 0, | |
14381 | AC_VERB_SET_CONNECT_SEL, 0x1); | |
14382 | } | |
14383 | ||
14384 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, | |
14385 | unsigned int res) | |
14386 | { | |
14387 | switch (res >> 26) { | |
14388 | case ALC880_HP_EVENT: | |
14389 | alc269_quanta_fl1_speaker_automute(codec); | |
14390 | break; | |
14391 | case ALC880_MIC_EVENT: | |
14392 | alc_mic_automute(codec); | |
14393 | break; | |
14394 | } | |
14395 | } | |
14396 | ||
14397 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, | |
14398 | unsigned int res) | |
14399 | { | |
14400 | if ((res >> 26) == ALC880_HP_EVENT) | |
14401 | alc269_lifebook_speaker_automute(codec); | |
14402 | if ((res >> 26) == ALC880_MIC_EVENT) | |
14403 | alc269_lifebook_mic_autoswitch(codec); | |
14404 | } | |
14405 | ||
14406 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) | |
14407 | { | |
14408 | struct alc_spec *spec = codec->spec; | |
14409 | spec->autocfg.hp_pins[0] = 0x15; | |
14410 | spec->autocfg.speaker_pins[0] = 0x14; | |
14411 | spec->ext_mic.pin = 0x18; | |
14412 | spec->ext_mic.mux_idx = 0; | |
14413 | spec->int_mic.pin = 0x19; | |
14414 | spec->int_mic.mux_idx = 1; | |
14415 | spec->auto_mic = 1; | |
14416 | } | |
14417 | ||
14418 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) | |
14419 | { | |
14420 | alc269_quanta_fl1_speaker_automute(codec); | |
14421 | alc_mic_automute(codec); | |
14422 | } | |
14423 | ||
14424 | static void alc269_lifebook_init_hook(struct hda_codec *codec) | |
14425 | { | |
14426 | alc269_lifebook_speaker_automute(codec); | |
14427 | alc269_lifebook_mic_autoswitch(codec); | |
14428 | } | |
14429 | ||
14430 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { | |
14431 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14432 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, | |
14433 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14434 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14435 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14436 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14437 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14438 | {} | |
14439 | }; | |
14440 | ||
14441 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { | |
14442 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14443 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14444 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14445 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, | |
14446 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14447 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14448 | {} | |
14449 | }; | |
14450 | ||
14451 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { | |
14452 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14453 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
14454 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14455 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14456 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14457 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14458 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14459 | {} | |
14460 | }; | |
14461 | ||
14462 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { | |
14463 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14464 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14465 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14466 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14467 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14468 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14469 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14470 | {} | |
14471 | }; | |
14472 | ||
14473 | static struct hda_verb alc271_acer_dmic_verbs[] = { | |
14474 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, | |
14475 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, | |
14476 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14477 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14478 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14479 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14480 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14481 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14482 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14483 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, | |
14484 | { } | |
14485 | }; | |
14486 | ||
14487 | /* toggle speaker-output according to the hp-jack state */ | |
14488 | static void alc269_speaker_automute(struct hda_codec *codec) | |
14489 | { | |
14490 | struct alc_spec *spec = codec->spec; | |
14491 | unsigned int nid = spec->autocfg.hp_pins[0]; | |
14492 | unsigned int present; | |
14493 | unsigned char bits; | |
14494 | ||
14495 | present = snd_hda_jack_detect(codec, nid); | |
14496 | bits = present ? HDA_AMP_MUTE : 0; | |
14497 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
14498 | HDA_AMP_MUTE, bits); | |
14499 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
14500 | HDA_AMP_MUTE, bits); | |
14501 | alc_report_jack(codec, nid); | |
14502 | } | |
14503 | ||
14504 | /* unsolicited event for HP jack sensing */ | |
14505 | static void alc269_laptop_unsol_event(struct hda_codec *codec, | |
14506 | unsigned int res) | |
14507 | { | |
14508 | switch (res >> 26) { | |
14509 | case ALC880_HP_EVENT: | |
14510 | alc269_speaker_automute(codec); | |
14511 | break; | |
14512 | case ALC880_MIC_EVENT: | |
14513 | alc_mic_automute(codec); | |
14514 | break; | |
14515 | } | |
14516 | } | |
14517 | ||
14518 | static void alc269_laptop_amic_setup(struct hda_codec *codec) | |
14519 | { | |
14520 | struct alc_spec *spec = codec->spec; | |
14521 | spec->autocfg.hp_pins[0] = 0x15; | |
14522 | spec->autocfg.speaker_pins[0] = 0x14; | |
14523 | spec->ext_mic.pin = 0x18; | |
14524 | spec->ext_mic.mux_idx = 0; | |
14525 | spec->int_mic.pin = 0x19; | |
14526 | spec->int_mic.mux_idx = 1; | |
14527 | spec->auto_mic = 1; | |
14528 | } | |
14529 | ||
14530 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) | |
14531 | { | |
14532 | struct alc_spec *spec = codec->spec; | |
14533 | spec->autocfg.hp_pins[0] = 0x15; | |
14534 | spec->autocfg.speaker_pins[0] = 0x14; | |
14535 | spec->ext_mic.pin = 0x18; | |
14536 | spec->ext_mic.mux_idx = 0; | |
14537 | spec->int_mic.pin = 0x12; | |
14538 | spec->int_mic.mux_idx = 5; | |
14539 | spec->auto_mic = 1; | |
14540 | } | |
14541 | ||
14542 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) | |
14543 | { | |
14544 | struct alc_spec *spec = codec->spec; | |
14545 | spec->autocfg.hp_pins[0] = 0x21; | |
14546 | spec->autocfg.speaker_pins[0] = 0x14; | |
14547 | spec->ext_mic.pin = 0x18; | |
14548 | spec->ext_mic.mux_idx = 0; | |
14549 | spec->int_mic.pin = 0x19; | |
14550 | spec->int_mic.mux_idx = 1; | |
14551 | spec->auto_mic = 1; | |
14552 | } | |
14553 | ||
14554 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | |
14555 | { | |
14556 | struct alc_spec *spec = codec->spec; | |
14557 | spec->autocfg.hp_pins[0] = 0x21; | |
14558 | spec->autocfg.speaker_pins[0] = 0x14; | |
14559 | spec->ext_mic.pin = 0x18; | |
14560 | spec->ext_mic.mux_idx = 0; | |
14561 | spec->int_mic.pin = 0x12; | |
14562 | spec->int_mic.mux_idx = 6; | |
14563 | spec->auto_mic = 1; | |
14564 | } | |
14565 | ||
14566 | static void alc269_laptop_inithook(struct hda_codec *codec) | |
14567 | { | |
14568 | alc269_speaker_automute(codec); | |
14569 | alc_mic_automute(codec); | |
14570 | } | |
14571 | ||
14572 | /* | |
14573 | * generic initialization of ADC, input mixers and output mixers | |
14574 | */ | |
14575 | static struct hda_verb alc269_init_verbs[] = { | |
14576 | /* | |
14577 | * Unmute ADC0 and set the default input to mic-in | |
14578 | */ | |
14579 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14580 | ||
14581 | /* | |
14582 | * Set up output mixers (0x02 - 0x03) | |
14583 | */ | |
14584 | /* set vol=0 to output mixers */ | |
14585 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14586 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14587 | ||
14588 | /* set up input amps for analog loopback */ | |
14589 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
14590 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14592 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14593 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14594 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14595 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14596 | ||
14597 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14598 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14599 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14600 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14601 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14602 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14603 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14604 | ||
14605 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14606 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14607 | ||
14608 | /* FIXME: use Mux-type input source selection */ | |
14609 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | |
14610 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
14611 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14612 | ||
14613 | /* set EAPD */ | |
14614 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
14615 | { } | |
14616 | }; | |
14617 | ||
14618 | static struct hda_verb alc269vb_init_verbs[] = { | |
14619 | /* | |
14620 | * Unmute ADC0 and set the default input to mic-in | |
14621 | */ | |
14622 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14623 | ||
14624 | /* | |
14625 | * Set up output mixers (0x02 - 0x03) | |
14626 | */ | |
14627 | /* set vol=0 to output mixers */ | |
14628 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14629 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14630 | ||
14631 | /* set up input amps for analog loopback */ | |
14632 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
14633 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14634 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14635 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14636 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14637 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14638 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14639 | ||
14640 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14641 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14642 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14643 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14644 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14645 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14646 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14647 | ||
14648 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14649 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14650 | ||
14651 | /* FIXME: use Mux-type input source selection */ | |
14652 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | |
14653 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
14654 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14655 | ||
14656 | /* set EAPD */ | |
14657 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
14658 | { } | |
14659 | }; | |
14660 | ||
14661 | #define alc269_auto_create_multi_out_ctls \ | |
14662 | alc268_auto_create_multi_out_ctls | |
14663 | #define alc269_auto_create_input_ctls \ | |
14664 | alc268_auto_create_input_ctls | |
14665 | ||
14666 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
14667 | #define alc269_loopbacks alc880_loopbacks | |
14668 | #endif | |
14669 | ||
14670 | /* pcm configuration: identical with ALC880 */ | |
14671 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback | |
14672 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture | |
14673 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback | |
14674 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture | |
14675 | ||
14676 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { | |
14677 | .substreams = 1, | |
14678 | .channels_min = 2, | |
14679 | .channels_max = 8, | |
14680 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
14681 | /* NID is set in alc_build_pcms */ | |
14682 | .ops = { | |
14683 | .open = alc880_playback_pcm_open, | |
14684 | .prepare = alc880_playback_pcm_prepare, | |
14685 | .cleanup = alc880_playback_pcm_cleanup | |
14686 | }, | |
14687 | }; | |
14688 | ||
14689 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { | |
14690 | .substreams = 1, | |
14691 | .channels_min = 2, | |
14692 | .channels_max = 2, | |
14693 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
14694 | /* NID is set in alc_build_pcms */ | |
14695 | }; | |
14696 | ||
14697 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
14698 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) | |
14699 | { | |
14700 | switch (codec->subsystem_id) { | |
14701 | case 0x103c1586: | |
14702 | return 1; | |
14703 | } | |
14704 | return 0; | |
14705 | } | |
14706 | ||
14707 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) | |
14708 | { | |
14709 | /* update mute-LED according to the speaker mute state */ | |
14710 | if (nid == 0x01 || nid == 0x14) { | |
14711 | int pinval; | |
14712 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & | |
14713 | HDA_AMP_MUTE) | |
14714 | pinval = 0x24; | |
14715 | else | |
14716 | pinval = 0x20; | |
14717 | /* mic2 vref pin is used for mute LED control */ | |
14718 | snd_hda_codec_update_cache(codec, 0x19, 0, | |
14719 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
14720 | pinval); | |
14721 | } | |
14722 | return alc_check_power_status(codec, nid); | |
14723 | } | |
14724 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ | |
14725 | ||
14726 | static int alc275_setup_dual_adc(struct hda_codec *codec) | |
14727 | { | |
14728 | struct alc_spec *spec = codec->spec; | |
14729 | ||
14730 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) | |
14731 | return 0; | |
14732 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || | |
14733 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { | |
14734 | if (spec->ext_mic.pin <= 0x12) { | |
14735 | spec->private_adc_nids[0] = 0x08; | |
14736 | spec->private_adc_nids[1] = 0x11; | |
14737 | spec->private_capsrc_nids[0] = 0x23; | |
14738 | spec->private_capsrc_nids[1] = 0x22; | |
14739 | } else { | |
14740 | spec->private_adc_nids[0] = 0x11; | |
14741 | spec->private_adc_nids[1] = 0x08; | |
14742 | spec->private_capsrc_nids[0] = 0x22; | |
14743 | spec->private_capsrc_nids[1] = 0x23; | |
14744 | } | |
14745 | spec->adc_nids = spec->private_adc_nids; | |
14746 | spec->capsrc_nids = spec->private_capsrc_nids; | |
14747 | spec->num_adc_nids = 2; | |
14748 | spec->dual_adc_switch = 1; | |
14749 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", | |
14750 | spec->adc_nids[0], spec->adc_nids[1]); | |
14751 | return 1; | |
14752 | } | |
14753 | return 0; | |
14754 | } | |
14755 | ||
14756 | /* different alc269-variants */ | |
14757 | enum { | |
14758 | ALC269_TYPE_NORMAL, | |
14759 | ALC269_TYPE_ALC258, | |
14760 | ALC269_TYPE_ALC259, | |
14761 | ALC269_TYPE_ALC269VB, | |
14762 | ALC269_TYPE_ALC270, | |
14763 | ALC269_TYPE_ALC271X, | |
14764 | }; | |
14765 | ||
14766 | /* | |
14767 | * BIOS auto configuration | |
14768 | */ | |
14769 | static int alc269_parse_auto_config(struct hda_codec *codec) | |
14770 | { | |
14771 | struct alc_spec *spec = codec->spec; | |
14772 | int err; | |
14773 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; | |
14774 | ||
14775 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
14776 | alc269_ignore); | |
14777 | if (err < 0) | |
14778 | return err; | |
14779 | ||
14780 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
14781 | if (err < 0) | |
14782 | return err; | |
14783 | if (spec->codec_variant == ALC269_TYPE_NORMAL) | |
14784 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); | |
14785 | else | |
14786 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, | |
14787 | 0x22, 0); | |
14788 | if (err < 0) | |
14789 | return err; | |
14790 | ||
14791 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
14792 | ||
14793 | alc_auto_parse_digital(codec); | |
14794 | ||
14795 | if (spec->kctls.list) | |
14796 | add_mixer(spec, spec->kctls.list); | |
14797 | ||
14798 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { | |
14799 | add_verb(spec, alc269vb_init_verbs); | |
14800 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); | |
14801 | } else { | |
14802 | add_verb(spec, alc269_init_verbs); | |
14803 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
14804 | } | |
14805 | ||
14806 | spec->num_mux_defs = 1; | |
14807 | spec->input_mux = &spec->private_imux[0]; | |
14808 | ||
14809 | if (!alc275_setup_dual_adc(codec)) | |
14810 | fillup_priv_adc_nids(codec, alc269_adc_candidates, | |
14811 | sizeof(alc269_adc_candidates)); | |
14812 | ||
14813 | /* set default input source */ | |
14814 | if (!spec->dual_adc_switch) | |
14815 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], | |
14816 | spec->input_mux->items[0].index); | |
14817 | ||
14818 | err = alc_auto_add_mic_boost(codec); | |
14819 | if (err < 0) | |
14820 | return err; | |
14821 | ||
14822 | if (!spec->cap_mixer && !spec->no_analog) | |
14823 | set_capture_mixer(codec); | |
14824 | ||
14825 | return 1; | |
14826 | } | |
14827 | ||
14828 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out | |
14829 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out | |
14830 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input | |
14831 | ||
14832 | ||
14833 | /* init callback for auto-configuration model -- overriding the default init */ | |
14834 | static void alc269_auto_init(struct hda_codec *codec) | |
14835 | { | |
14836 | struct alc_spec *spec = codec->spec; | |
14837 | alc269_auto_init_multi_out(codec); | |
14838 | alc269_auto_init_hp_out(codec); | |
14839 | alc269_auto_init_analog_input(codec); | |
14840 | alc_auto_init_digital(codec); | |
14841 | if (spec->unsol_event) | |
14842 | alc_inithook(codec); | |
14843 | } | |
14844 | ||
14845 | #ifdef SND_HDA_NEEDS_RESUME | |
14846 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) | |
14847 | { | |
14848 | int val = alc_read_coef_idx(codec, 0x04); | |
14849 | if (power_up) | |
14850 | val |= 1 << 11; | |
14851 | else | |
14852 | val &= ~(1 << 11); | |
14853 | alc_write_coef_idx(codec, 0x04, val); | |
14854 | } | |
14855 | ||
14856 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
14857 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) | |
14858 | { | |
14859 | struct alc_spec *spec = codec->spec; | |
14860 | ||
14861 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) | |
14862 | alc269_toggle_power_output(codec, 0); | |
14863 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { | |
14864 | alc269_toggle_power_output(codec, 0); | |
14865 | msleep(150); | |
14866 | } | |
14867 | ||
14868 | alc_shutup(codec); | |
14869 | if (spec && spec->power_hook) | |
14870 | spec->power_hook(codec); | |
14871 | return 0; | |
14872 | } | |
14873 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ | |
14874 | ||
14875 | static int alc269_resume(struct hda_codec *codec) | |
14876 | { | |
14877 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { | |
14878 | alc269_toggle_power_output(codec, 0); | |
14879 | msleep(150); | |
14880 | } | |
14881 | ||
14882 | codec->patch_ops.init(codec); | |
14883 | ||
14884 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { | |
14885 | alc269_toggle_power_output(codec, 1); | |
14886 | msleep(200); | |
14887 | } | |
14888 | ||
14889 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) | |
14890 | alc269_toggle_power_output(codec, 1); | |
14891 | ||
14892 | snd_hda_codec_resume_amp(codec); | |
14893 | snd_hda_codec_resume_cache(codec); | |
14894 | hda_call_check_power_status(codec, 0x01); | |
14895 | return 0; | |
14896 | } | |
14897 | #endif /* SND_HDA_NEEDS_RESUME */ | |
14898 | ||
14899 | static void alc269_fixup_hweq(struct hda_codec *codec, | |
14900 | const struct alc_fixup *fix, int action) | |
14901 | { | |
14902 | int coef; | |
14903 | ||
14904 | if (action != ALC_FIXUP_ACT_INIT) | |
14905 | return; | |
14906 | coef = alc_read_coef_idx(codec, 0x1e); | |
14907 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); | |
14908 | } | |
14909 | ||
14910 | enum { | |
14911 | ALC269_FIXUP_SONY_VAIO, | |
14912 | ALC275_FIXUP_SONY_VAIO_GPIO2, | |
14913 | ALC269_FIXUP_DELL_M101Z, | |
14914 | ALC269_FIXUP_SKU_IGNORE, | |
14915 | ALC269_FIXUP_ASUS_G73JW, | |
14916 | ALC269_FIXUP_LENOVO_EAPD, | |
14917 | ALC275_FIXUP_SONY_HWEQ, | |
14918 | }; | |
14919 | ||
14920 | static const struct alc_fixup alc269_fixups[] = { | |
14921 | [ALC269_FIXUP_SONY_VAIO] = { | |
14922 | .type = ALC_FIXUP_VERBS, | |
14923 | .v.verbs = (const struct hda_verb[]) { | |
14924 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, | |
14925 | {} | |
14926 | } | |
14927 | }, | |
14928 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { | |
14929 | .type = ALC_FIXUP_VERBS, | |
14930 | .v.verbs = (const struct hda_verb[]) { | |
14931 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, | |
14932 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, | |
14933 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
14934 | { } | |
14935 | }, | |
14936 | .chained = true, | |
14937 | .chain_id = ALC269_FIXUP_SONY_VAIO | |
14938 | }, | |
14939 | [ALC269_FIXUP_DELL_M101Z] = { | |
14940 | .type = ALC_FIXUP_VERBS, | |
14941 | .v.verbs = (const struct hda_verb[]) { | |
14942 | /* Enables internal speaker */ | |
14943 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, | |
14944 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, | |
14945 | {} | |
14946 | } | |
14947 | }, | |
14948 | [ALC269_FIXUP_SKU_IGNORE] = { | |
14949 | .type = ALC_FIXUP_SKU, | |
14950 | .v.sku = ALC_FIXUP_SKU_IGNORE, | |
14951 | }, | |
14952 | [ALC269_FIXUP_ASUS_G73JW] = { | |
14953 | .type = ALC_FIXUP_PINS, | |
14954 | .v.pins = (const struct alc_pincfg[]) { | |
14955 | { 0x17, 0x99130111 }, /* subwoofer */ | |
14956 | { } | |
14957 | } | |
14958 | }, | |
14959 | [ALC269_FIXUP_LENOVO_EAPD] = { | |
14960 | .type = ALC_FIXUP_VERBS, | |
14961 | .v.verbs = (const struct hda_verb[]) { | |
14962 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, | |
14963 | {} | |
14964 | } | |
14965 | }, | |
14966 | [ALC275_FIXUP_SONY_HWEQ] = { | |
14967 | .type = ALC_FIXUP_FUNC, | |
14968 | .v.func = alc269_fixup_hweq, | |
14969 | .chained = true, | |
14970 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 | |
14971 | } | |
14972 | }; | |
14973 | ||
14974 | static struct snd_pci_quirk alc269_fixup_tbl[] = { | |
14975 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), | |
14976 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), | |
14977 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), | |
14978 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | |
14979 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), | |
14980 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), | |
14981 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), | |
14982 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), | |
14983 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), | |
14984 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), | |
14985 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), | |
14986 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), | |
14987 | {} | |
14988 | }; | |
14989 | ||
14990 | ||
14991 | /* | |
14992 | * configuration and preset | |
14993 | */ | |
14994 | static const char * const alc269_models[ALC269_MODEL_LAST] = { | |
14995 | [ALC269_BASIC] = "basic", | |
14996 | [ALC269_QUANTA_FL1] = "quanta", | |
14997 | [ALC269_AMIC] = "laptop-amic", | |
14998 | [ALC269_DMIC] = "laptop-dmic", | |
14999 | [ALC269_FUJITSU] = "fujitsu", | |
15000 | [ALC269_LIFEBOOK] = "lifebook", | |
15001 | [ALC269_AUTO] = "auto", | |
15002 | }; | |
15003 | ||
15004 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | |
15005 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), | |
15006 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), | |
15007 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", | |
15008 | ALC269_AMIC), | |
15009 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), | |
15010 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), | |
15011 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), | |
15012 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), | |
15013 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), | |
15014 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), | |
15015 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), | |
15016 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), | |
15017 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), | |
15018 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), | |
15019 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), | |
15020 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), | |
15021 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), | |
15022 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), | |
15023 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), | |
15024 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), | |
15025 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), | |
15026 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), | |
15027 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), | |
15028 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), | |
15029 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), | |
15030 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), | |
15031 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), | |
15032 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), | |
15033 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), | |
15034 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), | |
15035 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), | |
15036 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), | |
15037 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), | |
15038 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), | |
15039 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), | |
15040 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), | |
15041 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), | |
15042 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), | |
15043 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), | |
15044 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), | |
15045 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", | |
15046 | ALC269_DMIC), | |
15047 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", | |
15048 | ALC269_DMIC), | |
15049 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), | |
15050 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), | |
15051 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), | |
15052 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), | |
15053 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), | |
15054 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), | |
15055 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), | |
15056 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), | |
15057 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), | |
15058 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), | |
15059 | {} | |
15060 | }; | |
15061 | ||
15062 | static struct alc_config_preset alc269_presets[] = { | |
15063 | [ALC269_BASIC] = { | |
15064 | .mixers = { alc269_base_mixer }, | |
15065 | .init_verbs = { alc269_init_verbs }, | |
15066 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
15067 | .dac_nids = alc269_dac_nids, | |
15068 | .hp_nid = 0x03, | |
15069 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
15070 | .channel_mode = alc269_modes, | |
15071 | .input_mux = &alc269_capture_source, | |
15072 | }, | |
15073 | [ALC269_QUANTA_FL1] = { | |
15074 | .mixers = { alc269_quanta_fl1_mixer }, | |
15075 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, | |
15076 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
15077 | .dac_nids = alc269_dac_nids, | |
15078 | .hp_nid = 0x03, | |
15079 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
15080 | .channel_mode = alc269_modes, | |
15081 | .input_mux = &alc269_capture_source, | |
15082 | .unsol_event = alc269_quanta_fl1_unsol_event, | |
15083 | .setup = alc269_quanta_fl1_setup, | |
15084 | .init_hook = alc269_quanta_fl1_init_hook, | |
15085 | }, | |
15086 | [ALC269_AMIC] = { | |
15087 | .mixers = { alc269_laptop_mixer }, | |
15088 | .cap_mixer = alc269_laptop_analog_capture_mixer, | |
15089 | .init_verbs = { alc269_init_verbs, | |
15090 | alc269_laptop_amic_init_verbs }, | |
15091 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
15092 | .dac_nids = alc269_dac_nids, | |
15093 | .hp_nid = 0x03, | |
15094 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
15095 | .channel_mode = alc269_modes, | |
15096 | .unsol_event = alc269_laptop_unsol_event, | |
15097 | .setup = alc269_laptop_amic_setup, | |
15098 | .init_hook = alc269_laptop_inithook, | |
15099 | }, | |
15100 | [ALC269_DMIC] = { | |
15101 | .mixers = { alc269_laptop_mixer }, | |
15102 | .cap_mixer = alc269_laptop_digital_capture_mixer, | |
15103 | .init_verbs = { alc269_init_verbs, | |
15104 | alc269_laptop_dmic_init_verbs }, | |
15105 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
15106 | .dac_nids = alc269_dac_nids, | |
15107 | .hp_nid = 0x03, | |
15108 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
15109 | .channel_mode = alc269_modes, | |
15110 | .unsol_event = alc269_laptop_unsol_event, | |
15111 | .setup = alc269_laptop_dmic_setup, | |
15112 | .init_hook = alc269_laptop_inithook, | |
15113 | }, | |
15114 | [ALC269VB_AMIC] = { | |
15115 | .mixers = { alc269vb_laptop_mixer }, | |
15116 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, | |
15117 | .init_verbs = { alc269vb_init_verbs, | |
15118 | alc269vb_laptop_amic_init_verbs }, | |
15119 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
15120 | .dac_nids = alc269_dac_nids, | |
15121 | .hp_nid = 0x03, | |
15122 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
15123 | .channel_mode = alc269_modes, | |
15124 | .unsol_event = alc269_laptop_unsol_event, | |
15125 | .setup = alc269vb_laptop_amic_setup, | |
15126 | .init_hook = alc269_laptop_inithook, | |
15127 | }, | |
15128 | [ALC269VB_DMIC] = { | |
15129 | .mixers = { alc269vb_laptop_mixer }, | |
15130 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | |
15131 | .init_verbs = { alc269vb_init_verbs, | |
15132 | alc269vb_laptop_dmic_init_verbs }, | |
15133 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
15134 | .dac_nids = alc269_dac_nids, | |
15135 | .hp_nid = 0x03, | |
15136 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
15137 | .channel_mode = alc269_modes, | |
15138 | .unsol_event = alc269_laptop_unsol_event, | |
15139 | .setup = alc269vb_laptop_dmic_setup, | |
15140 | .init_hook = alc269_laptop_inithook, | |
15141 | }, | |
15142 | [ALC269_FUJITSU] = { | |
15143 | .mixers = { alc269_fujitsu_mixer }, | |
15144 | .cap_mixer = alc269_laptop_digital_capture_mixer, | |
15145 | .init_verbs = { alc269_init_verbs, | |
15146 | alc269_laptop_dmic_init_verbs }, | |
15147 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
15148 | .dac_nids = alc269_dac_nids, | |
15149 | .hp_nid = 0x03, | |
15150 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
15151 | .channel_mode = alc269_modes, | |
15152 | .unsol_event = alc269_laptop_unsol_event, | |
15153 | .setup = alc269_laptop_dmic_setup, | |
15154 | .init_hook = alc269_laptop_inithook, | |
15155 | }, | |
15156 | [ALC269_LIFEBOOK] = { | |
15157 | .mixers = { alc269_lifebook_mixer }, | |
15158 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, | |
15159 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
15160 | .dac_nids = alc269_dac_nids, | |
15161 | .hp_nid = 0x03, | |
15162 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
15163 | .channel_mode = alc269_modes, | |
15164 | .input_mux = &alc269_capture_source, | |
15165 | .unsol_event = alc269_lifebook_unsol_event, | |
15166 | .init_hook = alc269_lifebook_init_hook, | |
15167 | }, | |
15168 | [ALC271_ACER] = { | |
15169 | .mixers = { alc269_asus_mixer }, | |
15170 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | |
15171 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, | |
15172 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
15173 | .dac_nids = alc269_dac_nids, | |
15174 | .adc_nids = alc262_dmic_adc_nids, | |
15175 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), | |
15176 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
15177 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
15178 | .channel_mode = alc269_modes, | |
15179 | .input_mux = &alc269_capture_source, | |
15180 | .dig_out_nid = ALC880_DIGOUT_NID, | |
15181 | .unsol_event = alc_sku_unsol_event, | |
15182 | .setup = alc269vb_laptop_dmic_setup, | |
15183 | .init_hook = alc_inithook, | |
15184 | }, | |
15185 | }; | |
15186 | ||
15187 | static int alc269_fill_coef(struct hda_codec *codec) | |
15188 | { | |
15189 | int val; | |
15190 | ||
15191 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { | |
15192 | alc_write_coef_idx(codec, 0xf, 0x960b); | |
15193 | alc_write_coef_idx(codec, 0xe, 0x8817); | |
15194 | } | |
15195 | ||
15196 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { | |
15197 | alc_write_coef_idx(codec, 0xf, 0x960b); | |
15198 | alc_write_coef_idx(codec, 0xe, 0x8814); | |
15199 | } | |
15200 | ||
15201 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { | |
15202 | val = alc_read_coef_idx(codec, 0x04); | |
15203 | /* Power up output pin */ | |
15204 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); | |
15205 | } | |
15206 | ||
15207 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { | |
15208 | val = alc_read_coef_idx(codec, 0xd); | |
15209 | if ((val & 0x0c00) >> 10 != 0x1) { | |
15210 | /* Capless ramp up clock control */ | |
15211 | alc_write_coef_idx(codec, 0xd, val | 1<<10); | |
15212 | } | |
15213 | val = alc_read_coef_idx(codec, 0x17); | |
15214 | if ((val & 0x01c0) >> 6 != 0x4) { | |
15215 | /* Class D power on reset */ | |
15216 | alc_write_coef_idx(codec, 0x17, val | 1<<7); | |
15217 | } | |
15218 | } | |
15219 | return 0; | |
15220 | } | |
15221 | ||
15222 | static int patch_alc269(struct hda_codec *codec) | |
15223 | { | |
15224 | struct alc_spec *spec; | |
15225 | int board_config, coef; | |
15226 | int err; | |
15227 | ||
15228 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
15229 | if (spec == NULL) | |
15230 | return -ENOMEM; | |
15231 | ||
15232 | codec->spec = spec; | |
15233 | ||
15234 | alc_auto_parse_customize_define(codec); | |
15235 | ||
15236 | if (codec->vendor_id == 0x10ec0269) { | |
15237 | coef = alc_read_coef_idx(codec, 0); | |
15238 | if ((coef & 0x00f0) == 0x0010) { | |
15239 | if (codec->bus->pci->subsystem_vendor == 0x1025 && | |
15240 | spec->cdefine.platform_type == 1) { | |
15241 | alc_codec_rename(codec, "ALC271X"); | |
15242 | spec->codec_variant = ALC269_TYPE_ALC271X; | |
15243 | } else if ((coef & 0xf000) == 0x1000) { | |
15244 | spec->codec_variant = ALC269_TYPE_ALC270; | |
15245 | } else if ((coef & 0xf000) == 0x2000) { | |
15246 | alc_codec_rename(codec, "ALC259"); | |
15247 | spec->codec_variant = ALC269_TYPE_ALC259; | |
15248 | } else if ((coef & 0xf000) == 0x3000) { | |
15249 | alc_codec_rename(codec, "ALC258"); | |
15250 | spec->codec_variant = ALC269_TYPE_ALC258; | |
15251 | } else { | |
15252 | alc_codec_rename(codec, "ALC269VB"); | |
15253 | spec->codec_variant = ALC269_TYPE_ALC269VB; | |
15254 | } | |
15255 | } else | |
15256 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | |
15257 | alc269_fill_coef(codec); | |
15258 | } | |
15259 | ||
15260 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, | |
15261 | alc269_models, | |
15262 | alc269_cfg_tbl); | |
15263 | ||
15264 | if (board_config < 0) { | |
15265 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
15266 | codec->chip_name); | |
15267 | board_config = ALC269_AUTO; | |
15268 | } | |
15269 | ||
15270 | if (board_config == ALC269_AUTO) { | |
15271 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); | |
15272 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | |
15273 | } | |
15274 | ||
15275 | if (board_config == ALC269_AUTO) { | |
15276 | /* automatic parse from the BIOS config */ | |
15277 | err = alc269_parse_auto_config(codec); | |
15278 | if (err < 0) { | |
15279 | alc_free(codec); | |
15280 | return err; | |
15281 | } else if (!err) { | |
15282 | printk(KERN_INFO | |
15283 | "hda_codec: Cannot set up configuration " | |
15284 | "from BIOS. Using base mode...\n"); | |
15285 | board_config = ALC269_BASIC; | |
15286 | } | |
15287 | } | |
15288 | ||
15289 | if (has_cdefine_beep(codec)) { | |
15290 | err = snd_hda_attach_beep_device(codec, 0x1); | |
15291 | if (err < 0) { | |
15292 | alc_free(codec); | |
15293 | return err; | |
15294 | } | |
15295 | } | |
15296 | ||
15297 | if (board_config != ALC269_AUTO) | |
15298 | setup_preset(codec, &alc269_presets[board_config]); | |
15299 | ||
15300 | if (board_config == ALC269_QUANTA_FL1) { | |
15301 | /* Due to a hardware problem on Lenovo Ideadpad, we need to | |
15302 | * fix the sample rate of analog I/O to 44.1kHz | |
15303 | */ | |
15304 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; | |
15305 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; | |
15306 | } else if (spec->dual_adc_switch) { | |
15307 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
15308 | /* switch ADC dynamically */ | |
15309 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; | |
15310 | } else { | |
15311 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
15312 | spec->stream_analog_capture = &alc269_pcm_analog_capture; | |
15313 | } | |
15314 | spec->stream_digital_playback = &alc269_pcm_digital_playback; | |
15315 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | |
15316 | ||
15317 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ | |
15318 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { | |
15319 | spec->adc_nids = alc269_adc_nids; | |
15320 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | |
15321 | spec->capsrc_nids = alc269_capsrc_nids; | |
15322 | } else { | |
15323 | spec->adc_nids = alc269vb_adc_nids; | |
15324 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); | |
15325 | spec->capsrc_nids = alc269vb_capsrc_nids; | |
15326 | } | |
15327 | } | |
15328 | ||
15329 | if (!spec->cap_mixer) | |
15330 | set_capture_mixer(codec); | |
15331 | if (has_cdefine_beep(codec)) | |
15332 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | |
15333 | ||
15334 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | |
15335 | ||
15336 | spec->vmaster_nid = 0x02; | |
15337 | ||
15338 | codec->patch_ops = alc_patch_ops; | |
15339 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
15340 | codec->patch_ops.suspend = alc269_suspend; | |
15341 | #endif | |
15342 | #ifdef SND_HDA_NEEDS_RESUME | |
15343 | codec->patch_ops.resume = alc269_resume; | |
15344 | #endif | |
15345 | if (board_config == ALC269_AUTO) | |
15346 | spec->init_hook = alc269_auto_init; | |
15347 | ||
15348 | alc_init_jacks(codec); | |
15349 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
15350 | if (!spec->loopback.amplist) | |
15351 | spec->loopback.amplist = alc269_loopbacks; | |
15352 | if (alc269_mic2_for_mute_led(codec)) | |
15353 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; | |
15354 | #endif | |
15355 | ||
15356 | return 0; | |
15357 | } | |
15358 | ||
15359 | /* | |
15360 | * ALC861 channel source setting (2/6 channel selection for 3-stack) | |
15361 | */ | |
15362 | ||
15363 | /* | |
15364 | * set the path ways for 2 channel output | |
15365 | * need to set the codec line out and mic 1 pin widgets to inputs | |
15366 | */ | |
15367 | static struct hda_verb alc861_threestack_ch2_init[] = { | |
15368 | /* set pin widget 1Ah (line in) for input */ | |
15369 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15370 | /* set pin widget 18h (mic1/2) for input, for mic also enable | |
15371 | * the vref | |
15372 | */ | |
15373 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15374 | ||
15375 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
15376 | #if 0 | |
15377 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
15378 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
15379 | #endif | |
15380 | { } /* end */ | |
15381 | }; | |
15382 | /* | |
15383 | * 6ch mode | |
15384 | * need to set the codec line out and mic 1 pin widgets to outputs | |
15385 | */ | |
15386 | static struct hda_verb alc861_threestack_ch6_init[] = { | |
15387 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
15388 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15389 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
15390 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15391 | ||
15392 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15393 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15394 | ||
15395 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
15396 | #if 0 | |
15397 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
15398 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
15399 | #endif | |
15400 | { } /* end */ | |
15401 | }; | |
15402 | ||
15403 | static struct hda_channel_mode alc861_threestack_modes[2] = { | |
15404 | { 2, alc861_threestack_ch2_init }, | |
15405 | { 6, alc861_threestack_ch6_init }, | |
15406 | }; | |
15407 | /* Set mic1 as input and unmute the mixer */ | |
15408 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { | |
15409 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15410 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
15411 | { } /* end */ | |
15412 | }; | |
15413 | /* Set mic1 as output and mute mixer */ | |
15414 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { | |
15415 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15416 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
15417 | { } /* end */ | |
15418 | }; | |
15419 | ||
15420 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { | |
15421 | { 2, alc861_uniwill_m31_ch2_init }, | |
15422 | { 4, alc861_uniwill_m31_ch4_init }, | |
15423 | }; | |
15424 | ||
15425 | /* Set mic1 and line-in as input and unmute the mixer */ | |
15426 | static struct hda_verb alc861_asus_ch2_init[] = { | |
15427 | /* set pin widget 1Ah (line in) for input */ | |
15428 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15429 | /* set pin widget 18h (mic1/2) for input, for mic also enable | |
15430 | * the vref | |
15431 | */ | |
15432 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15433 | ||
15434 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
15435 | #if 0 | |
15436 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
15437 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
15438 | #endif | |
15439 | { } /* end */ | |
15440 | }; | |
15441 | /* Set mic1 nad line-in as output and mute mixer */ | |
15442 | static struct hda_verb alc861_asus_ch6_init[] = { | |
15443 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
15444 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15445 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
15446 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
15447 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15448 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
15449 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15450 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15451 | ||
15452 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
15453 | #if 0 | |
15454 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
15455 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
15456 | #endif | |
15457 | { } /* end */ | |
15458 | }; | |
15459 | ||
15460 | static struct hda_channel_mode alc861_asus_modes[2] = { | |
15461 | { 2, alc861_asus_ch2_init }, | |
15462 | { 6, alc861_asus_ch6_init }, | |
15463 | }; | |
15464 | ||
15465 | /* patch-ALC861 */ | |
15466 | ||
15467 | static struct snd_kcontrol_new alc861_base_mixer[] = { | |
15468 | /* output mixer control */ | |
15469 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15470 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15471 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15472 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15473 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
15474 | ||
15475 | /*Input mixer control */ | |
15476 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15477 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
15478 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15479 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15480 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15481 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15482 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15483 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15484 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
15485 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
15486 | ||
15487 | { } /* end */ | |
15488 | }; | |
15489 | ||
15490 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { | |
15491 | /* output mixer control */ | |
15492 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15493 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15494 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15495 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15496 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
15497 | ||
15498 | /* Input mixer control */ | |
15499 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15500 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
15501 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15502 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15503 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15504 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15505 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15506 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15507 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
15508 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
15509 | ||
15510 | { | |
15511 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15512 | .name = "Channel Mode", | |
15513 | .info = alc_ch_mode_info, | |
15514 | .get = alc_ch_mode_get, | |
15515 | .put = alc_ch_mode_put, | |
15516 | .private_value = ARRAY_SIZE(alc861_threestack_modes), | |
15517 | }, | |
15518 | { } /* end */ | |
15519 | }; | |
15520 | ||
15521 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { | |
15522 | /* output mixer control */ | |
15523 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15524 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15525 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15526 | ||
15527 | { } /* end */ | |
15528 | }; | |
15529 | ||
15530 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { | |
15531 | /* output mixer control */ | |
15532 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15533 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15534 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15535 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15536 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
15537 | ||
15538 | /* Input mixer control */ | |
15539 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15540 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
15541 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15542 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15543 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15544 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15545 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15546 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15547 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
15548 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
15549 | ||
15550 | { | |
15551 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15552 | .name = "Channel Mode", | |
15553 | .info = alc_ch_mode_info, | |
15554 | .get = alc_ch_mode_get, | |
15555 | .put = alc_ch_mode_put, | |
15556 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
15557 | }, | |
15558 | { } /* end */ | |
15559 | }; | |
15560 | ||
15561 | static struct snd_kcontrol_new alc861_asus_mixer[] = { | |
15562 | /* output mixer control */ | |
15563 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15564 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15565 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15566 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15567 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
15568 | ||
15569 | /* Input mixer control */ | |
15570 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15571 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
15572 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15573 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15574 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15575 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15576 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15577 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15578 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
15579 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), | |
15580 | ||
15581 | { | |
15582 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15583 | .name = "Channel Mode", | |
15584 | .info = alc_ch_mode_info, | |
15585 | .get = alc_ch_mode_get, | |
15586 | .put = alc_ch_mode_put, | |
15587 | .private_value = ARRAY_SIZE(alc861_asus_modes), | |
15588 | }, | |
15589 | { } | |
15590 | }; | |
15591 | ||
15592 | /* additional mixer */ | |
15593 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { | |
15594 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15595 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15596 | { } | |
15597 | }; | |
15598 | ||
15599 | /* | |
15600 | * generic initialization of ADC, input mixers and output mixers | |
15601 | */ | |
15602 | static struct hda_verb alc861_base_init_verbs[] = { | |
15603 | /* | |
15604 | * Unmute ADC0 and set the default input to mic-in | |
15605 | */ | |
15606 | /* port-A for surround (rear panel) */ | |
15607 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15608 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15609 | /* port-B for mic-in (rear panel) with vref */ | |
15610 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15611 | /* port-C for line-in (rear panel) */ | |
15612 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15613 | /* port-D for Front */ | |
15614 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15615 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15616 | /* port-E for HP out (front panel) */ | |
15617 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
15618 | /* route front PCM to HP */ | |
15619 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15620 | /* port-F for mic-in (front panel) with vref */ | |
15621 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15622 | /* port-G for CLFE (rear panel) */ | |
15623 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15624 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15625 | /* port-H for side (rear panel) */ | |
15626 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15627 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15628 | /* CD-in */ | |
15629 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15630 | /* route front mic to ADC1*/ | |
15631 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15632 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15633 | ||
15634 | /* Unmute DAC0~3 & spdif out*/ | |
15635 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15636 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15637 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15638 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15639 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15640 | ||
15641 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15642 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15643 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15644 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15645 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15646 | ||
15647 | /* Unmute Stereo Mixer 15 */ | |
15648 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15649 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15650 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15651 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | |
15652 | ||
15653 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15654 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15655 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15656 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15657 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15658 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15659 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15660 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15661 | /* hp used DAC 3 (Front) */ | |
15662 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
15663 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15664 | ||
15665 | { } | |
15666 | }; | |
15667 | ||
15668 | static struct hda_verb alc861_threestack_init_verbs[] = { | |
15669 | /* | |
15670 | * Unmute ADC0 and set the default input to mic-in | |
15671 | */ | |
15672 | /* port-A for surround (rear panel) */ | |
15673 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15674 | /* port-B for mic-in (rear panel) with vref */ | |
15675 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15676 | /* port-C for line-in (rear panel) */ | |
15677 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15678 | /* port-D for Front */ | |
15679 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15680 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15681 | /* port-E for HP out (front panel) */ | |
15682 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
15683 | /* route front PCM to HP */ | |
15684 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15685 | /* port-F for mic-in (front panel) with vref */ | |
15686 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15687 | /* port-G for CLFE (rear panel) */ | |
15688 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15689 | /* port-H for side (rear panel) */ | |
15690 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15691 | /* CD-in */ | |
15692 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15693 | /* route front mic to ADC1*/ | |
15694 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15695 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15696 | /* Unmute DAC0~3 & spdif out*/ | |
15697 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15698 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15699 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15700 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15701 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15702 | ||
15703 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15704 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15705 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15706 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15707 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15708 | ||
15709 | /* Unmute Stereo Mixer 15 */ | |
15710 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15711 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15712 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15713 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | |
15714 | ||
15715 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15716 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15717 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15718 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15719 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15720 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15721 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15722 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15723 | /* hp used DAC 3 (Front) */ | |
15724 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
15725 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15726 | { } | |
15727 | }; | |
15728 | ||
15729 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | |
15730 | /* | |
15731 | * Unmute ADC0 and set the default input to mic-in | |
15732 | */ | |
15733 | /* port-A for surround (rear panel) */ | |
15734 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15735 | /* port-B for mic-in (rear panel) with vref */ | |
15736 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15737 | /* port-C for line-in (rear panel) */ | |
15738 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15739 | /* port-D for Front */ | |
15740 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15741 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15742 | /* port-E for HP out (front panel) */ | |
15743 | /* this has to be set to VREF80 */ | |
15744 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15745 | /* route front PCM to HP */ | |
15746 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15747 | /* port-F for mic-in (front panel) with vref */ | |
15748 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15749 | /* port-G for CLFE (rear panel) */ | |
15750 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15751 | /* port-H for side (rear panel) */ | |
15752 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15753 | /* CD-in */ | |
15754 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15755 | /* route front mic to ADC1*/ | |
15756 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15757 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15758 | /* Unmute DAC0~3 & spdif out*/ | |
15759 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15760 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15761 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15762 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15763 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15764 | ||
15765 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15766 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15767 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15768 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15769 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15770 | ||
15771 | /* Unmute Stereo Mixer 15 */ | |
15772 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15774 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15775 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | |
15776 | ||
15777 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15778 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15779 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15780 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15781 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15782 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15783 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15784 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15785 | /* hp used DAC 3 (Front) */ | |
15786 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
15787 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15788 | { } | |
15789 | }; | |
15790 | ||
15791 | static struct hda_verb alc861_asus_init_verbs[] = { | |
15792 | /* | |
15793 | * Unmute ADC0 and set the default input to mic-in | |
15794 | */ | |
15795 | /* port-A for surround (rear panel) | |
15796 | * according to codec#0 this is the HP jack | |
15797 | */ | |
15798 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ | |
15799 | /* route front PCM to HP */ | |
15800 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
15801 | /* port-B for mic-in (rear panel) with vref */ | |
15802 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15803 | /* port-C for line-in (rear panel) */ | |
15804 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15805 | /* port-D for Front */ | |
15806 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15807 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15808 | /* port-E for HP out (front panel) */ | |
15809 | /* this has to be set to VREF80 */ | |
15810 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15811 | /* route front PCM to HP */ | |
15812 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15813 | /* port-F for mic-in (front panel) with vref */ | |
15814 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15815 | /* port-G for CLFE (rear panel) */ | |
15816 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15817 | /* port-H for side (rear panel) */ | |
15818 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15819 | /* CD-in */ | |
15820 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15821 | /* route front mic to ADC1*/ | |
15822 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15823 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15824 | /* Unmute DAC0~3 & spdif out*/ | |
15825 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15826 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15827 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15828 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15829 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15830 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15831 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15832 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15833 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15834 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15835 | ||
15836 | /* Unmute Stereo Mixer 15 */ | |
15837 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15838 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15839 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15840 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | |
15841 | ||
15842 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15843 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15844 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15845 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15846 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15847 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15848 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15849 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15850 | /* hp used DAC 3 (Front) */ | |
15851 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
15852 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15853 | { } | |
15854 | }; | |
15855 | ||
15856 | /* additional init verbs for ASUS laptops */ | |
15857 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { | |
15858 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ | |
15859 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ | |
15860 | { } | |
15861 | }; | |
15862 | ||
15863 | /* | |
15864 | * generic initialization of ADC, input mixers and output mixers | |
15865 | */ | |
15866 | static struct hda_verb alc861_auto_init_verbs[] = { | |
15867 | /* | |
15868 | * Unmute ADC0 and set the default input to mic-in | |
15869 | */ | |
15870 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ | |
15871 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15872 | ||
15873 | /* Unmute DAC0~3 & spdif out*/ | |
15874 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15875 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15876 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15877 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15878 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15879 | ||
15880 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15881 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15882 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15883 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15884 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15885 | ||
15886 | /* Unmute Stereo Mixer 15 */ | |
15887 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15888 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15889 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15890 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | |
15891 | ||
15892 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15893 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15894 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15895 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15896 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15897 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15898 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15899 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15900 | ||
15901 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15902 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15903 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
15904 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
15905 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15906 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15907 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
15908 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
15909 | ||
15910 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ | |
15911 | ||
15912 | { } | |
15913 | }; | |
15914 | ||
15915 | static struct hda_verb alc861_toshiba_init_verbs[] = { | |
15916 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15917 | ||
15918 | { } | |
15919 | }; | |
15920 | ||
15921 | /* toggle speaker-output according to the hp-jack state */ | |
15922 | static void alc861_toshiba_automute(struct hda_codec *codec) | |
15923 | { | |
15924 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); | |
15925 | ||
15926 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, | |
15927 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
15928 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, | |
15929 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | |
15930 | } | |
15931 | ||
15932 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, | |
15933 | unsigned int res) | |
15934 | { | |
15935 | if ((res >> 26) == ALC880_HP_EVENT) | |
15936 | alc861_toshiba_automute(codec); | |
15937 | } | |
15938 | ||
15939 | /* pcm configuration: identical with ALC880 */ | |
15940 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback | |
15941 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture | |
15942 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback | |
15943 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture | |
15944 | ||
15945 | ||
15946 | #define ALC861_DIGOUT_NID 0x07 | |
15947 | ||
15948 | static struct hda_channel_mode alc861_8ch_modes[1] = { | |
15949 | { 8, NULL } | |
15950 | }; | |
15951 | ||
15952 | static hda_nid_t alc861_dac_nids[4] = { | |
15953 | /* front, surround, clfe, side */ | |
15954 | 0x03, 0x06, 0x05, 0x04 | |
15955 | }; | |
15956 | ||
15957 | static hda_nid_t alc660_dac_nids[3] = { | |
15958 | /* front, clfe, surround */ | |
15959 | 0x03, 0x05, 0x06 | |
15960 | }; | |
15961 | ||
15962 | static hda_nid_t alc861_adc_nids[1] = { | |
15963 | /* ADC0-2 */ | |
15964 | 0x08, | |
15965 | }; | |
15966 | ||
15967 | static struct hda_input_mux alc861_capture_source = { | |
15968 | .num_items = 5, | |
15969 | .items = { | |
15970 | { "Mic", 0x0 }, | |
15971 | { "Front Mic", 0x3 }, | |
15972 | { "Line", 0x1 }, | |
15973 | { "CD", 0x4 }, | |
15974 | { "Mixer", 0x5 }, | |
15975 | }, | |
15976 | }; | |
15977 | ||
15978 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |
15979 | { | |
15980 | struct alc_spec *spec = codec->spec; | |
15981 | hda_nid_t mix, srcs[5]; | |
15982 | int i, j, num; | |
15983 | ||
15984 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) | |
15985 | return 0; | |
15986 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | |
15987 | if (num < 0) | |
15988 | return 0; | |
15989 | for (i = 0; i < num; i++) { | |
15990 | unsigned int type; | |
15991 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); | |
15992 | if (type != AC_WID_AUD_OUT) | |
15993 | continue; | |
15994 | for (j = 0; j < spec->multiout.num_dacs; j++) | |
15995 | if (spec->multiout.dac_nids[j] == srcs[i]) | |
15996 | break; | |
15997 | if (j >= spec->multiout.num_dacs) | |
15998 | return srcs[i]; | |
15999 | } | |
16000 | return 0; | |
16001 | } | |
16002 | ||
16003 | /* fill in the dac_nids table from the parsed pin configuration */ | |
16004 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, | |
16005 | const struct auto_pin_cfg *cfg) | |
16006 | { | |
16007 | struct alc_spec *spec = codec->spec; | |
16008 | int i; | |
16009 | hda_nid_t nid, dac; | |
16010 | ||
16011 | spec->multiout.dac_nids = spec->private_dac_nids; | |
16012 | for (i = 0; i < cfg->line_outs; i++) { | |
16013 | nid = cfg->line_out_pins[i]; | |
16014 | dac = alc861_look_for_dac(codec, nid); | |
16015 | if (!dac) | |
16016 | continue; | |
16017 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
16018 | } | |
16019 | return 0; | |
16020 | } | |
16021 | ||
16022 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, | |
16023 | hda_nid_t nid, int idx, unsigned int chs) | |
16024 | { | |
16025 | return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx, | |
16026 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | |
16027 | } | |
16028 | ||
16029 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ | |
16030 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) | |
16031 | ||
16032 | /* add playback controls from the parsed DAC table */ | |
16033 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, | |
16034 | const struct auto_pin_cfg *cfg) | |
16035 | { | |
16036 | struct alc_spec *spec = codec->spec; | |
16037 | static const char * const chname[4] = { | |
16038 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
16039 | }; | |
16040 | const char *pfx = alc_get_line_out_pfx(cfg, true); | |
16041 | hda_nid_t nid; | |
16042 | int i, err; | |
16043 | ||
16044 | for (i = 0; i < cfg->line_outs; i++) { | |
16045 | nid = spec->multiout.dac_nids[i]; | |
16046 | if (!nid) | |
16047 | continue; | |
16048 | if (!pfx && i == 2) { | |
16049 | /* Center/LFE */ | |
16050 | err = alc861_create_out_sw(codec, "Center", nid, 1); | |
16051 | if (err < 0) | |
16052 | return err; | |
16053 | err = alc861_create_out_sw(codec, "LFE", nid, 2); | |
16054 | if (err < 0) | |
16055 | return err; | |
16056 | } else { | |
16057 | const char *name = pfx; | |
16058 | if (!name) | |
16059 | name = chname[i]; | |
16060 | err = __alc861_create_out_sw(codec, name, nid, i, 3); | |
16061 | if (err < 0) | |
16062 | return err; | |
16063 | } | |
16064 | } | |
16065 | return 0; | |
16066 | } | |
16067 | ||
16068 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) | |
16069 | { | |
16070 | struct alc_spec *spec = codec->spec; | |
16071 | int err; | |
16072 | hda_nid_t nid; | |
16073 | ||
16074 | if (!pin) | |
16075 | return 0; | |
16076 | ||
16077 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | |
16078 | nid = alc861_look_for_dac(codec, pin); | |
16079 | if (nid) { | |
16080 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); | |
16081 | if (err < 0) | |
16082 | return err; | |
16083 | spec->multiout.hp_nid = nid; | |
16084 | } | |
16085 | } | |
16086 | return 0; | |
16087 | } | |
16088 | ||
16089 | /* create playback/capture controls for input pins */ | |
16090 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, | |
16091 | const struct auto_pin_cfg *cfg) | |
16092 | { | |
16093 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); | |
16094 | } | |
16095 | ||
16096 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, | |
16097 | hda_nid_t nid, | |
16098 | int pin_type, hda_nid_t dac) | |
16099 | { | |
16100 | hda_nid_t mix, srcs[5]; | |
16101 | int i, num; | |
16102 | ||
16103 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
16104 | pin_type); | |
16105 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
16106 | AMP_OUT_UNMUTE); | |
16107 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) | |
16108 | return; | |
16109 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | |
16110 | if (num < 0) | |
16111 | return; | |
16112 | for (i = 0; i < num; i++) { | |
16113 | unsigned int mute; | |
16114 | if (srcs[i] == dac || srcs[i] == 0x15) | |
16115 | mute = AMP_IN_UNMUTE(i); | |
16116 | else | |
16117 | mute = AMP_IN_MUTE(i); | |
16118 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
16119 | mute); | |
16120 | } | |
16121 | } | |
16122 | ||
16123 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | |
16124 | { | |
16125 | struct alc_spec *spec = codec->spec; | |
16126 | int i; | |
16127 | ||
16128 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
16129 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
16130 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
16131 | if (nid) | |
16132 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, | |
16133 | spec->multiout.dac_nids[i]); | |
16134 | } | |
16135 | } | |
16136 | ||
16137 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | |
16138 | { | |
16139 | struct alc_spec *spec = codec->spec; | |
16140 | ||
16141 | if (spec->autocfg.hp_outs) | |
16142 | alc861_auto_set_output_and_unmute(codec, | |
16143 | spec->autocfg.hp_pins[0], | |
16144 | PIN_HP, | |
16145 | spec->multiout.hp_nid); | |
16146 | if (spec->autocfg.speaker_outs) | |
16147 | alc861_auto_set_output_and_unmute(codec, | |
16148 | spec->autocfg.speaker_pins[0], | |
16149 | PIN_OUT, | |
16150 | spec->multiout.dac_nids[0]); | |
16151 | } | |
16152 | ||
16153 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | |
16154 | { | |
16155 | struct alc_spec *spec = codec->spec; | |
16156 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
16157 | int i; | |
16158 | ||
16159 | for (i = 0; i < cfg->num_inputs; i++) { | |
16160 | hda_nid_t nid = cfg->inputs[i].pin; | |
16161 | if (nid >= 0x0c && nid <= 0x11) | |
16162 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); | |
16163 | } | |
16164 | } | |
16165 | ||
16166 | /* parse the BIOS configuration and set up the alc_spec */ | |
16167 | /* return 1 if successful, 0 if the proper config is not found, | |
16168 | * or a negative error code | |
16169 | */ | |
16170 | static int alc861_parse_auto_config(struct hda_codec *codec) | |
16171 | { | |
16172 | struct alc_spec *spec = codec->spec; | |
16173 | int err; | |
16174 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; | |
16175 | ||
16176 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
16177 | alc861_ignore); | |
16178 | if (err < 0) | |
16179 | return err; | |
16180 | if (!spec->autocfg.line_outs) | |
16181 | return 0; /* can't find valid BIOS pin config */ | |
16182 | ||
16183 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); | |
16184 | if (err < 0) | |
16185 | return err; | |
16186 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); | |
16187 | if (err < 0) | |
16188 | return err; | |
16189 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); | |
16190 | if (err < 0) | |
16191 | return err; | |
16192 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); | |
16193 | if (err < 0) | |
16194 | return err; | |
16195 | ||
16196 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
16197 | ||
16198 | alc_auto_parse_digital(codec); | |
16199 | ||
16200 | if (spec->kctls.list) | |
16201 | add_mixer(spec, spec->kctls.list); | |
16202 | ||
16203 | add_verb(spec, alc861_auto_init_verbs); | |
16204 | ||
16205 | spec->num_mux_defs = 1; | |
16206 | spec->input_mux = &spec->private_imux[0]; | |
16207 | ||
16208 | spec->adc_nids = alc861_adc_nids; | |
16209 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | |
16210 | set_capture_mixer(codec); | |
16211 | ||
16212 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); | |
16213 | ||
16214 | return 1; | |
16215 | } | |
16216 | ||
16217 | /* additional initialization for auto-configuration model */ | |
16218 | static void alc861_auto_init(struct hda_codec *codec) | |
16219 | { | |
16220 | struct alc_spec *spec = codec->spec; | |
16221 | alc861_auto_init_multi_out(codec); | |
16222 | alc861_auto_init_hp_out(codec); | |
16223 | alc861_auto_init_analog_input(codec); | |
16224 | alc_auto_init_digital(codec); | |
16225 | if (spec->unsol_event) | |
16226 | alc_inithook(codec); | |
16227 | } | |
16228 | ||
16229 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
16230 | static struct hda_amp_list alc861_loopbacks[] = { | |
16231 | { 0x15, HDA_INPUT, 0 }, | |
16232 | { 0x15, HDA_INPUT, 1 }, | |
16233 | { 0x15, HDA_INPUT, 2 }, | |
16234 | { 0x15, HDA_INPUT, 3 }, | |
16235 | { } /* end */ | |
16236 | }; | |
16237 | #endif | |
16238 | ||
16239 | ||
16240 | /* | |
16241 | * configuration and preset | |
16242 | */ | |
16243 | static const char * const alc861_models[ALC861_MODEL_LAST] = { | |
16244 | [ALC861_3ST] = "3stack", | |
16245 | [ALC660_3ST] = "3stack-660", | |
16246 | [ALC861_3ST_DIG] = "3stack-dig", | |
16247 | [ALC861_6ST_DIG] = "6stack-dig", | |
16248 | [ALC861_UNIWILL_M31] = "uniwill-m31", | |
16249 | [ALC861_TOSHIBA] = "toshiba", | |
16250 | [ALC861_ASUS] = "asus", | |
16251 | [ALC861_ASUS_LAPTOP] = "asus-laptop", | |
16252 | [ALC861_AUTO] = "auto", | |
16253 | }; | |
16254 | ||
16255 | static struct snd_pci_quirk alc861_cfg_tbl[] = { | |
16256 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), | |
16257 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
16258 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
16259 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | |
16260 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), | |
16261 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), | |
16262 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), | |
16263 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) | |
16264 | * Any other models that need this preset? | |
16265 | */ | |
16266 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ | |
16267 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), | |
16268 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), | |
16269 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), | |
16270 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), | |
16271 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), | |
16272 | /* FIXME: the below seems conflict */ | |
16273 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ | |
16274 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), | |
16275 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), | |
16276 | {} | |
16277 | }; | |
16278 | ||
16279 | static struct alc_config_preset alc861_presets[] = { | |
16280 | [ALC861_3ST] = { | |
16281 | .mixers = { alc861_3ST_mixer }, | |
16282 | .init_verbs = { alc861_threestack_init_verbs }, | |
16283 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16284 | .dac_nids = alc861_dac_nids, | |
16285 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
16286 | .channel_mode = alc861_threestack_modes, | |
16287 | .need_dac_fix = 1, | |
16288 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16289 | .adc_nids = alc861_adc_nids, | |
16290 | .input_mux = &alc861_capture_source, | |
16291 | }, | |
16292 | [ALC861_3ST_DIG] = { | |
16293 | .mixers = { alc861_base_mixer }, | |
16294 | .init_verbs = { alc861_threestack_init_verbs }, | |
16295 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16296 | .dac_nids = alc861_dac_nids, | |
16297 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16298 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
16299 | .channel_mode = alc861_threestack_modes, | |
16300 | .need_dac_fix = 1, | |
16301 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16302 | .adc_nids = alc861_adc_nids, | |
16303 | .input_mux = &alc861_capture_source, | |
16304 | }, | |
16305 | [ALC861_6ST_DIG] = { | |
16306 | .mixers = { alc861_base_mixer }, | |
16307 | .init_verbs = { alc861_base_init_verbs }, | |
16308 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16309 | .dac_nids = alc861_dac_nids, | |
16310 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16311 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), | |
16312 | .channel_mode = alc861_8ch_modes, | |
16313 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16314 | .adc_nids = alc861_adc_nids, | |
16315 | .input_mux = &alc861_capture_source, | |
16316 | }, | |
16317 | [ALC660_3ST] = { | |
16318 | .mixers = { alc861_3ST_mixer }, | |
16319 | .init_verbs = { alc861_threestack_init_verbs }, | |
16320 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), | |
16321 | .dac_nids = alc660_dac_nids, | |
16322 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
16323 | .channel_mode = alc861_threestack_modes, | |
16324 | .need_dac_fix = 1, | |
16325 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16326 | .adc_nids = alc861_adc_nids, | |
16327 | .input_mux = &alc861_capture_source, | |
16328 | }, | |
16329 | [ALC861_UNIWILL_M31] = { | |
16330 | .mixers = { alc861_uniwill_m31_mixer }, | |
16331 | .init_verbs = { alc861_uniwill_m31_init_verbs }, | |
16332 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16333 | .dac_nids = alc861_dac_nids, | |
16334 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16335 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
16336 | .channel_mode = alc861_uniwill_m31_modes, | |
16337 | .need_dac_fix = 1, | |
16338 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16339 | .adc_nids = alc861_adc_nids, | |
16340 | .input_mux = &alc861_capture_source, | |
16341 | }, | |
16342 | [ALC861_TOSHIBA] = { | |
16343 | .mixers = { alc861_toshiba_mixer }, | |
16344 | .init_verbs = { alc861_base_init_verbs, | |
16345 | alc861_toshiba_init_verbs }, | |
16346 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16347 | .dac_nids = alc861_dac_nids, | |
16348 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
16349 | .channel_mode = alc883_3ST_2ch_modes, | |
16350 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16351 | .adc_nids = alc861_adc_nids, | |
16352 | .input_mux = &alc861_capture_source, | |
16353 | .unsol_event = alc861_toshiba_unsol_event, | |
16354 | .init_hook = alc861_toshiba_automute, | |
16355 | }, | |
16356 | [ALC861_ASUS] = { | |
16357 | .mixers = { alc861_asus_mixer }, | |
16358 | .init_verbs = { alc861_asus_init_verbs }, | |
16359 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16360 | .dac_nids = alc861_dac_nids, | |
16361 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16362 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), | |
16363 | .channel_mode = alc861_asus_modes, | |
16364 | .need_dac_fix = 1, | |
16365 | .hp_nid = 0x06, | |
16366 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16367 | .adc_nids = alc861_adc_nids, | |
16368 | .input_mux = &alc861_capture_source, | |
16369 | }, | |
16370 | [ALC861_ASUS_LAPTOP] = { | |
16371 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, | |
16372 | .init_verbs = { alc861_asus_init_verbs, | |
16373 | alc861_asus_laptop_init_verbs }, | |
16374 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16375 | .dac_nids = alc861_dac_nids, | |
16376 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16377 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
16378 | .channel_mode = alc883_3ST_2ch_modes, | |
16379 | .need_dac_fix = 1, | |
16380 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16381 | .adc_nids = alc861_adc_nids, | |
16382 | .input_mux = &alc861_capture_source, | |
16383 | }, | |
16384 | }; | |
16385 | ||
16386 | /* Pin config fixes */ | |
16387 | enum { | |
16388 | PINFIX_FSC_AMILO_PI1505, | |
16389 | }; | |
16390 | ||
16391 | static const struct alc_fixup alc861_fixups[] = { | |
16392 | [PINFIX_FSC_AMILO_PI1505] = { | |
16393 | .type = ALC_FIXUP_PINS, | |
16394 | .v.pins = (const struct alc_pincfg[]) { | |
16395 | { 0x0b, 0x0221101f }, /* HP */ | |
16396 | { 0x0f, 0x90170310 }, /* speaker */ | |
16397 | { } | |
16398 | } | |
16399 | }, | |
16400 | }; | |
16401 | ||
16402 | static struct snd_pci_quirk alc861_fixup_tbl[] = { | |
16403 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), | |
16404 | {} | |
16405 | }; | |
16406 | ||
16407 | static int patch_alc861(struct hda_codec *codec) | |
16408 | { | |
16409 | struct alc_spec *spec; | |
16410 | int board_config; | |
16411 | int err; | |
16412 | ||
16413 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
16414 | if (spec == NULL) | |
16415 | return -ENOMEM; | |
16416 | ||
16417 | codec->spec = spec; | |
16418 | ||
16419 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, | |
16420 | alc861_models, | |
16421 | alc861_cfg_tbl); | |
16422 | ||
16423 | if (board_config < 0) { | |
16424 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
16425 | codec->chip_name); | |
16426 | board_config = ALC861_AUTO; | |
16427 | } | |
16428 | ||
16429 | if (board_config == ALC861_AUTO) { | |
16430 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); | |
16431 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | |
16432 | } | |
16433 | ||
16434 | if (board_config == ALC861_AUTO) { | |
16435 | /* automatic parse from the BIOS config */ | |
16436 | err = alc861_parse_auto_config(codec); | |
16437 | if (err < 0) { | |
16438 | alc_free(codec); | |
16439 | return err; | |
16440 | } else if (!err) { | |
16441 | printk(KERN_INFO | |
16442 | "hda_codec: Cannot set up configuration " | |
16443 | "from BIOS. Using base mode...\n"); | |
16444 | board_config = ALC861_3ST_DIG; | |
16445 | } | |
16446 | } | |
16447 | ||
16448 | err = snd_hda_attach_beep_device(codec, 0x23); | |
16449 | if (err < 0) { | |
16450 | alc_free(codec); | |
16451 | return err; | |
16452 | } | |
16453 | ||
16454 | if (board_config != ALC861_AUTO) | |
16455 | setup_preset(codec, &alc861_presets[board_config]); | |
16456 | ||
16457 | spec->stream_analog_playback = &alc861_pcm_analog_playback; | |
16458 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | |
16459 | ||
16460 | spec->stream_digital_playback = &alc861_pcm_digital_playback; | |
16461 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | |
16462 | ||
16463 | if (!spec->cap_mixer) | |
16464 | set_capture_mixer(codec); | |
16465 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); | |
16466 | ||
16467 | spec->vmaster_nid = 0x03; | |
16468 | ||
16469 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | |
16470 | ||
16471 | codec->patch_ops = alc_patch_ops; | |
16472 | if (board_config == ALC861_AUTO) { | |
16473 | spec->init_hook = alc861_auto_init; | |
16474 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
16475 | spec->power_hook = alc_power_eapd; | |
16476 | #endif | |
16477 | } | |
16478 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
16479 | if (!spec->loopback.amplist) | |
16480 | spec->loopback.amplist = alc861_loopbacks; | |
16481 | #endif | |
16482 | ||
16483 | return 0; | |
16484 | } | |
16485 | ||
16486 | /* | |
16487 | * ALC861-VD support | |
16488 | * | |
16489 | * Based on ALC882 | |
16490 | * | |
16491 | * In addition, an independent DAC | |
16492 | */ | |
16493 | #define ALC861VD_DIGOUT_NID 0x06 | |
16494 | ||
16495 | static hda_nid_t alc861vd_dac_nids[4] = { | |
16496 | /* front, surr, clfe, side surr */ | |
16497 | 0x02, 0x03, 0x04, 0x05 | |
16498 | }; | |
16499 | ||
16500 | /* dac_nids for ALC660vd are in a different order - according to | |
16501 | * Realtek's driver. | |
16502 | * This should probably result in a different mixer for 6stack models | |
16503 | * of ALC660vd codecs, but for now there is only 3stack mixer | |
16504 | * - and it is the same as in 861vd. | |
16505 | * adc_nids in ALC660vd are (is) the same as in 861vd | |
16506 | */ | |
16507 | static hda_nid_t alc660vd_dac_nids[3] = { | |
16508 | /* front, rear, clfe, rear_surr */ | |
16509 | 0x02, 0x04, 0x03 | |
16510 | }; | |
16511 | ||
16512 | static hda_nid_t alc861vd_adc_nids[1] = { | |
16513 | /* ADC0 */ | |
16514 | 0x09, | |
16515 | }; | |
16516 | ||
16517 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; | |
16518 | ||
16519 | /* input MUX */ | |
16520 | /* FIXME: should be a matrix-type input source selection */ | |
16521 | static struct hda_input_mux alc861vd_capture_source = { | |
16522 | .num_items = 4, | |
16523 | .items = { | |
16524 | { "Mic", 0x0 }, | |
16525 | { "Front Mic", 0x1 }, | |
16526 | { "Line", 0x2 }, | |
16527 | { "CD", 0x4 }, | |
16528 | }, | |
16529 | }; | |
16530 | ||
16531 | static struct hda_input_mux alc861vd_dallas_capture_source = { | |
16532 | .num_items = 2, | |
16533 | .items = { | |
16534 | { "Mic", 0x0 }, | |
16535 | { "Internal Mic", 0x1 }, | |
16536 | }, | |
16537 | }; | |
16538 | ||
16539 | static struct hda_input_mux alc861vd_hp_capture_source = { | |
16540 | .num_items = 2, | |
16541 | .items = { | |
16542 | { "Front Mic", 0x0 }, | |
16543 | { "ATAPI Mic", 0x1 }, | |
16544 | }, | |
16545 | }; | |
16546 | ||
16547 | /* | |
16548 | * 2ch mode | |
16549 | */ | |
16550 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { | |
16551 | { 2, NULL } | |
16552 | }; | |
16553 | ||
16554 | /* | |
16555 | * 6ch mode | |
16556 | */ | |
16557 | static struct hda_verb alc861vd_6stack_ch6_init[] = { | |
16558 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
16559 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16560 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16561 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16562 | { } /* end */ | |
16563 | }; | |
16564 | ||
16565 | /* | |
16566 | * 8ch mode | |
16567 | */ | |
16568 | static struct hda_verb alc861vd_6stack_ch8_init[] = { | |
16569 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16570 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16571 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16572 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16573 | { } /* end */ | |
16574 | }; | |
16575 | ||
16576 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { | |
16577 | { 6, alc861vd_6stack_ch6_init }, | |
16578 | { 8, alc861vd_6stack_ch8_init }, | |
16579 | }; | |
16580 | ||
16581 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { | |
16582 | { | |
16583 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
16584 | .name = "Channel Mode", | |
16585 | .info = alc_ch_mode_info, | |
16586 | .get = alc_ch_mode_get, | |
16587 | .put = alc_ch_mode_put, | |
16588 | }, | |
16589 | { } /* end */ | |
16590 | }; | |
16591 | ||
16592 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
16593 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
16594 | */ | |
16595 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { | |
16596 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16597 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16598 | ||
16599 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16600 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
16601 | ||
16602 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, | |
16603 | HDA_OUTPUT), | |
16604 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, | |
16605 | HDA_OUTPUT), | |
16606 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
16607 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16608 | ||
16609 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), | |
16610 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
16611 | ||
16612 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16613 | ||
16614 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
16615 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16616 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16617 | ||
16618 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
16619 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16620 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16621 | ||
16622 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16623 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16624 | ||
16625 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16626 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16627 | ||
16628 | { } /* end */ | |
16629 | }; | |
16630 | ||
16631 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { | |
16632 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16633 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16634 | ||
16635 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16636 | ||
16637 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
16638 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16640 | ||
16641 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
16642 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16643 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16644 | ||
16645 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16646 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16647 | ||
16648 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16649 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16650 | ||
16651 | { } /* end */ | |
16652 | }; | |
16653 | ||
16654 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { | |
16655 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16656 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ | |
16657 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
16658 | ||
16659 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16660 | ||
16661 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
16662 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16663 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16664 | ||
16665 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
16666 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16667 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16668 | ||
16669 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16670 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16671 | ||
16672 | { } /* end */ | |
16673 | }; | |
16674 | ||
16675 | /* Pin assignment: Speaker=0x14, HP = 0x15, | |
16676 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d | |
16677 | */ | |
16678 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | |
16679 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16680 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
16681 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16682 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
16683 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
16684 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16685 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16686 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
16687 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16688 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16689 | { } /* end */ | |
16690 | }; | |
16691 | ||
16692 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, | |
16693 | * Front Mic=0x18, ATAPI Mic = 0x19, | |
16694 | */ | |
16695 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { | |
16696 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16697 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16698 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16699 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
16700 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16701 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16702 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16703 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16704 | ||
16705 | { } /* end */ | |
16706 | }; | |
16707 | ||
16708 | /* | |
16709 | * generic initialization of ADC, input mixers and output mixers | |
16710 | */ | |
16711 | static struct hda_verb alc861vd_volume_init_verbs[] = { | |
16712 | /* | |
16713 | * Unmute ADC0 and set the default input to mic-in | |
16714 | */ | |
16715 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16716 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16717 | ||
16718 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of | |
16719 | * the analog-loopback mixer widget | |
16720 | */ | |
16721 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
16722 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16723 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16724 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
16725 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
16726 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
16727 | ||
16728 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ | |
16729 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16730 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16731 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
16732 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
16733 | ||
16734 | /* | |
16735 | * Set up output mixers (0x02 - 0x05) | |
16736 | */ | |
16737 | /* set vol=0 to output mixers */ | |
16738 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16739 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16740 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16741 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16742 | ||
16743 | /* set up input amps for analog loopback */ | |
16744 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
16745 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16746 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16747 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16748 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16749 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16750 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16751 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16752 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16753 | ||
16754 | { } | |
16755 | }; | |
16756 | ||
16757 | /* | |
16758 | * 3-stack pin configuration: | |
16759 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
16760 | */ | |
16761 | static struct hda_verb alc861vd_3stack_init_verbs[] = { | |
16762 | /* | |
16763 | * Set pin mode and muting | |
16764 | */ | |
16765 | /* set front pin widgets 0x14 for output */ | |
16766 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16767 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16768 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16769 | ||
16770 | /* Mic (rear) pin: input vref at 80% */ | |
16771 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16772 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16773 | /* Front Mic pin: input vref at 80% */ | |
16774 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16775 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16776 | /* Line In pin: input */ | |
16777 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16778 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16779 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
16780 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16781 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16782 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16783 | /* CD pin widget for input */ | |
16784 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16785 | ||
16786 | { } | |
16787 | }; | |
16788 | ||
16789 | /* | |
16790 | * 6-stack pin configuration: | |
16791 | */ | |
16792 | static struct hda_verb alc861vd_6stack_init_verbs[] = { | |
16793 | /* | |
16794 | * Set pin mode and muting | |
16795 | */ | |
16796 | /* set front pin widgets 0x14 for output */ | |
16797 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16798 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16799 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16800 | ||
16801 | /* Rear Pin: output 1 (0x0d) */ | |
16802 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16803 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16804 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
16805 | /* CLFE Pin: output 2 (0x0e) */ | |
16806 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16807 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16808 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
16809 | /* Side Pin: output 3 (0x0f) */ | |
16810 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16811 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16812 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
16813 | ||
16814 | /* Mic (rear) pin: input vref at 80% */ | |
16815 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16816 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16817 | /* Front Mic pin: input vref at 80% */ | |
16818 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16820 | /* Line In pin: input */ | |
16821 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16822 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16823 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
16824 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16825 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16826 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16827 | /* CD pin widget for input */ | |
16828 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16829 | ||
16830 | { } | |
16831 | }; | |
16832 | ||
16833 | static struct hda_verb alc861vd_eapd_verbs[] = { | |
16834 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16835 | { } | |
16836 | }; | |
16837 | ||
16838 | static struct hda_verb alc660vd_eapd_verbs[] = { | |
16839 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16840 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16841 | { } | |
16842 | }; | |
16843 | ||
16844 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { | |
16845 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16846 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16847 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
16848 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16849 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16850 | {} | |
16851 | }; | |
16852 | ||
16853 | static void alc861vd_lenovo_setup(struct hda_codec *codec) | |
16854 | { | |
16855 | struct alc_spec *spec = codec->spec; | |
16856 | spec->autocfg.hp_pins[0] = 0x1b; | |
16857 | spec->autocfg.speaker_pins[0] = 0x14; | |
16858 | } | |
16859 | ||
16860 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | |
16861 | { | |
16862 | alc_automute_amp(codec); | |
16863 | alc88x_simple_mic_automute(codec); | |
16864 | } | |
16865 | ||
16866 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, | |
16867 | unsigned int res) | |
16868 | { | |
16869 | switch (res >> 26) { | |
16870 | case ALC880_MIC_EVENT: | |
16871 | alc88x_simple_mic_automute(codec); | |
16872 | break; | |
16873 | default: | |
16874 | alc_automute_amp_unsol_event(codec, res); | |
16875 | break; | |
16876 | } | |
16877 | } | |
16878 | ||
16879 | static struct hda_verb alc861vd_dallas_verbs[] = { | |
16880 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16881 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16882 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16883 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16884 | ||
16885 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16886 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16887 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16888 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16889 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16890 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16891 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16892 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16893 | ||
16894 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16895 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16896 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16897 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16898 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16899 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16900 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16901 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16902 | ||
16903 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
16904 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16905 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
16906 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16907 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16908 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16909 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16910 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16911 | ||
16912 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16913 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
16914 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
16915 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
16916 | ||
16917 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16918 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16919 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16920 | ||
16921 | { } /* end */ | |
16922 | }; | |
16923 | ||
16924 | /* toggle speaker-output according to the hp-jack state */ | |
16925 | static void alc861vd_dallas_setup(struct hda_codec *codec) | |
16926 | { | |
16927 | struct alc_spec *spec = codec->spec; | |
16928 | ||
16929 | spec->autocfg.hp_pins[0] = 0x15; | |
16930 | spec->autocfg.speaker_pins[0] = 0x14; | |
16931 | } | |
16932 | ||
16933 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
16934 | #define alc861vd_loopbacks alc880_loopbacks | |
16935 | #endif | |
16936 | ||
16937 | /* pcm configuration: identical with ALC880 */ | |
16938 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback | |
16939 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture | |
16940 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback | |
16941 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture | |
16942 | ||
16943 | /* | |
16944 | * configuration and preset | |
16945 | */ | |
16946 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { | |
16947 | [ALC660VD_3ST] = "3stack-660", | |
16948 | [ALC660VD_3ST_DIG] = "3stack-660-digout", | |
16949 | [ALC660VD_ASUS_V1S] = "asus-v1s", | |
16950 | [ALC861VD_3ST] = "3stack", | |
16951 | [ALC861VD_3ST_DIG] = "3stack-digout", | |
16952 | [ALC861VD_6ST_DIG] = "6stack-digout", | |
16953 | [ALC861VD_LENOVO] = "lenovo", | |
16954 | [ALC861VD_DALLAS] = "dallas", | |
16955 | [ALC861VD_HP] = "hp", | |
16956 | [ALC861VD_AUTO] = "auto", | |
16957 | }; | |
16958 | ||
16959 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |
16960 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), | |
16961 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | |
16962 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), | |
16963 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ | |
16964 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), | |
16965 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), | |
16966 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), | |
16967 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), | |
16968 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ | |
16969 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), | |
16970 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), | |
16971 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), | |
16972 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), | |
16973 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), | |
16974 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), | |
16975 | {} | |
16976 | }; | |
16977 | ||
16978 | static struct alc_config_preset alc861vd_presets[] = { | |
16979 | [ALC660VD_3ST] = { | |
16980 | .mixers = { alc861vd_3st_mixer }, | |
16981 | .init_verbs = { alc861vd_volume_init_verbs, | |
16982 | alc861vd_3stack_init_verbs }, | |
16983 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16984 | .dac_nids = alc660vd_dac_nids, | |
16985 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16986 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16987 | .input_mux = &alc861vd_capture_source, | |
16988 | }, | |
16989 | [ALC660VD_3ST_DIG] = { | |
16990 | .mixers = { alc861vd_3st_mixer }, | |
16991 | .init_verbs = { alc861vd_volume_init_verbs, | |
16992 | alc861vd_3stack_init_verbs }, | |
16993 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16994 | .dac_nids = alc660vd_dac_nids, | |
16995 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16996 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16997 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16998 | .input_mux = &alc861vd_capture_source, | |
16999 | }, | |
17000 | [ALC861VD_3ST] = { | |
17001 | .mixers = { alc861vd_3st_mixer }, | |
17002 | .init_verbs = { alc861vd_volume_init_verbs, | |
17003 | alc861vd_3stack_init_verbs }, | |
17004 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
17005 | .dac_nids = alc861vd_dac_nids, | |
17006 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
17007 | .channel_mode = alc861vd_3stack_2ch_modes, | |
17008 | .input_mux = &alc861vd_capture_source, | |
17009 | }, | |
17010 | [ALC861VD_3ST_DIG] = { | |
17011 | .mixers = { alc861vd_3st_mixer }, | |
17012 | .init_verbs = { alc861vd_volume_init_verbs, | |
17013 | alc861vd_3stack_init_verbs }, | |
17014 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
17015 | .dac_nids = alc861vd_dac_nids, | |
17016 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
17017 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
17018 | .channel_mode = alc861vd_3stack_2ch_modes, | |
17019 | .input_mux = &alc861vd_capture_source, | |
17020 | }, | |
17021 | [ALC861VD_6ST_DIG] = { | |
17022 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, | |
17023 | .init_verbs = { alc861vd_volume_init_verbs, | |
17024 | alc861vd_6stack_init_verbs }, | |
17025 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
17026 | .dac_nids = alc861vd_dac_nids, | |
17027 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
17028 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), | |
17029 | .channel_mode = alc861vd_6stack_modes, | |
17030 | .input_mux = &alc861vd_capture_source, | |
17031 | }, | |
17032 | [ALC861VD_LENOVO] = { | |
17033 | .mixers = { alc861vd_lenovo_mixer }, | |
17034 | .init_verbs = { alc861vd_volume_init_verbs, | |
17035 | alc861vd_3stack_init_verbs, | |
17036 | alc861vd_eapd_verbs, | |
17037 | alc861vd_lenovo_unsol_verbs }, | |
17038 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
17039 | .dac_nids = alc660vd_dac_nids, | |
17040 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
17041 | .channel_mode = alc861vd_3stack_2ch_modes, | |
17042 | .input_mux = &alc861vd_capture_source, | |
17043 | .unsol_event = alc861vd_lenovo_unsol_event, | |
17044 | .setup = alc861vd_lenovo_setup, | |
17045 | .init_hook = alc861vd_lenovo_init_hook, | |
17046 | }, | |
17047 | [ALC861VD_DALLAS] = { | |
17048 | .mixers = { alc861vd_dallas_mixer }, | |
17049 | .init_verbs = { alc861vd_dallas_verbs }, | |
17050 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
17051 | .dac_nids = alc861vd_dac_nids, | |
17052 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
17053 | .channel_mode = alc861vd_3stack_2ch_modes, | |
17054 | .input_mux = &alc861vd_dallas_capture_source, | |
17055 | .unsol_event = alc_automute_amp_unsol_event, | |
17056 | .setup = alc861vd_dallas_setup, | |
17057 | .init_hook = alc_automute_amp, | |
17058 | }, | |
17059 | [ALC861VD_HP] = { | |
17060 | .mixers = { alc861vd_hp_mixer }, | |
17061 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | |
17062 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
17063 | .dac_nids = alc861vd_dac_nids, | |
17064 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
17065 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
17066 | .channel_mode = alc861vd_3stack_2ch_modes, | |
17067 | .input_mux = &alc861vd_hp_capture_source, | |
17068 | .unsol_event = alc_automute_amp_unsol_event, | |
17069 | .setup = alc861vd_dallas_setup, | |
17070 | .init_hook = alc_automute_amp, | |
17071 | }, | |
17072 | [ALC660VD_ASUS_V1S] = { | |
17073 | .mixers = { alc861vd_lenovo_mixer }, | |
17074 | .init_verbs = { alc861vd_volume_init_verbs, | |
17075 | alc861vd_3stack_init_verbs, | |
17076 | alc861vd_eapd_verbs, | |
17077 | alc861vd_lenovo_unsol_verbs }, | |
17078 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
17079 | .dac_nids = alc660vd_dac_nids, | |
17080 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
17081 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
17082 | .channel_mode = alc861vd_3stack_2ch_modes, | |
17083 | .input_mux = &alc861vd_capture_source, | |
17084 | .unsol_event = alc861vd_lenovo_unsol_event, | |
17085 | .setup = alc861vd_lenovo_setup, | |
17086 | .init_hook = alc861vd_lenovo_init_hook, | |
17087 | }, | |
17088 | }; | |
17089 | ||
17090 | /* | |
17091 | * BIOS auto configuration | |
17092 | */ | |
17093 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, | |
17094 | const struct auto_pin_cfg *cfg) | |
17095 | { | |
17096 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); | |
17097 | } | |
17098 | ||
17099 | ||
17100 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, | |
17101 | hda_nid_t nid, int pin_type, int dac_idx) | |
17102 | { | |
17103 | alc_set_pin_output(codec, nid, pin_type); | |
17104 | } | |
17105 | ||
17106 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) | |
17107 | { | |
17108 | struct alc_spec *spec = codec->spec; | |
17109 | int i; | |
17110 | ||
17111 | for (i = 0; i <= HDA_SIDE; i++) { | |
17112 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
17113 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
17114 | if (nid) | |
17115 | alc861vd_auto_set_output_and_unmute(codec, nid, | |
17116 | pin_type, i); | |
17117 | } | |
17118 | } | |
17119 | ||
17120 | ||
17121 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | |
17122 | { | |
17123 | struct alc_spec *spec = codec->spec; | |
17124 | hda_nid_t pin; | |
17125 | ||
17126 | pin = spec->autocfg.hp_pins[0]; | |
17127 | if (pin) /* connect to front and use dac 0 */ | |
17128 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
17129 | pin = spec->autocfg.speaker_pins[0]; | |
17130 | if (pin) | |
17131 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
17132 | } | |
17133 | ||
17134 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID | |
17135 | ||
17136 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |
17137 | { | |
17138 | struct alc_spec *spec = codec->spec; | |
17139 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
17140 | int i; | |
17141 | ||
17142 | for (i = 0; i < cfg->num_inputs; i++) { | |
17143 | hda_nid_t nid = cfg->inputs[i].pin; | |
17144 | if (alc_is_input_pin(codec, nid)) { | |
17145 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); | |
17146 | if (nid != ALC861VD_PIN_CD_NID && | |
17147 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
17148 | snd_hda_codec_write(codec, nid, 0, | |
17149 | AC_VERB_SET_AMP_GAIN_MUTE, | |
17150 | AMP_OUT_MUTE); | |
17151 | } | |
17152 | } | |
17153 | } | |
17154 | ||
17155 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src | |
17156 | ||
17157 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) | |
17158 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) | |
17159 | ||
17160 | /* add playback controls from the parsed DAC table */ | |
17161 | /* Based on ALC880 version. But ALC861VD has separate, | |
17162 | * different NIDs for mute/unmute switch and volume control */ | |
17163 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | |
17164 | const struct auto_pin_cfg *cfg) | |
17165 | { | |
17166 | static const char * const chname[4] = { | |
17167 | "Front", "Surround", "CLFE", "Side" | |
17168 | }; | |
17169 | const char *pfx = alc_get_line_out_pfx(cfg, true); | |
17170 | hda_nid_t nid_v, nid_s; | |
17171 | int i, err; | |
17172 | ||
17173 | for (i = 0; i < cfg->line_outs; i++) { | |
17174 | if (!spec->multiout.dac_nids[i]) | |
17175 | continue; | |
17176 | nid_v = alc861vd_idx_to_mixer_vol( | |
17177 | alc880_dac_to_idx( | |
17178 | spec->multiout.dac_nids[i])); | |
17179 | nid_s = alc861vd_idx_to_mixer_switch( | |
17180 | alc880_dac_to_idx( | |
17181 | spec->multiout.dac_nids[i])); | |
17182 | ||
17183 | if (!pfx && i == 2) { | |
17184 | /* Center/LFE */ | |
17185 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
17186 | "Center", | |
17187 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, | |
17188 | HDA_OUTPUT)); | |
17189 | if (err < 0) | |
17190 | return err; | |
17191 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
17192 | "LFE", | |
17193 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, | |
17194 | HDA_OUTPUT)); | |
17195 | if (err < 0) | |
17196 | return err; | |
17197 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
17198 | "Center", | |
17199 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, | |
17200 | HDA_INPUT)); | |
17201 | if (err < 0) | |
17202 | return err; | |
17203 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
17204 | "LFE", | |
17205 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, | |
17206 | HDA_INPUT)); | |
17207 | if (err < 0) | |
17208 | return err; | |
17209 | } else { | |
17210 | const char *name = pfx; | |
17211 | if (!name) | |
17212 | name = chname[i]; | |
17213 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
17214 | name, i, | |
17215 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, | |
17216 | HDA_OUTPUT)); | |
17217 | if (err < 0) | |
17218 | return err; | |
17219 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
17220 | name, i, | |
17221 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, | |
17222 | HDA_INPUT)); | |
17223 | if (err < 0) | |
17224 | return err; | |
17225 | } | |
17226 | } | |
17227 | return 0; | |
17228 | } | |
17229 | ||
17230 | /* add playback controls for speaker and HP outputs */ | |
17231 | /* Based on ALC880 version. But ALC861VD has separate, | |
17232 | * different NIDs for mute/unmute switch and volume control */ | |
17233 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, | |
17234 | hda_nid_t pin, const char *pfx) | |
17235 | { | |
17236 | hda_nid_t nid_v, nid_s; | |
17237 | int err; | |
17238 | ||
17239 | if (!pin) | |
17240 | return 0; | |
17241 | ||
17242 | if (alc880_is_fixed_pin(pin)) { | |
17243 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
17244 | /* specify the DAC as the extra output */ | |
17245 | if (!spec->multiout.hp_nid) | |
17246 | spec->multiout.hp_nid = nid_v; | |
17247 | else | |
17248 | spec->multiout.extra_out_nid[0] = nid_v; | |
17249 | /* control HP volume/switch on the output mixer amp */ | |
17250 | nid_v = alc861vd_idx_to_mixer_vol( | |
17251 | alc880_fixed_pin_idx(pin)); | |
17252 | nid_s = alc861vd_idx_to_mixer_switch( | |
17253 | alc880_fixed_pin_idx(pin)); | |
17254 | ||
17255 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | |
17256 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); | |
17257 | if (err < 0) | |
17258 | return err; | |
17259 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | |
17260 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); | |
17261 | if (err < 0) | |
17262 | return err; | |
17263 | } else if (alc880_is_multi_pin(pin)) { | |
17264 | /* set manual connection */ | |
17265 | /* we have only a switch on HP-out PIN */ | |
17266 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | |
17267 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
17268 | if (err < 0) | |
17269 | return err; | |
17270 | } | |
17271 | return 0; | |
17272 | } | |
17273 | ||
17274 | /* parse the BIOS configuration and set up the alc_spec | |
17275 | * return 1 if successful, 0 if the proper config is not found, | |
17276 | * or a negative error code | |
17277 | * Based on ALC880 version - had to change it to override | |
17278 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ | |
17279 | static int alc861vd_parse_auto_config(struct hda_codec *codec) | |
17280 | { | |
17281 | struct alc_spec *spec = codec->spec; | |
17282 | int err; | |
17283 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; | |
17284 | ||
17285 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
17286 | alc861vd_ignore); | |
17287 | if (err < 0) | |
17288 | return err; | |
17289 | if (!spec->autocfg.line_outs) | |
17290 | return 0; /* can't find valid BIOS pin config */ | |
17291 | ||
17292 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | |
17293 | if (err < 0) | |
17294 | return err; | |
17295 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
17296 | if (err < 0) | |
17297 | return err; | |
17298 | err = alc861vd_auto_create_extra_out(spec, | |
17299 | spec->autocfg.speaker_pins[0], | |
17300 | "Speaker"); | |
17301 | if (err < 0) | |
17302 | return err; | |
17303 | err = alc861vd_auto_create_extra_out(spec, | |
17304 | spec->autocfg.hp_pins[0], | |
17305 | "Headphone"); | |
17306 | if (err < 0) | |
17307 | return err; | |
17308 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); | |
17309 | if (err < 0) | |
17310 | return err; | |
17311 | ||
17312 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
17313 | ||
17314 | alc_auto_parse_digital(codec); | |
17315 | ||
17316 | if (spec->kctls.list) | |
17317 | add_mixer(spec, spec->kctls.list); | |
17318 | ||
17319 | add_verb(spec, alc861vd_volume_init_verbs); | |
17320 | ||
17321 | spec->num_mux_defs = 1; | |
17322 | spec->input_mux = &spec->private_imux[0]; | |
17323 | ||
17324 | err = alc_auto_add_mic_boost(codec); | |
17325 | if (err < 0) | |
17326 | return err; | |
17327 | ||
17328 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
17329 | ||
17330 | return 1; | |
17331 | } | |
17332 | ||
17333 | /* additional initialization for auto-configuration model */ | |
17334 | static void alc861vd_auto_init(struct hda_codec *codec) | |
17335 | { | |
17336 | struct alc_spec *spec = codec->spec; | |
17337 | alc861vd_auto_init_multi_out(codec); | |
17338 | alc861vd_auto_init_hp_out(codec); | |
17339 | alc861vd_auto_init_analog_input(codec); | |
17340 | alc861vd_auto_init_input_src(codec); | |
17341 | alc_auto_init_digital(codec); | |
17342 | if (spec->unsol_event) | |
17343 | alc_inithook(codec); | |
17344 | } | |
17345 | ||
17346 | enum { | |
17347 | ALC660VD_FIX_ASUS_GPIO1 | |
17348 | }; | |
17349 | ||
17350 | /* reset GPIO1 */ | |
17351 | static const struct alc_fixup alc861vd_fixups[] = { | |
17352 | [ALC660VD_FIX_ASUS_GPIO1] = { | |
17353 | .type = ALC_FIXUP_VERBS, | |
17354 | .v.verbs = (const struct hda_verb[]) { | |
17355 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
17356 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
17357 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
17358 | { } | |
17359 | } | |
17360 | }, | |
17361 | }; | |
17362 | ||
17363 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { | |
17364 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), | |
17365 | {} | |
17366 | }; | |
17367 | ||
17368 | static int patch_alc861vd(struct hda_codec *codec) | |
17369 | { | |
17370 | struct alc_spec *spec; | |
17371 | int err, board_config; | |
17372 | ||
17373 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
17374 | if (spec == NULL) | |
17375 | return -ENOMEM; | |
17376 | ||
17377 | codec->spec = spec; | |
17378 | ||
17379 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, | |
17380 | alc861vd_models, | |
17381 | alc861vd_cfg_tbl); | |
17382 | ||
17383 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { | |
17384 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
17385 | codec->chip_name); | |
17386 | board_config = ALC861VD_AUTO; | |
17387 | } | |
17388 | ||
17389 | if (board_config == ALC861VD_AUTO) { | |
17390 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); | |
17391 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | |
17392 | } | |
17393 | ||
17394 | if (board_config == ALC861VD_AUTO) { | |
17395 | /* automatic parse from the BIOS config */ | |
17396 | err = alc861vd_parse_auto_config(codec); | |
17397 | if (err < 0) { | |
17398 | alc_free(codec); | |
17399 | return err; | |
17400 | } else if (!err) { | |
17401 | printk(KERN_INFO | |
17402 | "hda_codec: Cannot set up configuration " | |
17403 | "from BIOS. Using base mode...\n"); | |
17404 | board_config = ALC861VD_3ST; | |
17405 | } | |
17406 | } | |
17407 | ||
17408 | err = snd_hda_attach_beep_device(codec, 0x23); | |
17409 | if (err < 0) { | |
17410 | alc_free(codec); | |
17411 | return err; | |
17412 | } | |
17413 | ||
17414 | if (board_config != ALC861VD_AUTO) | |
17415 | setup_preset(codec, &alc861vd_presets[board_config]); | |
17416 | ||
17417 | if (codec->vendor_id == 0x10ec0660) { | |
17418 | /* always turn on EAPD */ | |
17419 | add_verb(spec, alc660vd_eapd_verbs); | |
17420 | } | |
17421 | ||
17422 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; | |
17423 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; | |
17424 | ||
17425 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; | |
17426 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; | |
17427 | ||
17428 | if (!spec->adc_nids) { | |
17429 | spec->adc_nids = alc861vd_adc_nids; | |
17430 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | |
17431 | } | |
17432 | if (!spec->capsrc_nids) | |
17433 | spec->capsrc_nids = alc861vd_capsrc_nids; | |
17434 | ||
17435 | set_capture_mixer(codec); | |
17436 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
17437 | ||
17438 | spec->vmaster_nid = 0x02; | |
17439 | ||
17440 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | |
17441 | ||
17442 | codec->patch_ops = alc_patch_ops; | |
17443 | ||
17444 | if (board_config == ALC861VD_AUTO) | |
17445 | spec->init_hook = alc861vd_auto_init; | |
17446 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
17447 | if (!spec->loopback.amplist) | |
17448 | spec->loopback.amplist = alc861vd_loopbacks; | |
17449 | #endif | |
17450 | ||
17451 | return 0; | |
17452 | } | |
17453 | ||
17454 | /* | |
17455 | * ALC662 support | |
17456 | * | |
17457 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible | |
17458 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
17459 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
17460 | * 6-channel independent captures. | |
17461 | * | |
17462 | * In addition, an independent DAC for the multi-playback (not used in this | |
17463 | * driver yet). | |
17464 | */ | |
17465 | #define ALC662_DIGOUT_NID 0x06 | |
17466 | #define ALC662_DIGIN_NID 0x0a | |
17467 | ||
17468 | static hda_nid_t alc662_dac_nids[4] = { | |
17469 | /* front, rear, clfe, rear_surr */ | |
17470 | 0x02, 0x03, 0x04 | |
17471 | }; | |
17472 | ||
17473 | static hda_nid_t alc272_dac_nids[2] = { | |
17474 | 0x02, 0x03 | |
17475 | }; | |
17476 | ||
17477 | static hda_nid_t alc662_adc_nids[2] = { | |
17478 | /* ADC1-2 */ | |
17479 | 0x09, 0x08 | |
17480 | }; | |
17481 | ||
17482 | static hda_nid_t alc272_adc_nids[1] = { | |
17483 | /* ADC1-2 */ | |
17484 | 0x08, | |
17485 | }; | |
17486 | ||
17487 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; | |
17488 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; | |
17489 | ||
17490 | ||
17491 | /* input MUX */ | |
17492 | /* FIXME: should be a matrix-type input source selection */ | |
17493 | static struct hda_input_mux alc662_capture_source = { | |
17494 | .num_items = 4, | |
17495 | .items = { | |
17496 | { "Mic", 0x0 }, | |
17497 | { "Front Mic", 0x1 }, | |
17498 | { "Line", 0x2 }, | |
17499 | { "CD", 0x4 }, | |
17500 | }, | |
17501 | }; | |
17502 | ||
17503 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { | |
17504 | .num_items = 2, | |
17505 | .items = { | |
17506 | { "Mic", 0x1 }, | |
17507 | { "Line", 0x2 }, | |
17508 | }, | |
17509 | }; | |
17510 | ||
17511 | static struct hda_input_mux alc663_capture_source = { | |
17512 | .num_items = 3, | |
17513 | .items = { | |
17514 | { "Mic", 0x0 }, | |
17515 | { "Front Mic", 0x1 }, | |
17516 | { "Line", 0x2 }, | |
17517 | }, | |
17518 | }; | |
17519 | ||
17520 | #if 0 /* set to 1 for testing other input sources below */ | |
17521 | static struct hda_input_mux alc272_nc10_capture_source = { | |
17522 | .num_items = 16, | |
17523 | .items = { | |
17524 | { "Autoselect Mic", 0x0 }, | |
17525 | { "Internal Mic", 0x1 }, | |
17526 | { "In-0x02", 0x2 }, | |
17527 | { "In-0x03", 0x3 }, | |
17528 | { "In-0x04", 0x4 }, | |
17529 | { "In-0x05", 0x5 }, | |
17530 | { "In-0x06", 0x6 }, | |
17531 | { "In-0x07", 0x7 }, | |
17532 | { "In-0x08", 0x8 }, | |
17533 | { "In-0x09", 0x9 }, | |
17534 | { "In-0x0a", 0x0a }, | |
17535 | { "In-0x0b", 0x0b }, | |
17536 | { "In-0x0c", 0x0c }, | |
17537 | { "In-0x0d", 0x0d }, | |
17538 | { "In-0x0e", 0x0e }, | |
17539 | { "In-0x0f", 0x0f }, | |
17540 | }, | |
17541 | }; | |
17542 | #endif | |
17543 | ||
17544 | /* | |
17545 | * 2ch mode | |
17546 | */ | |
17547 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { | |
17548 | { 2, NULL } | |
17549 | }; | |
17550 | ||
17551 | /* | |
17552 | * 2ch mode | |
17553 | */ | |
17554 | static struct hda_verb alc662_3ST_ch2_init[] = { | |
17555 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
17556 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
17557 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
17558 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
17559 | { } /* end */ | |
17560 | }; | |
17561 | ||
17562 | /* | |
17563 | * 6ch mode | |
17564 | */ | |
17565 | static struct hda_verb alc662_3ST_ch6_init[] = { | |
17566 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17567 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
17568 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
17569 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17570 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
17571 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
17572 | { } /* end */ | |
17573 | }; | |
17574 | ||
17575 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { | |
17576 | { 2, alc662_3ST_ch2_init }, | |
17577 | { 6, alc662_3ST_ch6_init }, | |
17578 | }; | |
17579 | ||
17580 | /* | |
17581 | * 2ch mode | |
17582 | */ | |
17583 | static struct hda_verb alc662_sixstack_ch6_init[] = { | |
17584 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
17585 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
17586 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17587 | { } /* end */ | |
17588 | }; | |
17589 | ||
17590 | /* | |
17591 | * 6ch mode | |
17592 | */ | |
17593 | static struct hda_verb alc662_sixstack_ch8_init[] = { | |
17594 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17595 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17596 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17597 | { } /* end */ | |
17598 | }; | |
17599 | ||
17600 | static struct hda_channel_mode alc662_5stack_modes[2] = { | |
17601 | { 2, alc662_sixstack_ch6_init }, | |
17602 | { 6, alc662_sixstack_ch8_init }, | |
17603 | }; | |
17604 | ||
17605 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
17606 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
17607 | */ | |
17608 | ||
17609 | static struct snd_kcontrol_new alc662_base_mixer[] = { | |
17610 | /* output mixer control */ | |
17611 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
17612 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
17613 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
17614 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), | |
17615 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | |
17616 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
17617 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), | |
17618 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
17619 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17620 | ||
17621 | /*Input mixer control */ | |
17622 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), | |
17623 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), | |
17624 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), | |
17625 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), | |
17626 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), | |
17627 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), | |
17628 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), | |
17629 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), | |
17630 | { } /* end */ | |
17631 | }; | |
17632 | ||
17633 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | |
17634 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17635 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
17636 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17637 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
17638 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
17639 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17640 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17642 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17643 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17644 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17645 | { } /* end */ | |
17646 | }; | |
17647 | ||
17648 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | |
17649 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17650 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
17651 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17652 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), | |
17653 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | |
17654 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
17655 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), | |
17656 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
17657 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17658 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
17659 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
17660 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17661 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17662 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17663 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17664 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17665 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17666 | { } /* end */ | |
17667 | }; | |
17668 | ||
17669 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { | |
17670 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17671 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | |
17672 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17673 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), | |
17674 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17675 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17676 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17677 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17678 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17679 | { } /* end */ | |
17680 | }; | |
17681 | ||
17682 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { | |
17683 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17684 | ALC262_HIPPO_MASTER_SWITCH, | |
17685 | ||
17686 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
17687 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17688 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17689 | ||
17690 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
17691 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17692 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17693 | { } /* end */ | |
17694 | }; | |
17695 | ||
17696 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { | |
17697 | ALC262_HIPPO_MASTER_SWITCH, | |
17698 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17699 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17700 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | |
17701 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
17702 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), | |
17703 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17704 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17705 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17706 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17707 | { } /* end */ | |
17708 | }; | |
17709 | ||
17710 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { | |
17711 | .ops = &snd_hda_bind_vol, | |
17712 | .values = { | |
17713 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
17714 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
17715 | 0 | |
17716 | }, | |
17717 | }; | |
17718 | ||
17719 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { | |
17720 | .ops = &snd_hda_bind_sw, | |
17721 | .values = { | |
17722 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17723 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17724 | 0 | |
17725 | }, | |
17726 | }; | |
17727 | ||
17728 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { | |
17729 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17730 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), | |
17731 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17732 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17733 | { } /* end */ | |
17734 | }; | |
17735 | ||
17736 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { | |
17737 | .ops = &snd_hda_bind_sw, | |
17738 | .values = { | |
17739 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17740 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17741 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17742 | 0 | |
17743 | }, | |
17744 | }; | |
17745 | ||
17746 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { | |
17747 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17748 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), | |
17749 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17750 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17751 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17752 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17753 | ||
17754 | { } /* end */ | |
17755 | }; | |
17756 | ||
17757 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { | |
17758 | .ops = &snd_hda_bind_sw, | |
17759 | .values = { | |
17760 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17761 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17762 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
17763 | 0 | |
17764 | }, | |
17765 | }; | |
17766 | ||
17767 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { | |
17768 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17769 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), | |
17770 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17771 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17772 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17773 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17774 | { } /* end */ | |
17775 | }; | |
17776 | ||
17777 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { | |
17778 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17779 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17780 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17781 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17782 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17783 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17784 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17785 | { } /* end */ | |
17786 | }; | |
17787 | ||
17788 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { | |
17789 | .ops = &snd_hda_bind_vol, | |
17790 | .values = { | |
17791 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
17792 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), | |
17793 | 0 | |
17794 | }, | |
17795 | }; | |
17796 | ||
17797 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { | |
17798 | .ops = &snd_hda_bind_sw, | |
17799 | .values = { | |
17800 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17801 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), | |
17802 | 0 | |
17803 | }, | |
17804 | }; | |
17805 | ||
17806 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { | |
17807 | HDA_BIND_VOL("Master Playback Volume", | |
17808 | &alc663_asus_two_bind_master_vol), | |
17809 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
17810 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17811 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17812 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17813 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17814 | { } /* end */ | |
17815 | }; | |
17816 | ||
17817 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { | |
17818 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17819 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
17820 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17821 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17822 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17823 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17824 | { } /* end */ | |
17825 | }; | |
17826 | ||
17827 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { | |
17828 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17829 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17830 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17831 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17832 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17833 | ||
17834 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17835 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17836 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17837 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17838 | { } /* end */ | |
17839 | }; | |
17840 | ||
17841 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { | |
17842 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17843 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17844 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17845 | ||
17846 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17847 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17848 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17849 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17850 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17851 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17852 | { } /* end */ | |
17853 | }; | |
17854 | ||
17855 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { | |
17856 | .ops = &snd_hda_bind_sw, | |
17857 | .values = { | |
17858 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17859 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17860 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | |
17861 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
17862 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17863 | 0 | |
17864 | }, | |
17865 | }; | |
17866 | ||
17867 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { | |
17868 | .ops = &snd_hda_bind_sw, | |
17869 | .values = { | |
17870 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17871 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | |
17872 | 0 | |
17873 | }, | |
17874 | }; | |
17875 | ||
17876 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { | |
17877 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | |
17878 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | |
17879 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | |
17880 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17881 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17882 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17883 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17884 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17885 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17886 | { } /* end */ | |
17887 | }; | |
17888 | ||
17889 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { | |
17890 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | |
17891 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | |
17892 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | |
17893 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17894 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17895 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17896 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17897 | { } /* end */ | |
17898 | }; | |
17899 | ||
17900 | ||
17901 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { | |
17902 | { | |
17903 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
17904 | .name = "Channel Mode", | |
17905 | .info = alc_ch_mode_info, | |
17906 | .get = alc_ch_mode_get, | |
17907 | .put = alc_ch_mode_put, | |
17908 | }, | |
17909 | { } /* end */ | |
17910 | }; | |
17911 | ||
17912 | static struct hda_verb alc662_init_verbs[] = { | |
17913 | /* ADC: mute amp left and right */ | |
17914 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17915 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
17916 | ||
17917 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17918 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17919 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17920 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17921 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17923 | ||
17924 | /* Front Pin: output 0 (0x0c) */ | |
17925 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17926 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17927 | ||
17928 | /* Rear Pin: output 1 (0x0d) */ | |
17929 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17930 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17931 | ||
17932 | /* CLFE Pin: output 2 (0x0e) */ | |
17933 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17934 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17935 | ||
17936 | /* Mic (rear) pin: input vref at 80% */ | |
17937 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
17938 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17939 | /* Front Mic pin: input vref at 80% */ | |
17940 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
17941 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17942 | /* Line In pin: input */ | |
17943 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17944 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17945 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
17946 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17947 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17948 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
17949 | /* CD pin widget for input */ | |
17950 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17951 | ||
17952 | /* FIXME: use matrix-type input source selection */ | |
17953 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
17954 | /* Input mixer */ | |
17955 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17956 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17957 | ||
17958 | /* always trun on EAPD */ | |
17959 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
17960 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
17961 | ||
17962 | { } | |
17963 | }; | |
17964 | ||
17965 | static struct hda_verb alc663_init_verbs[] = { | |
17966 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17967 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17968 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17969 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17970 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17971 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17972 | { } | |
17973 | }; | |
17974 | ||
17975 | static struct hda_verb alc272_init_verbs[] = { | |
17976 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17977 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17978 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17979 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17980 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17981 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17982 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17983 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17984 | { } | |
17985 | }; | |
17986 | ||
17987 | static struct hda_verb alc662_sue_init_verbs[] = { | |
17988 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
17989 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
17990 | {} | |
17991 | }; | |
17992 | ||
17993 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { | |
17994 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17995 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17996 | {} | |
17997 | }; | |
17998 | ||
17999 | /* Set Unsolicited Event*/ | |
18000 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { | |
18001 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
18002 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18003 | {} | |
18004 | }; | |
18005 | ||
18006 | static struct hda_verb alc663_m51va_init_verbs[] = { | |
18007 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18008 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18009 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18010 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18011 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
18012 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
18013 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
18014 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18015 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18016 | {} | |
18017 | }; | |
18018 | ||
18019 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { | |
18020 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18021 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18022 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
18023 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
18024 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
18025 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18026 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18027 | {} | |
18028 | }; | |
18029 | ||
18030 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { | |
18031 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18032 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18033 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18034 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
18035 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
18036 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
18037 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18038 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18039 | {} | |
18040 | }; | |
18041 | ||
18042 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { | |
18043 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18044 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18045 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
18046 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
18047 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
18048 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18049 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18050 | {} | |
18051 | }; | |
18052 | ||
18053 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { | |
18054 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18055 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18056 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18057 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
18058 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18059 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18060 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
18061 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
18062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
18063 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18064 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18065 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18066 | {} | |
18067 | }; | |
18068 | ||
18069 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { | |
18070 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18071 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18072 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18073 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
18074 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18075 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18076 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
18077 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
18078 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
18079 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18080 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18081 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18082 | {} | |
18083 | }; | |
18084 | ||
18085 | static struct hda_verb alc663_g71v_init_verbs[] = { | |
18086 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18087 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
18088 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ | |
18089 | ||
18090 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18091 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18092 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
18093 | ||
18094 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
18095 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, | |
18096 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
18097 | {} | |
18098 | }; | |
18099 | ||
18100 | static struct hda_verb alc663_g50v_init_verbs[] = { | |
18101 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18102 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18103 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
18104 | ||
18105 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18106 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18107 | {} | |
18108 | }; | |
18109 | ||
18110 | static struct hda_verb alc662_ecs_init_verbs[] = { | |
18111 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | |
18112 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
18113 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18114 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18115 | {} | |
18116 | }; | |
18117 | ||
18118 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { | |
18119 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18120 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18121 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18122 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18123 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18124 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18125 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
18126 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
18127 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
18128 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18129 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18130 | {} | |
18131 | }; | |
18132 | ||
18133 | static struct hda_verb alc272_dell_init_verbs[] = { | |
18134 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18135 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18136 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18137 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18138 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18139 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18140 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
18141 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
18142 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
18143 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18144 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18145 | {} | |
18146 | }; | |
18147 | ||
18148 | static struct hda_verb alc663_mode7_init_verbs[] = { | |
18149 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18150 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18151 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
18152 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18153 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18154 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18155 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
18156 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18157 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18158 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
18159 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
18160 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
18161 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18162 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18163 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18164 | {} | |
18165 | }; | |
18166 | ||
18167 | static struct hda_verb alc663_mode8_init_verbs[] = { | |
18168 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18169 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18170 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18171 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
18172 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18173 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
18174 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18175 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18176 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18177 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18178 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
18179 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
18180 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
18181 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18182 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18183 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18184 | {} | |
18185 | }; | |
18186 | ||
18187 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { | |
18188 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
18189 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
18190 | { } /* end */ | |
18191 | }; | |
18192 | ||
18193 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { | |
18194 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
18195 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
18196 | { } /* end */ | |
18197 | }; | |
18198 | ||
18199 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | |
18200 | { | |
18201 | unsigned int present; | |
18202 | unsigned char bits; | |
18203 | ||
18204 | present = snd_hda_jack_detect(codec, 0x14); | |
18205 | bits = present ? HDA_AMP_MUTE : 0; | |
18206 | ||
18207 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
18208 | HDA_AMP_MUTE, bits); | |
18209 | } | |
18210 | ||
18211 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) | |
18212 | { | |
18213 | unsigned int present; | |
18214 | unsigned char bits; | |
18215 | ||
18216 | present = snd_hda_jack_detect(codec, 0x1b); | |
18217 | bits = present ? HDA_AMP_MUTE : 0; | |
18218 | ||
18219 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
18220 | HDA_AMP_MUTE, bits); | |
18221 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
18222 | HDA_AMP_MUTE, bits); | |
18223 | } | |
18224 | ||
18225 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | |
18226 | unsigned int res) | |
18227 | { | |
18228 | if ((res >> 26) == ALC880_HP_EVENT) | |
18229 | alc662_lenovo_101e_all_automute(codec); | |
18230 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
18231 | alc662_lenovo_101e_ispeaker_automute(codec); | |
18232 | } | |
18233 | ||
18234 | /* unsolicited event for HP jack sensing */ | |
18235 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | |
18236 | unsigned int res) | |
18237 | { | |
18238 | if ((res >> 26) == ALC880_MIC_EVENT) | |
18239 | alc_mic_automute(codec); | |
18240 | else | |
18241 | alc262_hippo_unsol_event(codec, res); | |
18242 | } | |
18243 | ||
18244 | static void alc662_eeepc_setup(struct hda_codec *codec) | |
18245 | { | |
18246 | struct alc_spec *spec = codec->spec; | |
18247 | ||
18248 | alc262_hippo1_setup(codec); | |
18249 | spec->ext_mic.pin = 0x18; | |
18250 | spec->ext_mic.mux_idx = 0; | |
18251 | spec->int_mic.pin = 0x19; | |
18252 | spec->int_mic.mux_idx = 1; | |
18253 | spec->auto_mic = 1; | |
18254 | } | |
18255 | ||
18256 | static void alc662_eeepc_inithook(struct hda_codec *codec) | |
18257 | { | |
18258 | alc262_hippo_automute(codec); | |
18259 | alc_mic_automute(codec); | |
18260 | } | |
18261 | ||
18262 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) | |
18263 | { | |
18264 | struct alc_spec *spec = codec->spec; | |
18265 | ||
18266 | spec->autocfg.hp_pins[0] = 0x14; | |
18267 | spec->autocfg.speaker_pins[0] = 0x1b; | |
18268 | } | |
18269 | ||
18270 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update | |
18271 | ||
18272 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) | |
18273 | { | |
18274 | unsigned int present; | |
18275 | unsigned char bits; | |
18276 | ||
18277 | present = snd_hda_jack_detect(codec, 0x21); | |
18278 | bits = present ? HDA_AMP_MUTE : 0; | |
18279 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
18280 | HDA_AMP_MUTE, bits); | |
18281 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
18282 | HDA_AMP_MUTE, bits); | |
18283 | } | |
18284 | ||
18285 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | |
18286 | { | |
18287 | unsigned int present; | |
18288 | unsigned char bits; | |
18289 | ||
18290 | present = snd_hda_jack_detect(codec, 0x21); | |
18291 | bits = present ? HDA_AMP_MUTE : 0; | |
18292 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
18293 | HDA_AMP_MUTE, bits); | |
18294 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
18295 | HDA_AMP_MUTE, bits); | |
18296 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | |
18297 | HDA_AMP_MUTE, bits); | |
18298 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | |
18299 | HDA_AMP_MUTE, bits); | |
18300 | } | |
18301 | ||
18302 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | |
18303 | { | |
18304 | unsigned int present; | |
18305 | unsigned char bits; | |
18306 | ||
18307 | present = snd_hda_jack_detect(codec, 0x15); | |
18308 | bits = present ? HDA_AMP_MUTE : 0; | |
18309 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
18310 | HDA_AMP_MUTE, bits); | |
18311 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
18312 | HDA_AMP_MUTE, bits); | |
18313 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | |
18314 | HDA_AMP_MUTE, bits); | |
18315 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | |
18316 | HDA_AMP_MUTE, bits); | |
18317 | } | |
18318 | ||
18319 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) | |
18320 | { | |
18321 | unsigned int present; | |
18322 | unsigned char bits; | |
18323 | ||
18324 | present = snd_hda_jack_detect(codec, 0x1b); | |
18325 | bits = present ? 0 : PIN_OUT; | |
18326 | snd_hda_codec_write(codec, 0x14, 0, | |
18327 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | |
18328 | } | |
18329 | ||
18330 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) | |
18331 | { | |
18332 | unsigned int present1, present2; | |
18333 | ||
18334 | present1 = snd_hda_jack_detect(codec, 0x21); | |
18335 | present2 = snd_hda_jack_detect(codec, 0x15); | |
18336 | ||
18337 | if (present1 || present2) { | |
18338 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18339 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18340 | } else { | |
18341 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18342 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18343 | } | |
18344 | } | |
18345 | ||
18346 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |
18347 | { | |
18348 | unsigned int present1, present2; | |
18349 | ||
18350 | present1 = snd_hda_jack_detect(codec, 0x1b); | |
18351 | present2 = snd_hda_jack_detect(codec, 0x15); | |
18352 | ||
18353 | if (present1 || present2) { | |
18354 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
18355 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
18356 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
18357 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
18358 | } else { | |
18359 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
18360 | HDA_AMP_MUTE, 0); | |
18361 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
18362 | HDA_AMP_MUTE, 0); | |
18363 | } | |
18364 | } | |
18365 | ||
18366 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) | |
18367 | { | |
18368 | unsigned int present1, present2; | |
18369 | ||
18370 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | |
18371 | AC_VERB_GET_PIN_SENSE, 0) | |
18372 | & AC_PINSENSE_PRESENCE; | |
18373 | present2 = snd_hda_codec_read(codec, 0x21, 0, | |
18374 | AC_VERB_GET_PIN_SENSE, 0) | |
18375 | & AC_PINSENSE_PRESENCE; | |
18376 | ||
18377 | if (present1 || present2) { | |
18378 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18379 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18380 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
18381 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18382 | } else { | |
18383 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18384 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18385 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
18386 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18387 | } | |
18388 | } | |
18389 | ||
18390 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) | |
18391 | { | |
18392 | unsigned int present1, present2; | |
18393 | ||
18394 | present1 = snd_hda_codec_read(codec, 0x21, 0, | |
18395 | AC_VERB_GET_PIN_SENSE, 0) | |
18396 | & AC_PINSENSE_PRESENCE; | |
18397 | present2 = snd_hda_codec_read(codec, 0x15, 0, | |
18398 | AC_VERB_GET_PIN_SENSE, 0) | |
18399 | & AC_PINSENSE_PRESENCE; | |
18400 | ||
18401 | if (present1 || present2) { | |
18402 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18403 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18404 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
18405 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18406 | } else { | |
18407 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18408 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18409 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
18410 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18411 | } | |
18412 | } | |
18413 | ||
18414 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | |
18415 | unsigned int res) | |
18416 | { | |
18417 | switch (res >> 26) { | |
18418 | case ALC880_HP_EVENT: | |
18419 | alc663_m51va_speaker_automute(codec); | |
18420 | break; | |
18421 | case ALC880_MIC_EVENT: | |
18422 | alc_mic_automute(codec); | |
18423 | break; | |
18424 | } | |
18425 | } | |
18426 | ||
18427 | static void alc663_m51va_setup(struct hda_codec *codec) | |
18428 | { | |
18429 | struct alc_spec *spec = codec->spec; | |
18430 | spec->ext_mic.pin = 0x18; | |
18431 | spec->ext_mic.mux_idx = 0; | |
18432 | spec->int_mic.pin = 0x12; | |
18433 | spec->int_mic.mux_idx = 9; | |
18434 | spec->auto_mic = 1; | |
18435 | } | |
18436 | ||
18437 | static void alc663_m51va_inithook(struct hda_codec *codec) | |
18438 | { | |
18439 | alc663_m51va_speaker_automute(codec); | |
18440 | alc_mic_automute(codec); | |
18441 | } | |
18442 | ||
18443 | /* ***************** Mode1 ******************************/ | |
18444 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event | |
18445 | ||
18446 | static void alc663_mode1_setup(struct hda_codec *codec) | |
18447 | { | |
18448 | struct alc_spec *spec = codec->spec; | |
18449 | spec->ext_mic.pin = 0x18; | |
18450 | spec->ext_mic.mux_idx = 0; | |
18451 | spec->int_mic.pin = 0x19; | |
18452 | spec->int_mic.mux_idx = 1; | |
18453 | spec->auto_mic = 1; | |
18454 | } | |
18455 | ||
18456 | #define alc663_mode1_inithook alc663_m51va_inithook | |
18457 | ||
18458 | /* ***************** Mode2 ******************************/ | |
18459 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | |
18460 | unsigned int res) | |
18461 | { | |
18462 | switch (res >> 26) { | |
18463 | case ALC880_HP_EVENT: | |
18464 | alc662_f5z_speaker_automute(codec); | |
18465 | break; | |
18466 | case ALC880_MIC_EVENT: | |
18467 | alc_mic_automute(codec); | |
18468 | break; | |
18469 | } | |
18470 | } | |
18471 | ||
18472 | #define alc662_mode2_setup alc663_mode1_setup | |
18473 | ||
18474 | static void alc662_mode2_inithook(struct hda_codec *codec) | |
18475 | { | |
18476 | alc662_f5z_speaker_automute(codec); | |
18477 | alc_mic_automute(codec); | |
18478 | } | |
18479 | /* ***************** Mode3 ******************************/ | |
18480 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | |
18481 | unsigned int res) | |
18482 | { | |
18483 | switch (res >> 26) { | |
18484 | case ALC880_HP_EVENT: | |
18485 | alc663_two_hp_m1_speaker_automute(codec); | |
18486 | break; | |
18487 | case ALC880_MIC_EVENT: | |
18488 | alc_mic_automute(codec); | |
18489 | break; | |
18490 | } | |
18491 | } | |
18492 | ||
18493 | #define alc663_mode3_setup alc663_mode1_setup | |
18494 | ||
18495 | static void alc663_mode3_inithook(struct hda_codec *codec) | |
18496 | { | |
18497 | alc663_two_hp_m1_speaker_automute(codec); | |
18498 | alc_mic_automute(codec); | |
18499 | } | |
18500 | /* ***************** Mode4 ******************************/ | |
18501 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | |
18502 | unsigned int res) | |
18503 | { | |
18504 | switch (res >> 26) { | |
18505 | case ALC880_HP_EVENT: | |
18506 | alc663_21jd_two_speaker_automute(codec); | |
18507 | break; | |
18508 | case ALC880_MIC_EVENT: | |
18509 | alc_mic_automute(codec); | |
18510 | break; | |
18511 | } | |
18512 | } | |
18513 | ||
18514 | #define alc663_mode4_setup alc663_mode1_setup | |
18515 | ||
18516 | static void alc663_mode4_inithook(struct hda_codec *codec) | |
18517 | { | |
18518 | alc663_21jd_two_speaker_automute(codec); | |
18519 | alc_mic_automute(codec); | |
18520 | } | |
18521 | /* ***************** Mode5 ******************************/ | |
18522 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | |
18523 | unsigned int res) | |
18524 | { | |
18525 | switch (res >> 26) { | |
18526 | case ALC880_HP_EVENT: | |
18527 | alc663_15jd_two_speaker_automute(codec); | |
18528 | break; | |
18529 | case ALC880_MIC_EVENT: | |
18530 | alc_mic_automute(codec); | |
18531 | break; | |
18532 | } | |
18533 | } | |
18534 | ||
18535 | #define alc663_mode5_setup alc663_mode1_setup | |
18536 | ||
18537 | static void alc663_mode5_inithook(struct hda_codec *codec) | |
18538 | { | |
18539 | alc663_15jd_two_speaker_automute(codec); | |
18540 | alc_mic_automute(codec); | |
18541 | } | |
18542 | /* ***************** Mode6 ******************************/ | |
18543 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | |
18544 | unsigned int res) | |
18545 | { | |
18546 | switch (res >> 26) { | |
18547 | case ALC880_HP_EVENT: | |
18548 | alc663_two_hp_m2_speaker_automute(codec); | |
18549 | break; | |
18550 | case ALC880_MIC_EVENT: | |
18551 | alc_mic_automute(codec); | |
18552 | break; | |
18553 | } | |
18554 | } | |
18555 | ||
18556 | #define alc663_mode6_setup alc663_mode1_setup | |
18557 | ||
18558 | static void alc663_mode6_inithook(struct hda_codec *codec) | |
18559 | { | |
18560 | alc663_two_hp_m2_speaker_automute(codec); | |
18561 | alc_mic_automute(codec); | |
18562 | } | |
18563 | ||
18564 | /* ***************** Mode7 ******************************/ | |
18565 | static void alc663_mode7_unsol_event(struct hda_codec *codec, | |
18566 | unsigned int res) | |
18567 | { | |
18568 | switch (res >> 26) { | |
18569 | case ALC880_HP_EVENT: | |
18570 | alc663_two_hp_m7_speaker_automute(codec); | |
18571 | break; | |
18572 | case ALC880_MIC_EVENT: | |
18573 | alc_mic_automute(codec); | |
18574 | break; | |
18575 | } | |
18576 | } | |
18577 | ||
18578 | #define alc663_mode7_setup alc663_mode1_setup | |
18579 | ||
18580 | static void alc663_mode7_inithook(struct hda_codec *codec) | |
18581 | { | |
18582 | alc663_two_hp_m7_speaker_automute(codec); | |
18583 | alc_mic_automute(codec); | |
18584 | } | |
18585 | ||
18586 | /* ***************** Mode8 ******************************/ | |
18587 | static void alc663_mode8_unsol_event(struct hda_codec *codec, | |
18588 | unsigned int res) | |
18589 | { | |
18590 | switch (res >> 26) { | |
18591 | case ALC880_HP_EVENT: | |
18592 | alc663_two_hp_m8_speaker_automute(codec); | |
18593 | break; | |
18594 | case ALC880_MIC_EVENT: | |
18595 | alc_mic_automute(codec); | |
18596 | break; | |
18597 | } | |
18598 | } | |
18599 | ||
18600 | #define alc663_mode8_setup alc663_m51va_setup | |
18601 | ||
18602 | static void alc663_mode8_inithook(struct hda_codec *codec) | |
18603 | { | |
18604 | alc663_two_hp_m8_speaker_automute(codec); | |
18605 | alc_mic_automute(codec); | |
18606 | } | |
18607 | ||
18608 | static void alc663_g71v_hp_automute(struct hda_codec *codec) | |
18609 | { | |
18610 | unsigned int present; | |
18611 | unsigned char bits; | |
18612 | ||
18613 | present = snd_hda_jack_detect(codec, 0x21); | |
18614 | bits = present ? HDA_AMP_MUTE : 0; | |
18615 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
18616 | HDA_AMP_MUTE, bits); | |
18617 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
18618 | HDA_AMP_MUTE, bits); | |
18619 | } | |
18620 | ||
18621 | static void alc663_g71v_front_automute(struct hda_codec *codec) | |
18622 | { | |
18623 | unsigned int present; | |
18624 | unsigned char bits; | |
18625 | ||
18626 | present = snd_hda_jack_detect(codec, 0x15); | |
18627 | bits = present ? HDA_AMP_MUTE : 0; | |
18628 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
18629 | HDA_AMP_MUTE, bits); | |
18630 | } | |
18631 | ||
18632 | static void alc663_g71v_unsol_event(struct hda_codec *codec, | |
18633 | unsigned int res) | |
18634 | { | |
18635 | switch (res >> 26) { | |
18636 | case ALC880_HP_EVENT: | |
18637 | alc663_g71v_hp_automute(codec); | |
18638 | break; | |
18639 | case ALC880_FRONT_EVENT: | |
18640 | alc663_g71v_front_automute(codec); | |
18641 | break; | |
18642 | case ALC880_MIC_EVENT: | |
18643 | alc_mic_automute(codec); | |
18644 | break; | |
18645 | } | |
18646 | } | |
18647 | ||
18648 | #define alc663_g71v_setup alc663_m51va_setup | |
18649 | ||
18650 | static void alc663_g71v_inithook(struct hda_codec *codec) | |
18651 | { | |
18652 | alc663_g71v_front_automute(codec); | |
18653 | alc663_g71v_hp_automute(codec); | |
18654 | alc_mic_automute(codec); | |
18655 | } | |
18656 | ||
18657 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | |
18658 | unsigned int res) | |
18659 | { | |
18660 | switch (res >> 26) { | |
18661 | case ALC880_HP_EVENT: | |
18662 | alc663_m51va_speaker_automute(codec); | |
18663 | break; | |
18664 | case ALC880_MIC_EVENT: | |
18665 | alc_mic_automute(codec); | |
18666 | break; | |
18667 | } | |
18668 | } | |
18669 | ||
18670 | #define alc663_g50v_setup alc663_m51va_setup | |
18671 | ||
18672 | static void alc663_g50v_inithook(struct hda_codec *codec) | |
18673 | { | |
18674 | alc663_m51va_speaker_automute(codec); | |
18675 | alc_mic_automute(codec); | |
18676 | } | |
18677 | ||
18678 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { | |
18679 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
18680 | ALC262_HIPPO_MASTER_SWITCH, | |
18681 | ||
18682 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), | |
18683 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
18684 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
18685 | ||
18686 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
18687 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
18688 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
18689 | { } /* end */ | |
18690 | }; | |
18691 | ||
18692 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { | |
18693 | /* Master Playback automatically created from Speaker and Headphone */ | |
18694 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
18695 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
18696 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
18697 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
18698 | ||
18699 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
18700 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
18701 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
18702 | ||
18703 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
18704 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
18705 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), | |
18706 | { } /* end */ | |
18707 | }; | |
18708 | ||
18709 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
18710 | #define alc662_loopbacks alc880_loopbacks | |
18711 | #endif | |
18712 | ||
18713 | ||
18714 | /* pcm configuration: identical with ALC880 */ | |
18715 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback | |
18716 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture | |
18717 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback | |
18718 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture | |
18719 | ||
18720 | /* | |
18721 | * configuration and preset | |
18722 | */ | |
18723 | static const char * const alc662_models[ALC662_MODEL_LAST] = { | |
18724 | [ALC662_3ST_2ch_DIG] = "3stack-dig", | |
18725 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", | |
18726 | [ALC662_3ST_6ch] = "3stack-6ch", | |
18727 | [ALC662_5ST_DIG] = "6stack-dig", | |
18728 | [ALC662_LENOVO_101E] = "lenovo-101e", | |
18729 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", | |
18730 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", | |
18731 | [ALC662_ECS] = "ecs", | |
18732 | [ALC663_ASUS_M51VA] = "m51va", | |
18733 | [ALC663_ASUS_G71V] = "g71v", | |
18734 | [ALC663_ASUS_H13] = "h13", | |
18735 | [ALC663_ASUS_G50V] = "g50v", | |
18736 | [ALC663_ASUS_MODE1] = "asus-mode1", | |
18737 | [ALC662_ASUS_MODE2] = "asus-mode2", | |
18738 | [ALC663_ASUS_MODE3] = "asus-mode3", | |
18739 | [ALC663_ASUS_MODE4] = "asus-mode4", | |
18740 | [ALC663_ASUS_MODE5] = "asus-mode5", | |
18741 | [ALC663_ASUS_MODE6] = "asus-mode6", | |
18742 | [ALC663_ASUS_MODE7] = "asus-mode7", | |
18743 | [ALC663_ASUS_MODE8] = "asus-mode8", | |
18744 | [ALC272_DELL] = "dell", | |
18745 | [ALC272_DELL_ZM1] = "dell-zm1", | |
18746 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", | |
18747 | [ALC662_AUTO] = "auto", | |
18748 | }; | |
18749 | ||
18750 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | |
18751 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), | |
18752 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), | |
18753 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), | |
18754 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), | |
18755 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), | |
18756 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), | |
18757 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), | |
18758 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | |
18759 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | |
18760 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | |
18761 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), | |
18762 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), | |
18763 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | |
18764 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), | |
18765 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), | |
18766 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), | |
18767 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), | |
18768 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), | |
18769 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), | |
18770 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), | |
18771 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), | |
18772 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), | |
18773 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | |
18774 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | |
18775 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | |
18776 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), | |
18777 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), | |
18778 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), | |
18779 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), | |
18780 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), | |
18781 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), | |
18782 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | |
18783 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | |
18784 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), | |
18785 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), | |
18786 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), | |
18787 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), | |
18788 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ | |
18789 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), | |
18790 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), | |
18791 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), | |
18792 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), | |
18793 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), | |
18794 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), | |
18795 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), | |
18796 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | |
18797 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | |
18798 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), | |
18799 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), | |
18800 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | |
18801 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), | |
18802 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), | |
18803 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), | |
18804 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ | |
18805 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | |
18806 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | |
18807 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), | |
18808 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), | |
18809 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), | |
18810 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), | |
18811 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | |
18812 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | |
18813 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | |
18814 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", | |
18815 | ALC662_3ST_6ch_DIG), | |
18816 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), | |
18817 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), | |
18818 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", | |
18819 | ALC662_3ST_6ch_DIG), | |
18820 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), | |
18821 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), | |
18822 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), | |
18823 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), | |
18824 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", | |
18825 | ALC662_3ST_6ch_DIG), | |
18826 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", | |
18827 | ALC663_ASUS_H13), | |
18828 | SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E), | |
18829 | {} | |
18830 | }; | |
18831 | ||
18832 | static struct alc_config_preset alc662_presets[] = { | |
18833 | [ALC662_3ST_2ch_DIG] = { | |
18834 | .mixers = { alc662_3ST_2ch_mixer }, | |
18835 | .init_verbs = { alc662_init_verbs }, | |
18836 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18837 | .dac_nids = alc662_dac_nids, | |
18838 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18839 | .dig_in_nid = ALC662_DIGIN_NID, | |
18840 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18841 | .channel_mode = alc662_3ST_2ch_modes, | |
18842 | .input_mux = &alc662_capture_source, | |
18843 | }, | |
18844 | [ALC662_3ST_6ch_DIG] = { | |
18845 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, | |
18846 | .init_verbs = { alc662_init_verbs }, | |
18847 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18848 | .dac_nids = alc662_dac_nids, | |
18849 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18850 | .dig_in_nid = ALC662_DIGIN_NID, | |
18851 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18852 | .channel_mode = alc662_3ST_6ch_modes, | |
18853 | .need_dac_fix = 1, | |
18854 | .input_mux = &alc662_capture_source, | |
18855 | }, | |
18856 | [ALC662_3ST_6ch] = { | |
18857 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, | |
18858 | .init_verbs = { alc662_init_verbs }, | |
18859 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18860 | .dac_nids = alc662_dac_nids, | |
18861 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18862 | .channel_mode = alc662_3ST_6ch_modes, | |
18863 | .need_dac_fix = 1, | |
18864 | .input_mux = &alc662_capture_source, | |
18865 | }, | |
18866 | [ALC662_5ST_DIG] = { | |
18867 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, | |
18868 | .init_verbs = { alc662_init_verbs }, | |
18869 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18870 | .dac_nids = alc662_dac_nids, | |
18871 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18872 | .dig_in_nid = ALC662_DIGIN_NID, | |
18873 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | |
18874 | .channel_mode = alc662_5stack_modes, | |
18875 | .input_mux = &alc662_capture_source, | |
18876 | }, | |
18877 | [ALC662_LENOVO_101E] = { | |
18878 | .mixers = { alc662_lenovo_101e_mixer }, | |
18879 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, | |
18880 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18881 | .dac_nids = alc662_dac_nids, | |
18882 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18883 | .channel_mode = alc662_3ST_2ch_modes, | |
18884 | .input_mux = &alc662_lenovo_101e_capture_source, | |
18885 | .unsol_event = alc662_lenovo_101e_unsol_event, | |
18886 | .init_hook = alc662_lenovo_101e_all_automute, | |
18887 | }, | |
18888 | [ALC662_ASUS_EEEPC_P701] = { | |
18889 | .mixers = { alc662_eeepc_p701_mixer }, | |
18890 | .init_verbs = { alc662_init_verbs, | |
18891 | alc662_eeepc_sue_init_verbs }, | |
18892 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18893 | .dac_nids = alc662_dac_nids, | |
18894 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18895 | .channel_mode = alc662_3ST_2ch_modes, | |
18896 | .unsol_event = alc662_eeepc_unsol_event, | |
18897 | .setup = alc662_eeepc_setup, | |
18898 | .init_hook = alc662_eeepc_inithook, | |
18899 | }, | |
18900 | [ALC662_ASUS_EEEPC_EP20] = { | |
18901 | .mixers = { alc662_eeepc_ep20_mixer, | |
18902 | alc662_chmode_mixer }, | |
18903 | .init_verbs = { alc662_init_verbs, | |
18904 | alc662_eeepc_ep20_sue_init_verbs }, | |
18905 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18906 | .dac_nids = alc662_dac_nids, | |
18907 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18908 | .channel_mode = alc662_3ST_6ch_modes, | |
18909 | .input_mux = &alc662_lenovo_101e_capture_source, | |
18910 | .unsol_event = alc662_eeepc_unsol_event, | |
18911 | .setup = alc662_eeepc_ep20_setup, | |
18912 | .init_hook = alc662_eeepc_ep20_inithook, | |
18913 | }, | |
18914 | [ALC662_ECS] = { | |
18915 | .mixers = { alc662_ecs_mixer }, | |
18916 | .init_verbs = { alc662_init_verbs, | |
18917 | alc662_ecs_init_verbs }, | |
18918 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18919 | .dac_nids = alc662_dac_nids, | |
18920 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18921 | .channel_mode = alc662_3ST_2ch_modes, | |
18922 | .unsol_event = alc662_eeepc_unsol_event, | |
18923 | .setup = alc662_eeepc_setup, | |
18924 | .init_hook = alc662_eeepc_inithook, | |
18925 | }, | |
18926 | [ALC663_ASUS_M51VA] = { | |
18927 | .mixers = { alc663_m51va_mixer }, | |
18928 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | |
18929 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18930 | .dac_nids = alc662_dac_nids, | |
18931 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18932 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18933 | .channel_mode = alc662_3ST_2ch_modes, | |
18934 | .unsol_event = alc663_m51va_unsol_event, | |
18935 | .setup = alc663_m51va_setup, | |
18936 | .init_hook = alc663_m51va_inithook, | |
18937 | }, | |
18938 | [ALC663_ASUS_G71V] = { | |
18939 | .mixers = { alc663_g71v_mixer }, | |
18940 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, | |
18941 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18942 | .dac_nids = alc662_dac_nids, | |
18943 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18944 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18945 | .channel_mode = alc662_3ST_2ch_modes, | |
18946 | .unsol_event = alc663_g71v_unsol_event, | |
18947 | .setup = alc663_g71v_setup, | |
18948 | .init_hook = alc663_g71v_inithook, | |
18949 | }, | |
18950 | [ALC663_ASUS_H13] = { | |
18951 | .mixers = { alc663_m51va_mixer }, | |
18952 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | |
18953 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18954 | .dac_nids = alc662_dac_nids, | |
18955 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18956 | .channel_mode = alc662_3ST_2ch_modes, | |
18957 | .unsol_event = alc663_m51va_unsol_event, | |
18958 | .init_hook = alc663_m51va_inithook, | |
18959 | }, | |
18960 | [ALC663_ASUS_G50V] = { | |
18961 | .mixers = { alc663_g50v_mixer }, | |
18962 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, | |
18963 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18964 | .dac_nids = alc662_dac_nids, | |
18965 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18966 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18967 | .channel_mode = alc662_3ST_6ch_modes, | |
18968 | .input_mux = &alc663_capture_source, | |
18969 | .unsol_event = alc663_g50v_unsol_event, | |
18970 | .setup = alc663_g50v_setup, | |
18971 | .init_hook = alc663_g50v_inithook, | |
18972 | }, | |
18973 | [ALC663_ASUS_MODE1] = { | |
18974 | .mixers = { alc663_m51va_mixer }, | |
18975 | .cap_mixer = alc662_auto_capture_mixer, | |
18976 | .init_verbs = { alc662_init_verbs, | |
18977 | alc663_21jd_amic_init_verbs }, | |
18978 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18979 | .hp_nid = 0x03, | |
18980 | .dac_nids = alc662_dac_nids, | |
18981 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18982 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18983 | .channel_mode = alc662_3ST_2ch_modes, | |
18984 | .unsol_event = alc663_mode1_unsol_event, | |
18985 | .setup = alc663_mode1_setup, | |
18986 | .init_hook = alc663_mode1_inithook, | |
18987 | }, | |
18988 | [ALC662_ASUS_MODE2] = { | |
18989 | .mixers = { alc662_1bjd_mixer }, | |
18990 | .cap_mixer = alc662_auto_capture_mixer, | |
18991 | .init_verbs = { alc662_init_verbs, | |
18992 | alc662_1bjd_amic_init_verbs }, | |
18993 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18994 | .dac_nids = alc662_dac_nids, | |
18995 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18996 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18997 | .channel_mode = alc662_3ST_2ch_modes, | |
18998 | .unsol_event = alc662_mode2_unsol_event, | |
18999 | .setup = alc662_mode2_setup, | |
19000 | .init_hook = alc662_mode2_inithook, | |
19001 | }, | |
19002 | [ALC663_ASUS_MODE3] = { | |
19003 | .mixers = { alc663_two_hp_m1_mixer }, | |
19004 | .cap_mixer = alc662_auto_capture_mixer, | |
19005 | .init_verbs = { alc662_init_verbs, | |
19006 | alc663_two_hp_amic_m1_init_verbs }, | |
19007 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
19008 | .hp_nid = 0x03, | |
19009 | .dac_nids = alc662_dac_nids, | |
19010 | .dig_out_nid = ALC662_DIGOUT_NID, | |
19011 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
19012 | .channel_mode = alc662_3ST_2ch_modes, | |
19013 | .unsol_event = alc663_mode3_unsol_event, | |
19014 | .setup = alc663_mode3_setup, | |
19015 | .init_hook = alc663_mode3_inithook, | |
19016 | }, | |
19017 | [ALC663_ASUS_MODE4] = { | |
19018 | .mixers = { alc663_asus_21jd_clfe_mixer }, | |
19019 | .cap_mixer = alc662_auto_capture_mixer, | |
19020 | .init_verbs = { alc662_init_verbs, | |
19021 | alc663_21jd_amic_init_verbs}, | |
19022 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
19023 | .hp_nid = 0x03, | |
19024 | .dac_nids = alc662_dac_nids, | |
19025 | .dig_out_nid = ALC662_DIGOUT_NID, | |
19026 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
19027 | .channel_mode = alc662_3ST_2ch_modes, | |
19028 | .unsol_event = alc663_mode4_unsol_event, | |
19029 | .setup = alc663_mode4_setup, | |
19030 | .init_hook = alc663_mode4_inithook, | |
19031 | }, | |
19032 | [ALC663_ASUS_MODE5] = { | |
19033 | .mixers = { alc663_asus_15jd_clfe_mixer }, | |
19034 | .cap_mixer = alc662_auto_capture_mixer, | |
19035 | .init_verbs = { alc662_init_verbs, | |
19036 | alc663_15jd_amic_init_verbs }, | |
19037 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
19038 | .hp_nid = 0x03, | |
19039 | .dac_nids = alc662_dac_nids, | |
19040 | .dig_out_nid = ALC662_DIGOUT_NID, | |
19041 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
19042 | .channel_mode = alc662_3ST_2ch_modes, | |
19043 | .unsol_event = alc663_mode5_unsol_event, | |
19044 | .setup = alc663_mode5_setup, | |
19045 | .init_hook = alc663_mode5_inithook, | |
19046 | }, | |
19047 | [ALC663_ASUS_MODE6] = { | |
19048 | .mixers = { alc663_two_hp_m2_mixer }, | |
19049 | .cap_mixer = alc662_auto_capture_mixer, | |
19050 | .init_verbs = { alc662_init_verbs, | |
19051 | alc663_two_hp_amic_m2_init_verbs }, | |
19052 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
19053 | .hp_nid = 0x03, | |
19054 | .dac_nids = alc662_dac_nids, | |
19055 | .dig_out_nid = ALC662_DIGOUT_NID, | |
19056 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
19057 | .channel_mode = alc662_3ST_2ch_modes, | |
19058 | .unsol_event = alc663_mode6_unsol_event, | |
19059 | .setup = alc663_mode6_setup, | |
19060 | .init_hook = alc663_mode6_inithook, | |
19061 | }, | |
19062 | [ALC663_ASUS_MODE7] = { | |
19063 | .mixers = { alc663_mode7_mixer }, | |
19064 | .cap_mixer = alc662_auto_capture_mixer, | |
19065 | .init_verbs = { alc662_init_verbs, | |
19066 | alc663_mode7_init_verbs }, | |
19067 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
19068 | .hp_nid = 0x03, | |
19069 | .dac_nids = alc662_dac_nids, | |
19070 | .dig_out_nid = ALC662_DIGOUT_NID, | |
19071 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
19072 | .channel_mode = alc662_3ST_2ch_modes, | |
19073 | .unsol_event = alc663_mode7_unsol_event, | |
19074 | .setup = alc663_mode7_setup, | |
19075 | .init_hook = alc663_mode7_inithook, | |
19076 | }, | |
19077 | [ALC663_ASUS_MODE8] = { | |
19078 | .mixers = { alc663_mode8_mixer }, | |
19079 | .cap_mixer = alc662_auto_capture_mixer, | |
19080 | .init_verbs = { alc662_init_verbs, | |
19081 | alc663_mode8_init_verbs }, | |
19082 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
19083 | .hp_nid = 0x03, | |
19084 | .dac_nids = alc662_dac_nids, | |
19085 | .dig_out_nid = ALC662_DIGOUT_NID, | |
19086 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
19087 | .channel_mode = alc662_3ST_2ch_modes, | |
19088 | .unsol_event = alc663_mode8_unsol_event, | |
19089 | .setup = alc663_mode8_setup, | |
19090 | .init_hook = alc663_mode8_inithook, | |
19091 | }, | |
19092 | [ALC272_DELL] = { | |
19093 | .mixers = { alc663_m51va_mixer }, | |
19094 | .cap_mixer = alc272_auto_capture_mixer, | |
19095 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, | |
19096 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
19097 | .dac_nids = alc662_dac_nids, | |
19098 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
19099 | .adc_nids = alc272_adc_nids, | |
19100 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), | |
19101 | .capsrc_nids = alc272_capsrc_nids, | |
19102 | .channel_mode = alc662_3ST_2ch_modes, | |
19103 | .unsol_event = alc663_m51va_unsol_event, | |
19104 | .setup = alc663_m51va_setup, | |
19105 | .init_hook = alc663_m51va_inithook, | |
19106 | }, | |
19107 | [ALC272_DELL_ZM1] = { | |
19108 | .mixers = { alc663_m51va_mixer }, | |
19109 | .cap_mixer = alc662_auto_capture_mixer, | |
19110 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, | |
19111 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
19112 | .dac_nids = alc662_dac_nids, | |
19113 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
19114 | .adc_nids = alc662_adc_nids, | |
19115 | .num_adc_nids = 1, | |
19116 | .capsrc_nids = alc662_capsrc_nids, | |
19117 | .channel_mode = alc662_3ST_2ch_modes, | |
19118 | .unsol_event = alc663_m51va_unsol_event, | |
19119 | .setup = alc663_m51va_setup, | |
19120 | .init_hook = alc663_m51va_inithook, | |
19121 | }, | |
19122 | [ALC272_SAMSUNG_NC10] = { | |
19123 | .mixers = { alc272_nc10_mixer }, | |
19124 | .init_verbs = { alc662_init_verbs, | |
19125 | alc663_21jd_amic_init_verbs }, | |
19126 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
19127 | .dac_nids = alc272_dac_nids, | |
19128 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
19129 | .channel_mode = alc662_3ST_2ch_modes, | |
19130 | /*.input_mux = &alc272_nc10_capture_source,*/ | |
19131 | .unsol_event = alc663_mode4_unsol_event, | |
19132 | .setup = alc663_mode4_setup, | |
19133 | .init_hook = alc663_mode4_inithook, | |
19134 | }, | |
19135 | }; | |
19136 | ||
19137 | ||
19138 | /* | |
19139 | * BIOS auto configuration | |
19140 | */ | |
19141 | ||
19142 | /* convert from MIX nid to DAC */ | |
19143 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) | |
19144 | { | |
19145 | if (nid == 0x0f) | |
19146 | return 0x02; | |
19147 | else if (nid >= 0x0c && nid <= 0x0e) | |
19148 | return nid - 0x0c + 0x02; | |
19149 | else if (nid == 0x26) /* ALC887-VD has this DAC too */ | |
19150 | return 0x25; | |
19151 | else | |
19152 | return 0; | |
19153 | } | |
19154 | ||
19155 | /* get MIX nid connected to the given pin targeted to DAC */ | |
19156 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, | |
19157 | hda_nid_t dac) | |
19158 | { | |
19159 | hda_nid_t mix[5]; | |
19160 | int i, num; | |
19161 | ||
19162 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); | |
19163 | for (i = 0; i < num; i++) { | |
19164 | if (alc662_mix_to_dac(mix[i]) == dac) | |
19165 | return mix[i]; | |
19166 | } | |
19167 | return 0; | |
19168 | } | |
19169 | ||
19170 | /* look for an empty DAC slot */ | |
19171 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |
19172 | { | |
19173 | struct alc_spec *spec = codec->spec; | |
19174 | hda_nid_t srcs[5]; | |
19175 | int i, j, num; | |
19176 | ||
19177 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); | |
19178 | if (num < 0) | |
19179 | return 0; | |
19180 | for (i = 0; i < num; i++) { | |
19181 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); | |
19182 | if (!nid) | |
19183 | continue; | |
19184 | for (j = 0; j < spec->multiout.num_dacs; j++) | |
19185 | if (spec->multiout.dac_nids[j] == nid) | |
19186 | break; | |
19187 | if (j >= spec->multiout.num_dacs) | |
19188 | return nid; | |
19189 | } | |
19190 | return 0; | |
19191 | } | |
19192 | ||
19193 | /* fill in the dac_nids table from the parsed pin configuration */ | |
19194 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, | |
19195 | const struct auto_pin_cfg *cfg) | |
19196 | { | |
19197 | struct alc_spec *spec = codec->spec; | |
19198 | int i; | |
19199 | hda_nid_t dac; | |
19200 | ||
19201 | spec->multiout.dac_nids = spec->private_dac_nids; | |
19202 | for (i = 0; i < cfg->line_outs; i++) { | |
19203 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); | |
19204 | if (!dac) | |
19205 | continue; | |
19206 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
19207 | } | |
19208 | return 0; | |
19209 | } | |
19210 | ||
19211 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, | |
19212 | hda_nid_t nid, int idx, unsigned int chs) | |
19213 | { | |
19214 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, | |
19215 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | |
19216 | } | |
19217 | ||
19218 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, | |
19219 | hda_nid_t nid, int idx, unsigned int chs) | |
19220 | { | |
19221 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, | |
19222 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); | |
19223 | } | |
19224 | ||
19225 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ | |
19226 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) | |
19227 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ | |
19228 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) | |
19229 | #define alc662_add_stereo_vol(spec, pfx, nid) \ | |
19230 | alc662_add_vol_ctl(spec, pfx, nid, 3) | |
19231 | #define alc662_add_stereo_sw(spec, pfx, nid) \ | |
19232 | alc662_add_sw_ctl(spec, pfx, nid, 3) | |
19233 | ||
19234 | /* add playback controls from the parsed DAC table */ | |
19235 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, | |
19236 | const struct auto_pin_cfg *cfg) | |
19237 | { | |
19238 | struct alc_spec *spec = codec->spec; | |
19239 | static const char * const chname[4] = { | |
19240 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
19241 | }; | |
19242 | const char *pfx = alc_get_line_out_pfx(cfg, true); | |
19243 | hda_nid_t nid, mix; | |
19244 | int i, err; | |
19245 | ||
19246 | for (i = 0; i < cfg->line_outs; i++) { | |
19247 | nid = spec->multiout.dac_nids[i]; | |
19248 | if (!nid) | |
19249 | continue; | |
19250 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); | |
19251 | if (!mix) | |
19252 | continue; | |
19253 | if (!pfx && i == 2) { | |
19254 | /* Center/LFE */ | |
19255 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); | |
19256 | if (err < 0) | |
19257 | return err; | |
19258 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); | |
19259 | if (err < 0) | |
19260 | return err; | |
19261 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); | |
19262 | if (err < 0) | |
19263 | return err; | |
19264 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); | |
19265 | if (err < 0) | |
19266 | return err; | |
19267 | } else { | |
19268 | const char *name = pfx; | |
19269 | if (!name) | |
19270 | name = chname[i]; | |
19271 | err = __alc662_add_vol_ctl(spec, name, nid, i, 3); | |
19272 | if (err < 0) | |
19273 | return err; | |
19274 | err = __alc662_add_sw_ctl(spec, name, mix, i, 3); | |
19275 | if (err < 0) | |
19276 | return err; | |
19277 | } | |
19278 | } | |
19279 | return 0; | |
19280 | } | |
19281 | ||
19282 | /* add playback controls for speaker and HP outputs */ | |
19283 | /* return DAC nid if any new DAC is assigned */ | |
19284 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |
19285 | const char *pfx) | |
19286 | { | |
19287 | struct alc_spec *spec = codec->spec; | |
19288 | hda_nid_t nid, mix; | |
19289 | int err; | |
19290 | ||
19291 | if (!pin) | |
19292 | return 0; | |
19293 | nid = alc662_look_for_dac(codec, pin); | |
19294 | if (!nid) { | |
19295 | /* the corresponding DAC is already occupied */ | |
19296 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) | |
19297 | return 0; /* no way */ | |
19298 | /* create a switch only */ | |
19299 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | |
19300 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
19301 | } | |
19302 | ||
19303 | mix = alc662_dac_to_mix(codec, pin, nid); | |
19304 | if (!mix) | |
19305 | return 0; | |
19306 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); | |
19307 | if (err < 0) | |
19308 | return err; | |
19309 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); | |
19310 | if (err < 0) | |
19311 | return err; | |
19312 | return nid; | |
19313 | } | |
19314 | ||
19315 | /* create playback/capture controls for input pins */ | |
19316 | #define alc662_auto_create_input_ctls \ | |
19317 | alc882_auto_create_input_ctls | |
19318 | ||
19319 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | |
19320 | hda_nid_t nid, int pin_type, | |
19321 | hda_nid_t dac) | |
19322 | { | |
19323 | int i, num; | |
19324 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; | |
19325 | ||
19326 | alc_set_pin_output(codec, nid, pin_type); | |
19327 | /* need the manual connection? */ | |
19328 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); | |
19329 | if (num <= 1) | |
19330 | return; | |
19331 | for (i = 0; i < num; i++) { | |
19332 | if (alc662_mix_to_dac(srcs[i]) != dac) | |
19333 | continue; | |
19334 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); | |
19335 | return; | |
19336 | } | |
19337 | } | |
19338 | ||
19339 | static void alc662_auto_init_multi_out(struct hda_codec *codec) | |
19340 | { | |
19341 | struct alc_spec *spec = codec->spec; | |
19342 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
19343 | int i; | |
19344 | ||
19345 | for (i = 0; i <= HDA_SIDE; i++) { | |
19346 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
19347 | if (nid) | |
19348 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, | |
19349 | spec->multiout.dac_nids[i]); | |
19350 | } | |
19351 | } | |
19352 | ||
19353 | static void alc662_auto_init_hp_out(struct hda_codec *codec) | |
19354 | { | |
19355 | struct alc_spec *spec = codec->spec; | |
19356 | hda_nid_t pin; | |
19357 | ||
19358 | pin = spec->autocfg.hp_pins[0]; | |
19359 | if (pin) | |
19360 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, | |
19361 | spec->multiout.hp_nid); | |
19362 | pin = spec->autocfg.speaker_pins[0]; | |
19363 | if (pin) | |
19364 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, | |
19365 | spec->multiout.extra_out_nid[0]); | |
19366 | } | |
19367 | ||
19368 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID | |
19369 | ||
19370 | static void alc662_auto_init_analog_input(struct hda_codec *codec) | |
19371 | { | |
19372 | struct alc_spec *spec = codec->spec; | |
19373 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
19374 | int i; | |
19375 | ||
19376 | for (i = 0; i < cfg->num_inputs; i++) { | |
19377 | hda_nid_t nid = cfg->inputs[i].pin; | |
19378 | if (alc_is_input_pin(codec, nid)) { | |
19379 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); | |
19380 | if (nid != ALC662_PIN_CD_NID && | |
19381 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
19382 | snd_hda_codec_write(codec, nid, 0, | |
19383 | AC_VERB_SET_AMP_GAIN_MUTE, | |
19384 | AMP_OUT_MUTE); | |
19385 | } | |
19386 | } | |
19387 | } | |
19388 | ||
19389 | #define alc662_auto_init_input_src alc882_auto_init_input_src | |
19390 | ||
19391 | static int alc662_parse_auto_config(struct hda_codec *codec) | |
19392 | { | |
19393 | struct alc_spec *spec = codec->spec; | |
19394 | int err; | |
19395 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; | |
19396 | ||
19397 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
19398 | alc662_ignore); | |
19399 | if (err < 0) | |
19400 | return err; | |
19401 | if (!spec->autocfg.line_outs) | |
19402 | return 0; /* can't find valid BIOS pin config */ | |
19403 | ||
19404 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); | |
19405 | if (err < 0) | |
19406 | return err; | |
19407 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); | |
19408 | if (err < 0) | |
19409 | return err; | |
19410 | err = alc662_auto_create_extra_out(codec, | |
19411 | spec->autocfg.speaker_pins[0], | |
19412 | "Speaker"); | |
19413 | if (err < 0) | |
19414 | return err; | |
19415 | if (err) | |
19416 | spec->multiout.extra_out_nid[0] = err; | |
19417 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], | |
19418 | "Headphone"); | |
19419 | if (err < 0) | |
19420 | return err; | |
19421 | if (err) | |
19422 | spec->multiout.hp_nid = err; | |
19423 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); | |
19424 | if (err < 0) | |
19425 | return err; | |
19426 | ||
19427 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
19428 | ||
19429 | alc_auto_parse_digital(codec); | |
19430 | ||
19431 | if (spec->kctls.list) | |
19432 | add_mixer(spec, spec->kctls.list); | |
19433 | ||
19434 | spec->num_mux_defs = 1; | |
19435 | spec->input_mux = &spec->private_imux[0]; | |
19436 | ||
19437 | add_verb(spec, alc662_init_verbs); | |
19438 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || | |
19439 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) | |
19440 | add_verb(spec, alc663_init_verbs); | |
19441 | ||
19442 | if (codec->vendor_id == 0x10ec0272) | |
19443 | add_verb(spec, alc272_init_verbs); | |
19444 | ||
19445 | err = alc_auto_add_mic_boost(codec); | |
19446 | if (err < 0) | |
19447 | return err; | |
19448 | ||
19449 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || | |
19450 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) | |
19451 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); | |
19452 | else | |
19453 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
19454 | ||
19455 | return 1; | |
19456 | } | |
19457 | ||
19458 | /* additional initialization for auto-configuration model */ | |
19459 | static void alc662_auto_init(struct hda_codec *codec) | |
19460 | { | |
19461 | struct alc_spec *spec = codec->spec; | |
19462 | alc662_auto_init_multi_out(codec); | |
19463 | alc662_auto_init_hp_out(codec); | |
19464 | alc662_auto_init_analog_input(codec); | |
19465 | alc662_auto_init_input_src(codec); | |
19466 | alc_auto_init_digital(codec); | |
19467 | if (spec->unsol_event) | |
19468 | alc_inithook(codec); | |
19469 | } | |
19470 | ||
19471 | static void alc272_fixup_mario(struct hda_codec *codec, | |
19472 | const struct alc_fixup *fix, int action) | |
19473 | { | |
19474 | if (action != ALC_FIXUP_ACT_PROBE) | |
19475 | return; | |
19476 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, | |
19477 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | | |
19478 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
19479 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
19480 | (0 << AC_AMPCAP_MUTE_SHIFT))) | |
19481 | printk(KERN_WARNING | |
19482 | "hda_codec: failed to override amp caps for NID 0x2\n"); | |
19483 | } | |
19484 | ||
19485 | enum { | |
19486 | ALC662_FIXUP_ASPIRE, | |
19487 | ALC662_FIXUP_IDEAPAD, | |
19488 | ALC272_FIXUP_MARIO, | |
19489 | ALC662_FIXUP_CZC_P10T, | |
19490 | }; | |
19491 | ||
19492 | static const struct alc_fixup alc662_fixups[] = { | |
19493 | [ALC662_FIXUP_ASPIRE] = { | |
19494 | .type = ALC_FIXUP_PINS, | |
19495 | .v.pins = (const struct alc_pincfg[]) { | |
19496 | { 0x15, 0x99130112 }, /* subwoofer */ | |
19497 | { } | |
19498 | } | |
19499 | }, | |
19500 | [ALC662_FIXUP_IDEAPAD] = { | |
19501 | .type = ALC_FIXUP_PINS, | |
19502 | .v.pins = (const struct alc_pincfg[]) { | |
19503 | { 0x17, 0x99130112 }, /* subwoofer */ | |
19504 | { } | |
19505 | } | |
19506 | }, | |
19507 | [ALC272_FIXUP_MARIO] = { | |
19508 | .type = ALC_FIXUP_FUNC, | |
19509 | .v.func = alc272_fixup_mario, | |
19510 | }, | |
19511 | [ALC662_FIXUP_CZC_P10T] = { | |
19512 | .type = ALC_FIXUP_VERBS, | |
19513 | .v.verbs = (const struct hda_verb[]) { | |
19514 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, | |
19515 | {} | |
19516 | } | |
19517 | }, | |
19518 | }; | |
19519 | ||
19520 | static struct snd_pci_quirk alc662_fixup_tbl[] = { | |
19521 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), | |
19522 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), | |
19523 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), | |
19524 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), | |
19525 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), | |
19526 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), | |
19527 | {} | |
19528 | }; | |
19529 | ||
19530 | static const struct alc_model_fixup alc662_fixup_models[] = { | |
19531 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, | |
19532 | {} | |
19533 | }; | |
19534 | ||
19535 | ||
19536 | static int patch_alc662(struct hda_codec *codec) | |
19537 | { | |
19538 | struct alc_spec *spec; | |
19539 | int err, board_config; | |
19540 | int coef; | |
19541 | ||
19542 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
19543 | if (!spec) | |
19544 | return -ENOMEM; | |
19545 | ||
19546 | codec->spec = spec; | |
19547 | ||
19548 | alc_auto_parse_customize_define(codec); | |
19549 | ||
19550 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | |
19551 | ||
19552 | coef = alc_read_coef_idx(codec, 0); | |
19553 | if (coef == 0x8020 || coef == 0x8011) | |
19554 | alc_codec_rename(codec, "ALC661"); | |
19555 | else if (coef & (1 << 14) && | |
19556 | codec->bus->pci->subsystem_vendor == 0x1025 && | |
19557 | spec->cdefine.platform_type == 1) | |
19558 | alc_codec_rename(codec, "ALC272X"); | |
19559 | else if (coef == 0x4011) | |
19560 | alc_codec_rename(codec, "ALC656"); | |
19561 | ||
19562 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, | |
19563 | alc662_models, | |
19564 | alc662_cfg_tbl); | |
19565 | if (board_config < 0) { | |
19566 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
19567 | codec->chip_name); | |
19568 | board_config = ALC662_AUTO; | |
19569 | } | |
19570 | ||
19571 | if (board_config == ALC662_AUTO) { | |
19572 | alc_pick_fixup(codec, alc662_fixup_models, | |
19573 | alc662_fixup_tbl, alc662_fixups); | |
19574 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | |
19575 | /* automatic parse from the BIOS config */ | |
19576 | err = alc662_parse_auto_config(codec); | |
19577 | if (err < 0) { | |
19578 | alc_free(codec); | |
19579 | return err; | |
19580 | } else if (!err) { | |
19581 | printk(KERN_INFO | |
19582 | "hda_codec: Cannot set up configuration " | |
19583 | "from BIOS. Using base mode...\n"); | |
19584 | board_config = ALC662_3ST_2ch_DIG; | |
19585 | } | |
19586 | } | |
19587 | ||
19588 | if (has_cdefine_beep(codec)) { | |
19589 | err = snd_hda_attach_beep_device(codec, 0x1); | |
19590 | if (err < 0) { | |
19591 | alc_free(codec); | |
19592 | return err; | |
19593 | } | |
19594 | } | |
19595 | ||
19596 | if (board_config != ALC662_AUTO) | |
19597 | setup_preset(codec, &alc662_presets[board_config]); | |
19598 | ||
19599 | spec->stream_analog_playback = &alc662_pcm_analog_playback; | |
19600 | spec->stream_analog_capture = &alc662_pcm_analog_capture; | |
19601 | ||
19602 | spec->stream_digital_playback = &alc662_pcm_digital_playback; | |
19603 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | |
19604 | ||
19605 | if (!spec->adc_nids) { | |
19606 | spec->adc_nids = alc662_adc_nids; | |
19607 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | |
19608 | } | |
19609 | if (!spec->capsrc_nids) | |
19610 | spec->capsrc_nids = alc662_capsrc_nids; | |
19611 | ||
19612 | if (!spec->cap_mixer) | |
19613 | set_capture_mixer(codec); | |
19614 | ||
19615 | if (has_cdefine_beep(codec)) { | |
19616 | switch (codec->vendor_id) { | |
19617 | case 0x10ec0662: | |
19618 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
19619 | break; | |
19620 | case 0x10ec0272: | |
19621 | case 0x10ec0663: | |
19622 | case 0x10ec0665: | |
19623 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | |
19624 | break; | |
19625 | case 0x10ec0273: | |
19626 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); | |
19627 | break; | |
19628 | } | |
19629 | } | |
19630 | spec->vmaster_nid = 0x02; | |
19631 | ||
19632 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | |
19633 | ||
19634 | codec->patch_ops = alc_patch_ops; | |
19635 | if (board_config == ALC662_AUTO) | |
19636 | spec->init_hook = alc662_auto_init; | |
19637 | ||
19638 | alc_init_jacks(codec); | |
19639 | ||
19640 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
19641 | if (!spec->loopback.amplist) | |
19642 | spec->loopback.amplist = alc662_loopbacks; | |
19643 | #endif | |
19644 | ||
19645 | return 0; | |
19646 | } | |
19647 | ||
19648 | static int patch_alc888(struct hda_codec *codec) | |
19649 | { | |
19650 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ | |
19651 | kfree(codec->chip_name); | |
19652 | if (codec->vendor_id == 0x10ec0887) | |
19653 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); | |
19654 | else | |
19655 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | |
19656 | if (!codec->chip_name) { | |
19657 | alc_free(codec); | |
19658 | return -ENOMEM; | |
19659 | } | |
19660 | return patch_alc662(codec); | |
19661 | } | |
19662 | return patch_alc882(codec); | |
19663 | } | |
19664 | ||
19665 | /* | |
19666 | * ALC680 support | |
19667 | */ | |
19668 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID | |
19669 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID | |
19670 | #define alc680_modes alc260_modes | |
19671 | ||
19672 | static hda_nid_t alc680_dac_nids[3] = { | |
19673 | /* Lout1, Lout2, hp */ | |
19674 | 0x02, 0x03, 0x04 | |
19675 | }; | |
19676 | ||
19677 | static hda_nid_t alc680_adc_nids[3] = { | |
19678 | /* ADC0-2 */ | |
19679 | /* DMIC, MIC, Line-in*/ | |
19680 | 0x07, 0x08, 0x09 | |
19681 | }; | |
19682 | ||
19683 | /* | |
19684 | * Analog capture ADC cgange | |
19685 | */ | |
19686 | static void alc680_rec_autoswitch(struct hda_codec *codec) | |
19687 | { | |
19688 | struct alc_spec *spec = codec->spec; | |
19689 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
19690 | int pin_found = 0; | |
19691 | int type_found = AUTO_PIN_LAST; | |
19692 | hda_nid_t nid; | |
19693 | int i; | |
19694 | ||
19695 | for (i = 0; i < cfg->num_inputs; i++) { | |
19696 | nid = cfg->inputs[i].pin; | |
19697 | if (!(snd_hda_query_pin_caps(codec, nid) & | |
19698 | AC_PINCAP_PRES_DETECT)) | |
19699 | continue; | |
19700 | if (snd_hda_jack_detect(codec, nid)) { | |
19701 | if (cfg->inputs[i].type < type_found) { | |
19702 | type_found = cfg->inputs[i].type; | |
19703 | pin_found = nid; | |
19704 | } | |
19705 | } | |
19706 | } | |
19707 | ||
19708 | nid = 0x07; | |
19709 | if (pin_found) | |
19710 | snd_hda_get_connections(codec, pin_found, &nid, 1); | |
19711 | ||
19712 | if (nid != spec->cur_adc) | |
19713 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); | |
19714 | spec->cur_adc = nid; | |
19715 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, | |
19716 | spec->cur_adc_format); | |
19717 | } | |
19718 | ||
19719 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |
19720 | struct hda_codec *codec, | |
19721 | unsigned int stream_tag, | |
19722 | unsigned int format, | |
19723 | struct snd_pcm_substream *substream) | |
19724 | { | |
19725 | struct alc_spec *spec = codec->spec; | |
19726 | ||
19727 | spec->cur_adc = 0x07; | |
19728 | spec->cur_adc_stream_tag = stream_tag; | |
19729 | spec->cur_adc_format = format; | |
19730 | ||
19731 | alc680_rec_autoswitch(codec); | |
19732 | return 0; | |
19733 | } | |
19734 | ||
19735 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
19736 | struct hda_codec *codec, | |
19737 | struct snd_pcm_substream *substream) | |
19738 | { | |
19739 | snd_hda_codec_cleanup_stream(codec, 0x07); | |
19740 | snd_hda_codec_cleanup_stream(codec, 0x08); | |
19741 | snd_hda_codec_cleanup_stream(codec, 0x09); | |
19742 | return 0; | |
19743 | } | |
19744 | ||
19745 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { | |
19746 | .substreams = 1, /* can be overridden */ | |
19747 | .channels_min = 2, | |
19748 | .channels_max = 2, | |
19749 | /* NID is set in alc_build_pcms */ | |
19750 | .ops = { | |
19751 | .prepare = alc680_capture_pcm_prepare, | |
19752 | .cleanup = alc680_capture_pcm_cleanup | |
19753 | }, | |
19754 | }; | |
19755 | ||
19756 | static struct snd_kcontrol_new alc680_base_mixer[] = { | |
19757 | /* output mixer control */ | |
19758 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
19759 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
19760 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), | |
19761 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
19762 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), | |
19763 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), | |
19764 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), | |
19765 | { } | |
19766 | }; | |
19767 | ||
19768 | static struct hda_bind_ctls alc680_bind_cap_vol = { | |
19769 | .ops = &snd_hda_bind_vol, | |
19770 | .values = { | |
19771 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), | |
19772 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
19773 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
19774 | 0 | |
19775 | }, | |
19776 | }; | |
19777 | ||
19778 | static struct hda_bind_ctls alc680_bind_cap_switch = { | |
19779 | .ops = &snd_hda_bind_sw, | |
19780 | .values = { | |
19781 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), | |
19782 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
19783 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
19784 | 0 | |
19785 | }, | |
19786 | }; | |
19787 | ||
19788 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { | |
19789 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), | |
19790 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), | |
19791 | { } /* end */ | |
19792 | }; | |
19793 | ||
19794 | /* | |
19795 | * generic initialization of ADC, input mixers and output mixers | |
19796 | */ | |
19797 | static struct hda_verb alc680_init_verbs[] = { | |
19798 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
19799 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
19800 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
19801 | ||
19802 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
19803 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
19804 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
19805 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
19806 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
19807 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
19808 | ||
19809 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19810 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19811 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19812 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19813 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19814 | ||
19815 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
19816 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
19817 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
19818 | ||
19819 | { } | |
19820 | }; | |
19821 | ||
19822 | /* toggle speaker-output according to the hp-jack state */ | |
19823 | static void alc680_base_setup(struct hda_codec *codec) | |
19824 | { | |
19825 | struct alc_spec *spec = codec->spec; | |
19826 | ||
19827 | spec->autocfg.hp_pins[0] = 0x16; | |
19828 | spec->autocfg.speaker_pins[0] = 0x14; | |
19829 | spec->autocfg.speaker_pins[1] = 0x15; | |
19830 | spec->autocfg.num_inputs = 2; | |
19831 | spec->autocfg.inputs[0].pin = 0x18; | |
19832 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; | |
19833 | spec->autocfg.inputs[1].pin = 0x19; | |
19834 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; | |
19835 | } | |
19836 | ||
19837 | static void alc680_unsol_event(struct hda_codec *codec, | |
19838 | unsigned int res) | |
19839 | { | |
19840 | if ((res >> 26) == ALC880_HP_EVENT) | |
19841 | alc_automute_amp(codec); | |
19842 | if ((res >> 26) == ALC880_MIC_EVENT) | |
19843 | alc680_rec_autoswitch(codec); | |
19844 | } | |
19845 | ||
19846 | static void alc680_inithook(struct hda_codec *codec) | |
19847 | { | |
19848 | alc_automute_amp(codec); | |
19849 | alc680_rec_autoswitch(codec); | |
19850 | } | |
19851 | ||
19852 | /* create input playback/capture controls for the given pin */ | |
19853 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
19854 | const char *ctlname, int idx) | |
19855 | { | |
19856 | hda_nid_t dac; | |
19857 | int err; | |
19858 | ||
19859 | switch (nid) { | |
19860 | case 0x14: | |
19861 | dac = 0x02; | |
19862 | break; | |
19863 | case 0x15: | |
19864 | dac = 0x03; | |
19865 | break; | |
19866 | case 0x16: | |
19867 | dac = 0x04; | |
19868 | break; | |
19869 | default: | |
19870 | return 0; | |
19871 | } | |
19872 | if (spec->multiout.dac_nids[0] != dac && | |
19873 | spec->multiout.dac_nids[1] != dac) { | |
19874 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, | |
19875 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, | |
19876 | HDA_OUTPUT)); | |
19877 | if (err < 0) | |
19878 | return err; | |
19879 | ||
19880 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
19881 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | |
19882 | ||
19883 | if (err < 0) | |
19884 | return err; | |
19885 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
19886 | } | |
19887 | ||
19888 | return 0; | |
19889 | } | |
19890 | ||
19891 | /* add playback controls from the parsed DAC table */ | |
19892 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, | |
19893 | const struct auto_pin_cfg *cfg) | |
19894 | { | |
19895 | hda_nid_t nid; | |
19896 | int err; | |
19897 | ||
19898 | spec->multiout.dac_nids = spec->private_dac_nids; | |
19899 | ||
19900 | nid = cfg->line_out_pins[0]; | |
19901 | if (nid) { | |
19902 | const char *name; | |
19903 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
19904 | name = "Speaker"; | |
19905 | else | |
19906 | name = "Front"; | |
19907 | err = alc680_new_analog_output(spec, nid, name, 0); | |
19908 | if (err < 0) | |
19909 | return err; | |
19910 | } | |
19911 | ||
19912 | nid = cfg->speaker_pins[0]; | |
19913 | if (nid) { | |
19914 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); | |
19915 | if (err < 0) | |
19916 | return err; | |
19917 | } | |
19918 | nid = cfg->hp_pins[0]; | |
19919 | if (nid) { | |
19920 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); | |
19921 | if (err < 0) | |
19922 | return err; | |
19923 | } | |
19924 | ||
19925 | return 0; | |
19926 | } | |
19927 | ||
19928 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, | |
19929 | hda_nid_t nid, int pin_type) | |
19930 | { | |
19931 | alc_set_pin_output(codec, nid, pin_type); | |
19932 | } | |
19933 | ||
19934 | static void alc680_auto_init_multi_out(struct hda_codec *codec) | |
19935 | { | |
19936 | struct alc_spec *spec = codec->spec; | |
19937 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; | |
19938 | if (nid) { | |
19939 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
19940 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); | |
19941 | } | |
19942 | } | |
19943 | ||
19944 | static void alc680_auto_init_hp_out(struct hda_codec *codec) | |
19945 | { | |
19946 | struct alc_spec *spec = codec->spec; | |
19947 | hda_nid_t pin; | |
19948 | ||
19949 | pin = spec->autocfg.hp_pins[0]; | |
19950 | if (pin) | |
19951 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); | |
19952 | pin = spec->autocfg.speaker_pins[0]; | |
19953 | if (pin) | |
19954 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); | |
19955 | } | |
19956 | ||
19957 | /* pcm configuration: identical with ALC880 */ | |
19958 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback | |
19959 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture | |
19960 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture | |
19961 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback | |
19962 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture | |
19963 | ||
19964 | /* | |
19965 | * BIOS auto configuration | |
19966 | */ | |
19967 | static int alc680_parse_auto_config(struct hda_codec *codec) | |
19968 | { | |
19969 | struct alc_spec *spec = codec->spec; | |
19970 | int err; | |
19971 | static hda_nid_t alc680_ignore[] = { 0 }; | |
19972 | ||
19973 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
19974 | alc680_ignore); | |
19975 | if (err < 0) | |
19976 | return err; | |
19977 | ||
19978 | if (!spec->autocfg.line_outs) { | |
19979 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
19980 | spec->multiout.max_channels = 2; | |
19981 | spec->no_analog = 1; | |
19982 | goto dig_only; | |
19983 | } | |
19984 | return 0; /* can't find valid BIOS pin config */ | |
19985 | } | |
19986 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
19987 | if (err < 0) | |
19988 | return err; | |
19989 | ||
19990 | spec->multiout.max_channels = 2; | |
19991 | ||
19992 | dig_only: | |
19993 | /* digital only support output */ | |
19994 | alc_auto_parse_digital(codec); | |
19995 | if (spec->kctls.list) | |
19996 | add_mixer(spec, spec->kctls.list); | |
19997 | ||
19998 | add_verb(spec, alc680_init_verbs); | |
19999 | ||
20000 | err = alc_auto_add_mic_boost(codec); | |
20001 | if (err < 0) | |
20002 | return err; | |
20003 | ||
20004 | return 1; | |
20005 | } | |
20006 | ||
20007 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input | |
20008 | ||
20009 | /* init callback for auto-configuration model -- overriding the default init */ | |
20010 | static void alc680_auto_init(struct hda_codec *codec) | |
20011 | { | |
20012 | struct alc_spec *spec = codec->spec; | |
20013 | alc680_auto_init_multi_out(codec); | |
20014 | alc680_auto_init_hp_out(codec); | |
20015 | alc680_auto_init_analog_input(codec); | |
20016 | alc_auto_init_digital(codec); | |
20017 | if (spec->unsol_event) | |
20018 | alc_inithook(codec); | |
20019 | } | |
20020 | ||
20021 | /* | |
20022 | * configuration and preset | |
20023 | */ | |
20024 | static const char * const alc680_models[ALC680_MODEL_LAST] = { | |
20025 | [ALC680_BASE] = "base", | |
20026 | [ALC680_AUTO] = "auto", | |
20027 | }; | |
20028 | ||
20029 | static struct snd_pci_quirk alc680_cfg_tbl[] = { | |
20030 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), | |
20031 | {} | |
20032 | }; | |
20033 | ||
20034 | static struct alc_config_preset alc680_presets[] = { | |
20035 | [ALC680_BASE] = { | |
20036 | .mixers = { alc680_base_mixer }, | |
20037 | .cap_mixer = alc680_master_capture_mixer, | |
20038 | .init_verbs = { alc680_init_verbs }, | |
20039 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), | |
20040 | .dac_nids = alc680_dac_nids, | |
20041 | .dig_out_nid = ALC680_DIGOUT_NID, | |
20042 | .num_channel_mode = ARRAY_SIZE(alc680_modes), | |
20043 | .channel_mode = alc680_modes, | |
20044 | .unsol_event = alc680_unsol_event, | |
20045 | .setup = alc680_base_setup, | |
20046 | .init_hook = alc680_inithook, | |
20047 | ||
20048 | }, | |
20049 | }; | |
20050 | ||
20051 | static int patch_alc680(struct hda_codec *codec) | |
20052 | { | |
20053 | struct alc_spec *spec; | |
20054 | int board_config; | |
20055 | int err; | |
20056 | ||
20057 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
20058 | if (spec == NULL) | |
20059 | return -ENOMEM; | |
20060 | ||
20061 | codec->spec = spec; | |
20062 | ||
20063 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, | |
20064 | alc680_models, | |
20065 | alc680_cfg_tbl); | |
20066 | ||
20067 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { | |
20068 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
20069 | codec->chip_name); | |
20070 | board_config = ALC680_AUTO; | |
20071 | } | |
20072 | ||
20073 | if (board_config == ALC680_AUTO) { | |
20074 | /* automatic parse from the BIOS config */ | |
20075 | err = alc680_parse_auto_config(codec); | |
20076 | if (err < 0) { | |
20077 | alc_free(codec); | |
20078 | return err; | |
20079 | } else if (!err) { | |
20080 | printk(KERN_INFO | |
20081 | "hda_codec: Cannot set up configuration " | |
20082 | "from BIOS. Using base mode...\n"); | |
20083 | board_config = ALC680_BASE; | |
20084 | } | |
20085 | } | |
20086 | ||
20087 | if (board_config != ALC680_AUTO) | |
20088 | setup_preset(codec, &alc680_presets[board_config]); | |
20089 | ||
20090 | spec->stream_analog_playback = &alc680_pcm_analog_playback; | |
20091 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; | |
20092 | spec->stream_digital_playback = &alc680_pcm_digital_playback; | |
20093 | spec->stream_digital_capture = &alc680_pcm_digital_capture; | |
20094 | ||
20095 | if (!spec->adc_nids) { | |
20096 | spec->adc_nids = alc680_adc_nids; | |
20097 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); | |
20098 | } | |
20099 | ||
20100 | if (!spec->cap_mixer) | |
20101 | set_capture_mixer(codec); | |
20102 | ||
20103 | spec->vmaster_nid = 0x02; | |
20104 | ||
20105 | codec->patch_ops = alc_patch_ops; | |
20106 | if (board_config == ALC680_AUTO) | |
20107 | spec->init_hook = alc680_auto_init; | |
20108 | ||
20109 | return 0; | |
20110 | } | |
20111 | ||
20112 | /* | |
20113 | * patch entries | |
20114 | */ | |
20115 | static struct hda_codec_preset snd_hda_preset_realtek[] = { | |
20116 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, | |
20117 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, | |
20118 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, | |
20119 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, | |
20120 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, | |
20121 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, | |
20122 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, | |
20123 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, | |
20124 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", | |
20125 | .patch = patch_alc861 }, | |
20126 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, | |
20127 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | |
20128 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | |
20129 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", | |
20130 | .patch = patch_alc882 }, | |
20131 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", | |
20132 | .patch = patch_alc662 }, | |
20133 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, | |
20134 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, | |
20135 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, | |
20136 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, | |
20137 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, | |
20138 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, | |
20139 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, | |
20140 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", | |
20141 | .patch = patch_alc882 }, | |
20142 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | |
20143 | .patch = patch_alc882 }, | |
20144 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | |
20145 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, | |
20146 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | |
20147 | .patch = patch_alc882 }, | |
20148 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, | |
20149 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, | |
20150 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, | |
20151 | {} /* terminator */ | |
20152 | }; | |
20153 | ||
20154 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); | |
20155 | ||
20156 | MODULE_LICENSE("GPL"); | |
20157 | MODULE_DESCRIPTION("Realtek HD-audio codec"); | |
20158 | ||
20159 | static struct hda_codec_preset_list realtek_list = { | |
20160 | .preset = snd_hda_preset_realtek, | |
20161 | .owner = THIS_MODULE, | |
20162 | }; | |
20163 | ||
20164 | static int __init patch_realtek_init(void) | |
20165 | { | |
20166 | return snd_hda_add_codec_preset(&realtek_list); | |
20167 | } | |
20168 | ||
20169 | static void __exit patch_realtek_exit(void) | |
20170 | { | |
20171 | snd_hda_delete_codec_preset(&realtek_list); | |
20172 | } | |
20173 | ||
20174 | module_init(patch_realtek_init) | |
20175 | module_exit(patch_realtek_exit) |