]>
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 "hda_codec.h" | |
32 | #include "hda_local.h" | |
33 | #include "hda_beep.h" | |
34 | ||
35 | #define ALC880_FRONT_EVENT 0x01 | |
36 | #define ALC880_DCVOL_EVENT 0x02 | |
37 | #define ALC880_HP_EVENT 0x04 | |
38 | #define ALC880_MIC_EVENT 0x08 | |
39 | ||
40 | /* ALC880 board config type */ | |
41 | enum { | |
42 | ALC880_3ST, | |
43 | ALC880_3ST_DIG, | |
44 | ALC880_5ST, | |
45 | ALC880_5ST_DIG, | |
46 | ALC880_W810, | |
47 | ALC880_Z71V, | |
48 | ALC880_6ST, | |
49 | ALC880_6ST_DIG, | |
50 | ALC880_F1734, | |
51 | ALC880_ASUS, | |
52 | ALC880_ASUS_DIG, | |
53 | ALC880_ASUS_W1V, | |
54 | ALC880_ASUS_DIG2, | |
55 | ALC880_FUJITSU, | |
56 | ALC880_UNIWILL_DIG, | |
57 | ALC880_UNIWILL, | |
58 | ALC880_UNIWILL_P53, | |
59 | ALC880_CLEVO, | |
60 | ALC880_TCL_S700, | |
61 | ALC880_LG, | |
62 | ALC880_LG_LW, | |
63 | ALC880_MEDION_RIM, | |
64 | #ifdef CONFIG_SND_DEBUG | |
65 | ALC880_TEST, | |
66 | #endif | |
67 | ALC880_AUTO, | |
68 | ALC880_MODEL_LAST /* last tag */ | |
69 | }; | |
70 | ||
71 | /* ALC260 models */ | |
72 | enum { | |
73 | ALC260_BASIC, | |
74 | ALC260_HP, | |
75 | ALC260_HP_DC7600, | |
76 | ALC260_HP_3013, | |
77 | ALC260_FUJITSU_S702X, | |
78 | ALC260_ACER, | |
79 | ALC260_WILL, | |
80 | ALC260_REPLACER_672V, | |
81 | ALC260_FAVORIT100, | |
82 | #ifdef CONFIG_SND_DEBUG | |
83 | ALC260_TEST, | |
84 | #endif | |
85 | ALC260_AUTO, | |
86 | ALC260_MODEL_LAST /* last tag */ | |
87 | }; | |
88 | ||
89 | /* ALC262 models */ | |
90 | enum { | |
91 | ALC262_BASIC, | |
92 | ALC262_HIPPO, | |
93 | ALC262_HIPPO_1, | |
94 | ALC262_FUJITSU, | |
95 | ALC262_HP_BPC, | |
96 | ALC262_HP_BPC_D7000_WL, | |
97 | ALC262_HP_BPC_D7000_WF, | |
98 | ALC262_HP_TC_T5735, | |
99 | ALC262_HP_RP5700, | |
100 | ALC262_BENQ_ED8, | |
101 | ALC262_SONY_ASSAMD, | |
102 | ALC262_BENQ_T31, | |
103 | ALC262_ULTRA, | |
104 | ALC262_LENOVO_3000, | |
105 | ALC262_NEC, | |
106 | ALC262_TOSHIBA_S06, | |
107 | ALC262_TOSHIBA_RX1, | |
108 | ALC262_TYAN, | |
109 | ALC262_AUTO, | |
110 | ALC262_MODEL_LAST /* last tag */ | |
111 | }; | |
112 | ||
113 | /* ALC268 models */ | |
114 | enum { | |
115 | ALC267_QUANTA_IL1, | |
116 | ALC268_3ST, | |
117 | ALC268_TOSHIBA, | |
118 | ALC268_ACER, | |
119 | ALC268_ACER_DMIC, | |
120 | ALC268_ACER_ASPIRE_ONE, | |
121 | ALC268_DELL, | |
122 | ALC268_ZEPTO, | |
123 | #ifdef CONFIG_SND_DEBUG | |
124 | ALC268_TEST, | |
125 | #endif | |
126 | ALC268_AUTO, | |
127 | ALC268_MODEL_LAST /* last tag */ | |
128 | }; | |
129 | ||
130 | /* ALC269 models */ | |
131 | enum { | |
132 | ALC269_BASIC, | |
133 | ALC269_QUANTA_FL1, | |
134 | ALC269_AMIC, | |
135 | ALC269_DMIC, | |
136 | ALC269VB_AMIC, | |
137 | ALC269VB_DMIC, | |
138 | ALC269_FUJITSU, | |
139 | ALC269_LIFEBOOK, | |
140 | ALC271_ACER, | |
141 | ALC269_AUTO, | |
142 | ALC269_MODEL_LAST /* last tag */ | |
143 | }; | |
144 | ||
145 | /* ALC861 models */ | |
146 | enum { | |
147 | ALC861_3ST, | |
148 | ALC660_3ST, | |
149 | ALC861_3ST_DIG, | |
150 | ALC861_6ST_DIG, | |
151 | ALC861_UNIWILL_M31, | |
152 | ALC861_TOSHIBA, | |
153 | ALC861_ASUS, | |
154 | ALC861_ASUS_LAPTOP, | |
155 | ALC861_AUTO, | |
156 | ALC861_MODEL_LAST, | |
157 | }; | |
158 | ||
159 | /* ALC861-VD models */ | |
160 | enum { | |
161 | ALC660VD_3ST, | |
162 | ALC660VD_3ST_DIG, | |
163 | ALC660VD_ASUS_V1S, | |
164 | ALC861VD_3ST, | |
165 | ALC861VD_3ST_DIG, | |
166 | ALC861VD_6ST_DIG, | |
167 | ALC861VD_LENOVO, | |
168 | ALC861VD_DALLAS, | |
169 | ALC861VD_HP, | |
170 | ALC861VD_AUTO, | |
171 | ALC861VD_MODEL_LAST, | |
172 | }; | |
173 | ||
174 | /* ALC662 models */ | |
175 | enum { | |
176 | ALC662_3ST_2ch_DIG, | |
177 | ALC662_3ST_6ch_DIG, | |
178 | ALC662_3ST_6ch, | |
179 | ALC662_5ST_DIG, | |
180 | ALC662_LENOVO_101E, | |
181 | ALC662_ASUS_EEEPC_P701, | |
182 | ALC662_ASUS_EEEPC_EP20, | |
183 | ALC663_ASUS_M51VA, | |
184 | ALC663_ASUS_G71V, | |
185 | ALC663_ASUS_H13, | |
186 | ALC663_ASUS_G50V, | |
187 | ALC662_ECS, | |
188 | ALC663_ASUS_MODE1, | |
189 | ALC662_ASUS_MODE2, | |
190 | ALC663_ASUS_MODE3, | |
191 | ALC663_ASUS_MODE4, | |
192 | ALC663_ASUS_MODE5, | |
193 | ALC663_ASUS_MODE6, | |
194 | ALC663_ASUS_MODE7, | |
195 | ALC663_ASUS_MODE8, | |
196 | ALC272_DELL, | |
197 | ALC272_DELL_ZM1, | |
198 | ALC272_SAMSUNG_NC10, | |
199 | ALC662_AUTO, | |
200 | ALC662_MODEL_LAST, | |
201 | }; | |
202 | ||
203 | /* ALC882 models */ | |
204 | enum { | |
205 | ALC882_3ST_DIG, | |
206 | ALC882_6ST_DIG, | |
207 | ALC882_ARIMA, | |
208 | ALC882_W2JC, | |
209 | ALC882_TARGA, | |
210 | ALC882_ASUS_A7J, | |
211 | ALC882_ASUS_A7M, | |
212 | ALC885_MACPRO, | |
213 | ALC885_MBA21, | |
214 | ALC885_MBP3, | |
215 | ALC885_MB5, | |
216 | ALC885_MACMINI3, | |
217 | ALC885_IMAC24, | |
218 | ALC885_IMAC91, | |
219 | ALC883_3ST_2ch_DIG, | |
220 | ALC883_3ST_6ch_DIG, | |
221 | ALC883_3ST_6ch, | |
222 | ALC883_6ST_DIG, | |
223 | ALC883_TARGA_DIG, | |
224 | ALC883_TARGA_2ch_DIG, | |
225 | ALC883_TARGA_8ch_DIG, | |
226 | ALC883_ACER, | |
227 | ALC883_ACER_ASPIRE, | |
228 | ALC888_ACER_ASPIRE_4930G, | |
229 | ALC888_ACER_ASPIRE_6530G, | |
230 | ALC888_ACER_ASPIRE_8930G, | |
231 | ALC888_ACER_ASPIRE_7730G, | |
232 | ALC883_MEDION, | |
233 | ALC883_MEDION_MD2, | |
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 | #define MUX_IDX_UNDEF ((unsigned char)-1) | |
286 | ||
287 | struct alc_customize_define { | |
288 | unsigned int sku_cfg; | |
289 | unsigned char port_connectivity; | |
290 | unsigned char check_sum; | |
291 | unsigned char customization; | |
292 | unsigned char external_amp; | |
293 | unsigned int enable_pcbeep:1; | |
294 | unsigned int platform_type:1; | |
295 | unsigned int swap:1; | |
296 | unsigned int override:1; | |
297 | }; | |
298 | ||
299 | struct alc_spec { | |
300 | /* codec parameterization */ | |
301 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ | |
302 | unsigned int num_mixers; | |
303 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ | |
304 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ | |
305 | ||
306 | const struct hda_verb *init_verbs[10]; /* initialization verbs | |
307 | * don't forget NULL | |
308 | * termination! | |
309 | */ | |
310 | unsigned int num_init_verbs; | |
311 | ||
312 | char stream_name_analog[32]; /* analog PCM stream */ | |
313 | struct hda_pcm_stream *stream_analog_playback; | |
314 | struct hda_pcm_stream *stream_analog_capture; | |
315 | struct hda_pcm_stream *stream_analog_alt_playback; | |
316 | struct hda_pcm_stream *stream_analog_alt_capture; | |
317 | ||
318 | char stream_name_digital[32]; /* digital PCM stream */ | |
319 | struct hda_pcm_stream *stream_digital_playback; | |
320 | struct hda_pcm_stream *stream_digital_capture; | |
321 | ||
322 | /* playback */ | |
323 | struct hda_multi_out multiout; /* playback set-up | |
324 | * max_channels, dacs must be set | |
325 | * dig_out_nid and hp_nid are optional | |
326 | */ | |
327 | hda_nid_t alt_dac_nid; | |
328 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ | |
329 | int dig_out_type; | |
330 | ||
331 | /* capture */ | |
332 | unsigned int num_adc_nids; | |
333 | hda_nid_t *adc_nids; | |
334 | hda_nid_t *capsrc_nids; | |
335 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ | |
336 | ||
337 | /* capture setup for dynamic dual-adc switch */ | |
338 | unsigned int cur_adc_idx; | |
339 | hda_nid_t cur_adc; | |
340 | unsigned int cur_adc_stream_tag; | |
341 | unsigned int cur_adc_format; | |
342 | ||
343 | /* capture source */ | |
344 | unsigned int num_mux_defs; | |
345 | const struct hda_input_mux *input_mux; | |
346 | unsigned int cur_mux[3]; | |
347 | struct alc_mic_route ext_mic; | |
348 | struct alc_mic_route int_mic; | |
349 | ||
350 | /* channel model */ | |
351 | const struct hda_channel_mode *channel_mode; | |
352 | int num_channel_mode; | |
353 | int need_dac_fix; | |
354 | int const_channel_count; | |
355 | int ext_channel_count; | |
356 | ||
357 | /* PCM information */ | |
358 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ | |
359 | ||
360 | /* dynamic controls, init_verbs and input_mux */ | |
361 | struct auto_pin_cfg autocfg; | |
362 | struct alc_customize_define cdefine; | |
363 | struct snd_array kctls; | |
364 | struct hda_input_mux private_imux[3]; | |
365 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; | |
366 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; | |
367 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; | |
368 | ||
369 | /* hooks */ | |
370 | void (*init_hook)(struct hda_codec *codec); | |
371 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | |
372 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
373 | void (*power_hook)(struct hda_codec *codec); | |
374 | #endif | |
375 | ||
376 | /* for pin sensing */ | |
377 | unsigned int sense_updated: 1; | |
378 | unsigned int jack_present: 1; | |
379 | unsigned int master_sw: 1; | |
380 | unsigned int auto_mic:1; | |
381 | ||
382 | /* other flags */ | |
383 | unsigned int no_analog :1; /* digital I/O only */ | |
384 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ | |
385 | int init_amp; | |
386 | ||
387 | /* for virtual master */ | |
388 | hda_nid_t vmaster_nid; | |
389 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
390 | struct hda_loopback_check loopback; | |
391 | #endif | |
392 | ||
393 | /* for PLL fix */ | |
394 | hda_nid_t pll_nid; | |
395 | unsigned int pll_coef_idx, pll_coef_bit; | |
396 | }; | |
397 | ||
398 | /* | |
399 | * configuration template - to be copied to the spec instance | |
400 | */ | |
401 | struct alc_config_preset { | |
402 | struct snd_kcontrol_new *mixers[5]; /* should be identical size | |
403 | * with spec | |
404 | */ | |
405 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ | |
406 | const struct hda_verb *init_verbs[5]; | |
407 | unsigned int num_dacs; | |
408 | hda_nid_t *dac_nids; | |
409 | hda_nid_t dig_out_nid; /* optional */ | |
410 | hda_nid_t hp_nid; /* optional */ | |
411 | hda_nid_t *slave_dig_outs; | |
412 | unsigned int num_adc_nids; | |
413 | hda_nid_t *adc_nids; | |
414 | hda_nid_t *capsrc_nids; | |
415 | hda_nid_t dig_in_nid; | |
416 | unsigned int num_channel_mode; | |
417 | const struct hda_channel_mode *channel_mode; | |
418 | int need_dac_fix; | |
419 | int const_channel_count; | |
420 | unsigned int num_mux_defs; | |
421 | const struct hda_input_mux *input_mux; | |
422 | void (*unsol_event)(struct hda_codec *, unsigned int); | |
423 | void (*setup)(struct hda_codec *); | |
424 | void (*init_hook)(struct hda_codec *); | |
425 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
426 | struct hda_amp_list *loopbacks; | |
427 | void (*power_hook)(struct hda_codec *codec); | |
428 | #endif | |
429 | }; | |
430 | ||
431 | ||
432 | /* | |
433 | * input MUX handling | |
434 | */ | |
435 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, | |
436 | struct snd_ctl_elem_info *uinfo) | |
437 | { | |
438 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
439 | struct alc_spec *spec = codec->spec; | |
440 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); | |
441 | if (mux_idx >= spec->num_mux_defs) | |
442 | mux_idx = 0; | |
443 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) | |
444 | mux_idx = 0; | |
445 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); | |
446 | } | |
447 | ||
448 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, | |
449 | struct snd_ctl_elem_value *ucontrol) | |
450 | { | |
451 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
452 | struct alc_spec *spec = codec->spec; | |
453 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
454 | ||
455 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; | |
456 | return 0; | |
457 | } | |
458 | ||
459 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, | |
460 | struct snd_ctl_elem_value *ucontrol) | |
461 | { | |
462 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
463 | struct alc_spec *spec = codec->spec; | |
464 | const struct hda_input_mux *imux; | |
465 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
466 | unsigned int mux_idx; | |
467 | hda_nid_t nid = spec->capsrc_nids ? | |
468 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | |
469 | unsigned int type; | |
470 | ||
471 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | |
472 | imux = &spec->input_mux[mux_idx]; | |
473 | if (!imux->num_items && mux_idx > 0) | |
474 | imux = &spec->input_mux[0]; | |
475 | ||
476 | type = get_wcaps_type(get_wcaps(codec, nid)); | |
477 | if (type == AC_WID_AUD_MIX) { | |
478 | /* Matrix-mixer style (e.g. ALC882) */ | |
479 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | |
480 | unsigned int i, idx; | |
481 | ||
482 | idx = ucontrol->value.enumerated.item[0]; | |
483 | if (idx >= imux->num_items) | |
484 | idx = imux->num_items - 1; | |
485 | if (*cur_val == idx) | |
486 | return 0; | |
487 | for (i = 0; i < imux->num_items; i++) { | |
488 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | |
489 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | |
490 | imux->items[i].index, | |
491 | HDA_AMP_MUTE, v); | |
492 | } | |
493 | *cur_val = idx; | |
494 | return 1; | |
495 | } else { | |
496 | /* MUX style (e.g. ALC880) */ | |
497 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, | |
498 | &spec->cur_mux[adc_idx]); | |
499 | } | |
500 | } | |
501 | ||
502 | /* | |
503 | * channel mode setting | |
504 | */ | |
505 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, | |
506 | struct snd_ctl_elem_info *uinfo) | |
507 | { | |
508 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
509 | struct alc_spec *spec = codec->spec; | |
510 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, | |
511 | spec->num_channel_mode); | |
512 | } | |
513 | ||
514 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, | |
515 | struct snd_ctl_elem_value *ucontrol) | |
516 | { | |
517 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
518 | struct alc_spec *spec = codec->spec; | |
519 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, | |
520 | spec->num_channel_mode, | |
521 | spec->ext_channel_count); | |
522 | } | |
523 | ||
524 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, | |
525 | struct snd_ctl_elem_value *ucontrol) | |
526 | { | |
527 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
528 | struct alc_spec *spec = codec->spec; | |
529 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, | |
530 | spec->num_channel_mode, | |
531 | &spec->ext_channel_count); | |
532 | if (err >= 0 && !spec->const_channel_count) { | |
533 | spec->multiout.max_channels = spec->ext_channel_count; | |
534 | if (spec->need_dac_fix) | |
535 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; | |
536 | } | |
537 | return err; | |
538 | } | |
539 | ||
540 | /* | |
541 | * Control the mode of pin widget settings via the mixer. "pc" is used | |
542 | * instead of "%" to avoid consequences of accidently treating the % as | |
543 | * being part of a format specifier. Maximum allowed length of a value is | |
544 | * 63 characters plus NULL terminator. | |
545 | * | |
546 | * Note: some retasking pin complexes seem to ignore requests for input | |
547 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these | |
548 | * are requested. Therefore order this list so that this behaviour will not | |
549 | * cause problems when mixer clients move through the enum sequentially. | |
550 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of | |
551 | * March 2006. | |
552 | */ | |
553 | static char *alc_pin_mode_names[] = { | |
554 | "Mic 50pc bias", "Mic 80pc bias", | |
555 | "Line in", "Line out", "Headphone out", | |
556 | }; | |
557 | static unsigned char alc_pin_mode_values[] = { | |
558 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, | |
559 | }; | |
560 | /* The control can present all 5 options, or it can limit the options based | |
561 | * in the pin being assumed to be exclusively an input or an output pin. In | |
562 | * addition, "input" pins may or may not process the mic bias option | |
563 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to | |
564 | * accept requests for bias as of chip versions up to March 2006) and/or | |
565 | * wiring in the computer. | |
566 | */ | |
567 | #define ALC_PIN_DIR_IN 0x00 | |
568 | #define ALC_PIN_DIR_OUT 0x01 | |
569 | #define ALC_PIN_DIR_INOUT 0x02 | |
570 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | |
571 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | |
572 | ||
573 | /* Info about the pin modes supported by the different pin direction modes. | |
574 | * For each direction the minimum and maximum values are given. | |
575 | */ | |
576 | static signed char alc_pin_mode_dir_info[5][2] = { | |
577 | { 0, 2 }, /* ALC_PIN_DIR_IN */ | |
578 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ | |
579 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ | |
580 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ | |
581 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ | |
582 | }; | |
583 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) | |
584 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) | |
585 | #define alc_pin_mode_n_items(_dir) \ | |
586 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) | |
587 | ||
588 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, | |
589 | struct snd_ctl_elem_info *uinfo) | |
590 | { | |
591 | unsigned int item_num = uinfo->value.enumerated.item; | |
592 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
593 | ||
594 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
595 | uinfo->count = 1; | |
596 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); | |
597 | ||
598 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) | |
599 | item_num = alc_pin_mode_min(dir); | |
600 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); | |
601 | return 0; | |
602 | } | |
603 | ||
604 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, | |
605 | struct snd_ctl_elem_value *ucontrol) | |
606 | { | |
607 | unsigned int i; | |
608 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
609 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
610 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
611 | long *valp = ucontrol->value.integer.value; | |
612 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, | |
613 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
614 | 0x00); | |
615 | ||
616 | /* Find enumerated value for current pinctl setting */ | |
617 | i = alc_pin_mode_min(dir); | |
618 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) | |
619 | i++; | |
620 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); | |
621 | return 0; | |
622 | } | |
623 | ||
624 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, | |
625 | struct snd_ctl_elem_value *ucontrol) | |
626 | { | |
627 | signed int change; | |
628 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
629 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
630 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
631 | long val = *ucontrol->value.integer.value; | |
632 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, | |
633 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
634 | 0x00); | |
635 | ||
636 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) | |
637 | val = alc_pin_mode_min(dir); | |
638 | ||
639 | change = pinctl != alc_pin_mode_values[val]; | |
640 | if (change) { | |
641 | /* Set pin mode to that requested */ | |
642 | snd_hda_codec_write_cache(codec, nid, 0, | |
643 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
644 | alc_pin_mode_values[val]); | |
645 | ||
646 | /* Also enable the retasking pin's input/output as required | |
647 | * for the requested pin mode. Enum values of 2 or less are | |
648 | * input modes. | |
649 | * | |
650 | * Dynamically switching the input/output buffers probably | |
651 | * reduces noise slightly (particularly on input) so we'll | |
652 | * do it. However, having both input and output buffers | |
653 | * enabled simultaneously doesn't seem to be problematic if | |
654 | * this turns out to be necessary in the future. | |
655 | */ | |
656 | if (val <= 2) { | |
657 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
658 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
659 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | |
660 | HDA_AMP_MUTE, 0); | |
661 | } else { | |
662 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | |
663 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
664 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
665 | HDA_AMP_MUTE, 0); | |
666 | } | |
667 | } | |
668 | return change; | |
669 | } | |
670 | ||
671 | #define ALC_PIN_MODE(xname, nid, dir) \ | |
672 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
673 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | |
674 | .info = alc_pin_mode_info, \ | |
675 | .get = alc_pin_mode_get, \ | |
676 | .put = alc_pin_mode_put, \ | |
677 | .private_value = nid | (dir<<16) } | |
678 | ||
679 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged | |
680 | * together using a mask with more than one bit set. This control is | |
681 | * currently used only by the ALC260 test model. At this stage they are not | |
682 | * needed for any "production" models. | |
683 | */ | |
684 | #ifdef CONFIG_SND_DEBUG | |
685 | #define alc_gpio_data_info snd_ctl_boolean_mono_info | |
686 | ||
687 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, | |
688 | struct snd_ctl_elem_value *ucontrol) | |
689 | { | |
690 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
691 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
692 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
693 | long *valp = ucontrol->value.integer.value; | |
694 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
695 | AC_VERB_GET_GPIO_DATA, 0x00); | |
696 | ||
697 | *valp = (val & mask) != 0; | |
698 | return 0; | |
699 | } | |
700 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, | |
701 | struct snd_ctl_elem_value *ucontrol) | |
702 | { | |
703 | signed int change; | |
704 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
705 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
706 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
707 | long val = *ucontrol->value.integer.value; | |
708 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, | |
709 | AC_VERB_GET_GPIO_DATA, | |
710 | 0x00); | |
711 | ||
712 | /* Set/unset the masked GPIO bit(s) as needed */ | |
713 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); | |
714 | if (val == 0) | |
715 | gpio_data &= ~mask; | |
716 | else | |
717 | gpio_data |= mask; | |
718 | snd_hda_codec_write_cache(codec, nid, 0, | |
719 | AC_VERB_SET_GPIO_DATA, gpio_data); | |
720 | ||
721 | return change; | |
722 | } | |
723 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ | |
724 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
725 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | |
726 | .info = alc_gpio_data_info, \ | |
727 | .get = alc_gpio_data_get, \ | |
728 | .put = alc_gpio_data_put, \ | |
729 | .private_value = nid | (mask<<16) } | |
730 | #endif /* CONFIG_SND_DEBUG */ | |
731 | ||
732 | /* A switch control to allow the enabling of the digital IO pins on the | |
733 | * ALC260. This is incredibly simplistic; the intention of this control is | |
734 | * to provide something in the test model allowing digital outputs to be | |
735 | * identified if present. If models are found which can utilise these | |
736 | * outputs a more complete mixer control can be devised for those models if | |
737 | * necessary. | |
738 | */ | |
739 | #ifdef CONFIG_SND_DEBUG | |
740 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info | |
741 | ||
742 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, | |
743 | struct snd_ctl_elem_value *ucontrol) | |
744 | { | |
745 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
746 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
747 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
748 | long *valp = ucontrol->value.integer.value; | |
749 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
750 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); | |
751 | ||
752 | *valp = (val & mask) != 0; | |
753 | return 0; | |
754 | } | |
755 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, | |
756 | struct snd_ctl_elem_value *ucontrol) | |
757 | { | |
758 | signed int change; | |
759 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
760 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
761 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
762 | long val = *ucontrol->value.integer.value; | |
763 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | |
764 | AC_VERB_GET_DIGI_CONVERT_1, | |
765 | 0x00); | |
766 | ||
767 | /* Set/unset the masked control bit(s) as needed */ | |
768 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); | |
769 | if (val==0) | |
770 | ctrl_data &= ~mask; | |
771 | else | |
772 | ctrl_data |= mask; | |
773 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, | |
774 | ctrl_data); | |
775 | ||
776 | return change; | |
777 | } | |
778 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ | |
779 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
780 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | |
781 | .info = alc_spdif_ctrl_info, \ | |
782 | .get = alc_spdif_ctrl_get, \ | |
783 | .put = alc_spdif_ctrl_put, \ | |
784 | .private_value = nid | (mask<<16) } | |
785 | #endif /* CONFIG_SND_DEBUG */ | |
786 | ||
787 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. | |
788 | * Again, this is only used in the ALC26x test models to help identify when | |
789 | * the EAPD line must be asserted for features to work. | |
790 | */ | |
791 | #ifdef CONFIG_SND_DEBUG | |
792 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info | |
793 | ||
794 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, | |
795 | struct snd_ctl_elem_value *ucontrol) | |
796 | { | |
797 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
798 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
799 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
800 | long *valp = ucontrol->value.integer.value; | |
801 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
802 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); | |
803 | ||
804 | *valp = (val & mask) != 0; | |
805 | return 0; | |
806 | } | |
807 | ||
808 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, | |
809 | struct snd_ctl_elem_value *ucontrol) | |
810 | { | |
811 | int change; | |
812 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
813 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
814 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
815 | long val = *ucontrol->value.integer.value; | |
816 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | |
817 | AC_VERB_GET_EAPD_BTLENABLE, | |
818 | 0x00); | |
819 | ||
820 | /* Set/unset the masked control bit(s) as needed */ | |
821 | change = (!val ? 0 : mask) != (ctrl_data & mask); | |
822 | if (!val) | |
823 | ctrl_data &= ~mask; | |
824 | else | |
825 | ctrl_data |= mask; | |
826 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
827 | ctrl_data); | |
828 | ||
829 | return change; | |
830 | } | |
831 | ||
832 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ | |
833 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
834 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | |
835 | .info = alc_eapd_ctrl_info, \ | |
836 | .get = alc_eapd_ctrl_get, \ | |
837 | .put = alc_eapd_ctrl_put, \ | |
838 | .private_value = nid | (mask<<16) } | |
839 | #endif /* CONFIG_SND_DEBUG */ | |
840 | ||
841 | /* | |
842 | * set up the input pin config (depending on the given auto-pin type) | |
843 | */ | |
844 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, | |
845 | int auto_pin_type) | |
846 | { | |
847 | unsigned int val = PIN_IN; | |
848 | ||
849 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { | |
850 | unsigned int pincap; | |
851 | unsigned int oldval; | |
852 | oldval = snd_hda_codec_read(codec, nid, 0, | |
853 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
854 | pincap = snd_hda_query_pin_caps(codec, nid); | |
855 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; | |
856 | /* if the default pin setup is vref50, we give it priority */ | |
857 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) | |
858 | val = PIN_VREF80; | |
859 | else if (pincap & AC_PINCAP_VREF_50) | |
860 | val = PIN_VREF50; | |
861 | else if (pincap & AC_PINCAP_VREF_100) | |
862 | val = PIN_VREF100; | |
863 | else if (pincap & AC_PINCAP_VREF_GRD) | |
864 | val = PIN_VREFGRD; | |
865 | } | |
866 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); | |
867 | } | |
868 | ||
869 | /* | |
870 | */ | |
871 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) | |
872 | { | |
873 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) | |
874 | return; | |
875 | spec->mixers[spec->num_mixers++] = mix; | |
876 | } | |
877 | ||
878 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) | |
879 | { | |
880 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) | |
881 | return; | |
882 | spec->init_verbs[spec->num_init_verbs++] = verb; | |
883 | } | |
884 | ||
885 | /* | |
886 | * set up from the preset table | |
887 | */ | |
888 | static void setup_preset(struct hda_codec *codec, | |
889 | const struct alc_config_preset *preset) | |
890 | { | |
891 | struct alc_spec *spec = codec->spec; | |
892 | int i; | |
893 | ||
894 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | |
895 | add_mixer(spec, preset->mixers[i]); | |
896 | spec->cap_mixer = preset->cap_mixer; | |
897 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; | |
898 | i++) | |
899 | add_verb(spec, preset->init_verbs[i]); | |
900 | ||
901 | spec->channel_mode = preset->channel_mode; | |
902 | spec->num_channel_mode = preset->num_channel_mode; | |
903 | spec->need_dac_fix = preset->need_dac_fix; | |
904 | spec->const_channel_count = preset->const_channel_count; | |
905 | ||
906 | if (preset->const_channel_count) | |
907 | spec->multiout.max_channels = preset->const_channel_count; | |
908 | else | |
909 | spec->multiout.max_channels = spec->channel_mode[0].channels; | |
910 | spec->ext_channel_count = spec->channel_mode[0].channels; | |
911 | ||
912 | spec->multiout.num_dacs = preset->num_dacs; | |
913 | spec->multiout.dac_nids = preset->dac_nids; | |
914 | spec->multiout.dig_out_nid = preset->dig_out_nid; | |
915 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; | |
916 | spec->multiout.hp_nid = preset->hp_nid; | |
917 | ||
918 | spec->num_mux_defs = preset->num_mux_defs; | |
919 | if (!spec->num_mux_defs) | |
920 | spec->num_mux_defs = 1; | |
921 | spec->input_mux = preset->input_mux; | |
922 | ||
923 | spec->num_adc_nids = preset->num_adc_nids; | |
924 | spec->adc_nids = preset->adc_nids; | |
925 | spec->capsrc_nids = preset->capsrc_nids; | |
926 | spec->dig_in_nid = preset->dig_in_nid; | |
927 | ||
928 | spec->unsol_event = preset->unsol_event; | |
929 | spec->init_hook = preset->init_hook; | |
930 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
931 | spec->power_hook = preset->power_hook; | |
932 | spec->loopback.amplist = preset->loopbacks; | |
933 | #endif | |
934 | ||
935 | if (preset->setup) | |
936 | preset->setup(codec); | |
937 | } | |
938 | ||
939 | /* Enable GPIO mask and set output */ | |
940 | static struct hda_verb alc_gpio1_init_verbs[] = { | |
941 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
942 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
943 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
944 | { } | |
945 | }; | |
946 | ||
947 | static struct hda_verb alc_gpio2_init_verbs[] = { | |
948 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | |
949 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | |
950 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, | |
951 | { } | |
952 | }; | |
953 | ||
954 | static struct hda_verb alc_gpio3_init_verbs[] = { | |
955 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
956 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
957 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
958 | { } | |
959 | }; | |
960 | ||
961 | /* | |
962 | * Fix hardware PLL issue | |
963 | * On some codecs, the analog PLL gating control must be off while | |
964 | * the default value is 1. | |
965 | */ | |
966 | static void alc_fix_pll(struct hda_codec *codec) | |
967 | { | |
968 | struct alc_spec *spec = codec->spec; | |
969 | unsigned int val; | |
970 | ||
971 | if (!spec->pll_nid) | |
972 | return; | |
973 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
974 | spec->pll_coef_idx); | |
975 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, | |
976 | AC_VERB_GET_PROC_COEF, 0); | |
977 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
978 | spec->pll_coef_idx); | |
979 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, | |
980 | val & ~(1 << spec->pll_coef_bit)); | |
981 | } | |
982 | ||
983 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |
984 | unsigned int coef_idx, unsigned int coef_bit) | |
985 | { | |
986 | struct alc_spec *spec = codec->spec; | |
987 | spec->pll_nid = nid; | |
988 | spec->pll_coef_idx = coef_idx; | |
989 | spec->pll_coef_bit = coef_bit; | |
990 | alc_fix_pll(codec); | |
991 | } | |
992 | ||
993 | static void alc_automute_pin(struct hda_codec *codec) | |
994 | { | |
995 | struct alc_spec *spec = codec->spec; | |
996 | unsigned int nid = spec->autocfg.hp_pins[0]; | |
997 | int i; | |
998 | ||
999 | if (!nid) | |
1000 | return; | |
1001 | spec->jack_present = snd_hda_jack_detect(codec, nid); | |
1002 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { | |
1003 | nid = spec->autocfg.speaker_pins[i]; | |
1004 | if (!nid) | |
1005 | break; | |
1006 | snd_hda_codec_write(codec, nid, 0, | |
1007 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
1008 | spec->jack_present ? 0 : PIN_OUT); | |
1009 | } | |
1010 | } | |
1011 | ||
1012 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, | |
1013 | hda_nid_t nid) | |
1014 | { | |
1015 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | |
1016 | int i, nums; | |
1017 | ||
1018 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); | |
1019 | for (i = 0; i < nums; i++) | |
1020 | if (conn[i] == nid) | |
1021 | return i; | |
1022 | return -1; | |
1023 | } | |
1024 | ||
1025 | /* switch the current ADC according to the jack state */ | |
1026 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) | |
1027 | { | |
1028 | struct alc_spec *spec = codec->spec; | |
1029 | unsigned int present; | |
1030 | hda_nid_t new_adc; | |
1031 | ||
1032 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); | |
1033 | if (present) | |
1034 | spec->cur_adc_idx = 1; | |
1035 | else | |
1036 | spec->cur_adc_idx = 0; | |
1037 | new_adc = spec->adc_nids[spec->cur_adc_idx]; | |
1038 | if (spec->cur_adc && spec->cur_adc != new_adc) { | |
1039 | /* stream is running, let's swap the current ADC */ | |
1040 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); | |
1041 | spec->cur_adc = new_adc; | |
1042 | snd_hda_codec_setup_stream(codec, new_adc, | |
1043 | spec->cur_adc_stream_tag, 0, | |
1044 | spec->cur_adc_format); | |
1045 | } | |
1046 | } | |
1047 | ||
1048 | static void alc_mic_automute(struct hda_codec *codec) | |
1049 | { | |
1050 | struct alc_spec *spec = codec->spec; | |
1051 | struct alc_mic_route *dead, *alive; | |
1052 | unsigned int present, type; | |
1053 | hda_nid_t cap_nid; | |
1054 | ||
1055 | if (!spec->auto_mic) | |
1056 | return; | |
1057 | if (!spec->int_mic.pin || !spec->ext_mic.pin) | |
1058 | return; | |
1059 | if (snd_BUG_ON(!spec->adc_nids)) | |
1060 | return; | |
1061 | ||
1062 | if (spec->dual_adc_switch) { | |
1063 | alc_dual_mic_adc_auto_switch(codec); | |
1064 | return; | |
1065 | } | |
1066 | ||
1067 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; | |
1068 | ||
1069 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); | |
1070 | if (present) { | |
1071 | alive = &spec->ext_mic; | |
1072 | dead = &spec->int_mic; | |
1073 | } else { | |
1074 | alive = &spec->int_mic; | |
1075 | dead = &spec->ext_mic; | |
1076 | } | |
1077 | ||
1078 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); | |
1079 | if (type == AC_WID_AUD_MIX) { | |
1080 | /* Matrix-mixer style (e.g. ALC882) */ | |
1081 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | |
1082 | alive->mux_idx, | |
1083 | HDA_AMP_MUTE, 0); | |
1084 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | |
1085 | dead->mux_idx, | |
1086 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
1087 | } else { | |
1088 | /* MUX style (e.g. ALC880) */ | |
1089 | snd_hda_codec_write_cache(codec, cap_nid, 0, | |
1090 | AC_VERB_SET_CONNECT_SEL, | |
1091 | alive->mux_idx); | |
1092 | } | |
1093 | ||
1094 | /* FIXME: analog mixer */ | |
1095 | } | |
1096 | ||
1097 | /* unsolicited event for HP jack sensing */ | |
1098 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | |
1099 | { | |
1100 | if (codec->vendor_id == 0x10ec0880) | |
1101 | res >>= 28; | |
1102 | else | |
1103 | res >>= 26; | |
1104 | switch (res) { | |
1105 | case ALC880_HP_EVENT: | |
1106 | alc_automute_pin(codec); | |
1107 | break; | |
1108 | case ALC880_MIC_EVENT: | |
1109 | alc_mic_automute(codec); | |
1110 | break; | |
1111 | } | |
1112 | } | |
1113 | ||
1114 | static void alc_inithook(struct hda_codec *codec) | |
1115 | { | |
1116 | alc_automute_pin(codec); | |
1117 | alc_mic_automute(codec); | |
1118 | } | |
1119 | ||
1120 | /* additional initialization for ALC888 variants */ | |
1121 | static void alc888_coef_init(struct hda_codec *codec) | |
1122 | { | |
1123 | unsigned int tmp; | |
1124 | ||
1125 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); | |
1126 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
1127 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1128 | if ((tmp & 0xf0) == 0x20) | |
1129 | /* alc888S-VC */ | |
1130 | snd_hda_codec_read(codec, 0x20, 0, | |
1131 | AC_VERB_SET_PROC_COEF, 0x830); | |
1132 | else | |
1133 | /* alc888-VB */ | |
1134 | snd_hda_codec_read(codec, 0x20, 0, | |
1135 | AC_VERB_SET_PROC_COEF, 0x3030); | |
1136 | } | |
1137 | ||
1138 | static void alc889_coef_init(struct hda_codec *codec) | |
1139 | { | |
1140 | unsigned int tmp; | |
1141 | ||
1142 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1143 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
1144 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1145 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); | |
1146 | } | |
1147 | ||
1148 | /* turn on/off EAPD control (only if available) */ | |
1149 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) | |
1150 | { | |
1151 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) | |
1152 | return; | |
1153 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) | |
1154 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
1155 | on ? 2 : 0); | |
1156 | } | |
1157 | ||
1158 | static void alc_auto_init_amp(struct hda_codec *codec, int type) | |
1159 | { | |
1160 | unsigned int tmp; | |
1161 | ||
1162 | switch (type) { | |
1163 | case ALC_INIT_GPIO1: | |
1164 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); | |
1165 | break; | |
1166 | case ALC_INIT_GPIO2: | |
1167 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); | |
1168 | break; | |
1169 | case ALC_INIT_GPIO3: | |
1170 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); | |
1171 | break; | |
1172 | case ALC_INIT_DEFAULT: | |
1173 | switch (codec->vendor_id) { | |
1174 | case 0x10ec0260: | |
1175 | set_eapd(codec, 0x0f, 1); | |
1176 | set_eapd(codec, 0x10, 1); | |
1177 | break; | |
1178 | case 0x10ec0262: | |
1179 | case 0x10ec0267: | |
1180 | case 0x10ec0268: | |
1181 | case 0x10ec0269: | |
1182 | case 0x10ec0270: | |
1183 | case 0x10ec0272: | |
1184 | case 0x10ec0660: | |
1185 | case 0x10ec0662: | |
1186 | case 0x10ec0663: | |
1187 | case 0x10ec0862: | |
1188 | case 0x10ec0889: | |
1189 | set_eapd(codec, 0x14, 1); | |
1190 | set_eapd(codec, 0x15, 1); | |
1191 | break; | |
1192 | } | |
1193 | switch (codec->vendor_id) { | |
1194 | case 0x10ec0260: | |
1195 | snd_hda_codec_write(codec, 0x1a, 0, | |
1196 | AC_VERB_SET_COEF_INDEX, 7); | |
1197 | tmp = snd_hda_codec_read(codec, 0x1a, 0, | |
1198 | AC_VERB_GET_PROC_COEF, 0); | |
1199 | snd_hda_codec_write(codec, 0x1a, 0, | |
1200 | AC_VERB_SET_COEF_INDEX, 7); | |
1201 | snd_hda_codec_write(codec, 0x1a, 0, | |
1202 | AC_VERB_SET_PROC_COEF, | |
1203 | tmp | 0x2010); | |
1204 | break; | |
1205 | case 0x10ec0262: | |
1206 | case 0x10ec0880: | |
1207 | case 0x10ec0882: | |
1208 | case 0x10ec0883: | |
1209 | case 0x10ec0885: | |
1210 | case 0x10ec0887: | |
1211 | case 0x10ec0889: | |
1212 | alc889_coef_init(codec); | |
1213 | break; | |
1214 | case 0x10ec0888: | |
1215 | alc888_coef_init(codec); | |
1216 | break; | |
1217 | #if 0 /* XXX: This may cause the silent output on speaker on some machines */ | |
1218 | case 0x10ec0267: | |
1219 | case 0x10ec0268: | |
1220 | snd_hda_codec_write(codec, 0x20, 0, | |
1221 | AC_VERB_SET_COEF_INDEX, 7); | |
1222 | tmp = snd_hda_codec_read(codec, 0x20, 0, | |
1223 | AC_VERB_GET_PROC_COEF, 0); | |
1224 | snd_hda_codec_write(codec, 0x20, 0, | |
1225 | AC_VERB_SET_COEF_INDEX, 7); | |
1226 | snd_hda_codec_write(codec, 0x20, 0, | |
1227 | AC_VERB_SET_PROC_COEF, | |
1228 | tmp | 0x3000); | |
1229 | break; | |
1230 | #endif /* XXX */ | |
1231 | } | |
1232 | break; | |
1233 | } | |
1234 | } | |
1235 | ||
1236 | static void alc_init_auto_hp(struct hda_codec *codec) | |
1237 | { | |
1238 | struct alc_spec *spec = codec->spec; | |
1239 | ||
1240 | if (!spec->autocfg.hp_pins[0]) | |
1241 | return; | |
1242 | ||
1243 | if (!spec->autocfg.speaker_pins[0]) { | |
1244 | if (spec->autocfg.line_out_pins[0] && | |
1245 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) | |
1246 | spec->autocfg.speaker_pins[0] = | |
1247 | spec->autocfg.line_out_pins[0]; | |
1248 | else | |
1249 | return; | |
1250 | } | |
1251 | ||
1252 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", | |
1253 | spec->autocfg.hp_pins[0]); | |
1254 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, | |
1255 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
1256 | AC_USRSP_EN | ALC880_HP_EVENT); | |
1257 | spec->unsol_event = alc_sku_unsol_event; | |
1258 | } | |
1259 | ||
1260 | static void alc_init_auto_mic(struct hda_codec *codec) | |
1261 | { | |
1262 | struct alc_spec *spec = codec->spec; | |
1263 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
1264 | hda_nid_t fixed, ext; | |
1265 | int i; | |
1266 | ||
1267 | /* there must be only two mic inputs exclusively */ | |
1268 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) | |
1269 | if (cfg->input_pins[i]) | |
1270 | return; | |
1271 | ||
1272 | fixed = ext = 0; | |
1273 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { | |
1274 | hda_nid_t nid = cfg->input_pins[i]; | |
1275 | unsigned int defcfg; | |
1276 | if (!nid) | |
1277 | return; | |
1278 | defcfg = snd_hda_codec_get_pincfg(codec, nid); | |
1279 | switch (get_defcfg_connect(defcfg)) { | |
1280 | case AC_JACK_PORT_FIXED: | |
1281 | if (fixed) | |
1282 | return; /* already occupied */ | |
1283 | fixed = nid; | |
1284 | break; | |
1285 | case AC_JACK_PORT_COMPLEX: | |
1286 | if (ext) | |
1287 | return; /* already occupied */ | |
1288 | ext = nid; | |
1289 | break; | |
1290 | default: | |
1291 | return; /* invalid entry */ | |
1292 | } | |
1293 | } | |
1294 | if (!ext || !fixed) | |
1295 | return; | |
1296 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) | |
1297 | return; /* no unsol support */ | |
1298 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", | |
1299 | ext, fixed); | |
1300 | spec->ext_mic.pin = ext; | |
1301 | spec->int_mic.pin = fixed; | |
1302 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | |
1303 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | |
1304 | spec->auto_mic = 1; | |
1305 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, | |
1306 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
1307 | AC_USRSP_EN | ALC880_MIC_EVENT); | |
1308 | spec->unsol_event = alc_sku_unsol_event; | |
1309 | } | |
1310 | ||
1311 | static int alc_auto_parse_customize_define(struct hda_codec *codec) | |
1312 | { | |
1313 | unsigned int ass, tmp, i; | |
1314 | unsigned nid = 0; | |
1315 | struct alc_spec *spec = codec->spec; | |
1316 | ||
1317 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ | |
1318 | ||
1319 | ass = codec->subsystem_id & 0xffff; | |
1320 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) | |
1321 | goto do_sku; | |
1322 | ||
1323 | nid = 0x1d; | |
1324 | if (codec->vendor_id == 0x10ec0260) | |
1325 | nid = 0x17; | |
1326 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
1327 | ||
1328 | if (!(ass & 1)) { | |
1329 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", | |
1330 | codec->chip_name, ass); | |
1331 | return -1; | |
1332 | } | |
1333 | ||
1334 | /* check sum */ | |
1335 | tmp = 0; | |
1336 | for (i = 1; i < 16; i++) { | |
1337 | if ((ass >> i) & 1) | |
1338 | tmp++; | |
1339 | } | |
1340 | if (((ass >> 16) & 0xf) != tmp) | |
1341 | return -1; | |
1342 | ||
1343 | spec->cdefine.port_connectivity = ass >> 30; | |
1344 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; | |
1345 | spec->cdefine.check_sum = (ass >> 16) & 0xf; | |
1346 | spec->cdefine.customization = ass >> 8; | |
1347 | do_sku: | |
1348 | spec->cdefine.sku_cfg = ass; | |
1349 | spec->cdefine.external_amp = (ass & 0x38) >> 3; | |
1350 | spec->cdefine.platform_type = (ass & 0x4) >> 2; | |
1351 | spec->cdefine.swap = (ass & 0x2) >> 1; | |
1352 | spec->cdefine.override = ass & 0x1; | |
1353 | ||
1354 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", | |
1355 | nid, spec->cdefine.sku_cfg); | |
1356 | snd_printd("SKU: port_connectivity=0x%x\n", | |
1357 | spec->cdefine.port_connectivity); | |
1358 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); | |
1359 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); | |
1360 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); | |
1361 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); | |
1362 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); | |
1363 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); | |
1364 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); | |
1365 | ||
1366 | return 0; | |
1367 | } | |
1368 | ||
1369 | /* check subsystem ID and set up device-specific initialization; | |
1370 | * return 1 if initialized, 0 if invalid SSID | |
1371 | */ | |
1372 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. | |
1373 | * 31 ~ 16 : Manufacture ID | |
1374 | * 15 ~ 8 : SKU ID | |
1375 | * 7 ~ 0 : Assembly ID | |
1376 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 | |
1377 | */ | |
1378 | static int alc_subsystem_id(struct hda_codec *codec, | |
1379 | hda_nid_t porta, hda_nid_t porte, | |
1380 | hda_nid_t portd, hda_nid_t porti) | |
1381 | { | |
1382 | unsigned int ass, tmp, i; | |
1383 | unsigned nid; | |
1384 | struct alc_spec *spec = codec->spec; | |
1385 | ||
1386 | ass = codec->subsystem_id & 0xffff; | |
1387 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) | |
1388 | goto do_sku; | |
1389 | ||
1390 | /* invalid SSID, check the special NID pin defcfg instead */ | |
1391 | /* | |
1392 | * 31~30 : port connectivity | |
1393 | * 29~21 : reserve | |
1394 | * 20 : PCBEEP input | |
1395 | * 19~16 : Check sum (15:1) | |
1396 | * 15~1 : Custom | |
1397 | * 0 : override | |
1398 | */ | |
1399 | nid = 0x1d; | |
1400 | if (codec->vendor_id == 0x10ec0260) | |
1401 | nid = 0x17; | |
1402 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
1403 | snd_printd("realtek: No valid SSID, " | |
1404 | "checking pincfg 0x%08x for NID 0x%x\n", | |
1405 | ass, nid); | |
1406 | if (!(ass & 1)) | |
1407 | return 0; | |
1408 | if ((ass >> 30) != 1) /* no physical connection */ | |
1409 | return 0; | |
1410 | ||
1411 | /* check sum */ | |
1412 | tmp = 0; | |
1413 | for (i = 1; i < 16; i++) { | |
1414 | if ((ass >> i) & 1) | |
1415 | tmp++; | |
1416 | } | |
1417 | if (((ass >> 16) & 0xf) != tmp) | |
1418 | return 0; | |
1419 | do_sku: | |
1420 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", | |
1421 | ass & 0xffff, codec->vendor_id); | |
1422 | /* | |
1423 | * 0 : override | |
1424 | * 1 : Swap Jack | |
1425 | * 2 : 0 --> Desktop, 1 --> Laptop | |
1426 | * 3~5 : External Amplifier control | |
1427 | * 7~6 : Reserved | |
1428 | */ | |
1429 | tmp = (ass & 0x38) >> 3; /* external Amp control */ | |
1430 | switch (tmp) { | |
1431 | case 1: | |
1432 | spec->init_amp = ALC_INIT_GPIO1; | |
1433 | break; | |
1434 | case 3: | |
1435 | spec->init_amp = ALC_INIT_GPIO2; | |
1436 | break; | |
1437 | case 7: | |
1438 | spec->init_amp = ALC_INIT_GPIO3; | |
1439 | break; | |
1440 | case 5: | |
1441 | spec->init_amp = ALC_INIT_DEFAULT; | |
1442 | break; | |
1443 | } | |
1444 | ||
1445 | /* is laptop or Desktop and enable the function "Mute internal speaker | |
1446 | * when the external headphone out jack is plugged" | |
1447 | */ | |
1448 | if (!(ass & 0x8000)) | |
1449 | return 1; | |
1450 | /* | |
1451 | * 10~8 : Jack location | |
1452 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered | |
1453 | * 14~13: Resvered | |
1454 | * 15 : 1 --> enable the function "Mute internal speaker | |
1455 | * when the external headphone out jack is plugged" | |
1456 | */ | |
1457 | if (!spec->autocfg.hp_pins[0]) { | |
1458 | hda_nid_t nid; | |
1459 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ | |
1460 | if (tmp == 0) | |
1461 | nid = porta; | |
1462 | else if (tmp == 1) | |
1463 | nid = porte; | |
1464 | else if (tmp == 2) | |
1465 | nid = portd; | |
1466 | else if (tmp == 3) | |
1467 | nid = porti; | |
1468 | else | |
1469 | return 1; | |
1470 | for (i = 0; i < spec->autocfg.line_outs; i++) | |
1471 | if (spec->autocfg.line_out_pins[i] == nid) | |
1472 | return 1; | |
1473 | spec->autocfg.hp_pins[0] = nid; | |
1474 | } | |
1475 | ||
1476 | alc_init_auto_hp(codec); | |
1477 | alc_init_auto_mic(codec); | |
1478 | return 1; | |
1479 | } | |
1480 | ||
1481 | static void alc_ssid_check(struct hda_codec *codec, | |
1482 | hda_nid_t porta, hda_nid_t porte, | |
1483 | hda_nid_t portd, hda_nid_t porti) | |
1484 | { | |
1485 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { | |
1486 | struct alc_spec *spec = codec->spec; | |
1487 | snd_printd("realtek: " | |
1488 | "Enable default setup for auto mode as fallback\n"); | |
1489 | spec->init_amp = ALC_INIT_DEFAULT; | |
1490 | alc_init_auto_hp(codec); | |
1491 | alc_init_auto_mic(codec); | |
1492 | } | |
1493 | } | |
1494 | ||
1495 | /* | |
1496 | * Fix-up pin default configurations and add default verbs | |
1497 | */ | |
1498 | ||
1499 | struct alc_pincfg { | |
1500 | hda_nid_t nid; | |
1501 | u32 val; | |
1502 | }; | |
1503 | ||
1504 | struct alc_fixup { | |
1505 | const struct alc_pincfg *pins; | |
1506 | const struct hda_verb *verbs; | |
1507 | }; | |
1508 | ||
1509 | static void alc_pick_fixup(struct hda_codec *codec, | |
1510 | const struct snd_pci_quirk *quirk, | |
1511 | const struct alc_fixup *fix, | |
1512 | int pre_init) | |
1513 | { | |
1514 | const struct alc_pincfg *cfg; | |
1515 | ||
1516 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | |
1517 | if (!quirk) | |
1518 | return; | |
1519 | fix += quirk->value; | |
1520 | cfg = fix->pins; | |
1521 | if (pre_init && cfg) { | |
1522 | #ifdef CONFIG_SND_DEBUG_VERBOSE | |
1523 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", | |
1524 | codec->chip_name, quirk->name); | |
1525 | #endif | |
1526 | for (; cfg->nid; cfg++) | |
1527 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | |
1528 | } | |
1529 | if (!pre_init && fix->verbs) { | |
1530 | #ifdef CONFIG_SND_DEBUG_VERBOSE | |
1531 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", | |
1532 | codec->chip_name, quirk->name); | |
1533 | #endif | |
1534 | add_verb(codec->spec, fix->verbs); | |
1535 | } | |
1536 | } | |
1537 | ||
1538 | static int alc_read_coef_idx(struct hda_codec *codec, | |
1539 | unsigned int coef_idx) | |
1540 | { | |
1541 | unsigned int val; | |
1542 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, | |
1543 | coef_idx); | |
1544 | val = snd_hda_codec_read(codec, 0x20, 0, | |
1545 | AC_VERB_GET_PROC_COEF, 0); | |
1546 | return val; | |
1547 | } | |
1548 | ||
1549 | /* set right pin controls for digital I/O */ | |
1550 | static void alc_auto_init_digital(struct hda_codec *codec) | |
1551 | { | |
1552 | struct alc_spec *spec = codec->spec; | |
1553 | int i; | |
1554 | hda_nid_t pin; | |
1555 | ||
1556 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | |
1557 | pin = spec->autocfg.dig_out_pins[i]; | |
1558 | if (pin) { | |
1559 | snd_hda_codec_write(codec, pin, 0, | |
1560 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
1561 | PIN_OUT); | |
1562 | } | |
1563 | } | |
1564 | pin = spec->autocfg.dig_in_pin; | |
1565 | if (pin) | |
1566 | snd_hda_codec_write(codec, pin, 0, | |
1567 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
1568 | PIN_IN); | |
1569 | } | |
1570 | ||
1571 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ | |
1572 | static void alc_auto_parse_digital(struct hda_codec *codec) | |
1573 | { | |
1574 | struct alc_spec *spec = codec->spec; | |
1575 | int i, err; | |
1576 | hda_nid_t dig_nid; | |
1577 | ||
1578 | /* support multiple SPDIFs; the secondary is set up as a slave */ | |
1579 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | |
1580 | err = snd_hda_get_connections(codec, | |
1581 | spec->autocfg.dig_out_pins[i], | |
1582 | &dig_nid, 1); | |
1583 | if (err < 0) | |
1584 | continue; | |
1585 | if (!i) { | |
1586 | spec->multiout.dig_out_nid = dig_nid; | |
1587 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | |
1588 | } else { | |
1589 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | |
1590 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) | |
1591 | break; | |
1592 | spec->slave_dig_outs[i - 1] = dig_nid; | |
1593 | } | |
1594 | } | |
1595 | ||
1596 | if (spec->autocfg.dig_in_pin) { | |
1597 | hda_nid_t dig_nid; | |
1598 | err = snd_hda_get_connections(codec, | |
1599 | spec->autocfg.dig_in_pin, | |
1600 | &dig_nid, 1); | |
1601 | if (err > 0) | |
1602 | spec->dig_in_nid = dig_nid; | |
1603 | } | |
1604 | } | |
1605 | ||
1606 | /* | |
1607 | * ALC888 | |
1608 | */ | |
1609 | ||
1610 | /* | |
1611 | * 2ch mode | |
1612 | */ | |
1613 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { | |
1614 | /* Mic-in jack as mic in */ | |
1615 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1616 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1617 | /* Line-in jack as Line in */ | |
1618 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1619 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1620 | /* Line-Out as Front */ | |
1621 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1622 | { } /* end */ | |
1623 | }; | |
1624 | ||
1625 | /* | |
1626 | * 4ch mode | |
1627 | */ | |
1628 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { | |
1629 | /* Mic-in jack as mic in */ | |
1630 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1631 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1632 | /* Line-in jack as Surround */ | |
1633 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1634 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1635 | /* Line-Out as Front */ | |
1636 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1637 | { } /* end */ | |
1638 | }; | |
1639 | ||
1640 | /* | |
1641 | * 6ch mode | |
1642 | */ | |
1643 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { | |
1644 | /* Mic-in jack as CLFE */ | |
1645 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1646 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1647 | /* Line-in jack as Surround */ | |
1648 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1649 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1650 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ | |
1651 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1652 | { } /* end */ | |
1653 | }; | |
1654 | ||
1655 | /* | |
1656 | * 8ch mode | |
1657 | */ | |
1658 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { | |
1659 | /* Mic-in jack as CLFE */ | |
1660 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1661 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1662 | /* Line-in jack as Surround */ | |
1663 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1664 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1665 | /* Line-Out as Side */ | |
1666 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1667 | { } /* end */ | |
1668 | }; | |
1669 | ||
1670 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { | |
1671 | { 2, alc888_4ST_ch2_intel_init }, | |
1672 | { 4, alc888_4ST_ch4_intel_init }, | |
1673 | { 6, alc888_4ST_ch6_intel_init }, | |
1674 | { 8, alc888_4ST_ch8_intel_init }, | |
1675 | }; | |
1676 | ||
1677 | /* | |
1678 | * ALC888 Fujitsu Siemens Amillo xa3530 | |
1679 | */ | |
1680 | ||
1681 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { | |
1682 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1683 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1684 | /* Connect Internal HP to Front */ | |
1685 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1686 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1687 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1688 | /* Connect Bass HP to Front */ | |
1689 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1690 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1691 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1692 | /* Connect Line-Out side jack (SPDIF) to Side */ | |
1693 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1694 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1695 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1696 | /* Connect Mic jack to CLFE */ | |
1697 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1698 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1699 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
1700 | /* Connect Line-in jack to Surround */ | |
1701 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1702 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1703 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1704 | /* Connect HP out jack to Front */ | |
1705 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1706 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1707 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1708 | /* Enable unsolicited event for HP jack and Line-out jack */ | |
1709 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1710 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1711 | {} | |
1712 | }; | |
1713 | ||
1714 | static void alc_automute_amp(struct hda_codec *codec) | |
1715 | { | |
1716 | struct alc_spec *spec = codec->spec; | |
1717 | unsigned int mute; | |
1718 | hda_nid_t nid; | |
1719 | int i; | |
1720 | ||
1721 | spec->jack_present = 0; | |
1722 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { | |
1723 | nid = spec->autocfg.hp_pins[i]; | |
1724 | if (!nid) | |
1725 | break; | |
1726 | if (snd_hda_jack_detect(codec, nid)) { | |
1727 | spec->jack_present = 1; | |
1728 | break; | |
1729 | } | |
1730 | } | |
1731 | ||
1732 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; | |
1733 | /* Toggle internal speakers muting */ | |
1734 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { | |
1735 | nid = spec->autocfg.speaker_pins[i]; | |
1736 | if (!nid) | |
1737 | break; | |
1738 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
1739 | HDA_AMP_MUTE, mute); | |
1740 | } | |
1741 | } | |
1742 | ||
1743 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, | |
1744 | unsigned int res) | |
1745 | { | |
1746 | if (codec->vendor_id == 0x10ec0880) | |
1747 | res >>= 28; | |
1748 | else | |
1749 | res >>= 26; | |
1750 | if (res == ALC880_HP_EVENT) | |
1751 | alc_automute_amp(codec); | |
1752 | } | |
1753 | ||
1754 | static void alc889_automute_setup(struct hda_codec *codec) | |
1755 | { | |
1756 | struct alc_spec *spec = codec->spec; | |
1757 | ||
1758 | spec->autocfg.hp_pins[0] = 0x15; | |
1759 | spec->autocfg.speaker_pins[0] = 0x14; | |
1760 | spec->autocfg.speaker_pins[1] = 0x16; | |
1761 | spec->autocfg.speaker_pins[2] = 0x17; | |
1762 | spec->autocfg.speaker_pins[3] = 0x19; | |
1763 | spec->autocfg.speaker_pins[4] = 0x1a; | |
1764 | } | |
1765 | ||
1766 | static void alc889_intel_init_hook(struct hda_codec *codec) | |
1767 | { | |
1768 | alc889_coef_init(codec); | |
1769 | alc_automute_amp(codec); | |
1770 | } | |
1771 | ||
1772 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) | |
1773 | { | |
1774 | struct alc_spec *spec = codec->spec; | |
1775 | ||
1776 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ | |
1777 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ | |
1778 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ | |
1779 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ | |
1780 | } | |
1781 | ||
1782 | /* | |
1783 | * ALC888 Acer Aspire 4930G model | |
1784 | */ | |
1785 | ||
1786 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { | |
1787 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1788 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1789 | /* Unselect Front Mic by default in input mixer 3 */ | |
1790 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
1791 | /* Enable unsolicited event for HP jack */ | |
1792 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1793 | /* Connect Internal HP to front */ | |
1794 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1795 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1796 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1797 | /* Connect HP out to front */ | |
1798 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1799 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1800 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1801 | { } | |
1802 | }; | |
1803 | ||
1804 | /* | |
1805 | * ALC888 Acer Aspire 6530G model | |
1806 | */ | |
1807 | ||
1808 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { | |
1809 | /* Route to built-in subwoofer as well as speakers */ | |
1810 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1811 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
1812 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1813 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
1814 | /* Bias voltage on for external mic port */ | |
1815 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, | |
1816 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1817 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1818 | /* Unselect Front Mic by default in input mixer 3 */ | |
1819 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
1820 | /* Enable unsolicited event for HP jack */ | |
1821 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1822 | /* Enable speaker output */ | |
1823 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1824 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1825 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
1826 | /* Enable headphone output */ | |
1827 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | |
1828 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1829 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1830 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
1831 | { } | |
1832 | }; | |
1833 | ||
1834 | /* | |
1835 | * ALC889 Acer Aspire 8930G model | |
1836 | */ | |
1837 | ||
1838 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { | |
1839 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1840 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1841 | /* Unselect Front Mic by default in input mixer 3 */ | |
1842 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
1843 | /* Enable unsolicited event for HP jack */ | |
1844 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1845 | /* Connect Internal Front to Front */ | |
1846 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1847 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1848 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1849 | /* Connect Internal Rear to Rear */ | |
1850 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1851 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1852 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1853 | /* Connect Internal CLFE to CLFE */ | |
1854 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1855 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1856 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
1857 | /* Connect HP out to Front */ | |
1858 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | |
1859 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1860 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1861 | /* Enable all DACs */ | |
1862 | /* DAC DISABLE/MUTE 1? */ | |
1863 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ | |
1864 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, | |
1865 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | |
1866 | /* DAC DISABLE/MUTE 2? */ | |
1867 | /* some bit here disables the other DACs. Init=0x4900 */ | |
1868 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | |
1869 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | |
1870 | /* DMIC fix | |
1871 | * This laptop has a stereo digital microphone. The mics are only 1cm apart | |
1872 | * which makes the stereo useless. However, either the mic or the ALC889 | |
1873 | * makes the signal become a difference/sum signal instead of standard | |
1874 | * stereo, which is annoying. So instead we flip this bit which makes the | |
1875 | * codec replicate the sum signal to both channels, turning it into a | |
1876 | * normal mono mic. | |
1877 | */ | |
1878 | /* DMIC_CONTROL? Init value = 0x0001 */ | |
1879 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
1880 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, | |
1881 | { } | |
1882 | }; | |
1883 | ||
1884 | static struct hda_input_mux alc888_2_capture_sources[2] = { | |
1885 | /* Front mic only available on one ADC */ | |
1886 | { | |
1887 | .num_items = 4, | |
1888 | .items = { | |
1889 | { "Mic", 0x0 }, | |
1890 | { "Line", 0x2 }, | |
1891 | { "CD", 0x4 }, | |
1892 | { "Front Mic", 0xb }, | |
1893 | }, | |
1894 | }, | |
1895 | { | |
1896 | .num_items = 3, | |
1897 | .items = { | |
1898 | { "Mic", 0x0 }, | |
1899 | { "Line", 0x2 }, | |
1900 | { "CD", 0x4 }, | |
1901 | }, | |
1902 | } | |
1903 | }; | |
1904 | ||
1905 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { | |
1906 | /* Interal mic only available on one ADC */ | |
1907 | { | |
1908 | .num_items = 5, | |
1909 | .items = { | |
1910 | { "Ext Mic", 0x0 }, | |
1911 | { "Line In", 0x2 }, | |
1912 | { "CD", 0x4 }, | |
1913 | { "Input Mix", 0xa }, | |
1914 | { "Int Mic", 0xb }, | |
1915 | }, | |
1916 | }, | |
1917 | { | |
1918 | .num_items = 4, | |
1919 | .items = { | |
1920 | { "Ext Mic", 0x0 }, | |
1921 | { "Line In", 0x2 }, | |
1922 | { "CD", 0x4 }, | |
1923 | { "Input Mix", 0xa }, | |
1924 | }, | |
1925 | } | |
1926 | }; | |
1927 | ||
1928 | static struct hda_input_mux alc889_capture_sources[3] = { | |
1929 | /* Digital mic only available on first "ADC" */ | |
1930 | { | |
1931 | .num_items = 5, | |
1932 | .items = { | |
1933 | { "Mic", 0x0 }, | |
1934 | { "Line", 0x2 }, | |
1935 | { "CD", 0x4 }, | |
1936 | { "Front Mic", 0xb }, | |
1937 | { "Input Mix", 0xa }, | |
1938 | }, | |
1939 | }, | |
1940 | { | |
1941 | .num_items = 4, | |
1942 | .items = { | |
1943 | { "Mic", 0x0 }, | |
1944 | { "Line", 0x2 }, | |
1945 | { "CD", 0x4 }, | |
1946 | { "Input Mix", 0xa }, | |
1947 | }, | |
1948 | }, | |
1949 | { | |
1950 | .num_items = 4, | |
1951 | .items = { | |
1952 | { "Mic", 0x0 }, | |
1953 | { "Line", 0x2 }, | |
1954 | { "CD", 0x4 }, | |
1955 | { "Input Mix", 0xa }, | |
1956 | }, | |
1957 | } | |
1958 | }; | |
1959 | ||
1960 | static struct snd_kcontrol_new alc888_base_mixer[] = { | |
1961 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1962 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
1963 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1964 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
1965 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
1966 | HDA_OUTPUT), | |
1967 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
1968 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
1969 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1970 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
1971 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
1972 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
1973 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1974 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1975 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1976 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1977 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
1978 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1979 | { } /* end */ | |
1980 | }; | |
1981 | ||
1982 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { | |
1983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1984 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
1985 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1986 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
1987 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
1988 | HDA_OUTPUT), | |
1989 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
1990 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
1991 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1992 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1993 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1994 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1995 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
1996 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1997 | { } /* end */ | |
1998 | }; | |
1999 | ||
2000 | ||
2001 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) | |
2002 | { | |
2003 | struct alc_spec *spec = codec->spec; | |
2004 | ||
2005 | spec->autocfg.hp_pins[0] = 0x15; | |
2006 | spec->autocfg.speaker_pins[0] = 0x14; | |
2007 | spec->autocfg.speaker_pins[1] = 0x16; | |
2008 | spec->autocfg.speaker_pins[2] = 0x17; | |
2009 | } | |
2010 | ||
2011 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) | |
2012 | { | |
2013 | struct alc_spec *spec = codec->spec; | |
2014 | ||
2015 | spec->autocfg.hp_pins[0] = 0x15; | |
2016 | spec->autocfg.speaker_pins[0] = 0x14; | |
2017 | spec->autocfg.speaker_pins[1] = 0x16; | |
2018 | spec->autocfg.speaker_pins[2] = 0x17; | |
2019 | } | |
2020 | ||
2021 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) | |
2022 | { | |
2023 | struct alc_spec *spec = codec->spec; | |
2024 | ||
2025 | spec->autocfg.hp_pins[0] = 0x15; | |
2026 | spec->autocfg.speaker_pins[0] = 0x14; | |
2027 | spec->autocfg.speaker_pins[1] = 0x16; | |
2028 | spec->autocfg.speaker_pins[2] = 0x1b; | |
2029 | } | |
2030 | ||
2031 | /* | |
2032 | * ALC880 3-stack model | |
2033 | * | |
2034 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) | |
2035 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, | |
2036 | * F-Mic = 0x1b, HP = 0x19 | |
2037 | */ | |
2038 | ||
2039 | static hda_nid_t alc880_dac_nids[4] = { | |
2040 | /* front, rear, clfe, rear_surr */ | |
2041 | 0x02, 0x05, 0x04, 0x03 | |
2042 | }; | |
2043 | ||
2044 | static hda_nid_t alc880_adc_nids[3] = { | |
2045 | /* ADC0-2 */ | |
2046 | 0x07, 0x08, 0x09, | |
2047 | }; | |
2048 | ||
2049 | /* The datasheet says the node 0x07 is connected from inputs, | |
2050 | * but it shows zero connection in the real implementation on some devices. | |
2051 | * Note: this is a 915GAV bug, fixed on 915GLV | |
2052 | */ | |
2053 | static hda_nid_t alc880_adc_nids_alt[2] = { | |
2054 | /* ADC1-2 */ | |
2055 | 0x08, 0x09, | |
2056 | }; | |
2057 | ||
2058 | #define ALC880_DIGOUT_NID 0x06 | |
2059 | #define ALC880_DIGIN_NID 0x0a | |
2060 | ||
2061 | static struct hda_input_mux alc880_capture_source = { | |
2062 | .num_items = 4, | |
2063 | .items = { | |
2064 | { "Mic", 0x0 }, | |
2065 | { "Front Mic", 0x3 }, | |
2066 | { "Line", 0x2 }, | |
2067 | { "CD", 0x4 }, | |
2068 | }, | |
2069 | }; | |
2070 | ||
2071 | /* channel source setting (2/6 channel selection for 3-stack) */ | |
2072 | /* 2ch mode */ | |
2073 | static struct hda_verb alc880_threestack_ch2_init[] = { | |
2074 | /* set line-in to input, mute it */ | |
2075 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2076 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2077 | /* set mic-in to input vref 80%, mute it */ | |
2078 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
2079 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2080 | { } /* end */ | |
2081 | }; | |
2082 | ||
2083 | /* 6ch mode */ | |
2084 | static struct hda_verb alc880_threestack_ch6_init[] = { | |
2085 | /* set line-in to output, unmute it */ | |
2086 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2087 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2088 | /* set mic-in to output, unmute it */ | |
2089 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2090 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2091 | { } /* end */ | |
2092 | }; | |
2093 | ||
2094 | static struct hda_channel_mode alc880_threestack_modes[2] = { | |
2095 | { 2, alc880_threestack_ch2_init }, | |
2096 | { 6, alc880_threestack_ch6_init }, | |
2097 | }; | |
2098 | ||
2099 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { | |
2100 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2101 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2102 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
2103 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | |
2104 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2105 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2106 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2107 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2108 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2109 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2110 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2111 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2112 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2113 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2114 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
2115 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
2116 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), | |
2117 | { | |
2118 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2119 | .name = "Channel Mode", | |
2120 | .info = alc_ch_mode_info, | |
2121 | .get = alc_ch_mode_get, | |
2122 | .put = alc_ch_mode_put, | |
2123 | }, | |
2124 | { } /* end */ | |
2125 | }; | |
2126 | ||
2127 | /* capture mixer elements */ | |
2128 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, | |
2129 | struct snd_ctl_elem_info *uinfo) | |
2130 | { | |
2131 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2132 | struct alc_spec *spec = codec->spec; | |
2133 | int err; | |
2134 | ||
2135 | mutex_lock(&codec->control_mutex); | |
2136 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, | |
2137 | HDA_INPUT); | |
2138 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); | |
2139 | mutex_unlock(&codec->control_mutex); | |
2140 | return err; | |
2141 | } | |
2142 | ||
2143 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |
2144 | unsigned int size, unsigned int __user *tlv) | |
2145 | { | |
2146 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2147 | struct alc_spec *spec = codec->spec; | |
2148 | int err; | |
2149 | ||
2150 | mutex_lock(&codec->control_mutex); | |
2151 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, | |
2152 | HDA_INPUT); | |
2153 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); | |
2154 | mutex_unlock(&codec->control_mutex); | |
2155 | return err; | |
2156 | } | |
2157 | ||
2158 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, | |
2159 | struct snd_ctl_elem_value *ucontrol); | |
2160 | ||
2161 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, | |
2162 | struct snd_ctl_elem_value *ucontrol, | |
2163 | getput_call_t func) | |
2164 | { | |
2165 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2166 | struct alc_spec *spec = codec->spec; | |
2167 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
2168 | int err; | |
2169 | ||
2170 | mutex_lock(&codec->control_mutex); | |
2171 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], | |
2172 | 3, 0, HDA_INPUT); | |
2173 | err = func(kcontrol, ucontrol); | |
2174 | mutex_unlock(&codec->control_mutex); | |
2175 | return err; | |
2176 | } | |
2177 | ||
2178 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, | |
2179 | struct snd_ctl_elem_value *ucontrol) | |
2180 | { | |
2181 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2182 | snd_hda_mixer_amp_volume_get); | |
2183 | } | |
2184 | ||
2185 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, | |
2186 | struct snd_ctl_elem_value *ucontrol) | |
2187 | { | |
2188 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2189 | snd_hda_mixer_amp_volume_put); | |
2190 | } | |
2191 | ||
2192 | /* capture mixer elements */ | |
2193 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info | |
2194 | ||
2195 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, | |
2196 | struct snd_ctl_elem_value *ucontrol) | |
2197 | { | |
2198 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2199 | snd_hda_mixer_amp_switch_get); | |
2200 | } | |
2201 | ||
2202 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, | |
2203 | struct snd_ctl_elem_value *ucontrol) | |
2204 | { | |
2205 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2206 | snd_hda_mixer_amp_switch_put); | |
2207 | } | |
2208 | ||
2209 | #define _DEFINE_CAPMIX(num) \ | |
2210 | { \ | |
2211 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2212 | .name = "Capture Switch", \ | |
2213 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | |
2214 | .count = num, \ | |
2215 | .info = alc_cap_sw_info, \ | |
2216 | .get = alc_cap_sw_get, \ | |
2217 | .put = alc_cap_sw_put, \ | |
2218 | }, \ | |
2219 | { \ | |
2220 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2221 | .name = "Capture Volume", \ | |
2222 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | |
2223 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | |
2224 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ | |
2225 | .count = num, \ | |
2226 | .info = alc_cap_vol_info, \ | |
2227 | .get = alc_cap_vol_get, \ | |
2228 | .put = alc_cap_vol_put, \ | |
2229 | .tlv = { .c = alc_cap_vol_tlv }, \ | |
2230 | } | |
2231 | ||
2232 | #define _DEFINE_CAPSRC(num) \ | |
2233 | { \ | |
2234 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2235 | /* .name = "Capture Source", */ \ | |
2236 | .name = "Input Source", \ | |
2237 | .count = num, \ | |
2238 | .info = alc_mux_enum_info, \ | |
2239 | .get = alc_mux_enum_get, \ | |
2240 | .put = alc_mux_enum_put, \ | |
2241 | } | |
2242 | ||
2243 | #define DEFINE_CAPMIX(num) \ | |
2244 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | |
2245 | _DEFINE_CAPMIX(num), \ | |
2246 | _DEFINE_CAPSRC(num), \ | |
2247 | { } /* end */ \ | |
2248 | } | |
2249 | ||
2250 | #define DEFINE_CAPMIX_NOSRC(num) \ | |
2251 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ | |
2252 | _DEFINE_CAPMIX(num), \ | |
2253 | { } /* end */ \ | |
2254 | } | |
2255 | ||
2256 | /* up to three ADCs */ | |
2257 | DEFINE_CAPMIX(1); | |
2258 | DEFINE_CAPMIX(2); | |
2259 | DEFINE_CAPMIX(3); | |
2260 | DEFINE_CAPMIX_NOSRC(1); | |
2261 | DEFINE_CAPMIX_NOSRC(2); | |
2262 | DEFINE_CAPMIX_NOSRC(3); | |
2263 | ||
2264 | /* | |
2265 | * ALC880 5-stack model | |
2266 | * | |
2267 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), | |
2268 | * Side = 0x02 (0xd) | |
2269 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 | |
2270 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 | |
2271 | */ | |
2272 | ||
2273 | /* additional mixers to alc880_three_stack_mixer */ | |
2274 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { | |
2275 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2276 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), | |
2277 | { } /* end */ | |
2278 | }; | |
2279 | ||
2280 | /* channel source setting (6/8 channel selection for 5-stack) */ | |
2281 | /* 6ch mode */ | |
2282 | static struct hda_verb alc880_fivestack_ch6_init[] = { | |
2283 | /* set line-in to input, mute it */ | |
2284 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2285 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2286 | { } /* end */ | |
2287 | }; | |
2288 | ||
2289 | /* 8ch mode */ | |
2290 | static struct hda_verb alc880_fivestack_ch8_init[] = { | |
2291 | /* set line-in to output, unmute it */ | |
2292 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2293 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2294 | { } /* end */ | |
2295 | }; | |
2296 | ||
2297 | static struct hda_channel_mode alc880_fivestack_modes[2] = { | |
2298 | { 6, alc880_fivestack_ch6_init }, | |
2299 | { 8, alc880_fivestack_ch8_init }, | |
2300 | }; | |
2301 | ||
2302 | ||
2303 | /* | |
2304 | * ALC880 6-stack model | |
2305 | * | |
2306 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), | |
2307 | * Side = 0x05 (0x0f) | |
2308 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, | |
2309 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b | |
2310 | */ | |
2311 | ||
2312 | static hda_nid_t alc880_6st_dac_nids[4] = { | |
2313 | /* front, rear, clfe, rear_surr */ | |
2314 | 0x02, 0x03, 0x04, 0x05 | |
2315 | }; | |
2316 | ||
2317 | static struct hda_input_mux alc880_6stack_capture_source = { | |
2318 | .num_items = 4, | |
2319 | .items = { | |
2320 | { "Mic", 0x0 }, | |
2321 | { "Front Mic", 0x1 }, | |
2322 | { "Line", 0x2 }, | |
2323 | { "CD", 0x4 }, | |
2324 | }, | |
2325 | }; | |
2326 | ||
2327 | /* fixed 8-channels */ | |
2328 | static struct hda_channel_mode alc880_sixstack_modes[1] = { | |
2329 | { 8, NULL }, | |
2330 | }; | |
2331 | ||
2332 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { | |
2333 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2334 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2335 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2336 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2337 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2338 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2339 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2340 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2341 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
2342 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2343 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2344 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2345 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2346 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2347 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2348 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2349 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2350 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2351 | { | |
2352 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2353 | .name = "Channel Mode", | |
2354 | .info = alc_ch_mode_info, | |
2355 | .get = alc_ch_mode_get, | |
2356 | .put = alc_ch_mode_put, | |
2357 | }, | |
2358 | { } /* end */ | |
2359 | }; | |
2360 | ||
2361 | ||
2362 | /* | |
2363 | * ALC880 W810 model | |
2364 | * | |
2365 | * W810 has rear IO for: | |
2366 | * Front (DAC 02) | |
2367 | * Surround (DAC 03) | |
2368 | * Center/LFE (DAC 04) | |
2369 | * Digital out (06) | |
2370 | * | |
2371 | * The system also has a pair of internal speakers, and a headphone jack. | |
2372 | * These are both connected to Line2 on the codec, hence to DAC 02. | |
2373 | * | |
2374 | * There is a variable resistor to control the speaker or headphone | |
2375 | * volume. This is a hardware-only device without a software API. | |
2376 | * | |
2377 | * Plugging headphones in will disable the internal speakers. This is | |
2378 | * implemented in hardware, not via the driver using jack sense. In | |
2379 | * a similar fashion, plugging into the rear socket marked "front" will | |
2380 | * disable both the speakers and headphones. | |
2381 | * | |
2382 | * For input, there's a microphone jack, and an "audio in" jack. | |
2383 | * These may not do anything useful with this driver yet, because I | |
2384 | * haven't setup any initialization verbs for these yet... | |
2385 | */ | |
2386 | ||
2387 | static hda_nid_t alc880_w810_dac_nids[3] = { | |
2388 | /* front, rear/surround, clfe */ | |
2389 | 0x02, 0x03, 0x04 | |
2390 | }; | |
2391 | ||
2392 | /* fixed 6 channels */ | |
2393 | static struct hda_channel_mode alc880_w810_modes[1] = { | |
2394 | { 6, NULL } | |
2395 | }; | |
2396 | ||
2397 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ | |
2398 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { | |
2399 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2400 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2401 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2402 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2403 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2404 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2405 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2406 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2407 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
2408 | { } /* end */ | |
2409 | }; | |
2410 | ||
2411 | ||
2412 | /* | |
2413 | * Z710V model | |
2414 | * | |
2415 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) | |
2416 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), | |
2417 | * Line = 0x1a | |
2418 | */ | |
2419 | ||
2420 | static hda_nid_t alc880_z71v_dac_nids[1] = { | |
2421 | 0x02 | |
2422 | }; | |
2423 | #define ALC880_Z71V_HP_DAC 0x03 | |
2424 | ||
2425 | /* fixed 2 channels */ | |
2426 | static struct hda_channel_mode alc880_2_jack_modes[1] = { | |
2427 | { 2, NULL } | |
2428 | }; | |
2429 | ||
2430 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { | |
2431 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2432 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2433 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2434 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
2435 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2436 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2437 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2438 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2439 | { } /* end */ | |
2440 | }; | |
2441 | ||
2442 | ||
2443 | /* | |
2444 | * ALC880 F1734 model | |
2445 | * | |
2446 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) | |
2447 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 | |
2448 | */ | |
2449 | ||
2450 | static hda_nid_t alc880_f1734_dac_nids[1] = { | |
2451 | 0x03 | |
2452 | }; | |
2453 | #define ALC880_F1734_HP_DAC 0x02 | |
2454 | ||
2455 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { | |
2456 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2457 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2458 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2459 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2460 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2461 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2462 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2463 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2464 | { } /* end */ | |
2465 | }; | |
2466 | ||
2467 | static struct hda_input_mux alc880_f1734_capture_source = { | |
2468 | .num_items = 2, | |
2469 | .items = { | |
2470 | { "Mic", 0x1 }, | |
2471 | { "CD", 0x4 }, | |
2472 | }, | |
2473 | }; | |
2474 | ||
2475 | ||
2476 | /* | |
2477 | * ALC880 ASUS model | |
2478 | * | |
2479 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
2480 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
2481 | * Mic = 0x18, Line = 0x1a | |
2482 | */ | |
2483 | ||
2484 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ | |
2485 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ | |
2486 | ||
2487 | static struct snd_kcontrol_new alc880_asus_mixer[] = { | |
2488 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2489 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2490 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2491 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2492 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2493 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2494 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2495 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2496 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2497 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2498 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2499 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2500 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2501 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2502 | { | |
2503 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2504 | .name = "Channel Mode", | |
2505 | .info = alc_ch_mode_info, | |
2506 | .get = alc_ch_mode_get, | |
2507 | .put = alc_ch_mode_put, | |
2508 | }, | |
2509 | { } /* end */ | |
2510 | }; | |
2511 | ||
2512 | /* | |
2513 | * ALC880 ASUS W1V model | |
2514 | * | |
2515 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
2516 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
2517 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b | |
2518 | */ | |
2519 | ||
2520 | /* additional mixers to alc880_asus_mixer */ | |
2521 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { | |
2522 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
2523 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
2524 | { } /* end */ | |
2525 | }; | |
2526 | ||
2527 | /* TCL S700 */ | |
2528 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { | |
2529 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2530 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
2531 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
2532 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), | |
2533 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), | |
2534 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), | |
2535 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), | |
2536 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
2537 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
2538 | { } /* end */ | |
2539 | }; | |
2540 | ||
2541 | /* Uniwill */ | |
2542 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { | |
2543 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2544 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2545 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2546 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2547 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2548 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2549 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2550 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2551 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2552 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2553 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2554 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2555 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2556 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2557 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2558 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2559 | { | |
2560 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2561 | .name = "Channel Mode", | |
2562 | .info = alc_ch_mode_info, | |
2563 | .get = alc_ch_mode_get, | |
2564 | .put = alc_ch_mode_put, | |
2565 | }, | |
2566 | { } /* end */ | |
2567 | }; | |
2568 | ||
2569 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { | |
2570 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2571 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2572 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2573 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2574 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2575 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2576 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2577 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2578 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2579 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2580 | { } /* end */ | |
2581 | }; | |
2582 | ||
2583 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { | |
2584 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2585 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2586 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2587 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2588 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2589 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2590 | { } /* end */ | |
2591 | }; | |
2592 | ||
2593 | /* | |
2594 | * virtual master controls | |
2595 | */ | |
2596 | ||
2597 | /* | |
2598 | * slave controls for virtual master | |
2599 | */ | |
2600 | static const char *alc_slave_vols[] = { | |
2601 | "Front Playback Volume", | |
2602 | "Surround Playback Volume", | |
2603 | "Center Playback Volume", | |
2604 | "LFE Playback Volume", | |
2605 | "Side Playback Volume", | |
2606 | "Headphone Playback Volume", | |
2607 | "Speaker Playback Volume", | |
2608 | "Mono Playback Volume", | |
2609 | "Line-Out Playback Volume", | |
2610 | "PCM Playback Volume", | |
2611 | NULL, | |
2612 | }; | |
2613 | ||
2614 | static const char *alc_slave_sws[] = { | |
2615 | "Front Playback Switch", | |
2616 | "Surround Playback Switch", | |
2617 | "Center Playback Switch", | |
2618 | "LFE Playback Switch", | |
2619 | "Side Playback Switch", | |
2620 | "Headphone Playback Switch", | |
2621 | "Speaker Playback Switch", | |
2622 | "Mono Playback Switch", | |
2623 | "IEC958 Playback Switch", | |
2624 | "Line-Out Playback Switch", | |
2625 | "PCM Playback Switch", | |
2626 | NULL, | |
2627 | }; | |
2628 | ||
2629 | /* | |
2630 | * build control elements | |
2631 | */ | |
2632 | ||
2633 | #define NID_MAPPING (-1) | |
2634 | ||
2635 | #define SUBDEV_SPEAKER_ (0 << 6) | |
2636 | #define SUBDEV_HP_ (1 << 6) | |
2637 | #define SUBDEV_LINE_ (2 << 6) | |
2638 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) | |
2639 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) | |
2640 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) | |
2641 | ||
2642 | static void alc_free_kctls(struct hda_codec *codec); | |
2643 | ||
2644 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | |
2645 | /* additional beep mixers; the actual parameters are overwritten at build */ | |
2646 | static struct snd_kcontrol_new alc_beep_mixer[] = { | |
2647 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), | |
2648 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), | |
2649 | { } /* end */ | |
2650 | }; | |
2651 | #endif | |
2652 | ||
2653 | static int alc_build_controls(struct hda_codec *codec) | |
2654 | { | |
2655 | struct alc_spec *spec = codec->spec; | |
2656 | struct snd_kcontrol *kctl = NULL; | |
2657 | struct snd_kcontrol_new *knew; | |
2658 | int i, j, err; | |
2659 | unsigned int u; | |
2660 | hda_nid_t nid; | |
2661 | ||
2662 | for (i = 0; i < spec->num_mixers; i++) { | |
2663 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | |
2664 | if (err < 0) | |
2665 | return err; | |
2666 | } | |
2667 | if (spec->cap_mixer) { | |
2668 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); | |
2669 | if (err < 0) | |
2670 | return err; | |
2671 | } | |
2672 | if (spec->multiout.dig_out_nid) { | |
2673 | err = snd_hda_create_spdif_out_ctls(codec, | |
2674 | spec->multiout.dig_out_nid); | |
2675 | if (err < 0) | |
2676 | return err; | |
2677 | if (!spec->no_analog) { | |
2678 | err = snd_hda_create_spdif_share_sw(codec, | |
2679 | &spec->multiout); | |
2680 | if (err < 0) | |
2681 | return err; | |
2682 | spec->multiout.share_spdif = 1; | |
2683 | } | |
2684 | } | |
2685 | if (spec->dig_in_nid) { | |
2686 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | |
2687 | if (err < 0) | |
2688 | return err; | |
2689 | } | |
2690 | ||
2691 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | |
2692 | /* create beep controls if needed */ | |
2693 | if (spec->beep_amp) { | |
2694 | struct snd_kcontrol_new *knew; | |
2695 | for (knew = alc_beep_mixer; knew->name; knew++) { | |
2696 | struct snd_kcontrol *kctl; | |
2697 | kctl = snd_ctl_new1(knew, codec); | |
2698 | if (!kctl) | |
2699 | return -ENOMEM; | |
2700 | kctl->private_value = spec->beep_amp; | |
2701 | err = snd_hda_ctl_add(codec, 0, kctl); | |
2702 | if (err < 0) | |
2703 | return err; | |
2704 | } | |
2705 | } | |
2706 | #endif | |
2707 | ||
2708 | /* if we have no master control, let's create it */ | |
2709 | if (!spec->no_analog && | |
2710 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | |
2711 | unsigned int vmaster_tlv[4]; | |
2712 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, | |
2713 | HDA_OUTPUT, vmaster_tlv); | |
2714 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", | |
2715 | vmaster_tlv, alc_slave_vols); | |
2716 | if (err < 0) | |
2717 | return err; | |
2718 | } | |
2719 | if (!spec->no_analog && | |
2720 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | |
2721 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", | |
2722 | NULL, alc_slave_sws); | |
2723 | if (err < 0) | |
2724 | return err; | |
2725 | } | |
2726 | ||
2727 | /* assign Capture Source enums to NID */ | |
2728 | if (spec->capsrc_nids || spec->adc_nids) { | |
2729 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); | |
2730 | if (!kctl) | |
2731 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | |
2732 | for (i = 0; kctl && i < kctl->count; i++) { | |
2733 | hda_nid_t *nids = spec->capsrc_nids; | |
2734 | if (!nids) | |
2735 | nids = spec->adc_nids; | |
2736 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); | |
2737 | if (err < 0) | |
2738 | return err; | |
2739 | } | |
2740 | } | |
2741 | if (spec->cap_mixer) { | |
2742 | const char *kname = kctl ? kctl->id.name : NULL; | |
2743 | for (knew = spec->cap_mixer; knew->name; knew++) { | |
2744 | if (kname && strcmp(knew->name, kname) == 0) | |
2745 | continue; | |
2746 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); | |
2747 | for (i = 0; kctl && i < kctl->count; i++) { | |
2748 | err = snd_hda_add_nid(codec, kctl, i, | |
2749 | spec->adc_nids[i]); | |
2750 | if (err < 0) | |
2751 | return err; | |
2752 | } | |
2753 | } | |
2754 | } | |
2755 | ||
2756 | /* other nid->control mapping */ | |
2757 | for (i = 0; i < spec->num_mixers; i++) { | |
2758 | for (knew = spec->mixers[i]; knew->name; knew++) { | |
2759 | if (knew->iface != NID_MAPPING) | |
2760 | continue; | |
2761 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); | |
2762 | if (kctl == NULL) | |
2763 | continue; | |
2764 | u = knew->subdevice; | |
2765 | for (j = 0; j < 4; j++, u >>= 8) { | |
2766 | nid = u & 0x3f; | |
2767 | if (nid == 0) | |
2768 | continue; | |
2769 | switch (u & 0xc0) { | |
2770 | case SUBDEV_SPEAKER_: | |
2771 | nid = spec->autocfg.speaker_pins[nid]; | |
2772 | break; | |
2773 | case SUBDEV_LINE_: | |
2774 | nid = spec->autocfg.line_out_pins[nid]; | |
2775 | break; | |
2776 | case SUBDEV_HP_: | |
2777 | nid = spec->autocfg.hp_pins[nid]; | |
2778 | break; | |
2779 | default: | |
2780 | continue; | |
2781 | } | |
2782 | err = snd_hda_add_nid(codec, kctl, 0, nid); | |
2783 | if (err < 0) | |
2784 | return err; | |
2785 | } | |
2786 | u = knew->private_value; | |
2787 | for (j = 0; j < 4; j++, u >>= 8) { | |
2788 | nid = u & 0xff; | |
2789 | if (nid == 0) | |
2790 | continue; | |
2791 | err = snd_hda_add_nid(codec, kctl, 0, nid); | |
2792 | if (err < 0) | |
2793 | return err; | |
2794 | } | |
2795 | } | |
2796 | } | |
2797 | ||
2798 | alc_free_kctls(codec); /* no longer needed */ | |
2799 | ||
2800 | return 0; | |
2801 | } | |
2802 | ||
2803 | ||
2804 | /* | |
2805 | * initialize the codec volumes, etc | |
2806 | */ | |
2807 | ||
2808 | /* | |
2809 | * generic initialization of ADC, input mixers and output mixers | |
2810 | */ | |
2811 | static struct hda_verb alc880_volume_init_verbs[] = { | |
2812 | /* | |
2813 | * Unmute ADC0-2 and set the default input to mic-in | |
2814 | */ | |
2815 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2816 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2817 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2818 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2819 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2820 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2821 | ||
2822 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
2823 | * mixer widget | |
2824 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
2825 | * panel mic (mic 2) | |
2826 | */ | |
2827 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
2828 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
2829 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2830 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
2831 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
2832 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
2833 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
2834 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
2835 | ||
2836 | /* | |
2837 | * Set up output mixers (0x0c - 0x0f) | |
2838 | */ | |
2839 | /* set vol=0 to output mixers */ | |
2840 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2841 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2842 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2843 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2844 | /* set up input amps for analog loopback */ | |
2845 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
2846 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
2847 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2848 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
2849 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2850 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
2851 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2852 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
2853 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2854 | ||
2855 | { } | |
2856 | }; | |
2857 | ||
2858 | /* | |
2859 | * 3-stack pin configuration: | |
2860 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
2861 | */ | |
2862 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { | |
2863 | /* | |
2864 | * preset connection lists of input pins | |
2865 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
2866 | */ | |
2867 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
2868 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2869 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
2870 | ||
2871 | /* | |
2872 | * Set pin mode and muting | |
2873 | */ | |
2874 | /* set front pin widgets 0x14 for output */ | |
2875 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2876 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2877 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
2878 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2879 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2880 | /* Mic2 (as headphone out) for HP output */ | |
2881 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2882 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2883 | /* Line In pin widget for input */ | |
2884 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2885 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2886 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
2887 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2888 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2889 | /* CD pin widget for input */ | |
2890 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2891 | ||
2892 | { } | |
2893 | }; | |
2894 | ||
2895 | /* | |
2896 | * 5-stack pin configuration: | |
2897 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, | |
2898 | * line-in/side = 0x1a, f-mic = 0x1b | |
2899 | */ | |
2900 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { | |
2901 | /* | |
2902 | * preset connection lists of input pins | |
2903 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
2904 | */ | |
2905 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2906 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ | |
2907 | ||
2908 | /* | |
2909 | * Set pin mode and muting | |
2910 | */ | |
2911 | /* set pin widgets 0x14-0x17 for output */ | |
2912 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2913 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2914 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2915 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2916 | /* unmute pins for output (no gain on this amp) */ | |
2917 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2918 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2919 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2920 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2921 | ||
2922 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
2923 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2924 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2925 | /* Mic2 (as headphone out) for HP output */ | |
2926 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2927 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2928 | /* Line In pin widget for input */ | |
2929 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2930 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2931 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
2932 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2933 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2934 | /* CD pin widget for input */ | |
2935 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2936 | ||
2937 | { } | |
2938 | }; | |
2939 | ||
2940 | /* | |
2941 | * W810 pin configuration: | |
2942 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b | |
2943 | */ | |
2944 | static struct hda_verb alc880_pin_w810_init_verbs[] = { | |
2945 | /* hphone/speaker input selector: front DAC */ | |
2946 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, | |
2947 | ||
2948 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2949 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2950 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2951 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2952 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2953 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2954 | ||
2955 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2956 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2957 | ||
2958 | { } | |
2959 | }; | |
2960 | ||
2961 | /* | |
2962 | * Z71V pin configuration: | |
2963 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) | |
2964 | */ | |
2965 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { | |
2966 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2967 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2968 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2969 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2970 | ||
2971 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2972 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2973 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2974 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2975 | ||
2976 | { } | |
2977 | }; | |
2978 | ||
2979 | /* | |
2980 | * 6-stack pin configuration: | |
2981 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, | |
2982 | * f-mic = 0x19, line = 0x1a, HP = 0x1b | |
2983 | */ | |
2984 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { | |
2985 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2986 | ||
2987 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2988 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2989 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2990 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2991 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2992 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2993 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2994 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2995 | ||
2996 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2997 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2998 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2999 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3000 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3001 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3002 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3003 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3004 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3005 | ||
3006 | { } | |
3007 | }; | |
3008 | ||
3009 | /* | |
3010 | * Uniwill pin configuration: | |
3011 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, | |
3012 | * line = 0x1a | |
3013 | */ | |
3014 | static struct hda_verb alc880_uniwill_init_verbs[] = { | |
3015 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3016 | ||
3017 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3018 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3019 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3020 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3021 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3022 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3023 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3024 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3025 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3027 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3028 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3029 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3030 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3031 | ||
3032 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3033 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3034 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3035 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3036 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3037 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3038 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ | |
3039 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
3040 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3041 | ||
3042 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3043 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
3044 | ||
3045 | { } | |
3046 | }; | |
3047 | ||
3048 | /* | |
3049 | * Uniwill P53 | |
3050 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, | |
3051 | */ | |
3052 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | |
3053 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3054 | ||
3055 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3056 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3057 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3058 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3059 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3060 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3061 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3062 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3063 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3064 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3065 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3066 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3067 | ||
3068 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3069 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3070 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3071 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3072 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3073 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3074 | ||
3075 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3076 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, | |
3077 | ||
3078 | { } | |
3079 | }; | |
3080 | ||
3081 | static struct hda_verb alc880_beep_init_verbs[] = { | |
3082 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, | |
3083 | { } | |
3084 | }; | |
3085 | ||
3086 | /* auto-toggle front mic */ | |
3087 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) | |
3088 | { | |
3089 | unsigned int present; | |
3090 | unsigned char bits; | |
3091 | ||
3092 | present = snd_hda_jack_detect(codec, 0x18); | |
3093 | bits = present ? HDA_AMP_MUTE : 0; | |
3094 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
3095 | } | |
3096 | ||
3097 | static void alc880_uniwill_setup(struct hda_codec *codec) | |
3098 | { | |
3099 | struct alc_spec *spec = codec->spec; | |
3100 | ||
3101 | spec->autocfg.hp_pins[0] = 0x14; | |
3102 | spec->autocfg.speaker_pins[0] = 0x15; | |
3103 | spec->autocfg.speaker_pins[0] = 0x16; | |
3104 | } | |
3105 | ||
3106 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | |
3107 | { | |
3108 | alc_automute_amp(codec); | |
3109 | alc880_uniwill_mic_automute(codec); | |
3110 | } | |
3111 | ||
3112 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |
3113 | unsigned int res) | |
3114 | { | |
3115 | /* Looks like the unsol event is incompatible with the standard | |
3116 | * definition. 4bit tag is placed at 28 bit! | |
3117 | */ | |
3118 | switch (res >> 28) { | |
3119 | case ALC880_MIC_EVENT: | |
3120 | alc880_uniwill_mic_automute(codec); | |
3121 | break; | |
3122 | default: | |
3123 | alc_automute_amp_unsol_event(codec, res); | |
3124 | break; | |
3125 | } | |
3126 | } | |
3127 | ||
3128 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) | |
3129 | { | |
3130 | struct alc_spec *spec = codec->spec; | |
3131 | ||
3132 | spec->autocfg.hp_pins[0] = 0x14; | |
3133 | spec->autocfg.speaker_pins[0] = 0x15; | |
3134 | } | |
3135 | ||
3136 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | |
3137 | { | |
3138 | unsigned int present; | |
3139 | ||
3140 | present = snd_hda_codec_read(codec, 0x21, 0, | |
3141 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); | |
3142 | present &= HDA_AMP_VOLMASK; | |
3143 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, | |
3144 | HDA_AMP_VOLMASK, present); | |
3145 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, | |
3146 | HDA_AMP_VOLMASK, present); | |
3147 | } | |
3148 | ||
3149 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, | |
3150 | unsigned int res) | |
3151 | { | |
3152 | /* Looks like the unsol event is incompatible with the standard | |
3153 | * definition. 4bit tag is placed at 28 bit! | |
3154 | */ | |
3155 | if ((res >> 28) == ALC880_DCVOL_EVENT) | |
3156 | alc880_uniwill_p53_dcvol_automute(codec); | |
3157 | else | |
3158 | alc_automute_amp_unsol_event(codec, res); | |
3159 | } | |
3160 | ||
3161 | /* | |
3162 | * F1734 pin configuration: | |
3163 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 | |
3164 | */ | |
3165 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { | |
3166 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3167 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
3168 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3169 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3170 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3171 | ||
3172 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3173 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3174 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3175 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3176 | ||
3177 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3178 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3179 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
3180 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3181 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3182 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3183 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3184 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3185 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3186 | ||
3187 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
3188 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, | |
3189 | ||
3190 | { } | |
3191 | }; | |
3192 | ||
3193 | /* | |
3194 | * ASUS pin configuration: | |
3195 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a | |
3196 | */ | |
3197 | static struct hda_verb alc880_pin_asus_init_verbs[] = { | |
3198 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
3199 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3200 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3201 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3202 | ||
3203 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3204 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3205 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3206 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3207 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3208 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3209 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3210 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3211 | ||
3212 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3213 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3214 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3215 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3216 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3217 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3218 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3219 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3220 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3221 | ||
3222 | { } | |
3223 | }; | |
3224 | ||
3225 | /* Enable GPIO mask and set output */ | |
3226 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs | |
3227 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs | |
3228 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs | |
3229 | ||
3230 | /* Clevo m520g init */ | |
3231 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { | |
3232 | /* headphone output */ | |
3233 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3234 | /* line-out */ | |
3235 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3236 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3237 | /* Line-in */ | |
3238 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3239 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3240 | /* CD */ | |
3241 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3242 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3243 | /* Mic1 (rear panel) */ | |
3244 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3245 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3246 | /* Mic2 (front panel) */ | |
3247 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3248 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3249 | /* headphone */ | |
3250 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3251 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3252 | /* change to EAPD mode */ | |
3253 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3254 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3255 | ||
3256 | { } | |
3257 | }; | |
3258 | ||
3259 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { | |
3260 | /* change to EAPD mode */ | |
3261 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3262 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3263 | ||
3264 | /* Headphone output */ | |
3265 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3266 | /* Front output*/ | |
3267 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3268 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3269 | ||
3270 | /* Line In pin widget for input */ | |
3271 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3272 | /* CD pin widget for input */ | |
3273 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3274 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3275 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3276 | ||
3277 | /* change to EAPD mode */ | |
3278 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3279 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
3280 | ||
3281 | { } | |
3282 | }; | |
3283 | ||
3284 | /* | |
3285 | * LG m1 express dual | |
3286 | * | |
3287 | * Pin assignment: | |
3288 | * Rear Line-In/Out (blue): 0x14 | |
3289 | * Build-in Mic-In: 0x15 | |
3290 | * Speaker-out: 0x17 | |
3291 | * HP-Out (green): 0x1b | |
3292 | * Mic-In/Out (red): 0x19 | |
3293 | * SPDIF-Out: 0x1e | |
3294 | */ | |
3295 | ||
3296 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ | |
3297 | static hda_nid_t alc880_lg_dac_nids[3] = { | |
3298 | 0x05, 0x02, 0x03 | |
3299 | }; | |
3300 | ||
3301 | /* seems analog CD is not working */ | |
3302 | static struct hda_input_mux alc880_lg_capture_source = { | |
3303 | .num_items = 3, | |
3304 | .items = { | |
3305 | { "Mic", 0x1 }, | |
3306 | { "Line", 0x5 }, | |
3307 | { "Internal Mic", 0x6 }, | |
3308 | }, | |
3309 | }; | |
3310 | ||
3311 | /* 2,4,6 channel modes */ | |
3312 | static struct hda_verb alc880_lg_ch2_init[] = { | |
3313 | /* set line-in and mic-in to input */ | |
3314 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
3315 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
3316 | { } | |
3317 | }; | |
3318 | ||
3319 | static struct hda_verb alc880_lg_ch4_init[] = { | |
3320 | /* set line-in to out and mic-in to input */ | |
3321 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3322 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
3323 | { } | |
3324 | }; | |
3325 | ||
3326 | static struct hda_verb alc880_lg_ch6_init[] = { | |
3327 | /* set line-in and mic-in to output */ | |
3328 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3329 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3330 | { } | |
3331 | }; | |
3332 | ||
3333 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { | |
3334 | { 2, alc880_lg_ch2_init }, | |
3335 | { 4, alc880_lg_ch4_init }, | |
3336 | { 6, alc880_lg_ch6_init }, | |
3337 | }; | |
3338 | ||
3339 | static struct snd_kcontrol_new alc880_lg_mixer[] = { | |
3340 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
3341 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), | |
3342 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3343 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), | |
3344 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | |
3345 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
3346 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
3347 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
3348 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3349 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3350 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
3351 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
3352 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
3353 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
3354 | { | |
3355 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3356 | .name = "Channel Mode", | |
3357 | .info = alc_ch_mode_info, | |
3358 | .get = alc_ch_mode_get, | |
3359 | .put = alc_ch_mode_put, | |
3360 | }, | |
3361 | { } /* end */ | |
3362 | }; | |
3363 | ||
3364 | static struct hda_verb alc880_lg_init_verbs[] = { | |
3365 | /* set capture source to mic-in */ | |
3366 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3367 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3368 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3369 | /* mute all amp mixer inputs */ | |
3370 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, | |
3371 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
3372 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
3373 | /* line-in to input */ | |
3374 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3375 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3376 | /* built-in mic */ | |
3377 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3378 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3379 | /* speaker-out */ | |
3380 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3381 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3382 | /* mic-in to input */ | |
3383 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3384 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3385 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3386 | /* HP-out */ | |
3387 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
3388 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3389 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3390 | /* jack sense */ | |
3391 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3392 | { } | |
3393 | }; | |
3394 | ||
3395 | /* toggle speaker-output according to the hp-jack state */ | |
3396 | static void alc880_lg_setup(struct hda_codec *codec) | |
3397 | { | |
3398 | struct alc_spec *spec = codec->spec; | |
3399 | ||
3400 | spec->autocfg.hp_pins[0] = 0x1b; | |
3401 | spec->autocfg.speaker_pins[0] = 0x17; | |
3402 | } | |
3403 | ||
3404 | /* | |
3405 | * LG LW20 | |
3406 | * | |
3407 | * Pin assignment: | |
3408 | * Speaker-out: 0x14 | |
3409 | * Mic-In: 0x18 | |
3410 | * Built-in Mic-In: 0x19 | |
3411 | * Line-In: 0x1b | |
3412 | * HP-Out: 0x1a | |
3413 | * SPDIF-Out: 0x1e | |
3414 | */ | |
3415 | ||
3416 | static struct hda_input_mux alc880_lg_lw_capture_source = { | |
3417 | .num_items = 3, | |
3418 | .items = { | |
3419 | { "Mic", 0x0 }, | |
3420 | { "Internal Mic", 0x1 }, | |
3421 | { "Line In", 0x2 }, | |
3422 | }, | |
3423 | }; | |
3424 | ||
3425 | #define alc880_lg_lw_modes alc880_threestack_modes | |
3426 | ||
3427 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { | |
3428 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3429 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
3430 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
3431 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | |
3432 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
3433 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
3434 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
3435 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
3436 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
3437 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
3438 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
3439 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3440 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
3441 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
3442 | { | |
3443 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3444 | .name = "Channel Mode", | |
3445 | .info = alc_ch_mode_info, | |
3446 | .get = alc_ch_mode_get, | |
3447 | .put = alc_ch_mode_put, | |
3448 | }, | |
3449 | { } /* end */ | |
3450 | }; | |
3451 | ||
3452 | static struct hda_verb alc880_lg_lw_init_verbs[] = { | |
3453 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3454 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
3455 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
3456 | ||
3457 | /* set capture source to mic-in */ | |
3458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3459 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3460 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3461 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
3462 | /* speaker-out */ | |
3463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3464 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3465 | /* HP-out */ | |
3466 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3467 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3468 | /* mic-in to input */ | |
3469 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3470 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3471 | /* built-in mic */ | |
3472 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3473 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3474 | /* jack sense */ | |
3475 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3476 | { } | |
3477 | }; | |
3478 | ||
3479 | /* toggle speaker-output according to the hp-jack state */ | |
3480 | static void alc880_lg_lw_setup(struct hda_codec *codec) | |
3481 | { | |
3482 | struct alc_spec *spec = codec->spec; | |
3483 | ||
3484 | spec->autocfg.hp_pins[0] = 0x1b; | |
3485 | spec->autocfg.speaker_pins[0] = 0x14; | |
3486 | } | |
3487 | ||
3488 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { | |
3489 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3490 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
3491 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
3492 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3493 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3494 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3495 | { } /* end */ | |
3496 | }; | |
3497 | ||
3498 | static struct hda_input_mux alc880_medion_rim_capture_source = { | |
3499 | .num_items = 2, | |
3500 | .items = { | |
3501 | { "Mic", 0x0 }, | |
3502 | { "Internal Mic", 0x1 }, | |
3503 | }, | |
3504 | }; | |
3505 | ||
3506 | static struct hda_verb alc880_medion_rim_init_verbs[] = { | |
3507 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3508 | ||
3509 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3510 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3511 | ||
3512 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3513 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3514 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3515 | /* Mic2 (as headphone out) for HP output */ | |
3516 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3517 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3518 | /* Internal Speaker */ | |
3519 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3520 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3521 | ||
3522 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3523 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3524 | ||
3525 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3526 | { } | |
3527 | }; | |
3528 | ||
3529 | /* toggle speaker-output according to the hp-jack state */ | |
3530 | static void alc880_medion_rim_automute(struct hda_codec *codec) | |
3531 | { | |
3532 | struct alc_spec *spec = codec->spec; | |
3533 | alc_automute_amp(codec); | |
3534 | /* toggle EAPD */ | |
3535 | if (spec->jack_present) | |
3536 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); | |
3537 | else | |
3538 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); | |
3539 | } | |
3540 | ||
3541 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | |
3542 | unsigned int res) | |
3543 | { | |
3544 | /* Looks like the unsol event is incompatible with the standard | |
3545 | * definition. 4bit tag is placed at 28 bit! | |
3546 | */ | |
3547 | if ((res >> 28) == ALC880_HP_EVENT) | |
3548 | alc880_medion_rim_automute(codec); | |
3549 | } | |
3550 | ||
3551 | static void alc880_medion_rim_setup(struct hda_codec *codec) | |
3552 | { | |
3553 | struct alc_spec *spec = codec->spec; | |
3554 | ||
3555 | spec->autocfg.hp_pins[0] = 0x14; | |
3556 | spec->autocfg.speaker_pins[0] = 0x1b; | |
3557 | } | |
3558 | ||
3559 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3560 | static struct hda_amp_list alc880_loopbacks[] = { | |
3561 | { 0x0b, HDA_INPUT, 0 }, | |
3562 | { 0x0b, HDA_INPUT, 1 }, | |
3563 | { 0x0b, HDA_INPUT, 2 }, | |
3564 | { 0x0b, HDA_INPUT, 3 }, | |
3565 | { 0x0b, HDA_INPUT, 4 }, | |
3566 | { } /* end */ | |
3567 | }; | |
3568 | ||
3569 | static struct hda_amp_list alc880_lg_loopbacks[] = { | |
3570 | { 0x0b, HDA_INPUT, 1 }, | |
3571 | { 0x0b, HDA_INPUT, 6 }, | |
3572 | { 0x0b, HDA_INPUT, 7 }, | |
3573 | { } /* end */ | |
3574 | }; | |
3575 | #endif | |
3576 | ||
3577 | /* | |
3578 | * Common callbacks | |
3579 | */ | |
3580 | ||
3581 | static int alc_init(struct hda_codec *codec) | |
3582 | { | |
3583 | struct alc_spec *spec = codec->spec; | |
3584 | unsigned int i; | |
3585 | ||
3586 | alc_fix_pll(codec); | |
3587 | alc_auto_init_amp(codec, spec->init_amp); | |
3588 | ||
3589 | for (i = 0; i < spec->num_init_verbs; i++) | |
3590 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | |
3591 | ||
3592 | if (spec->init_hook) | |
3593 | spec->init_hook(codec); | |
3594 | ||
3595 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3596 | if (codec->patch_ops.check_power_status) | |
3597 | codec->patch_ops.check_power_status(codec, 0x01); | |
3598 | #endif | |
3599 | return 0; | |
3600 | } | |
3601 | ||
3602 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) | |
3603 | { | |
3604 | struct alc_spec *spec = codec->spec; | |
3605 | ||
3606 | if (spec->unsol_event) | |
3607 | spec->unsol_event(codec, res); | |
3608 | } | |
3609 | ||
3610 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3611 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) | |
3612 | { | |
3613 | struct alc_spec *spec = codec->spec; | |
3614 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); | |
3615 | } | |
3616 | #endif | |
3617 | ||
3618 | /* | |
3619 | * Analog playback callbacks | |
3620 | */ | |
3621 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
3622 | struct hda_codec *codec, | |
3623 | struct snd_pcm_substream *substream) | |
3624 | { | |
3625 | struct alc_spec *spec = codec->spec; | |
3626 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, | |
3627 | hinfo); | |
3628 | } | |
3629 | ||
3630 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3631 | struct hda_codec *codec, | |
3632 | unsigned int stream_tag, | |
3633 | unsigned int format, | |
3634 | struct snd_pcm_substream *substream) | |
3635 | { | |
3636 | struct alc_spec *spec = codec->spec; | |
3637 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, | |
3638 | stream_tag, format, substream); | |
3639 | } | |
3640 | ||
3641 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3642 | struct hda_codec *codec, | |
3643 | struct snd_pcm_substream *substream) | |
3644 | { | |
3645 | struct alc_spec *spec = codec->spec; | |
3646 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | |
3647 | } | |
3648 | ||
3649 | /* | |
3650 | * Digital out | |
3651 | */ | |
3652 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
3653 | struct hda_codec *codec, | |
3654 | struct snd_pcm_substream *substream) | |
3655 | { | |
3656 | struct alc_spec *spec = codec->spec; | |
3657 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | |
3658 | } | |
3659 | ||
3660 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3661 | struct hda_codec *codec, | |
3662 | unsigned int stream_tag, | |
3663 | unsigned int format, | |
3664 | struct snd_pcm_substream *substream) | |
3665 | { | |
3666 | struct alc_spec *spec = codec->spec; | |
3667 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, | |
3668 | stream_tag, format, substream); | |
3669 | } | |
3670 | ||
3671 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3672 | struct hda_codec *codec, | |
3673 | struct snd_pcm_substream *substream) | |
3674 | { | |
3675 | struct alc_spec *spec = codec->spec; | |
3676 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); | |
3677 | } | |
3678 | ||
3679 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, | |
3680 | struct hda_codec *codec, | |
3681 | struct snd_pcm_substream *substream) | |
3682 | { | |
3683 | struct alc_spec *spec = codec->spec; | |
3684 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | |
3685 | } | |
3686 | ||
3687 | /* | |
3688 | * Analog capture | |
3689 | */ | |
3690 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3691 | struct hda_codec *codec, | |
3692 | unsigned int stream_tag, | |
3693 | unsigned int format, | |
3694 | struct snd_pcm_substream *substream) | |
3695 | { | |
3696 | struct alc_spec *spec = codec->spec; | |
3697 | ||
3698 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], | |
3699 | stream_tag, 0, format); | |
3700 | return 0; | |
3701 | } | |
3702 | ||
3703 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3704 | struct hda_codec *codec, | |
3705 | struct snd_pcm_substream *substream) | |
3706 | { | |
3707 | struct alc_spec *spec = codec->spec; | |
3708 | ||
3709 | snd_hda_codec_cleanup_stream(codec, | |
3710 | spec->adc_nids[substream->number + 1]); | |
3711 | return 0; | |
3712 | } | |
3713 | ||
3714 | /* analog capture with dynamic dual-adc changes */ | |
3715 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3716 | struct hda_codec *codec, | |
3717 | unsigned int stream_tag, | |
3718 | unsigned int format, | |
3719 | struct snd_pcm_substream *substream) | |
3720 | { | |
3721 | struct alc_spec *spec = codec->spec; | |
3722 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; | |
3723 | spec->cur_adc_stream_tag = stream_tag; | |
3724 | spec->cur_adc_format = format; | |
3725 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); | |
3726 | return 0; | |
3727 | } | |
3728 | ||
3729 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3730 | struct hda_codec *codec, | |
3731 | struct snd_pcm_substream *substream) | |
3732 | { | |
3733 | struct alc_spec *spec = codec->spec; | |
3734 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); | |
3735 | spec->cur_adc = 0; | |
3736 | return 0; | |
3737 | } | |
3738 | ||
3739 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { | |
3740 | .substreams = 1, | |
3741 | .channels_min = 2, | |
3742 | .channels_max = 2, | |
3743 | .nid = 0, /* fill later */ | |
3744 | .ops = { | |
3745 | .prepare = dualmic_capture_pcm_prepare, | |
3746 | .cleanup = dualmic_capture_pcm_cleanup | |
3747 | }, | |
3748 | }; | |
3749 | ||
3750 | /* | |
3751 | */ | |
3752 | static struct hda_pcm_stream alc880_pcm_analog_playback = { | |
3753 | .substreams = 1, | |
3754 | .channels_min = 2, | |
3755 | .channels_max = 8, | |
3756 | /* NID is set in alc_build_pcms */ | |
3757 | .ops = { | |
3758 | .open = alc880_playback_pcm_open, | |
3759 | .prepare = alc880_playback_pcm_prepare, | |
3760 | .cleanup = alc880_playback_pcm_cleanup | |
3761 | }, | |
3762 | }; | |
3763 | ||
3764 | static struct hda_pcm_stream alc880_pcm_analog_capture = { | |
3765 | .substreams = 1, | |
3766 | .channels_min = 2, | |
3767 | .channels_max = 2, | |
3768 | /* NID is set in alc_build_pcms */ | |
3769 | }; | |
3770 | ||
3771 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { | |
3772 | .substreams = 1, | |
3773 | .channels_min = 2, | |
3774 | .channels_max = 2, | |
3775 | /* NID is set in alc_build_pcms */ | |
3776 | }; | |
3777 | ||
3778 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { | |
3779 | .substreams = 2, /* can be overridden */ | |
3780 | .channels_min = 2, | |
3781 | .channels_max = 2, | |
3782 | /* NID is set in alc_build_pcms */ | |
3783 | .ops = { | |
3784 | .prepare = alc880_alt_capture_pcm_prepare, | |
3785 | .cleanup = alc880_alt_capture_pcm_cleanup | |
3786 | }, | |
3787 | }; | |
3788 | ||
3789 | static struct hda_pcm_stream alc880_pcm_digital_playback = { | |
3790 | .substreams = 1, | |
3791 | .channels_min = 2, | |
3792 | .channels_max = 2, | |
3793 | /* NID is set in alc_build_pcms */ | |
3794 | .ops = { | |
3795 | .open = alc880_dig_playback_pcm_open, | |
3796 | .close = alc880_dig_playback_pcm_close, | |
3797 | .prepare = alc880_dig_playback_pcm_prepare, | |
3798 | .cleanup = alc880_dig_playback_pcm_cleanup | |
3799 | }, | |
3800 | }; | |
3801 | ||
3802 | static struct hda_pcm_stream alc880_pcm_digital_capture = { | |
3803 | .substreams = 1, | |
3804 | .channels_min = 2, | |
3805 | .channels_max = 2, | |
3806 | /* NID is set in alc_build_pcms */ | |
3807 | }; | |
3808 | ||
3809 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ | |
3810 | static struct hda_pcm_stream alc_pcm_null_stream = { | |
3811 | .substreams = 0, | |
3812 | .channels_min = 0, | |
3813 | .channels_max = 0, | |
3814 | }; | |
3815 | ||
3816 | static int alc_build_pcms(struct hda_codec *codec) | |
3817 | { | |
3818 | struct alc_spec *spec = codec->spec; | |
3819 | struct hda_pcm *info = spec->pcm_rec; | |
3820 | int i; | |
3821 | ||
3822 | codec->num_pcms = 1; | |
3823 | codec->pcm_info = info; | |
3824 | ||
3825 | if (spec->no_analog) | |
3826 | goto skip_analog; | |
3827 | ||
3828 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), | |
3829 | "%s Analog", codec->chip_name); | |
3830 | info->name = spec->stream_name_analog; | |
3831 | ||
3832 | if (spec->stream_analog_playback) { | |
3833 | if (snd_BUG_ON(!spec->multiout.dac_nids)) | |
3834 | return -EINVAL; | |
3835 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); | |
3836 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | |
3837 | } | |
3838 | if (spec->stream_analog_capture) { | |
3839 | if (snd_BUG_ON(!spec->adc_nids)) | |
3840 | return -EINVAL; | |
3841 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); | |
3842 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | |
3843 | } | |
3844 | ||
3845 | if (spec->channel_mode) { | |
3846 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; | |
3847 | for (i = 0; i < spec->num_channel_mode; i++) { | |
3848 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { | |
3849 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; | |
3850 | } | |
3851 | } | |
3852 | } | |
3853 | ||
3854 | skip_analog: | |
3855 | /* SPDIF for stream index #1 */ | |
3856 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { | |
3857 | snprintf(spec->stream_name_digital, | |
3858 | sizeof(spec->stream_name_digital), | |
3859 | "%s Digital", codec->chip_name); | |
3860 | codec->num_pcms = 2; | |
3861 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; | |
3862 | info = spec->pcm_rec + 1; | |
3863 | info->name = spec->stream_name_digital; | |
3864 | if (spec->dig_out_type) | |
3865 | info->pcm_type = spec->dig_out_type; | |
3866 | else | |
3867 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | |
3868 | if (spec->multiout.dig_out_nid && | |
3869 | spec->stream_digital_playback) { | |
3870 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); | |
3871 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | |
3872 | } | |
3873 | if (spec->dig_in_nid && | |
3874 | spec->stream_digital_capture) { | |
3875 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); | |
3876 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | |
3877 | } | |
3878 | /* FIXME: do we need this for all Realtek codec models? */ | |
3879 | codec->spdif_status_reset = 1; | |
3880 | } | |
3881 | ||
3882 | if (spec->no_analog) | |
3883 | return 0; | |
3884 | ||
3885 | /* If the use of more than one ADC is requested for the current | |
3886 | * model, configure a second analog capture-only PCM. | |
3887 | */ | |
3888 | /* Additional Analaog capture for index #2 */ | |
3889 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || | |
3890 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { | |
3891 | codec->num_pcms = 3; | |
3892 | info = spec->pcm_rec + 2; | |
3893 | info->name = spec->stream_name_analog; | |
3894 | if (spec->alt_dac_nid) { | |
3895 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
3896 | *spec->stream_analog_alt_playback; | |
3897 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | |
3898 | spec->alt_dac_nid; | |
3899 | } else { | |
3900 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
3901 | alc_pcm_null_stream; | |
3902 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | |
3903 | } | |
3904 | if (spec->num_adc_nids > 1) { | |
3905 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
3906 | *spec->stream_analog_alt_capture; | |
3907 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | |
3908 | spec->adc_nids[1]; | |
3909 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = | |
3910 | spec->num_adc_nids - 1; | |
3911 | } else { | |
3912 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
3913 | alc_pcm_null_stream; | |
3914 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; | |
3915 | } | |
3916 | } | |
3917 | ||
3918 | return 0; | |
3919 | } | |
3920 | ||
3921 | static inline void alc_shutup(struct hda_codec *codec) | |
3922 | { | |
3923 | snd_hda_shutup_pins(codec); | |
3924 | } | |
3925 | ||
3926 | static void alc_free_kctls(struct hda_codec *codec) | |
3927 | { | |
3928 | struct alc_spec *spec = codec->spec; | |
3929 | ||
3930 | if (spec->kctls.list) { | |
3931 | struct snd_kcontrol_new *kctl = spec->kctls.list; | |
3932 | int i; | |
3933 | for (i = 0; i < spec->kctls.used; i++) | |
3934 | kfree(kctl[i].name); | |
3935 | } | |
3936 | snd_array_free(&spec->kctls); | |
3937 | } | |
3938 | ||
3939 | static void alc_free(struct hda_codec *codec) | |
3940 | { | |
3941 | struct alc_spec *spec = codec->spec; | |
3942 | ||
3943 | if (!spec) | |
3944 | return; | |
3945 | ||
3946 | alc_shutup(codec); | |
3947 | alc_free_kctls(codec); | |
3948 | kfree(spec); | |
3949 | snd_hda_detach_beep_device(codec); | |
3950 | } | |
3951 | ||
3952 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3953 | static void alc_power_eapd(struct hda_codec *codec) | |
3954 | { | |
3955 | /* We currently only handle front, HP */ | |
3956 | switch (codec->vendor_id) { | |
3957 | case 0x10ec0260: | |
3958 | set_eapd(codec, 0x0f, 0); | |
3959 | set_eapd(codec, 0x10, 0); | |
3960 | break; | |
3961 | case 0x10ec0262: | |
3962 | case 0x10ec0267: | |
3963 | case 0x10ec0268: | |
3964 | case 0x10ec0269: | |
3965 | case 0x10ec0270: | |
3966 | case 0x10ec0272: | |
3967 | case 0x10ec0660: | |
3968 | case 0x10ec0662: | |
3969 | case 0x10ec0663: | |
3970 | case 0x10ec0862: | |
3971 | case 0x10ec0889: | |
3972 | set_eapd(codec, 0x14, 0); | |
3973 | set_eapd(codec, 0x15, 0); | |
3974 | break; | |
3975 | } | |
3976 | } | |
3977 | ||
3978 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) | |
3979 | { | |
3980 | struct alc_spec *spec = codec->spec; | |
3981 | alc_shutup(codec); | |
3982 | if (spec && spec->power_hook) | |
3983 | spec->power_hook(codec); | |
3984 | return 0; | |
3985 | } | |
3986 | #endif | |
3987 | ||
3988 | #ifdef SND_HDA_NEEDS_RESUME | |
3989 | static int alc_resume(struct hda_codec *codec) | |
3990 | { | |
3991 | codec->patch_ops.init(codec); | |
3992 | snd_hda_codec_resume_amp(codec); | |
3993 | snd_hda_codec_resume_cache(codec); | |
3994 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3995 | if (codec->patch_ops.check_power_status) | |
3996 | codec->patch_ops.check_power_status(codec, 0x01); | |
3997 | #endif | |
3998 | return 0; | |
3999 | } | |
4000 | #endif | |
4001 | ||
4002 | /* | |
4003 | */ | |
4004 | static struct hda_codec_ops alc_patch_ops = { | |
4005 | .build_controls = alc_build_controls, | |
4006 | .build_pcms = alc_build_pcms, | |
4007 | .init = alc_init, | |
4008 | .free = alc_free, | |
4009 | .unsol_event = alc_unsol_event, | |
4010 | #ifdef SND_HDA_NEEDS_RESUME | |
4011 | .resume = alc_resume, | |
4012 | #endif | |
4013 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
4014 | .suspend = alc_suspend, | |
4015 | .check_power_status = alc_check_power_status, | |
4016 | #endif | |
4017 | .reboot_notify = alc_shutup, | |
4018 | }; | |
4019 | ||
4020 | /* replace the codec chip_name with the given string */ | |
4021 | static int alc_codec_rename(struct hda_codec *codec, const char *name) | |
4022 | { | |
4023 | kfree(codec->chip_name); | |
4024 | codec->chip_name = kstrdup(name, GFP_KERNEL); | |
4025 | if (!codec->chip_name) { | |
4026 | alc_free(codec); | |
4027 | return -ENOMEM; | |
4028 | } | |
4029 | return 0; | |
4030 | } | |
4031 | ||
4032 | /* | |
4033 | * Test configuration for debugging | |
4034 | * | |
4035 | * Almost all inputs/outputs are enabled. I/O pins can be configured via | |
4036 | * enum controls. | |
4037 | */ | |
4038 | #ifdef CONFIG_SND_DEBUG | |
4039 | static hda_nid_t alc880_test_dac_nids[4] = { | |
4040 | 0x02, 0x03, 0x04, 0x05 | |
4041 | }; | |
4042 | ||
4043 | static struct hda_input_mux alc880_test_capture_source = { | |
4044 | .num_items = 7, | |
4045 | .items = { | |
4046 | { "In-1", 0x0 }, | |
4047 | { "In-2", 0x1 }, | |
4048 | { "In-3", 0x2 }, | |
4049 | { "In-4", 0x3 }, | |
4050 | { "CD", 0x4 }, | |
4051 | { "Front", 0x5 }, | |
4052 | { "Surround", 0x6 }, | |
4053 | }, | |
4054 | }; | |
4055 | ||
4056 | static struct hda_channel_mode alc880_test_modes[4] = { | |
4057 | { 2, NULL }, | |
4058 | { 4, NULL }, | |
4059 | { 6, NULL }, | |
4060 | { 8, NULL }, | |
4061 | }; | |
4062 | ||
4063 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, | |
4064 | struct snd_ctl_elem_info *uinfo) | |
4065 | { | |
4066 | static char *texts[] = { | |
4067 | "N/A", "Line Out", "HP Out", | |
4068 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" | |
4069 | }; | |
4070 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
4071 | uinfo->count = 1; | |
4072 | uinfo->value.enumerated.items = 8; | |
4073 | if (uinfo->value.enumerated.item >= 8) | |
4074 | uinfo->value.enumerated.item = 7; | |
4075 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
4076 | return 0; | |
4077 | } | |
4078 | ||
4079 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, | |
4080 | struct snd_ctl_elem_value *ucontrol) | |
4081 | { | |
4082 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4083 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4084 | unsigned int pin_ctl, item = 0; | |
4085 | ||
4086 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | |
4087 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
4088 | if (pin_ctl & AC_PINCTL_OUT_EN) { | |
4089 | if (pin_ctl & AC_PINCTL_HP_EN) | |
4090 | item = 2; | |
4091 | else | |
4092 | item = 1; | |
4093 | } else if (pin_ctl & AC_PINCTL_IN_EN) { | |
4094 | switch (pin_ctl & AC_PINCTL_VREFEN) { | |
4095 | case AC_PINCTL_VREF_HIZ: item = 3; break; | |
4096 | case AC_PINCTL_VREF_50: item = 4; break; | |
4097 | case AC_PINCTL_VREF_GRD: item = 5; break; | |
4098 | case AC_PINCTL_VREF_80: item = 6; break; | |
4099 | case AC_PINCTL_VREF_100: item = 7; break; | |
4100 | } | |
4101 | } | |
4102 | ucontrol->value.enumerated.item[0] = item; | |
4103 | return 0; | |
4104 | } | |
4105 | ||
4106 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, | |
4107 | struct snd_ctl_elem_value *ucontrol) | |
4108 | { | |
4109 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4110 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4111 | static unsigned int ctls[] = { | |
4112 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, | |
4113 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, | |
4114 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, | |
4115 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, | |
4116 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, | |
4117 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, | |
4118 | }; | |
4119 | unsigned int old_ctl, new_ctl; | |
4120 | ||
4121 | old_ctl = snd_hda_codec_read(codec, nid, 0, | |
4122 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
4123 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; | |
4124 | if (old_ctl != new_ctl) { | |
4125 | int val; | |
4126 | snd_hda_codec_write_cache(codec, nid, 0, | |
4127 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4128 | new_ctl); | |
4129 | val = ucontrol->value.enumerated.item[0] >= 3 ? | |
4130 | HDA_AMP_MUTE : 0; | |
4131 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
4132 | HDA_AMP_MUTE, val); | |
4133 | return 1; | |
4134 | } | |
4135 | return 0; | |
4136 | } | |
4137 | ||
4138 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, | |
4139 | struct snd_ctl_elem_info *uinfo) | |
4140 | { | |
4141 | static char *texts[] = { | |
4142 | "Front", "Surround", "CLFE", "Side" | |
4143 | }; | |
4144 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
4145 | uinfo->count = 1; | |
4146 | uinfo->value.enumerated.items = 4; | |
4147 | if (uinfo->value.enumerated.item >= 4) | |
4148 | uinfo->value.enumerated.item = 3; | |
4149 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
4150 | return 0; | |
4151 | } | |
4152 | ||
4153 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, | |
4154 | struct snd_ctl_elem_value *ucontrol) | |
4155 | { | |
4156 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4157 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4158 | unsigned int sel; | |
4159 | ||
4160 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); | |
4161 | ucontrol->value.enumerated.item[0] = sel & 3; | |
4162 | return 0; | |
4163 | } | |
4164 | ||
4165 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, | |
4166 | struct snd_ctl_elem_value *ucontrol) | |
4167 | { | |
4168 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4169 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4170 | unsigned int sel; | |
4171 | ||
4172 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; | |
4173 | if (ucontrol->value.enumerated.item[0] != sel) { | |
4174 | sel = ucontrol->value.enumerated.item[0] & 3; | |
4175 | snd_hda_codec_write_cache(codec, nid, 0, | |
4176 | AC_VERB_SET_CONNECT_SEL, sel); | |
4177 | return 1; | |
4178 | } | |
4179 | return 0; | |
4180 | } | |
4181 | ||
4182 | #define PIN_CTL_TEST(xname,nid) { \ | |
4183 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
4184 | .name = xname, \ | |
4185 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | |
4186 | .info = alc_test_pin_ctl_info, \ | |
4187 | .get = alc_test_pin_ctl_get, \ | |
4188 | .put = alc_test_pin_ctl_put, \ | |
4189 | .private_value = nid \ | |
4190 | } | |
4191 | ||
4192 | #define PIN_SRC_TEST(xname,nid) { \ | |
4193 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
4194 | .name = xname, \ | |
4195 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | |
4196 | .info = alc_test_pin_src_info, \ | |
4197 | .get = alc_test_pin_src_get, \ | |
4198 | .put = alc_test_pin_src_put, \ | |
4199 | .private_value = nid \ | |
4200 | } | |
4201 | ||
4202 | static struct snd_kcontrol_new alc880_test_mixer[] = { | |
4203 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
4204 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
4205 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
4206 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
4207 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
4208 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
4209 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), | |
4210 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
4211 | PIN_CTL_TEST("Front Pin Mode", 0x14), | |
4212 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | |
4213 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | |
4214 | PIN_CTL_TEST("Side Pin Mode", 0x17), | |
4215 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), | |
4216 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), | |
4217 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), | |
4218 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), | |
4219 | PIN_SRC_TEST("In-1 Pin Source", 0x18), | |
4220 | PIN_SRC_TEST("In-2 Pin Source", 0x19), | |
4221 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), | |
4222 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), | |
4223 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
4224 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
4225 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
4226 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
4227 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), | |
4228 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), | |
4229 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
4230 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
4231 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), | |
4232 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
4233 | { | |
4234 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4235 | .name = "Channel Mode", | |
4236 | .info = alc_ch_mode_info, | |
4237 | .get = alc_ch_mode_get, | |
4238 | .put = alc_ch_mode_put, | |
4239 | }, | |
4240 | { } /* end */ | |
4241 | }; | |
4242 | ||
4243 | static struct hda_verb alc880_test_init_verbs[] = { | |
4244 | /* Unmute inputs of 0x0c - 0x0f */ | |
4245 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4246 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4247 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4248 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4249 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4250 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4251 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4252 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4253 | /* Vol output for 0x0c-0x0f */ | |
4254 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4255 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4256 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4257 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4258 | /* Set output pins 0x14-0x17 */ | |
4259 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4260 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4261 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4262 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4263 | /* Unmute output pins 0x14-0x17 */ | |
4264 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4265 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4266 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4267 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4268 | /* Set input pins 0x18-0x1c */ | |
4269 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
4270 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
4271 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
4272 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
4273 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
4274 | /* Mute input pins 0x18-0x1b */ | |
4275 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4276 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4277 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4278 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4279 | /* ADC set up */ | |
4280 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4281 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4282 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4283 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4284 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4285 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4286 | /* Analog input/passthru */ | |
4287 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4288 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4289 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4290 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4291 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
4292 | { } | |
4293 | }; | |
4294 | #endif | |
4295 | ||
4296 | /* | |
4297 | */ | |
4298 | ||
4299 | static const char *alc880_models[ALC880_MODEL_LAST] = { | |
4300 | [ALC880_3ST] = "3stack", | |
4301 | [ALC880_TCL_S700] = "tcl", | |
4302 | [ALC880_3ST_DIG] = "3stack-digout", | |
4303 | [ALC880_CLEVO] = "clevo", | |
4304 | [ALC880_5ST] = "5stack", | |
4305 | [ALC880_5ST_DIG] = "5stack-digout", | |
4306 | [ALC880_W810] = "w810", | |
4307 | [ALC880_Z71V] = "z71v", | |
4308 | [ALC880_6ST] = "6stack", | |
4309 | [ALC880_6ST_DIG] = "6stack-digout", | |
4310 | [ALC880_ASUS] = "asus", | |
4311 | [ALC880_ASUS_W1V] = "asus-w1v", | |
4312 | [ALC880_ASUS_DIG] = "asus-dig", | |
4313 | [ALC880_ASUS_DIG2] = "asus-dig2", | |
4314 | [ALC880_UNIWILL_DIG] = "uniwill", | |
4315 | [ALC880_UNIWILL_P53] = "uniwill-p53", | |
4316 | [ALC880_FUJITSU] = "fujitsu", | |
4317 | [ALC880_F1734] = "F1734", | |
4318 | [ALC880_LG] = "lg", | |
4319 | [ALC880_LG_LW] = "lg-lw", | |
4320 | [ALC880_MEDION_RIM] = "medion", | |
4321 | #ifdef CONFIG_SND_DEBUG | |
4322 | [ALC880_TEST] = "test", | |
4323 | #endif | |
4324 | [ALC880_AUTO] = "auto", | |
4325 | }; | |
4326 | ||
4327 | static struct snd_pci_quirk alc880_cfg_tbl[] = { | |
4328 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), | |
4329 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), | |
4330 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), | |
4331 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), | |
4332 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), | |
4333 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), | |
4334 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), | |
4335 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), | |
4336 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), | |
4337 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), | |
4338 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), | |
4339 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), | |
4340 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), | |
4341 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), | |
4342 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), | |
4343 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), | |
4344 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), | |
4345 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), | |
4346 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ | |
4347 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), | |
4348 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), | |
4349 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), | |
4350 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), | |
4351 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), | |
4352 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), | |
4353 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ | |
4354 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), | |
4355 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), | |
4356 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), | |
4357 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), | |
4358 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), | |
4359 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), | |
4360 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), | |
4361 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), | |
4362 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), | |
4363 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), | |
4364 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), | |
4365 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), | |
4366 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), | |
4367 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), | |
4368 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), | |
4369 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), | |
4370 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), | |
4371 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), | |
4372 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), | |
4373 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), | |
4374 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), | |
4375 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), | |
4376 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), | |
4377 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), | |
4378 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), | |
4379 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), | |
4380 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), | |
4381 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), | |
4382 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), | |
4383 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), | |
4384 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ | |
4385 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), | |
4386 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), | |
4387 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), | |
4388 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), | |
4389 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), | |
4390 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), | |
4391 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), | |
4392 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), | |
4393 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), | |
4394 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), | |
4395 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), | |
4396 | /* default Intel */ | |
4397 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), | |
4398 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), | |
4399 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), | |
4400 | {} | |
4401 | }; | |
4402 | ||
4403 | /* | |
4404 | * ALC880 codec presets | |
4405 | */ | |
4406 | static struct alc_config_preset alc880_presets[] = { | |
4407 | [ALC880_3ST] = { | |
4408 | .mixers = { alc880_three_stack_mixer }, | |
4409 | .init_verbs = { alc880_volume_init_verbs, | |
4410 | alc880_pin_3stack_init_verbs }, | |
4411 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4412 | .dac_nids = alc880_dac_nids, | |
4413 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4414 | .channel_mode = alc880_threestack_modes, | |
4415 | .need_dac_fix = 1, | |
4416 | .input_mux = &alc880_capture_source, | |
4417 | }, | |
4418 | [ALC880_3ST_DIG] = { | |
4419 | .mixers = { alc880_three_stack_mixer }, | |
4420 | .init_verbs = { alc880_volume_init_verbs, | |
4421 | alc880_pin_3stack_init_verbs }, | |
4422 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4423 | .dac_nids = alc880_dac_nids, | |
4424 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4425 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4426 | .channel_mode = alc880_threestack_modes, | |
4427 | .need_dac_fix = 1, | |
4428 | .input_mux = &alc880_capture_source, | |
4429 | }, | |
4430 | [ALC880_TCL_S700] = { | |
4431 | .mixers = { alc880_tcl_s700_mixer }, | |
4432 | .init_verbs = { alc880_volume_init_verbs, | |
4433 | alc880_pin_tcl_S700_init_verbs, | |
4434 | alc880_gpio2_init_verbs }, | |
4435 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4436 | .dac_nids = alc880_dac_nids, | |
4437 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ | |
4438 | .num_adc_nids = 1, /* single ADC */ | |
4439 | .hp_nid = 0x03, | |
4440 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4441 | .channel_mode = alc880_2_jack_modes, | |
4442 | .input_mux = &alc880_capture_source, | |
4443 | }, | |
4444 | [ALC880_5ST] = { | |
4445 | .mixers = { alc880_three_stack_mixer, | |
4446 | alc880_five_stack_mixer}, | |
4447 | .init_verbs = { alc880_volume_init_verbs, | |
4448 | alc880_pin_5stack_init_verbs }, | |
4449 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4450 | .dac_nids = alc880_dac_nids, | |
4451 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), | |
4452 | .channel_mode = alc880_fivestack_modes, | |
4453 | .input_mux = &alc880_capture_source, | |
4454 | }, | |
4455 | [ALC880_5ST_DIG] = { | |
4456 | .mixers = { alc880_three_stack_mixer, | |
4457 | alc880_five_stack_mixer }, | |
4458 | .init_verbs = { alc880_volume_init_verbs, | |
4459 | alc880_pin_5stack_init_verbs }, | |
4460 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4461 | .dac_nids = alc880_dac_nids, | |
4462 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4463 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), | |
4464 | .channel_mode = alc880_fivestack_modes, | |
4465 | .input_mux = &alc880_capture_source, | |
4466 | }, | |
4467 | [ALC880_6ST] = { | |
4468 | .mixers = { alc880_six_stack_mixer }, | |
4469 | .init_verbs = { alc880_volume_init_verbs, | |
4470 | alc880_pin_6stack_init_verbs }, | |
4471 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), | |
4472 | .dac_nids = alc880_6st_dac_nids, | |
4473 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
4474 | .channel_mode = alc880_sixstack_modes, | |
4475 | .input_mux = &alc880_6stack_capture_source, | |
4476 | }, | |
4477 | [ALC880_6ST_DIG] = { | |
4478 | .mixers = { alc880_six_stack_mixer }, | |
4479 | .init_verbs = { alc880_volume_init_verbs, | |
4480 | alc880_pin_6stack_init_verbs }, | |
4481 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), | |
4482 | .dac_nids = alc880_6st_dac_nids, | |
4483 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4484 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
4485 | .channel_mode = alc880_sixstack_modes, | |
4486 | .input_mux = &alc880_6stack_capture_source, | |
4487 | }, | |
4488 | [ALC880_W810] = { | |
4489 | .mixers = { alc880_w810_base_mixer }, | |
4490 | .init_verbs = { alc880_volume_init_verbs, | |
4491 | alc880_pin_w810_init_verbs, | |
4492 | alc880_gpio2_init_verbs }, | |
4493 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), | |
4494 | .dac_nids = alc880_w810_dac_nids, | |
4495 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4496 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
4497 | .channel_mode = alc880_w810_modes, | |
4498 | .input_mux = &alc880_capture_source, | |
4499 | }, | |
4500 | [ALC880_Z71V] = { | |
4501 | .mixers = { alc880_z71v_mixer }, | |
4502 | .init_verbs = { alc880_volume_init_verbs, | |
4503 | alc880_pin_z71v_init_verbs }, | |
4504 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), | |
4505 | .dac_nids = alc880_z71v_dac_nids, | |
4506 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4507 | .hp_nid = 0x03, | |
4508 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4509 | .channel_mode = alc880_2_jack_modes, | |
4510 | .input_mux = &alc880_capture_source, | |
4511 | }, | |
4512 | [ALC880_F1734] = { | |
4513 | .mixers = { alc880_f1734_mixer }, | |
4514 | .init_verbs = { alc880_volume_init_verbs, | |
4515 | alc880_pin_f1734_init_verbs }, | |
4516 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), | |
4517 | .dac_nids = alc880_f1734_dac_nids, | |
4518 | .hp_nid = 0x02, | |
4519 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4520 | .channel_mode = alc880_2_jack_modes, | |
4521 | .input_mux = &alc880_f1734_capture_source, | |
4522 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4523 | .setup = alc880_uniwill_p53_setup, | |
4524 | .init_hook = alc_automute_amp, | |
4525 | }, | |
4526 | [ALC880_ASUS] = { | |
4527 | .mixers = { alc880_asus_mixer }, | |
4528 | .init_verbs = { alc880_volume_init_verbs, | |
4529 | alc880_pin_asus_init_verbs, | |
4530 | alc880_gpio1_init_verbs }, | |
4531 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4532 | .dac_nids = alc880_asus_dac_nids, | |
4533 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4534 | .channel_mode = alc880_asus_modes, | |
4535 | .need_dac_fix = 1, | |
4536 | .input_mux = &alc880_capture_source, | |
4537 | }, | |
4538 | [ALC880_ASUS_DIG] = { | |
4539 | .mixers = { alc880_asus_mixer }, | |
4540 | .init_verbs = { alc880_volume_init_verbs, | |
4541 | alc880_pin_asus_init_verbs, | |
4542 | alc880_gpio1_init_verbs }, | |
4543 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4544 | .dac_nids = alc880_asus_dac_nids, | |
4545 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4546 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4547 | .channel_mode = alc880_asus_modes, | |
4548 | .need_dac_fix = 1, | |
4549 | .input_mux = &alc880_capture_source, | |
4550 | }, | |
4551 | [ALC880_ASUS_DIG2] = { | |
4552 | .mixers = { alc880_asus_mixer }, | |
4553 | .init_verbs = { alc880_volume_init_verbs, | |
4554 | alc880_pin_asus_init_verbs, | |
4555 | alc880_gpio2_init_verbs }, /* use GPIO2 */ | |
4556 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4557 | .dac_nids = alc880_asus_dac_nids, | |
4558 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4559 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4560 | .channel_mode = alc880_asus_modes, | |
4561 | .need_dac_fix = 1, | |
4562 | .input_mux = &alc880_capture_source, | |
4563 | }, | |
4564 | [ALC880_ASUS_W1V] = { | |
4565 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, | |
4566 | .init_verbs = { alc880_volume_init_verbs, | |
4567 | alc880_pin_asus_init_verbs, | |
4568 | alc880_gpio1_init_verbs }, | |
4569 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4570 | .dac_nids = alc880_asus_dac_nids, | |
4571 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4572 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4573 | .channel_mode = alc880_asus_modes, | |
4574 | .need_dac_fix = 1, | |
4575 | .input_mux = &alc880_capture_source, | |
4576 | }, | |
4577 | [ALC880_UNIWILL_DIG] = { | |
4578 | .mixers = { alc880_asus_mixer }, | |
4579 | .init_verbs = { alc880_volume_init_verbs, | |
4580 | alc880_pin_asus_init_verbs }, | |
4581 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4582 | .dac_nids = alc880_asus_dac_nids, | |
4583 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4584 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4585 | .channel_mode = alc880_asus_modes, | |
4586 | .need_dac_fix = 1, | |
4587 | .input_mux = &alc880_capture_source, | |
4588 | }, | |
4589 | [ALC880_UNIWILL] = { | |
4590 | .mixers = { alc880_uniwill_mixer }, | |
4591 | .init_verbs = { alc880_volume_init_verbs, | |
4592 | alc880_uniwill_init_verbs }, | |
4593 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4594 | .dac_nids = alc880_asus_dac_nids, | |
4595 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4596 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4597 | .channel_mode = alc880_threestack_modes, | |
4598 | .need_dac_fix = 1, | |
4599 | .input_mux = &alc880_capture_source, | |
4600 | .unsol_event = alc880_uniwill_unsol_event, | |
4601 | .setup = alc880_uniwill_setup, | |
4602 | .init_hook = alc880_uniwill_init_hook, | |
4603 | }, | |
4604 | [ALC880_UNIWILL_P53] = { | |
4605 | .mixers = { alc880_uniwill_p53_mixer }, | |
4606 | .init_verbs = { alc880_volume_init_verbs, | |
4607 | alc880_uniwill_p53_init_verbs }, | |
4608 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4609 | .dac_nids = alc880_asus_dac_nids, | |
4610 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
4611 | .channel_mode = alc880_threestack_modes, | |
4612 | .input_mux = &alc880_capture_source, | |
4613 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4614 | .setup = alc880_uniwill_p53_setup, | |
4615 | .init_hook = alc_automute_amp, | |
4616 | }, | |
4617 | [ALC880_FUJITSU] = { | |
4618 | .mixers = { alc880_fujitsu_mixer }, | |
4619 | .init_verbs = { alc880_volume_init_verbs, | |
4620 | alc880_uniwill_p53_init_verbs, | |
4621 | alc880_beep_init_verbs }, | |
4622 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4623 | .dac_nids = alc880_dac_nids, | |
4624 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4625 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4626 | .channel_mode = alc880_2_jack_modes, | |
4627 | .input_mux = &alc880_capture_source, | |
4628 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4629 | .setup = alc880_uniwill_p53_setup, | |
4630 | .init_hook = alc_automute_amp, | |
4631 | }, | |
4632 | [ALC880_CLEVO] = { | |
4633 | .mixers = { alc880_three_stack_mixer }, | |
4634 | .init_verbs = { alc880_volume_init_verbs, | |
4635 | alc880_pin_clevo_init_verbs }, | |
4636 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4637 | .dac_nids = alc880_dac_nids, | |
4638 | .hp_nid = 0x03, | |
4639 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4640 | .channel_mode = alc880_threestack_modes, | |
4641 | .need_dac_fix = 1, | |
4642 | .input_mux = &alc880_capture_source, | |
4643 | }, | |
4644 | [ALC880_LG] = { | |
4645 | .mixers = { alc880_lg_mixer }, | |
4646 | .init_verbs = { alc880_volume_init_verbs, | |
4647 | alc880_lg_init_verbs }, | |
4648 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), | |
4649 | .dac_nids = alc880_lg_dac_nids, | |
4650 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4651 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), | |
4652 | .channel_mode = alc880_lg_ch_modes, | |
4653 | .need_dac_fix = 1, | |
4654 | .input_mux = &alc880_lg_capture_source, | |
4655 | .unsol_event = alc_automute_amp_unsol_event, | |
4656 | .setup = alc880_lg_setup, | |
4657 | .init_hook = alc_automute_amp, | |
4658 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
4659 | .loopbacks = alc880_lg_loopbacks, | |
4660 | #endif | |
4661 | }, | |
4662 | [ALC880_LG_LW] = { | |
4663 | .mixers = { alc880_lg_lw_mixer }, | |
4664 | .init_verbs = { alc880_volume_init_verbs, | |
4665 | alc880_lg_lw_init_verbs }, | |
4666 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4667 | .dac_nids = alc880_dac_nids, | |
4668 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4669 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), | |
4670 | .channel_mode = alc880_lg_lw_modes, | |
4671 | .input_mux = &alc880_lg_lw_capture_source, | |
4672 | .unsol_event = alc_automute_amp_unsol_event, | |
4673 | .setup = alc880_lg_lw_setup, | |
4674 | .init_hook = alc_automute_amp, | |
4675 | }, | |
4676 | [ALC880_MEDION_RIM] = { | |
4677 | .mixers = { alc880_medion_rim_mixer }, | |
4678 | .init_verbs = { alc880_volume_init_verbs, | |
4679 | alc880_medion_rim_init_verbs, | |
4680 | alc_gpio2_init_verbs }, | |
4681 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4682 | .dac_nids = alc880_dac_nids, | |
4683 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4684 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4685 | .channel_mode = alc880_2_jack_modes, | |
4686 | .input_mux = &alc880_medion_rim_capture_source, | |
4687 | .unsol_event = alc880_medion_rim_unsol_event, | |
4688 | .setup = alc880_medion_rim_setup, | |
4689 | .init_hook = alc880_medion_rim_automute, | |
4690 | }, | |
4691 | #ifdef CONFIG_SND_DEBUG | |
4692 | [ALC880_TEST] = { | |
4693 | .mixers = { alc880_test_mixer }, | |
4694 | .init_verbs = { alc880_test_init_verbs }, | |
4695 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), | |
4696 | .dac_nids = alc880_test_dac_nids, | |
4697 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4698 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), | |
4699 | .channel_mode = alc880_test_modes, | |
4700 | .input_mux = &alc880_test_capture_source, | |
4701 | }, | |
4702 | #endif | |
4703 | }; | |
4704 | ||
4705 | /* | |
4706 | * Automatic parse of I/O pins from the BIOS configuration | |
4707 | */ | |
4708 | ||
4709 | enum { | |
4710 | ALC_CTL_WIDGET_VOL, | |
4711 | ALC_CTL_WIDGET_MUTE, | |
4712 | ALC_CTL_BIND_MUTE, | |
4713 | }; | |
4714 | static struct snd_kcontrol_new alc880_control_templates[] = { | |
4715 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), | |
4716 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | |
4717 | HDA_BIND_MUTE(NULL, 0, 0, 0), | |
4718 | }; | |
4719 | ||
4720 | /* add dynamic controls */ | |
4721 | static int add_control(struct alc_spec *spec, int type, const char *name, | |
4722 | unsigned long val) | |
4723 | { | |
4724 | struct snd_kcontrol_new *knew; | |
4725 | ||
4726 | snd_array_init(&spec->kctls, sizeof(*knew), 32); | |
4727 | knew = snd_array_new(&spec->kctls); | |
4728 | if (!knew) | |
4729 | return -ENOMEM; | |
4730 | *knew = alc880_control_templates[type]; | |
4731 | knew->name = kstrdup(name, GFP_KERNEL); | |
4732 | if (!knew->name) | |
4733 | return -ENOMEM; | |
4734 | if (get_amp_nid_(val)) | |
4735 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; | |
4736 | knew->private_value = val; | |
4737 | return 0; | |
4738 | } | |
4739 | ||
4740 | static int add_control_with_pfx(struct alc_spec *spec, int type, | |
4741 | const char *pfx, const char *dir, | |
4742 | const char *sfx, unsigned long val) | |
4743 | { | |
4744 | char name[32]; | |
4745 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); | |
4746 | return add_control(spec, type, name, val); | |
4747 | } | |
4748 | ||
4749 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ | |
4750 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) | |
4751 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ | |
4752 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) | |
4753 | ||
4754 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) | |
4755 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | |
4756 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | |
4757 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | |
4758 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) | |
4759 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | |
4760 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | |
4761 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) | |
4762 | #define ALC880_PIN_CD_NID 0x1c | |
4763 | ||
4764 | /* fill in the dac_nids table from the parsed pin configuration */ | |
4765 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, | |
4766 | const struct auto_pin_cfg *cfg) | |
4767 | { | |
4768 | hda_nid_t nid; | |
4769 | int assigned[4]; | |
4770 | int i, j; | |
4771 | ||
4772 | memset(assigned, 0, sizeof(assigned)); | |
4773 | spec->multiout.dac_nids = spec->private_dac_nids; | |
4774 | ||
4775 | /* check the pins hardwired to audio widget */ | |
4776 | for (i = 0; i < cfg->line_outs; i++) { | |
4777 | nid = cfg->line_out_pins[i]; | |
4778 | if (alc880_is_fixed_pin(nid)) { | |
4779 | int idx = alc880_fixed_pin_idx(nid); | |
4780 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); | |
4781 | assigned[idx] = 1; | |
4782 | } | |
4783 | } | |
4784 | /* left pins can be connect to any audio widget */ | |
4785 | for (i = 0; i < cfg->line_outs; i++) { | |
4786 | nid = cfg->line_out_pins[i]; | |
4787 | if (alc880_is_fixed_pin(nid)) | |
4788 | continue; | |
4789 | /* search for an empty channel */ | |
4790 | for (j = 0; j < cfg->line_outs; j++) { | |
4791 | if (!assigned[j]) { | |
4792 | spec->multiout.dac_nids[i] = | |
4793 | alc880_idx_to_dac(j); | |
4794 | assigned[j] = 1; | |
4795 | break; | |
4796 | } | |
4797 | } | |
4798 | } | |
4799 | spec->multiout.num_dacs = cfg->line_outs; | |
4800 | return 0; | |
4801 | } | |
4802 | ||
4803 | /* add playback controls from the parsed DAC table */ | |
4804 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, | |
4805 | const struct auto_pin_cfg *cfg) | |
4806 | { | |
4807 | static const char *chname[4] = { | |
4808 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
4809 | }; | |
4810 | hda_nid_t nid; | |
4811 | int i, err; | |
4812 | ||
4813 | for (i = 0; i < cfg->line_outs; i++) { | |
4814 | if (!spec->multiout.dac_nids[i]) | |
4815 | continue; | |
4816 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); | |
4817 | if (i == 2) { | |
4818 | /* Center/LFE */ | |
4819 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
4820 | "Center", | |
4821 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | |
4822 | HDA_OUTPUT)); | |
4823 | if (err < 0) | |
4824 | return err; | |
4825 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
4826 | "LFE", | |
4827 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
4828 | HDA_OUTPUT)); | |
4829 | if (err < 0) | |
4830 | return err; | |
4831 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
4832 | "Center", | |
4833 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, | |
4834 | HDA_INPUT)); | |
4835 | if (err < 0) | |
4836 | return err; | |
4837 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
4838 | "LFE", | |
4839 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, | |
4840 | HDA_INPUT)); | |
4841 | if (err < 0) | |
4842 | return err; | |
4843 | } else { | |
4844 | const char *pfx; | |
4845 | if (cfg->line_outs == 1 && | |
4846 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
4847 | pfx = "Speaker"; | |
4848 | else | |
4849 | pfx = chname[i]; | |
4850 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | |
4851 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
4852 | HDA_OUTPUT)); | |
4853 | if (err < 0) | |
4854 | return err; | |
4855 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | |
4856 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, | |
4857 | HDA_INPUT)); | |
4858 | if (err < 0) | |
4859 | return err; | |
4860 | } | |
4861 | } | |
4862 | return 0; | |
4863 | } | |
4864 | ||
4865 | /* add playback controls for speaker and HP outputs */ | |
4866 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
4867 | const char *pfx) | |
4868 | { | |
4869 | hda_nid_t nid; | |
4870 | int err; | |
4871 | ||
4872 | if (!pin) | |
4873 | return 0; | |
4874 | ||
4875 | if (alc880_is_fixed_pin(pin)) { | |
4876 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
4877 | /* specify the DAC as the extra output */ | |
4878 | if (!spec->multiout.hp_nid) | |
4879 | spec->multiout.hp_nid = nid; | |
4880 | else | |
4881 | spec->multiout.extra_out_nid[0] = nid; | |
4882 | /* control HP volume/switch on the output mixer amp */ | |
4883 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); | |
4884 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | |
4885 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
4886 | if (err < 0) | |
4887 | return err; | |
4888 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | |
4889 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); | |
4890 | if (err < 0) | |
4891 | return err; | |
4892 | } else if (alc880_is_multi_pin(pin)) { | |
4893 | /* set manual connection */ | |
4894 | /* we have only a switch on HP-out PIN */ | |
4895 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | |
4896 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
4897 | if (err < 0) | |
4898 | return err; | |
4899 | } | |
4900 | return 0; | |
4901 | } | |
4902 | ||
4903 | /* create input playback/capture controls for the given pin */ | |
4904 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, | |
4905 | const char *ctlname, | |
4906 | int idx, hda_nid_t mix_nid) | |
4907 | { | |
4908 | int err; | |
4909 | ||
4910 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, | |
4911 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | |
4912 | if (err < 0) | |
4913 | return err; | |
4914 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
4915 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | |
4916 | if (err < 0) | |
4917 | return err; | |
4918 | return 0; | |
4919 | } | |
4920 | ||
4921 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) | |
4922 | { | |
4923 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | |
4924 | return (pincap & AC_PINCAP_IN) != 0; | |
4925 | } | |
4926 | ||
4927 | /* create playback/capture controls for input pins */ | |
4928 | static int alc_auto_create_input_ctls(struct hda_codec *codec, | |
4929 | const struct auto_pin_cfg *cfg, | |
4930 | hda_nid_t mixer, | |
4931 | hda_nid_t cap1, hda_nid_t cap2) | |
4932 | { | |
4933 | struct alc_spec *spec = codec->spec; | |
4934 | struct hda_input_mux *imux = &spec->private_imux[0]; | |
4935 | int i, err, idx; | |
4936 | ||
4937 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
4938 | hda_nid_t pin; | |
4939 | ||
4940 | pin = cfg->input_pins[i]; | |
4941 | if (!alc_is_input_pin(codec, pin)) | |
4942 | continue; | |
4943 | ||
4944 | if (mixer) { | |
4945 | idx = get_connection_index(codec, mixer, pin); | |
4946 | if (idx >= 0) { | |
4947 | err = new_analog_input(spec, pin, | |
4948 | auto_pin_cfg_labels[i], | |
4949 | idx, mixer); | |
4950 | if (err < 0) | |
4951 | return err; | |
4952 | } | |
4953 | } | |
4954 | ||
4955 | if (!cap1) | |
4956 | continue; | |
4957 | idx = get_connection_index(codec, cap1, pin); | |
4958 | if (idx < 0 && cap2) | |
4959 | idx = get_connection_index(codec, cap2, pin); | |
4960 | if (idx >= 0) { | |
4961 | imux->items[imux->num_items].label = | |
4962 | auto_pin_cfg_labels[i]; | |
4963 | imux->items[imux->num_items].index = idx; | |
4964 | imux->num_items++; | |
4965 | } | |
4966 | } | |
4967 | return 0; | |
4968 | } | |
4969 | ||
4970 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, | |
4971 | const struct auto_pin_cfg *cfg) | |
4972 | { | |
4973 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); | |
4974 | } | |
4975 | ||
4976 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, | |
4977 | unsigned int pin_type) | |
4978 | { | |
4979 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4980 | pin_type); | |
4981 | /* unmute pin */ | |
4982 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
4983 | AMP_OUT_UNMUTE); | |
4984 | } | |
4985 | ||
4986 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, | |
4987 | hda_nid_t nid, int pin_type, | |
4988 | int dac_idx) | |
4989 | { | |
4990 | alc_set_pin_output(codec, nid, pin_type); | |
4991 | /* need the manual connection? */ | |
4992 | if (alc880_is_multi_pin(nid)) { | |
4993 | struct alc_spec *spec = codec->spec; | |
4994 | int idx = alc880_multi_pin_idx(nid); | |
4995 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
4996 | AC_VERB_SET_CONNECT_SEL, | |
4997 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
4998 | } | |
4999 | } | |
5000 | ||
5001 | static int get_pin_type(int line_out_type) | |
5002 | { | |
5003 | if (line_out_type == AUTO_PIN_HP_OUT) | |
5004 | return PIN_HP; | |
5005 | else | |
5006 | return PIN_OUT; | |
5007 | } | |
5008 | ||
5009 | static void alc880_auto_init_multi_out(struct hda_codec *codec) | |
5010 | { | |
5011 | struct alc_spec *spec = codec->spec; | |
5012 | int i; | |
5013 | ||
5014 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
5015 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
5016 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
5017 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); | |
5018 | } | |
5019 | } | |
5020 | ||
5021 | static void alc880_auto_init_extra_out(struct hda_codec *codec) | |
5022 | { | |
5023 | struct alc_spec *spec = codec->spec; | |
5024 | hda_nid_t pin; | |
5025 | ||
5026 | pin = spec->autocfg.speaker_pins[0]; | |
5027 | if (pin) /* connect to front */ | |
5028 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
5029 | pin = spec->autocfg.hp_pins[0]; | |
5030 | if (pin) /* connect to front */ | |
5031 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
5032 | } | |
5033 | ||
5034 | static void alc880_auto_init_analog_input(struct hda_codec *codec) | |
5035 | { | |
5036 | struct alc_spec *spec = codec->spec; | |
5037 | int i; | |
5038 | ||
5039 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
5040 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
5041 | if (alc_is_input_pin(codec, nid)) { | |
5042 | alc_set_input_pin(codec, nid, i); | |
5043 | if (nid != ALC880_PIN_CD_NID && | |
5044 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
5045 | snd_hda_codec_write(codec, nid, 0, | |
5046 | AC_VERB_SET_AMP_GAIN_MUTE, | |
5047 | AMP_OUT_MUTE); | |
5048 | } | |
5049 | } | |
5050 | } | |
5051 | ||
5052 | static void alc880_auto_init_input_src(struct hda_codec *codec) | |
5053 | { | |
5054 | struct alc_spec *spec = codec->spec; | |
5055 | int c; | |
5056 | ||
5057 | for (c = 0; c < spec->num_adc_nids; c++) { | |
5058 | unsigned int mux_idx; | |
5059 | const struct hda_input_mux *imux; | |
5060 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | |
5061 | imux = &spec->input_mux[mux_idx]; | |
5062 | if (!imux->num_items && mux_idx > 0) | |
5063 | imux = &spec->input_mux[0]; | |
5064 | if (imux) | |
5065 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, | |
5066 | AC_VERB_SET_CONNECT_SEL, | |
5067 | imux->items[0].index); | |
5068 | } | |
5069 | } | |
5070 | ||
5071 | /* parse the BIOS configuration and set up the alc_spec */ | |
5072 | /* return 1 if successful, 0 if the proper config is not found, | |
5073 | * or a negative error code | |
5074 | */ | |
5075 | static int alc880_parse_auto_config(struct hda_codec *codec) | |
5076 | { | |
5077 | struct alc_spec *spec = codec->spec; | |
5078 | int err; | |
5079 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; | |
5080 | ||
5081 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
5082 | alc880_ignore); | |
5083 | if (err < 0) | |
5084 | return err; | |
5085 | if (!spec->autocfg.line_outs) | |
5086 | return 0; /* can't find valid BIOS pin config */ | |
5087 | ||
5088 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | |
5089 | if (err < 0) | |
5090 | return err; | |
5091 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
5092 | if (err < 0) | |
5093 | return err; | |
5094 | err = alc880_auto_create_extra_out(spec, | |
5095 | spec->autocfg.speaker_pins[0], | |
5096 | "Speaker"); | |
5097 | if (err < 0) | |
5098 | return err; | |
5099 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
5100 | "Headphone"); | |
5101 | if (err < 0) | |
5102 | return err; | |
5103 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); | |
5104 | if (err < 0) | |
5105 | return err; | |
5106 | ||
5107 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
5108 | ||
5109 | alc_auto_parse_digital(codec); | |
5110 | ||
5111 | if (spec->kctls.list) | |
5112 | add_mixer(spec, spec->kctls.list); | |
5113 | ||
5114 | add_verb(spec, alc880_volume_init_verbs); | |
5115 | ||
5116 | spec->num_mux_defs = 1; | |
5117 | spec->input_mux = &spec->private_imux[0]; | |
5118 | ||
5119 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
5120 | ||
5121 | return 1; | |
5122 | } | |
5123 | ||
5124 | /* additional initialization for auto-configuration model */ | |
5125 | static void alc880_auto_init(struct hda_codec *codec) | |
5126 | { | |
5127 | struct alc_spec *spec = codec->spec; | |
5128 | alc880_auto_init_multi_out(codec); | |
5129 | alc880_auto_init_extra_out(codec); | |
5130 | alc880_auto_init_analog_input(codec); | |
5131 | alc880_auto_init_input_src(codec); | |
5132 | alc_auto_init_digital(codec); | |
5133 | if (spec->unsol_event) | |
5134 | alc_inithook(codec); | |
5135 | } | |
5136 | ||
5137 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only | |
5138 | * one of two digital mic pins, e.g. on ALC272 | |
5139 | */ | |
5140 | static void fixup_automic_adc(struct hda_codec *codec) | |
5141 | { | |
5142 | struct alc_spec *spec = codec->spec; | |
5143 | int i; | |
5144 | ||
5145 | for (i = 0; i < spec->num_adc_nids; i++) { | |
5146 | hda_nid_t cap = spec->capsrc_nids ? | |
5147 | spec->capsrc_nids[i] : spec->adc_nids[i]; | |
5148 | int iidx, eidx; | |
5149 | ||
5150 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); | |
5151 | if (iidx < 0) | |
5152 | continue; | |
5153 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); | |
5154 | if (eidx < 0) | |
5155 | continue; | |
5156 | spec->int_mic.mux_idx = iidx; | |
5157 | spec->ext_mic.mux_idx = eidx; | |
5158 | if (spec->capsrc_nids) | |
5159 | spec->capsrc_nids += i; | |
5160 | spec->adc_nids += i; | |
5161 | spec->num_adc_nids = 1; | |
5162 | return; | |
5163 | } | |
5164 | snd_printd(KERN_INFO "hda_codec: %s: " | |
5165 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", | |
5166 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); | |
5167 | spec->auto_mic = 0; /* disable auto-mic to be sure */ | |
5168 | } | |
5169 | ||
5170 | /* select or unmute the given capsrc route */ | |
5171 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, | |
5172 | int idx) | |
5173 | { | |
5174 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { | |
5175 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, | |
5176 | HDA_AMP_MUTE, 0); | |
5177 | } else { | |
5178 | snd_hda_codec_write_cache(codec, cap, 0, | |
5179 | AC_VERB_SET_CONNECT_SEL, idx); | |
5180 | } | |
5181 | } | |
5182 | ||
5183 | /* set the default connection to that pin */ | |
5184 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) | |
5185 | { | |
5186 | struct alc_spec *spec = codec->spec; | |
5187 | int i; | |
5188 | ||
5189 | for (i = 0; i < spec->num_adc_nids; i++) { | |
5190 | hda_nid_t cap = spec->capsrc_nids ? | |
5191 | spec->capsrc_nids[i] : spec->adc_nids[i]; | |
5192 | int idx; | |
5193 | ||
5194 | idx = get_connection_index(codec, cap, pin); | |
5195 | if (idx < 0) | |
5196 | continue; | |
5197 | select_or_unmute_capsrc(codec, cap, idx); | |
5198 | return i; /* return the found index */ | |
5199 | } | |
5200 | return -1; /* not found */ | |
5201 | } | |
5202 | ||
5203 | /* choose the ADC/MUX containing the input pin and initialize the setup */ | |
5204 | static void fixup_single_adc(struct hda_codec *codec) | |
5205 | { | |
5206 | struct alc_spec *spec = codec->spec; | |
5207 | hda_nid_t pin = 0; | |
5208 | int i; | |
5209 | ||
5210 | /* search for the input pin; there must be only one */ | |
5211 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
5212 | if (spec->autocfg.input_pins[i]) { | |
5213 | pin = spec->autocfg.input_pins[i]; | |
5214 | break; | |
5215 | } | |
5216 | } | |
5217 | if (!pin) | |
5218 | return; | |
5219 | i = init_capsrc_for_pin(codec, pin); | |
5220 | if (i >= 0) { | |
5221 | /* use only this ADC */ | |
5222 | if (spec->capsrc_nids) | |
5223 | spec->capsrc_nids += i; | |
5224 | spec->adc_nids += i; | |
5225 | spec->num_adc_nids = 1; | |
5226 | } | |
5227 | } | |
5228 | ||
5229 | /* initialize dual adcs */ | |
5230 | static void fixup_dual_adc_switch(struct hda_codec *codec) | |
5231 | { | |
5232 | struct alc_spec *spec = codec->spec; | |
5233 | init_capsrc_for_pin(codec, spec->ext_mic.pin); | |
5234 | init_capsrc_for_pin(codec, spec->int_mic.pin); | |
5235 | } | |
5236 | ||
5237 | static void set_capture_mixer(struct hda_codec *codec) | |
5238 | { | |
5239 | struct alc_spec *spec = codec->spec; | |
5240 | static struct snd_kcontrol_new *caps[2][3] = { | |
5241 | { alc_capture_mixer_nosrc1, | |
5242 | alc_capture_mixer_nosrc2, | |
5243 | alc_capture_mixer_nosrc3 }, | |
5244 | { alc_capture_mixer1, | |
5245 | alc_capture_mixer2, | |
5246 | alc_capture_mixer3 }, | |
5247 | }; | |
5248 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { | |
5249 | int mux = 0; | |
5250 | int num_adcs = spec->num_adc_nids; | |
5251 | if (spec->dual_adc_switch) | |
5252 | fixup_dual_adc_switch(codec); | |
5253 | else if (spec->auto_mic) | |
5254 | fixup_automic_adc(codec); | |
5255 | else if (spec->input_mux) { | |
5256 | if (spec->input_mux->num_items > 1) | |
5257 | mux = 1; | |
5258 | else if (spec->input_mux->num_items == 1) | |
5259 | fixup_single_adc(codec); | |
5260 | } | |
5261 | if (spec->dual_adc_switch) | |
5262 | num_adcs = 1; | |
5263 | spec->cap_mixer = caps[mux][num_adcs - 1]; | |
5264 | } | |
5265 | } | |
5266 | ||
5267 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ | |
5268 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, | |
5269 | int num_nids) | |
5270 | { | |
5271 | struct alc_spec *spec = codec->spec; | |
5272 | int n; | |
5273 | hda_nid_t fallback_adc = 0, fallback_cap = 0; | |
5274 | ||
5275 | for (n = 0; n < num_nids; n++) { | |
5276 | hda_nid_t adc, cap; | |
5277 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | |
5278 | int nconns, i, j; | |
5279 | ||
5280 | adc = nids[n]; | |
5281 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) | |
5282 | continue; | |
5283 | cap = adc; | |
5284 | nconns = snd_hda_get_connections(codec, cap, conn, | |
5285 | ARRAY_SIZE(conn)); | |
5286 | if (nconns == 1) { | |
5287 | cap = conn[0]; | |
5288 | nconns = snd_hda_get_connections(codec, cap, conn, | |
5289 | ARRAY_SIZE(conn)); | |
5290 | } | |
5291 | if (nconns <= 0) | |
5292 | continue; | |
5293 | if (!fallback_adc) { | |
5294 | fallback_adc = adc; | |
5295 | fallback_cap = cap; | |
5296 | } | |
5297 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
5298 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
5299 | if (!nid) | |
5300 | continue; | |
5301 | for (j = 0; j < nconns; j++) { | |
5302 | if (conn[j] == nid) | |
5303 | break; | |
5304 | } | |
5305 | if (j >= nconns) | |
5306 | break; | |
5307 | } | |
5308 | if (i >= AUTO_PIN_LAST) { | |
5309 | int num_adcs = spec->num_adc_nids; | |
5310 | spec->private_adc_nids[num_adcs] = adc; | |
5311 | spec->private_capsrc_nids[num_adcs] = cap; | |
5312 | spec->num_adc_nids++; | |
5313 | spec->adc_nids = spec->private_adc_nids; | |
5314 | if (adc != cap) | |
5315 | spec->capsrc_nids = spec->private_capsrc_nids; | |
5316 | } | |
5317 | } | |
5318 | if (!spec->num_adc_nids) { | |
5319 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" | |
5320 | " using fallback 0x%x\n", | |
5321 | codec->chip_name, fallback_adc); | |
5322 | spec->private_adc_nids[0] = fallback_adc; | |
5323 | spec->adc_nids = spec->private_adc_nids; | |
5324 | if (fallback_adc != fallback_cap) { | |
5325 | spec->private_capsrc_nids[0] = fallback_cap; | |
5326 | spec->capsrc_nids = spec->private_adc_nids; | |
5327 | } | |
5328 | } | |
5329 | } | |
5330 | ||
5331 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | |
5332 | #define set_beep_amp(spec, nid, idx, dir) \ | |
5333 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) | |
5334 | ||
5335 | static struct snd_pci_quirk beep_white_list[] = { | |
5336 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), | |
5337 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), | |
5338 | {} | |
5339 | }; | |
5340 | ||
5341 | static inline int has_cdefine_beep(struct hda_codec *codec) | |
5342 | { | |
5343 | struct alc_spec *spec = codec->spec; | |
5344 | const struct snd_pci_quirk *q; | |
5345 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); | |
5346 | if (q) | |
5347 | return q->value; | |
5348 | return spec->cdefine.enable_pcbeep; | |
5349 | } | |
5350 | #else | |
5351 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ | |
5352 | #define has_cdefine_beep(codec) 0 | |
5353 | #endif | |
5354 | ||
5355 | /* | |
5356 | * OK, here we have finally the patch for ALC880 | |
5357 | */ | |
5358 | ||
5359 | static int patch_alc880(struct hda_codec *codec) | |
5360 | { | |
5361 | struct alc_spec *spec; | |
5362 | int board_config; | |
5363 | int err; | |
5364 | ||
5365 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
5366 | if (spec == NULL) | |
5367 | return -ENOMEM; | |
5368 | ||
5369 | codec->spec = spec; | |
5370 | ||
5371 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, | |
5372 | alc880_models, | |
5373 | alc880_cfg_tbl); | |
5374 | if (board_config < 0) { | |
5375 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
5376 | codec->chip_name); | |
5377 | board_config = ALC880_AUTO; | |
5378 | } | |
5379 | ||
5380 | if (board_config == ALC880_AUTO) { | |
5381 | /* automatic parse from the BIOS config */ | |
5382 | err = alc880_parse_auto_config(codec); | |
5383 | if (err < 0) { | |
5384 | alc_free(codec); | |
5385 | return err; | |
5386 | } else if (!err) { | |
5387 | printk(KERN_INFO | |
5388 | "hda_codec: Cannot set up configuration " | |
5389 | "from BIOS. Using 3-stack mode...\n"); | |
5390 | board_config = ALC880_3ST; | |
5391 | } | |
5392 | } | |
5393 | ||
5394 | err = snd_hda_attach_beep_device(codec, 0x1); | |
5395 | if (err < 0) { | |
5396 | alc_free(codec); | |
5397 | return err; | |
5398 | } | |
5399 | ||
5400 | if (board_config != ALC880_AUTO) | |
5401 | setup_preset(codec, &alc880_presets[board_config]); | |
5402 | ||
5403 | spec->stream_analog_playback = &alc880_pcm_analog_playback; | |
5404 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | |
5405 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | |
5406 | ||
5407 | spec->stream_digital_playback = &alc880_pcm_digital_playback; | |
5408 | spec->stream_digital_capture = &alc880_pcm_digital_capture; | |
5409 | ||
5410 | if (!spec->adc_nids && spec->input_mux) { | |
5411 | /* check whether NID 0x07 is valid */ | |
5412 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); | |
5413 | /* get type */ | |
5414 | wcap = get_wcaps_type(wcap); | |
5415 | if (wcap != AC_WID_AUD_IN) { | |
5416 | spec->adc_nids = alc880_adc_nids_alt; | |
5417 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | |
5418 | } else { | |
5419 | spec->adc_nids = alc880_adc_nids; | |
5420 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | |
5421 | } | |
5422 | } | |
5423 | set_capture_mixer(codec); | |
5424 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
5425 | ||
5426 | spec->vmaster_nid = 0x0c; | |
5427 | ||
5428 | codec->patch_ops = alc_patch_ops; | |
5429 | if (board_config == ALC880_AUTO) | |
5430 | spec->init_hook = alc880_auto_init; | |
5431 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
5432 | if (!spec->loopback.amplist) | |
5433 | spec->loopback.amplist = alc880_loopbacks; | |
5434 | #endif | |
5435 | ||
5436 | return 0; | |
5437 | } | |
5438 | ||
5439 | ||
5440 | /* | |
5441 | * ALC260 support | |
5442 | */ | |
5443 | ||
5444 | static hda_nid_t alc260_dac_nids[1] = { | |
5445 | /* front */ | |
5446 | 0x02, | |
5447 | }; | |
5448 | ||
5449 | static hda_nid_t alc260_adc_nids[1] = { | |
5450 | /* ADC0 */ | |
5451 | 0x04, | |
5452 | }; | |
5453 | ||
5454 | static hda_nid_t alc260_adc_nids_alt[1] = { | |
5455 | /* ADC1 */ | |
5456 | 0x05, | |
5457 | }; | |
5458 | ||
5459 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that | |
5460 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. | |
5461 | */ | |
5462 | static hda_nid_t alc260_dual_adc_nids[2] = { | |
5463 | /* ADC0, ADC1 */ | |
5464 | 0x04, 0x05 | |
5465 | }; | |
5466 | ||
5467 | #define ALC260_DIGOUT_NID 0x03 | |
5468 | #define ALC260_DIGIN_NID 0x06 | |
5469 | ||
5470 | static struct hda_input_mux alc260_capture_source = { | |
5471 | .num_items = 4, | |
5472 | .items = { | |
5473 | { "Mic", 0x0 }, | |
5474 | { "Front Mic", 0x1 }, | |
5475 | { "Line", 0x2 }, | |
5476 | { "CD", 0x4 }, | |
5477 | }, | |
5478 | }; | |
5479 | ||
5480 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, | |
5481 | * headphone jack and the internal CD lines since these are the only pins at | |
5482 | * which audio can appear. For flexibility, also allow the option of | |
5483 | * recording the mixer output on the second ADC (ADC0 doesn't have a | |
5484 | * connection to the mixer output). | |
5485 | */ | |
5486 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { | |
5487 | { | |
5488 | .num_items = 3, | |
5489 | .items = { | |
5490 | { "Mic/Line", 0x0 }, | |
5491 | { "CD", 0x4 }, | |
5492 | { "Headphone", 0x2 }, | |
5493 | }, | |
5494 | }, | |
5495 | { | |
5496 | .num_items = 4, | |
5497 | .items = { | |
5498 | { "Mic/Line", 0x0 }, | |
5499 | { "CD", 0x4 }, | |
5500 | { "Headphone", 0x2 }, | |
5501 | { "Mixer", 0x5 }, | |
5502 | }, | |
5503 | }, | |
5504 | ||
5505 | }; | |
5506 | ||
5507 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to | |
5508 | * the Fujitsu S702x, but jacks are marked differently. | |
5509 | */ | |
5510 | static struct hda_input_mux alc260_acer_capture_sources[2] = { | |
5511 | { | |
5512 | .num_items = 4, | |
5513 | .items = { | |
5514 | { "Mic", 0x0 }, | |
5515 | { "Line", 0x2 }, | |
5516 | { "CD", 0x4 }, | |
5517 | { "Headphone", 0x5 }, | |
5518 | }, | |
5519 | }, | |
5520 | { | |
5521 | .num_items = 5, | |
5522 | .items = { | |
5523 | { "Mic", 0x0 }, | |
5524 | { "Line", 0x2 }, | |
5525 | { "CD", 0x4 }, | |
5526 | { "Headphone", 0x6 }, | |
5527 | { "Mixer", 0x5 }, | |
5528 | }, | |
5529 | }, | |
5530 | }; | |
5531 | ||
5532 | /* Maxdata Favorit 100XS */ | |
5533 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { | |
5534 | { | |
5535 | .num_items = 2, | |
5536 | .items = { | |
5537 | { "Line/Mic", 0x0 }, | |
5538 | { "CD", 0x4 }, | |
5539 | }, | |
5540 | }, | |
5541 | { | |
5542 | .num_items = 3, | |
5543 | .items = { | |
5544 | { "Line/Mic", 0x0 }, | |
5545 | { "CD", 0x4 }, | |
5546 | { "Mixer", 0x5 }, | |
5547 | }, | |
5548 | }, | |
5549 | }; | |
5550 | ||
5551 | /* | |
5552 | * This is just place-holder, so there's something for alc_build_pcms to look | |
5553 | * at when it calculates the maximum number of channels. ALC260 has no mixer | |
5554 | * element which allows changing the channel mode, so the verb list is | |
5555 | * never used. | |
5556 | */ | |
5557 | static struct hda_channel_mode alc260_modes[1] = { | |
5558 | { 2, NULL }, | |
5559 | }; | |
5560 | ||
5561 | ||
5562 | /* Mixer combinations | |
5563 | * | |
5564 | * basic: base_output + input + pc_beep + capture | |
5565 | * HP: base_output + input + capture_alt | |
5566 | * HP_3013: hp_3013 + input + capture | |
5567 | * fujitsu: fujitsu + capture | |
5568 | * acer: acer + capture | |
5569 | */ | |
5570 | ||
5571 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { | |
5572 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5573 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | |
5574 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5575 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | |
5576 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
5577 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
5578 | { } /* end */ | |
5579 | }; | |
5580 | ||
5581 | static struct snd_kcontrol_new alc260_input_mixer[] = { | |
5582 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5583 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5584 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5585 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5586 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5587 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5588 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), | |
5589 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), | |
5590 | { } /* end */ | |
5591 | }; | |
5592 | ||
5593 | /* update HP, line and mono out pins according to the master switch */ | |
5594 | static void alc260_hp_master_update(struct hda_codec *codec, | |
5595 | hda_nid_t hp, hda_nid_t line, | |
5596 | hda_nid_t mono) | |
5597 | { | |
5598 | struct alc_spec *spec = codec->spec; | |
5599 | unsigned int val = spec->master_sw ? PIN_HP : 0; | |
5600 | /* change HP and line-out pins */ | |
5601 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5602 | val); | |
5603 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5604 | val); | |
5605 | /* mono (speaker) depending on the HP jack sense */ | |
5606 | val = (val && !spec->jack_present) ? PIN_OUT : 0; | |
5607 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5608 | val); | |
5609 | } | |
5610 | ||
5611 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, | |
5612 | struct snd_ctl_elem_value *ucontrol) | |
5613 | { | |
5614 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5615 | struct alc_spec *spec = codec->spec; | |
5616 | *ucontrol->value.integer.value = spec->master_sw; | |
5617 | return 0; | |
5618 | } | |
5619 | ||
5620 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
5621 | struct snd_ctl_elem_value *ucontrol) | |
5622 | { | |
5623 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5624 | struct alc_spec *spec = codec->spec; | |
5625 | int val = !!*ucontrol->value.integer.value; | |
5626 | hda_nid_t hp, line, mono; | |
5627 | ||
5628 | if (val == spec->master_sw) | |
5629 | return 0; | |
5630 | spec->master_sw = val; | |
5631 | hp = (kcontrol->private_value >> 16) & 0xff; | |
5632 | line = (kcontrol->private_value >> 8) & 0xff; | |
5633 | mono = kcontrol->private_value & 0xff; | |
5634 | alc260_hp_master_update(codec, hp, line, mono); | |
5635 | return 1; | |
5636 | } | |
5637 | ||
5638 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { | |
5639 | { | |
5640 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5641 | .name = "Master Playback Switch", | |
5642 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, | |
5643 | .info = snd_ctl_boolean_mono_info, | |
5644 | .get = alc260_hp_master_sw_get, | |
5645 | .put = alc260_hp_master_sw_put, | |
5646 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 | |
5647 | }, | |
5648 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5649 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | |
5650 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5651 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | |
5652 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | |
5653 | HDA_OUTPUT), | |
5654 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
5655 | { } /* end */ | |
5656 | }; | |
5657 | ||
5658 | static struct hda_verb alc260_hp_unsol_verbs[] = { | |
5659 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5660 | {}, | |
5661 | }; | |
5662 | ||
5663 | static void alc260_hp_automute(struct hda_codec *codec) | |
5664 | { | |
5665 | struct alc_spec *spec = codec->spec; | |
5666 | ||
5667 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); | |
5668 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); | |
5669 | } | |
5670 | ||
5671 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) | |
5672 | { | |
5673 | if ((res >> 26) == ALC880_HP_EVENT) | |
5674 | alc260_hp_automute(codec); | |
5675 | } | |
5676 | ||
5677 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { | |
5678 | { | |
5679 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5680 | .name = "Master Playback Switch", | |
5681 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, | |
5682 | .info = snd_ctl_boolean_mono_info, | |
5683 | .get = alc260_hp_master_sw_get, | |
5684 | .put = alc260_hp_master_sw_put, | |
5685 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 | |
5686 | }, | |
5687 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5688 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
5689 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), | |
5690 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), | |
5691 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5692 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
5693 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
5694 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), | |
5695 | { } /* end */ | |
5696 | }; | |
5697 | ||
5698 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { | |
5699 | .ops = &snd_hda_bind_vol, | |
5700 | .values = { | |
5701 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), | |
5702 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | |
5703 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), | |
5704 | 0 | |
5705 | }, | |
5706 | }; | |
5707 | ||
5708 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { | |
5709 | .ops = &snd_hda_bind_sw, | |
5710 | .values = { | |
5711 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), | |
5712 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
5713 | 0 | |
5714 | }, | |
5715 | }; | |
5716 | ||
5717 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { | |
5718 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), | |
5719 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), | |
5720 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), | |
5721 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
5722 | { } /* end */ | |
5723 | }; | |
5724 | ||
5725 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { | |
5726 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5727 | {}, | |
5728 | }; | |
5729 | ||
5730 | static void alc260_hp_3013_automute(struct hda_codec *codec) | |
5731 | { | |
5732 | struct alc_spec *spec = codec->spec; | |
5733 | ||
5734 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | |
5735 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); | |
5736 | } | |
5737 | ||
5738 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, | |
5739 | unsigned int res) | |
5740 | { | |
5741 | if ((res >> 26) == ALC880_HP_EVENT) | |
5742 | alc260_hp_3013_automute(codec); | |
5743 | } | |
5744 | ||
5745 | static void alc260_hp_3012_automute(struct hda_codec *codec) | |
5746 | { | |
5747 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; | |
5748 | ||
5749 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5750 | bits); | |
5751 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5752 | bits); | |
5753 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5754 | bits); | |
5755 | } | |
5756 | ||
5757 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, | |
5758 | unsigned int res) | |
5759 | { | |
5760 | if ((res >> 26) == ALC880_HP_EVENT) | |
5761 | alc260_hp_3012_automute(codec); | |
5762 | } | |
5763 | ||
5764 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | |
5765 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. | |
5766 | */ | |
5767 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { | |
5768 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5769 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), | |
5770 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
5771 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5772 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5773 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5774 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5775 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5776 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5777 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), | |
5778 | { } /* end */ | |
5779 | }; | |
5780 | ||
5781 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current | |
5782 | * versions of the ALC260 don't act on requests to enable mic bias from NID | |
5783 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 | |
5784 | * datasheet doesn't mention this restriction. At this stage it's not clear | |
5785 | * whether this behaviour is intentional or is a hardware bug in chip | |
5786 | * revisions available in early 2006. Therefore for now allow the | |
5787 | * "Headphone Jack Mode" control to span all choices, but if it turns out | |
5788 | * that the lack of mic bias for this NID is intentional we could change the | |
5789 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
5790 | * | |
5791 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 | |
5792 | * don't appear to make the mic bias available from the "line" jack, even | |
5793 | * though the NID used for this jack (0x14) can supply it. The theory is | |
5794 | * that perhaps Acer have included blocking capacitors between the ALC260 | |
5795 | * and the output jack. If this turns out to be the case for all such | |
5796 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT | |
5797 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
5798 | * | |
5799 | * The C20x Tablet series have a mono internal speaker which is controlled | |
5800 | * via the chip's Mono sum widget and pin complex, so include the necessary | |
5801 | * controls for such models. On models without a "mono speaker" the control | |
5802 | * won't do anything. | |
5803 | */ | |
5804 | static struct snd_kcontrol_new alc260_acer_mixer[] = { | |
5805 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5806 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
5807 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | |
5808 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | |
5809 | HDA_OUTPUT), | |
5810 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, | |
5811 | HDA_INPUT), | |
5812 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5813 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5816 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5817 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5818 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5819 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
5820 | { } /* end */ | |
5821 | }; | |
5822 | ||
5823 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack | |
5824 | */ | |
5825 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { | |
5826 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5827 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
5828 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | |
5829 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5830 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5831 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5832 | { } /* end */ | |
5833 | }; | |
5834 | ||
5835 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, | |
5836 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. | |
5837 | */ | |
5838 | static struct snd_kcontrol_new alc260_will_mixer[] = { | |
5839 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5840 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
5841 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5842 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5843 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5844 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5845 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5846 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
5847 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5848 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5849 | { } /* end */ | |
5850 | }; | |
5851 | ||
5852 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, | |
5853 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. | |
5854 | */ | |
5855 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { | |
5856 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5857 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
5858 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5859 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5860 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5861 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), | |
5862 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), | |
5863 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5864 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5865 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
5866 | { } /* end */ | |
5867 | }; | |
5868 | ||
5869 | /* | |
5870 | * initialization verbs | |
5871 | */ | |
5872 | static struct hda_verb alc260_init_verbs[] = { | |
5873 | /* Line In pin widget for input */ | |
5874 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
5875 | /* CD pin widget for input */ | |
5876 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
5877 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
5878 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
5879 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
5880 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
5881 | /* LINE-2 is used for line-out in rear */ | |
5882 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5883 | /* select line-out */ | |
5884 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5885 | /* LINE-OUT pin */ | |
5886 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5887 | /* enable HP */ | |
5888 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5889 | /* enable Mono */ | |
5890 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5891 | /* mute capture amp left and right */ | |
5892 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5893 | /* set connection select to line in (default select for this ADC) */ | |
5894 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
5895 | /* mute capture amp left and right */ | |
5896 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5897 | /* set connection select to line in (default select for this ADC) */ | |
5898 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
5899 | /* set vol=0 Line-Out mixer amp left and right */ | |
5900 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5901 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
5902 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5903 | /* set vol=0 HP mixer amp left and right */ | |
5904 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5905 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
5906 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5907 | /* set vol=0 Mono mixer amp left and right */ | |
5908 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5909 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
5910 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5911 | /* unmute LINE-2 out pin */ | |
5912 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5913 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | |
5914 | * Line In 2 = 0x03 | |
5915 | */ | |
5916 | /* mute analog inputs */ | |
5917 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5918 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5919 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5920 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5921 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5922 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | |
5923 | /* mute Front out path */ | |
5924 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5925 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5926 | /* mute Headphone out path */ | |
5927 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5928 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5929 | /* mute Mono out path */ | |
5930 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5931 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5932 | { } | |
5933 | }; | |
5934 | ||
5935 | #if 0 /* should be identical with alc260_init_verbs? */ | |
5936 | static struct hda_verb alc260_hp_init_verbs[] = { | |
5937 | /* Headphone and output */ | |
5938 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
5939 | /* mono output */ | |
5940 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5941 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
5942 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5943 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
5944 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5945 | /* Line In pin widget for input */ | |
5946 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
5947 | /* Line-2 pin widget for output */ | |
5948 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5949 | /* CD pin widget for input */ | |
5950 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
5951 | /* unmute amp left and right */ | |
5952 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
5953 | /* set connection select to line in (default select for this ADC) */ | |
5954 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
5955 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
5956 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
5957 | /* mute pin widget amp left and right (no gain on this amp) */ | |
5958 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
5959 | /* unmute HP mixer amp left and right (volume = 0) */ | |
5960 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
5961 | /* mute pin widget amp left and right (no gain on this amp) */ | |
5962 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
5963 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | |
5964 | * Line In 2 = 0x03 | |
5965 | */ | |
5966 | /* mute analog inputs */ | |
5967 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5968 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5969 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5970 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5971 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5972 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | |
5973 | /* Unmute Front out path */ | |
5974 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5975 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
5976 | /* Unmute Headphone out path */ | |
5977 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5978 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
5979 | /* Unmute Mono out path */ | |
5980 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5981 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
5982 | { } | |
5983 | }; | |
5984 | #endif | |
5985 | ||
5986 | static struct hda_verb alc260_hp_3013_init_verbs[] = { | |
5987 | /* Line out and output */ | |
5988 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5989 | /* mono output */ | |
5990 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5991 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
5992 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5993 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
5994 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5995 | /* Line In pin widget for input */ | |
5996 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
5997 | /* Headphone pin widget for output */ | |
5998 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
5999 | /* CD pin widget for input */ | |
6000 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6001 | /* unmute amp left and right */ | |
6002 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
6003 | /* set connection select to line in (default select for this ADC) */ | |
6004 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
6005 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
6006 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6007 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6008 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
6009 | /* unmute HP mixer amp left and right (volume = 0) */ | |
6010 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6011 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6012 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
6013 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | |
6014 | * Line In 2 = 0x03 | |
6015 | */ | |
6016 | /* mute analog inputs */ | |
6017 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6018 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6019 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6020 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6021 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6022 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | |
6023 | /* Unmute Front out path */ | |
6024 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6025 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6026 | /* Unmute Headphone out path */ | |
6027 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6028 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6029 | /* Unmute Mono out path */ | |
6030 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6031 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6032 | { } | |
6033 | }; | |
6034 | ||
6035 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x | |
6036 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD | |
6037 | * audio = 0x16, internal speaker = 0x10. | |
6038 | */ | |
6039 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | |
6040 | /* Disable all GPIOs */ | |
6041 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, | |
6042 | /* Internal speaker is connected to headphone pin */ | |
6043 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6044 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ | |
6045 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6046 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ | |
6047 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6048 | /* Ensure all other unused pins are disabled and muted. */ | |
6049 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6050 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6051 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6052 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6053 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6054 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6055 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6056 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6057 | ||
6058 | /* Disable digital (SPDIF) pins */ | |
6059 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6060 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6061 | ||
6062 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus | |
6063 | * when acting as an output. | |
6064 | */ | |
6065 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6066 | ||
6067 | /* Start with output sum widgets muted and their output gains at min */ | |
6068 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6069 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6070 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6071 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6072 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6073 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6074 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6075 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6076 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6077 | ||
6078 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ | |
6079 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6080 | /* Unmute Line1 pin widget output buffer since it starts as an output. | |
6081 | * If the pin mode is changed by the user the pin mode control will | |
6082 | * take care of enabling the pin's input/output buffers as needed. | |
6083 | * Therefore there's no need to enable the input buffer at this | |
6084 | * stage. | |
6085 | */ | |
6086 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6087 | /* Unmute input buffer of pin widget used for Line-in (no equiv | |
6088 | * mixer ctrl) | |
6089 | */ | |
6090 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6091 | ||
6092 | /* Mute capture amp left and right */ | |
6093 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6094 | /* Set ADC connection select to match default mixer setting - line | |
6095 | * in (on mic1 pin) | |
6096 | */ | |
6097 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6098 | ||
6099 | /* Do the same for the second ADC: mute capture input amp and | |
6100 | * set ADC connection to line in (on mic1 pin) | |
6101 | */ | |
6102 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6103 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6104 | ||
6105 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6106 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6107 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6108 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6109 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6110 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6111 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6112 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6113 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6114 | ||
6115 | { } | |
6116 | }; | |
6117 | ||
6118 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and | |
6119 | * similar laptops (adapted from Fujitsu init verbs). | |
6120 | */ | |
6121 | static struct hda_verb alc260_acer_init_verbs[] = { | |
6122 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and | |
6123 | * the headphone jack. Turn this on and rely on the standard mute | |
6124 | * methods whenever the user wants to turn these outputs off. | |
6125 | */ | |
6126 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6127 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6128 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
6129 | /* Internal speaker/Headphone jack is connected to Line-out pin */ | |
6130 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6131 | /* Internal microphone/Mic jack is connected to Mic1 pin */ | |
6132 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
6133 | /* Line In jack is connected to Line1 pin */ | |
6134 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6135 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ | |
6136 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6137 | /* Ensure all other unused pins are disabled and muted. */ | |
6138 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6139 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6140 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6141 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6142 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6143 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6144 | /* Disable digital (SPDIF) pins */ | |
6145 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6146 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6147 | ||
6148 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | |
6149 | * bus when acting as outputs. | |
6150 | */ | |
6151 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6152 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6153 | ||
6154 | /* Start with output sum widgets muted and their output gains at min */ | |
6155 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6156 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6157 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6158 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6159 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6160 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6161 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6162 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6163 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6164 | ||
6165 | /* Unmute Line-out pin widget amp left and right | |
6166 | * (no equiv mixer ctrl) | |
6167 | */ | |
6168 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6169 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ | |
6170 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6171 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as | |
6172 | * inputs. If the pin mode is changed by the user the pin mode control | |
6173 | * will take care of enabling the pin's input/output buffers as needed. | |
6174 | * Therefore there's no need to enable the input buffer at this | |
6175 | * stage. | |
6176 | */ | |
6177 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6178 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6179 | ||
6180 | /* Mute capture amp left and right */ | |
6181 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6182 | /* Set ADC connection select to match default mixer setting - mic | |
6183 | * (on mic1 pin) | |
6184 | */ | |
6185 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6186 | ||
6187 | /* Do similar with the second ADC: mute capture input amp and | |
6188 | * set ADC connection to mic to match ALSA's default state. | |
6189 | */ | |
6190 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6191 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6192 | ||
6193 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6194 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6195 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6196 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6197 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6198 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6199 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6200 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6201 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6202 | ||
6203 | { } | |
6204 | }; | |
6205 | ||
6206 | /* Initialisation sequence for Maxdata Favorit 100XS | |
6207 | * (adapted from Acer init verbs). | |
6208 | */ | |
6209 | static struct hda_verb alc260_favorit100_init_verbs[] = { | |
6210 | /* GPIO 0 enables the output jack. | |
6211 | * Turn this on and rely on the standard mute | |
6212 | * methods whenever the user wants to turn these outputs off. | |
6213 | */ | |
6214 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6215 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6216 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
6217 | /* Line/Mic input jack is connected to Mic1 pin */ | |
6218 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
6219 | /* Ensure all other unused pins are disabled and muted. */ | |
6220 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6221 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6222 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6223 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6224 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6225 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6226 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6227 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6228 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6229 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6230 | /* Disable digital (SPDIF) pins */ | |
6231 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6232 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6233 | ||
6234 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | |
6235 | * bus when acting as outputs. | |
6236 | */ | |
6237 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6238 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6239 | ||
6240 | /* Start with output sum widgets muted and their output gains at min */ | |
6241 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6242 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6243 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6244 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6245 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6246 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6247 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6248 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6249 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6250 | ||
6251 | /* Unmute Line-out pin widget amp left and right | |
6252 | * (no equiv mixer ctrl) | |
6253 | */ | |
6254 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6255 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as | |
6256 | * inputs. If the pin mode is changed by the user the pin mode control | |
6257 | * will take care of enabling the pin's input/output buffers as needed. | |
6258 | * Therefore there's no need to enable the input buffer at this | |
6259 | * stage. | |
6260 | */ | |
6261 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6262 | ||
6263 | /* Mute capture amp left and right */ | |
6264 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6265 | /* Set ADC connection select to match default mixer setting - mic | |
6266 | * (on mic1 pin) | |
6267 | */ | |
6268 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6269 | ||
6270 | /* Do similar with the second ADC: mute capture input amp and | |
6271 | * set ADC connection to mic to match ALSA's default state. | |
6272 | */ | |
6273 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6274 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6275 | ||
6276 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6277 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6278 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6279 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6280 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6281 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6282 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6283 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6284 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6285 | ||
6286 | { } | |
6287 | }; | |
6288 | ||
6289 | static struct hda_verb alc260_will_verbs[] = { | |
6290 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6291 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6292 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6293 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
6294 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
6295 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, | |
6296 | {} | |
6297 | }; | |
6298 | ||
6299 | static struct hda_verb alc260_replacer_672v_verbs[] = { | |
6300 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
6301 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
6302 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, | |
6303 | ||
6304 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6305 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6306 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
6307 | ||
6308 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6309 | {} | |
6310 | }; | |
6311 | ||
6312 | /* toggle speaker-output according to the hp-jack state */ | |
6313 | static void alc260_replacer_672v_automute(struct hda_codec *codec) | |
6314 | { | |
6315 | unsigned int present; | |
6316 | ||
6317 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ | |
6318 | present = snd_hda_jack_detect(codec, 0x0f); | |
6319 | if (present) { | |
6320 | snd_hda_codec_write_cache(codec, 0x01, 0, | |
6321 | AC_VERB_SET_GPIO_DATA, 1); | |
6322 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
6323 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6324 | PIN_HP); | |
6325 | } else { | |
6326 | snd_hda_codec_write_cache(codec, 0x01, 0, | |
6327 | AC_VERB_SET_GPIO_DATA, 0); | |
6328 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
6329 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6330 | PIN_OUT); | |
6331 | } | |
6332 | } | |
6333 | ||
6334 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, | |
6335 | unsigned int res) | |
6336 | { | |
6337 | if ((res >> 26) == ALC880_HP_EVENT) | |
6338 | alc260_replacer_672v_automute(codec); | |
6339 | } | |
6340 | ||
6341 | static struct hda_verb alc260_hp_dc7600_verbs[] = { | |
6342 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6343 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6344 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6345 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6346 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6347 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6348 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6349 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6350 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6351 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6352 | {} | |
6353 | }; | |
6354 | ||
6355 | /* Test configuration for debugging, modelled after the ALC880 test | |
6356 | * configuration. | |
6357 | */ | |
6358 | #ifdef CONFIG_SND_DEBUG | |
6359 | static hda_nid_t alc260_test_dac_nids[1] = { | |
6360 | 0x02, | |
6361 | }; | |
6362 | static hda_nid_t alc260_test_adc_nids[2] = { | |
6363 | 0x04, 0x05, | |
6364 | }; | |
6365 | /* For testing the ALC260, each input MUX needs its own definition since | |
6366 | * the signal assignments are different. This assumes that the first ADC | |
6367 | * is NID 0x04. | |
6368 | */ | |
6369 | static struct hda_input_mux alc260_test_capture_sources[2] = { | |
6370 | { | |
6371 | .num_items = 7, | |
6372 | .items = { | |
6373 | { "MIC1 pin", 0x0 }, | |
6374 | { "MIC2 pin", 0x1 }, | |
6375 | { "LINE1 pin", 0x2 }, | |
6376 | { "LINE2 pin", 0x3 }, | |
6377 | { "CD pin", 0x4 }, | |
6378 | { "LINE-OUT pin", 0x5 }, | |
6379 | { "HP-OUT pin", 0x6 }, | |
6380 | }, | |
6381 | }, | |
6382 | { | |
6383 | .num_items = 8, | |
6384 | .items = { | |
6385 | { "MIC1 pin", 0x0 }, | |
6386 | { "MIC2 pin", 0x1 }, | |
6387 | { "LINE1 pin", 0x2 }, | |
6388 | { "LINE2 pin", 0x3 }, | |
6389 | { "CD pin", 0x4 }, | |
6390 | { "Mixer", 0x5 }, | |
6391 | { "LINE-OUT pin", 0x6 }, | |
6392 | { "HP-OUT pin", 0x7 }, | |
6393 | }, | |
6394 | }, | |
6395 | }; | |
6396 | static struct snd_kcontrol_new alc260_test_mixer[] = { | |
6397 | /* Output driver widgets */ | |
6398 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
6399 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
6400 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
6401 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), | |
6402 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6403 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), | |
6404 | ||
6405 | /* Modes for retasking pin widgets | |
6406 | * Note: the ALC260 doesn't seem to act on requests to enable mic | |
6407 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't | |
6408 | * mention this restriction. At this stage it's not clear whether | |
6409 | * this behaviour is intentional or is a hardware bug in chip | |
6410 | * revisions available at least up until early 2006. Therefore for | |
6411 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all | |
6412 | * choices, but if it turns out that the lack of mic bias for these | |
6413 | * NIDs is intentional we could change their modes from | |
6414 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
6415 | */ | |
6416 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), | |
6417 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), | |
6418 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
6419 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
6420 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), | |
6421 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), | |
6422 | ||
6423 | /* Loopback mixer controls */ | |
6424 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), | |
6425 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), | |
6426 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), | |
6427 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), | |
6428 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), | |
6429 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), | |
6430 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), | |
6431 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), | |
6432 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
6433 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
6434 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), | |
6435 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), | |
6436 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), | |
6437 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), | |
6438 | ||
6439 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
6440 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
6441 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
6442 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
6443 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
6444 | ||
6445 | /* Switches to allow the digital IO pins to be enabled. The datasheet | |
6446 | * is ambigious as to which NID is which; testing on laptops which | |
6447 | * make this output available should provide clarification. | |
6448 | */ | |
6449 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | |
6450 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | |
6451 | ||
6452 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | |
6453 | * this output to turn on an external amplifier. | |
6454 | */ | |
6455 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
6456 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
6457 | ||
6458 | { } /* end */ | |
6459 | }; | |
6460 | static struct hda_verb alc260_test_init_verbs[] = { | |
6461 | /* Enable all GPIOs as outputs with an initial value of 0 */ | |
6462 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, | |
6463 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
6464 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, | |
6465 | ||
6466 | /* Enable retasking pins as output, initially without power amp */ | |
6467 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6468 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6469 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6470 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6471 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6472 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6473 | ||
6474 | /* Disable digital (SPDIF) pins initially, but users can enable | |
6475 | * them via a mixer switch. In the case of SPDIF-out, this initverb | |
6476 | * payload also sets the generation to 0, output to be in "consumer" | |
6477 | * PCM format, copyright asserted, no pre-emphasis and no validity | |
6478 | * control. | |
6479 | */ | |
6480 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6481 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6482 | ||
6483 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the | |
6484 | * OUT1 sum bus when acting as an output. | |
6485 | */ | |
6486 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6487 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, | |
6488 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6489 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, | |
6490 | ||
6491 | /* Start with output sum widgets muted and their output gains at min */ | |
6492 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6493 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6494 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6495 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6496 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6497 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6498 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6499 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6500 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6501 | ||
6502 | /* Unmute retasking pin widget output buffers since the default | |
6503 | * state appears to be output. As the pin mode is changed by the | |
6504 | * user the pin mode control will take care of enabling the pin's | |
6505 | * input/output buffers as needed. | |
6506 | */ | |
6507 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6508 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6509 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6510 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6511 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6512 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6513 | /* Also unmute the mono-out pin widget */ | |
6514 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6515 | ||
6516 | /* Mute capture amp left and right */ | |
6517 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6518 | /* Set ADC connection select to match default mixer setting (mic1 | |
6519 | * pin) | |
6520 | */ | |
6521 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6522 | ||
6523 | /* Do the same for the second ADC: mute capture input amp and | |
6524 | * set ADC connection to mic1 pin | |
6525 | */ | |
6526 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6527 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6528 | ||
6529 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6530 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6531 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6532 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6533 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6534 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6535 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6536 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6537 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6538 | ||
6539 | { } | |
6540 | }; | |
6541 | #endif | |
6542 | ||
6543 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback | |
6544 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture | |
6545 | ||
6546 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback | |
6547 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture | |
6548 | ||
6549 | /* | |
6550 | * for BIOS auto-configuration | |
6551 | */ | |
6552 | ||
6553 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, | |
6554 | const char *pfx, int *vol_bits) | |
6555 | { | |
6556 | hda_nid_t nid_vol; | |
6557 | unsigned long vol_val, sw_val; | |
6558 | int err; | |
6559 | ||
6560 | if (nid >= 0x0f && nid < 0x11) { | |
6561 | nid_vol = nid - 0x7; | |
6562 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
6563 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
6564 | } else if (nid == 0x11) { | |
6565 | nid_vol = nid - 0x7; | |
6566 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); | |
6567 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
6568 | } else if (nid >= 0x12 && nid <= 0x15) { | |
6569 | nid_vol = 0x08; | |
6570 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
6571 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
6572 | } else | |
6573 | return 0; /* N/A */ | |
6574 | ||
6575 | if (!(*vol_bits & (1 << nid_vol))) { | |
6576 | /* first control for the volume widget */ | |
6577 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val); | |
6578 | if (err < 0) | |
6579 | return err; | |
6580 | *vol_bits |= (1 << nid_vol); | |
6581 | } | |
6582 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val); | |
6583 | if (err < 0) | |
6584 | return err; | |
6585 | return 1; | |
6586 | } | |
6587 | ||
6588 | /* add playback controls from the parsed DAC table */ | |
6589 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |
6590 | const struct auto_pin_cfg *cfg) | |
6591 | { | |
6592 | hda_nid_t nid; | |
6593 | int err; | |
6594 | int vols = 0; | |
6595 | ||
6596 | spec->multiout.num_dacs = 1; | |
6597 | spec->multiout.dac_nids = spec->private_dac_nids; | |
6598 | spec->multiout.dac_nids[0] = 0x02; | |
6599 | ||
6600 | nid = cfg->line_out_pins[0]; | |
6601 | if (nid) { | |
6602 | const char *pfx; | |
6603 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) | |
6604 | pfx = "Master"; | |
6605 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
6606 | pfx = "Speaker"; | |
6607 | else | |
6608 | pfx = "Front"; | |
6609 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); | |
6610 | if (err < 0) | |
6611 | return err; | |
6612 | } | |
6613 | ||
6614 | nid = cfg->speaker_pins[0]; | |
6615 | if (nid) { | |
6616 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); | |
6617 | if (err < 0) | |
6618 | return err; | |
6619 | } | |
6620 | ||
6621 | nid = cfg->hp_pins[0]; | |
6622 | if (nid) { | |
6623 | err = alc260_add_playback_controls(spec, nid, "Headphone", | |
6624 | &vols); | |
6625 | if (err < 0) | |
6626 | return err; | |
6627 | } | |
6628 | return 0; | |
6629 | } | |
6630 | ||
6631 | /* create playback/capture controls for input pins */ | |
6632 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, | |
6633 | const struct auto_pin_cfg *cfg) | |
6634 | { | |
6635 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); | |
6636 | } | |
6637 | ||
6638 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |
6639 | hda_nid_t nid, int pin_type, | |
6640 | int sel_idx) | |
6641 | { | |
6642 | alc_set_pin_output(codec, nid, pin_type); | |
6643 | /* need the manual connection? */ | |
6644 | if (nid >= 0x12) { | |
6645 | int idx = nid - 0x12; | |
6646 | snd_hda_codec_write(codec, idx + 0x0b, 0, | |
6647 | AC_VERB_SET_CONNECT_SEL, sel_idx); | |
6648 | } | |
6649 | } | |
6650 | ||
6651 | static void alc260_auto_init_multi_out(struct hda_codec *codec) | |
6652 | { | |
6653 | struct alc_spec *spec = codec->spec; | |
6654 | hda_nid_t nid; | |
6655 | ||
6656 | nid = spec->autocfg.line_out_pins[0]; | |
6657 | if (nid) { | |
6658 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
6659 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); | |
6660 | } | |
6661 | ||
6662 | nid = spec->autocfg.speaker_pins[0]; | |
6663 | if (nid) | |
6664 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | |
6665 | ||
6666 | nid = spec->autocfg.hp_pins[0]; | |
6667 | if (nid) | |
6668 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); | |
6669 | } | |
6670 | ||
6671 | #define ALC260_PIN_CD_NID 0x16 | |
6672 | static void alc260_auto_init_analog_input(struct hda_codec *codec) | |
6673 | { | |
6674 | struct alc_spec *spec = codec->spec; | |
6675 | int i; | |
6676 | ||
6677 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
6678 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
6679 | if (nid >= 0x12) { | |
6680 | alc_set_input_pin(codec, nid, i); | |
6681 | if (nid != ALC260_PIN_CD_NID && | |
6682 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
6683 | snd_hda_codec_write(codec, nid, 0, | |
6684 | AC_VERB_SET_AMP_GAIN_MUTE, | |
6685 | AMP_OUT_MUTE); | |
6686 | } | |
6687 | } | |
6688 | } | |
6689 | ||
6690 | #define alc260_auto_init_input_src alc880_auto_init_input_src | |
6691 | ||
6692 | /* | |
6693 | * generic initialization of ADC, input mixers and output mixers | |
6694 | */ | |
6695 | static struct hda_verb alc260_volume_init_verbs[] = { | |
6696 | /* | |
6697 | * Unmute ADC0-1 and set the default input to mic-in | |
6698 | */ | |
6699 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6700 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6701 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6702 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6703 | ||
6704 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
6705 | * mixer widget | |
6706 | * Note: PASD motherboards uses the Line In 2 as the input for | |
6707 | * front panel mic (mic 2) | |
6708 | */ | |
6709 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
6710 | /* mute analog inputs */ | |
6711 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6712 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6713 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6714 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6715 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6716 | ||
6717 | /* | |
6718 | * Set up output mixers (0x08 - 0x0a) | |
6719 | */ | |
6720 | /* set vol=0 to output mixers */ | |
6721 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6722 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6723 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6724 | /* set up input amps for analog loopback */ | |
6725 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
6726 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6727 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6728 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6729 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6730 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6731 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6732 | ||
6733 | { } | |
6734 | }; | |
6735 | ||
6736 | static int alc260_parse_auto_config(struct hda_codec *codec) | |
6737 | { | |
6738 | struct alc_spec *spec = codec->spec; | |
6739 | int err; | |
6740 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; | |
6741 | ||
6742 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
6743 | alc260_ignore); | |
6744 | if (err < 0) | |
6745 | return err; | |
6746 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
6747 | if (err < 0) | |
6748 | return err; | |
6749 | if (!spec->kctls.list) | |
6750 | return 0; /* can't find valid BIOS pin config */ | |
6751 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); | |
6752 | if (err < 0) | |
6753 | return err; | |
6754 | ||
6755 | spec->multiout.max_channels = 2; | |
6756 | ||
6757 | if (spec->autocfg.dig_outs) | |
6758 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; | |
6759 | if (spec->kctls.list) | |
6760 | add_mixer(spec, spec->kctls.list); | |
6761 | ||
6762 | add_verb(spec, alc260_volume_init_verbs); | |
6763 | ||
6764 | spec->num_mux_defs = 1; | |
6765 | spec->input_mux = &spec->private_imux[0]; | |
6766 | ||
6767 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); | |
6768 | ||
6769 | return 1; | |
6770 | } | |
6771 | ||
6772 | /* additional initialization for auto-configuration model */ | |
6773 | static void alc260_auto_init(struct hda_codec *codec) | |
6774 | { | |
6775 | struct alc_spec *spec = codec->spec; | |
6776 | alc260_auto_init_multi_out(codec); | |
6777 | alc260_auto_init_analog_input(codec); | |
6778 | alc260_auto_init_input_src(codec); | |
6779 | alc_auto_init_digital(codec); | |
6780 | if (spec->unsol_event) | |
6781 | alc_inithook(codec); | |
6782 | } | |
6783 | ||
6784 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
6785 | static struct hda_amp_list alc260_loopbacks[] = { | |
6786 | { 0x07, HDA_INPUT, 0 }, | |
6787 | { 0x07, HDA_INPUT, 1 }, | |
6788 | { 0x07, HDA_INPUT, 2 }, | |
6789 | { 0x07, HDA_INPUT, 3 }, | |
6790 | { 0x07, HDA_INPUT, 4 }, | |
6791 | { } /* end */ | |
6792 | }; | |
6793 | #endif | |
6794 | ||
6795 | /* | |
6796 | * Pin config fixes | |
6797 | */ | |
6798 | enum { | |
6799 | PINFIX_HP_DC5750, | |
6800 | }; | |
6801 | ||
6802 | static struct alc_pincfg alc260_hp_dc5750_pinfix[] = { | |
6803 | { 0x11, 0x90130110 }, /* speaker */ | |
6804 | { } | |
6805 | }; | |
6806 | ||
6807 | static const struct alc_fixup alc260_fixups[] = { | |
6808 | [PINFIX_HP_DC5750] = { | |
6809 | .pins = alc260_hp_dc5750_pinfix | |
6810 | }, | |
6811 | }; | |
6812 | ||
6813 | static struct snd_pci_quirk alc260_fixup_tbl[] = { | |
6814 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), | |
6815 | {} | |
6816 | }; | |
6817 | ||
6818 | /* | |
6819 | * ALC260 configurations | |
6820 | */ | |
6821 | static const char *alc260_models[ALC260_MODEL_LAST] = { | |
6822 | [ALC260_BASIC] = "basic", | |
6823 | [ALC260_HP] = "hp", | |
6824 | [ALC260_HP_3013] = "hp-3013", | |
6825 | [ALC260_HP_DC7600] = "hp-dc7600", | |
6826 | [ALC260_FUJITSU_S702X] = "fujitsu", | |
6827 | [ALC260_ACER] = "acer", | |
6828 | [ALC260_WILL] = "will", | |
6829 | [ALC260_REPLACER_672V] = "replacer", | |
6830 | [ALC260_FAVORIT100] = "favorit100", | |
6831 | #ifdef CONFIG_SND_DEBUG | |
6832 | [ALC260_TEST] = "test", | |
6833 | #endif | |
6834 | [ALC260_AUTO] = "auto", | |
6835 | }; | |
6836 | ||
6837 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | |
6838 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), | |
6839 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), | |
6840 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), | |
6841 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), | |
6842 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), | |
6843 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ | |
6844 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), | |
6845 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), | |
6846 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), | |
6847 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), | |
6848 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | |
6849 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | |
6850 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), | |
6851 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), | |
6852 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), | |
6853 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), | |
6854 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), | |
6855 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), | |
6856 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), | |
6857 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), | |
6858 | {} | |
6859 | }; | |
6860 | ||
6861 | static struct alc_config_preset alc260_presets[] = { | |
6862 | [ALC260_BASIC] = { | |
6863 | .mixers = { alc260_base_output_mixer, | |
6864 | alc260_input_mixer }, | |
6865 | .init_verbs = { alc260_init_verbs }, | |
6866 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6867 | .dac_nids = alc260_dac_nids, | |
6868 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
6869 | .adc_nids = alc260_dual_adc_nids, | |
6870 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6871 | .channel_mode = alc260_modes, | |
6872 | .input_mux = &alc260_capture_source, | |
6873 | }, | |
6874 | [ALC260_HP] = { | |
6875 | .mixers = { alc260_hp_output_mixer, | |
6876 | alc260_input_mixer }, | |
6877 | .init_verbs = { alc260_init_verbs, | |
6878 | alc260_hp_unsol_verbs }, | |
6879 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6880 | .dac_nids = alc260_dac_nids, | |
6881 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | |
6882 | .adc_nids = alc260_adc_nids_alt, | |
6883 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6884 | .channel_mode = alc260_modes, | |
6885 | .input_mux = &alc260_capture_source, | |
6886 | .unsol_event = alc260_hp_unsol_event, | |
6887 | .init_hook = alc260_hp_automute, | |
6888 | }, | |
6889 | [ALC260_HP_DC7600] = { | |
6890 | .mixers = { alc260_hp_dc7600_mixer, | |
6891 | alc260_input_mixer }, | |
6892 | .init_verbs = { alc260_init_verbs, | |
6893 | alc260_hp_dc7600_verbs }, | |
6894 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6895 | .dac_nids = alc260_dac_nids, | |
6896 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | |
6897 | .adc_nids = alc260_adc_nids_alt, | |
6898 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6899 | .channel_mode = alc260_modes, | |
6900 | .input_mux = &alc260_capture_source, | |
6901 | .unsol_event = alc260_hp_3012_unsol_event, | |
6902 | .init_hook = alc260_hp_3012_automute, | |
6903 | }, | |
6904 | [ALC260_HP_3013] = { | |
6905 | .mixers = { alc260_hp_3013_mixer, | |
6906 | alc260_input_mixer }, | |
6907 | .init_verbs = { alc260_hp_3013_init_verbs, | |
6908 | alc260_hp_3013_unsol_verbs }, | |
6909 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6910 | .dac_nids = alc260_dac_nids, | |
6911 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | |
6912 | .adc_nids = alc260_adc_nids_alt, | |
6913 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6914 | .channel_mode = alc260_modes, | |
6915 | .input_mux = &alc260_capture_source, | |
6916 | .unsol_event = alc260_hp_3013_unsol_event, | |
6917 | .init_hook = alc260_hp_3013_automute, | |
6918 | }, | |
6919 | [ALC260_FUJITSU_S702X] = { | |
6920 | .mixers = { alc260_fujitsu_mixer }, | |
6921 | .init_verbs = { alc260_fujitsu_init_verbs }, | |
6922 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6923 | .dac_nids = alc260_dac_nids, | |
6924 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
6925 | .adc_nids = alc260_dual_adc_nids, | |
6926 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6927 | .channel_mode = alc260_modes, | |
6928 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), | |
6929 | .input_mux = alc260_fujitsu_capture_sources, | |
6930 | }, | |
6931 | [ALC260_ACER] = { | |
6932 | .mixers = { alc260_acer_mixer }, | |
6933 | .init_verbs = { alc260_acer_init_verbs }, | |
6934 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6935 | .dac_nids = alc260_dac_nids, | |
6936 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
6937 | .adc_nids = alc260_dual_adc_nids, | |
6938 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6939 | .channel_mode = alc260_modes, | |
6940 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), | |
6941 | .input_mux = alc260_acer_capture_sources, | |
6942 | }, | |
6943 | [ALC260_FAVORIT100] = { | |
6944 | .mixers = { alc260_favorit100_mixer }, | |
6945 | .init_verbs = { alc260_favorit100_init_verbs }, | |
6946 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6947 | .dac_nids = alc260_dac_nids, | |
6948 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
6949 | .adc_nids = alc260_dual_adc_nids, | |
6950 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6951 | .channel_mode = alc260_modes, | |
6952 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), | |
6953 | .input_mux = alc260_favorit100_capture_sources, | |
6954 | }, | |
6955 | [ALC260_WILL] = { | |
6956 | .mixers = { alc260_will_mixer }, | |
6957 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, | |
6958 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6959 | .dac_nids = alc260_dac_nids, | |
6960 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
6961 | .adc_nids = alc260_adc_nids, | |
6962 | .dig_out_nid = ALC260_DIGOUT_NID, | |
6963 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6964 | .channel_mode = alc260_modes, | |
6965 | .input_mux = &alc260_capture_source, | |
6966 | }, | |
6967 | [ALC260_REPLACER_672V] = { | |
6968 | .mixers = { alc260_replacer_672v_mixer }, | |
6969 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, | |
6970 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6971 | .dac_nids = alc260_dac_nids, | |
6972 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
6973 | .adc_nids = alc260_adc_nids, | |
6974 | .dig_out_nid = ALC260_DIGOUT_NID, | |
6975 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6976 | .channel_mode = alc260_modes, | |
6977 | .input_mux = &alc260_capture_source, | |
6978 | .unsol_event = alc260_replacer_672v_unsol_event, | |
6979 | .init_hook = alc260_replacer_672v_automute, | |
6980 | }, | |
6981 | #ifdef CONFIG_SND_DEBUG | |
6982 | [ALC260_TEST] = { | |
6983 | .mixers = { alc260_test_mixer }, | |
6984 | .init_verbs = { alc260_test_init_verbs }, | |
6985 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), | |
6986 | .dac_nids = alc260_test_dac_nids, | |
6987 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), | |
6988 | .adc_nids = alc260_test_adc_nids, | |
6989 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6990 | .channel_mode = alc260_modes, | |
6991 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), | |
6992 | .input_mux = alc260_test_capture_sources, | |
6993 | }, | |
6994 | #endif | |
6995 | }; | |
6996 | ||
6997 | static int patch_alc260(struct hda_codec *codec) | |
6998 | { | |
6999 | struct alc_spec *spec; | |
7000 | int err, board_config; | |
7001 | ||
7002 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
7003 | if (spec == NULL) | |
7004 | return -ENOMEM; | |
7005 | ||
7006 | codec->spec = spec; | |
7007 | ||
7008 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, | |
7009 | alc260_models, | |
7010 | alc260_cfg_tbl); | |
7011 | if (board_config < 0) { | |
7012 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
7013 | codec->chip_name); | |
7014 | board_config = ALC260_AUTO; | |
7015 | } | |
7016 | ||
7017 | if (board_config == ALC260_AUTO) | |
7018 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); | |
7019 | ||
7020 | if (board_config == ALC260_AUTO) { | |
7021 | /* automatic parse from the BIOS config */ | |
7022 | err = alc260_parse_auto_config(codec); | |
7023 | if (err < 0) { | |
7024 | alc_free(codec); | |
7025 | return err; | |
7026 | } else if (!err) { | |
7027 | printk(KERN_INFO | |
7028 | "hda_codec: Cannot set up configuration " | |
7029 | "from BIOS. Using base mode...\n"); | |
7030 | board_config = ALC260_BASIC; | |
7031 | } | |
7032 | } | |
7033 | ||
7034 | err = snd_hda_attach_beep_device(codec, 0x1); | |
7035 | if (err < 0) { | |
7036 | alc_free(codec); | |
7037 | return err; | |
7038 | } | |
7039 | ||
7040 | if (board_config != ALC260_AUTO) | |
7041 | setup_preset(codec, &alc260_presets[board_config]); | |
7042 | ||
7043 | spec->stream_analog_playback = &alc260_pcm_analog_playback; | |
7044 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | |
7045 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; | |
7046 | ||
7047 | spec->stream_digital_playback = &alc260_pcm_digital_playback; | |
7048 | spec->stream_digital_capture = &alc260_pcm_digital_capture; | |
7049 | ||
7050 | if (!spec->adc_nids && spec->input_mux) { | |
7051 | /* check whether NID 0x04 is valid */ | |
7052 | unsigned int wcap = get_wcaps(codec, 0x04); | |
7053 | wcap = get_wcaps_type(wcap); | |
7054 | /* get type */ | |
7055 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
7056 | spec->adc_nids = alc260_adc_nids_alt; | |
7057 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); | |
7058 | } else { | |
7059 | spec->adc_nids = alc260_adc_nids; | |
7060 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | |
7061 | } | |
7062 | } | |
7063 | set_capture_mixer(codec); | |
7064 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); | |
7065 | ||
7066 | if (board_config == ALC260_AUTO) | |
7067 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0); | |
7068 | ||
7069 | spec->vmaster_nid = 0x08; | |
7070 | ||
7071 | codec->patch_ops = alc_patch_ops; | |
7072 | if (board_config == ALC260_AUTO) | |
7073 | spec->init_hook = alc260_auto_init; | |
7074 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
7075 | if (!spec->loopback.amplist) | |
7076 | spec->loopback.amplist = alc260_loopbacks; | |
7077 | #endif | |
7078 | ||
7079 | return 0; | |
7080 | } | |
7081 | ||
7082 | ||
7083 | /* | |
7084 | * ALC882/883/885/888/889 support | |
7085 | * | |
7086 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | |
7087 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
7088 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
7089 | * 6-channel independent captures. | |
7090 | * | |
7091 | * In addition, an independent DAC for the multi-playback (not used in this | |
7092 | * driver yet). | |
7093 | */ | |
7094 | #define ALC882_DIGOUT_NID 0x06 | |
7095 | #define ALC882_DIGIN_NID 0x0a | |
7096 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID | |
7097 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID | |
7098 | #define ALC1200_DIGOUT_NID 0x10 | |
7099 | ||
7100 | ||
7101 | static struct hda_channel_mode alc882_ch_modes[1] = { | |
7102 | { 8, NULL } | |
7103 | }; | |
7104 | ||
7105 | /* DACs */ | |
7106 | static hda_nid_t alc882_dac_nids[4] = { | |
7107 | /* front, rear, clfe, rear_surr */ | |
7108 | 0x02, 0x03, 0x04, 0x05 | |
7109 | }; | |
7110 | #define alc883_dac_nids alc882_dac_nids | |
7111 | ||
7112 | /* ADCs */ | |
7113 | #define alc882_adc_nids alc880_adc_nids | |
7114 | #define alc882_adc_nids_alt alc880_adc_nids_alt | |
7115 | #define alc883_adc_nids alc882_adc_nids_alt | |
7116 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; | |
7117 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; | |
7118 | #define alc889_adc_nids alc880_adc_nids | |
7119 | ||
7120 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; | |
7121 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | |
7122 | #define alc883_capsrc_nids alc882_capsrc_nids_alt | |
7123 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | |
7124 | #define alc889_capsrc_nids alc882_capsrc_nids | |
7125 | ||
7126 | /* input MUX */ | |
7127 | /* FIXME: should be a matrix-type input source selection */ | |
7128 | ||
7129 | static struct hda_input_mux alc882_capture_source = { | |
7130 | .num_items = 4, | |
7131 | .items = { | |
7132 | { "Mic", 0x0 }, | |
7133 | { "Front Mic", 0x1 }, | |
7134 | { "Line", 0x2 }, | |
7135 | { "CD", 0x4 }, | |
7136 | }, | |
7137 | }; | |
7138 | ||
7139 | #define alc883_capture_source alc882_capture_source | |
7140 | ||
7141 | static struct hda_input_mux alc889_capture_source = { | |
7142 | .num_items = 3, | |
7143 | .items = { | |
7144 | { "Front Mic", 0x0 }, | |
7145 | { "Mic", 0x3 }, | |
7146 | { "Line", 0x2 }, | |
7147 | }, | |
7148 | }; | |
7149 | ||
7150 | static struct hda_input_mux mb5_capture_source = { | |
7151 | .num_items = 3, | |
7152 | .items = { | |
7153 | { "Mic", 0x1 }, | |
7154 | { "Line", 0x7 }, | |
7155 | { "CD", 0x4 }, | |
7156 | }, | |
7157 | }; | |
7158 | ||
7159 | static struct hda_input_mux macmini3_capture_source = { | |
7160 | .num_items = 2, | |
7161 | .items = { | |
7162 | { "Line", 0x2 }, | |
7163 | { "CD", 0x4 }, | |
7164 | }, | |
7165 | }; | |
7166 | ||
7167 | static struct hda_input_mux alc883_3stack_6ch_intel = { | |
7168 | .num_items = 4, | |
7169 | .items = { | |
7170 | { "Mic", 0x1 }, | |
7171 | { "Front Mic", 0x0 }, | |
7172 | { "Line", 0x2 }, | |
7173 | { "CD", 0x4 }, | |
7174 | }, | |
7175 | }; | |
7176 | ||
7177 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { | |
7178 | .num_items = 2, | |
7179 | .items = { | |
7180 | { "Mic", 0x1 }, | |
7181 | { "Line", 0x2 }, | |
7182 | }, | |
7183 | }; | |
7184 | ||
7185 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | |
7186 | .num_items = 4, | |
7187 | .items = { | |
7188 | { "Mic", 0x0 }, | |
7189 | { "Int Mic", 0x1 }, | |
7190 | { "Line", 0x2 }, | |
7191 | { "CD", 0x4 }, | |
7192 | }, | |
7193 | }; | |
7194 | ||
7195 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | |
7196 | .num_items = 2, | |
7197 | .items = { | |
7198 | { "Mic", 0x0 }, | |
7199 | { "Int Mic", 0x1 }, | |
7200 | }, | |
7201 | }; | |
7202 | ||
7203 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | |
7204 | .num_items = 3, | |
7205 | .items = { | |
7206 | { "Mic", 0x0 }, | |
7207 | { "Front Mic", 0x1 }, | |
7208 | { "Line", 0x4 }, | |
7209 | }, | |
7210 | }; | |
7211 | ||
7212 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | |
7213 | .num_items = 2, | |
7214 | .items = { | |
7215 | { "Mic", 0x0 }, | |
7216 | { "Line", 0x2 }, | |
7217 | }, | |
7218 | }; | |
7219 | ||
7220 | static struct hda_input_mux alc889A_mb31_capture_source = { | |
7221 | .num_items = 2, | |
7222 | .items = { | |
7223 | { "Mic", 0x0 }, | |
7224 | /* Front Mic (0x01) unused */ | |
7225 | { "Line", 0x2 }, | |
7226 | /* Line 2 (0x03) unused */ | |
7227 | /* CD (0x04) unused? */ | |
7228 | }, | |
7229 | }; | |
7230 | ||
7231 | static struct hda_input_mux alc889A_imac91_capture_source = { | |
7232 | .num_items = 2, | |
7233 | .items = { | |
7234 | { "Mic", 0x01 }, | |
7235 | { "Line", 0x2 }, /* Not sure! */ | |
7236 | }, | |
7237 | }; | |
7238 | ||
7239 | /* | |
7240 | * 2ch mode | |
7241 | */ | |
7242 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | |
7243 | { 2, NULL } | |
7244 | }; | |
7245 | ||
7246 | /* | |
7247 | * 2ch mode | |
7248 | */ | |
7249 | static struct hda_verb alc882_3ST_ch2_init[] = { | |
7250 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7251 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7252 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7253 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7254 | { } /* end */ | |
7255 | }; | |
7256 | ||
7257 | /* | |
7258 | * 4ch mode | |
7259 | */ | |
7260 | static struct hda_verb alc882_3ST_ch4_init[] = { | |
7261 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7262 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7263 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7264 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7265 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7266 | { } /* end */ | |
7267 | }; | |
7268 | ||
7269 | /* | |
7270 | * 6ch mode | |
7271 | */ | |
7272 | static struct hda_verb alc882_3ST_ch6_init[] = { | |
7273 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7274 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7275 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7276 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7277 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7278 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7279 | { } /* end */ | |
7280 | }; | |
7281 | ||
7282 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { | |
7283 | { 2, alc882_3ST_ch2_init }, | |
7284 | { 4, alc882_3ST_ch4_init }, | |
7285 | { 6, alc882_3ST_ch6_init }, | |
7286 | }; | |
7287 | ||
7288 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes | |
7289 | ||
7290 | /* | |
7291 | * 2ch mode | |
7292 | */ | |
7293 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { | |
7294 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
7295 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7296 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7297 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7298 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7299 | { } /* end */ | |
7300 | }; | |
7301 | ||
7302 | /* | |
7303 | * 4ch mode | |
7304 | */ | |
7305 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { | |
7306 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7307 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7308 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7309 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7310 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7311 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7312 | { } /* end */ | |
7313 | }; | |
7314 | ||
7315 | /* | |
7316 | * 6ch mode | |
7317 | */ | |
7318 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { | |
7319 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7320 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7321 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7322 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7323 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7324 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7325 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7326 | { } /* end */ | |
7327 | }; | |
7328 | ||
7329 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { | |
7330 | { 2, alc883_3ST_ch2_clevo_init }, | |
7331 | { 4, alc883_3ST_ch4_clevo_init }, | |
7332 | { 6, alc883_3ST_ch6_clevo_init }, | |
7333 | }; | |
7334 | ||
7335 | ||
7336 | /* | |
7337 | * 6ch mode | |
7338 | */ | |
7339 | static struct hda_verb alc882_sixstack_ch6_init[] = { | |
7340 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7341 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7342 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7343 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7344 | { } /* end */ | |
7345 | }; | |
7346 | ||
7347 | /* | |
7348 | * 8ch mode | |
7349 | */ | |
7350 | static struct hda_verb alc882_sixstack_ch8_init[] = { | |
7351 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7352 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7353 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7354 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7355 | { } /* end */ | |
7356 | }; | |
7357 | ||
7358 | static struct hda_channel_mode alc882_sixstack_modes[2] = { | |
7359 | { 6, alc882_sixstack_ch6_init }, | |
7360 | { 8, alc882_sixstack_ch8_init }, | |
7361 | }; | |
7362 | ||
7363 | ||
7364 | /* Macbook Air 2,1 */ | |
7365 | ||
7366 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { | |
7367 | { 2, NULL }, | |
7368 | }; | |
7369 | ||
7370 | /* | |
7371 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic | |
7372 | */ | |
7373 | ||
7374 | /* | |
7375 | * 2ch mode | |
7376 | */ | |
7377 | static struct hda_verb alc885_mbp_ch2_init[] = { | |
7378 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7379 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7380 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7381 | { } /* end */ | |
7382 | }; | |
7383 | ||
7384 | /* | |
7385 | * 4ch mode | |
7386 | */ | |
7387 | static struct hda_verb alc885_mbp_ch4_init[] = { | |
7388 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7389 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7390 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7391 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7392 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7393 | { } /* end */ | |
7394 | }; | |
7395 | ||
7396 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { | |
7397 | { 2, alc885_mbp_ch2_init }, | |
7398 | { 4, alc885_mbp_ch4_init }, | |
7399 | }; | |
7400 | ||
7401 | /* | |
7402 | * 2ch | |
7403 | * Speakers/Woofer/HP = Front | |
7404 | * LineIn = Input | |
7405 | */ | |
7406 | static struct hda_verb alc885_mb5_ch2_init[] = { | |
7407 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7408 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7409 | { } /* end */ | |
7410 | }; | |
7411 | ||
7412 | /* | |
7413 | * 6ch mode | |
7414 | * Speakers/HP = Front | |
7415 | * Woofer = LFE | |
7416 | * LineIn = Surround | |
7417 | */ | |
7418 | static struct hda_verb alc885_mb5_ch6_init[] = { | |
7419 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7420 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7421 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7422 | { } /* end */ | |
7423 | }; | |
7424 | ||
7425 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { | |
7426 | { 2, alc885_mb5_ch2_init }, | |
7427 | { 6, alc885_mb5_ch6_init }, | |
7428 | }; | |
7429 | ||
7430 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes | |
7431 | ||
7432 | /* | |
7433 | * 2ch mode | |
7434 | */ | |
7435 | static struct hda_verb alc883_4ST_ch2_init[] = { | |
7436 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7437 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7438 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7439 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7440 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7441 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7442 | { } /* end */ | |
7443 | }; | |
7444 | ||
7445 | /* | |
7446 | * 4ch mode | |
7447 | */ | |
7448 | static struct hda_verb alc883_4ST_ch4_init[] = { | |
7449 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7450 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7451 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7452 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7453 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7454 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7455 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7456 | { } /* end */ | |
7457 | }; | |
7458 | ||
7459 | /* | |
7460 | * 6ch mode | |
7461 | */ | |
7462 | static struct hda_verb alc883_4ST_ch6_init[] = { | |
7463 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7464 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7465 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7466 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7467 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7468 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7469 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7470 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7471 | { } /* end */ | |
7472 | }; | |
7473 | ||
7474 | /* | |
7475 | * 8ch mode | |
7476 | */ | |
7477 | static struct hda_verb alc883_4ST_ch8_init[] = { | |
7478 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7479 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7480 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7481 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7482 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7483 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7484 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7485 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7486 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7487 | { } /* end */ | |
7488 | }; | |
7489 | ||
7490 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { | |
7491 | { 2, alc883_4ST_ch2_init }, | |
7492 | { 4, alc883_4ST_ch4_init }, | |
7493 | { 6, alc883_4ST_ch6_init }, | |
7494 | { 8, alc883_4ST_ch8_init }, | |
7495 | }; | |
7496 | ||
7497 | ||
7498 | /* | |
7499 | * 2ch mode | |
7500 | */ | |
7501 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | |
7502 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7503 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7504 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7505 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7506 | { } /* end */ | |
7507 | }; | |
7508 | ||
7509 | /* | |
7510 | * 4ch mode | |
7511 | */ | |
7512 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | |
7513 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7514 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7515 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7516 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7517 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7518 | { } /* end */ | |
7519 | }; | |
7520 | ||
7521 | /* | |
7522 | * 6ch mode | |
7523 | */ | |
7524 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | |
7525 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7526 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7527 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7528 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7529 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7530 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7531 | { } /* end */ | |
7532 | }; | |
7533 | ||
7534 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | |
7535 | { 2, alc883_3ST_ch2_intel_init }, | |
7536 | { 4, alc883_3ST_ch4_intel_init }, | |
7537 | { 6, alc883_3ST_ch6_intel_init }, | |
7538 | }; | |
7539 | ||
7540 | /* | |
7541 | * 2ch mode | |
7542 | */ | |
7543 | static struct hda_verb alc889_ch2_intel_init[] = { | |
7544 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7545 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7546 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7547 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7548 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7549 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7550 | { } /* end */ | |
7551 | }; | |
7552 | ||
7553 | /* | |
7554 | * 6ch mode | |
7555 | */ | |
7556 | static struct hda_verb alc889_ch6_intel_init[] = { | |
7557 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7558 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7559 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7560 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7561 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7562 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7563 | { } /* end */ | |
7564 | }; | |
7565 | ||
7566 | /* | |
7567 | * 8ch mode | |
7568 | */ | |
7569 | static struct hda_verb alc889_ch8_intel_init[] = { | |
7570 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7571 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7572 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7573 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7574 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7575 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7576 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7577 | { } /* end */ | |
7578 | }; | |
7579 | ||
7580 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { | |
7581 | { 2, alc889_ch2_intel_init }, | |
7582 | { 6, alc889_ch6_intel_init }, | |
7583 | { 8, alc889_ch8_intel_init }, | |
7584 | }; | |
7585 | ||
7586 | /* | |
7587 | * 6ch mode | |
7588 | */ | |
7589 | static struct hda_verb alc883_sixstack_ch6_init[] = { | |
7590 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7591 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7592 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7593 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7594 | { } /* end */ | |
7595 | }; | |
7596 | ||
7597 | /* | |
7598 | * 8ch mode | |
7599 | */ | |
7600 | static struct hda_verb alc883_sixstack_ch8_init[] = { | |
7601 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7602 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7603 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7604 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7605 | { } /* end */ | |
7606 | }; | |
7607 | ||
7608 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | |
7609 | { 6, alc883_sixstack_ch6_init }, | |
7610 | { 8, alc883_sixstack_ch8_init }, | |
7611 | }; | |
7612 | ||
7613 | ||
7614 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
7615 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
7616 | */ | |
7617 | static struct snd_kcontrol_new alc882_base_mixer[] = { | |
7618 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7619 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7620 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7621 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
7622 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7623 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7624 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7625 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7626 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
7627 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
7628 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7629 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7630 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7631 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7632 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7633 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7634 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7635 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7636 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7637 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
7638 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7639 | { } /* end */ | |
7640 | }; | |
7641 | ||
7642 | /* Macbook Air 2,1 same control for HP and internal Speaker */ | |
7643 | ||
7644 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { | |
7645 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7646 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), | |
7647 | { } | |
7648 | }; | |
7649 | ||
7650 | ||
7651 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { | |
7652 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7653 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7654 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7655 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
7656 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
7657 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7658 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7659 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | |
7660 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
7661 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), | |
7662 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), | |
7663 | { } /* end */ | |
7664 | }; | |
7665 | ||
7666 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { | |
7667 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7668 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7669 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
7670 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
7671 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7672 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
7673 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | |
7674 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | |
7675 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
7676 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
7677 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
7678 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
7679 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), | |
7680 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), | |
7681 | { } /* end */ | |
7682 | }; | |
7683 | ||
7684 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { | |
7685 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7686 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7687 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
7688 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
7689 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7690 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
7691 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | |
7692 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | |
7693 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
7694 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
7695 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), | |
7696 | { } /* end */ | |
7697 | }; | |
7698 | ||
7699 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { | |
7700 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7701 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7702 | { } /* end */ | |
7703 | }; | |
7704 | ||
7705 | ||
7706 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { | |
7707 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7708 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7709 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7710 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7711 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7712 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7713 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7714 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7715 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7716 | { } /* end */ | |
7717 | }; | |
7718 | ||
7719 | static struct snd_kcontrol_new alc882_targa_mixer[] = { | |
7720 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7721 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7722 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7723 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7724 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7725 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7726 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7727 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7728 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7729 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7730 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7731 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7732 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
7733 | { } /* end */ | |
7734 | }; | |
7735 | ||
7736 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? | |
7737 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c | |
7738 | */ | |
7739 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { | |
7740 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7741 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7742 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7743 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
7744 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7745 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7746 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7747 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7748 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
7749 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
7750 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7751 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7752 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7753 | { } /* end */ | |
7754 | }; | |
7755 | ||
7756 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { | |
7757 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7758 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7759 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7760 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7761 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7762 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7763 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7765 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7766 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7767 | { } /* end */ | |
7768 | }; | |
7769 | ||
7770 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { | |
7771 | { | |
7772 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7773 | .name = "Channel Mode", | |
7774 | .info = alc_ch_mode_info, | |
7775 | .get = alc_ch_mode_get, | |
7776 | .put = alc_ch_mode_put, | |
7777 | }, | |
7778 | { } /* end */ | |
7779 | }; | |
7780 | ||
7781 | static struct hda_verb alc882_base_init_verbs[] = { | |
7782 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
7783 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7784 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7785 | /* Rear mixer */ | |
7786 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7787 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7788 | /* CLFE mixer */ | |
7789 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7790 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7791 | /* Side mixer */ | |
7792 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7793 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7794 | ||
7795 | /* Front Pin: output 0 (0x0c) */ | |
7796 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7797 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7798 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7799 | /* Rear Pin: output 1 (0x0d) */ | |
7800 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7801 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7802 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7803 | /* CLFE Pin: output 2 (0x0e) */ | |
7804 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7805 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7806 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7807 | /* Side Pin: output 3 (0x0f) */ | |
7808 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7809 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7810 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
7811 | /* Mic (rear) pin: input vref at 80% */ | |
7812 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7813 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7814 | /* Front Mic pin: input vref at 80% */ | |
7815 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7816 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7817 | /* Line In pin: input */ | |
7818 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7819 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7820 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
7821 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7822 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7823 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7824 | /* CD pin widget for input */ | |
7825 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7826 | ||
7827 | /* FIXME: use matrix-type input source selection */ | |
7828 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
7829 | /* Input mixer2 */ | |
7830 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7831 | /* Input mixer3 */ | |
7832 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7833 | /* ADC2: mute amp left and right */ | |
7834 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7835 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7836 | /* ADC3: mute amp left and right */ | |
7837 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7838 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7839 | ||
7840 | { } | |
7841 | }; | |
7842 | ||
7843 | static struct hda_verb alc882_adc1_init_verbs[] = { | |
7844 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
7845 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7846 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7847 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7848 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7849 | /* ADC1: mute amp left and right */ | |
7850 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7851 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7852 | { } | |
7853 | }; | |
7854 | ||
7855 | static struct hda_verb alc882_eapd_verbs[] = { | |
7856 | /* change to EAPD mode */ | |
7857 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
7858 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
7859 | { } | |
7860 | }; | |
7861 | ||
7862 | static struct hda_verb alc889_eapd_verbs[] = { | |
7863 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
7864 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
7865 | { } | |
7866 | }; | |
7867 | ||
7868 | static struct hda_verb alc_hp15_unsol_verbs[] = { | |
7869 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
7870 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7871 | {} | |
7872 | }; | |
7873 | ||
7874 | static struct hda_verb alc885_init_verbs[] = { | |
7875 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
7876 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7877 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7878 | /* Rear mixer */ | |
7879 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7880 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7881 | /* CLFE mixer */ | |
7882 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7883 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7884 | /* Side mixer */ | |
7885 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7886 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7887 | ||
7888 | /* Front HP Pin: output 0 (0x0c) */ | |
7889 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7890 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7891 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7892 | /* Front Pin: output 0 (0x0c) */ | |
7893 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7894 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7895 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7896 | /* Rear Pin: output 1 (0x0d) */ | |
7897 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7898 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7899 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7900 | /* CLFE Pin: output 2 (0x0e) */ | |
7901 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7902 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7903 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7904 | /* Side Pin: output 3 (0x0f) */ | |
7905 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7906 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7907 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
7908 | /* Mic (rear) pin: input vref at 80% */ | |
7909 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7910 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7911 | /* Front Mic pin: input vref at 80% */ | |
7912 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7913 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7914 | /* Line In pin: input */ | |
7915 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7916 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7917 | ||
7918 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ | |
7919 | /* Input mixer1 */ | |
7920 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7921 | /* Input mixer2 */ | |
7922 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7923 | /* Input mixer3 */ | |
7924 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7925 | /* ADC2: mute amp left and right */ | |
7926 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7927 | /* ADC3: mute amp left and right */ | |
7928 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7929 | ||
7930 | { } | |
7931 | }; | |
7932 | ||
7933 | static struct hda_verb alc885_init_input_verbs[] = { | |
7934 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7935 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7936 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
7937 | { } | |
7938 | }; | |
7939 | ||
7940 | ||
7941 | /* Unmute Selector 24h and set the default input to front mic */ | |
7942 | static struct hda_verb alc889_init_input_verbs[] = { | |
7943 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7944 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7945 | { } | |
7946 | }; | |
7947 | ||
7948 | ||
7949 | #define alc883_init_verbs alc882_base_init_verbs | |
7950 | ||
7951 | /* Mac Pro test */ | |
7952 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | |
7953 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7954 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7955 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | |
7956 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
7957 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
7958 | /* FIXME: this looks suspicious... | |
7959 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7960 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7961 | */ | |
7962 | { } /* end */ | |
7963 | }; | |
7964 | ||
7965 | static struct hda_verb alc882_macpro_init_verbs[] = { | |
7966 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
7967 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7968 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7969 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7970 | /* Front Pin: output 0 (0x0c) */ | |
7971 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7972 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7973 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7974 | /* Front Mic pin: input vref at 80% */ | |
7975 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7976 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7977 | /* Speaker: output */ | |
7978 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7979 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7980 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | |
7981 | /* Headphone output (output 0 - 0x0c) */ | |
7982 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7983 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7984 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7985 | ||
7986 | /* FIXME: use matrix-type input source selection */ | |
7987 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
7988 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
7989 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7990 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7991 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7992 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7993 | /* Input mixer2 */ | |
7994 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7996 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7997 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7998 | /* Input mixer3 */ | |
7999 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8000 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8001 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8002 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8003 | /* ADC1: mute amp left and right */ | |
8004 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8005 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8006 | /* ADC2: mute amp left and right */ | |
8007 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8008 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8009 | /* ADC3: mute amp left and right */ | |
8010 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8011 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8012 | ||
8013 | { } | |
8014 | }; | |
8015 | ||
8016 | /* Macbook 5,1 */ | |
8017 | static struct hda_verb alc885_mb5_init_verbs[] = { | |
8018 | /* DACs */ | |
8019 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8020 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8021 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8022 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8023 | /* Front mixer */ | |
8024 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8025 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8027 | /* Surround mixer */ | |
8028 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8029 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8030 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8031 | /* LFE mixer */ | |
8032 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8033 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8034 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8035 | /* HP mixer */ | |
8036 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8037 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8038 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8039 | /* Front Pin (0x0c) */ | |
8040 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8041 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8042 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8043 | /* LFE Pin (0x0e) */ | |
8044 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8045 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8046 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8047 | /* HP Pin (0x0f) */ | |
8048 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8049 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8050 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
8051 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8052 | /* Front Mic pin: input vref at 80% */ | |
8053 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8054 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8055 | /* Line In pin */ | |
8056 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8057 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8058 | ||
8059 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, | |
8060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, | |
8061 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, | |
8062 | { } | |
8063 | }; | |
8064 | ||
8065 | /* Macmini 3,1 */ | |
8066 | static struct hda_verb alc885_macmini3_init_verbs[] = { | |
8067 | /* DACs */ | |
8068 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8069 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8070 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8071 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8072 | /* Front mixer */ | |
8073 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8074 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8075 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8076 | /* Surround mixer */ | |
8077 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8078 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8079 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8080 | /* LFE mixer */ | |
8081 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8082 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8083 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8084 | /* HP mixer */ | |
8085 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8086 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8087 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8088 | /* Front Pin (0x0c) */ | |
8089 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8090 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8091 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8092 | /* LFE Pin (0x0e) */ | |
8093 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8094 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8095 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8096 | /* HP Pin (0x0f) */ | |
8097 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8098 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8099 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
8100 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8101 | /* Line In pin */ | |
8102 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8103 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8104 | ||
8105 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8106 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8107 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8108 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8109 | { } | |
8110 | }; | |
8111 | ||
8112 | ||
8113 | static struct hda_verb alc885_mba21_init_verbs[] = { | |
8114 | /*Internal and HP Speaker Mixer*/ | |
8115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8117 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8118 | /*Internal Speaker Pin (0x0c)*/ | |
8119 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8120 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8121 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8122 | /* HP Pin: output 0 (0x0e) */ | |
8123 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | |
8124 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8125 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8126 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, | |
8127 | /* Line in (is hp when jack connected)*/ | |
8128 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, | |
8129 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8130 | ||
8131 | { } | |
8132 | }; | |
8133 | ||
8134 | ||
8135 | /* Macbook Pro rev3 */ | |
8136 | static struct hda_verb alc885_mbp3_init_verbs[] = { | |
8137 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
8138 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8139 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8140 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8141 | /* Rear mixer */ | |
8142 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8143 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8144 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8145 | /* HP mixer */ | |
8146 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8147 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8148 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8149 | /* Front Pin: output 0 (0x0c) */ | |
8150 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8151 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8152 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8153 | /* HP Pin: output 0 (0x0e) */ | |
8154 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | |
8155 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8156 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8157 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8158 | /* Mic (rear) pin: input vref at 80% */ | |
8159 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8160 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8161 | /* Front Mic pin: input vref at 80% */ | |
8162 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8163 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8164 | /* Line In pin: use output 1 when in LineOut mode */ | |
8165 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8166 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8167 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8168 | ||
8169 | /* FIXME: use matrix-type input source selection */ | |
8170 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8171 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
8172 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8173 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8174 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8175 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8176 | /* Input mixer2 */ | |
8177 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8178 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8179 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8180 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8181 | /* Input mixer3 */ | |
8182 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8183 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8185 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8186 | /* ADC1: mute amp left and right */ | |
8187 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8188 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8189 | /* ADC2: mute amp left and right */ | |
8190 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8191 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8192 | /* ADC3: mute amp left and right */ | |
8193 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8194 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8195 | ||
8196 | { } | |
8197 | }; | |
8198 | ||
8199 | /* iMac 9,1 */ | |
8200 | static struct hda_verb alc885_imac91_init_verbs[] = { | |
8201 | /* Internal Speaker Pin (0x0c) */ | |
8202 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8203 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8204 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8205 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8206 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8207 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8208 | /* HP Pin: Rear */ | |
8209 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8210 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8211 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8212 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, | |
8213 | /* Line in Rear */ | |
8214 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, | |
8215 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8216 | /* Front Mic pin: input vref at 80% */ | |
8217 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8218 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8219 | /* Rear mixer */ | |
8220 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8221 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8222 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8223 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ | |
8224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8225 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8226 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8227 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ | |
8228 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8229 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8230 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8231 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8232 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ | |
8233 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8234 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8235 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8236 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8237 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ | |
8238 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8239 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8240 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8241 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8242 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ | |
8243 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8244 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8245 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ | |
8246 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8247 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8248 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ | |
8249 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8250 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8251 | { } | |
8252 | }; | |
8253 | ||
8254 | /* iMac 24 mixer. */ | |
8255 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { | |
8256 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8257 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), | |
8258 | { } /* end */ | |
8259 | }; | |
8260 | ||
8261 | /* iMac 24 init verbs. */ | |
8262 | static struct hda_verb alc885_imac24_init_verbs[] = { | |
8263 | /* Internal speakers: output 0 (0x0c) */ | |
8264 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8265 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8266 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8267 | /* Internal speakers: output 0 (0x0c) */ | |
8268 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8269 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8270 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8271 | /* Headphone: output 0 (0x0c) */ | |
8272 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8273 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8274 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8275 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8276 | /* Front Mic: input vref at 80% */ | |
8277 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8278 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8279 | { } | |
8280 | }; | |
8281 | ||
8282 | /* Toggle speaker-output according to the hp-jack state */ | |
8283 | static void alc885_imac24_setup(struct hda_codec *codec) | |
8284 | { | |
8285 | struct alc_spec *spec = codec->spec; | |
8286 | ||
8287 | spec->autocfg.hp_pins[0] = 0x14; | |
8288 | spec->autocfg.speaker_pins[0] = 0x18; | |
8289 | spec->autocfg.speaker_pins[1] = 0x1a; | |
8290 | } | |
8291 | ||
8292 | #define alc885_mb5_setup alc885_imac24_setup | |
8293 | #define alc885_macmini3_setup alc885_imac24_setup | |
8294 | ||
8295 | /* Macbook Air 2,1 */ | |
8296 | static void alc885_mba21_setup(struct hda_codec *codec) | |
8297 | { | |
8298 | struct alc_spec *spec = codec->spec; | |
8299 | ||
8300 | spec->autocfg.hp_pins[0] = 0x14; | |
8301 | spec->autocfg.speaker_pins[0] = 0x18; | |
8302 | } | |
8303 | ||
8304 | ||
8305 | ||
8306 | static void alc885_mbp3_setup(struct hda_codec *codec) | |
8307 | { | |
8308 | struct alc_spec *spec = codec->spec; | |
8309 | ||
8310 | spec->autocfg.hp_pins[0] = 0x15; | |
8311 | spec->autocfg.speaker_pins[0] = 0x14; | |
8312 | } | |
8313 | ||
8314 | static void alc885_imac91_setup(struct hda_codec *codec) | |
8315 | { | |
8316 | struct alc_spec *spec = codec->spec; | |
8317 | ||
8318 | spec->autocfg.hp_pins[0] = 0x14; | |
8319 | spec->autocfg.speaker_pins[0] = 0x18; | |
8320 | spec->autocfg.speaker_pins[1] = 0x1a; | |
8321 | } | |
8322 | ||
8323 | static struct hda_verb alc882_targa_verbs[] = { | |
8324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8325 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8326 | ||
8327 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8328 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8329 | ||
8330 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
8331 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8332 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8333 | ||
8334 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8335 | { } /* end */ | |
8336 | }; | |
8337 | ||
8338 | /* toggle speaker-output according to the hp-jack state */ | |
8339 | static void alc882_targa_automute(struct hda_codec *codec) | |
8340 | { | |
8341 | struct alc_spec *spec = codec->spec; | |
8342 | alc_automute_amp(codec); | |
8343 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, | |
8344 | spec->jack_present ? 1 : 3); | |
8345 | } | |
8346 | ||
8347 | static void alc882_targa_setup(struct hda_codec *codec) | |
8348 | { | |
8349 | struct alc_spec *spec = codec->spec; | |
8350 | ||
8351 | spec->autocfg.hp_pins[0] = 0x14; | |
8352 | spec->autocfg.speaker_pins[0] = 0x1b; | |
8353 | } | |
8354 | ||
8355 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | |
8356 | { | |
8357 | if ((res >> 26) == ALC880_HP_EVENT) | |
8358 | alc882_targa_automute(codec); | |
8359 | } | |
8360 | ||
8361 | static struct hda_verb alc882_asus_a7j_verbs[] = { | |
8362 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8364 | ||
8365 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8366 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8367 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8368 | ||
8369 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8370 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8371 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8372 | ||
8373 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
8374 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8375 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8376 | { } /* end */ | |
8377 | }; | |
8378 | ||
8379 | static struct hda_verb alc882_asus_a7m_verbs[] = { | |
8380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8381 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8382 | ||
8383 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8384 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8385 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8386 | ||
8387 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8388 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8389 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8390 | ||
8391 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
8392 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8393 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8394 | { } /* end */ | |
8395 | }; | |
8396 | ||
8397 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) | |
8398 | { | |
8399 | unsigned int gpiostate, gpiomask, gpiodir; | |
8400 | ||
8401 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | |
8402 | AC_VERB_GET_GPIO_DATA, 0); | |
8403 | ||
8404 | if (!muted) | |
8405 | gpiostate |= (1 << pin); | |
8406 | else | |
8407 | gpiostate &= ~(1 << pin); | |
8408 | ||
8409 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | |
8410 | AC_VERB_GET_GPIO_MASK, 0); | |
8411 | gpiomask |= (1 << pin); | |
8412 | ||
8413 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | |
8414 | AC_VERB_GET_GPIO_DIRECTION, 0); | |
8415 | gpiodir |= (1 << pin); | |
8416 | ||
8417 | ||
8418 | snd_hda_codec_write(codec, codec->afg, 0, | |
8419 | AC_VERB_SET_GPIO_MASK, gpiomask); | |
8420 | snd_hda_codec_write(codec, codec->afg, 0, | |
8421 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | |
8422 | ||
8423 | msleep(1); | |
8424 | ||
8425 | snd_hda_codec_write(codec, codec->afg, 0, | |
8426 | AC_VERB_SET_GPIO_DATA, gpiostate); | |
8427 | } | |
8428 | ||
8429 | /* set up GPIO at initialization */ | |
8430 | static void alc885_macpro_init_hook(struct hda_codec *codec) | |
8431 | { | |
8432 | alc882_gpio_mute(codec, 0, 0); | |
8433 | alc882_gpio_mute(codec, 1, 0); | |
8434 | } | |
8435 | ||
8436 | /* set up GPIO and update auto-muting at initialization */ | |
8437 | static void alc885_imac24_init_hook(struct hda_codec *codec) | |
8438 | { | |
8439 | alc885_macpro_init_hook(codec); | |
8440 | alc_automute_amp(codec); | |
8441 | } | |
8442 | ||
8443 | /* | |
8444 | * generic initialization of ADC, input mixers and output mixers | |
8445 | */ | |
8446 | static struct hda_verb alc883_auto_init_verbs[] = { | |
8447 | /* | |
8448 | * Unmute ADC0-2 and set the default input to mic-in | |
8449 | */ | |
8450 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8451 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8452 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8453 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8454 | ||
8455 | /* | |
8456 | * Set up output mixers (0x0c - 0x0f) | |
8457 | */ | |
8458 | /* set vol=0 to output mixers */ | |
8459 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8460 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8461 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8462 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8463 | /* set up input amps for analog loopback */ | |
8464 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
8465 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8466 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8467 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8468 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8469 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8470 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8471 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8472 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8473 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8474 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8475 | ||
8476 | /* FIXME: use matrix-type input source selection */ | |
8477 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8478 | /* Input mixer2 */ | |
8479 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8480 | /* Input mixer3 */ | |
8481 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8482 | { } | |
8483 | }; | |
8484 | ||
8485 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ | |
8486 | static struct hda_verb alc889A_mb31_ch2_init[] = { | |
8487 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | |
8488 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8489 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | |
8490 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | |
8491 | { } /* end */ | |
8492 | }; | |
8493 | ||
8494 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ | |
8495 | static struct hda_verb alc889A_mb31_ch4_init[] = { | |
8496 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | |
8497 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8498 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | |
8499 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | |
8500 | { } /* end */ | |
8501 | }; | |
8502 | ||
8503 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ | |
8504 | static struct hda_verb alc889A_mb31_ch5_init[] = { | |
8505 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ | |
8506 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8507 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | |
8508 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | |
8509 | { } /* end */ | |
8510 | }; | |
8511 | ||
8512 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ | |
8513 | static struct hda_verb alc889A_mb31_ch6_init[] = { | |
8514 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ | |
8515 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ | |
8516 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | |
8517 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | |
8518 | { } /* end */ | |
8519 | }; | |
8520 | ||
8521 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { | |
8522 | { 2, alc889A_mb31_ch2_init }, | |
8523 | { 4, alc889A_mb31_ch4_init }, | |
8524 | { 5, alc889A_mb31_ch5_init }, | |
8525 | { 6, alc889A_mb31_ch6_init }, | |
8526 | }; | |
8527 | ||
8528 | static struct hda_verb alc883_medion_eapd_verbs[] = { | |
8529 | /* eanable EAPD on medion laptop */ | |
8530 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
8531 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
8532 | { } | |
8533 | }; | |
8534 | ||
8535 | #define alc883_base_mixer alc882_base_mixer | |
8536 | ||
8537 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { | |
8538 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8539 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8540 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8541 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8542 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8543 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8544 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8545 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8546 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8547 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8548 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8549 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8550 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8551 | { } /* end */ | |
8552 | }; | |
8553 | ||
8554 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { | |
8555 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8556 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
8557 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8558 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8559 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8560 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8561 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8562 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8563 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8564 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8565 | { } /* end */ | |
8566 | }; | |
8567 | ||
8568 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { | |
8569 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8570 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
8571 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8572 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8573 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8574 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8575 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8576 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8577 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8578 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8579 | { } /* end */ | |
8580 | }; | |
8581 | ||
8582 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { | |
8583 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8584 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8585 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8586 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8587 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8588 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8589 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8590 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8591 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8592 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8593 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8594 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8595 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8596 | { } /* end */ | |
8597 | }; | |
8598 | ||
8599 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { | |
8600 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8601 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8602 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8603 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8604 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8605 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8606 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8607 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8608 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8609 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8610 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8611 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8612 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8613 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8614 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8615 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8616 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8617 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8618 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8619 | { } /* end */ | |
8620 | }; | |
8621 | ||
8622 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { | |
8623 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8624 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8625 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8626 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8627 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
8628 | HDA_OUTPUT), | |
8629 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8630 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8631 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8632 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8633 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8634 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8635 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8636 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8637 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8638 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
8639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8640 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8641 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
8642 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8643 | { } /* end */ | |
8644 | }; | |
8645 | ||
8646 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { | |
8647 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8648 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8649 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8650 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8651 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
8652 | HDA_OUTPUT), | |
8653 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8654 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8655 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8656 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8657 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), | |
8658 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8659 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8660 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8661 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
8662 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), | |
8663 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
8664 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8665 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
8666 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8667 | { } /* end */ | |
8668 | }; | |
8669 | ||
8670 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { | |
8671 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8672 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8673 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8674 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8675 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8676 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8677 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8678 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8679 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8680 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8681 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8682 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8683 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8684 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8685 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8686 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8687 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8688 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8689 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8690 | { } /* end */ | |
8691 | }; | |
8692 | ||
8693 | static struct snd_kcontrol_new alc883_targa_mixer[] = { | |
8694 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8695 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8696 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8697 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8698 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8699 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8700 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8701 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8702 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8703 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8704 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8705 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8706 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8707 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8708 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8709 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8710 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8711 | { } /* end */ | |
8712 | }; | |
8713 | ||
8714 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { | |
8715 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8716 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8717 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8718 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8719 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8720 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8721 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8722 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8724 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8725 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8726 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8727 | { } /* end */ | |
8728 | }; | |
8729 | ||
8730 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { | |
8731 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8732 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
8733 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8734 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8735 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8736 | { } /* end */ | |
8737 | }; | |
8738 | ||
8739 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { | |
8740 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8741 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8742 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8743 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8744 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8745 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8746 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8747 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8748 | { } /* end */ | |
8749 | }; | |
8750 | ||
8751 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { | |
8752 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8753 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
8754 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8755 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8756 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8757 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8758 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8759 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8760 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8761 | { } /* end */ | |
8762 | }; | |
8763 | ||
8764 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | |
8765 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8766 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8767 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8768 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8769 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8770 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8771 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8772 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8773 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8774 | { } /* end */ | |
8775 | }; | |
8776 | ||
8777 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { | |
8778 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8779 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8780 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8781 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | |
8782 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), | |
8783 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), | |
8784 | { } /* end */ | |
8785 | }; | |
8786 | ||
8787 | static struct hda_verb alc883_medion_wim2160_verbs[] = { | |
8788 | /* Unmute front mixer */ | |
8789 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8790 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8791 | ||
8792 | /* Set speaker pin to front mixer */ | |
8793 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8794 | ||
8795 | /* Init headphone pin */ | |
8796 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8797 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8798 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8799 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8800 | ||
8801 | { } /* end */ | |
8802 | }; | |
8803 | ||
8804 | /* toggle speaker-output according to the hp-jack state */ | |
8805 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) | |
8806 | { | |
8807 | struct alc_spec *spec = codec->spec; | |
8808 | ||
8809 | spec->autocfg.hp_pins[0] = 0x1a; | |
8810 | spec->autocfg.speaker_pins[0] = 0x15; | |
8811 | } | |
8812 | ||
8813 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | |
8814 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8815 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8816 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8817 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8818 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8820 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8821 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8822 | { } /* end */ | |
8823 | }; | |
8824 | ||
8825 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { | |
8826 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8827 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8828 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8829 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8830 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8831 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8832 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8833 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8835 | { } /* end */ | |
8836 | }; | |
8837 | ||
8838 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { | |
8839 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8840 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8841 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
8842 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | |
8843 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", | |
8844 | 0x0d, 1, 0x0, HDA_OUTPUT), | |
8845 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
8846 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
8847 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
8848 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8849 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
8850 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8851 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8852 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8853 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8854 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8855 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8856 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8857 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8858 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8859 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8860 | { } /* end */ | |
8861 | }; | |
8862 | ||
8863 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { | |
8864 | /* Output mixers */ | |
8865 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8866 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
8867 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
8868 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
8869 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, | |
8870 | HDA_OUTPUT), | |
8871 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), | |
8872 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), | |
8873 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), | |
8874 | /* Output switches */ | |
8875 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), | |
8876 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), | |
8877 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), | |
8878 | /* Boost mixers */ | |
8879 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), | |
8880 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), | |
8881 | /* Input mixers */ | |
8882 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | |
8883 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
8884 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8885 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8886 | { } /* end */ | |
8887 | }; | |
8888 | ||
8889 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { | |
8890 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8891 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8892 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8893 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8894 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
8895 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8896 | { } /* end */ | |
8897 | }; | |
8898 | ||
8899 | static struct hda_bind_ctls alc883_bind_cap_vol = { | |
8900 | .ops = &snd_hda_bind_vol, | |
8901 | .values = { | |
8902 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
8903 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
8904 | 0 | |
8905 | }, | |
8906 | }; | |
8907 | ||
8908 | static struct hda_bind_ctls alc883_bind_cap_switch = { | |
8909 | .ops = &snd_hda_bind_sw, | |
8910 | .values = { | |
8911 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
8912 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
8913 | 0 | |
8914 | }, | |
8915 | }; | |
8916 | ||
8917 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { | |
8918 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8919 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8920 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8921 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8922 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8923 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8924 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8925 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8926 | { } /* end */ | |
8927 | }; | |
8928 | ||
8929 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { | |
8930 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), | |
8931 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), | |
8932 | { | |
8933 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8934 | /* .name = "Capture Source", */ | |
8935 | .name = "Input Source", | |
8936 | .count = 1, | |
8937 | .info = alc_mux_enum_info, | |
8938 | .get = alc_mux_enum_get, | |
8939 | .put = alc_mux_enum_put, | |
8940 | }, | |
8941 | { } /* end */ | |
8942 | }; | |
8943 | ||
8944 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { | |
8945 | { | |
8946 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8947 | .name = "Channel Mode", | |
8948 | .info = alc_ch_mode_info, | |
8949 | .get = alc_ch_mode_get, | |
8950 | .put = alc_ch_mode_put, | |
8951 | }, | |
8952 | { } /* end */ | |
8953 | }; | |
8954 | ||
8955 | /* toggle speaker-output according to the hp-jack state */ | |
8956 | static void alc883_mitac_setup(struct hda_codec *codec) | |
8957 | { | |
8958 | struct alc_spec *spec = codec->spec; | |
8959 | ||
8960 | spec->autocfg.hp_pins[0] = 0x15; | |
8961 | spec->autocfg.speaker_pins[0] = 0x14; | |
8962 | spec->autocfg.speaker_pins[1] = 0x17; | |
8963 | } | |
8964 | ||
8965 | /* auto-toggle front mic */ | |
8966 | /* | |
8967 | static void alc883_mitac_mic_automute(struct hda_codec *codec) | |
8968 | { | |
8969 | unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0; | |
8970 | ||
8971 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
8972 | } | |
8973 | */ | |
8974 | ||
8975 | static struct hda_verb alc883_mitac_verbs[] = { | |
8976 | /* HP */ | |
8977 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8978 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8979 | /* Subwoofer */ | |
8980 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8981 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8982 | ||
8983 | /* enable unsolicited event */ | |
8984 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8985 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ | |
8986 | ||
8987 | { } /* end */ | |
8988 | }; | |
8989 | ||
8990 | static struct hda_verb alc883_clevo_m540r_verbs[] = { | |
8991 | /* HP */ | |
8992 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8993 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8994 | /* Int speaker */ | |
8995 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ | |
8996 | ||
8997 | /* enable unsolicited event */ | |
8998 | /* | |
8999 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9000 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
9001 | */ | |
9002 | ||
9003 | { } /* end */ | |
9004 | }; | |
9005 | ||
9006 | static struct hda_verb alc883_clevo_m720_verbs[] = { | |
9007 | /* HP */ | |
9008 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9009 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9010 | /* Int speaker */ | |
9011 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9012 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9013 | ||
9014 | /* enable unsolicited event */ | |
9015 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9016 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
9017 | ||
9018 | { } /* end */ | |
9019 | }; | |
9020 | ||
9021 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { | |
9022 | /* HP */ | |
9023 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9024 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9025 | /* Subwoofer */ | |
9026 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9027 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9028 | ||
9029 | /* enable unsolicited event */ | |
9030 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9031 | ||
9032 | { } /* end */ | |
9033 | }; | |
9034 | ||
9035 | static struct hda_verb alc883_targa_verbs[] = { | |
9036 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9037 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9038 | ||
9039 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9040 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9041 | ||
9042 | /* Connect Line-Out side jack (SPDIF) to Side */ | |
9043 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9044 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9045 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
9046 | /* Connect Mic jack to CLFE */ | |
9047 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9048 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9049 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
9050 | /* Connect Line-in jack to Surround */ | |
9051 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9052 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9053 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9054 | /* Connect HP out jack to Front */ | |
9055 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9056 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9057 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9058 | ||
9059 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9060 | ||
9061 | { } /* end */ | |
9062 | }; | |
9063 | ||
9064 | static struct hda_verb alc883_lenovo_101e_verbs[] = { | |
9065 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9066 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, | |
9067 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, | |
9068 | { } /* end */ | |
9069 | }; | |
9070 | ||
9071 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { | |
9072 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9073 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9074 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9075 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9076 | { } /* end */ | |
9077 | }; | |
9078 | ||
9079 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { | |
9080 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9081 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9082 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9083 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, | |
9084 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9085 | { } /* end */ | |
9086 | }; | |
9087 | ||
9088 | static struct hda_verb alc883_haier_w66_verbs[] = { | |
9089 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9090 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9091 | ||
9092 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9093 | ||
9094 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9095 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9096 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9097 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9098 | { } /* end */ | |
9099 | }; | |
9100 | ||
9101 | static struct hda_verb alc888_lenovo_sky_verbs[] = { | |
9102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9103 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9104 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9105 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9106 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9107 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9108 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9109 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9110 | { } /* end */ | |
9111 | }; | |
9112 | ||
9113 | static struct hda_verb alc888_6st_dell_verbs[] = { | |
9114 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9115 | { } | |
9116 | }; | |
9117 | ||
9118 | static struct hda_verb alc883_vaiott_verbs[] = { | |
9119 | /* HP */ | |
9120 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9121 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9122 | ||
9123 | /* enable unsolicited event */ | |
9124 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9125 | ||
9126 | { } /* end */ | |
9127 | }; | |
9128 | ||
9129 | static void alc888_3st_hp_setup(struct hda_codec *codec) | |
9130 | { | |
9131 | struct alc_spec *spec = codec->spec; | |
9132 | ||
9133 | spec->autocfg.hp_pins[0] = 0x1b; | |
9134 | spec->autocfg.speaker_pins[0] = 0x14; | |
9135 | spec->autocfg.speaker_pins[1] = 0x16; | |
9136 | spec->autocfg.speaker_pins[2] = 0x18; | |
9137 | } | |
9138 | ||
9139 | static struct hda_verb alc888_3st_hp_verbs[] = { | |
9140 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ | |
9141 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ | |
9142 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | |
9143 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9144 | { } /* end */ | |
9145 | }; | |
9146 | ||
9147 | /* | |
9148 | * 2ch mode | |
9149 | */ | |
9150 | static struct hda_verb alc888_3st_hp_2ch_init[] = { | |
9151 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
9152 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
9153 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
9154 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
9155 | { } /* end */ | |
9156 | }; | |
9157 | ||
9158 | /* | |
9159 | * 4ch mode | |
9160 | */ | |
9161 | static struct hda_verb alc888_3st_hp_4ch_init[] = { | |
9162 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
9163 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
9164 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
9165 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9166 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
9167 | { } /* end */ | |
9168 | }; | |
9169 | ||
9170 | /* | |
9171 | * 6ch mode | |
9172 | */ | |
9173 | static struct hda_verb alc888_3st_hp_6ch_init[] = { | |
9174 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
9175 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9176 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
9177 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
9178 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9179 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
9180 | { } /* end */ | |
9181 | }; | |
9182 | ||
9183 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { | |
9184 | { 2, alc888_3st_hp_2ch_init }, | |
9185 | { 4, alc888_3st_hp_4ch_init }, | |
9186 | { 6, alc888_3st_hp_6ch_init }, | |
9187 | }; | |
9188 | ||
9189 | /* toggle front-jack and RCA according to the hp-jack state */ | |
9190 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | |
9191 | { | |
9192 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); | |
9193 | ||
9194 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9195 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9196 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9197 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9198 | } | |
9199 | ||
9200 | /* toggle RCA according to the front-jack state */ | |
9201 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) | |
9202 | { | |
9203 | unsigned int present = snd_hda_jack_detect(codec, 0x14); | |
9204 | ||
9205 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9206 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9207 | } | |
9208 | ||
9209 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, | |
9210 | unsigned int res) | |
9211 | { | |
9212 | if ((res >> 26) == ALC880_HP_EVENT) | |
9213 | alc888_lenovo_ms7195_front_automute(codec); | |
9214 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
9215 | alc888_lenovo_ms7195_rca_automute(codec); | |
9216 | } | |
9217 | ||
9218 | static struct hda_verb alc883_medion_md2_verbs[] = { | |
9219 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9220 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9221 | ||
9222 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9223 | ||
9224 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9225 | { } /* end */ | |
9226 | }; | |
9227 | ||
9228 | /* toggle speaker-output according to the hp-jack state */ | |
9229 | static void alc883_medion_md2_setup(struct hda_codec *codec) | |
9230 | { | |
9231 | struct alc_spec *spec = codec->spec; | |
9232 | ||
9233 | spec->autocfg.hp_pins[0] = 0x14; | |
9234 | spec->autocfg.speaker_pins[0] = 0x15; | |
9235 | } | |
9236 | ||
9237 | /* toggle speaker-output according to the hp-jack state */ | |
9238 | #define alc883_targa_init_hook alc882_targa_init_hook | |
9239 | #define alc883_targa_unsol_event alc882_targa_unsol_event | |
9240 | ||
9241 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) | |
9242 | { | |
9243 | unsigned int present; | |
9244 | ||
9245 | present = snd_hda_jack_detect(codec, 0x18); | |
9246 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | |
9247 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9248 | } | |
9249 | ||
9250 | static void alc883_clevo_m720_setup(struct hda_codec *codec) | |
9251 | { | |
9252 | struct alc_spec *spec = codec->spec; | |
9253 | ||
9254 | spec->autocfg.hp_pins[0] = 0x15; | |
9255 | spec->autocfg.speaker_pins[0] = 0x14; | |
9256 | } | |
9257 | ||
9258 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | |
9259 | { | |
9260 | alc_automute_amp(codec); | |
9261 | alc883_clevo_m720_mic_automute(codec); | |
9262 | } | |
9263 | ||
9264 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | |
9265 | unsigned int res) | |
9266 | { | |
9267 | switch (res >> 26) { | |
9268 | case ALC880_MIC_EVENT: | |
9269 | alc883_clevo_m720_mic_automute(codec); | |
9270 | break; | |
9271 | default: | |
9272 | alc_automute_amp_unsol_event(codec, res); | |
9273 | break; | |
9274 | } | |
9275 | } | |
9276 | ||
9277 | /* toggle speaker-output according to the hp-jack state */ | |
9278 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) | |
9279 | { | |
9280 | struct alc_spec *spec = codec->spec; | |
9281 | ||
9282 | spec->autocfg.hp_pins[0] = 0x14; | |
9283 | spec->autocfg.speaker_pins[0] = 0x15; | |
9284 | } | |
9285 | ||
9286 | static void alc883_haier_w66_setup(struct hda_codec *codec) | |
9287 | { | |
9288 | struct alc_spec *spec = codec->spec; | |
9289 | ||
9290 | spec->autocfg.hp_pins[0] = 0x1b; | |
9291 | spec->autocfg.speaker_pins[0] = 0x14; | |
9292 | } | |
9293 | ||
9294 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | |
9295 | { | |
9296 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; | |
9297 | ||
9298 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9299 | HDA_AMP_MUTE, bits); | |
9300 | } | |
9301 | ||
9302 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) | |
9303 | { | |
9304 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; | |
9305 | ||
9306 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9307 | HDA_AMP_MUTE, bits); | |
9308 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9309 | HDA_AMP_MUTE, bits); | |
9310 | } | |
9311 | ||
9312 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |
9313 | unsigned int res) | |
9314 | { | |
9315 | if ((res >> 26) == ALC880_HP_EVENT) | |
9316 | alc883_lenovo_101e_all_automute(codec); | |
9317 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
9318 | alc883_lenovo_101e_ispeaker_automute(codec); | |
9319 | } | |
9320 | ||
9321 | /* toggle speaker-output according to the hp-jack state */ | |
9322 | static void alc883_acer_aspire_setup(struct hda_codec *codec) | |
9323 | { | |
9324 | struct alc_spec *spec = codec->spec; | |
9325 | ||
9326 | spec->autocfg.hp_pins[0] = 0x14; | |
9327 | spec->autocfg.speaker_pins[0] = 0x15; | |
9328 | spec->autocfg.speaker_pins[1] = 0x16; | |
9329 | } | |
9330 | ||
9331 | static struct hda_verb alc883_acer_eapd_verbs[] = { | |
9332 | /* HP Pin: output 0 (0x0c) */ | |
9333 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9334 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9335 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9336 | /* Front Pin: output 0 (0x0c) */ | |
9337 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9338 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9339 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9340 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9341 | /* eanable EAPD on medion laptop */ | |
9342 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
9343 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
9344 | /* enable unsolicited event */ | |
9345 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9346 | { } | |
9347 | }; | |
9348 | ||
9349 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { | |
9350 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9351 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
9352 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9353 | { } /* end */ | |
9354 | }; | |
9355 | ||
9356 | static void alc888_6st_dell_setup(struct hda_codec *codec) | |
9357 | { | |
9358 | struct alc_spec *spec = codec->spec; | |
9359 | ||
9360 | spec->autocfg.hp_pins[0] = 0x1b; | |
9361 | spec->autocfg.speaker_pins[0] = 0x14; | |
9362 | spec->autocfg.speaker_pins[1] = 0x15; | |
9363 | spec->autocfg.speaker_pins[2] = 0x16; | |
9364 | spec->autocfg.speaker_pins[3] = 0x17; | |
9365 | } | |
9366 | ||
9367 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) | |
9368 | { | |
9369 | struct alc_spec *spec = codec->spec; | |
9370 | ||
9371 | spec->autocfg.hp_pins[0] = 0x1b; | |
9372 | spec->autocfg.speaker_pins[0] = 0x14; | |
9373 | spec->autocfg.speaker_pins[1] = 0x15; | |
9374 | spec->autocfg.speaker_pins[2] = 0x16; | |
9375 | spec->autocfg.speaker_pins[3] = 0x17; | |
9376 | spec->autocfg.speaker_pins[4] = 0x1a; | |
9377 | } | |
9378 | ||
9379 | static void alc883_vaiott_setup(struct hda_codec *codec) | |
9380 | { | |
9381 | struct alc_spec *spec = codec->spec; | |
9382 | ||
9383 | spec->autocfg.hp_pins[0] = 0x15; | |
9384 | spec->autocfg.speaker_pins[0] = 0x14; | |
9385 | spec->autocfg.speaker_pins[1] = 0x17; | |
9386 | } | |
9387 | ||
9388 | static struct hda_verb alc888_asus_m90v_verbs[] = { | |
9389 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9390 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9391 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9392 | /* enable unsolicited event */ | |
9393 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9394 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
9395 | { } /* end */ | |
9396 | }; | |
9397 | ||
9398 | static void alc883_mode2_setup(struct hda_codec *codec) | |
9399 | { | |
9400 | struct alc_spec *spec = codec->spec; | |
9401 | ||
9402 | spec->autocfg.hp_pins[0] = 0x1b; | |
9403 | spec->autocfg.speaker_pins[0] = 0x14; | |
9404 | spec->autocfg.speaker_pins[1] = 0x15; | |
9405 | spec->autocfg.speaker_pins[2] = 0x16; | |
9406 | spec->ext_mic.pin = 0x18; | |
9407 | spec->int_mic.pin = 0x19; | |
9408 | spec->ext_mic.mux_idx = 0; | |
9409 | spec->int_mic.mux_idx = 1; | |
9410 | spec->auto_mic = 1; | |
9411 | } | |
9412 | ||
9413 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | |
9414 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9415 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9416 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9417 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9418 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9419 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
9420 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, | |
9421 | /* enable unsolicited event */ | |
9422 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9423 | { } /* end */ | |
9424 | }; | |
9425 | ||
9426 | static void alc883_eee1601_inithook(struct hda_codec *codec) | |
9427 | { | |
9428 | struct alc_spec *spec = codec->spec; | |
9429 | ||
9430 | spec->autocfg.hp_pins[0] = 0x14; | |
9431 | spec->autocfg.speaker_pins[0] = 0x1b; | |
9432 | alc_automute_pin(codec); | |
9433 | } | |
9434 | ||
9435 | static struct hda_verb alc889A_mb31_verbs[] = { | |
9436 | /* Init rear pin (used as headphone output) */ | |
9437 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ | |
9438 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ | |
9439 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9440 | /* Init line pin (used as output in 4ch and 6ch mode) */ | |
9441 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ | |
9442 | /* Init line 2 pin (used as headphone out by default) */ | |
9443 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ | |
9444 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ | |
9445 | { } /* end */ | |
9446 | }; | |
9447 | ||
9448 | /* Mute speakers according to the headphone jack state */ | |
9449 | static void alc889A_mb31_automute(struct hda_codec *codec) | |
9450 | { | |
9451 | unsigned int present; | |
9452 | ||
9453 | /* Mute only in 2ch or 4ch mode */ | |
9454 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) | |
9455 | == 0x00) { | |
9456 | present = snd_hda_jack_detect(codec, 0x15); | |
9457 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9458 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9459 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
9460 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9461 | } | |
9462 | } | |
9463 | ||
9464 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) | |
9465 | { | |
9466 | if ((res >> 26) == ALC880_HP_EVENT) | |
9467 | alc889A_mb31_automute(codec); | |
9468 | } | |
9469 | ||
9470 | ||
9471 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
9472 | #define alc882_loopbacks alc880_loopbacks | |
9473 | #endif | |
9474 | ||
9475 | /* pcm configuration: identical with ALC880 */ | |
9476 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback | |
9477 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | |
9478 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | |
9479 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | |
9480 | ||
9481 | static hda_nid_t alc883_slave_dig_outs[] = { | |
9482 | ALC1200_DIGOUT_NID, 0, | |
9483 | }; | |
9484 | ||
9485 | static hda_nid_t alc1200_slave_dig_outs[] = { | |
9486 | ALC883_DIGOUT_NID, 0, | |
9487 | }; | |
9488 | ||
9489 | /* | |
9490 | * configuration and preset | |
9491 | */ | |
9492 | static const char *alc882_models[ALC882_MODEL_LAST] = { | |
9493 | [ALC882_3ST_DIG] = "3stack-dig", | |
9494 | [ALC882_6ST_DIG] = "6stack-dig", | |
9495 | [ALC882_ARIMA] = "arima", | |
9496 | [ALC882_W2JC] = "w2jc", | |
9497 | [ALC882_TARGA] = "targa", | |
9498 | [ALC882_ASUS_A7J] = "asus-a7j", | |
9499 | [ALC882_ASUS_A7M] = "asus-a7m", | |
9500 | [ALC885_MACPRO] = "macpro", | |
9501 | [ALC885_MB5] = "mb5", | |
9502 | [ALC885_MACMINI3] = "macmini3", | |
9503 | [ALC885_MBA21] = "mba21", | |
9504 | [ALC885_MBP3] = "mbp3", | |
9505 | [ALC885_IMAC24] = "imac24", | |
9506 | [ALC885_IMAC91] = "imac91", | |
9507 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", | |
9508 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | |
9509 | [ALC883_3ST_6ch] = "3stack-6ch", | |
9510 | [ALC883_6ST_DIG] = "alc883-6stack-dig", | |
9511 | [ALC883_TARGA_DIG] = "targa-dig", | |
9512 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | |
9513 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", | |
9514 | [ALC883_ACER] = "acer", | |
9515 | [ALC883_ACER_ASPIRE] = "acer-aspire", | |
9516 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", | |
9517 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", | |
9518 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", | |
9519 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", | |
9520 | [ALC883_MEDION] = "medion", | |
9521 | [ALC883_MEDION_MD2] = "medion-md2", | |
9522 | [ALC883_MEDION_WIM2160] = "medion-wim2160", | |
9523 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", | |
9524 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", | |
9525 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", | |
9526 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | |
9527 | [ALC888_LENOVO_SKY] = "lenovo-sky", | |
9528 | [ALC883_HAIER_W66] = "haier-w66", | |
9529 | [ALC888_3ST_HP] = "3stack-hp", | |
9530 | [ALC888_6ST_DELL] = "6stack-dell", | |
9531 | [ALC883_MITAC] = "mitac", | |
9532 | [ALC883_CLEVO_M540R] = "clevo-m540r", | |
9533 | [ALC883_CLEVO_M720] = "clevo-m720", | |
9534 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", | |
9535 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", | |
9536 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", | |
9537 | [ALC889A_INTEL] = "intel-alc889a", | |
9538 | [ALC889_INTEL] = "intel-x58", | |
9539 | [ALC1200_ASUS_P5Q] = "asus-p5q", | |
9540 | [ALC889A_MB31] = "mb31", | |
9541 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", | |
9542 | [ALC882_AUTO] = "auto", | |
9543 | }; | |
9544 | ||
9545 | static struct snd_pci_quirk alc882_cfg_tbl[] = { | |
9546 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | |
9547 | ||
9548 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), | |
9549 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), | |
9550 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), | |
9551 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), | |
9552 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | |
9553 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), | |
9554 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", | |
9555 | ALC888_ACER_ASPIRE_4930G), | |
9556 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", | |
9557 | ALC888_ACER_ASPIRE_4930G), | |
9558 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", | |
9559 | ALC888_ACER_ASPIRE_8930G), | |
9560 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", | |
9561 | ALC888_ACER_ASPIRE_8930G), | |
9562 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), | |
9563 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), | |
9564 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | |
9565 | ALC888_ACER_ASPIRE_6530G), | |
9566 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | |
9567 | ALC888_ACER_ASPIRE_6530G), | |
9568 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", | |
9569 | ALC888_ACER_ASPIRE_7730G), | |
9570 | /* default Acer -- disabled as it causes more problems. | |
9571 | * model=auto should work fine now | |
9572 | */ | |
9573 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ | |
9574 | ||
9575 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), | |
9576 | ||
9577 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), | |
9578 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), | |
9579 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | |
9580 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), | |
9581 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), | |
9582 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), | |
9583 | ||
9584 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), | |
9585 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), | |
9586 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), | |
9587 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), | |
9588 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), | |
9589 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), | |
9590 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), | |
9591 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | |
9592 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), | |
9593 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), | |
9594 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), | |
9595 | ||
9596 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), | |
9597 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), | |
9598 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), | |
9599 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), | |
9600 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), | |
9601 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | |
9602 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), | |
9603 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), | |
9604 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), | |
9605 | ||
9606 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), | |
9607 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), | |
9608 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | |
9609 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ | |
9610 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), | |
9611 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | |
9612 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), | |
9613 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), | |
9614 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), | |
9615 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), | |
9616 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), | |
9617 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | |
9618 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), | |
9619 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), | |
9620 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), | |
9621 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), | |
9622 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | |
9623 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | |
9624 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), | |
9625 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), | |
9626 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), | |
9627 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | |
9628 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | |
9629 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), | |
9630 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), | |
9631 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), | |
9632 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | |
9633 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), | |
9634 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), | |
9635 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), | |
9636 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), | |
9637 | ||
9638 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), | |
9639 | SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), | |
9640 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), | |
9641 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | |
9642 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), | |
9643 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), | |
9644 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | |
9645 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ | |
9646 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | |
9647 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", | |
9648 | ALC883_FUJITSU_PI2515), | |
9649 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", | |
9650 | ALC888_FUJITSU_XA3530), | |
9651 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), | |
9652 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
9653 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
9654 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
9655 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), | |
9656 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), | |
9657 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), | |
9658 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), | |
9659 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | |
9660 | ||
9661 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), | |
9662 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | |
9663 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), | |
9664 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), | |
9665 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), | |
9666 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), | |
9667 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), | |
9668 | ||
9669 | {} | |
9670 | }; | |
9671 | ||
9672 | /* codec SSID table for Intel Mac */ | |
9673 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | |
9674 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), | |
9675 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), | |
9676 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), | |
9677 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), | |
9678 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), | |
9679 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), | |
9680 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), | |
9681 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), | |
9682 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), | |
9683 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), | |
9684 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), | |
9685 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), | |
9686 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | |
9687 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | |
9688 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), | |
9689 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), | |
9690 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), | |
9691 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, | |
9692 | * so apparently no perfect solution yet | |
9693 | */ | |
9694 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), | |
9695 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), | |
9696 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), | |
9697 | {} /* terminator */ | |
9698 | }; | |
9699 | ||
9700 | static struct alc_config_preset alc882_presets[] = { | |
9701 | [ALC882_3ST_DIG] = { | |
9702 | .mixers = { alc882_base_mixer }, | |
9703 | .init_verbs = { alc882_base_init_verbs, | |
9704 | alc882_adc1_init_verbs }, | |
9705 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9706 | .dac_nids = alc882_dac_nids, | |
9707 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9708 | .dig_in_nid = ALC882_DIGIN_NID, | |
9709 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9710 | .channel_mode = alc882_ch_modes, | |
9711 | .need_dac_fix = 1, | |
9712 | .input_mux = &alc882_capture_source, | |
9713 | }, | |
9714 | [ALC882_6ST_DIG] = { | |
9715 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
9716 | .init_verbs = { alc882_base_init_verbs, | |
9717 | alc882_adc1_init_verbs }, | |
9718 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9719 | .dac_nids = alc882_dac_nids, | |
9720 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9721 | .dig_in_nid = ALC882_DIGIN_NID, | |
9722 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
9723 | .channel_mode = alc882_sixstack_modes, | |
9724 | .input_mux = &alc882_capture_source, | |
9725 | }, | |
9726 | [ALC882_ARIMA] = { | |
9727 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
9728 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
9729 | alc882_eapd_verbs }, | |
9730 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9731 | .dac_nids = alc882_dac_nids, | |
9732 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
9733 | .channel_mode = alc882_sixstack_modes, | |
9734 | .input_mux = &alc882_capture_source, | |
9735 | }, | |
9736 | [ALC882_W2JC] = { | |
9737 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | |
9738 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
9739 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, | |
9740 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9741 | .dac_nids = alc882_dac_nids, | |
9742 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
9743 | .channel_mode = alc880_threestack_modes, | |
9744 | .need_dac_fix = 1, | |
9745 | .input_mux = &alc882_capture_source, | |
9746 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9747 | }, | |
9748 | [ALC885_MBA21] = { | |
9749 | .mixers = { alc885_mba21_mixer }, | |
9750 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, | |
9751 | .num_dacs = 2, | |
9752 | .dac_nids = alc882_dac_nids, | |
9753 | .channel_mode = alc885_mba21_ch_modes, | |
9754 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), | |
9755 | .input_mux = &alc882_capture_source, | |
9756 | .unsol_event = alc_automute_amp_unsol_event, | |
9757 | .setup = alc885_mba21_setup, | |
9758 | .init_hook = alc_automute_amp, | |
9759 | }, | |
9760 | [ALC885_MBP3] = { | |
9761 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | |
9762 | .init_verbs = { alc885_mbp3_init_verbs, | |
9763 | alc880_gpio1_init_verbs }, | |
9764 | .num_dacs = 2, | |
9765 | .dac_nids = alc882_dac_nids, | |
9766 | .hp_nid = 0x04, | |
9767 | .channel_mode = alc885_mbp_4ch_modes, | |
9768 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | |
9769 | .input_mux = &alc882_capture_source, | |
9770 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9771 | .dig_in_nid = ALC882_DIGIN_NID, | |
9772 | .unsol_event = alc_automute_amp_unsol_event, | |
9773 | .setup = alc885_mbp3_setup, | |
9774 | .init_hook = alc_automute_amp, | |
9775 | }, | |
9776 | [ALC885_MB5] = { | |
9777 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, | |
9778 | .init_verbs = { alc885_mb5_init_verbs, | |
9779 | alc880_gpio1_init_verbs }, | |
9780 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9781 | .dac_nids = alc882_dac_nids, | |
9782 | .channel_mode = alc885_mb5_6ch_modes, | |
9783 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), | |
9784 | .input_mux = &mb5_capture_source, | |
9785 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9786 | .dig_in_nid = ALC882_DIGIN_NID, | |
9787 | .unsol_event = alc_automute_amp_unsol_event, | |
9788 | .setup = alc885_mb5_setup, | |
9789 | .init_hook = alc_automute_amp, | |
9790 | }, | |
9791 | [ALC885_MACMINI3] = { | |
9792 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, | |
9793 | .init_verbs = { alc885_macmini3_init_verbs, | |
9794 | alc880_gpio1_init_verbs }, | |
9795 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9796 | .dac_nids = alc882_dac_nids, | |
9797 | .channel_mode = alc885_macmini3_6ch_modes, | |
9798 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), | |
9799 | .input_mux = &macmini3_capture_source, | |
9800 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9801 | .dig_in_nid = ALC882_DIGIN_NID, | |
9802 | .unsol_event = alc_automute_amp_unsol_event, | |
9803 | .setup = alc885_macmini3_setup, | |
9804 | .init_hook = alc_automute_amp, | |
9805 | }, | |
9806 | [ALC885_MACPRO] = { | |
9807 | .mixers = { alc882_macpro_mixer }, | |
9808 | .init_verbs = { alc882_macpro_init_verbs }, | |
9809 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9810 | .dac_nids = alc882_dac_nids, | |
9811 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9812 | .dig_in_nid = ALC882_DIGIN_NID, | |
9813 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9814 | .channel_mode = alc882_ch_modes, | |
9815 | .input_mux = &alc882_capture_source, | |
9816 | .init_hook = alc885_macpro_init_hook, | |
9817 | }, | |
9818 | [ALC885_IMAC24] = { | |
9819 | .mixers = { alc885_imac24_mixer }, | |
9820 | .init_verbs = { alc885_imac24_init_verbs }, | |
9821 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9822 | .dac_nids = alc882_dac_nids, | |
9823 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9824 | .dig_in_nid = ALC882_DIGIN_NID, | |
9825 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9826 | .channel_mode = alc882_ch_modes, | |
9827 | .input_mux = &alc882_capture_source, | |
9828 | .unsol_event = alc_automute_amp_unsol_event, | |
9829 | .setup = alc885_imac24_setup, | |
9830 | .init_hook = alc885_imac24_init_hook, | |
9831 | }, | |
9832 | [ALC885_IMAC91] = { | |
9833 | .mixers = {alc885_imac91_mixer}, | |
9834 | .init_verbs = { alc885_imac91_init_verbs, | |
9835 | alc880_gpio1_init_verbs }, | |
9836 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9837 | .dac_nids = alc882_dac_nids, | |
9838 | .channel_mode = alc885_mba21_ch_modes, | |
9839 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), | |
9840 | .input_mux = &alc889A_imac91_capture_source, | |
9841 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9842 | .dig_in_nid = ALC882_DIGIN_NID, | |
9843 | .unsol_event = alc_automute_amp_unsol_event, | |
9844 | .setup = alc885_imac91_setup, | |
9845 | .init_hook = alc_automute_amp, | |
9846 | }, | |
9847 | [ALC882_TARGA] = { | |
9848 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | |
9849 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
9850 | alc880_gpio3_init_verbs, alc882_targa_verbs}, | |
9851 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9852 | .dac_nids = alc882_dac_nids, | |
9853 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9854 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
9855 | .adc_nids = alc882_adc_nids, | |
9856 | .capsrc_nids = alc882_capsrc_nids, | |
9857 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | |
9858 | .channel_mode = alc882_3ST_6ch_modes, | |
9859 | .need_dac_fix = 1, | |
9860 | .input_mux = &alc882_capture_source, | |
9861 | .unsol_event = alc882_targa_unsol_event, | |
9862 | .setup = alc882_targa_setup, | |
9863 | .init_hook = alc882_targa_automute, | |
9864 | }, | |
9865 | [ALC882_ASUS_A7J] = { | |
9866 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | |
9867 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
9868 | alc882_asus_a7j_verbs}, | |
9869 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9870 | .dac_nids = alc882_dac_nids, | |
9871 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9872 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
9873 | .adc_nids = alc882_adc_nids, | |
9874 | .capsrc_nids = alc882_capsrc_nids, | |
9875 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | |
9876 | .channel_mode = alc882_3ST_6ch_modes, | |
9877 | .need_dac_fix = 1, | |
9878 | .input_mux = &alc882_capture_source, | |
9879 | }, | |
9880 | [ALC882_ASUS_A7M] = { | |
9881 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | |
9882 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
9883 | alc882_eapd_verbs, alc880_gpio1_init_verbs, | |
9884 | alc882_asus_a7m_verbs }, | |
9885 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9886 | .dac_nids = alc882_dac_nids, | |
9887 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9888 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
9889 | .channel_mode = alc880_threestack_modes, | |
9890 | .need_dac_fix = 1, | |
9891 | .input_mux = &alc882_capture_source, | |
9892 | }, | |
9893 | [ALC883_3ST_2ch_DIG] = { | |
9894 | .mixers = { alc883_3ST_2ch_mixer }, | |
9895 | .init_verbs = { alc883_init_verbs }, | |
9896 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9897 | .dac_nids = alc883_dac_nids, | |
9898 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9899 | .dig_in_nid = ALC883_DIGIN_NID, | |
9900 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9901 | .channel_mode = alc883_3ST_2ch_modes, | |
9902 | .input_mux = &alc883_capture_source, | |
9903 | }, | |
9904 | [ALC883_3ST_6ch_DIG] = { | |
9905 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
9906 | .init_verbs = { alc883_init_verbs }, | |
9907 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9908 | .dac_nids = alc883_dac_nids, | |
9909 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9910 | .dig_in_nid = ALC883_DIGIN_NID, | |
9911 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
9912 | .channel_mode = alc883_3ST_6ch_modes, | |
9913 | .need_dac_fix = 1, | |
9914 | .input_mux = &alc883_capture_source, | |
9915 | }, | |
9916 | [ALC883_3ST_6ch] = { | |
9917 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
9918 | .init_verbs = { alc883_init_verbs }, | |
9919 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9920 | .dac_nids = alc883_dac_nids, | |
9921 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
9922 | .channel_mode = alc883_3ST_6ch_modes, | |
9923 | .need_dac_fix = 1, | |
9924 | .input_mux = &alc883_capture_source, | |
9925 | }, | |
9926 | [ALC883_3ST_6ch_INTEL] = { | |
9927 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, | |
9928 | .init_verbs = { alc883_init_verbs }, | |
9929 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9930 | .dac_nids = alc883_dac_nids, | |
9931 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9932 | .dig_in_nid = ALC883_DIGIN_NID, | |
9933 | .slave_dig_outs = alc883_slave_dig_outs, | |
9934 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), | |
9935 | .channel_mode = alc883_3ST_6ch_intel_modes, | |
9936 | .need_dac_fix = 1, | |
9937 | .input_mux = &alc883_3stack_6ch_intel, | |
9938 | }, | |
9939 | [ALC889A_INTEL] = { | |
9940 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | |
9941 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, | |
9942 | alc_hp15_unsol_verbs }, | |
9943 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9944 | .dac_nids = alc883_dac_nids, | |
9945 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
9946 | .adc_nids = alc889_adc_nids, | |
9947 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9948 | .dig_in_nid = ALC883_DIGIN_NID, | |
9949 | .slave_dig_outs = alc883_slave_dig_outs, | |
9950 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | |
9951 | .channel_mode = alc889_8ch_intel_modes, | |
9952 | .capsrc_nids = alc889_capsrc_nids, | |
9953 | .input_mux = &alc889_capture_source, | |
9954 | .setup = alc889_automute_setup, | |
9955 | .init_hook = alc_automute_amp, | |
9956 | .unsol_event = alc_automute_amp_unsol_event, | |
9957 | .need_dac_fix = 1, | |
9958 | }, | |
9959 | [ALC889_INTEL] = { | |
9960 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | |
9961 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, | |
9962 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, | |
9963 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9964 | .dac_nids = alc883_dac_nids, | |
9965 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
9966 | .adc_nids = alc889_adc_nids, | |
9967 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9968 | .dig_in_nid = ALC883_DIGIN_NID, | |
9969 | .slave_dig_outs = alc883_slave_dig_outs, | |
9970 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | |
9971 | .channel_mode = alc889_8ch_intel_modes, | |
9972 | .capsrc_nids = alc889_capsrc_nids, | |
9973 | .input_mux = &alc889_capture_source, | |
9974 | .setup = alc889_automute_setup, | |
9975 | .init_hook = alc889_intel_init_hook, | |
9976 | .unsol_event = alc_automute_amp_unsol_event, | |
9977 | .need_dac_fix = 1, | |
9978 | }, | |
9979 | [ALC883_6ST_DIG] = { | |
9980 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
9981 | .init_verbs = { alc883_init_verbs }, | |
9982 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9983 | .dac_nids = alc883_dac_nids, | |
9984 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9985 | .dig_in_nid = ALC883_DIGIN_NID, | |
9986 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
9987 | .channel_mode = alc883_sixstack_modes, | |
9988 | .input_mux = &alc883_capture_source, | |
9989 | }, | |
9990 | [ALC883_TARGA_DIG] = { | |
9991 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, | |
9992 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | |
9993 | alc883_targa_verbs}, | |
9994 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9995 | .dac_nids = alc883_dac_nids, | |
9996 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9997 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
9998 | .channel_mode = alc883_3ST_6ch_modes, | |
9999 | .need_dac_fix = 1, | |
10000 | .input_mux = &alc883_capture_source, | |
10001 | .unsol_event = alc883_targa_unsol_event, | |
10002 | .setup = alc882_targa_setup, | |
10003 | .init_hook = alc882_targa_automute, | |
10004 | }, | |
10005 | [ALC883_TARGA_2ch_DIG] = { | |
10006 | .mixers = { alc883_targa_2ch_mixer}, | |
10007 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | |
10008 | alc883_targa_verbs}, | |
10009 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10010 | .dac_nids = alc883_dac_nids, | |
10011 | .adc_nids = alc883_adc_nids_alt, | |
10012 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
10013 | .capsrc_nids = alc883_capsrc_nids, | |
10014 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10015 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10016 | .channel_mode = alc883_3ST_2ch_modes, | |
10017 | .input_mux = &alc883_capture_source, | |
10018 | .unsol_event = alc883_targa_unsol_event, | |
10019 | .setup = alc882_targa_setup, | |
10020 | .init_hook = alc882_targa_automute, | |
10021 | }, | |
10022 | [ALC883_TARGA_8ch_DIG] = { | |
10023 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, | |
10024 | alc883_chmode_mixer }, | |
10025 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | |
10026 | alc883_targa_verbs }, | |
10027 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10028 | .dac_nids = alc883_dac_nids, | |
10029 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10030 | .adc_nids = alc883_adc_nids_rev, | |
10031 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10032 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10033 | .dig_in_nid = ALC883_DIGIN_NID, | |
10034 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), | |
10035 | .channel_mode = alc883_4ST_8ch_modes, | |
10036 | .need_dac_fix = 1, | |
10037 | .input_mux = &alc883_capture_source, | |
10038 | .unsol_event = alc883_targa_unsol_event, | |
10039 | .setup = alc882_targa_setup, | |
10040 | .init_hook = alc882_targa_automute, | |
10041 | }, | |
10042 | [ALC883_ACER] = { | |
10043 | .mixers = { alc883_base_mixer }, | |
10044 | /* On TravelMate laptops, GPIO 0 enables the internal speaker | |
10045 | * and the headphone jack. Turn this on and rely on the | |
10046 | * standard mute methods whenever the user wants to turn | |
10047 | * these outputs off. | |
10048 | */ | |
10049 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | |
10050 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10051 | .dac_nids = alc883_dac_nids, | |
10052 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10053 | .channel_mode = alc883_3ST_2ch_modes, | |
10054 | .input_mux = &alc883_capture_source, | |
10055 | }, | |
10056 | [ALC883_ACER_ASPIRE] = { | |
10057 | .mixers = { alc883_acer_aspire_mixer }, | |
10058 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, | |
10059 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10060 | .dac_nids = alc883_dac_nids, | |
10061 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10062 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10063 | .channel_mode = alc883_3ST_2ch_modes, | |
10064 | .input_mux = &alc883_capture_source, | |
10065 | .unsol_event = alc_automute_amp_unsol_event, | |
10066 | .setup = alc883_acer_aspire_setup, | |
10067 | .init_hook = alc_automute_amp, | |
10068 | }, | |
10069 | [ALC888_ACER_ASPIRE_4930G] = { | |
10070 | .mixers = { alc888_base_mixer, | |
10071 | alc883_chmode_mixer }, | |
10072 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10073 | alc888_acer_aspire_4930g_verbs }, | |
10074 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10075 | .dac_nids = alc883_dac_nids, | |
10076 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10077 | .adc_nids = alc883_adc_nids_rev, | |
10078 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10079 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10080 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10081 | .channel_mode = alc883_3ST_6ch_modes, | |
10082 | .need_dac_fix = 1, | |
10083 | .const_channel_count = 6, | |
10084 | .num_mux_defs = | |
10085 | ARRAY_SIZE(alc888_2_capture_sources), | |
10086 | .input_mux = alc888_2_capture_sources, | |
10087 | .unsol_event = alc_automute_amp_unsol_event, | |
10088 | .setup = alc888_acer_aspire_4930g_setup, | |
10089 | .init_hook = alc_automute_amp, | |
10090 | }, | |
10091 | [ALC888_ACER_ASPIRE_6530G] = { | |
10092 | .mixers = { alc888_acer_aspire_6530_mixer }, | |
10093 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10094 | alc888_acer_aspire_6530g_verbs }, | |
10095 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10096 | .dac_nids = alc883_dac_nids, | |
10097 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10098 | .adc_nids = alc883_adc_nids_rev, | |
10099 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10100 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10101 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10102 | .channel_mode = alc883_3ST_2ch_modes, | |
10103 | .num_mux_defs = | |
10104 | ARRAY_SIZE(alc888_2_capture_sources), | |
10105 | .input_mux = alc888_acer_aspire_6530_sources, | |
10106 | .unsol_event = alc_automute_amp_unsol_event, | |
10107 | .setup = alc888_acer_aspire_6530g_setup, | |
10108 | .init_hook = alc_automute_amp, | |
10109 | }, | |
10110 | [ALC888_ACER_ASPIRE_8930G] = { | |
10111 | .mixers = { alc889_acer_aspire_8930g_mixer, | |
10112 | alc883_chmode_mixer }, | |
10113 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10114 | alc889_acer_aspire_8930g_verbs, | |
10115 | alc889_eapd_verbs}, | |
10116 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10117 | .dac_nids = alc883_dac_nids, | |
10118 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
10119 | .adc_nids = alc889_adc_nids, | |
10120 | .capsrc_nids = alc889_capsrc_nids, | |
10121 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10122 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10123 | .channel_mode = alc883_3ST_6ch_modes, | |
10124 | .need_dac_fix = 1, | |
10125 | .const_channel_count = 6, | |
10126 | .num_mux_defs = | |
10127 | ARRAY_SIZE(alc889_capture_sources), | |
10128 | .input_mux = alc889_capture_sources, | |
10129 | .unsol_event = alc_automute_amp_unsol_event, | |
10130 | .setup = alc889_acer_aspire_8930g_setup, | |
10131 | .init_hook = alc_automute_amp, | |
10132 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
10133 | .power_hook = alc_power_eapd, | |
10134 | #endif | |
10135 | }, | |
10136 | [ALC888_ACER_ASPIRE_7730G] = { | |
10137 | .mixers = { alc883_3ST_6ch_mixer, | |
10138 | alc883_chmode_mixer }, | |
10139 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10140 | alc888_acer_aspire_7730G_verbs }, | |
10141 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10142 | .dac_nids = alc883_dac_nids, | |
10143 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10144 | .adc_nids = alc883_adc_nids_rev, | |
10145 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10146 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10147 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10148 | .channel_mode = alc883_3ST_6ch_modes, | |
10149 | .need_dac_fix = 1, | |
10150 | .const_channel_count = 6, | |
10151 | .input_mux = &alc883_capture_source, | |
10152 | .unsol_event = alc_automute_amp_unsol_event, | |
10153 | .setup = alc888_acer_aspire_6530g_setup, | |
10154 | .init_hook = alc_automute_amp, | |
10155 | }, | |
10156 | [ALC883_MEDION] = { | |
10157 | .mixers = { alc883_fivestack_mixer, | |
10158 | alc883_chmode_mixer }, | |
10159 | .init_verbs = { alc883_init_verbs, | |
10160 | alc883_medion_eapd_verbs }, | |
10161 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10162 | .dac_nids = alc883_dac_nids, | |
10163 | .adc_nids = alc883_adc_nids_alt, | |
10164 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
10165 | .capsrc_nids = alc883_capsrc_nids, | |
10166 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10167 | .channel_mode = alc883_sixstack_modes, | |
10168 | .input_mux = &alc883_capture_source, | |
10169 | }, | |
10170 | [ALC883_MEDION_MD2] = { | |
10171 | .mixers = { alc883_medion_md2_mixer}, | |
10172 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, | |
10173 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10174 | .dac_nids = alc883_dac_nids, | |
10175 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10176 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10177 | .channel_mode = alc883_3ST_2ch_modes, | |
10178 | .input_mux = &alc883_capture_source, | |
10179 | .unsol_event = alc_automute_amp_unsol_event, | |
10180 | .setup = alc883_medion_md2_setup, | |
10181 | .init_hook = alc_automute_amp, | |
10182 | }, | |
10183 | [ALC883_MEDION_WIM2160] = { | |
10184 | .mixers = { alc883_medion_wim2160_mixer }, | |
10185 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, | |
10186 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10187 | .dac_nids = alc883_dac_nids, | |
10188 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10189 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
10190 | .adc_nids = alc883_adc_nids, | |
10191 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10192 | .channel_mode = alc883_3ST_2ch_modes, | |
10193 | .input_mux = &alc883_capture_source, | |
10194 | .unsol_event = alc_automute_amp_unsol_event, | |
10195 | .setup = alc883_medion_wim2160_setup, | |
10196 | .init_hook = alc_automute_amp, | |
10197 | }, | |
10198 | [ALC883_LAPTOP_EAPD] = { | |
10199 | .mixers = { alc883_base_mixer }, | |
10200 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, | |
10201 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10202 | .dac_nids = alc883_dac_nids, | |
10203 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10204 | .channel_mode = alc883_3ST_2ch_modes, | |
10205 | .input_mux = &alc883_capture_source, | |
10206 | }, | |
10207 | [ALC883_CLEVO_M540R] = { | |
10208 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10209 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, | |
10210 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10211 | .dac_nids = alc883_dac_nids, | |
10212 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10213 | .dig_in_nid = ALC883_DIGIN_NID, | |
10214 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), | |
10215 | .channel_mode = alc883_3ST_6ch_clevo_modes, | |
10216 | .need_dac_fix = 1, | |
10217 | .input_mux = &alc883_capture_source, | |
10218 | /* This machine has the hardware HP auto-muting, thus | |
10219 | * we need no software mute via unsol event | |
10220 | */ | |
10221 | }, | |
10222 | [ALC883_CLEVO_M720] = { | |
10223 | .mixers = { alc883_clevo_m720_mixer }, | |
10224 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | |
10225 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10226 | .dac_nids = alc883_dac_nids, | |
10227 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10228 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10229 | .channel_mode = alc883_3ST_2ch_modes, | |
10230 | .input_mux = &alc883_capture_source, | |
10231 | .unsol_event = alc883_clevo_m720_unsol_event, | |
10232 | .setup = alc883_clevo_m720_setup, | |
10233 | .init_hook = alc883_clevo_m720_init_hook, | |
10234 | }, | |
10235 | [ALC883_LENOVO_101E_2ch] = { | |
10236 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | |
10237 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | |
10238 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10239 | .dac_nids = alc883_dac_nids, | |
10240 | .adc_nids = alc883_adc_nids_alt, | |
10241 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
10242 | .capsrc_nids = alc883_capsrc_nids, | |
10243 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10244 | .channel_mode = alc883_3ST_2ch_modes, | |
10245 | .input_mux = &alc883_lenovo_101e_capture_source, | |
10246 | .unsol_event = alc883_lenovo_101e_unsol_event, | |
10247 | .init_hook = alc883_lenovo_101e_all_automute, | |
10248 | }, | |
10249 | [ALC883_LENOVO_NB0763] = { | |
10250 | .mixers = { alc883_lenovo_nb0763_mixer }, | |
10251 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | |
10252 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10253 | .dac_nids = alc883_dac_nids, | |
10254 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10255 | .channel_mode = alc883_3ST_2ch_modes, | |
10256 | .need_dac_fix = 1, | |
10257 | .input_mux = &alc883_lenovo_nb0763_capture_source, | |
10258 | .unsol_event = alc_automute_amp_unsol_event, | |
10259 | .setup = alc883_medion_md2_setup, | |
10260 | .init_hook = alc_automute_amp, | |
10261 | }, | |
10262 | [ALC888_LENOVO_MS7195_DIG] = { | |
10263 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10264 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, | |
10265 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10266 | .dac_nids = alc883_dac_nids, | |
10267 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10268 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10269 | .channel_mode = alc883_3ST_6ch_modes, | |
10270 | .need_dac_fix = 1, | |
10271 | .input_mux = &alc883_capture_source, | |
10272 | .unsol_event = alc883_lenovo_ms7195_unsol_event, | |
10273 | .init_hook = alc888_lenovo_ms7195_front_automute, | |
10274 | }, | |
10275 | [ALC883_HAIER_W66] = { | |
10276 | .mixers = { alc883_targa_2ch_mixer}, | |
10277 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, | |
10278 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10279 | .dac_nids = alc883_dac_nids, | |
10280 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10281 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10282 | .channel_mode = alc883_3ST_2ch_modes, | |
10283 | .input_mux = &alc883_capture_source, | |
10284 | .unsol_event = alc_automute_amp_unsol_event, | |
10285 | .setup = alc883_haier_w66_setup, | |
10286 | .init_hook = alc_automute_amp, | |
10287 | }, | |
10288 | [ALC888_3ST_HP] = { | |
10289 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10290 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, | |
10291 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10292 | .dac_nids = alc883_dac_nids, | |
10293 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), | |
10294 | .channel_mode = alc888_3st_hp_modes, | |
10295 | .need_dac_fix = 1, | |
10296 | .input_mux = &alc883_capture_source, | |
10297 | .unsol_event = alc_automute_amp_unsol_event, | |
10298 | .setup = alc888_3st_hp_setup, | |
10299 | .init_hook = alc_automute_amp, | |
10300 | }, | |
10301 | [ALC888_6ST_DELL] = { | |
10302 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
10303 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, | |
10304 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10305 | .dac_nids = alc883_dac_nids, | |
10306 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10307 | .dig_in_nid = ALC883_DIGIN_NID, | |
10308 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10309 | .channel_mode = alc883_sixstack_modes, | |
10310 | .input_mux = &alc883_capture_source, | |
10311 | .unsol_event = alc_automute_amp_unsol_event, | |
10312 | .setup = alc888_6st_dell_setup, | |
10313 | .init_hook = alc_automute_amp, | |
10314 | }, | |
10315 | [ALC883_MITAC] = { | |
10316 | .mixers = { alc883_mitac_mixer }, | |
10317 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | |
10318 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10319 | .dac_nids = alc883_dac_nids, | |
10320 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10321 | .channel_mode = alc883_3ST_2ch_modes, | |
10322 | .input_mux = &alc883_capture_source, | |
10323 | .unsol_event = alc_automute_amp_unsol_event, | |
10324 | .setup = alc883_mitac_setup, | |
10325 | .init_hook = alc_automute_amp, | |
10326 | }, | |
10327 | [ALC883_FUJITSU_PI2515] = { | |
10328 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | |
10329 | .init_verbs = { alc883_init_verbs, | |
10330 | alc883_2ch_fujitsu_pi2515_verbs}, | |
10331 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10332 | .dac_nids = alc883_dac_nids, | |
10333 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10334 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10335 | .channel_mode = alc883_3ST_2ch_modes, | |
10336 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
10337 | .unsol_event = alc_automute_amp_unsol_event, | |
10338 | .setup = alc883_2ch_fujitsu_pi2515_setup, | |
10339 | .init_hook = alc_automute_amp, | |
10340 | }, | |
10341 | [ALC888_FUJITSU_XA3530] = { | |
10342 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, | |
10343 | .init_verbs = { alc883_init_verbs, | |
10344 | alc888_fujitsu_xa3530_verbs }, | |
10345 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10346 | .dac_nids = alc883_dac_nids, | |
10347 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10348 | .adc_nids = alc883_adc_nids_rev, | |
10349 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10350 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10351 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), | |
10352 | .channel_mode = alc888_4ST_8ch_intel_modes, | |
10353 | .num_mux_defs = | |
10354 | ARRAY_SIZE(alc888_2_capture_sources), | |
10355 | .input_mux = alc888_2_capture_sources, | |
10356 | .unsol_event = alc_automute_amp_unsol_event, | |
10357 | .setup = alc888_fujitsu_xa3530_setup, | |
10358 | .init_hook = alc_automute_amp, | |
10359 | }, | |
10360 | [ALC888_LENOVO_SKY] = { | |
10361 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | |
10362 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, | |
10363 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10364 | .dac_nids = alc883_dac_nids, | |
10365 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10366 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10367 | .channel_mode = alc883_sixstack_modes, | |
10368 | .need_dac_fix = 1, | |
10369 | .input_mux = &alc883_lenovo_sky_capture_source, | |
10370 | .unsol_event = alc_automute_amp_unsol_event, | |
10371 | .setup = alc888_lenovo_sky_setup, | |
10372 | .init_hook = alc_automute_amp, | |
10373 | }, | |
10374 | [ALC888_ASUS_M90V] = { | |
10375 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10376 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, | |
10377 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10378 | .dac_nids = alc883_dac_nids, | |
10379 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10380 | .dig_in_nid = ALC883_DIGIN_NID, | |
10381 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10382 | .channel_mode = alc883_3ST_6ch_modes, | |
10383 | .need_dac_fix = 1, | |
10384 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
10385 | .unsol_event = alc_sku_unsol_event, | |
10386 | .setup = alc883_mode2_setup, | |
10387 | .init_hook = alc_inithook, | |
10388 | }, | |
10389 | [ALC888_ASUS_EEE1601] = { | |
10390 | .mixers = { alc883_asus_eee1601_mixer }, | |
10391 | .cap_mixer = alc883_asus_eee1601_cap_mixer, | |
10392 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, | |
10393 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10394 | .dac_nids = alc883_dac_nids, | |
10395 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10396 | .dig_in_nid = ALC883_DIGIN_NID, | |
10397 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10398 | .channel_mode = alc883_3ST_2ch_modes, | |
10399 | .need_dac_fix = 1, | |
10400 | .input_mux = &alc883_asus_eee1601_capture_source, | |
10401 | .unsol_event = alc_sku_unsol_event, | |
10402 | .init_hook = alc883_eee1601_inithook, | |
10403 | }, | |
10404 | [ALC1200_ASUS_P5Q] = { | |
10405 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
10406 | .init_verbs = { alc883_init_verbs }, | |
10407 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10408 | .dac_nids = alc883_dac_nids, | |
10409 | .dig_out_nid = ALC1200_DIGOUT_NID, | |
10410 | .dig_in_nid = ALC883_DIGIN_NID, | |
10411 | .slave_dig_outs = alc1200_slave_dig_outs, | |
10412 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10413 | .channel_mode = alc883_sixstack_modes, | |
10414 | .input_mux = &alc883_capture_source, | |
10415 | }, | |
10416 | [ALC889A_MB31] = { | |
10417 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, | |
10418 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, | |
10419 | alc880_gpio1_init_verbs }, | |
10420 | .adc_nids = alc883_adc_nids, | |
10421 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
10422 | .capsrc_nids = alc883_capsrc_nids, | |
10423 | .dac_nids = alc883_dac_nids, | |
10424 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10425 | .channel_mode = alc889A_mb31_6ch_modes, | |
10426 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), | |
10427 | .input_mux = &alc889A_mb31_capture_source, | |
10428 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10429 | .unsol_event = alc889A_mb31_unsol_event, | |
10430 | .init_hook = alc889A_mb31_automute, | |
10431 | }, | |
10432 | [ALC883_SONY_VAIO_TT] = { | |
10433 | .mixers = { alc883_vaiott_mixer }, | |
10434 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, | |
10435 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10436 | .dac_nids = alc883_dac_nids, | |
10437 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10438 | .channel_mode = alc883_3ST_2ch_modes, | |
10439 | .input_mux = &alc883_capture_source, | |
10440 | .unsol_event = alc_automute_amp_unsol_event, | |
10441 | .setup = alc883_vaiott_setup, | |
10442 | .init_hook = alc_automute_amp, | |
10443 | }, | |
10444 | }; | |
10445 | ||
10446 | ||
10447 | /* | |
10448 | * Pin config fixes | |
10449 | */ | |
10450 | enum { | |
10451 | PINFIX_ABIT_AW9D_MAX, | |
10452 | PINFIX_PB_M5210, | |
10453 | }; | |
10454 | ||
10455 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { | |
10456 | { 0x15, 0x01080104 }, /* side */ | |
10457 | { 0x16, 0x01011012 }, /* rear */ | |
10458 | { 0x17, 0x01016011 }, /* clfe */ | |
10459 | { } | |
10460 | }; | |
10461 | ||
10462 | static const struct hda_verb pb_m5210_verbs[] = { | |
10463 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, | |
10464 | {} | |
10465 | }; | |
10466 | ||
10467 | static const struct alc_fixup alc882_fixups[] = { | |
10468 | [PINFIX_ABIT_AW9D_MAX] = { | |
10469 | .pins = alc882_abit_aw9d_pinfix | |
10470 | }, | |
10471 | [PINFIX_PB_M5210] = { | |
10472 | .verbs = pb_m5210_verbs | |
10473 | }, | |
10474 | }; | |
10475 | ||
10476 | static struct snd_pci_quirk alc882_fixup_tbl[] = { | |
10477 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), | |
10478 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | |
10479 | {} | |
10480 | }; | |
10481 | ||
10482 | /* | |
10483 | * BIOS auto configuration | |
10484 | */ | |
10485 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, | |
10486 | const struct auto_pin_cfg *cfg) | |
10487 | { | |
10488 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); | |
10489 | } | |
10490 | ||
10491 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | |
10492 | hda_nid_t nid, int pin_type, | |
10493 | hda_nid_t dac) | |
10494 | { | |
10495 | int idx; | |
10496 | ||
10497 | /* set as output */ | |
10498 | alc_set_pin_output(codec, nid, pin_type); | |
10499 | ||
10500 | if (dac == 0x25) | |
10501 | idx = 4; | |
10502 | else if (dac >= 0x02 && dac <= 0x05) | |
10503 | idx = dac - 2; | |
10504 | else | |
10505 | return; | |
10506 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | |
10507 | } | |
10508 | ||
10509 | static void alc882_auto_init_multi_out(struct hda_codec *codec) | |
10510 | { | |
10511 | struct alc_spec *spec = codec->spec; | |
10512 | int i; | |
10513 | ||
10514 | for (i = 0; i <= HDA_SIDE; i++) { | |
10515 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
10516 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
10517 | if (nid) | |
10518 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, | |
10519 | spec->multiout.dac_nids[i]); | |
10520 | } | |
10521 | } | |
10522 | ||
10523 | static void alc882_auto_init_hp_out(struct hda_codec *codec) | |
10524 | { | |
10525 | struct alc_spec *spec = codec->spec; | |
10526 | hda_nid_t pin, dac; | |
10527 | ||
10528 | pin = spec->autocfg.hp_pins[0]; | |
10529 | if (pin) { | |
10530 | dac = spec->multiout.hp_nid; | |
10531 | if (!dac) | |
10532 | dac = spec->multiout.dac_nids[0]; /* to front */ | |
10533 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); | |
10534 | } | |
10535 | pin = spec->autocfg.speaker_pins[0]; | |
10536 | if (pin) { | |
10537 | dac = spec->multiout.extra_out_nid[0]; | |
10538 | if (!dac) | |
10539 | dac = spec->multiout.dac_nids[0]; /* to front */ | |
10540 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); | |
10541 | } | |
10542 | } | |
10543 | ||
10544 | static void alc882_auto_init_analog_input(struct hda_codec *codec) | |
10545 | { | |
10546 | struct alc_spec *spec = codec->spec; | |
10547 | int i; | |
10548 | ||
10549 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
10550 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
10551 | if (!nid) | |
10552 | continue; | |
10553 | alc_set_input_pin(codec, nid, i); | |
10554 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) | |
10555 | snd_hda_codec_write(codec, nid, 0, | |
10556 | AC_VERB_SET_AMP_GAIN_MUTE, | |
10557 | AMP_OUT_MUTE); | |
10558 | } | |
10559 | } | |
10560 | ||
10561 | static void alc882_auto_init_input_src(struct hda_codec *codec) | |
10562 | { | |
10563 | struct alc_spec *spec = codec->spec; | |
10564 | int c; | |
10565 | ||
10566 | for (c = 0; c < spec->num_adc_nids; c++) { | |
10567 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | |
10568 | hda_nid_t nid = spec->capsrc_nids[c]; | |
10569 | unsigned int mux_idx; | |
10570 | const struct hda_input_mux *imux; | |
10571 | int conns, mute, idx, item; | |
10572 | ||
10573 | conns = snd_hda_get_connections(codec, nid, conn_list, | |
10574 | ARRAY_SIZE(conn_list)); | |
10575 | if (conns < 0) | |
10576 | continue; | |
10577 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | |
10578 | imux = &spec->input_mux[mux_idx]; | |
10579 | if (!imux->num_items && mux_idx > 0) | |
10580 | imux = &spec->input_mux[0]; | |
10581 | for (idx = 0; idx < conns; idx++) { | |
10582 | /* if the current connection is the selected one, | |
10583 | * unmute it as default - otherwise mute it | |
10584 | */ | |
10585 | mute = AMP_IN_MUTE(idx); | |
10586 | for (item = 0; item < imux->num_items; item++) { | |
10587 | if (imux->items[item].index == idx) { | |
10588 | if (spec->cur_mux[c] == item) | |
10589 | mute = AMP_IN_UNMUTE(idx); | |
10590 | break; | |
10591 | } | |
10592 | } | |
10593 | /* check if we have a selector or mixer | |
10594 | * we could check for the widget type instead, but | |
10595 | * just check for Amp-In presence (in case of mixer | |
10596 | * without amp-in there is something wrong, this | |
10597 | * function shouldn't be used or capsrc nid is wrong) | |
10598 | */ | |
10599 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | |
10600 | snd_hda_codec_write(codec, nid, 0, | |
10601 | AC_VERB_SET_AMP_GAIN_MUTE, | |
10602 | mute); | |
10603 | else if (mute != AMP_IN_MUTE(idx)) | |
10604 | snd_hda_codec_write(codec, nid, 0, | |
10605 | AC_VERB_SET_CONNECT_SEL, | |
10606 | idx); | |
10607 | } | |
10608 | } | |
10609 | } | |
10610 | ||
10611 | /* add mic boosts if needed */ | |
10612 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | |
10613 | { | |
10614 | struct alc_spec *spec = codec->spec; | |
10615 | int err; | |
10616 | hda_nid_t nid; | |
10617 | ||
10618 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | |
10619 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | |
10620 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
10621 | "Mic Boost", | |
10622 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
10623 | if (err < 0) | |
10624 | return err; | |
10625 | } | |
10626 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | |
10627 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | |
10628 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
10629 | "Front Mic Boost", | |
10630 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
10631 | if (err < 0) | |
10632 | return err; | |
10633 | } | |
10634 | return 0; | |
10635 | } | |
10636 | ||
10637 | /* almost identical with ALC880 parser... */ | |
10638 | static int alc882_parse_auto_config(struct hda_codec *codec) | |
10639 | { | |
10640 | struct alc_spec *spec = codec->spec; | |
10641 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; | |
10642 | int err; | |
10643 | ||
10644 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
10645 | alc882_ignore); | |
10646 | if (err < 0) | |
10647 | return err; | |
10648 | if (!spec->autocfg.line_outs) | |
10649 | return 0; /* can't find valid BIOS pin config */ | |
10650 | ||
10651 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | |
10652 | if (err < 0) | |
10653 | return err; | |
10654 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
10655 | if (err < 0) | |
10656 | return err; | |
10657 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
10658 | "Headphone"); | |
10659 | if (err < 0) | |
10660 | return err; | |
10661 | err = alc880_auto_create_extra_out(spec, | |
10662 | spec->autocfg.speaker_pins[0], | |
10663 | "Speaker"); | |
10664 | if (err < 0) | |
10665 | return err; | |
10666 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); | |
10667 | if (err < 0) | |
10668 | return err; | |
10669 | ||
10670 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
10671 | ||
10672 | alc_auto_parse_digital(codec); | |
10673 | ||
10674 | if (spec->kctls.list) | |
10675 | add_mixer(spec, spec->kctls.list); | |
10676 | ||
10677 | add_verb(spec, alc883_auto_init_verbs); | |
10678 | /* if ADC 0x07 is available, initialize it, too */ | |
10679 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) | |
10680 | add_verb(spec, alc882_adc1_init_verbs); | |
10681 | ||
10682 | spec->num_mux_defs = 1; | |
10683 | spec->input_mux = &spec->private_imux[0]; | |
10684 | ||
10685 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
10686 | ||
10687 | err = alc_auto_add_mic_boost(codec); | |
10688 | if (err < 0) | |
10689 | return err; | |
10690 | ||
10691 | return 1; /* config found */ | |
10692 | } | |
10693 | ||
10694 | /* additional initialization for auto-configuration model */ | |
10695 | static void alc882_auto_init(struct hda_codec *codec) | |
10696 | { | |
10697 | struct alc_spec *spec = codec->spec; | |
10698 | alc882_auto_init_multi_out(codec); | |
10699 | alc882_auto_init_hp_out(codec); | |
10700 | alc882_auto_init_analog_input(codec); | |
10701 | alc882_auto_init_input_src(codec); | |
10702 | alc_auto_init_digital(codec); | |
10703 | if (spec->unsol_event) | |
10704 | alc_inithook(codec); | |
10705 | } | |
10706 | ||
10707 | static int patch_alc882(struct hda_codec *codec) | |
10708 | { | |
10709 | struct alc_spec *spec; | |
10710 | int err, board_config; | |
10711 | ||
10712 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
10713 | if (spec == NULL) | |
10714 | return -ENOMEM; | |
10715 | ||
10716 | codec->spec = spec; | |
10717 | ||
10718 | alc_auto_parse_customize_define(codec); | |
10719 | ||
10720 | switch (codec->vendor_id) { | |
10721 | case 0x10ec0882: | |
10722 | case 0x10ec0885: | |
10723 | break; | |
10724 | default: | |
10725 | /* ALC883 and variants */ | |
10726 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | |
10727 | break; | |
10728 | } | |
10729 | ||
10730 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, | |
10731 | alc882_models, | |
10732 | alc882_cfg_tbl); | |
10733 | ||
10734 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) | |
10735 | board_config = snd_hda_check_board_codec_sid_config(codec, | |
10736 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); | |
10737 | ||
10738 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | |
10739 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
10740 | codec->chip_name); | |
10741 | board_config = ALC882_AUTO; | |
10742 | } | |
10743 | ||
10744 | if (board_config == ALC882_AUTO) | |
10745 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); | |
10746 | ||
10747 | if (board_config == ALC882_AUTO) { | |
10748 | /* automatic parse from the BIOS config */ | |
10749 | err = alc882_parse_auto_config(codec); | |
10750 | if (err < 0) { | |
10751 | alc_free(codec); | |
10752 | return err; | |
10753 | } else if (!err) { | |
10754 | printk(KERN_INFO | |
10755 | "hda_codec: Cannot set up configuration " | |
10756 | "from BIOS. Using base mode...\n"); | |
10757 | board_config = ALC882_3ST_DIG; | |
10758 | } | |
10759 | } | |
10760 | ||
10761 | if (has_cdefine_beep(codec)) { | |
10762 | err = snd_hda_attach_beep_device(codec, 0x1); | |
10763 | if (err < 0) { | |
10764 | alc_free(codec); | |
10765 | return err; | |
10766 | } | |
10767 | } | |
10768 | ||
10769 | if (board_config != ALC882_AUTO) | |
10770 | setup_preset(codec, &alc882_presets[board_config]); | |
10771 | ||
10772 | spec->stream_analog_playback = &alc882_pcm_analog_playback; | |
10773 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | |
10774 | /* FIXME: setup DAC5 */ | |
10775 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ | |
10776 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | |
10777 | ||
10778 | spec->stream_digital_playback = &alc882_pcm_digital_playback; | |
10779 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | |
10780 | ||
10781 | if (!spec->adc_nids && spec->input_mux) { | |
10782 | int i, j; | |
10783 | spec->num_adc_nids = 0; | |
10784 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { | |
10785 | const struct hda_input_mux *imux = spec->input_mux; | |
10786 | hda_nid_t cap; | |
10787 | hda_nid_t items[16]; | |
10788 | hda_nid_t nid = alc882_adc_nids[i]; | |
10789 | unsigned int wcap = get_wcaps(codec, nid); | |
10790 | /* get type */ | |
10791 | wcap = get_wcaps_type(wcap); | |
10792 | if (wcap != AC_WID_AUD_IN) | |
10793 | continue; | |
10794 | spec->private_adc_nids[spec->num_adc_nids] = nid; | |
10795 | err = snd_hda_get_connections(codec, nid, &cap, 1); | |
10796 | if (err < 0) | |
10797 | continue; | |
10798 | err = snd_hda_get_connections(codec, cap, items, | |
10799 | ARRAY_SIZE(items)); | |
10800 | if (err < 0) | |
10801 | continue; | |
10802 | for (j = 0; j < imux->num_items; j++) | |
10803 | if (imux->items[j].index >= err) | |
10804 | break; | |
10805 | if (j < imux->num_items) | |
10806 | continue; | |
10807 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; | |
10808 | spec->num_adc_nids++; | |
10809 | } | |
10810 | spec->adc_nids = spec->private_adc_nids; | |
10811 | spec->capsrc_nids = spec->private_capsrc_nids; | |
10812 | } | |
10813 | ||
10814 | set_capture_mixer(codec); | |
10815 | ||
10816 | if (has_cdefine_beep(codec)) | |
10817 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
10818 | ||
10819 | if (board_config == ALC882_AUTO) | |
10820 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); | |
10821 | ||
10822 | spec->vmaster_nid = 0x0c; | |
10823 | ||
10824 | codec->patch_ops = alc_patch_ops; | |
10825 | if (board_config == ALC882_AUTO) | |
10826 | spec->init_hook = alc882_auto_init; | |
10827 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
10828 | if (!spec->loopback.amplist) | |
10829 | spec->loopback.amplist = alc882_loopbacks; | |
10830 | #endif | |
10831 | ||
10832 | return 0; | |
10833 | } | |
10834 | ||
10835 | ||
10836 | /* | |
10837 | * ALC262 support | |
10838 | */ | |
10839 | ||
10840 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | |
10841 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | |
10842 | ||
10843 | #define alc262_dac_nids alc260_dac_nids | |
10844 | #define alc262_adc_nids alc882_adc_nids | |
10845 | #define alc262_adc_nids_alt alc882_adc_nids_alt | |
10846 | #define alc262_capsrc_nids alc882_capsrc_nids | |
10847 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | |
10848 | ||
10849 | #define alc262_modes alc260_modes | |
10850 | #define alc262_capture_source alc882_capture_source | |
10851 | ||
10852 | static hda_nid_t alc262_dmic_adc_nids[1] = { | |
10853 | /* ADC0 */ | |
10854 | 0x09 | |
10855 | }; | |
10856 | ||
10857 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; | |
10858 | ||
10859 | static struct snd_kcontrol_new alc262_base_mixer[] = { | |
10860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10861 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10862 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
10863 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
10864 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
10865 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
10866 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10867 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10868 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10869 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10870 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
10871 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
10872 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), | |
10873 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10874 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
10875 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
10876 | { } /* end */ | |
10877 | }; | |
10878 | ||
10879 | /* update HP, line and mono-out pins according to the master switch */ | |
10880 | static void alc262_hp_master_update(struct hda_codec *codec) | |
10881 | { | |
10882 | struct alc_spec *spec = codec->spec; | |
10883 | int val = spec->master_sw; | |
10884 | ||
10885 | /* HP & line-out */ | |
10886 | snd_hda_codec_write_cache(codec, 0x1b, 0, | |
10887 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
10888 | val ? PIN_HP : 0); | |
10889 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
10890 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
10891 | val ? PIN_HP : 0); | |
10892 | /* mono (speaker) depending on the HP jack sense */ | |
10893 | val = val && !spec->jack_present; | |
10894 | snd_hda_codec_write_cache(codec, 0x16, 0, | |
10895 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
10896 | val ? PIN_OUT : 0); | |
10897 | } | |
10898 | ||
10899 | static void alc262_hp_bpc_automute(struct hda_codec *codec) | |
10900 | { | |
10901 | struct alc_spec *spec = codec->spec; | |
10902 | ||
10903 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); | |
10904 | alc262_hp_master_update(codec); | |
10905 | } | |
10906 | ||
10907 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) | |
10908 | { | |
10909 | if ((res >> 26) != ALC880_HP_EVENT) | |
10910 | return; | |
10911 | alc262_hp_bpc_automute(codec); | |
10912 | } | |
10913 | ||
10914 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) | |
10915 | { | |
10916 | struct alc_spec *spec = codec->spec; | |
10917 | ||
10918 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | |
10919 | alc262_hp_master_update(codec); | |
10920 | } | |
10921 | ||
10922 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, | |
10923 | unsigned int res) | |
10924 | { | |
10925 | if ((res >> 26) != ALC880_HP_EVENT) | |
10926 | return; | |
10927 | alc262_hp_wildwest_automute(codec); | |
10928 | } | |
10929 | ||
10930 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get | |
10931 | ||
10932 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
10933 | struct snd_ctl_elem_value *ucontrol) | |
10934 | { | |
10935 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
10936 | struct alc_spec *spec = codec->spec; | |
10937 | int val = !!*ucontrol->value.integer.value; | |
10938 | ||
10939 | if (val == spec->master_sw) | |
10940 | return 0; | |
10941 | spec->master_sw = val; | |
10942 | alc262_hp_master_update(codec); | |
10943 | return 1; | |
10944 | } | |
10945 | ||
10946 | #define ALC262_HP_MASTER_SWITCH \ | |
10947 | { \ | |
10948 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
10949 | .name = "Master Playback Switch", \ | |
10950 | .info = snd_ctl_boolean_mono_info, \ | |
10951 | .get = alc262_hp_master_sw_get, \ | |
10952 | .put = alc262_hp_master_sw_put, \ | |
10953 | }, \ | |
10954 | { \ | |
10955 | .iface = NID_MAPPING, \ | |
10956 | .name = "Master Playback Switch", \ | |
10957 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ | |
10958 | } | |
10959 | ||
10960 | ||
10961 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { | |
10962 | ALC262_HP_MASTER_SWITCH, | |
10963 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10964 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10965 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
10966 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, | |
10967 | HDA_OUTPUT), | |
10968 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
10969 | HDA_OUTPUT), | |
10970 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10971 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10972 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10973 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10974 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
10975 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
10976 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
10977 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
10978 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
10979 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
10980 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
10981 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
10982 | { } /* end */ | |
10983 | }; | |
10984 | ||
10985 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { | |
10986 | ALC262_HP_MASTER_SWITCH, | |
10987 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10988 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
10989 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
10990 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10991 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, | |
10992 | HDA_OUTPUT), | |
10993 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
10994 | HDA_OUTPUT), | |
10995 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
10996 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
10997 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), | |
10998 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10999 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11000 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11001 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11002 | { } /* end */ | |
11003 | }; | |
11004 | ||
11005 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |
11006 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11007 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11008 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), | |
11009 | { } /* end */ | |
11010 | }; | |
11011 | ||
11012 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
11013 | static void alc262_hp_t5735_setup(struct hda_codec *codec) | |
11014 | { | |
11015 | struct alc_spec *spec = codec->spec; | |
11016 | ||
11017 | spec->autocfg.hp_pins[0] = 0x15; | |
11018 | spec->autocfg.speaker_pins[0] = 0x14; | |
11019 | } | |
11020 | ||
11021 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | |
11022 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11023 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11024 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11025 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11026 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11027 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11028 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11029 | { } /* end */ | |
11030 | }; | |
11031 | ||
11032 | static struct hda_verb alc262_hp_t5735_verbs[] = { | |
11033 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11034 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11035 | ||
11036 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
11037 | { } | |
11038 | }; | |
11039 | ||
11040 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { | |
11041 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11042 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
11043 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
11044 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
11045 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11046 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11047 | { } /* end */ | |
11048 | }; | |
11049 | ||
11050 | static struct hda_verb alc262_hp_rp5700_verbs[] = { | |
11051 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11052 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11053 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11054 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11055 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11056 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11057 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
11058 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
11059 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
11060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
11061 | {} | |
11062 | }; | |
11063 | ||
11064 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { | |
11065 | .num_items = 1, | |
11066 | .items = { | |
11067 | { "Line", 0x1 }, | |
11068 | }, | |
11069 | }; | |
11070 | ||
11071 | /* bind hp and internal speaker mute (with plug check) as master switch */ | |
11072 | static void alc262_hippo_master_update(struct hda_codec *codec) | |
11073 | { | |
11074 | struct alc_spec *spec = codec->spec; | |
11075 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
11076 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
11077 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
11078 | unsigned int mute; | |
11079 | ||
11080 | /* HP */ | |
11081 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; | |
11082 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, | |
11083 | HDA_AMP_MUTE, mute); | |
11084 | /* mute internal speaker per jack sense */ | |
11085 | if (spec->jack_present) | |
11086 | mute = HDA_AMP_MUTE; | |
11087 | if (line_nid) | |
11088 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, | |
11089 | HDA_AMP_MUTE, mute); | |
11090 | if (speaker_nid && speaker_nid != line_nid) | |
11091 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, | |
11092 | HDA_AMP_MUTE, mute); | |
11093 | } | |
11094 | ||
11095 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get | |
11096 | ||
11097 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, | |
11098 | struct snd_ctl_elem_value *ucontrol) | |
11099 | { | |
11100 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11101 | struct alc_spec *spec = codec->spec; | |
11102 | int val = !!*ucontrol->value.integer.value; | |
11103 | ||
11104 | if (val == spec->master_sw) | |
11105 | return 0; | |
11106 | spec->master_sw = val; | |
11107 | alc262_hippo_master_update(codec); | |
11108 | return 1; | |
11109 | } | |
11110 | ||
11111 | #define ALC262_HIPPO_MASTER_SWITCH \ | |
11112 | { \ | |
11113 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
11114 | .name = "Master Playback Switch", \ | |
11115 | .info = snd_ctl_boolean_mono_info, \ | |
11116 | .get = alc262_hippo_master_sw_get, \ | |
11117 | .put = alc262_hippo_master_sw_put, \ | |
11118 | }, \ | |
11119 | { \ | |
11120 | .iface = NID_MAPPING, \ | |
11121 | .name = "Master Playback Switch", \ | |
11122 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ | |
11123 | (SUBDEV_SPEAKER(0) << 16), \ | |
11124 | } | |
11125 | ||
11126 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { | |
11127 | ALC262_HIPPO_MASTER_SWITCH, | |
11128 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11129 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11130 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11131 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11132 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11133 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11134 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11135 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11136 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11137 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11138 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11139 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11140 | { } /* end */ | |
11141 | }; | |
11142 | ||
11143 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { | |
11144 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11145 | ALC262_HIPPO_MASTER_SWITCH, | |
11146 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11147 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11148 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11149 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11150 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11151 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11152 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11153 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11154 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11155 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11156 | { } /* end */ | |
11157 | }; | |
11158 | ||
11159 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
11160 | static void alc262_hippo_automute(struct hda_codec *codec) | |
11161 | { | |
11162 | struct alc_spec *spec = codec->spec; | |
11163 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
11164 | ||
11165 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); | |
11166 | alc262_hippo_master_update(codec); | |
11167 | } | |
11168 | ||
11169 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) | |
11170 | { | |
11171 | if ((res >> 26) != ALC880_HP_EVENT) | |
11172 | return; | |
11173 | alc262_hippo_automute(codec); | |
11174 | } | |
11175 | ||
11176 | static void alc262_hippo_setup(struct hda_codec *codec) | |
11177 | { | |
11178 | struct alc_spec *spec = codec->spec; | |
11179 | ||
11180 | spec->autocfg.hp_pins[0] = 0x15; | |
11181 | spec->autocfg.speaker_pins[0] = 0x14; | |
11182 | } | |
11183 | ||
11184 | static void alc262_hippo1_setup(struct hda_codec *codec) | |
11185 | { | |
11186 | struct alc_spec *spec = codec->spec; | |
11187 | ||
11188 | spec->autocfg.hp_pins[0] = 0x1b; | |
11189 | spec->autocfg.speaker_pins[0] = 0x14; | |
11190 | } | |
11191 | ||
11192 | ||
11193 | static struct snd_kcontrol_new alc262_sony_mixer[] = { | |
11194 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11195 | ALC262_HIPPO_MASTER_SWITCH, | |
11196 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11197 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11198 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11199 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11200 | { } /* end */ | |
11201 | }; | |
11202 | ||
11203 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { | |
11204 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11205 | ALC262_HIPPO_MASTER_SWITCH, | |
11206 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11207 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11208 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11209 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11210 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11211 | { } /* end */ | |
11212 | }; | |
11213 | ||
11214 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { | |
11215 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11216 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
11217 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
11218 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
11219 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11220 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11221 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11223 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11224 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11225 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11226 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11227 | { } /* end */ | |
11228 | }; | |
11229 | ||
11230 | static struct hda_verb alc262_tyan_verbs[] = { | |
11231 | /* Headphone automute */ | |
11232 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11233 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11234 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11235 | ||
11236 | /* P11 AUX_IN, white 4-pin connector */ | |
11237 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11238 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, | |
11239 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, | |
11240 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, | |
11241 | ||
11242 | {} | |
11243 | }; | |
11244 | ||
11245 | /* unsolicited event for HP jack sensing */ | |
11246 | static void alc262_tyan_setup(struct hda_codec *codec) | |
11247 | { | |
11248 | struct alc_spec *spec = codec->spec; | |
11249 | ||
11250 | spec->autocfg.hp_pins[0] = 0x1b; | |
11251 | spec->autocfg.speaker_pins[0] = 0x15; | |
11252 | } | |
11253 | ||
11254 | ||
11255 | #define alc262_capture_mixer alc882_capture_mixer | |
11256 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | |
11257 | ||
11258 | /* | |
11259 | * generic initialization of ADC, input mixers and output mixers | |
11260 | */ | |
11261 | static struct hda_verb alc262_init_verbs[] = { | |
11262 | /* | |
11263 | * Unmute ADC0-2 and set the default input to mic-in | |
11264 | */ | |
11265 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11266 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11267 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11268 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11269 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11270 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11271 | ||
11272 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
11273 | * mixer widget | |
11274 | * Note: PASD motherboards uses the Line In 2 as the input for | |
11275 | * front panel mic (mic 2) | |
11276 | */ | |
11277 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
11278 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11279 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11280 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11281 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11282 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
11283 | ||
11284 | /* | |
11285 | * Set up output mixers (0x0c - 0x0e) | |
11286 | */ | |
11287 | /* set vol=0 to output mixers */ | |
11288 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11289 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11290 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11291 | /* set up input amps for analog loopback */ | |
11292 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
11293 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11294 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11295 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11296 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11298 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11299 | ||
11300 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
11301 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11302 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
11303 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11304 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11305 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11306 | ||
11307 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11308 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11309 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11310 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11311 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11312 | ||
11313 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11314 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11315 | ||
11316 | /* FIXME: use matrix-type input source selection */ | |
11317 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
11318 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
11319 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11320 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11321 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11322 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11323 | /* Input mixer2 */ | |
11324 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11325 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11326 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11327 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11328 | /* Input mixer3 */ | |
11329 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11330 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11331 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11332 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11333 | ||
11334 | { } | |
11335 | }; | |
11336 | ||
11337 | static struct hda_verb alc262_eapd_verbs[] = { | |
11338 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
11339 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
11340 | { } | |
11341 | }; | |
11342 | ||
11343 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { | |
11344 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11345 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11346 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11347 | ||
11348 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11349 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11350 | {} | |
11351 | }; | |
11352 | ||
11353 | static struct hda_verb alc262_sony_unsol_verbs[] = { | |
11354 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11355 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11356 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic | |
11357 | ||
11358 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11359 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11360 | {} | |
11361 | }; | |
11362 | ||
11363 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { | |
11364 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11365 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11366 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11367 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11368 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11369 | { } /* end */ | |
11370 | }; | |
11371 | ||
11372 | static struct hda_verb alc262_toshiba_s06_verbs[] = { | |
11373 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11374 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11375 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11376 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11377 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, | |
11378 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11379 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
11380 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11381 | {} | |
11382 | }; | |
11383 | ||
11384 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) | |
11385 | { | |
11386 | struct alc_spec *spec = codec->spec; | |
11387 | ||
11388 | spec->autocfg.hp_pins[0] = 0x15; | |
11389 | spec->autocfg.speaker_pins[0] = 0x14; | |
11390 | spec->ext_mic.pin = 0x18; | |
11391 | spec->ext_mic.mux_idx = 0; | |
11392 | spec->int_mic.pin = 0x12; | |
11393 | spec->int_mic.mux_idx = 9; | |
11394 | spec->auto_mic = 1; | |
11395 | } | |
11396 | ||
11397 | /* | |
11398 | * nec model | |
11399 | * 0x15 = headphone | |
11400 | * 0x16 = internal speaker | |
11401 | * 0x18 = external mic | |
11402 | */ | |
11403 | ||
11404 | static struct snd_kcontrol_new alc262_nec_mixer[] = { | |
11405 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
11406 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), | |
11407 | ||
11408 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11409 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11410 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11411 | ||
11412 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11413 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11414 | { } /* end */ | |
11415 | }; | |
11416 | ||
11417 | static struct hda_verb alc262_nec_verbs[] = { | |
11418 | /* Unmute Speaker */ | |
11419 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11420 | ||
11421 | /* Headphone */ | |
11422 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11423 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11424 | ||
11425 | /* External mic to headphone */ | |
11426 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11427 | /* External mic to speaker */ | |
11428 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11429 | {} | |
11430 | }; | |
11431 | ||
11432 | /* | |
11433 | * fujitsu model | |
11434 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, | |
11435 | * 0x1b = port replicator headphone out | |
11436 | */ | |
11437 | ||
11438 | #define ALC_HP_EVENT 0x37 | |
11439 | ||
11440 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { | |
11441 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
11442 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11443 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
11444 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11445 | {} | |
11446 | }; | |
11447 | ||
11448 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { | |
11449 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
11450 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11451 | {} | |
11452 | }; | |
11453 | ||
11454 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { | |
11455 | /* Front Mic pin: input vref at 50% */ | |
11456 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
11457 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11458 | {} | |
11459 | }; | |
11460 | ||
11461 | static struct hda_input_mux alc262_fujitsu_capture_source = { | |
11462 | .num_items = 3, | |
11463 | .items = { | |
11464 | { "Mic", 0x0 }, | |
11465 | { "Int Mic", 0x1 }, | |
11466 | { "CD", 0x4 }, | |
11467 | }, | |
11468 | }; | |
11469 | ||
11470 | static struct hda_input_mux alc262_HP_capture_source = { | |
11471 | .num_items = 5, | |
11472 | .items = { | |
11473 | { "Mic", 0x0 }, | |
11474 | { "Front Mic", 0x1 }, | |
11475 | { "Line", 0x2 }, | |
11476 | { "CD", 0x4 }, | |
11477 | { "AUX IN", 0x6 }, | |
11478 | }, | |
11479 | }; | |
11480 | ||
11481 | static struct hda_input_mux alc262_HP_D7000_capture_source = { | |
11482 | .num_items = 4, | |
11483 | .items = { | |
11484 | { "Mic", 0x0 }, | |
11485 | { "Front Mic", 0x2 }, | |
11486 | { "Line", 0x1 }, | |
11487 | { "CD", 0x4 }, | |
11488 | }, | |
11489 | }; | |
11490 | ||
11491 | /* mute/unmute internal speaker according to the hp jacks and mute state */ | |
11492 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) | |
11493 | { | |
11494 | struct alc_spec *spec = codec->spec; | |
11495 | unsigned int mute; | |
11496 | ||
11497 | if (force || !spec->sense_updated) { | |
11498 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || | |
11499 | snd_hda_jack_detect(codec, 0x1b); | |
11500 | spec->sense_updated = 1; | |
11501 | } | |
11502 | /* unmute internal speaker only if both HPs are unplugged and | |
11503 | * master switch is on | |
11504 | */ | |
11505 | if (spec->jack_present) | |
11506 | mute = HDA_AMP_MUTE; | |
11507 | else | |
11508 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
11509 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
11510 | HDA_AMP_MUTE, mute); | |
11511 | } | |
11512 | ||
11513 | /* unsolicited event for HP jack sensing */ | |
11514 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, | |
11515 | unsigned int res) | |
11516 | { | |
11517 | if ((res >> 26) != ALC_HP_EVENT) | |
11518 | return; | |
11519 | alc262_fujitsu_automute(codec, 1); | |
11520 | } | |
11521 | ||
11522 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) | |
11523 | { | |
11524 | alc262_fujitsu_automute(codec, 1); | |
11525 | } | |
11526 | ||
11527 | /* bind volumes of both NID 0x0c and 0x0d */ | |
11528 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { | |
11529 | .ops = &snd_hda_bind_vol, | |
11530 | .values = { | |
11531 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), | |
11532 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), | |
11533 | 0 | |
11534 | }, | |
11535 | }; | |
11536 | ||
11537 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
11538 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) | |
11539 | { | |
11540 | struct alc_spec *spec = codec->spec; | |
11541 | unsigned int mute; | |
11542 | ||
11543 | if (force || !spec->sense_updated) { | |
11544 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); | |
11545 | spec->sense_updated = 1; | |
11546 | } | |
11547 | if (spec->jack_present) { | |
11548 | /* mute internal speaker */ | |
11549 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11550 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
11551 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
11552 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
11553 | } else { | |
11554 | /* unmute internal speaker if necessary */ | |
11555 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
11556 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11557 | HDA_AMP_MUTE, mute); | |
11558 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
11559 | HDA_AMP_MUTE, mute); | |
11560 | } | |
11561 | } | |
11562 | ||
11563 | /* unsolicited event for HP jack sensing */ | |
11564 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, | |
11565 | unsigned int res) | |
11566 | { | |
11567 | if ((res >> 26) != ALC_HP_EVENT) | |
11568 | return; | |
11569 | alc262_lenovo_3000_automute(codec, 1); | |
11570 | } | |
11571 | ||
11572 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, | |
11573 | int dir, int idx, long *valp) | |
11574 | { | |
11575 | int i, change = 0; | |
11576 | ||
11577 | for (i = 0; i < 2; i++, valp++) | |
11578 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, | |
11579 | HDA_AMP_MUTE, | |
11580 | *valp ? 0 : HDA_AMP_MUTE); | |
11581 | return change; | |
11582 | } | |
11583 | ||
11584 | /* bind hp and internal speaker mute (with plug check) */ | |
11585 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | |
11586 | struct snd_ctl_elem_value *ucontrol) | |
11587 | { | |
11588 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11589 | long *valp = ucontrol->value.integer.value; | |
11590 | int change; | |
11591 | ||
11592 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); | |
11593 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); | |
11594 | if (change) | |
11595 | alc262_fujitsu_automute(codec, 0); | |
11596 | return change; | |
11597 | } | |
11598 | ||
11599 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | |
11600 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
11601 | { | |
11602 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11603 | .name = "Master Playback Switch", | |
11604 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
11605 | .info = snd_hda_mixer_amp_switch_info, | |
11606 | .get = snd_hda_mixer_amp_switch_get, | |
11607 | .put = alc262_fujitsu_master_sw_put, | |
11608 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
11609 | }, | |
11610 | { | |
11611 | .iface = NID_MAPPING, | |
11612 | .name = "Master Playback Switch", | |
11613 | .private_value = 0x1b, | |
11614 | }, | |
11615 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11616 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11617 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11618 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11619 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11620 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
11621 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
11622 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
11623 | { } /* end */ | |
11624 | }; | |
11625 | ||
11626 | /* bind hp and internal speaker mute (with plug check) */ | |
11627 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, | |
11628 | struct snd_ctl_elem_value *ucontrol) | |
11629 | { | |
11630 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11631 | long *valp = ucontrol->value.integer.value; | |
11632 | int change; | |
11633 | ||
11634 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); | |
11635 | if (change) | |
11636 | alc262_lenovo_3000_automute(codec, 0); | |
11637 | return change; | |
11638 | } | |
11639 | ||
11640 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | |
11641 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
11642 | { | |
11643 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11644 | .name = "Master Playback Switch", | |
11645 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
11646 | .info = snd_hda_mixer_amp_switch_info, | |
11647 | .get = snd_hda_mixer_amp_switch_get, | |
11648 | .put = alc262_lenovo_3000_master_sw_put, | |
11649 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
11650 | }, | |
11651 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11652 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11653 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11654 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11655 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11656 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
11657 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
11658 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
11659 | { } /* end */ | |
11660 | }; | |
11661 | ||
11662 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { | |
11663 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
11664 | ALC262_HIPPO_MASTER_SWITCH, | |
11665 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11666 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11667 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11668 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11669 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11670 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11671 | { } /* end */ | |
11672 | }; | |
11673 | ||
11674 | /* additional init verbs for Benq laptops */ | |
11675 | static struct hda_verb alc262_EAPD_verbs[] = { | |
11676 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
11677 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
11678 | {} | |
11679 | }; | |
11680 | ||
11681 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { | |
11682 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11683 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11684 | ||
11685 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
11686 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
11687 | {} | |
11688 | }; | |
11689 | ||
11690 | /* Samsung Q1 Ultra Vista model setup */ | |
11691 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { | |
11692 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11693 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
11694 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11695 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11696 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
11697 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), | |
11698 | { } /* end */ | |
11699 | }; | |
11700 | ||
11701 | static struct hda_verb alc262_ultra_verbs[] = { | |
11702 | /* output mixer */ | |
11703 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11704 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11705 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11706 | /* speaker */ | |
11707 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11708 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11709 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11710 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11711 | /* HP */ | |
11712 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11713 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11714 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11715 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11716 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11717 | /* internal mic */ | |
11718 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
11719 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11720 | /* ADC, choose mic */ | |
11721 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11722 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11723 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11724 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11725 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11726 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
11727 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
11728 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
11729 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
11730 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | |
11731 | {} | |
11732 | }; | |
11733 | ||
11734 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
11735 | static void alc262_ultra_automute(struct hda_codec *codec) | |
11736 | { | |
11737 | struct alc_spec *spec = codec->spec; | |
11738 | unsigned int mute; | |
11739 | ||
11740 | mute = 0; | |
11741 | /* auto-mute only when HP is used as HP */ | |
11742 | if (!spec->cur_mux[0]) { | |
11743 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | |
11744 | if (spec->jack_present) | |
11745 | mute = HDA_AMP_MUTE; | |
11746 | } | |
11747 | /* mute/unmute internal speaker */ | |
11748 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11749 | HDA_AMP_MUTE, mute); | |
11750 | /* mute/unmute HP */ | |
11751 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
11752 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | |
11753 | } | |
11754 | ||
11755 | /* unsolicited event for HP jack sensing */ | |
11756 | static void alc262_ultra_unsol_event(struct hda_codec *codec, | |
11757 | unsigned int res) | |
11758 | { | |
11759 | if ((res >> 26) != ALC880_HP_EVENT) | |
11760 | return; | |
11761 | alc262_ultra_automute(codec); | |
11762 | } | |
11763 | ||
11764 | static struct hda_input_mux alc262_ultra_capture_source = { | |
11765 | .num_items = 2, | |
11766 | .items = { | |
11767 | { "Mic", 0x1 }, | |
11768 | { "Headphone", 0x7 }, | |
11769 | }, | |
11770 | }; | |
11771 | ||
11772 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | |
11773 | struct snd_ctl_elem_value *ucontrol) | |
11774 | { | |
11775 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11776 | struct alc_spec *spec = codec->spec; | |
11777 | int ret; | |
11778 | ||
11779 | ret = alc_mux_enum_put(kcontrol, ucontrol); | |
11780 | if (!ret) | |
11781 | return 0; | |
11782 | /* reprogram the HP pin as mic or HP according to the input source */ | |
11783 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
11784 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11785 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | |
11786 | alc262_ultra_automute(codec); /* mute/unmute HP */ | |
11787 | return ret; | |
11788 | } | |
11789 | ||
11790 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | |
11791 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | |
11792 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
11793 | { | |
11794 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11795 | .name = "Capture Source", | |
11796 | .info = alc_mux_enum_info, | |
11797 | .get = alc_mux_enum_get, | |
11798 | .put = alc262_ultra_mux_enum_put, | |
11799 | }, | |
11800 | { | |
11801 | .iface = NID_MAPPING, | |
11802 | .name = "Capture Source", | |
11803 | .private_value = 0x15, | |
11804 | }, | |
11805 | { } /* end */ | |
11806 | }; | |
11807 | ||
11808 | /* We use two mixers depending on the output pin; 0x16 is a mono output | |
11809 | * and thus it's bound with a different mixer. | |
11810 | * This function returns which mixer amp should be used. | |
11811 | */ | |
11812 | static int alc262_check_volbit(hda_nid_t nid) | |
11813 | { | |
11814 | if (!nid) | |
11815 | return 0; | |
11816 | else if (nid == 0x16) | |
11817 | return 2; | |
11818 | else | |
11819 | return 1; | |
11820 | } | |
11821 | ||
11822 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, | |
11823 | const char *pfx, int *vbits) | |
11824 | { | |
11825 | unsigned long val; | |
11826 | int vbit; | |
11827 | ||
11828 | vbit = alc262_check_volbit(nid); | |
11829 | if (!vbit) | |
11830 | return 0; | |
11831 | if (*vbits & vbit) /* a volume control for this mixer already there */ | |
11832 | return 0; | |
11833 | *vbits |= vbit; | |
11834 | if (vbit == 2) | |
11835 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); | |
11836 | else | |
11837 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); | |
11838 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); | |
11839 | } | |
11840 | ||
11841 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, | |
11842 | const char *pfx) | |
11843 | { | |
11844 | unsigned long val; | |
11845 | ||
11846 | if (!nid) | |
11847 | return 0; | |
11848 | if (nid == 0x16) | |
11849 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
11850 | else | |
11851 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
11852 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); | |
11853 | } | |
11854 | ||
11855 | /* add playback controls from the parsed DAC table */ | |
11856 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, | |
11857 | const struct auto_pin_cfg *cfg) | |
11858 | { | |
11859 | const char *pfx; | |
11860 | int vbits; | |
11861 | int err; | |
11862 | ||
11863 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
11864 | spec->multiout.dac_nids = spec->private_dac_nids; | |
11865 | spec->multiout.dac_nids[0] = 2; | |
11866 | ||
11867 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) | |
11868 | pfx = "Master"; | |
11869 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
11870 | pfx = "Speaker"; | |
11871 | else | |
11872 | pfx = "Front"; | |
11873 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); | |
11874 | if (err < 0) | |
11875 | return err; | |
11876 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); | |
11877 | if (err < 0) | |
11878 | return err; | |
11879 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); | |
11880 | if (err < 0) | |
11881 | return err; | |
11882 | ||
11883 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | | |
11884 | alc262_check_volbit(cfg->speaker_pins[0]) | | |
11885 | alc262_check_volbit(cfg->hp_pins[0]); | |
11886 | if (vbits == 1 || vbits == 2) | |
11887 | pfx = "Master"; /* only one mixer is used */ | |
11888 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
11889 | pfx = "Speaker"; | |
11890 | else | |
11891 | pfx = "Front"; | |
11892 | vbits = 0; | |
11893 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); | |
11894 | if (err < 0) | |
11895 | return err; | |
11896 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", | |
11897 | &vbits); | |
11898 | if (err < 0) | |
11899 | return err; | |
11900 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", | |
11901 | &vbits); | |
11902 | if (err < 0) | |
11903 | return err; | |
11904 | return 0; | |
11905 | } | |
11906 | ||
11907 | #define alc262_auto_create_input_ctls \ | |
11908 | alc882_auto_create_input_ctls | |
11909 | ||
11910 | /* | |
11911 | * generic initialization of ADC, input mixers and output mixers | |
11912 | */ | |
11913 | static struct hda_verb alc262_volume_init_verbs[] = { | |
11914 | /* | |
11915 | * Unmute ADC0-2 and set the default input to mic-in | |
11916 | */ | |
11917 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11918 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11919 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11920 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11921 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11922 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11923 | ||
11924 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
11925 | * mixer widget | |
11926 | * Note: PASD motherboards uses the Line In 2 as the input for | |
11927 | * front panel mic (mic 2) | |
11928 | */ | |
11929 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
11930 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11932 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11933 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11934 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
11935 | ||
11936 | /* | |
11937 | * Set up output mixers (0x0c - 0x0f) | |
11938 | */ | |
11939 | /* set vol=0 to output mixers */ | |
11940 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11941 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11942 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11943 | ||
11944 | /* set up input amps for analog loopback */ | |
11945 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
11946 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11947 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11948 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11949 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11950 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11951 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11952 | ||
11953 | /* FIXME: use matrix-type input source selection */ | |
11954 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
11955 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
11956 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11957 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11958 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11959 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11960 | /* Input mixer2 */ | |
11961 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11962 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11963 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11964 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11965 | /* Input mixer3 */ | |
11966 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11967 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11968 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11969 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11970 | ||
11971 | { } | |
11972 | }; | |
11973 | ||
11974 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { | |
11975 | /* | |
11976 | * Unmute ADC0-2 and set the default input to mic-in | |
11977 | */ | |
11978 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11979 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11980 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11981 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11982 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11983 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11984 | ||
11985 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
11986 | * mixer widget | |
11987 | * Note: PASD motherboards uses the Line In 2 as the input for | |
11988 | * front panel mic (mic 2) | |
11989 | */ | |
11990 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
11991 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11992 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11993 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11994 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11995 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
11996 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
11997 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
11998 | ||
11999 | /* | |
12000 | * Set up output mixers (0x0c - 0x0e) | |
12001 | */ | |
12002 | /* set vol=0 to output mixers */ | |
12003 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12004 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12005 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12006 | ||
12007 | /* set up input amps for analog loopback */ | |
12008 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12009 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12010 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12011 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12012 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12013 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12014 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12015 | ||
12016 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12017 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12018 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12019 | ||
12020 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12021 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12022 | ||
12023 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12024 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12025 | ||
12026 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12027 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12028 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12029 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12030 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12031 | ||
12032 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12033 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12034 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12035 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12036 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12037 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12038 | ||
12039 | ||
12040 | /* FIXME: use matrix-type input source selection */ | |
12041 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ | |
12042 | /* Input mixer1: only unmute Mic */ | |
12043 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12044 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | |
12045 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12046 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12047 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12048 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12049 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12050 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12051 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
12052 | /* Input mixer2 */ | |
12053 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12054 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | |
12055 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12056 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12057 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12058 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12059 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12060 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12061 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
12062 | /* Input mixer3 */ | |
12063 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12064 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | |
12065 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12066 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12067 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12068 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12069 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12070 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12071 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
12072 | ||
12073 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12074 | ||
12075 | { } | |
12076 | }; | |
12077 | ||
12078 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { | |
12079 | /* | |
12080 | * Unmute ADC0-2 and set the default input to mic-in | |
12081 | */ | |
12082 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12083 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12084 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12085 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12086 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12087 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12088 | ||
12089 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
12090 | * mixer widget | |
12091 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
12092 | * panel mic (mic 2) | |
12093 | */ | |
12094 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
12095 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12096 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
12101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
12102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
12103 | /* | |
12104 | * Set up output mixers (0x0c - 0x0e) | |
12105 | */ | |
12106 | /* set vol=0 to output mixers */ | |
12107 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12108 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12109 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12110 | ||
12111 | /* set up input amps for analog loopback */ | |
12112 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12113 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12114 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12115 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12116 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12117 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12118 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12119 | ||
12120 | ||
12121 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ | |
12122 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ | |
12123 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ | |
12124 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ | |
12125 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
12126 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ | |
12127 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ | |
12128 | ||
12129 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12130 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12131 | ||
12132 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12133 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
12134 | ||
12135 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ | |
12136 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12137 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12138 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
12139 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12140 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12141 | ||
12142 | /* FIXME: use matrix-type input source selection */ | |
12143 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
12144 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
12145 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ | |
12146 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ | |
12147 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ | |
12148 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ | |
12149 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ | |
12150 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12151 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ | |
12152 | /* Input mixer2 */ | |
12153 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12154 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
12155 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
12156 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
12157 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
12158 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12159 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
12160 | /* Input mixer3 */ | |
12161 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12162 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
12163 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
12164 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
12165 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
12166 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12167 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
12168 | ||
12169 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12170 | ||
12171 | { } | |
12172 | }; | |
12173 | ||
12174 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { | |
12175 | ||
12176 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | |
12177 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12178 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
12179 | ||
12180 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ | |
12181 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
12182 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
12183 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
12184 | ||
12185 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ | |
12186 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12187 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
12188 | {} | |
12189 | }; | |
12190 | ||
12191 | ||
12192 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
12193 | #define alc262_loopbacks alc880_loopbacks | |
12194 | #endif | |
12195 | ||
12196 | /* pcm configuration: identical with ALC880 */ | |
12197 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback | |
12198 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture | |
12199 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback | |
12200 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture | |
12201 | ||
12202 | /* | |
12203 | * BIOS auto configuration | |
12204 | */ | |
12205 | static int alc262_parse_auto_config(struct hda_codec *codec) | |
12206 | { | |
12207 | struct alc_spec *spec = codec->spec; | |
12208 | int err; | |
12209 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; | |
12210 | ||
12211 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
12212 | alc262_ignore); | |
12213 | if (err < 0) | |
12214 | return err; | |
12215 | if (!spec->autocfg.line_outs) { | |
12216 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
12217 | spec->multiout.max_channels = 2; | |
12218 | spec->no_analog = 1; | |
12219 | goto dig_only; | |
12220 | } | |
12221 | return 0; /* can't find valid BIOS pin config */ | |
12222 | } | |
12223 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
12224 | if (err < 0) | |
12225 | return err; | |
12226 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); | |
12227 | if (err < 0) | |
12228 | return err; | |
12229 | ||
12230 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
12231 | ||
12232 | dig_only: | |
12233 | alc_auto_parse_digital(codec); | |
12234 | ||
12235 | if (spec->kctls.list) | |
12236 | add_mixer(spec, spec->kctls.list); | |
12237 | ||
12238 | add_verb(spec, alc262_volume_init_verbs); | |
12239 | spec->num_mux_defs = 1; | |
12240 | spec->input_mux = &spec->private_imux[0]; | |
12241 | ||
12242 | err = alc_auto_add_mic_boost(codec); | |
12243 | if (err < 0) | |
12244 | return err; | |
12245 | ||
12246 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
12247 | ||
12248 | return 1; | |
12249 | } | |
12250 | ||
12251 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out | |
12252 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out | |
12253 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input | |
12254 | #define alc262_auto_init_input_src alc882_auto_init_input_src | |
12255 | ||
12256 | ||
12257 | /* init callback for auto-configuration model -- overriding the default init */ | |
12258 | static void alc262_auto_init(struct hda_codec *codec) | |
12259 | { | |
12260 | struct alc_spec *spec = codec->spec; | |
12261 | alc262_auto_init_multi_out(codec); | |
12262 | alc262_auto_init_hp_out(codec); | |
12263 | alc262_auto_init_analog_input(codec); | |
12264 | alc262_auto_init_input_src(codec); | |
12265 | alc_auto_init_digital(codec); | |
12266 | if (spec->unsol_event) | |
12267 | alc_inithook(codec); | |
12268 | } | |
12269 | ||
12270 | /* | |
12271 | * configuration and preset | |
12272 | */ | |
12273 | static const char *alc262_models[ALC262_MODEL_LAST] = { | |
12274 | [ALC262_BASIC] = "basic", | |
12275 | [ALC262_HIPPO] = "hippo", | |
12276 | [ALC262_HIPPO_1] = "hippo_1", | |
12277 | [ALC262_FUJITSU] = "fujitsu", | |
12278 | [ALC262_HP_BPC] = "hp-bpc", | |
12279 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", | |
12280 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", | |
12281 | [ALC262_HP_RP5700] = "hp-rp5700", | |
12282 | [ALC262_BENQ_ED8] = "benq", | |
12283 | [ALC262_BENQ_T31] = "benq-t31", | |
12284 | [ALC262_SONY_ASSAMD] = "sony-assamd", | |
12285 | [ALC262_TOSHIBA_S06] = "toshiba-s06", | |
12286 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", | |
12287 | [ALC262_ULTRA] = "ultra", | |
12288 | [ALC262_LENOVO_3000] = "lenovo-3000", | |
12289 | [ALC262_NEC] = "nec", | |
12290 | [ALC262_TYAN] = "tyan", | |
12291 | [ALC262_AUTO] = "auto", | |
12292 | }; | |
12293 | ||
12294 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | |
12295 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | |
12296 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), | |
12297 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", | |
12298 | ALC262_HP_BPC), | |
12299 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", | |
12300 | ALC262_HP_BPC), | |
12301 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", | |
12302 | ALC262_HP_BPC), | |
12303 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), | |
12304 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), | |
12305 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), | |
12306 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), | |
12307 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), | |
12308 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), | |
12309 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), | |
12310 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), | |
12311 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), | |
12312 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), | |
12313 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), | |
12314 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", | |
12315 | ALC262_HP_TC_T5735), | |
12316 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), | |
12317 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), | |
12318 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), | |
12319 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), | |
12320 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ | |
12321 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), | |
12322 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), | |
12323 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), | |
12324 | #if 0 /* disable the quirk since model=auto works better in recent versions */ | |
12325 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", | |
12326 | ALC262_SONY_ASSAMD), | |
12327 | #endif | |
12328 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", | |
12329 | ALC262_TOSHIBA_RX1), | |
12330 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), | |
12331 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), | |
12332 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), | |
12333 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), | |
12334 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", | |
12335 | ALC262_ULTRA), | |
12336 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), | |
12337 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), | |
12338 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), | |
12339 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), | |
12340 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | |
12341 | {} | |
12342 | }; | |
12343 | ||
12344 | static struct alc_config_preset alc262_presets[] = { | |
12345 | [ALC262_BASIC] = { | |
12346 | .mixers = { alc262_base_mixer }, | |
12347 | .init_verbs = { alc262_init_verbs }, | |
12348 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12349 | .dac_nids = alc262_dac_nids, | |
12350 | .hp_nid = 0x03, | |
12351 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12352 | .channel_mode = alc262_modes, | |
12353 | .input_mux = &alc262_capture_source, | |
12354 | }, | |
12355 | [ALC262_HIPPO] = { | |
12356 | .mixers = { alc262_hippo_mixer }, | |
12357 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, | |
12358 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12359 | .dac_nids = alc262_dac_nids, | |
12360 | .hp_nid = 0x03, | |
12361 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12362 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12363 | .channel_mode = alc262_modes, | |
12364 | .input_mux = &alc262_capture_source, | |
12365 | .unsol_event = alc262_hippo_unsol_event, | |
12366 | .setup = alc262_hippo_setup, | |
12367 | .init_hook = alc262_hippo_automute, | |
12368 | }, | |
12369 | [ALC262_HIPPO_1] = { | |
12370 | .mixers = { alc262_hippo1_mixer }, | |
12371 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, | |
12372 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12373 | .dac_nids = alc262_dac_nids, | |
12374 | .hp_nid = 0x02, | |
12375 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12376 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12377 | .channel_mode = alc262_modes, | |
12378 | .input_mux = &alc262_capture_source, | |
12379 | .unsol_event = alc262_hippo_unsol_event, | |
12380 | .setup = alc262_hippo1_setup, | |
12381 | .init_hook = alc262_hippo_automute, | |
12382 | }, | |
12383 | [ALC262_FUJITSU] = { | |
12384 | .mixers = { alc262_fujitsu_mixer }, | |
12385 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | |
12386 | alc262_fujitsu_unsol_verbs }, | |
12387 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12388 | .dac_nids = alc262_dac_nids, | |
12389 | .hp_nid = 0x03, | |
12390 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12391 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12392 | .channel_mode = alc262_modes, | |
12393 | .input_mux = &alc262_fujitsu_capture_source, | |
12394 | .unsol_event = alc262_fujitsu_unsol_event, | |
12395 | .init_hook = alc262_fujitsu_init_hook, | |
12396 | }, | |
12397 | [ALC262_HP_BPC] = { | |
12398 | .mixers = { alc262_HP_BPC_mixer }, | |
12399 | .init_verbs = { alc262_HP_BPC_init_verbs }, | |
12400 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12401 | .dac_nids = alc262_dac_nids, | |
12402 | .hp_nid = 0x03, | |
12403 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12404 | .channel_mode = alc262_modes, | |
12405 | .input_mux = &alc262_HP_capture_source, | |
12406 | .unsol_event = alc262_hp_bpc_unsol_event, | |
12407 | .init_hook = alc262_hp_bpc_automute, | |
12408 | }, | |
12409 | [ALC262_HP_BPC_D7000_WF] = { | |
12410 | .mixers = { alc262_HP_BPC_WildWest_mixer }, | |
12411 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
12412 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12413 | .dac_nids = alc262_dac_nids, | |
12414 | .hp_nid = 0x03, | |
12415 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12416 | .channel_mode = alc262_modes, | |
12417 | .input_mux = &alc262_HP_D7000_capture_source, | |
12418 | .unsol_event = alc262_hp_wildwest_unsol_event, | |
12419 | .init_hook = alc262_hp_wildwest_automute, | |
12420 | }, | |
12421 | [ALC262_HP_BPC_D7000_WL] = { | |
12422 | .mixers = { alc262_HP_BPC_WildWest_mixer, | |
12423 | alc262_HP_BPC_WildWest_option_mixer }, | |
12424 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
12425 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12426 | .dac_nids = alc262_dac_nids, | |
12427 | .hp_nid = 0x03, | |
12428 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12429 | .channel_mode = alc262_modes, | |
12430 | .input_mux = &alc262_HP_D7000_capture_source, | |
12431 | .unsol_event = alc262_hp_wildwest_unsol_event, | |
12432 | .init_hook = alc262_hp_wildwest_automute, | |
12433 | }, | |
12434 | [ALC262_HP_TC_T5735] = { | |
12435 | .mixers = { alc262_hp_t5735_mixer }, | |
12436 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, | |
12437 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12438 | .dac_nids = alc262_dac_nids, | |
12439 | .hp_nid = 0x03, | |
12440 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12441 | .channel_mode = alc262_modes, | |
12442 | .input_mux = &alc262_capture_source, | |
12443 | .unsol_event = alc_sku_unsol_event, | |
12444 | .setup = alc262_hp_t5735_setup, | |
12445 | .init_hook = alc_inithook, | |
12446 | }, | |
12447 | [ALC262_HP_RP5700] = { | |
12448 | .mixers = { alc262_hp_rp5700_mixer }, | |
12449 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, | |
12450 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12451 | .dac_nids = alc262_dac_nids, | |
12452 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12453 | .channel_mode = alc262_modes, | |
12454 | .input_mux = &alc262_hp_rp5700_capture_source, | |
12455 | }, | |
12456 | [ALC262_BENQ_ED8] = { | |
12457 | .mixers = { alc262_base_mixer }, | |
12458 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | |
12459 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12460 | .dac_nids = alc262_dac_nids, | |
12461 | .hp_nid = 0x03, | |
12462 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12463 | .channel_mode = alc262_modes, | |
12464 | .input_mux = &alc262_capture_source, | |
12465 | }, | |
12466 | [ALC262_SONY_ASSAMD] = { | |
12467 | .mixers = { alc262_sony_mixer }, | |
12468 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, | |
12469 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12470 | .dac_nids = alc262_dac_nids, | |
12471 | .hp_nid = 0x02, | |
12472 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12473 | .channel_mode = alc262_modes, | |
12474 | .input_mux = &alc262_capture_source, | |
12475 | .unsol_event = alc262_hippo_unsol_event, | |
12476 | .setup = alc262_hippo_setup, | |
12477 | .init_hook = alc262_hippo_automute, | |
12478 | }, | |
12479 | [ALC262_BENQ_T31] = { | |
12480 | .mixers = { alc262_benq_t31_mixer }, | |
12481 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, | |
12482 | alc_hp15_unsol_verbs }, | |
12483 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12484 | .dac_nids = alc262_dac_nids, | |
12485 | .hp_nid = 0x03, | |
12486 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12487 | .channel_mode = alc262_modes, | |
12488 | .input_mux = &alc262_capture_source, | |
12489 | .unsol_event = alc262_hippo_unsol_event, | |
12490 | .setup = alc262_hippo_setup, | |
12491 | .init_hook = alc262_hippo_automute, | |
12492 | }, | |
12493 | [ALC262_ULTRA] = { | |
12494 | .mixers = { alc262_ultra_mixer }, | |
12495 | .cap_mixer = alc262_ultra_capture_mixer, | |
12496 | .init_verbs = { alc262_ultra_verbs }, | |
12497 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12498 | .dac_nids = alc262_dac_nids, | |
12499 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12500 | .channel_mode = alc262_modes, | |
12501 | .input_mux = &alc262_ultra_capture_source, | |
12502 | .adc_nids = alc262_adc_nids, /* ADC0 */ | |
12503 | .capsrc_nids = alc262_capsrc_nids, | |
12504 | .num_adc_nids = 1, /* single ADC */ | |
12505 | .unsol_event = alc262_ultra_unsol_event, | |
12506 | .init_hook = alc262_ultra_automute, | |
12507 | }, | |
12508 | [ALC262_LENOVO_3000] = { | |
12509 | .mixers = { alc262_lenovo_3000_mixer }, | |
12510 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | |
12511 | alc262_lenovo_3000_unsol_verbs, | |
12512 | alc262_lenovo_3000_init_verbs }, | |
12513 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12514 | .dac_nids = alc262_dac_nids, | |
12515 | .hp_nid = 0x03, | |
12516 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12517 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12518 | .channel_mode = alc262_modes, | |
12519 | .input_mux = &alc262_fujitsu_capture_source, | |
12520 | .unsol_event = alc262_lenovo_3000_unsol_event, | |
12521 | }, | |
12522 | [ALC262_NEC] = { | |
12523 | .mixers = { alc262_nec_mixer }, | |
12524 | .init_verbs = { alc262_nec_verbs }, | |
12525 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12526 | .dac_nids = alc262_dac_nids, | |
12527 | .hp_nid = 0x03, | |
12528 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12529 | .channel_mode = alc262_modes, | |
12530 | .input_mux = &alc262_capture_source, | |
12531 | }, | |
12532 | [ALC262_TOSHIBA_S06] = { | |
12533 | .mixers = { alc262_toshiba_s06_mixer }, | |
12534 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, | |
12535 | alc262_eapd_verbs }, | |
12536 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12537 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
12538 | .dac_nids = alc262_dac_nids, | |
12539 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ | |
12540 | .num_adc_nids = 1, /* single ADC */ | |
12541 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12542 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12543 | .channel_mode = alc262_modes, | |
12544 | .unsol_event = alc_sku_unsol_event, | |
12545 | .setup = alc262_toshiba_s06_setup, | |
12546 | .init_hook = alc_inithook, | |
12547 | }, | |
12548 | [ALC262_TOSHIBA_RX1] = { | |
12549 | .mixers = { alc262_toshiba_rx1_mixer }, | |
12550 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, | |
12551 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12552 | .dac_nids = alc262_dac_nids, | |
12553 | .hp_nid = 0x03, | |
12554 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12555 | .channel_mode = alc262_modes, | |
12556 | .input_mux = &alc262_capture_source, | |
12557 | .unsol_event = alc262_hippo_unsol_event, | |
12558 | .setup = alc262_hippo_setup, | |
12559 | .init_hook = alc262_hippo_automute, | |
12560 | }, | |
12561 | [ALC262_TYAN] = { | |
12562 | .mixers = { alc262_tyan_mixer }, | |
12563 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, | |
12564 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12565 | .dac_nids = alc262_dac_nids, | |
12566 | .hp_nid = 0x02, | |
12567 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12568 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12569 | .channel_mode = alc262_modes, | |
12570 | .input_mux = &alc262_capture_source, | |
12571 | .unsol_event = alc_automute_amp_unsol_event, | |
12572 | .setup = alc262_tyan_setup, | |
12573 | .init_hook = alc_automute_amp, | |
12574 | }, | |
12575 | }; | |
12576 | ||
12577 | static int patch_alc262(struct hda_codec *codec) | |
12578 | { | |
12579 | struct alc_spec *spec; | |
12580 | int board_config; | |
12581 | int err; | |
12582 | ||
12583 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
12584 | if (spec == NULL) | |
12585 | return -ENOMEM; | |
12586 | ||
12587 | codec->spec = spec; | |
12588 | #if 0 | |
12589 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is | |
12590 | * under-run | |
12591 | */ | |
12592 | { | |
12593 | int tmp; | |
12594 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
12595 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
12596 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
12597 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); | |
12598 | } | |
12599 | #endif | |
12600 | alc_auto_parse_customize_define(codec); | |
12601 | ||
12602 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | |
12603 | ||
12604 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, | |
12605 | alc262_models, | |
12606 | alc262_cfg_tbl); | |
12607 | ||
12608 | if (board_config < 0) { | |
12609 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
12610 | codec->chip_name); | |
12611 | board_config = ALC262_AUTO; | |
12612 | } | |
12613 | ||
12614 | if (board_config == ALC262_AUTO) { | |
12615 | /* automatic parse from the BIOS config */ | |
12616 | err = alc262_parse_auto_config(codec); | |
12617 | if (err < 0) { | |
12618 | alc_free(codec); | |
12619 | return err; | |
12620 | } else if (!err) { | |
12621 | printk(KERN_INFO | |
12622 | "hda_codec: Cannot set up configuration " | |
12623 | "from BIOS. Using base mode...\n"); | |
12624 | board_config = ALC262_BASIC; | |
12625 | } | |
12626 | } | |
12627 | ||
12628 | if (!spec->no_analog && has_cdefine_beep(codec)) { | |
12629 | err = snd_hda_attach_beep_device(codec, 0x1); | |
12630 | if (err < 0) { | |
12631 | alc_free(codec); | |
12632 | return err; | |
12633 | } | |
12634 | } | |
12635 | ||
12636 | if (board_config != ALC262_AUTO) | |
12637 | setup_preset(codec, &alc262_presets[board_config]); | |
12638 | ||
12639 | spec->stream_analog_playback = &alc262_pcm_analog_playback; | |
12640 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | |
12641 | ||
12642 | spec->stream_digital_playback = &alc262_pcm_digital_playback; | |
12643 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | |
12644 | ||
12645 | if (!spec->adc_nids && spec->input_mux) { | |
12646 | int i; | |
12647 | /* check whether the digital-mic has to be supported */ | |
12648 | for (i = 0; i < spec->input_mux->num_items; i++) { | |
12649 | if (spec->input_mux->items[i].index >= 9) | |
12650 | break; | |
12651 | } | |
12652 | if (i < spec->input_mux->num_items) { | |
12653 | /* use only ADC0 */ | |
12654 | spec->adc_nids = alc262_dmic_adc_nids; | |
12655 | spec->num_adc_nids = 1; | |
12656 | spec->capsrc_nids = alc262_dmic_capsrc_nids; | |
12657 | } else { | |
12658 | /* all analog inputs */ | |
12659 | /* check whether NID 0x07 is valid */ | |
12660 | unsigned int wcap = get_wcaps(codec, 0x07); | |
12661 | ||
12662 | /* get type */ | |
12663 | wcap = get_wcaps_type(wcap); | |
12664 | if (wcap != AC_WID_AUD_IN) { | |
12665 | spec->adc_nids = alc262_adc_nids_alt; | |
12666 | spec->num_adc_nids = | |
12667 | ARRAY_SIZE(alc262_adc_nids_alt); | |
12668 | spec->capsrc_nids = alc262_capsrc_nids_alt; | |
12669 | } else { | |
12670 | spec->adc_nids = alc262_adc_nids; | |
12671 | spec->num_adc_nids = | |
12672 | ARRAY_SIZE(alc262_adc_nids); | |
12673 | spec->capsrc_nids = alc262_capsrc_nids; | |
12674 | } | |
12675 | } | |
12676 | } | |
12677 | if (!spec->cap_mixer && !spec->no_analog) | |
12678 | set_capture_mixer(codec); | |
12679 | if (!spec->no_analog && has_cdefine_beep(codec)) | |
12680 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
12681 | ||
12682 | spec->vmaster_nid = 0x0c; | |
12683 | ||
12684 | codec->patch_ops = alc_patch_ops; | |
12685 | if (board_config == ALC262_AUTO) | |
12686 | spec->init_hook = alc262_auto_init; | |
12687 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
12688 | if (!spec->loopback.amplist) | |
12689 | spec->loopback.amplist = alc262_loopbacks; | |
12690 | #endif | |
12691 | ||
12692 | return 0; | |
12693 | } | |
12694 | ||
12695 | /* | |
12696 | * ALC268 channel source setting (2 channel) | |
12697 | */ | |
12698 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | |
12699 | #define alc268_modes alc260_modes | |
12700 | ||
12701 | static hda_nid_t alc268_dac_nids[2] = { | |
12702 | /* front, hp */ | |
12703 | 0x02, 0x03 | |
12704 | }; | |
12705 | ||
12706 | static hda_nid_t alc268_adc_nids[2] = { | |
12707 | /* ADC0-1 */ | |
12708 | 0x08, 0x07 | |
12709 | }; | |
12710 | ||
12711 | static hda_nid_t alc268_adc_nids_alt[1] = { | |
12712 | /* ADC0 */ | |
12713 | 0x08 | |
12714 | }; | |
12715 | ||
12716 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; | |
12717 | ||
12718 | static struct snd_kcontrol_new alc268_base_mixer[] = { | |
12719 | /* output mixer control */ | |
12720 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
12721 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
12722 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
12723 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
12724 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12725 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12726 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
12727 | { } | |
12728 | }; | |
12729 | ||
12730 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { | |
12731 | /* output mixer control */ | |
12732 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
12733 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
12734 | ALC262_HIPPO_MASTER_SWITCH, | |
12735 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12736 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12737 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
12738 | { } | |
12739 | }; | |
12740 | ||
12741 | /* bind Beep switches of both NID 0x0f and 0x10 */ | |
12742 | static struct hda_bind_ctls alc268_bind_beep_sw = { | |
12743 | .ops = &snd_hda_bind_sw, | |
12744 | .values = { | |
12745 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | |
12746 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | |
12747 | 0 | |
12748 | }, | |
12749 | }; | |
12750 | ||
12751 | static struct snd_kcontrol_new alc268_beep_mixer[] = { | |
12752 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | |
12753 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | |
12754 | { } | |
12755 | }; | |
12756 | ||
12757 | static struct hda_verb alc268_eapd_verbs[] = { | |
12758 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12759 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12760 | { } | |
12761 | }; | |
12762 | ||
12763 | /* Toshiba specific */ | |
12764 | static struct hda_verb alc268_toshiba_verbs[] = { | |
12765 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12766 | { } /* end */ | |
12767 | }; | |
12768 | ||
12769 | /* Acer specific */ | |
12770 | /* bind volumes of both NID 0x02 and 0x03 */ | |
12771 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { | |
12772 | .ops = &snd_hda_bind_vol, | |
12773 | .values = { | |
12774 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
12775 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
12776 | 0 | |
12777 | }, | |
12778 | }; | |
12779 | ||
12780 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
12781 | static void alc268_acer_automute(struct hda_codec *codec, int force) | |
12782 | { | |
12783 | struct alc_spec *spec = codec->spec; | |
12784 | unsigned int mute; | |
12785 | ||
12786 | if (force || !spec->sense_updated) { | |
12787 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); | |
12788 | spec->sense_updated = 1; | |
12789 | } | |
12790 | if (spec->jack_present) | |
12791 | mute = HDA_AMP_MUTE; /* mute internal speaker */ | |
12792 | else /* unmute internal speaker if necessary */ | |
12793 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
12794 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
12795 | HDA_AMP_MUTE, mute); | |
12796 | } | |
12797 | ||
12798 | ||
12799 | /* bind hp and internal speaker mute (with plug check) */ | |
12800 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, | |
12801 | struct snd_ctl_elem_value *ucontrol) | |
12802 | { | |
12803 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
12804 | long *valp = ucontrol->value.integer.value; | |
12805 | int change; | |
12806 | ||
12807 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); | |
12808 | if (change) | |
12809 | alc268_acer_automute(codec, 0); | |
12810 | return change; | |
12811 | } | |
12812 | ||
12813 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { | |
12814 | /* output mixer control */ | |
12815 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
12816 | { | |
12817 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12818 | .name = "Master Playback Switch", | |
12819 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
12820 | .info = snd_hda_mixer_amp_switch_info, | |
12821 | .get = snd_hda_mixer_amp_switch_get, | |
12822 | .put = alc268_acer_master_sw_put, | |
12823 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
12824 | }, | |
12825 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), | |
12826 | { } | |
12827 | }; | |
12828 | ||
12829 | static struct snd_kcontrol_new alc268_acer_mixer[] = { | |
12830 | /* output mixer control */ | |
12831 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
12832 | { | |
12833 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12834 | .name = "Master Playback Switch", | |
12835 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
12836 | .info = snd_hda_mixer_amp_switch_info, | |
12837 | .get = snd_hda_mixer_amp_switch_get, | |
12838 | .put = alc268_acer_master_sw_put, | |
12839 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
12840 | }, | |
12841 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12842 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
12843 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
12844 | { } | |
12845 | }; | |
12846 | ||
12847 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { | |
12848 | /* output mixer control */ | |
12849 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
12850 | { | |
12851 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12852 | .name = "Master Playback Switch", | |
12853 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
12854 | .info = snd_hda_mixer_amp_switch_info, | |
12855 | .get = snd_hda_mixer_amp_switch_get, | |
12856 | .put = alc268_acer_master_sw_put, | |
12857 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
12858 | }, | |
12859 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12860 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
12861 | { } | |
12862 | }; | |
12863 | ||
12864 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { | |
12865 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12866 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12867 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12868 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
12869 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
12870 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, | |
12871 | { } | |
12872 | }; | |
12873 | ||
12874 | static struct hda_verb alc268_acer_verbs[] = { | |
12875 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ | |
12876 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12877 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12878 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12879 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12880 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12881 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12882 | { } | |
12883 | }; | |
12884 | ||
12885 | /* unsolicited event for HP jack sensing */ | |
12886 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event | |
12887 | #define alc268_toshiba_setup alc262_hippo_setup | |
12888 | #define alc268_toshiba_automute alc262_hippo_automute | |
12889 | ||
12890 | static void alc268_acer_unsol_event(struct hda_codec *codec, | |
12891 | unsigned int res) | |
12892 | { | |
12893 | if ((res >> 26) != ALC880_HP_EVENT) | |
12894 | return; | |
12895 | alc268_acer_automute(codec, 1); | |
12896 | } | |
12897 | ||
12898 | static void alc268_acer_init_hook(struct hda_codec *codec) | |
12899 | { | |
12900 | alc268_acer_automute(codec, 1); | |
12901 | } | |
12902 | ||
12903 | /* toggle speaker-output according to the hp-jack state */ | |
12904 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | |
12905 | { | |
12906 | unsigned int present; | |
12907 | unsigned char bits; | |
12908 | ||
12909 | present = snd_hda_jack_detect(codec, 0x15); | |
12910 | bits = present ? HDA_AMP_MUTE : 0; | |
12911 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, | |
12912 | HDA_AMP_MUTE, bits); | |
12913 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, | |
12914 | HDA_AMP_MUTE, bits); | |
12915 | } | |
12916 | ||
12917 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, | |
12918 | unsigned int res) | |
12919 | { | |
12920 | switch (res >> 26) { | |
12921 | case ALC880_HP_EVENT: | |
12922 | alc268_aspire_one_speaker_automute(codec); | |
12923 | break; | |
12924 | case ALC880_MIC_EVENT: | |
12925 | alc_mic_automute(codec); | |
12926 | break; | |
12927 | } | |
12928 | } | |
12929 | ||
12930 | static void alc268_acer_lc_setup(struct hda_codec *codec) | |
12931 | { | |
12932 | struct alc_spec *spec = codec->spec; | |
12933 | spec->ext_mic.pin = 0x18; | |
12934 | spec->ext_mic.mux_idx = 0; | |
12935 | spec->int_mic.pin = 0x12; | |
12936 | spec->int_mic.mux_idx = 6; | |
12937 | spec->auto_mic = 1; | |
12938 | } | |
12939 | ||
12940 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | |
12941 | { | |
12942 | alc268_aspire_one_speaker_automute(codec); | |
12943 | alc_mic_automute(codec); | |
12944 | } | |
12945 | ||
12946 | static struct snd_kcontrol_new alc268_dell_mixer[] = { | |
12947 | /* output mixer control */ | |
12948 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
12949 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
12950 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
12951 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
12952 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12953 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
12954 | { } | |
12955 | }; | |
12956 | ||
12957 | static struct hda_verb alc268_dell_verbs[] = { | |
12958 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12959 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12960 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12961 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
12962 | { } | |
12963 | }; | |
12964 | ||
12965 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
12966 | static void alc268_dell_setup(struct hda_codec *codec) | |
12967 | { | |
12968 | struct alc_spec *spec = codec->spec; | |
12969 | ||
12970 | spec->autocfg.hp_pins[0] = 0x15; | |
12971 | spec->autocfg.speaker_pins[0] = 0x14; | |
12972 | spec->ext_mic.pin = 0x18; | |
12973 | spec->ext_mic.mux_idx = 0; | |
12974 | spec->int_mic.pin = 0x19; | |
12975 | spec->int_mic.mux_idx = 1; | |
12976 | spec->auto_mic = 1; | |
12977 | } | |
12978 | ||
12979 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { | |
12980 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
12981 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
12982 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
12983 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
12984 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
12985 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), | |
12986 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
12987 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
12988 | { } | |
12989 | }; | |
12990 | ||
12991 | static struct hda_verb alc267_quanta_il1_verbs[] = { | |
12992 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12993 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
12994 | { } | |
12995 | }; | |
12996 | ||
12997 | static void alc267_quanta_il1_setup(struct hda_codec *codec) | |
12998 | { | |
12999 | struct alc_spec *spec = codec->spec; | |
13000 | spec->autocfg.hp_pins[0] = 0x15; | |
13001 | spec->autocfg.speaker_pins[0] = 0x14; | |
13002 | spec->ext_mic.pin = 0x18; | |
13003 | spec->ext_mic.mux_idx = 0; | |
13004 | spec->int_mic.pin = 0x19; | |
13005 | spec->int_mic.mux_idx = 1; | |
13006 | spec->auto_mic = 1; | |
13007 | } | |
13008 | ||
13009 | /* | |
13010 | * generic initialization of ADC, input mixers and output mixers | |
13011 | */ | |
13012 | static struct hda_verb alc268_base_init_verbs[] = { | |
13013 | /* Unmute DAC0-1 and set vol = 0 */ | |
13014 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13015 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13016 | ||
13017 | /* | |
13018 | * Set up output mixers (0x0c - 0x0e) | |
13019 | */ | |
13020 | /* set vol=0 to output mixers */ | |
13021 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13022 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13023 | ||
13024 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13025 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13026 | ||
13027 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
13028 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
13029 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
13030 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13031 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13032 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13033 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13034 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13035 | ||
13036 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13037 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13038 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13039 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13040 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13041 | ||
13042 | /* set PCBEEP vol = 0, mute connections */ | |
13043 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13044 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13045 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13046 | ||
13047 | /* Unmute Selector 23h,24h and set the default input to mic-in */ | |
13048 | ||
13049 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13050 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13051 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13052 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13053 | ||
13054 | { } | |
13055 | }; | |
13056 | ||
13057 | /* | |
13058 | * generic initialization of ADC, input mixers and output mixers | |
13059 | */ | |
13060 | static struct hda_verb alc268_volume_init_verbs[] = { | |
13061 | /* set output DAC */ | |
13062 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13063 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13064 | ||
13065 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13066 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13067 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13068 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13069 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13070 | ||
13071 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13072 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13073 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13074 | ||
13075 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13076 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13077 | ||
13078 | /* set PCBEEP vol = 0, mute connections */ | |
13079 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13080 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13081 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13082 | ||
13083 | { } | |
13084 | }; | |
13085 | ||
13086 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { | |
13087 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13088 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
13089 | { } /* end */ | |
13090 | }; | |
13091 | ||
13092 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { | |
13093 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13094 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
13095 | _DEFINE_CAPSRC(1), | |
13096 | { } /* end */ | |
13097 | }; | |
13098 | ||
13099 | static struct snd_kcontrol_new alc268_capture_mixer[] = { | |
13100 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13101 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
13102 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | |
13103 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | |
13104 | _DEFINE_CAPSRC(2), | |
13105 | { } /* end */ | |
13106 | }; | |
13107 | ||
13108 | static struct hda_input_mux alc268_capture_source = { | |
13109 | .num_items = 4, | |
13110 | .items = { | |
13111 | { "Mic", 0x0 }, | |
13112 | { "Front Mic", 0x1 }, | |
13113 | { "Line", 0x2 }, | |
13114 | { "CD", 0x3 }, | |
13115 | }, | |
13116 | }; | |
13117 | ||
13118 | static struct hda_input_mux alc268_acer_capture_source = { | |
13119 | .num_items = 3, | |
13120 | .items = { | |
13121 | { "Mic", 0x0 }, | |
13122 | { "Internal Mic", 0x1 }, | |
13123 | { "Line", 0x2 }, | |
13124 | }, | |
13125 | }; | |
13126 | ||
13127 | static struct hda_input_mux alc268_acer_dmic_capture_source = { | |
13128 | .num_items = 3, | |
13129 | .items = { | |
13130 | { "Mic", 0x0 }, | |
13131 | { "Internal Mic", 0x6 }, | |
13132 | { "Line", 0x2 }, | |
13133 | }, | |
13134 | }; | |
13135 | ||
13136 | #ifdef CONFIG_SND_DEBUG | |
13137 | static struct snd_kcontrol_new alc268_test_mixer[] = { | |
13138 | /* Volume widgets */ | |
13139 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13140 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13141 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
13142 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), | |
13143 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), | |
13144 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), | |
13145 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), | |
13146 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), | |
13147 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), | |
13148 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), | |
13149 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), | |
13150 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), | |
13151 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), | |
13152 | /* The below appears problematic on some hardwares */ | |
13153 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ | |
13154 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13155 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), | |
13156 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), | |
13157 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), | |
13158 | ||
13159 | /* Modes for retasking pin widgets */ | |
13160 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
13161 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
13162 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), | |
13163 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), | |
13164 | ||
13165 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
13166 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
13167 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
13168 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
13169 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
13170 | ||
13171 | /* Switches to allow the digital SPDIF output pin to be enabled. | |
13172 | * The ALC268 does not have an SPDIF input. | |
13173 | */ | |
13174 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), | |
13175 | ||
13176 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | |
13177 | * this output to turn on an external amplifier. | |
13178 | */ | |
13179 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
13180 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
13181 | ||
13182 | { } /* end */ | |
13183 | }; | |
13184 | #endif | |
13185 | ||
13186 | /* create input playback/capture controls for the given pin */ | |
13187 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
13188 | const char *ctlname, int idx) | |
13189 | { | |
13190 | hda_nid_t dac; | |
13191 | int err; | |
13192 | ||
13193 | switch (nid) { | |
13194 | case 0x14: | |
13195 | case 0x16: | |
13196 | dac = 0x02; | |
13197 | break; | |
13198 | case 0x15: | |
13199 | case 0x1a: /* ALC259/269 only */ | |
13200 | case 0x1b: /* ALC259/269 only */ | |
13201 | case 0x21: /* ALC269vb has this pin, too */ | |
13202 | dac = 0x03; | |
13203 | break; | |
13204 | default: | |
13205 | snd_printd(KERN_WARNING "hda_codec: " | |
13206 | "ignoring pin 0x%x as unknown\n", nid); | |
13207 | return 0; | |
13208 | } | |
13209 | if (spec->multiout.dac_nids[0] != dac && | |
13210 | spec->multiout.dac_nids[1] != dac) { | |
13211 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, | |
13212 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, | |
13213 | HDA_OUTPUT)); | |
13214 | if (err < 0) | |
13215 | return err; | |
13216 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
13217 | } | |
13218 | ||
13219 | if (nid != 0x16) | |
13220 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
13221 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | |
13222 | else /* mono */ | |
13223 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
13224 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); | |
13225 | if (err < 0) | |
13226 | return err; | |
13227 | return 0; | |
13228 | } | |
13229 | ||
13230 | /* add playback controls from the parsed DAC table */ | |
13231 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |
13232 | const struct auto_pin_cfg *cfg) | |
13233 | { | |
13234 | hda_nid_t nid; | |
13235 | int err; | |
13236 | ||
13237 | spec->multiout.dac_nids = spec->private_dac_nids; | |
13238 | ||
13239 | nid = cfg->line_out_pins[0]; | |
13240 | if (nid) { | |
13241 | const char *name; | |
13242 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
13243 | name = "Speaker"; | |
13244 | else | |
13245 | name = "Front"; | |
13246 | err = alc268_new_analog_output(spec, nid, name, 0); | |
13247 | if (err < 0) | |
13248 | return err; | |
13249 | } | |
13250 | ||
13251 | nid = cfg->speaker_pins[0]; | |
13252 | if (nid == 0x1d) { | |
13253 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", | |
13254 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
13255 | if (err < 0) | |
13256 | return err; | |
13257 | } else if (nid) { | |
13258 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); | |
13259 | if (err < 0) | |
13260 | return err; | |
13261 | } | |
13262 | nid = cfg->hp_pins[0]; | |
13263 | if (nid) { | |
13264 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); | |
13265 | if (err < 0) | |
13266 | return err; | |
13267 | } | |
13268 | ||
13269 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | |
13270 | if (nid == 0x16) { | |
13271 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", | |
13272 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); | |
13273 | if (err < 0) | |
13274 | return err; | |
13275 | } | |
13276 | return 0; | |
13277 | } | |
13278 | ||
13279 | /* create playback/capture controls for input pins */ | |
13280 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, | |
13281 | const struct auto_pin_cfg *cfg) | |
13282 | { | |
13283 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); | |
13284 | } | |
13285 | ||
13286 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, | |
13287 | hda_nid_t nid, int pin_type) | |
13288 | { | |
13289 | int idx; | |
13290 | ||
13291 | alc_set_pin_output(codec, nid, pin_type); | |
13292 | if (nid == 0x14 || nid == 0x16) | |
13293 | idx = 0; | |
13294 | else | |
13295 | idx = 1; | |
13296 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | |
13297 | } | |
13298 | ||
13299 | static void alc268_auto_init_multi_out(struct hda_codec *codec) | |
13300 | { | |
13301 | struct alc_spec *spec = codec->spec; | |
13302 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; | |
13303 | if (nid) { | |
13304 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
13305 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); | |
13306 | } | |
13307 | } | |
13308 | ||
13309 | static void alc268_auto_init_hp_out(struct hda_codec *codec) | |
13310 | { | |
13311 | struct alc_spec *spec = codec->spec; | |
13312 | hda_nid_t pin; | |
13313 | ||
13314 | pin = spec->autocfg.hp_pins[0]; | |
13315 | if (pin) | |
13316 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); | |
13317 | pin = spec->autocfg.speaker_pins[0]; | |
13318 | if (pin) | |
13319 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); | |
13320 | } | |
13321 | ||
13322 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | |
13323 | { | |
13324 | struct alc_spec *spec = codec->spec; | |
13325 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
13326 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
13327 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
13328 | unsigned int dac_vol1, dac_vol2; | |
13329 | ||
13330 | if (line_nid == 0x1d || speaker_nid == 0x1d) { | |
13331 | snd_hda_codec_write(codec, speaker_nid, 0, | |
13332 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
13333 | /* mute mixer inputs from 0x1d */ | |
13334 | snd_hda_codec_write(codec, 0x0f, 0, | |
13335 | AC_VERB_SET_AMP_GAIN_MUTE, | |
13336 | AMP_IN_UNMUTE(1)); | |
13337 | snd_hda_codec_write(codec, 0x10, 0, | |
13338 | AC_VERB_SET_AMP_GAIN_MUTE, | |
13339 | AMP_IN_UNMUTE(1)); | |
13340 | } else { | |
13341 | /* unmute mixer inputs from 0x1d */ | |
13342 | snd_hda_codec_write(codec, 0x0f, 0, | |
13343 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
13344 | snd_hda_codec_write(codec, 0x10, 0, | |
13345 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
13346 | } | |
13347 | ||
13348 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ | |
13349 | if (line_nid == 0x14) | |
13350 | dac_vol2 = AMP_OUT_ZERO; | |
13351 | else if (line_nid == 0x15) | |
13352 | dac_vol1 = AMP_OUT_ZERO; | |
13353 | if (hp_nid == 0x14) | |
13354 | dac_vol2 = AMP_OUT_ZERO; | |
13355 | else if (hp_nid == 0x15) | |
13356 | dac_vol1 = AMP_OUT_ZERO; | |
13357 | if (line_nid != 0x16 || hp_nid != 0x16 || | |
13358 | spec->autocfg.line_out_pins[1] != 0x16 || | |
13359 | spec->autocfg.line_out_pins[2] != 0x16) | |
13360 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; | |
13361 | ||
13362 | snd_hda_codec_write(codec, 0x02, 0, | |
13363 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); | |
13364 | snd_hda_codec_write(codec, 0x03, 0, | |
13365 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); | |
13366 | } | |
13367 | ||
13368 | /* pcm configuration: identical with ALC880 */ | |
13369 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback | |
13370 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture | |
13371 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture | |
13372 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback | |
13373 | ||
13374 | /* | |
13375 | * BIOS auto configuration | |
13376 | */ | |
13377 | static int alc268_parse_auto_config(struct hda_codec *codec) | |
13378 | { | |
13379 | struct alc_spec *spec = codec->spec; | |
13380 | int err; | |
13381 | static hda_nid_t alc268_ignore[] = { 0 }; | |
13382 | ||
13383 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
13384 | alc268_ignore); | |
13385 | if (err < 0) | |
13386 | return err; | |
13387 | if (!spec->autocfg.line_outs) { | |
13388 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
13389 | spec->multiout.max_channels = 2; | |
13390 | spec->no_analog = 1; | |
13391 | goto dig_only; | |
13392 | } | |
13393 | return 0; /* can't find valid BIOS pin config */ | |
13394 | } | |
13395 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
13396 | if (err < 0) | |
13397 | return err; | |
13398 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); | |
13399 | if (err < 0) | |
13400 | return err; | |
13401 | ||
13402 | spec->multiout.max_channels = 2; | |
13403 | ||
13404 | dig_only: | |
13405 | /* digital only support output */ | |
13406 | alc_auto_parse_digital(codec); | |
13407 | if (spec->kctls.list) | |
13408 | add_mixer(spec, spec->kctls.list); | |
13409 | ||
13410 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) | |
13411 | add_mixer(spec, alc268_beep_mixer); | |
13412 | ||
13413 | add_verb(spec, alc268_volume_init_verbs); | |
13414 | spec->num_mux_defs = 2; | |
13415 | spec->input_mux = &spec->private_imux[0]; | |
13416 | ||
13417 | err = alc_auto_add_mic_boost(codec); | |
13418 | if (err < 0) | |
13419 | return err; | |
13420 | ||
13421 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
13422 | ||
13423 | return 1; | |
13424 | } | |
13425 | ||
13426 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input | |
13427 | ||
13428 | /* init callback for auto-configuration model -- overriding the default init */ | |
13429 | static void alc268_auto_init(struct hda_codec *codec) | |
13430 | { | |
13431 | struct alc_spec *spec = codec->spec; | |
13432 | alc268_auto_init_multi_out(codec); | |
13433 | alc268_auto_init_hp_out(codec); | |
13434 | alc268_auto_init_mono_speaker_out(codec); | |
13435 | alc268_auto_init_analog_input(codec); | |
13436 | alc_auto_init_digital(codec); | |
13437 | if (spec->unsol_event) | |
13438 | alc_inithook(codec); | |
13439 | } | |
13440 | ||
13441 | /* | |
13442 | * configuration and preset | |
13443 | */ | |
13444 | static const char *alc268_models[ALC268_MODEL_LAST] = { | |
13445 | [ALC267_QUANTA_IL1] = "quanta-il1", | |
13446 | [ALC268_3ST] = "3stack", | |
13447 | [ALC268_TOSHIBA] = "toshiba", | |
13448 | [ALC268_ACER] = "acer", | |
13449 | [ALC268_ACER_DMIC] = "acer-dmic", | |
13450 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", | |
13451 | [ALC268_DELL] = "dell", | |
13452 | [ALC268_ZEPTO] = "zepto", | |
13453 | #ifdef CONFIG_SND_DEBUG | |
13454 | [ALC268_TEST] = "test", | |
13455 | #endif | |
13456 | [ALC268_AUTO] = "auto", | |
13457 | }; | |
13458 | ||
13459 | static struct snd_pci_quirk alc268_cfg_tbl[] = { | |
13460 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), | |
13461 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), | |
13462 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), | |
13463 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), | |
13464 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), | |
13465 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", | |
13466 | ALC268_ACER_ASPIRE_ONE), | |
13467 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), | |
13468 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, | |
13469 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), | |
13470 | /* almost compatible with toshiba but with optional digital outs; | |
13471 | * auto-probing seems working fine | |
13472 | */ | |
13473 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", | |
13474 | ALC268_AUTO), | |
13475 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), | |
13476 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), | |
13477 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), | |
13478 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), | |
13479 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), | |
13480 | {} | |
13481 | }; | |
13482 | ||
13483 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ | |
13484 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { | |
13485 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), | |
13486 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), | |
13487 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", | |
13488 | ALC268_TOSHIBA), | |
13489 | {} | |
13490 | }; | |
13491 | ||
13492 | static struct alc_config_preset alc268_presets[] = { | |
13493 | [ALC267_QUANTA_IL1] = { | |
13494 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, | |
13495 | alc268_capture_nosrc_mixer }, | |
13496 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13497 | alc267_quanta_il1_verbs }, | |
13498 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13499 | .dac_nids = alc268_dac_nids, | |
13500 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13501 | .adc_nids = alc268_adc_nids_alt, | |
13502 | .hp_nid = 0x03, | |
13503 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13504 | .channel_mode = alc268_modes, | |
13505 | .unsol_event = alc_sku_unsol_event, | |
13506 | .setup = alc267_quanta_il1_setup, | |
13507 | .init_hook = alc_inithook, | |
13508 | }, | |
13509 | [ALC268_3ST] = { | |
13510 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | |
13511 | alc268_beep_mixer }, | |
13512 | .init_verbs = { alc268_base_init_verbs }, | |
13513 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13514 | .dac_nids = alc268_dac_nids, | |
13515 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13516 | .adc_nids = alc268_adc_nids_alt, | |
13517 | .capsrc_nids = alc268_capsrc_nids, | |
13518 | .hp_nid = 0x03, | |
13519 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13520 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13521 | .channel_mode = alc268_modes, | |
13522 | .input_mux = &alc268_capture_source, | |
13523 | }, | |
13524 | [ALC268_TOSHIBA] = { | |
13525 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, | |
13526 | alc268_beep_mixer }, | |
13527 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13528 | alc268_toshiba_verbs }, | |
13529 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13530 | .dac_nids = alc268_dac_nids, | |
13531 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13532 | .adc_nids = alc268_adc_nids_alt, | |
13533 | .capsrc_nids = alc268_capsrc_nids, | |
13534 | .hp_nid = 0x03, | |
13535 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13536 | .channel_mode = alc268_modes, | |
13537 | .input_mux = &alc268_capture_source, | |
13538 | .unsol_event = alc268_toshiba_unsol_event, | |
13539 | .setup = alc268_toshiba_setup, | |
13540 | .init_hook = alc268_toshiba_automute, | |
13541 | }, | |
13542 | [ALC268_ACER] = { | |
13543 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, | |
13544 | alc268_beep_mixer }, | |
13545 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13546 | alc268_acer_verbs }, | |
13547 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13548 | .dac_nids = alc268_dac_nids, | |
13549 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13550 | .adc_nids = alc268_adc_nids_alt, | |
13551 | .capsrc_nids = alc268_capsrc_nids, | |
13552 | .hp_nid = 0x02, | |
13553 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13554 | .channel_mode = alc268_modes, | |
13555 | .input_mux = &alc268_acer_capture_source, | |
13556 | .unsol_event = alc268_acer_unsol_event, | |
13557 | .init_hook = alc268_acer_init_hook, | |
13558 | }, | |
13559 | [ALC268_ACER_DMIC] = { | |
13560 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, | |
13561 | alc268_beep_mixer }, | |
13562 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13563 | alc268_acer_verbs }, | |
13564 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13565 | .dac_nids = alc268_dac_nids, | |
13566 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13567 | .adc_nids = alc268_adc_nids_alt, | |
13568 | .capsrc_nids = alc268_capsrc_nids, | |
13569 | .hp_nid = 0x02, | |
13570 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13571 | .channel_mode = alc268_modes, | |
13572 | .input_mux = &alc268_acer_dmic_capture_source, | |
13573 | .unsol_event = alc268_acer_unsol_event, | |
13574 | .init_hook = alc268_acer_init_hook, | |
13575 | }, | |
13576 | [ALC268_ACER_ASPIRE_ONE] = { | |
13577 | .mixers = { alc268_acer_aspire_one_mixer, | |
13578 | alc268_beep_mixer, | |
13579 | alc268_capture_nosrc_mixer }, | |
13580 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13581 | alc268_acer_aspire_one_verbs }, | |
13582 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13583 | .dac_nids = alc268_dac_nids, | |
13584 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13585 | .adc_nids = alc268_adc_nids_alt, | |
13586 | .capsrc_nids = alc268_capsrc_nids, | |
13587 | .hp_nid = 0x03, | |
13588 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13589 | .channel_mode = alc268_modes, | |
13590 | .unsol_event = alc268_acer_lc_unsol_event, | |
13591 | .setup = alc268_acer_lc_setup, | |
13592 | .init_hook = alc268_acer_lc_init_hook, | |
13593 | }, | |
13594 | [ALC268_DELL] = { | |
13595 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, | |
13596 | alc268_capture_nosrc_mixer }, | |
13597 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13598 | alc268_dell_verbs }, | |
13599 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13600 | .dac_nids = alc268_dac_nids, | |
13601 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13602 | .adc_nids = alc268_adc_nids_alt, | |
13603 | .capsrc_nids = alc268_capsrc_nids, | |
13604 | .hp_nid = 0x02, | |
13605 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13606 | .channel_mode = alc268_modes, | |
13607 | .unsol_event = alc_sku_unsol_event, | |
13608 | .setup = alc268_dell_setup, | |
13609 | .init_hook = alc_inithook, | |
13610 | }, | |
13611 | [ALC268_ZEPTO] = { | |
13612 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | |
13613 | alc268_beep_mixer }, | |
13614 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13615 | alc268_toshiba_verbs }, | |
13616 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13617 | .dac_nids = alc268_dac_nids, | |
13618 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13619 | .adc_nids = alc268_adc_nids_alt, | |
13620 | .capsrc_nids = alc268_capsrc_nids, | |
13621 | .hp_nid = 0x03, | |
13622 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13623 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13624 | .channel_mode = alc268_modes, | |
13625 | .input_mux = &alc268_capture_source, | |
13626 | .setup = alc268_toshiba_setup, | |
13627 | .init_hook = alc268_toshiba_automute, | |
13628 | }, | |
13629 | #ifdef CONFIG_SND_DEBUG | |
13630 | [ALC268_TEST] = { | |
13631 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, | |
13632 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13633 | alc268_volume_init_verbs }, | |
13634 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13635 | .dac_nids = alc268_dac_nids, | |
13636 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13637 | .adc_nids = alc268_adc_nids_alt, | |
13638 | .capsrc_nids = alc268_capsrc_nids, | |
13639 | .hp_nid = 0x03, | |
13640 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13641 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13642 | .channel_mode = alc268_modes, | |
13643 | .input_mux = &alc268_capture_source, | |
13644 | }, | |
13645 | #endif | |
13646 | }; | |
13647 | ||
13648 | static int patch_alc268(struct hda_codec *codec) | |
13649 | { | |
13650 | struct alc_spec *spec; | |
13651 | int board_config; | |
13652 | int i, has_beep, err; | |
13653 | ||
13654 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
13655 | if (spec == NULL) | |
13656 | return -ENOMEM; | |
13657 | ||
13658 | codec->spec = spec; | |
13659 | ||
13660 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, | |
13661 | alc268_models, | |
13662 | alc268_cfg_tbl); | |
13663 | ||
13664 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) | |
13665 | board_config = snd_hda_check_board_codec_sid_config(codec, | |
13666 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); | |
13667 | ||
13668 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { | |
13669 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
13670 | codec->chip_name); | |
13671 | board_config = ALC268_AUTO; | |
13672 | } | |
13673 | ||
13674 | if (board_config == ALC268_AUTO) { | |
13675 | /* automatic parse from the BIOS config */ | |
13676 | err = alc268_parse_auto_config(codec); | |
13677 | if (err < 0) { | |
13678 | alc_free(codec); | |
13679 | return err; | |
13680 | } else if (!err) { | |
13681 | printk(KERN_INFO | |
13682 | "hda_codec: Cannot set up configuration " | |
13683 | "from BIOS. Using base mode...\n"); | |
13684 | board_config = ALC268_3ST; | |
13685 | } | |
13686 | } | |
13687 | ||
13688 | if (board_config != ALC268_AUTO) | |
13689 | setup_preset(codec, &alc268_presets[board_config]); | |
13690 | ||
13691 | spec->stream_analog_playback = &alc268_pcm_analog_playback; | |
13692 | spec->stream_analog_capture = &alc268_pcm_analog_capture; | |
13693 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; | |
13694 | ||
13695 | spec->stream_digital_playback = &alc268_pcm_digital_playback; | |
13696 | ||
13697 | has_beep = 0; | |
13698 | for (i = 0; i < spec->num_mixers; i++) { | |
13699 | if (spec->mixers[i] == alc268_beep_mixer) { | |
13700 | has_beep = 1; | |
13701 | break; | |
13702 | } | |
13703 | } | |
13704 | ||
13705 | if (has_beep) { | |
13706 | err = snd_hda_attach_beep_device(codec, 0x1); | |
13707 | if (err < 0) { | |
13708 | alc_free(codec); | |
13709 | return err; | |
13710 | } | |
13711 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) | |
13712 | /* override the amp caps for beep generator */ | |
13713 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | |
13714 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | | |
13715 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
13716 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
13717 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
13718 | } | |
13719 | ||
13720 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { | |
13721 | /* check whether NID 0x07 is valid */ | |
13722 | unsigned int wcap = get_wcaps(codec, 0x07); | |
13723 | int i; | |
13724 | ||
13725 | spec->capsrc_nids = alc268_capsrc_nids; | |
13726 | /* get type */ | |
13727 | wcap = get_wcaps_type(wcap); | |
13728 | if (spec->auto_mic || | |
13729 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
13730 | spec->adc_nids = alc268_adc_nids_alt; | |
13731 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | |
13732 | if (spec->auto_mic) | |
13733 | fixup_automic_adc(codec); | |
13734 | if (spec->auto_mic || spec->input_mux->num_items == 1) | |
13735 | add_mixer(spec, alc268_capture_nosrc_mixer); | |
13736 | else | |
13737 | add_mixer(spec, alc268_capture_alt_mixer); | |
13738 | } else { | |
13739 | spec->adc_nids = alc268_adc_nids; | |
13740 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | |
13741 | add_mixer(spec, alc268_capture_mixer); | |
13742 | } | |
13743 | /* set default input source */ | |
13744 | for (i = 0; i < spec->num_adc_nids; i++) | |
13745 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | |
13746 | 0, AC_VERB_SET_CONNECT_SEL, | |
13747 | i < spec->num_mux_defs ? | |
13748 | spec->input_mux[i].items[0].index : | |
13749 | spec->input_mux->items[0].index); | |
13750 | } | |
13751 | ||
13752 | spec->vmaster_nid = 0x02; | |
13753 | ||
13754 | codec->patch_ops = alc_patch_ops; | |
13755 | if (board_config == ALC268_AUTO) | |
13756 | spec->init_hook = alc268_auto_init; | |
13757 | ||
13758 | return 0; | |
13759 | } | |
13760 | ||
13761 | /* | |
13762 | * ALC269 channel source setting (2 channel) | |
13763 | */ | |
13764 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID | |
13765 | ||
13766 | #define alc269_dac_nids alc260_dac_nids | |
13767 | ||
13768 | static hda_nid_t alc269_adc_nids[1] = { | |
13769 | /* ADC1 */ | |
13770 | 0x08, | |
13771 | }; | |
13772 | ||
13773 | static hda_nid_t alc269_capsrc_nids[1] = { | |
13774 | 0x23, | |
13775 | }; | |
13776 | ||
13777 | static hda_nid_t alc269vb_adc_nids[1] = { | |
13778 | /* ADC1 */ | |
13779 | 0x09, | |
13780 | }; | |
13781 | ||
13782 | static hda_nid_t alc269vb_capsrc_nids[1] = { | |
13783 | 0x22, | |
13784 | }; | |
13785 | ||
13786 | static hda_nid_t alc269_adc_candidates[] = { | |
13787 | 0x08, 0x09, 0x07, | |
13788 | }; | |
13789 | ||
13790 | #define alc269_modes alc260_modes | |
13791 | #define alc269_capture_source alc880_lg_lw_capture_source | |
13792 | ||
13793 | static struct snd_kcontrol_new alc269_base_mixer[] = { | |
13794 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13795 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13796 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13797 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13798 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13800 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13801 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
13802 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
13803 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
13804 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13805 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
13806 | { } /* end */ | |
13807 | }; | |
13808 | ||
13809 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { | |
13810 | /* output mixer control */ | |
13811 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13812 | { | |
13813 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13814 | .name = "Master Playback Switch", | |
13815 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
13816 | .info = snd_hda_mixer_amp_switch_info, | |
13817 | .get = snd_hda_mixer_amp_switch_get, | |
13818 | .put = alc268_acer_master_sw_put, | |
13819 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13820 | }, | |
13821 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13822 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13823 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13824 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
13825 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
13826 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
13827 | { } | |
13828 | }; | |
13829 | ||
13830 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { | |
13831 | /* output mixer control */ | |
13832 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13833 | { | |
13834 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13835 | .name = "Master Playback Switch", | |
13836 | .subdevice = HDA_SUBDEV_AMP_FLAG, | |
13837 | .info = snd_hda_mixer_amp_switch_info, | |
13838 | .get = snd_hda_mixer_amp_switch_get, | |
13839 | .put = alc268_acer_master_sw_put, | |
13840 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13841 | }, | |
13842 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13843 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13844 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13845 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
13846 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
13847 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
13848 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
13849 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
13850 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), | |
13851 | { } | |
13852 | }; | |
13853 | ||
13854 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { | |
13855 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13856 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13857 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13858 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13859 | { } /* end */ | |
13860 | }; | |
13861 | ||
13862 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { | |
13863 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13864 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13865 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
13866 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13867 | { } /* end */ | |
13868 | }; | |
13869 | ||
13870 | static struct snd_kcontrol_new alc269_asus_mixer[] = { | |
13871 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13872 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
13873 | { } /* end */ | |
13874 | }; | |
13875 | ||
13876 | /* capture mixer elements */ | |
13877 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { | |
13878 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
13879 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
13880 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13881 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), | |
13882 | { } /* end */ | |
13883 | }; | |
13884 | ||
13885 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { | |
13886 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
13887 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
13888 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13889 | { } /* end */ | |
13890 | }; | |
13891 | ||
13892 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { | |
13893 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
13894 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
13895 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13896 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), | |
13897 | { } /* end */ | |
13898 | }; | |
13899 | ||
13900 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { | |
13901 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
13902 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
13903 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13904 | { } /* end */ | |
13905 | }; | |
13906 | ||
13907 | /* FSC amilo */ | |
13908 | #define alc269_fujitsu_mixer alc269_laptop_mixer | |
13909 | ||
13910 | static struct hda_verb alc269_quanta_fl1_verbs[] = { | |
13911 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13912 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13913 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13914 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13915 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13916 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13917 | { } | |
13918 | }; | |
13919 | ||
13920 | static struct hda_verb alc269_lifebook_verbs[] = { | |
13921 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13922 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13923 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13924 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13925 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13926 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13927 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13928 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13929 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13930 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13931 | { } | |
13932 | }; | |
13933 | ||
13934 | /* toggle speaker-output according to the hp-jack state */ | |
13935 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) | |
13936 | { | |
13937 | unsigned int present; | |
13938 | unsigned char bits; | |
13939 | ||
13940 | present = snd_hda_jack_detect(codec, 0x15); | |
13941 | bits = present ? HDA_AMP_MUTE : 0; | |
13942 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
13943 | HDA_AMP_MUTE, bits); | |
13944 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
13945 | HDA_AMP_MUTE, bits); | |
13946 | ||
13947 | snd_hda_codec_write(codec, 0x20, 0, | |
13948 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
13949 | snd_hda_codec_write(codec, 0x20, 0, | |
13950 | AC_VERB_SET_PROC_COEF, 0x680); | |
13951 | ||
13952 | snd_hda_codec_write(codec, 0x20, 0, | |
13953 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
13954 | snd_hda_codec_write(codec, 0x20, 0, | |
13955 | AC_VERB_SET_PROC_COEF, 0x480); | |
13956 | } | |
13957 | ||
13958 | /* toggle speaker-output according to the hp-jacks state */ | |
13959 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) | |
13960 | { | |
13961 | unsigned int present; | |
13962 | unsigned char bits; | |
13963 | ||
13964 | /* Check laptop headphone socket */ | |
13965 | present = snd_hda_jack_detect(codec, 0x15); | |
13966 | ||
13967 | /* Check port replicator headphone socket */ | |
13968 | present |= snd_hda_jack_detect(codec, 0x1a); | |
13969 | ||
13970 | bits = present ? HDA_AMP_MUTE : 0; | |
13971 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
13972 | HDA_AMP_MUTE, bits); | |
13973 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
13974 | HDA_AMP_MUTE, bits); | |
13975 | ||
13976 | snd_hda_codec_write(codec, 0x20, 0, | |
13977 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
13978 | snd_hda_codec_write(codec, 0x20, 0, | |
13979 | AC_VERB_SET_PROC_COEF, 0x680); | |
13980 | ||
13981 | snd_hda_codec_write(codec, 0x20, 0, | |
13982 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
13983 | snd_hda_codec_write(codec, 0x20, 0, | |
13984 | AC_VERB_SET_PROC_COEF, 0x480); | |
13985 | } | |
13986 | ||
13987 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) | |
13988 | { | |
13989 | unsigned int present_laptop; | |
13990 | unsigned int present_dock; | |
13991 | ||
13992 | present_laptop = snd_hda_jack_detect(codec, 0x18); | |
13993 | present_dock = snd_hda_jack_detect(codec, 0x1b); | |
13994 | ||
13995 | /* Laptop mic port overrides dock mic port, design decision */ | |
13996 | if (present_dock) | |
13997 | snd_hda_codec_write(codec, 0x23, 0, | |
13998 | AC_VERB_SET_CONNECT_SEL, 0x3); | |
13999 | if (present_laptop) | |
14000 | snd_hda_codec_write(codec, 0x23, 0, | |
14001 | AC_VERB_SET_CONNECT_SEL, 0x0); | |
14002 | if (!present_dock && !present_laptop) | |
14003 | snd_hda_codec_write(codec, 0x23, 0, | |
14004 | AC_VERB_SET_CONNECT_SEL, 0x1); | |
14005 | } | |
14006 | ||
14007 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, | |
14008 | unsigned int res) | |
14009 | { | |
14010 | switch (res >> 26) { | |
14011 | case ALC880_HP_EVENT: | |
14012 | alc269_quanta_fl1_speaker_automute(codec); | |
14013 | break; | |
14014 | case ALC880_MIC_EVENT: | |
14015 | alc_mic_automute(codec); | |
14016 | break; | |
14017 | } | |
14018 | } | |
14019 | ||
14020 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, | |
14021 | unsigned int res) | |
14022 | { | |
14023 | if ((res >> 26) == ALC880_HP_EVENT) | |
14024 | alc269_lifebook_speaker_automute(codec); | |
14025 | if ((res >> 26) == ALC880_MIC_EVENT) | |
14026 | alc269_lifebook_mic_autoswitch(codec); | |
14027 | } | |
14028 | ||
14029 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) | |
14030 | { | |
14031 | struct alc_spec *spec = codec->spec; | |
14032 | spec->autocfg.hp_pins[0] = 0x15; | |
14033 | spec->autocfg.speaker_pins[0] = 0x14; | |
14034 | spec->ext_mic.pin = 0x18; | |
14035 | spec->ext_mic.mux_idx = 0; | |
14036 | spec->int_mic.pin = 0x19; | |
14037 | spec->int_mic.mux_idx = 1; | |
14038 | spec->auto_mic = 1; | |
14039 | } | |
14040 | ||
14041 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) | |
14042 | { | |
14043 | alc269_quanta_fl1_speaker_automute(codec); | |
14044 | alc_mic_automute(codec); | |
14045 | } | |
14046 | ||
14047 | static void alc269_lifebook_init_hook(struct hda_codec *codec) | |
14048 | { | |
14049 | alc269_lifebook_speaker_automute(codec); | |
14050 | alc269_lifebook_mic_autoswitch(codec); | |
14051 | } | |
14052 | ||
14053 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { | |
14054 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14055 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, | |
14056 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14057 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14058 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14059 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14060 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14061 | {} | |
14062 | }; | |
14063 | ||
14064 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { | |
14065 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14066 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14067 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14068 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, | |
14069 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14070 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14071 | {} | |
14072 | }; | |
14073 | ||
14074 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { | |
14075 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14076 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
14077 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14078 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14079 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14080 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14081 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14082 | {} | |
14083 | }; | |
14084 | ||
14085 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { | |
14086 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14087 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14088 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14089 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14090 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14091 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14092 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14093 | {} | |
14094 | }; | |
14095 | ||
14096 | static struct hda_verb alc271_acer_dmic_verbs[] = { | |
14097 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, | |
14098 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, | |
14099 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14100 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14101 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14102 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14103 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14104 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14105 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14106 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, | |
14107 | { } | |
14108 | }; | |
14109 | ||
14110 | /* toggle speaker-output according to the hp-jack state */ | |
14111 | static void alc269_speaker_automute(struct hda_codec *codec) | |
14112 | { | |
14113 | struct alc_spec *spec = codec->spec; | |
14114 | unsigned int nid = spec->autocfg.hp_pins[0]; | |
14115 | unsigned int present; | |
14116 | unsigned char bits; | |
14117 | ||
14118 | present = snd_hda_jack_detect(codec, nid); | |
14119 | bits = present ? HDA_AMP_MUTE : 0; | |
14120 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
14121 | HDA_AMP_MUTE, bits); | |
14122 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
14123 | HDA_AMP_MUTE, bits); | |
14124 | } | |
14125 | ||
14126 | /* unsolicited event for HP jack sensing */ | |
14127 | static void alc269_laptop_unsol_event(struct hda_codec *codec, | |
14128 | unsigned int res) | |
14129 | { | |
14130 | switch (res >> 26) { | |
14131 | case ALC880_HP_EVENT: | |
14132 | alc269_speaker_automute(codec); | |
14133 | break; | |
14134 | case ALC880_MIC_EVENT: | |
14135 | alc_mic_automute(codec); | |
14136 | break; | |
14137 | } | |
14138 | } | |
14139 | ||
14140 | static void alc269_laptop_amic_setup(struct hda_codec *codec) | |
14141 | { | |
14142 | struct alc_spec *spec = codec->spec; | |
14143 | spec->autocfg.hp_pins[0] = 0x15; | |
14144 | spec->autocfg.speaker_pins[0] = 0x14; | |
14145 | spec->ext_mic.pin = 0x18; | |
14146 | spec->ext_mic.mux_idx = 0; | |
14147 | spec->int_mic.pin = 0x19; | |
14148 | spec->int_mic.mux_idx = 1; | |
14149 | spec->auto_mic = 1; | |
14150 | } | |
14151 | ||
14152 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) | |
14153 | { | |
14154 | struct alc_spec *spec = codec->spec; | |
14155 | spec->autocfg.hp_pins[0] = 0x15; | |
14156 | spec->autocfg.speaker_pins[0] = 0x14; | |
14157 | spec->ext_mic.pin = 0x18; | |
14158 | spec->ext_mic.mux_idx = 0; | |
14159 | spec->int_mic.pin = 0x12; | |
14160 | spec->int_mic.mux_idx = 5; | |
14161 | spec->auto_mic = 1; | |
14162 | } | |
14163 | ||
14164 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) | |
14165 | { | |
14166 | struct alc_spec *spec = codec->spec; | |
14167 | spec->autocfg.hp_pins[0] = 0x21; | |
14168 | spec->autocfg.speaker_pins[0] = 0x14; | |
14169 | spec->ext_mic.pin = 0x18; | |
14170 | spec->ext_mic.mux_idx = 0; | |
14171 | spec->int_mic.pin = 0x19; | |
14172 | spec->int_mic.mux_idx = 1; | |
14173 | spec->auto_mic = 1; | |
14174 | } | |
14175 | ||
14176 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | |
14177 | { | |
14178 | struct alc_spec *spec = codec->spec; | |
14179 | spec->autocfg.hp_pins[0] = 0x21; | |
14180 | spec->autocfg.speaker_pins[0] = 0x14; | |
14181 | spec->ext_mic.pin = 0x18; | |
14182 | spec->ext_mic.mux_idx = 0; | |
14183 | spec->int_mic.pin = 0x12; | |
14184 | spec->int_mic.mux_idx = 6; | |
14185 | spec->auto_mic = 1; | |
14186 | } | |
14187 | ||
14188 | static void alc269_laptop_inithook(struct hda_codec *codec) | |
14189 | { | |
14190 | alc269_speaker_automute(codec); | |
14191 | alc_mic_automute(codec); | |
14192 | } | |
14193 | ||
14194 | /* | |
14195 | * generic initialization of ADC, input mixers and output mixers | |
14196 | */ | |
14197 | static struct hda_verb alc269_init_verbs[] = { | |
14198 | /* | |
14199 | * Unmute ADC0 and set the default input to mic-in | |
14200 | */ | |
14201 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14202 | ||
14203 | /* | |
14204 | * Set up output mixers (0x02 - 0x03) | |
14205 | */ | |
14206 | /* set vol=0 to output mixers */ | |
14207 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14208 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14209 | ||
14210 | /* set up input amps for analog loopback */ | |
14211 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
14212 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14213 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14214 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14215 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14216 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14217 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14218 | ||
14219 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14220 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14221 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14222 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14223 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14224 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14225 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14226 | ||
14227 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14228 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14229 | ||
14230 | /* FIXME: use Mux-type input source selection */ | |
14231 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | |
14232 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
14233 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14234 | ||
14235 | /* set EAPD */ | |
14236 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
14237 | { } | |
14238 | }; | |
14239 | ||
14240 | static struct hda_verb alc269vb_init_verbs[] = { | |
14241 | /* | |
14242 | * Unmute ADC0 and set the default input to mic-in | |
14243 | */ | |
14244 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14245 | ||
14246 | /* | |
14247 | * Set up output mixers (0x02 - 0x03) | |
14248 | */ | |
14249 | /* set vol=0 to output mixers */ | |
14250 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14251 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14252 | ||
14253 | /* set up input amps for analog loopback */ | |
14254 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
14255 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14256 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14257 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14258 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14259 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14260 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14261 | ||
14262 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14263 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14264 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14265 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14266 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14267 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14268 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14269 | ||
14270 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14271 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14272 | ||
14273 | /* FIXME: use Mux-type input source selection */ | |
14274 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | |
14275 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
14276 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14277 | ||
14278 | /* set EAPD */ | |
14279 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
14280 | { } | |
14281 | }; | |
14282 | ||
14283 | #define alc269_auto_create_multi_out_ctls \ | |
14284 | alc268_auto_create_multi_out_ctls | |
14285 | #define alc269_auto_create_input_ctls \ | |
14286 | alc268_auto_create_input_ctls | |
14287 | ||
14288 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
14289 | #define alc269_loopbacks alc880_loopbacks | |
14290 | #endif | |
14291 | ||
14292 | /* pcm configuration: identical with ALC880 */ | |
14293 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback | |
14294 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture | |
14295 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback | |
14296 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture | |
14297 | ||
14298 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { | |
14299 | .substreams = 1, | |
14300 | .channels_min = 2, | |
14301 | .channels_max = 8, | |
14302 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
14303 | /* NID is set in alc_build_pcms */ | |
14304 | .ops = { | |
14305 | .open = alc880_playback_pcm_open, | |
14306 | .prepare = alc880_playback_pcm_prepare, | |
14307 | .cleanup = alc880_playback_pcm_cleanup | |
14308 | }, | |
14309 | }; | |
14310 | ||
14311 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { | |
14312 | .substreams = 1, | |
14313 | .channels_min = 2, | |
14314 | .channels_max = 2, | |
14315 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
14316 | /* NID is set in alc_build_pcms */ | |
14317 | }; | |
14318 | ||
14319 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
14320 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) | |
14321 | { | |
14322 | switch (codec->subsystem_id) { | |
14323 | case 0x103c1586: | |
14324 | return 1; | |
14325 | } | |
14326 | return 0; | |
14327 | } | |
14328 | ||
14329 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) | |
14330 | { | |
14331 | /* update mute-LED according to the speaker mute state */ | |
14332 | if (nid == 0x01 || nid == 0x14) { | |
14333 | int pinval; | |
14334 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & | |
14335 | HDA_AMP_MUTE) | |
14336 | pinval = 0x24; | |
14337 | else | |
14338 | pinval = 0x20; | |
14339 | /* mic2 vref pin is used for mute LED control */ | |
14340 | snd_hda_codec_update_cache(codec, 0x19, 0, | |
14341 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
14342 | pinval); | |
14343 | } | |
14344 | return alc_check_power_status(codec, nid); | |
14345 | } | |
14346 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ | |
14347 | ||
14348 | static int alc275_setup_dual_adc(struct hda_codec *codec) | |
14349 | { | |
14350 | struct alc_spec *spec = codec->spec; | |
14351 | ||
14352 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) | |
14353 | return 0; | |
14354 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || | |
14355 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { | |
14356 | if (spec->ext_mic.pin <= 0x12) { | |
14357 | spec->private_adc_nids[0] = 0x08; | |
14358 | spec->private_adc_nids[1] = 0x11; | |
14359 | spec->private_capsrc_nids[0] = 0x23; | |
14360 | spec->private_capsrc_nids[1] = 0x22; | |
14361 | } else { | |
14362 | spec->private_adc_nids[0] = 0x11; | |
14363 | spec->private_adc_nids[1] = 0x08; | |
14364 | spec->private_capsrc_nids[0] = 0x22; | |
14365 | spec->private_capsrc_nids[1] = 0x23; | |
14366 | } | |
14367 | spec->adc_nids = spec->private_adc_nids; | |
14368 | spec->capsrc_nids = spec->private_capsrc_nids; | |
14369 | spec->num_adc_nids = 2; | |
14370 | spec->dual_adc_switch = 1; | |
14371 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", | |
14372 | spec->adc_nids[0], spec->adc_nids[1]); | |
14373 | return 1; | |
14374 | } | |
14375 | return 0; | |
14376 | } | |
14377 | ||
14378 | /* | |
14379 | * BIOS auto configuration | |
14380 | */ | |
14381 | static int alc269_parse_auto_config(struct hda_codec *codec) | |
14382 | { | |
14383 | struct alc_spec *spec = codec->spec; | |
14384 | int err; | |
14385 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; | |
14386 | ||
14387 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
14388 | alc269_ignore); | |
14389 | if (err < 0) | |
14390 | return err; | |
14391 | ||
14392 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
14393 | if (err < 0) | |
14394 | return err; | |
14395 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); | |
14396 | if (err < 0) | |
14397 | return err; | |
14398 | ||
14399 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
14400 | ||
14401 | alc_auto_parse_digital(codec); | |
14402 | ||
14403 | if (spec->kctls.list) | |
14404 | add_mixer(spec, spec->kctls.list); | |
14405 | ||
14406 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { | |
14407 | add_verb(spec, alc269vb_init_verbs); | |
14408 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); | |
14409 | } else { | |
14410 | add_verb(spec, alc269_init_verbs); | |
14411 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
14412 | } | |
14413 | ||
14414 | spec->num_mux_defs = 1; | |
14415 | spec->input_mux = &spec->private_imux[0]; | |
14416 | ||
14417 | if (!alc275_setup_dual_adc(codec)) | |
14418 | fillup_priv_adc_nids(codec, alc269_adc_candidates, | |
14419 | sizeof(alc269_adc_candidates)); | |
14420 | ||
14421 | /* set default input source */ | |
14422 | if (!spec->dual_adc_switch) | |
14423 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], | |
14424 | spec->input_mux->items[0].index); | |
14425 | ||
14426 | err = alc_auto_add_mic_boost(codec); | |
14427 | if (err < 0) | |
14428 | return err; | |
14429 | ||
14430 | if (!spec->cap_mixer && !spec->no_analog) | |
14431 | set_capture_mixer(codec); | |
14432 | ||
14433 | return 1; | |
14434 | } | |
14435 | ||
14436 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out | |
14437 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out | |
14438 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input | |
14439 | ||
14440 | ||
14441 | /* init callback for auto-configuration model -- overriding the default init */ | |
14442 | static void alc269_auto_init(struct hda_codec *codec) | |
14443 | { | |
14444 | struct alc_spec *spec = codec->spec; | |
14445 | alc269_auto_init_multi_out(codec); | |
14446 | alc269_auto_init_hp_out(codec); | |
14447 | alc269_auto_init_analog_input(codec); | |
14448 | alc_auto_init_digital(codec); | |
14449 | if (spec->unsol_event) | |
14450 | alc_inithook(codec); | |
14451 | } | |
14452 | ||
14453 | enum { | |
14454 | ALC269_FIXUP_SONY_VAIO, | |
14455 | }; | |
14456 | ||
14457 | static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = { | |
14458 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, | |
14459 | {} | |
14460 | }; | |
14461 | ||
14462 | static const struct alc_fixup alc269_fixups[] = { | |
14463 | [ALC269_FIXUP_SONY_VAIO] = { | |
14464 | .verbs = alc269_sony_vaio_fixup_verbs | |
14465 | }, | |
14466 | }; | |
14467 | ||
14468 | static struct snd_pci_quirk alc269_fixup_tbl[] = { | |
14469 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | |
14470 | SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | |
14471 | {} | |
14472 | }; | |
14473 | ||
14474 | ||
14475 | /* | |
14476 | * configuration and preset | |
14477 | */ | |
14478 | static const char *alc269_models[ALC269_MODEL_LAST] = { | |
14479 | [ALC269_BASIC] = "basic", | |
14480 | [ALC269_QUANTA_FL1] = "quanta", | |
14481 | [ALC269_AMIC] = "laptop-amic", | |
14482 | [ALC269_DMIC] = "laptop-dmic", | |
14483 | [ALC269_FUJITSU] = "fujitsu", | |
14484 | [ALC269_LIFEBOOK] = "lifebook", | |
14485 | [ALC269_AUTO] = "auto", | |
14486 | }; | |
14487 | ||
14488 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | |
14489 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), | |
14490 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), | |
14491 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", | |
14492 | ALC269_AMIC), | |
14493 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), | |
14494 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), | |
14495 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), | |
14496 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), | |
14497 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), | |
14498 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), | |
14499 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), | |
14500 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), | |
14501 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), | |
14502 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), | |
14503 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), | |
14504 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), | |
14505 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), | |
14506 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), | |
14507 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), | |
14508 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), | |
14509 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), | |
14510 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), | |
14511 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), | |
14512 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), | |
14513 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), | |
14514 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), | |
14515 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), | |
14516 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), | |
14517 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), | |
14518 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), | |
14519 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), | |
14520 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), | |
14521 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), | |
14522 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), | |
14523 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), | |
14524 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), | |
14525 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), | |
14526 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), | |
14527 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), | |
14528 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), | |
14529 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", | |
14530 | ALC269_DMIC), | |
14531 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", | |
14532 | ALC269_DMIC), | |
14533 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), | |
14534 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), | |
14535 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), | |
14536 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), | |
14537 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), | |
14538 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), | |
14539 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), | |
14540 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), | |
14541 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), | |
14542 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), | |
14543 | {} | |
14544 | }; | |
14545 | ||
14546 | static struct alc_config_preset alc269_presets[] = { | |
14547 | [ALC269_BASIC] = { | |
14548 | .mixers = { alc269_base_mixer }, | |
14549 | .init_verbs = { alc269_init_verbs }, | |
14550 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14551 | .dac_nids = alc269_dac_nids, | |
14552 | .hp_nid = 0x03, | |
14553 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14554 | .channel_mode = alc269_modes, | |
14555 | .input_mux = &alc269_capture_source, | |
14556 | }, | |
14557 | [ALC269_QUANTA_FL1] = { | |
14558 | .mixers = { alc269_quanta_fl1_mixer }, | |
14559 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, | |
14560 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14561 | .dac_nids = alc269_dac_nids, | |
14562 | .hp_nid = 0x03, | |
14563 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14564 | .channel_mode = alc269_modes, | |
14565 | .input_mux = &alc269_capture_source, | |
14566 | .unsol_event = alc269_quanta_fl1_unsol_event, | |
14567 | .setup = alc269_quanta_fl1_setup, | |
14568 | .init_hook = alc269_quanta_fl1_init_hook, | |
14569 | }, | |
14570 | [ALC269_AMIC] = { | |
14571 | .mixers = { alc269_laptop_mixer }, | |
14572 | .cap_mixer = alc269_laptop_analog_capture_mixer, | |
14573 | .init_verbs = { alc269_init_verbs, | |
14574 | alc269_laptop_amic_init_verbs }, | |
14575 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14576 | .dac_nids = alc269_dac_nids, | |
14577 | .hp_nid = 0x03, | |
14578 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14579 | .channel_mode = alc269_modes, | |
14580 | .unsol_event = alc269_laptop_unsol_event, | |
14581 | .setup = alc269_laptop_amic_setup, | |
14582 | .init_hook = alc269_laptop_inithook, | |
14583 | }, | |
14584 | [ALC269_DMIC] = { | |
14585 | .mixers = { alc269_laptop_mixer }, | |
14586 | .cap_mixer = alc269_laptop_digital_capture_mixer, | |
14587 | .init_verbs = { alc269_init_verbs, | |
14588 | alc269_laptop_dmic_init_verbs }, | |
14589 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14590 | .dac_nids = alc269_dac_nids, | |
14591 | .hp_nid = 0x03, | |
14592 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14593 | .channel_mode = alc269_modes, | |
14594 | .unsol_event = alc269_laptop_unsol_event, | |
14595 | .setup = alc269_laptop_dmic_setup, | |
14596 | .init_hook = alc269_laptop_inithook, | |
14597 | }, | |
14598 | [ALC269VB_AMIC] = { | |
14599 | .mixers = { alc269vb_laptop_mixer }, | |
14600 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, | |
14601 | .init_verbs = { alc269vb_init_verbs, | |
14602 | alc269vb_laptop_amic_init_verbs }, | |
14603 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14604 | .dac_nids = alc269_dac_nids, | |
14605 | .hp_nid = 0x03, | |
14606 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14607 | .channel_mode = alc269_modes, | |
14608 | .unsol_event = alc269_laptop_unsol_event, | |
14609 | .setup = alc269vb_laptop_amic_setup, | |
14610 | .init_hook = alc269_laptop_inithook, | |
14611 | }, | |
14612 | [ALC269VB_DMIC] = { | |
14613 | .mixers = { alc269vb_laptop_mixer }, | |
14614 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | |
14615 | .init_verbs = { alc269vb_init_verbs, | |
14616 | alc269vb_laptop_dmic_init_verbs }, | |
14617 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14618 | .dac_nids = alc269_dac_nids, | |
14619 | .hp_nid = 0x03, | |
14620 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14621 | .channel_mode = alc269_modes, | |
14622 | .unsol_event = alc269_laptop_unsol_event, | |
14623 | .setup = alc269vb_laptop_dmic_setup, | |
14624 | .init_hook = alc269_laptop_inithook, | |
14625 | }, | |
14626 | [ALC269_FUJITSU] = { | |
14627 | .mixers = { alc269_fujitsu_mixer }, | |
14628 | .cap_mixer = alc269_laptop_digital_capture_mixer, | |
14629 | .init_verbs = { alc269_init_verbs, | |
14630 | alc269_laptop_dmic_init_verbs }, | |
14631 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14632 | .dac_nids = alc269_dac_nids, | |
14633 | .hp_nid = 0x03, | |
14634 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14635 | .channel_mode = alc269_modes, | |
14636 | .unsol_event = alc269_laptop_unsol_event, | |
14637 | .setup = alc269_laptop_dmic_setup, | |
14638 | .init_hook = alc269_laptop_inithook, | |
14639 | }, | |
14640 | [ALC269_LIFEBOOK] = { | |
14641 | .mixers = { alc269_lifebook_mixer }, | |
14642 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, | |
14643 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14644 | .dac_nids = alc269_dac_nids, | |
14645 | .hp_nid = 0x03, | |
14646 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14647 | .channel_mode = alc269_modes, | |
14648 | .input_mux = &alc269_capture_source, | |
14649 | .unsol_event = alc269_lifebook_unsol_event, | |
14650 | .init_hook = alc269_lifebook_init_hook, | |
14651 | }, | |
14652 | [ALC271_ACER] = { | |
14653 | .mixers = { alc269_asus_mixer }, | |
14654 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | |
14655 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, | |
14656 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14657 | .dac_nids = alc269_dac_nids, | |
14658 | .adc_nids = alc262_dmic_adc_nids, | |
14659 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), | |
14660 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
14661 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14662 | .channel_mode = alc269_modes, | |
14663 | .input_mux = &alc269_capture_source, | |
14664 | .dig_out_nid = ALC880_DIGOUT_NID, | |
14665 | .unsol_event = alc_sku_unsol_event, | |
14666 | .setup = alc269vb_laptop_dmic_setup, | |
14667 | .init_hook = alc_inithook, | |
14668 | }, | |
14669 | }; | |
14670 | ||
14671 | static int patch_alc269(struct hda_codec *codec) | |
14672 | { | |
14673 | struct alc_spec *spec; | |
14674 | int board_config; | |
14675 | int err; | |
14676 | int is_alc269vb = 0; | |
14677 | ||
14678 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
14679 | if (spec == NULL) | |
14680 | return -ENOMEM; | |
14681 | ||
14682 | codec->spec = spec; | |
14683 | ||
14684 | alc_auto_parse_customize_define(codec); | |
14685 | ||
14686 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ | |
14687 | if (codec->bus->pci->subsystem_vendor == 0x1025 && | |
14688 | spec->cdefine.platform_type == 1) | |
14689 | alc_codec_rename(codec, "ALC271X"); | |
14690 | else | |
14691 | alc_codec_rename(codec, "ALC259"); | |
14692 | is_alc269vb = 1; | |
14693 | } else | |
14694 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | |
14695 | ||
14696 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, | |
14697 | alc269_models, | |
14698 | alc269_cfg_tbl); | |
14699 | ||
14700 | if (board_config < 0) { | |
14701 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
14702 | codec->chip_name); | |
14703 | board_config = ALC269_AUTO; | |
14704 | } | |
14705 | ||
14706 | if (board_config == ALC269_AUTO) | |
14707 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); | |
14708 | ||
14709 | if (board_config == ALC269_AUTO) { | |
14710 | /* automatic parse from the BIOS config */ | |
14711 | err = alc269_parse_auto_config(codec); | |
14712 | if (err < 0) { | |
14713 | alc_free(codec); | |
14714 | return err; | |
14715 | } else if (!err) { | |
14716 | printk(KERN_INFO | |
14717 | "hda_codec: Cannot set up configuration " | |
14718 | "from BIOS. Using base mode...\n"); | |
14719 | board_config = ALC269_BASIC; | |
14720 | } | |
14721 | } | |
14722 | ||
14723 | if (has_cdefine_beep(codec)) { | |
14724 | err = snd_hda_attach_beep_device(codec, 0x1); | |
14725 | if (err < 0) { | |
14726 | alc_free(codec); | |
14727 | return err; | |
14728 | } | |
14729 | } | |
14730 | ||
14731 | if (board_config != ALC269_AUTO) | |
14732 | setup_preset(codec, &alc269_presets[board_config]); | |
14733 | ||
14734 | if (board_config == ALC269_QUANTA_FL1) { | |
14735 | /* Due to a hardware problem on Lenovo Ideadpad, we need to | |
14736 | * fix the sample rate of analog I/O to 44.1kHz | |
14737 | */ | |
14738 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; | |
14739 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; | |
14740 | } else if (spec->dual_adc_switch) { | |
14741 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
14742 | /* switch ADC dynamically */ | |
14743 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; | |
14744 | } else { | |
14745 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
14746 | spec->stream_analog_capture = &alc269_pcm_analog_capture; | |
14747 | } | |
14748 | spec->stream_digital_playback = &alc269_pcm_digital_playback; | |
14749 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | |
14750 | ||
14751 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ | |
14752 | if (!is_alc269vb) { | |
14753 | spec->adc_nids = alc269_adc_nids; | |
14754 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | |
14755 | spec->capsrc_nids = alc269_capsrc_nids; | |
14756 | } else { | |
14757 | spec->adc_nids = alc269vb_adc_nids; | |
14758 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); | |
14759 | spec->capsrc_nids = alc269vb_capsrc_nids; | |
14760 | } | |
14761 | } | |
14762 | ||
14763 | if (!spec->cap_mixer) | |
14764 | set_capture_mixer(codec); | |
14765 | if (has_cdefine_beep(codec)) | |
14766 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | |
14767 | ||
14768 | if (board_config == ALC269_AUTO) | |
14769 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); | |
14770 | ||
14771 | spec->vmaster_nid = 0x02; | |
14772 | ||
14773 | codec->patch_ops = alc_patch_ops; | |
14774 | if (board_config == ALC269_AUTO) | |
14775 | spec->init_hook = alc269_auto_init; | |
14776 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
14777 | if (!spec->loopback.amplist) | |
14778 | spec->loopback.amplist = alc269_loopbacks; | |
14779 | if (alc269_mic2_for_mute_led(codec)) | |
14780 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; | |
14781 | #endif | |
14782 | ||
14783 | return 0; | |
14784 | } | |
14785 | ||
14786 | /* | |
14787 | * ALC861 channel source setting (2/6 channel selection for 3-stack) | |
14788 | */ | |
14789 | ||
14790 | /* | |
14791 | * set the path ways for 2 channel output | |
14792 | * need to set the codec line out and mic 1 pin widgets to inputs | |
14793 | */ | |
14794 | static struct hda_verb alc861_threestack_ch2_init[] = { | |
14795 | /* set pin widget 1Ah (line in) for input */ | |
14796 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
14797 | /* set pin widget 18h (mic1/2) for input, for mic also enable | |
14798 | * the vref | |
14799 | */ | |
14800 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14801 | ||
14802 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
14803 | #if 0 | |
14804 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
14805 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
14806 | #endif | |
14807 | { } /* end */ | |
14808 | }; | |
14809 | /* | |
14810 | * 6ch mode | |
14811 | * need to set the codec line out and mic 1 pin widgets to outputs | |
14812 | */ | |
14813 | static struct hda_verb alc861_threestack_ch6_init[] = { | |
14814 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
14815 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14816 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
14817 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14818 | ||
14819 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14820 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14821 | ||
14822 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
14823 | #if 0 | |
14824 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
14825 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
14826 | #endif | |
14827 | { } /* end */ | |
14828 | }; | |
14829 | ||
14830 | static struct hda_channel_mode alc861_threestack_modes[2] = { | |
14831 | { 2, alc861_threestack_ch2_init }, | |
14832 | { 6, alc861_threestack_ch6_init }, | |
14833 | }; | |
14834 | /* Set mic1 as input and unmute the mixer */ | |
14835 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { | |
14836 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14837 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
14838 | { } /* end */ | |
14839 | }; | |
14840 | /* Set mic1 as output and mute mixer */ | |
14841 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { | |
14842 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14843 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
14844 | { } /* end */ | |
14845 | }; | |
14846 | ||
14847 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { | |
14848 | { 2, alc861_uniwill_m31_ch2_init }, | |
14849 | { 4, alc861_uniwill_m31_ch4_init }, | |
14850 | }; | |
14851 | ||
14852 | /* Set mic1 and line-in as input and unmute the mixer */ | |
14853 | static struct hda_verb alc861_asus_ch2_init[] = { | |
14854 | /* set pin widget 1Ah (line in) for input */ | |
14855 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
14856 | /* set pin widget 18h (mic1/2) for input, for mic also enable | |
14857 | * the vref | |
14858 | */ | |
14859 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14860 | ||
14861 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
14862 | #if 0 | |
14863 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
14864 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
14865 | #endif | |
14866 | { } /* end */ | |
14867 | }; | |
14868 | /* Set mic1 nad line-in as output and mute mixer */ | |
14869 | static struct hda_verb alc861_asus_ch6_init[] = { | |
14870 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
14871 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14872 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
14873 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
14874 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14875 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
14876 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14877 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14878 | ||
14879 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
14880 | #if 0 | |
14881 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
14882 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
14883 | #endif | |
14884 | { } /* end */ | |
14885 | }; | |
14886 | ||
14887 | static struct hda_channel_mode alc861_asus_modes[2] = { | |
14888 | { 2, alc861_asus_ch2_init }, | |
14889 | { 6, alc861_asus_ch6_init }, | |
14890 | }; | |
14891 | ||
14892 | /* patch-ALC861 */ | |
14893 | ||
14894 | static struct snd_kcontrol_new alc861_base_mixer[] = { | |
14895 | /* output mixer control */ | |
14896 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
14897 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
14898 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
14899 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
14900 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
14901 | ||
14902 | /*Input mixer control */ | |
14903 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
14904 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
14905 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
14906 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
14907 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
14908 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
14909 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
14910 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
14911 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
14912 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
14913 | ||
14914 | { } /* end */ | |
14915 | }; | |
14916 | ||
14917 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { | |
14918 | /* output mixer control */ | |
14919 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
14920 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
14921 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
14922 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
14923 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
14924 | ||
14925 | /* Input mixer control */ | |
14926 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
14927 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
14928 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
14929 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
14930 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
14931 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
14932 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
14933 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
14934 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
14935 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
14936 | ||
14937 | { | |
14938 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14939 | .name = "Channel Mode", | |
14940 | .info = alc_ch_mode_info, | |
14941 | .get = alc_ch_mode_get, | |
14942 | .put = alc_ch_mode_put, | |
14943 | .private_value = ARRAY_SIZE(alc861_threestack_modes), | |
14944 | }, | |
14945 | { } /* end */ | |
14946 | }; | |
14947 | ||
14948 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { | |
14949 | /* output mixer control */ | |
14950 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
14951 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
14952 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
14953 | ||
14954 | { } /* end */ | |
14955 | }; | |
14956 | ||
14957 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { | |
14958 | /* output mixer control */ | |
14959 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
14960 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
14961 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
14962 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
14963 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
14964 | ||
14965 | /* Input mixer control */ | |
14966 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
14967 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
14968 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
14969 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
14970 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
14971 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
14972 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
14973 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
14974 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
14975 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
14976 | ||
14977 | { | |
14978 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14979 | .name = "Channel Mode", | |
14980 | .info = alc_ch_mode_info, | |
14981 | .get = alc_ch_mode_get, | |
14982 | .put = alc_ch_mode_put, | |
14983 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
14984 | }, | |
14985 | { } /* end */ | |
14986 | }; | |
14987 | ||
14988 | static struct snd_kcontrol_new alc861_asus_mixer[] = { | |
14989 | /* output mixer control */ | |
14990 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
14991 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
14992 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
14993 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
14994 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
14995 | ||
14996 | /* Input mixer control */ | |
14997 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
14998 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
14999 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15000 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15001 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15002 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15003 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15004 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15005 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
15006 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), | |
15007 | ||
15008 | { | |
15009 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15010 | .name = "Channel Mode", | |
15011 | .info = alc_ch_mode_info, | |
15012 | .get = alc_ch_mode_get, | |
15013 | .put = alc_ch_mode_put, | |
15014 | .private_value = ARRAY_SIZE(alc861_asus_modes), | |
15015 | }, | |
15016 | { } | |
15017 | }; | |
15018 | ||
15019 | /* additional mixer */ | |
15020 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { | |
15021 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15022 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15023 | { } | |
15024 | }; | |
15025 | ||
15026 | /* | |
15027 | * generic initialization of ADC, input mixers and output mixers | |
15028 | */ | |
15029 | static struct hda_verb alc861_base_init_verbs[] = { | |
15030 | /* | |
15031 | * Unmute ADC0 and set the default input to mic-in | |
15032 | */ | |
15033 | /* port-A for surround (rear panel) */ | |
15034 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15035 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15036 | /* port-B for mic-in (rear panel) with vref */ | |
15037 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15038 | /* port-C for line-in (rear panel) */ | |
15039 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15040 | /* port-D for Front */ | |
15041 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15042 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15043 | /* port-E for HP out (front panel) */ | |
15044 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
15045 | /* route front PCM to HP */ | |
15046 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15047 | /* port-F for mic-in (front panel) with vref */ | |
15048 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15049 | /* port-G for CLFE (rear panel) */ | |
15050 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15051 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15052 | /* port-H for side (rear panel) */ | |
15053 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15054 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15055 | /* CD-in */ | |
15056 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15057 | /* route front mic to ADC1*/ | |
15058 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15059 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15060 | ||
15061 | /* Unmute DAC0~3 & spdif out*/ | |
15062 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15063 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15064 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15065 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15066 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15067 | ||
15068 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15069 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15070 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15071 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15072 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15073 | ||
15074 | /* Unmute Stereo Mixer 15 */ | |
15075 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15076 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15077 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15078 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | |
15079 | ||
15080 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15081 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15082 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15083 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15084 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15085 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15086 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15087 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15088 | /* hp used DAC 3 (Front) */ | |
15089 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
15090 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15091 | ||
15092 | { } | |
15093 | }; | |
15094 | ||
15095 | static struct hda_verb alc861_threestack_init_verbs[] = { | |
15096 | /* | |
15097 | * Unmute ADC0 and set the default input to mic-in | |
15098 | */ | |
15099 | /* port-A for surround (rear panel) */ | |
15100 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15101 | /* port-B for mic-in (rear panel) with vref */ | |
15102 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15103 | /* port-C for line-in (rear panel) */ | |
15104 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15105 | /* port-D for Front */ | |
15106 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15107 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15108 | /* port-E for HP out (front panel) */ | |
15109 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
15110 | /* route front PCM to HP */ | |
15111 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15112 | /* port-F for mic-in (front panel) with vref */ | |
15113 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15114 | /* port-G for CLFE (rear panel) */ | |
15115 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15116 | /* port-H for side (rear panel) */ | |
15117 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15118 | /* CD-in */ | |
15119 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15120 | /* route front mic to ADC1*/ | |
15121 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15122 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15123 | /* Unmute DAC0~3 & spdif out*/ | |
15124 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15125 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15126 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15127 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15129 | ||
15130 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15131 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15132 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15133 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15134 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15135 | ||
15136 | /* Unmute Stereo Mixer 15 */ | |
15137 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15138 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15139 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15140 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | |
15141 | ||
15142 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15143 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15144 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15145 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15146 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15147 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15148 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15149 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15150 | /* hp used DAC 3 (Front) */ | |
15151 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
15152 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15153 | { } | |
15154 | }; | |
15155 | ||
15156 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | |
15157 | /* | |
15158 | * Unmute ADC0 and set the default input to mic-in | |
15159 | */ | |
15160 | /* port-A for surround (rear panel) */ | |
15161 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15162 | /* port-B for mic-in (rear panel) with vref */ | |
15163 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15164 | /* port-C for line-in (rear panel) */ | |
15165 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15166 | /* port-D for Front */ | |
15167 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15168 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15169 | /* port-E for HP out (front panel) */ | |
15170 | /* this has to be set to VREF80 */ | |
15171 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15172 | /* route front PCM to HP */ | |
15173 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15174 | /* port-F for mic-in (front panel) with vref */ | |
15175 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15176 | /* port-G for CLFE (rear panel) */ | |
15177 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15178 | /* port-H for side (rear panel) */ | |
15179 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15180 | /* CD-in */ | |
15181 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15182 | /* route front mic to ADC1*/ | |
15183 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15184 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15185 | /* Unmute DAC0~3 & spdif out*/ | |
15186 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15187 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15188 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15189 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15190 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15191 | ||
15192 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15193 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15194 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15195 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15196 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15197 | ||
15198 | /* Unmute Stereo Mixer 15 */ | |
15199 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15200 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15201 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15202 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | |
15203 | ||
15204 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15205 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15206 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15207 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15208 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15209 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15210 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15211 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15212 | /* hp used DAC 3 (Front) */ | |
15213 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
15214 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15215 | { } | |
15216 | }; | |
15217 | ||
15218 | static struct hda_verb alc861_asus_init_verbs[] = { | |
15219 | /* | |
15220 | * Unmute ADC0 and set the default input to mic-in | |
15221 | */ | |
15222 | /* port-A for surround (rear panel) | |
15223 | * according to codec#0 this is the HP jack | |
15224 | */ | |
15225 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ | |
15226 | /* route front PCM to HP */ | |
15227 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
15228 | /* port-B for mic-in (rear panel) with vref */ | |
15229 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15230 | /* port-C for line-in (rear panel) */ | |
15231 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15232 | /* port-D for Front */ | |
15233 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15234 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15235 | /* port-E for HP out (front panel) */ | |
15236 | /* this has to be set to VREF80 */ | |
15237 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15238 | /* route front PCM to HP */ | |
15239 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15240 | /* port-F for mic-in (front panel) with vref */ | |
15241 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15242 | /* port-G for CLFE (rear panel) */ | |
15243 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15244 | /* port-H for side (rear panel) */ | |
15245 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15246 | /* CD-in */ | |
15247 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15248 | /* route front mic to ADC1*/ | |
15249 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15250 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15251 | /* Unmute DAC0~3 & spdif out*/ | |
15252 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15253 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15254 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15255 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15256 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15257 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15258 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15259 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15260 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15261 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15262 | ||
15263 | /* Unmute Stereo Mixer 15 */ | |
15264 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15265 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15266 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15267 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | |
15268 | ||
15269 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15270 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15271 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15272 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15273 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15274 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15275 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15276 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15277 | /* hp used DAC 3 (Front) */ | |
15278 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
15279 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15280 | { } | |
15281 | }; | |
15282 | ||
15283 | /* additional init verbs for ASUS laptops */ | |
15284 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { | |
15285 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ | |
15286 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ | |
15287 | { } | |
15288 | }; | |
15289 | ||
15290 | /* | |
15291 | * generic initialization of ADC, input mixers and output mixers | |
15292 | */ | |
15293 | static struct hda_verb alc861_auto_init_verbs[] = { | |
15294 | /* | |
15295 | * Unmute ADC0 and set the default input to mic-in | |
15296 | */ | |
15297 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ | |
15298 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15299 | ||
15300 | /* Unmute DAC0~3 & spdif out*/ | |
15301 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15302 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15303 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15304 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15305 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15306 | ||
15307 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15308 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15309 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15310 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15311 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15312 | ||
15313 | /* Unmute Stereo Mixer 15 */ | |
15314 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15315 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15316 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15317 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | |
15318 | ||
15319 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15320 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15321 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15322 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15323 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15324 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15325 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15326 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15327 | ||
15328 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15329 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15330 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
15331 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
15332 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15333 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15334 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
15335 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
15336 | ||
15337 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ | |
15338 | ||
15339 | { } | |
15340 | }; | |
15341 | ||
15342 | static struct hda_verb alc861_toshiba_init_verbs[] = { | |
15343 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15344 | ||
15345 | { } | |
15346 | }; | |
15347 | ||
15348 | /* toggle speaker-output according to the hp-jack state */ | |
15349 | static void alc861_toshiba_automute(struct hda_codec *codec) | |
15350 | { | |
15351 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); | |
15352 | ||
15353 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, | |
15354 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
15355 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, | |
15356 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | |
15357 | } | |
15358 | ||
15359 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, | |
15360 | unsigned int res) | |
15361 | { | |
15362 | if ((res >> 26) == ALC880_HP_EVENT) | |
15363 | alc861_toshiba_automute(codec); | |
15364 | } | |
15365 | ||
15366 | /* pcm configuration: identical with ALC880 */ | |
15367 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback | |
15368 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture | |
15369 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback | |
15370 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture | |
15371 | ||
15372 | ||
15373 | #define ALC861_DIGOUT_NID 0x07 | |
15374 | ||
15375 | static struct hda_channel_mode alc861_8ch_modes[1] = { | |
15376 | { 8, NULL } | |
15377 | }; | |
15378 | ||
15379 | static hda_nid_t alc861_dac_nids[4] = { | |
15380 | /* front, surround, clfe, side */ | |
15381 | 0x03, 0x06, 0x05, 0x04 | |
15382 | }; | |
15383 | ||
15384 | static hda_nid_t alc660_dac_nids[3] = { | |
15385 | /* front, clfe, surround */ | |
15386 | 0x03, 0x05, 0x06 | |
15387 | }; | |
15388 | ||
15389 | static hda_nid_t alc861_adc_nids[1] = { | |
15390 | /* ADC0-2 */ | |
15391 | 0x08, | |
15392 | }; | |
15393 | ||
15394 | static struct hda_input_mux alc861_capture_source = { | |
15395 | .num_items = 5, | |
15396 | .items = { | |
15397 | { "Mic", 0x0 }, | |
15398 | { "Front Mic", 0x3 }, | |
15399 | { "Line", 0x1 }, | |
15400 | { "CD", 0x4 }, | |
15401 | { "Mixer", 0x5 }, | |
15402 | }, | |
15403 | }; | |
15404 | ||
15405 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |
15406 | { | |
15407 | struct alc_spec *spec = codec->spec; | |
15408 | hda_nid_t mix, srcs[5]; | |
15409 | int i, j, num; | |
15410 | ||
15411 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) | |
15412 | return 0; | |
15413 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | |
15414 | if (num < 0) | |
15415 | return 0; | |
15416 | for (i = 0; i < num; i++) { | |
15417 | unsigned int type; | |
15418 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); | |
15419 | if (type != AC_WID_AUD_OUT) | |
15420 | continue; | |
15421 | for (j = 0; j < spec->multiout.num_dacs; j++) | |
15422 | if (spec->multiout.dac_nids[j] == srcs[i]) | |
15423 | break; | |
15424 | if (j >= spec->multiout.num_dacs) | |
15425 | return srcs[i]; | |
15426 | } | |
15427 | return 0; | |
15428 | } | |
15429 | ||
15430 | /* fill in the dac_nids table from the parsed pin configuration */ | |
15431 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, | |
15432 | const struct auto_pin_cfg *cfg) | |
15433 | { | |
15434 | struct alc_spec *spec = codec->spec; | |
15435 | int i; | |
15436 | hda_nid_t nid, dac; | |
15437 | ||
15438 | spec->multiout.dac_nids = spec->private_dac_nids; | |
15439 | for (i = 0; i < cfg->line_outs; i++) { | |
15440 | nid = cfg->line_out_pins[i]; | |
15441 | dac = alc861_look_for_dac(codec, nid); | |
15442 | if (!dac) | |
15443 | continue; | |
15444 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
15445 | } | |
15446 | return 0; | |
15447 | } | |
15448 | ||
15449 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, | |
15450 | hda_nid_t nid, unsigned int chs) | |
15451 | { | |
15452 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, | |
15453 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | |
15454 | } | |
15455 | ||
15456 | /* add playback controls from the parsed DAC table */ | |
15457 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, | |
15458 | const struct auto_pin_cfg *cfg) | |
15459 | { | |
15460 | struct alc_spec *spec = codec->spec; | |
15461 | static const char *chname[4] = { | |
15462 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
15463 | }; | |
15464 | hda_nid_t nid; | |
15465 | int i, err; | |
15466 | ||
15467 | if (cfg->line_outs == 1) { | |
15468 | const char *pfx = NULL; | |
15469 | if (!cfg->hp_outs) | |
15470 | pfx = "Master"; | |
15471 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
15472 | pfx = "Speaker"; | |
15473 | if (pfx) { | |
15474 | nid = spec->multiout.dac_nids[0]; | |
15475 | return alc861_create_out_sw(codec, pfx, nid, 3); | |
15476 | } | |
15477 | } | |
15478 | ||
15479 | for (i = 0; i < cfg->line_outs; i++) { | |
15480 | nid = spec->multiout.dac_nids[i]; | |
15481 | if (!nid) | |
15482 | continue; | |
15483 | if (i == 2) { | |
15484 | /* Center/LFE */ | |
15485 | err = alc861_create_out_sw(codec, "Center", nid, 1); | |
15486 | if (err < 0) | |
15487 | return err; | |
15488 | err = alc861_create_out_sw(codec, "LFE", nid, 2); | |
15489 | if (err < 0) | |
15490 | return err; | |
15491 | } else { | |
15492 | err = alc861_create_out_sw(codec, chname[i], nid, 3); | |
15493 | if (err < 0) | |
15494 | return err; | |
15495 | } | |
15496 | } | |
15497 | return 0; | |
15498 | } | |
15499 | ||
15500 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) | |
15501 | { | |
15502 | struct alc_spec *spec = codec->spec; | |
15503 | int err; | |
15504 | hda_nid_t nid; | |
15505 | ||
15506 | if (!pin) | |
15507 | return 0; | |
15508 | ||
15509 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | |
15510 | nid = alc861_look_for_dac(codec, pin); | |
15511 | if (nid) { | |
15512 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); | |
15513 | if (err < 0) | |
15514 | return err; | |
15515 | spec->multiout.hp_nid = nid; | |
15516 | } | |
15517 | } | |
15518 | return 0; | |
15519 | } | |
15520 | ||
15521 | /* create playback/capture controls for input pins */ | |
15522 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, | |
15523 | const struct auto_pin_cfg *cfg) | |
15524 | { | |
15525 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); | |
15526 | } | |
15527 | ||
15528 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, | |
15529 | hda_nid_t nid, | |
15530 | int pin_type, hda_nid_t dac) | |
15531 | { | |
15532 | hda_nid_t mix, srcs[5]; | |
15533 | int i, num; | |
15534 | ||
15535 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
15536 | pin_type); | |
15537 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15538 | AMP_OUT_UNMUTE); | |
15539 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) | |
15540 | return; | |
15541 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | |
15542 | if (num < 0) | |
15543 | return; | |
15544 | for (i = 0; i < num; i++) { | |
15545 | unsigned int mute; | |
15546 | if (srcs[i] == dac || srcs[i] == 0x15) | |
15547 | mute = AMP_IN_UNMUTE(i); | |
15548 | else | |
15549 | mute = AMP_IN_MUTE(i); | |
15550 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15551 | mute); | |
15552 | } | |
15553 | } | |
15554 | ||
15555 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | |
15556 | { | |
15557 | struct alc_spec *spec = codec->spec; | |
15558 | int i; | |
15559 | ||
15560 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
15561 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
15562 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
15563 | if (nid) | |
15564 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, | |
15565 | spec->multiout.dac_nids[i]); | |
15566 | } | |
15567 | } | |
15568 | ||
15569 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | |
15570 | { | |
15571 | struct alc_spec *spec = codec->spec; | |
15572 | ||
15573 | if (spec->autocfg.hp_outs) | |
15574 | alc861_auto_set_output_and_unmute(codec, | |
15575 | spec->autocfg.hp_pins[0], | |
15576 | PIN_HP, | |
15577 | spec->multiout.hp_nid); | |
15578 | if (spec->autocfg.speaker_outs) | |
15579 | alc861_auto_set_output_and_unmute(codec, | |
15580 | spec->autocfg.speaker_pins[0], | |
15581 | PIN_OUT, | |
15582 | spec->multiout.dac_nids[0]); | |
15583 | } | |
15584 | ||
15585 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | |
15586 | { | |
15587 | struct alc_spec *spec = codec->spec; | |
15588 | int i; | |
15589 | ||
15590 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
15591 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
15592 | if (nid >= 0x0c && nid <= 0x11) | |
15593 | alc_set_input_pin(codec, nid, i); | |
15594 | } | |
15595 | } | |
15596 | ||
15597 | /* parse the BIOS configuration and set up the alc_spec */ | |
15598 | /* return 1 if successful, 0 if the proper config is not found, | |
15599 | * or a negative error code | |
15600 | */ | |
15601 | static int alc861_parse_auto_config(struct hda_codec *codec) | |
15602 | { | |
15603 | struct alc_spec *spec = codec->spec; | |
15604 | int err; | |
15605 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; | |
15606 | ||
15607 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
15608 | alc861_ignore); | |
15609 | if (err < 0) | |
15610 | return err; | |
15611 | if (!spec->autocfg.line_outs) | |
15612 | return 0; /* can't find valid BIOS pin config */ | |
15613 | ||
15614 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); | |
15615 | if (err < 0) | |
15616 | return err; | |
15617 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); | |
15618 | if (err < 0) | |
15619 | return err; | |
15620 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); | |
15621 | if (err < 0) | |
15622 | return err; | |
15623 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); | |
15624 | if (err < 0) | |
15625 | return err; | |
15626 | ||
15627 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
15628 | ||
15629 | alc_auto_parse_digital(codec); | |
15630 | ||
15631 | if (spec->kctls.list) | |
15632 | add_mixer(spec, spec->kctls.list); | |
15633 | ||
15634 | add_verb(spec, alc861_auto_init_verbs); | |
15635 | ||
15636 | spec->num_mux_defs = 1; | |
15637 | spec->input_mux = &spec->private_imux[0]; | |
15638 | ||
15639 | spec->adc_nids = alc861_adc_nids; | |
15640 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | |
15641 | set_capture_mixer(codec); | |
15642 | ||
15643 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); | |
15644 | ||
15645 | return 1; | |
15646 | } | |
15647 | ||
15648 | /* additional initialization for auto-configuration model */ | |
15649 | static void alc861_auto_init(struct hda_codec *codec) | |
15650 | { | |
15651 | struct alc_spec *spec = codec->spec; | |
15652 | alc861_auto_init_multi_out(codec); | |
15653 | alc861_auto_init_hp_out(codec); | |
15654 | alc861_auto_init_analog_input(codec); | |
15655 | alc_auto_init_digital(codec); | |
15656 | if (spec->unsol_event) | |
15657 | alc_inithook(codec); | |
15658 | } | |
15659 | ||
15660 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
15661 | static struct hda_amp_list alc861_loopbacks[] = { | |
15662 | { 0x15, HDA_INPUT, 0 }, | |
15663 | { 0x15, HDA_INPUT, 1 }, | |
15664 | { 0x15, HDA_INPUT, 2 }, | |
15665 | { 0x15, HDA_INPUT, 3 }, | |
15666 | { } /* end */ | |
15667 | }; | |
15668 | #endif | |
15669 | ||
15670 | ||
15671 | /* | |
15672 | * configuration and preset | |
15673 | */ | |
15674 | static const char *alc861_models[ALC861_MODEL_LAST] = { | |
15675 | [ALC861_3ST] = "3stack", | |
15676 | [ALC660_3ST] = "3stack-660", | |
15677 | [ALC861_3ST_DIG] = "3stack-dig", | |
15678 | [ALC861_6ST_DIG] = "6stack-dig", | |
15679 | [ALC861_UNIWILL_M31] = "uniwill-m31", | |
15680 | [ALC861_TOSHIBA] = "toshiba", | |
15681 | [ALC861_ASUS] = "asus", | |
15682 | [ALC861_ASUS_LAPTOP] = "asus-laptop", | |
15683 | [ALC861_AUTO] = "auto", | |
15684 | }; | |
15685 | ||
15686 | static struct snd_pci_quirk alc861_cfg_tbl[] = { | |
15687 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), | |
15688 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
15689 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
15690 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | |
15691 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), | |
15692 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), | |
15693 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), | |
15694 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) | |
15695 | * Any other models that need this preset? | |
15696 | */ | |
15697 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ | |
15698 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), | |
15699 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), | |
15700 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), | |
15701 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), | |
15702 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), | |
15703 | /* FIXME: the below seems conflict */ | |
15704 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ | |
15705 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), | |
15706 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), | |
15707 | {} | |
15708 | }; | |
15709 | ||
15710 | static struct alc_config_preset alc861_presets[] = { | |
15711 | [ALC861_3ST] = { | |
15712 | .mixers = { alc861_3ST_mixer }, | |
15713 | .init_verbs = { alc861_threestack_init_verbs }, | |
15714 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15715 | .dac_nids = alc861_dac_nids, | |
15716 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
15717 | .channel_mode = alc861_threestack_modes, | |
15718 | .need_dac_fix = 1, | |
15719 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15720 | .adc_nids = alc861_adc_nids, | |
15721 | .input_mux = &alc861_capture_source, | |
15722 | }, | |
15723 | [ALC861_3ST_DIG] = { | |
15724 | .mixers = { alc861_base_mixer }, | |
15725 | .init_verbs = { alc861_threestack_init_verbs }, | |
15726 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15727 | .dac_nids = alc861_dac_nids, | |
15728 | .dig_out_nid = ALC861_DIGOUT_NID, | |
15729 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
15730 | .channel_mode = alc861_threestack_modes, | |
15731 | .need_dac_fix = 1, | |
15732 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15733 | .adc_nids = alc861_adc_nids, | |
15734 | .input_mux = &alc861_capture_source, | |
15735 | }, | |
15736 | [ALC861_6ST_DIG] = { | |
15737 | .mixers = { alc861_base_mixer }, | |
15738 | .init_verbs = { alc861_base_init_verbs }, | |
15739 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15740 | .dac_nids = alc861_dac_nids, | |
15741 | .dig_out_nid = ALC861_DIGOUT_NID, | |
15742 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), | |
15743 | .channel_mode = alc861_8ch_modes, | |
15744 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15745 | .adc_nids = alc861_adc_nids, | |
15746 | .input_mux = &alc861_capture_source, | |
15747 | }, | |
15748 | [ALC660_3ST] = { | |
15749 | .mixers = { alc861_3ST_mixer }, | |
15750 | .init_verbs = { alc861_threestack_init_verbs }, | |
15751 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), | |
15752 | .dac_nids = alc660_dac_nids, | |
15753 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
15754 | .channel_mode = alc861_threestack_modes, | |
15755 | .need_dac_fix = 1, | |
15756 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15757 | .adc_nids = alc861_adc_nids, | |
15758 | .input_mux = &alc861_capture_source, | |
15759 | }, | |
15760 | [ALC861_UNIWILL_M31] = { | |
15761 | .mixers = { alc861_uniwill_m31_mixer }, | |
15762 | .init_verbs = { alc861_uniwill_m31_init_verbs }, | |
15763 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15764 | .dac_nids = alc861_dac_nids, | |
15765 | .dig_out_nid = ALC861_DIGOUT_NID, | |
15766 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
15767 | .channel_mode = alc861_uniwill_m31_modes, | |
15768 | .need_dac_fix = 1, | |
15769 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15770 | .adc_nids = alc861_adc_nids, | |
15771 | .input_mux = &alc861_capture_source, | |
15772 | }, | |
15773 | [ALC861_TOSHIBA] = { | |
15774 | .mixers = { alc861_toshiba_mixer }, | |
15775 | .init_verbs = { alc861_base_init_verbs, | |
15776 | alc861_toshiba_init_verbs }, | |
15777 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15778 | .dac_nids = alc861_dac_nids, | |
15779 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
15780 | .channel_mode = alc883_3ST_2ch_modes, | |
15781 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15782 | .adc_nids = alc861_adc_nids, | |
15783 | .input_mux = &alc861_capture_source, | |
15784 | .unsol_event = alc861_toshiba_unsol_event, | |
15785 | .init_hook = alc861_toshiba_automute, | |
15786 | }, | |
15787 | [ALC861_ASUS] = { | |
15788 | .mixers = { alc861_asus_mixer }, | |
15789 | .init_verbs = { alc861_asus_init_verbs }, | |
15790 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15791 | .dac_nids = alc861_dac_nids, | |
15792 | .dig_out_nid = ALC861_DIGOUT_NID, | |
15793 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), | |
15794 | .channel_mode = alc861_asus_modes, | |
15795 | .need_dac_fix = 1, | |
15796 | .hp_nid = 0x06, | |
15797 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15798 | .adc_nids = alc861_adc_nids, | |
15799 | .input_mux = &alc861_capture_source, | |
15800 | }, | |
15801 | [ALC861_ASUS_LAPTOP] = { | |
15802 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, | |
15803 | .init_verbs = { alc861_asus_init_verbs, | |
15804 | alc861_asus_laptop_init_verbs }, | |
15805 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15806 | .dac_nids = alc861_dac_nids, | |
15807 | .dig_out_nid = ALC861_DIGOUT_NID, | |
15808 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
15809 | .channel_mode = alc883_3ST_2ch_modes, | |
15810 | .need_dac_fix = 1, | |
15811 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15812 | .adc_nids = alc861_adc_nids, | |
15813 | .input_mux = &alc861_capture_source, | |
15814 | }, | |
15815 | }; | |
15816 | ||
15817 | /* Pin config fixes */ | |
15818 | enum { | |
15819 | PINFIX_FSC_AMILO_PI1505, | |
15820 | }; | |
15821 | ||
15822 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { | |
15823 | { 0x0b, 0x0221101f }, /* HP */ | |
15824 | { 0x0f, 0x90170310 }, /* speaker */ | |
15825 | { } | |
15826 | }; | |
15827 | ||
15828 | static const struct alc_fixup alc861_fixups[] = { | |
15829 | [PINFIX_FSC_AMILO_PI1505] = { | |
15830 | .pins = alc861_fsc_amilo_pi1505_pinfix | |
15831 | }, | |
15832 | }; | |
15833 | ||
15834 | static struct snd_pci_quirk alc861_fixup_tbl[] = { | |
15835 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), | |
15836 | {} | |
15837 | }; | |
15838 | ||
15839 | static int patch_alc861(struct hda_codec *codec) | |
15840 | { | |
15841 | struct alc_spec *spec; | |
15842 | int board_config; | |
15843 | int err; | |
15844 | ||
15845 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
15846 | if (spec == NULL) | |
15847 | return -ENOMEM; | |
15848 | ||
15849 | codec->spec = spec; | |
15850 | ||
15851 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, | |
15852 | alc861_models, | |
15853 | alc861_cfg_tbl); | |
15854 | ||
15855 | if (board_config < 0) { | |
15856 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
15857 | codec->chip_name); | |
15858 | board_config = ALC861_AUTO; | |
15859 | } | |
15860 | ||
15861 | if (board_config == ALC861_AUTO) | |
15862 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); | |
15863 | ||
15864 | if (board_config == ALC861_AUTO) { | |
15865 | /* automatic parse from the BIOS config */ | |
15866 | err = alc861_parse_auto_config(codec); | |
15867 | if (err < 0) { | |
15868 | alc_free(codec); | |
15869 | return err; | |
15870 | } else if (!err) { | |
15871 | printk(KERN_INFO | |
15872 | "hda_codec: Cannot set up configuration " | |
15873 | "from BIOS. Using base mode...\n"); | |
15874 | board_config = ALC861_3ST_DIG; | |
15875 | } | |
15876 | } | |
15877 | ||
15878 | err = snd_hda_attach_beep_device(codec, 0x23); | |
15879 | if (err < 0) { | |
15880 | alc_free(codec); | |
15881 | return err; | |
15882 | } | |
15883 | ||
15884 | if (board_config != ALC861_AUTO) | |
15885 | setup_preset(codec, &alc861_presets[board_config]); | |
15886 | ||
15887 | spec->stream_analog_playback = &alc861_pcm_analog_playback; | |
15888 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | |
15889 | ||
15890 | spec->stream_digital_playback = &alc861_pcm_digital_playback; | |
15891 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | |
15892 | ||
15893 | if (!spec->cap_mixer) | |
15894 | set_capture_mixer(codec); | |
15895 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); | |
15896 | ||
15897 | spec->vmaster_nid = 0x03; | |
15898 | ||
15899 | if (board_config == ALC861_AUTO) | |
15900 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); | |
15901 | ||
15902 | codec->patch_ops = alc_patch_ops; | |
15903 | if (board_config == ALC861_AUTO) { | |
15904 | spec->init_hook = alc861_auto_init; | |
15905 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
15906 | spec->power_hook = alc_power_eapd; | |
15907 | #endif | |
15908 | } | |
15909 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
15910 | if (!spec->loopback.amplist) | |
15911 | spec->loopback.amplist = alc861_loopbacks; | |
15912 | #endif | |
15913 | ||
15914 | return 0; | |
15915 | } | |
15916 | ||
15917 | /* | |
15918 | * ALC861-VD support | |
15919 | * | |
15920 | * Based on ALC882 | |
15921 | * | |
15922 | * In addition, an independent DAC | |
15923 | */ | |
15924 | #define ALC861VD_DIGOUT_NID 0x06 | |
15925 | ||
15926 | static hda_nid_t alc861vd_dac_nids[4] = { | |
15927 | /* front, surr, clfe, side surr */ | |
15928 | 0x02, 0x03, 0x04, 0x05 | |
15929 | }; | |
15930 | ||
15931 | /* dac_nids for ALC660vd are in a different order - according to | |
15932 | * Realtek's driver. | |
15933 | * This should probably result in a different mixer for 6stack models | |
15934 | * of ALC660vd codecs, but for now there is only 3stack mixer | |
15935 | * - and it is the same as in 861vd. | |
15936 | * adc_nids in ALC660vd are (is) the same as in 861vd | |
15937 | */ | |
15938 | static hda_nid_t alc660vd_dac_nids[3] = { | |
15939 | /* front, rear, clfe, rear_surr */ | |
15940 | 0x02, 0x04, 0x03 | |
15941 | }; | |
15942 | ||
15943 | static hda_nid_t alc861vd_adc_nids[1] = { | |
15944 | /* ADC0 */ | |
15945 | 0x09, | |
15946 | }; | |
15947 | ||
15948 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; | |
15949 | ||
15950 | /* input MUX */ | |
15951 | /* FIXME: should be a matrix-type input source selection */ | |
15952 | static struct hda_input_mux alc861vd_capture_source = { | |
15953 | .num_items = 4, | |
15954 | .items = { | |
15955 | { "Mic", 0x0 }, | |
15956 | { "Front Mic", 0x1 }, | |
15957 | { "Line", 0x2 }, | |
15958 | { "CD", 0x4 }, | |
15959 | }, | |
15960 | }; | |
15961 | ||
15962 | static struct hda_input_mux alc861vd_dallas_capture_source = { | |
15963 | .num_items = 2, | |
15964 | .items = { | |
15965 | { "Ext Mic", 0x0 }, | |
15966 | { "Int Mic", 0x1 }, | |
15967 | }, | |
15968 | }; | |
15969 | ||
15970 | static struct hda_input_mux alc861vd_hp_capture_source = { | |
15971 | .num_items = 2, | |
15972 | .items = { | |
15973 | { "Front Mic", 0x0 }, | |
15974 | { "ATAPI Mic", 0x1 }, | |
15975 | }, | |
15976 | }; | |
15977 | ||
15978 | /* | |
15979 | * 2ch mode | |
15980 | */ | |
15981 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { | |
15982 | { 2, NULL } | |
15983 | }; | |
15984 | ||
15985 | /* | |
15986 | * 6ch mode | |
15987 | */ | |
15988 | static struct hda_verb alc861vd_6stack_ch6_init[] = { | |
15989 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15990 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
15991 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
15992 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
15993 | { } /* end */ | |
15994 | }; | |
15995 | ||
15996 | /* | |
15997 | * 8ch mode | |
15998 | */ | |
15999 | static struct hda_verb alc861vd_6stack_ch8_init[] = { | |
16000 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16001 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16002 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16003 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16004 | { } /* end */ | |
16005 | }; | |
16006 | ||
16007 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { | |
16008 | { 6, alc861vd_6stack_ch6_init }, | |
16009 | { 8, alc861vd_6stack_ch8_init }, | |
16010 | }; | |
16011 | ||
16012 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { | |
16013 | { | |
16014 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
16015 | .name = "Channel Mode", | |
16016 | .info = alc_ch_mode_info, | |
16017 | .get = alc_ch_mode_get, | |
16018 | .put = alc_ch_mode_put, | |
16019 | }, | |
16020 | { } /* end */ | |
16021 | }; | |
16022 | ||
16023 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
16024 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
16025 | */ | |
16026 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { | |
16027 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16028 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16029 | ||
16030 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16031 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
16032 | ||
16033 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, | |
16034 | HDA_OUTPUT), | |
16035 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, | |
16036 | HDA_OUTPUT), | |
16037 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
16038 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16039 | ||
16040 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), | |
16041 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
16042 | ||
16043 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16044 | ||
16045 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
16046 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16047 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16048 | ||
16049 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
16050 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16051 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16052 | ||
16053 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16054 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16055 | ||
16056 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16057 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16058 | ||
16059 | { } /* end */ | |
16060 | }; | |
16061 | ||
16062 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { | |
16063 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16064 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16065 | ||
16066 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16067 | ||
16068 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
16069 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16070 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16071 | ||
16072 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
16073 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16074 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16075 | ||
16076 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16077 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16078 | ||
16079 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16080 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16081 | ||
16082 | { } /* end */ | |
16083 | }; | |
16084 | ||
16085 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { | |
16086 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16087 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ | |
16088 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
16089 | ||
16090 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16091 | ||
16092 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
16093 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16094 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16095 | ||
16096 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
16097 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16098 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16099 | ||
16100 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16101 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16102 | ||
16103 | { } /* end */ | |
16104 | }; | |
16105 | ||
16106 | /* Pin assignment: Speaker=0x14, HP = 0x15, | |
16107 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d | |
16108 | */ | |
16109 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | |
16110 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16111 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
16112 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16113 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
16114 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
16115 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16116 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16117 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
16118 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16119 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16120 | { } /* end */ | |
16121 | }; | |
16122 | ||
16123 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, | |
16124 | * Front Mic=0x18, ATAPI Mic = 0x19, | |
16125 | */ | |
16126 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { | |
16127 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16128 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16129 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16130 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
16131 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16132 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16133 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16134 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16135 | ||
16136 | { } /* end */ | |
16137 | }; | |
16138 | ||
16139 | /* | |
16140 | * generic initialization of ADC, input mixers and output mixers | |
16141 | */ | |
16142 | static struct hda_verb alc861vd_volume_init_verbs[] = { | |
16143 | /* | |
16144 | * Unmute ADC0 and set the default input to mic-in | |
16145 | */ | |
16146 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16147 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16148 | ||
16149 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of | |
16150 | * the analog-loopback mixer widget | |
16151 | */ | |
16152 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
16153 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16154 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16155 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
16156 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
16157 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
16158 | ||
16159 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ | |
16160 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16161 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16162 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
16163 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
16164 | ||
16165 | /* | |
16166 | * Set up output mixers (0x02 - 0x05) | |
16167 | */ | |
16168 | /* set vol=0 to output mixers */ | |
16169 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16170 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16171 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16172 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16173 | ||
16174 | /* set up input amps for analog loopback */ | |
16175 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
16176 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16177 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16178 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16179 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16180 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16181 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16182 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16183 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16184 | ||
16185 | { } | |
16186 | }; | |
16187 | ||
16188 | /* | |
16189 | * 3-stack pin configuration: | |
16190 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
16191 | */ | |
16192 | static struct hda_verb alc861vd_3stack_init_verbs[] = { | |
16193 | /* | |
16194 | * Set pin mode and muting | |
16195 | */ | |
16196 | /* set front pin widgets 0x14 for output */ | |
16197 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16198 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16199 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16200 | ||
16201 | /* Mic (rear) pin: input vref at 80% */ | |
16202 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16203 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16204 | /* Front Mic pin: input vref at 80% */ | |
16205 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16206 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16207 | /* Line In pin: input */ | |
16208 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16209 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16210 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
16211 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16212 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16213 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16214 | /* CD pin widget for input */ | |
16215 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16216 | ||
16217 | { } | |
16218 | }; | |
16219 | ||
16220 | /* | |
16221 | * 6-stack pin configuration: | |
16222 | */ | |
16223 | static struct hda_verb alc861vd_6stack_init_verbs[] = { | |
16224 | /* | |
16225 | * Set pin mode and muting | |
16226 | */ | |
16227 | /* set front pin widgets 0x14 for output */ | |
16228 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16229 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16230 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16231 | ||
16232 | /* Rear Pin: output 1 (0x0d) */ | |
16233 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16234 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16235 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
16236 | /* CLFE Pin: output 2 (0x0e) */ | |
16237 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16238 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16239 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
16240 | /* Side Pin: output 3 (0x0f) */ | |
16241 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16242 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16243 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
16244 | ||
16245 | /* Mic (rear) pin: input vref at 80% */ | |
16246 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16247 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16248 | /* Front Mic pin: input vref at 80% */ | |
16249 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16250 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16251 | /* Line In pin: input */ | |
16252 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16253 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16254 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
16255 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16256 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16257 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16258 | /* CD pin widget for input */ | |
16259 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16260 | ||
16261 | { } | |
16262 | }; | |
16263 | ||
16264 | static struct hda_verb alc861vd_eapd_verbs[] = { | |
16265 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16266 | { } | |
16267 | }; | |
16268 | ||
16269 | static struct hda_verb alc660vd_eapd_verbs[] = { | |
16270 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16271 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16272 | { } | |
16273 | }; | |
16274 | ||
16275 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { | |
16276 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16277 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16278 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
16279 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16280 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16281 | {} | |
16282 | }; | |
16283 | ||
16284 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) | |
16285 | { | |
16286 | unsigned int present; | |
16287 | unsigned char bits; | |
16288 | ||
16289 | present = snd_hda_jack_detect(codec, 0x18); | |
16290 | bits = present ? HDA_AMP_MUTE : 0; | |
16291 | ||
16292 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | |
16293 | HDA_AMP_MUTE, bits); | |
16294 | } | |
16295 | ||
16296 | static void alc861vd_lenovo_setup(struct hda_codec *codec) | |
16297 | { | |
16298 | struct alc_spec *spec = codec->spec; | |
16299 | spec->autocfg.hp_pins[0] = 0x1b; | |
16300 | spec->autocfg.speaker_pins[0] = 0x14; | |
16301 | } | |
16302 | ||
16303 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | |
16304 | { | |
16305 | alc_automute_amp(codec); | |
16306 | alc861vd_lenovo_mic_automute(codec); | |
16307 | } | |
16308 | ||
16309 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, | |
16310 | unsigned int res) | |
16311 | { | |
16312 | switch (res >> 26) { | |
16313 | case ALC880_MIC_EVENT: | |
16314 | alc861vd_lenovo_mic_automute(codec); | |
16315 | break; | |
16316 | default: | |
16317 | alc_automute_amp_unsol_event(codec, res); | |
16318 | break; | |
16319 | } | |
16320 | } | |
16321 | ||
16322 | static struct hda_verb alc861vd_dallas_verbs[] = { | |
16323 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16324 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16325 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16326 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16327 | ||
16328 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16329 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16330 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16331 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16332 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16333 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16334 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16335 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16336 | ||
16337 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16338 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16339 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16340 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16341 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16342 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16343 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16344 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16345 | ||
16346 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
16347 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16348 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
16349 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16350 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16351 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16352 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16353 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16354 | ||
16355 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16356 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
16357 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
16358 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
16359 | ||
16360 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16361 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16362 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16363 | ||
16364 | { } /* end */ | |
16365 | }; | |
16366 | ||
16367 | /* toggle speaker-output according to the hp-jack state */ | |
16368 | static void alc861vd_dallas_setup(struct hda_codec *codec) | |
16369 | { | |
16370 | struct alc_spec *spec = codec->spec; | |
16371 | ||
16372 | spec->autocfg.hp_pins[0] = 0x15; | |
16373 | spec->autocfg.speaker_pins[0] = 0x14; | |
16374 | } | |
16375 | ||
16376 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
16377 | #define alc861vd_loopbacks alc880_loopbacks | |
16378 | #endif | |
16379 | ||
16380 | /* pcm configuration: identical with ALC880 */ | |
16381 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback | |
16382 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture | |
16383 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback | |
16384 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture | |
16385 | ||
16386 | /* | |
16387 | * configuration and preset | |
16388 | */ | |
16389 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { | |
16390 | [ALC660VD_3ST] = "3stack-660", | |
16391 | [ALC660VD_3ST_DIG] = "3stack-660-digout", | |
16392 | [ALC660VD_ASUS_V1S] = "asus-v1s", | |
16393 | [ALC861VD_3ST] = "3stack", | |
16394 | [ALC861VD_3ST_DIG] = "3stack-digout", | |
16395 | [ALC861VD_6ST_DIG] = "6stack-digout", | |
16396 | [ALC861VD_LENOVO] = "lenovo", | |
16397 | [ALC861VD_DALLAS] = "dallas", | |
16398 | [ALC861VD_HP] = "hp", | |
16399 | [ALC861VD_AUTO] = "auto", | |
16400 | }; | |
16401 | ||
16402 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |
16403 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), | |
16404 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | |
16405 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), | |
16406 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ | |
16407 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), | |
16408 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), | |
16409 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), | |
16410 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), | |
16411 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ | |
16412 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), | |
16413 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), | |
16414 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), | |
16415 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), | |
16416 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), | |
16417 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), | |
16418 | {} | |
16419 | }; | |
16420 | ||
16421 | static struct alc_config_preset alc861vd_presets[] = { | |
16422 | [ALC660VD_3ST] = { | |
16423 | .mixers = { alc861vd_3st_mixer }, | |
16424 | .init_verbs = { alc861vd_volume_init_verbs, | |
16425 | alc861vd_3stack_init_verbs }, | |
16426 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16427 | .dac_nids = alc660vd_dac_nids, | |
16428 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16429 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16430 | .input_mux = &alc861vd_capture_source, | |
16431 | }, | |
16432 | [ALC660VD_3ST_DIG] = { | |
16433 | .mixers = { alc861vd_3st_mixer }, | |
16434 | .init_verbs = { alc861vd_volume_init_verbs, | |
16435 | alc861vd_3stack_init_verbs }, | |
16436 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16437 | .dac_nids = alc660vd_dac_nids, | |
16438 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16439 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16440 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16441 | .input_mux = &alc861vd_capture_source, | |
16442 | }, | |
16443 | [ALC861VD_3ST] = { | |
16444 | .mixers = { alc861vd_3st_mixer }, | |
16445 | .init_verbs = { alc861vd_volume_init_verbs, | |
16446 | alc861vd_3stack_init_verbs }, | |
16447 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16448 | .dac_nids = alc861vd_dac_nids, | |
16449 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16450 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16451 | .input_mux = &alc861vd_capture_source, | |
16452 | }, | |
16453 | [ALC861VD_3ST_DIG] = { | |
16454 | .mixers = { alc861vd_3st_mixer }, | |
16455 | .init_verbs = { alc861vd_volume_init_verbs, | |
16456 | alc861vd_3stack_init_verbs }, | |
16457 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16458 | .dac_nids = alc861vd_dac_nids, | |
16459 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16460 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16461 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16462 | .input_mux = &alc861vd_capture_source, | |
16463 | }, | |
16464 | [ALC861VD_6ST_DIG] = { | |
16465 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, | |
16466 | .init_verbs = { alc861vd_volume_init_verbs, | |
16467 | alc861vd_6stack_init_verbs }, | |
16468 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16469 | .dac_nids = alc861vd_dac_nids, | |
16470 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16471 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), | |
16472 | .channel_mode = alc861vd_6stack_modes, | |
16473 | .input_mux = &alc861vd_capture_source, | |
16474 | }, | |
16475 | [ALC861VD_LENOVO] = { | |
16476 | .mixers = { alc861vd_lenovo_mixer }, | |
16477 | .init_verbs = { alc861vd_volume_init_verbs, | |
16478 | alc861vd_3stack_init_verbs, | |
16479 | alc861vd_eapd_verbs, | |
16480 | alc861vd_lenovo_unsol_verbs }, | |
16481 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16482 | .dac_nids = alc660vd_dac_nids, | |
16483 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16484 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16485 | .input_mux = &alc861vd_capture_source, | |
16486 | .unsol_event = alc861vd_lenovo_unsol_event, | |
16487 | .setup = alc861vd_lenovo_setup, | |
16488 | .init_hook = alc861vd_lenovo_init_hook, | |
16489 | }, | |
16490 | [ALC861VD_DALLAS] = { | |
16491 | .mixers = { alc861vd_dallas_mixer }, | |
16492 | .init_verbs = { alc861vd_dallas_verbs }, | |
16493 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16494 | .dac_nids = alc861vd_dac_nids, | |
16495 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16496 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16497 | .input_mux = &alc861vd_dallas_capture_source, | |
16498 | .unsol_event = alc_automute_amp_unsol_event, | |
16499 | .setup = alc861vd_dallas_setup, | |
16500 | .init_hook = alc_automute_amp, | |
16501 | }, | |
16502 | [ALC861VD_HP] = { | |
16503 | .mixers = { alc861vd_hp_mixer }, | |
16504 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | |
16505 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16506 | .dac_nids = alc861vd_dac_nids, | |
16507 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16508 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16509 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16510 | .input_mux = &alc861vd_hp_capture_source, | |
16511 | .unsol_event = alc_automute_amp_unsol_event, | |
16512 | .setup = alc861vd_dallas_setup, | |
16513 | .init_hook = alc_automute_amp, | |
16514 | }, | |
16515 | [ALC660VD_ASUS_V1S] = { | |
16516 | .mixers = { alc861vd_lenovo_mixer }, | |
16517 | .init_verbs = { alc861vd_volume_init_verbs, | |
16518 | alc861vd_3stack_init_verbs, | |
16519 | alc861vd_eapd_verbs, | |
16520 | alc861vd_lenovo_unsol_verbs }, | |
16521 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16522 | .dac_nids = alc660vd_dac_nids, | |
16523 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16524 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16525 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16526 | .input_mux = &alc861vd_capture_source, | |
16527 | .unsol_event = alc861vd_lenovo_unsol_event, | |
16528 | .setup = alc861vd_lenovo_setup, | |
16529 | .init_hook = alc861vd_lenovo_init_hook, | |
16530 | }, | |
16531 | }; | |
16532 | ||
16533 | /* | |
16534 | * BIOS auto configuration | |
16535 | */ | |
16536 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, | |
16537 | const struct auto_pin_cfg *cfg) | |
16538 | { | |
16539 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); | |
16540 | } | |
16541 | ||
16542 | ||
16543 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, | |
16544 | hda_nid_t nid, int pin_type, int dac_idx) | |
16545 | { | |
16546 | alc_set_pin_output(codec, nid, pin_type); | |
16547 | } | |
16548 | ||
16549 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) | |
16550 | { | |
16551 | struct alc_spec *spec = codec->spec; | |
16552 | int i; | |
16553 | ||
16554 | for (i = 0; i <= HDA_SIDE; i++) { | |
16555 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
16556 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
16557 | if (nid) | |
16558 | alc861vd_auto_set_output_and_unmute(codec, nid, | |
16559 | pin_type, i); | |
16560 | } | |
16561 | } | |
16562 | ||
16563 | ||
16564 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | |
16565 | { | |
16566 | struct alc_spec *spec = codec->spec; | |
16567 | hda_nid_t pin; | |
16568 | ||
16569 | pin = spec->autocfg.hp_pins[0]; | |
16570 | if (pin) /* connect to front and use dac 0 */ | |
16571 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
16572 | pin = spec->autocfg.speaker_pins[0]; | |
16573 | if (pin) | |
16574 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
16575 | } | |
16576 | ||
16577 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID | |
16578 | ||
16579 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |
16580 | { | |
16581 | struct alc_spec *spec = codec->spec; | |
16582 | int i; | |
16583 | ||
16584 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
16585 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
16586 | if (alc_is_input_pin(codec, nid)) { | |
16587 | alc_set_input_pin(codec, nid, i); | |
16588 | if (nid != ALC861VD_PIN_CD_NID && | |
16589 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
16590 | snd_hda_codec_write(codec, nid, 0, | |
16591 | AC_VERB_SET_AMP_GAIN_MUTE, | |
16592 | AMP_OUT_MUTE); | |
16593 | } | |
16594 | } | |
16595 | } | |
16596 | ||
16597 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src | |
16598 | ||
16599 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) | |
16600 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) | |
16601 | ||
16602 | /* add playback controls from the parsed DAC table */ | |
16603 | /* Based on ALC880 version. But ALC861VD has separate, | |
16604 | * different NIDs for mute/unmute switch and volume control */ | |
16605 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | |
16606 | const struct auto_pin_cfg *cfg) | |
16607 | { | |
16608 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; | |
16609 | hda_nid_t nid_v, nid_s; | |
16610 | int i, err; | |
16611 | ||
16612 | for (i = 0; i < cfg->line_outs; i++) { | |
16613 | if (!spec->multiout.dac_nids[i]) | |
16614 | continue; | |
16615 | nid_v = alc861vd_idx_to_mixer_vol( | |
16616 | alc880_dac_to_idx( | |
16617 | spec->multiout.dac_nids[i])); | |
16618 | nid_s = alc861vd_idx_to_mixer_switch( | |
16619 | alc880_dac_to_idx( | |
16620 | spec->multiout.dac_nids[i])); | |
16621 | ||
16622 | if (i == 2) { | |
16623 | /* Center/LFE */ | |
16624 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
16625 | "Center", | |
16626 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, | |
16627 | HDA_OUTPUT)); | |
16628 | if (err < 0) | |
16629 | return err; | |
16630 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
16631 | "LFE", | |
16632 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, | |
16633 | HDA_OUTPUT)); | |
16634 | if (err < 0) | |
16635 | return err; | |
16636 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
16637 | "Center", | |
16638 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, | |
16639 | HDA_INPUT)); | |
16640 | if (err < 0) | |
16641 | return err; | |
16642 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
16643 | "LFE", | |
16644 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, | |
16645 | HDA_INPUT)); | |
16646 | if (err < 0) | |
16647 | return err; | |
16648 | } else { | |
16649 | const char *pfx; | |
16650 | if (cfg->line_outs == 1 && | |
16651 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | |
16652 | if (!cfg->hp_pins) | |
16653 | pfx = "Speaker"; | |
16654 | else | |
16655 | pfx = "PCM"; | |
16656 | } else | |
16657 | pfx = chname[i]; | |
16658 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | |
16659 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, | |
16660 | HDA_OUTPUT)); | |
16661 | if (err < 0) | |
16662 | return err; | |
16663 | if (cfg->line_outs == 1 && | |
16664 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
16665 | pfx = "Speaker"; | |
16666 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | |
16667 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, | |
16668 | HDA_INPUT)); | |
16669 | if (err < 0) | |
16670 | return err; | |
16671 | } | |
16672 | } | |
16673 | return 0; | |
16674 | } | |
16675 | ||
16676 | /* add playback controls for speaker and HP outputs */ | |
16677 | /* Based on ALC880 version. But ALC861VD has separate, | |
16678 | * different NIDs for mute/unmute switch and volume control */ | |
16679 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, | |
16680 | hda_nid_t pin, const char *pfx) | |
16681 | { | |
16682 | hda_nid_t nid_v, nid_s; | |
16683 | int err; | |
16684 | ||
16685 | if (!pin) | |
16686 | return 0; | |
16687 | ||
16688 | if (alc880_is_fixed_pin(pin)) { | |
16689 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
16690 | /* specify the DAC as the extra output */ | |
16691 | if (!spec->multiout.hp_nid) | |
16692 | spec->multiout.hp_nid = nid_v; | |
16693 | else | |
16694 | spec->multiout.extra_out_nid[0] = nid_v; | |
16695 | /* control HP volume/switch on the output mixer amp */ | |
16696 | nid_v = alc861vd_idx_to_mixer_vol( | |
16697 | alc880_fixed_pin_idx(pin)); | |
16698 | nid_s = alc861vd_idx_to_mixer_switch( | |
16699 | alc880_fixed_pin_idx(pin)); | |
16700 | ||
16701 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | |
16702 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); | |
16703 | if (err < 0) | |
16704 | return err; | |
16705 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | |
16706 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); | |
16707 | if (err < 0) | |
16708 | return err; | |
16709 | } else if (alc880_is_multi_pin(pin)) { | |
16710 | /* set manual connection */ | |
16711 | /* we have only a switch on HP-out PIN */ | |
16712 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | |
16713 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
16714 | if (err < 0) | |
16715 | return err; | |
16716 | } | |
16717 | return 0; | |
16718 | } | |
16719 | ||
16720 | /* parse the BIOS configuration and set up the alc_spec | |
16721 | * return 1 if successful, 0 if the proper config is not found, | |
16722 | * or a negative error code | |
16723 | * Based on ALC880 version - had to change it to override | |
16724 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ | |
16725 | static int alc861vd_parse_auto_config(struct hda_codec *codec) | |
16726 | { | |
16727 | struct alc_spec *spec = codec->spec; | |
16728 | int err; | |
16729 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; | |
16730 | ||
16731 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
16732 | alc861vd_ignore); | |
16733 | if (err < 0) | |
16734 | return err; | |
16735 | if (!spec->autocfg.line_outs) | |
16736 | return 0; /* can't find valid BIOS pin config */ | |
16737 | ||
16738 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | |
16739 | if (err < 0) | |
16740 | return err; | |
16741 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
16742 | if (err < 0) | |
16743 | return err; | |
16744 | err = alc861vd_auto_create_extra_out(spec, | |
16745 | spec->autocfg.speaker_pins[0], | |
16746 | "Speaker"); | |
16747 | if (err < 0) | |
16748 | return err; | |
16749 | err = alc861vd_auto_create_extra_out(spec, | |
16750 | spec->autocfg.hp_pins[0], | |
16751 | "Headphone"); | |
16752 | if (err < 0) | |
16753 | return err; | |
16754 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); | |
16755 | if (err < 0) | |
16756 | return err; | |
16757 | ||
16758 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
16759 | ||
16760 | alc_auto_parse_digital(codec); | |
16761 | ||
16762 | if (spec->kctls.list) | |
16763 | add_mixer(spec, spec->kctls.list); | |
16764 | ||
16765 | add_verb(spec, alc861vd_volume_init_verbs); | |
16766 | ||
16767 | spec->num_mux_defs = 1; | |
16768 | spec->input_mux = &spec->private_imux[0]; | |
16769 | ||
16770 | err = alc_auto_add_mic_boost(codec); | |
16771 | if (err < 0) | |
16772 | return err; | |
16773 | ||
16774 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
16775 | ||
16776 | return 1; | |
16777 | } | |
16778 | ||
16779 | /* additional initialization for auto-configuration model */ | |
16780 | static void alc861vd_auto_init(struct hda_codec *codec) | |
16781 | { | |
16782 | struct alc_spec *spec = codec->spec; | |
16783 | alc861vd_auto_init_multi_out(codec); | |
16784 | alc861vd_auto_init_hp_out(codec); | |
16785 | alc861vd_auto_init_analog_input(codec); | |
16786 | alc861vd_auto_init_input_src(codec); | |
16787 | alc_auto_init_digital(codec); | |
16788 | if (spec->unsol_event) | |
16789 | alc_inithook(codec); | |
16790 | } | |
16791 | ||
16792 | enum { | |
16793 | ALC660VD_FIX_ASUS_GPIO1 | |
16794 | }; | |
16795 | ||
16796 | /* reset GPIO1 */ | |
16797 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { | |
16798 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
16799 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
16800 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
16801 | { } | |
16802 | }; | |
16803 | ||
16804 | static const struct alc_fixup alc861vd_fixups[] = { | |
16805 | [ALC660VD_FIX_ASUS_GPIO1] = { | |
16806 | .verbs = alc660vd_fix_asus_gpio1_verbs, | |
16807 | }, | |
16808 | }; | |
16809 | ||
16810 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { | |
16811 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), | |
16812 | {} | |
16813 | }; | |
16814 | ||
16815 | static int patch_alc861vd(struct hda_codec *codec) | |
16816 | { | |
16817 | struct alc_spec *spec; | |
16818 | int err, board_config; | |
16819 | ||
16820 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
16821 | if (spec == NULL) | |
16822 | return -ENOMEM; | |
16823 | ||
16824 | codec->spec = spec; | |
16825 | ||
16826 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, | |
16827 | alc861vd_models, | |
16828 | alc861vd_cfg_tbl); | |
16829 | ||
16830 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { | |
16831 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
16832 | codec->chip_name); | |
16833 | board_config = ALC861VD_AUTO; | |
16834 | } | |
16835 | ||
16836 | if (board_config == ALC861VD_AUTO) | |
16837 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); | |
16838 | ||
16839 | if (board_config == ALC861VD_AUTO) { | |
16840 | /* automatic parse from the BIOS config */ | |
16841 | err = alc861vd_parse_auto_config(codec); | |
16842 | if (err < 0) { | |
16843 | alc_free(codec); | |
16844 | return err; | |
16845 | } else if (!err) { | |
16846 | printk(KERN_INFO | |
16847 | "hda_codec: Cannot set up configuration " | |
16848 | "from BIOS. Using base mode...\n"); | |
16849 | board_config = ALC861VD_3ST; | |
16850 | } | |
16851 | } | |
16852 | ||
16853 | err = snd_hda_attach_beep_device(codec, 0x23); | |
16854 | if (err < 0) { | |
16855 | alc_free(codec); | |
16856 | return err; | |
16857 | } | |
16858 | ||
16859 | if (board_config != ALC861VD_AUTO) | |
16860 | setup_preset(codec, &alc861vd_presets[board_config]); | |
16861 | ||
16862 | if (codec->vendor_id == 0x10ec0660) { | |
16863 | /* always turn on EAPD */ | |
16864 | add_verb(spec, alc660vd_eapd_verbs); | |
16865 | } | |
16866 | ||
16867 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; | |
16868 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; | |
16869 | ||
16870 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; | |
16871 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; | |
16872 | ||
16873 | if (!spec->adc_nids) { | |
16874 | spec->adc_nids = alc861vd_adc_nids; | |
16875 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | |
16876 | } | |
16877 | if (!spec->capsrc_nids) | |
16878 | spec->capsrc_nids = alc861vd_capsrc_nids; | |
16879 | ||
16880 | set_capture_mixer(codec); | |
16881 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
16882 | ||
16883 | spec->vmaster_nid = 0x02; | |
16884 | ||
16885 | if (board_config == ALC861VD_AUTO) | |
16886 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); | |
16887 | ||
16888 | codec->patch_ops = alc_patch_ops; | |
16889 | ||
16890 | if (board_config == ALC861VD_AUTO) | |
16891 | spec->init_hook = alc861vd_auto_init; | |
16892 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
16893 | if (!spec->loopback.amplist) | |
16894 | spec->loopback.amplist = alc861vd_loopbacks; | |
16895 | #endif | |
16896 | ||
16897 | return 0; | |
16898 | } | |
16899 | ||
16900 | /* | |
16901 | * ALC662 support | |
16902 | * | |
16903 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible | |
16904 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
16905 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
16906 | * 6-channel independent captures. | |
16907 | * | |
16908 | * In addition, an independent DAC for the multi-playback (not used in this | |
16909 | * driver yet). | |
16910 | */ | |
16911 | #define ALC662_DIGOUT_NID 0x06 | |
16912 | #define ALC662_DIGIN_NID 0x0a | |
16913 | ||
16914 | static hda_nid_t alc662_dac_nids[4] = { | |
16915 | /* front, rear, clfe, rear_surr */ | |
16916 | 0x02, 0x03, 0x04 | |
16917 | }; | |
16918 | ||
16919 | static hda_nid_t alc272_dac_nids[2] = { | |
16920 | 0x02, 0x03 | |
16921 | }; | |
16922 | ||
16923 | static hda_nid_t alc662_adc_nids[2] = { | |
16924 | /* ADC1-2 */ | |
16925 | 0x09, 0x08 | |
16926 | }; | |
16927 | ||
16928 | static hda_nid_t alc272_adc_nids[1] = { | |
16929 | /* ADC1-2 */ | |
16930 | 0x08, | |
16931 | }; | |
16932 | ||
16933 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; | |
16934 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; | |
16935 | ||
16936 | ||
16937 | /* input MUX */ | |
16938 | /* FIXME: should be a matrix-type input source selection */ | |
16939 | static struct hda_input_mux alc662_capture_source = { | |
16940 | .num_items = 4, | |
16941 | .items = { | |
16942 | { "Mic", 0x0 }, | |
16943 | { "Front Mic", 0x1 }, | |
16944 | { "Line", 0x2 }, | |
16945 | { "CD", 0x4 }, | |
16946 | }, | |
16947 | }; | |
16948 | ||
16949 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { | |
16950 | .num_items = 2, | |
16951 | .items = { | |
16952 | { "Mic", 0x1 }, | |
16953 | { "Line", 0x2 }, | |
16954 | }, | |
16955 | }; | |
16956 | ||
16957 | static struct hda_input_mux alc663_capture_source = { | |
16958 | .num_items = 3, | |
16959 | .items = { | |
16960 | { "Mic", 0x0 }, | |
16961 | { "Front Mic", 0x1 }, | |
16962 | { "Line", 0x2 }, | |
16963 | }, | |
16964 | }; | |
16965 | ||
16966 | #if 0 /* set to 1 for testing other input sources below */ | |
16967 | static struct hda_input_mux alc272_nc10_capture_source = { | |
16968 | .num_items = 16, | |
16969 | .items = { | |
16970 | { "Autoselect Mic", 0x0 }, | |
16971 | { "Internal Mic", 0x1 }, | |
16972 | { "In-0x02", 0x2 }, | |
16973 | { "In-0x03", 0x3 }, | |
16974 | { "In-0x04", 0x4 }, | |
16975 | { "In-0x05", 0x5 }, | |
16976 | { "In-0x06", 0x6 }, | |
16977 | { "In-0x07", 0x7 }, | |
16978 | { "In-0x08", 0x8 }, | |
16979 | { "In-0x09", 0x9 }, | |
16980 | { "In-0x0a", 0x0a }, | |
16981 | { "In-0x0b", 0x0b }, | |
16982 | { "In-0x0c", 0x0c }, | |
16983 | { "In-0x0d", 0x0d }, | |
16984 | { "In-0x0e", 0x0e }, | |
16985 | { "In-0x0f", 0x0f }, | |
16986 | }, | |
16987 | }; | |
16988 | #endif | |
16989 | ||
16990 | /* | |
16991 | * 2ch mode | |
16992 | */ | |
16993 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { | |
16994 | { 2, NULL } | |
16995 | }; | |
16996 | ||
16997 | /* | |
16998 | * 2ch mode | |
16999 | */ | |
17000 | static struct hda_verb alc662_3ST_ch2_init[] = { | |
17001 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
17002 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
17003 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
17004 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
17005 | { } /* end */ | |
17006 | }; | |
17007 | ||
17008 | /* | |
17009 | * 6ch mode | |
17010 | */ | |
17011 | static struct hda_verb alc662_3ST_ch6_init[] = { | |
17012 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17013 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
17014 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
17015 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17016 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
17017 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
17018 | { } /* end */ | |
17019 | }; | |
17020 | ||
17021 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { | |
17022 | { 2, alc662_3ST_ch2_init }, | |
17023 | { 6, alc662_3ST_ch6_init }, | |
17024 | }; | |
17025 | ||
17026 | /* | |
17027 | * 2ch mode | |
17028 | */ | |
17029 | static struct hda_verb alc662_sixstack_ch6_init[] = { | |
17030 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
17031 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
17032 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17033 | { } /* end */ | |
17034 | }; | |
17035 | ||
17036 | /* | |
17037 | * 6ch mode | |
17038 | */ | |
17039 | static struct hda_verb alc662_sixstack_ch8_init[] = { | |
17040 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17041 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17042 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17043 | { } /* end */ | |
17044 | }; | |
17045 | ||
17046 | static struct hda_channel_mode alc662_5stack_modes[2] = { | |
17047 | { 2, alc662_sixstack_ch6_init }, | |
17048 | { 6, alc662_sixstack_ch8_init }, | |
17049 | }; | |
17050 | ||
17051 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
17052 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
17053 | */ | |
17054 | ||
17055 | static struct snd_kcontrol_new alc662_base_mixer[] = { | |
17056 | /* output mixer control */ | |
17057 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
17058 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
17059 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
17060 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), | |
17061 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | |
17062 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
17063 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), | |
17064 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
17065 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17066 | ||
17067 | /*Input mixer control */ | |
17068 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), | |
17069 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), | |
17070 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), | |
17071 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), | |
17072 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), | |
17073 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), | |
17074 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), | |
17075 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), | |
17076 | { } /* end */ | |
17077 | }; | |
17078 | ||
17079 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | |
17080 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17081 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
17082 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17083 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
17084 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
17085 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17086 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17087 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17088 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17089 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17090 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17091 | { } /* end */ | |
17092 | }; | |
17093 | ||
17094 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | |
17095 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17096 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
17097 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17098 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), | |
17099 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | |
17100 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
17101 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), | |
17102 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
17103 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17104 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
17105 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
17106 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17107 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17108 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17109 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17110 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17111 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17112 | { } /* end */ | |
17113 | }; | |
17114 | ||
17115 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { | |
17116 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17117 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | |
17118 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17119 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), | |
17120 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17121 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17122 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17123 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17124 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17125 | { } /* end */ | |
17126 | }; | |
17127 | ||
17128 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { | |
17129 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17130 | ALC262_HIPPO_MASTER_SWITCH, | |
17131 | ||
17132 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), | |
17133 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17134 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17135 | ||
17136 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
17137 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17138 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17139 | { } /* end */ | |
17140 | }; | |
17141 | ||
17142 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { | |
17143 | ALC262_HIPPO_MASTER_SWITCH, | |
17144 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17145 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17146 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | |
17147 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
17148 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), | |
17149 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17150 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17151 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17152 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17153 | { } /* end */ | |
17154 | }; | |
17155 | ||
17156 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { | |
17157 | .ops = &snd_hda_bind_vol, | |
17158 | .values = { | |
17159 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
17160 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
17161 | 0 | |
17162 | }, | |
17163 | }; | |
17164 | ||
17165 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { | |
17166 | .ops = &snd_hda_bind_sw, | |
17167 | .values = { | |
17168 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17169 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17170 | 0 | |
17171 | }, | |
17172 | }; | |
17173 | ||
17174 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { | |
17175 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17176 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), | |
17177 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17178 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17179 | { } /* end */ | |
17180 | }; | |
17181 | ||
17182 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { | |
17183 | .ops = &snd_hda_bind_sw, | |
17184 | .values = { | |
17185 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17186 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17187 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17188 | 0 | |
17189 | }, | |
17190 | }; | |
17191 | ||
17192 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { | |
17193 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17194 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), | |
17195 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17196 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17197 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17198 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17199 | ||
17200 | { } /* end */ | |
17201 | }; | |
17202 | ||
17203 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { | |
17204 | .ops = &snd_hda_bind_sw, | |
17205 | .values = { | |
17206 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17207 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17208 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
17209 | 0 | |
17210 | }, | |
17211 | }; | |
17212 | ||
17213 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { | |
17214 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17215 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), | |
17216 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17217 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17218 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17219 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17220 | { } /* end */ | |
17221 | }; | |
17222 | ||
17223 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { | |
17224 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17225 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17226 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17227 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17228 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17229 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17230 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17231 | { } /* end */ | |
17232 | }; | |
17233 | ||
17234 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { | |
17235 | .ops = &snd_hda_bind_vol, | |
17236 | .values = { | |
17237 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
17238 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), | |
17239 | 0 | |
17240 | }, | |
17241 | }; | |
17242 | ||
17243 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { | |
17244 | .ops = &snd_hda_bind_sw, | |
17245 | .values = { | |
17246 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17247 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), | |
17248 | 0 | |
17249 | }, | |
17250 | }; | |
17251 | ||
17252 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { | |
17253 | HDA_BIND_VOL("Master Playback Volume", | |
17254 | &alc663_asus_two_bind_master_vol), | |
17255 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
17256 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17257 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17258 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17259 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17260 | { } /* end */ | |
17261 | }; | |
17262 | ||
17263 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { | |
17264 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17265 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
17266 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17267 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17268 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17269 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17270 | { } /* end */ | |
17271 | }; | |
17272 | ||
17273 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { | |
17274 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17275 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17276 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17277 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17278 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17279 | ||
17280 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17281 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17282 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17283 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17284 | { } /* end */ | |
17285 | }; | |
17286 | ||
17287 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { | |
17288 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17289 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17290 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17291 | ||
17292 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17293 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17294 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17295 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17296 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17297 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17298 | { } /* end */ | |
17299 | }; | |
17300 | ||
17301 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { | |
17302 | .ops = &snd_hda_bind_sw, | |
17303 | .values = { | |
17304 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17305 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17306 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | |
17307 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
17308 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17309 | 0 | |
17310 | }, | |
17311 | }; | |
17312 | ||
17313 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { | |
17314 | .ops = &snd_hda_bind_sw, | |
17315 | .values = { | |
17316 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17317 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | |
17318 | 0 | |
17319 | }, | |
17320 | }; | |
17321 | ||
17322 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { | |
17323 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | |
17324 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | |
17325 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | |
17326 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17327 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17328 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17329 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17330 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17331 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17332 | { } /* end */ | |
17333 | }; | |
17334 | ||
17335 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { | |
17336 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | |
17337 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | |
17338 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | |
17339 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17340 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17341 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17342 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17343 | { } /* end */ | |
17344 | }; | |
17345 | ||
17346 | ||
17347 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { | |
17348 | { | |
17349 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
17350 | .name = "Channel Mode", | |
17351 | .info = alc_ch_mode_info, | |
17352 | .get = alc_ch_mode_get, | |
17353 | .put = alc_ch_mode_put, | |
17354 | }, | |
17355 | { } /* end */ | |
17356 | }; | |
17357 | ||
17358 | static struct hda_verb alc662_init_verbs[] = { | |
17359 | /* ADC: mute amp left and right */ | |
17360 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17361 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
17362 | ||
17363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17364 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17365 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17366 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17367 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17368 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17369 | ||
17370 | /* Front Pin: output 0 (0x0c) */ | |
17371 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17372 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17373 | ||
17374 | /* Rear Pin: output 1 (0x0d) */ | |
17375 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17376 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17377 | ||
17378 | /* CLFE Pin: output 2 (0x0e) */ | |
17379 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17380 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17381 | ||
17382 | /* Mic (rear) pin: input vref at 80% */ | |
17383 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
17384 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17385 | /* Front Mic pin: input vref at 80% */ | |
17386 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
17387 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17388 | /* Line In pin: input */ | |
17389 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17390 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17391 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
17392 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17393 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17394 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
17395 | /* CD pin widget for input */ | |
17396 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17397 | ||
17398 | /* FIXME: use matrix-type input source selection */ | |
17399 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
17400 | /* Input mixer */ | |
17401 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17402 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17403 | ||
17404 | /* always trun on EAPD */ | |
17405 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
17406 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
17407 | ||
17408 | { } | |
17409 | }; | |
17410 | ||
17411 | static struct hda_verb alc663_init_verbs[] = { | |
17412 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17413 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17414 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17415 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17416 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17417 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17418 | { } | |
17419 | }; | |
17420 | ||
17421 | static struct hda_verb alc272_init_verbs[] = { | |
17422 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17423 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17424 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17425 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17426 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17427 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17428 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17429 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17430 | { } | |
17431 | }; | |
17432 | ||
17433 | static struct hda_verb alc662_sue_init_verbs[] = { | |
17434 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
17435 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
17436 | {} | |
17437 | }; | |
17438 | ||
17439 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { | |
17440 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17441 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17442 | {} | |
17443 | }; | |
17444 | ||
17445 | /* Set Unsolicited Event*/ | |
17446 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { | |
17447 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17448 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17449 | {} | |
17450 | }; | |
17451 | ||
17452 | static struct hda_verb alc663_m51va_init_verbs[] = { | |
17453 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17454 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17455 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17456 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17457 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17459 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17460 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17461 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17462 | {} | |
17463 | }; | |
17464 | ||
17465 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { | |
17466 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17467 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17468 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17469 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17470 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17471 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17472 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17473 | {} | |
17474 | }; | |
17475 | ||
17476 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { | |
17477 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17478 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17479 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17480 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
17481 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17482 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17483 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17484 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17485 | {} | |
17486 | }; | |
17487 | ||
17488 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { | |
17489 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17490 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17491 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17492 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17493 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17494 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17495 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17496 | {} | |
17497 | }; | |
17498 | ||
17499 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { | |
17500 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17501 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17502 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17503 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
17504 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17505 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17506 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
17507 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17508 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17509 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17510 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17511 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17512 | {} | |
17513 | }; | |
17514 | ||
17515 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { | |
17516 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17517 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17518 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17519 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17520 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17521 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17522 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17523 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17524 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17525 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17526 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17527 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17528 | {} | |
17529 | }; | |
17530 | ||
17531 | static struct hda_verb alc663_g71v_init_verbs[] = { | |
17532 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17533 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
17534 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ | |
17535 | ||
17536 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17537 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17538 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
17539 | ||
17540 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
17541 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, | |
17542 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
17543 | {} | |
17544 | }; | |
17545 | ||
17546 | static struct hda_verb alc663_g50v_init_verbs[] = { | |
17547 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17548 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17549 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
17550 | ||
17551 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17552 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17553 | {} | |
17554 | }; | |
17555 | ||
17556 | static struct hda_verb alc662_ecs_init_verbs[] = { | |
17557 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | |
17558 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17559 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17560 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17561 | {} | |
17562 | }; | |
17563 | ||
17564 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { | |
17565 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17566 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17567 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17568 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17569 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17570 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17571 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17572 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17573 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17574 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17575 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17576 | {} | |
17577 | }; | |
17578 | ||
17579 | static struct hda_verb alc272_dell_init_verbs[] = { | |
17580 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17581 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17582 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17583 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17584 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17585 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17586 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17587 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17588 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17589 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17590 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17591 | {} | |
17592 | }; | |
17593 | ||
17594 | static struct hda_verb alc663_mode7_init_verbs[] = { | |
17595 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17596 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17597 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17598 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17599 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17600 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17601 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
17602 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17603 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17604 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17605 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17606 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17607 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17608 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17609 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17610 | {} | |
17611 | }; | |
17612 | ||
17613 | static struct hda_verb alc663_mode8_init_verbs[] = { | |
17614 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17615 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17616 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17617 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
17618 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17619 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17620 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17621 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17622 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17623 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17624 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17625 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17626 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17627 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17628 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17629 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17630 | {} | |
17631 | }; | |
17632 | ||
17633 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { | |
17634 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
17635 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
17636 | { } /* end */ | |
17637 | }; | |
17638 | ||
17639 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { | |
17640 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
17641 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
17642 | { } /* end */ | |
17643 | }; | |
17644 | ||
17645 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | |
17646 | { | |
17647 | unsigned int present; | |
17648 | unsigned char bits; | |
17649 | ||
17650 | present = snd_hda_jack_detect(codec, 0x14); | |
17651 | bits = present ? HDA_AMP_MUTE : 0; | |
17652 | ||
17653 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
17654 | HDA_AMP_MUTE, bits); | |
17655 | } | |
17656 | ||
17657 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) | |
17658 | { | |
17659 | unsigned int present; | |
17660 | unsigned char bits; | |
17661 | ||
17662 | present = snd_hda_jack_detect(codec, 0x1b); | |
17663 | bits = present ? HDA_AMP_MUTE : 0; | |
17664 | ||
17665 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
17666 | HDA_AMP_MUTE, bits); | |
17667 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
17668 | HDA_AMP_MUTE, bits); | |
17669 | } | |
17670 | ||
17671 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | |
17672 | unsigned int res) | |
17673 | { | |
17674 | if ((res >> 26) == ALC880_HP_EVENT) | |
17675 | alc662_lenovo_101e_all_automute(codec); | |
17676 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
17677 | alc662_lenovo_101e_ispeaker_automute(codec); | |
17678 | } | |
17679 | ||
17680 | /* unsolicited event for HP jack sensing */ | |
17681 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | |
17682 | unsigned int res) | |
17683 | { | |
17684 | if ((res >> 26) == ALC880_MIC_EVENT) | |
17685 | alc_mic_automute(codec); | |
17686 | else | |
17687 | alc262_hippo_unsol_event(codec, res); | |
17688 | } | |
17689 | ||
17690 | static void alc662_eeepc_setup(struct hda_codec *codec) | |
17691 | { | |
17692 | struct alc_spec *spec = codec->spec; | |
17693 | ||
17694 | alc262_hippo1_setup(codec); | |
17695 | spec->ext_mic.pin = 0x18; | |
17696 | spec->ext_mic.mux_idx = 0; | |
17697 | spec->int_mic.pin = 0x19; | |
17698 | spec->int_mic.mux_idx = 1; | |
17699 | spec->auto_mic = 1; | |
17700 | } | |
17701 | ||
17702 | static void alc662_eeepc_inithook(struct hda_codec *codec) | |
17703 | { | |
17704 | alc262_hippo_automute(codec); | |
17705 | alc_mic_automute(codec); | |
17706 | } | |
17707 | ||
17708 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) | |
17709 | { | |
17710 | struct alc_spec *spec = codec->spec; | |
17711 | ||
17712 | spec->autocfg.hp_pins[0] = 0x14; | |
17713 | spec->autocfg.speaker_pins[0] = 0x1b; | |
17714 | } | |
17715 | ||
17716 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update | |
17717 | ||
17718 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) | |
17719 | { | |
17720 | unsigned int present; | |
17721 | unsigned char bits; | |
17722 | ||
17723 | present = snd_hda_jack_detect(codec, 0x21); | |
17724 | bits = present ? HDA_AMP_MUTE : 0; | |
17725 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
17726 | HDA_AMP_MUTE, bits); | |
17727 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
17728 | HDA_AMP_MUTE, bits); | |
17729 | } | |
17730 | ||
17731 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | |
17732 | { | |
17733 | unsigned int present; | |
17734 | unsigned char bits; | |
17735 | ||
17736 | present = snd_hda_jack_detect(codec, 0x21); | |
17737 | bits = present ? HDA_AMP_MUTE : 0; | |
17738 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
17739 | HDA_AMP_MUTE, bits); | |
17740 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
17741 | HDA_AMP_MUTE, bits); | |
17742 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | |
17743 | HDA_AMP_MUTE, bits); | |
17744 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | |
17745 | HDA_AMP_MUTE, bits); | |
17746 | } | |
17747 | ||
17748 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | |
17749 | { | |
17750 | unsigned int present; | |
17751 | unsigned char bits; | |
17752 | ||
17753 | present = snd_hda_jack_detect(codec, 0x15); | |
17754 | bits = present ? HDA_AMP_MUTE : 0; | |
17755 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
17756 | HDA_AMP_MUTE, bits); | |
17757 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
17758 | HDA_AMP_MUTE, bits); | |
17759 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | |
17760 | HDA_AMP_MUTE, bits); | |
17761 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | |
17762 | HDA_AMP_MUTE, bits); | |
17763 | } | |
17764 | ||
17765 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) | |
17766 | { | |
17767 | unsigned int present; | |
17768 | unsigned char bits; | |
17769 | ||
17770 | present = snd_hda_jack_detect(codec, 0x1b); | |
17771 | bits = present ? 0 : PIN_OUT; | |
17772 | snd_hda_codec_write(codec, 0x14, 0, | |
17773 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | |
17774 | } | |
17775 | ||
17776 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) | |
17777 | { | |
17778 | unsigned int present1, present2; | |
17779 | ||
17780 | present1 = snd_hda_jack_detect(codec, 0x21); | |
17781 | present2 = snd_hda_jack_detect(codec, 0x15); | |
17782 | ||
17783 | if (present1 || present2) { | |
17784 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
17785 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
17786 | } else { | |
17787 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
17788 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
17789 | } | |
17790 | } | |
17791 | ||
17792 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |
17793 | { | |
17794 | unsigned int present1, present2; | |
17795 | ||
17796 | present1 = snd_hda_jack_detect(codec, 0x1b); | |
17797 | present2 = snd_hda_jack_detect(codec, 0x15); | |
17798 | ||
17799 | if (present1 || present2) { | |
17800 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
17801 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
17802 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
17803 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
17804 | } else { | |
17805 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
17806 | HDA_AMP_MUTE, 0); | |
17807 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
17808 | HDA_AMP_MUTE, 0); | |
17809 | } | |
17810 | } | |
17811 | ||
17812 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) | |
17813 | { | |
17814 | unsigned int present1, present2; | |
17815 | ||
17816 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | |
17817 | AC_VERB_GET_PIN_SENSE, 0) | |
17818 | & AC_PINSENSE_PRESENCE; | |
17819 | present2 = snd_hda_codec_read(codec, 0x21, 0, | |
17820 | AC_VERB_GET_PIN_SENSE, 0) | |
17821 | & AC_PINSENSE_PRESENCE; | |
17822 | ||
17823 | if (present1 || present2) { | |
17824 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
17825 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
17826 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
17827 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
17828 | } else { | |
17829 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
17830 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
17831 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
17832 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
17833 | } | |
17834 | } | |
17835 | ||
17836 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) | |
17837 | { | |
17838 | unsigned int present1, present2; | |
17839 | ||
17840 | present1 = snd_hda_codec_read(codec, 0x21, 0, | |
17841 | AC_VERB_GET_PIN_SENSE, 0) | |
17842 | & AC_PINSENSE_PRESENCE; | |
17843 | present2 = snd_hda_codec_read(codec, 0x15, 0, | |
17844 | AC_VERB_GET_PIN_SENSE, 0) | |
17845 | & AC_PINSENSE_PRESENCE; | |
17846 | ||
17847 | if (present1 || present2) { | |
17848 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
17849 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
17850 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
17851 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
17852 | } else { | |
17853 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
17854 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
17855 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
17856 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
17857 | } | |
17858 | } | |
17859 | ||
17860 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | |
17861 | unsigned int res) | |
17862 | { | |
17863 | switch (res >> 26) { | |
17864 | case ALC880_HP_EVENT: | |
17865 | alc663_m51va_speaker_automute(codec); | |
17866 | break; | |
17867 | case ALC880_MIC_EVENT: | |
17868 | alc_mic_automute(codec); | |
17869 | break; | |
17870 | } | |
17871 | } | |
17872 | ||
17873 | static void alc663_m51va_setup(struct hda_codec *codec) | |
17874 | { | |
17875 | struct alc_spec *spec = codec->spec; | |
17876 | spec->ext_mic.pin = 0x18; | |
17877 | spec->ext_mic.mux_idx = 0; | |
17878 | spec->int_mic.pin = 0x12; | |
17879 | spec->int_mic.mux_idx = 9; | |
17880 | spec->auto_mic = 1; | |
17881 | } | |
17882 | ||
17883 | static void alc663_m51va_inithook(struct hda_codec *codec) | |
17884 | { | |
17885 | alc663_m51va_speaker_automute(codec); | |
17886 | alc_mic_automute(codec); | |
17887 | } | |
17888 | ||
17889 | /* ***************** Mode1 ******************************/ | |
17890 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event | |
17891 | ||
17892 | static void alc663_mode1_setup(struct hda_codec *codec) | |
17893 | { | |
17894 | struct alc_spec *spec = codec->spec; | |
17895 | spec->ext_mic.pin = 0x18; | |
17896 | spec->ext_mic.mux_idx = 0; | |
17897 | spec->int_mic.pin = 0x19; | |
17898 | spec->int_mic.mux_idx = 1; | |
17899 | spec->auto_mic = 1; | |
17900 | } | |
17901 | ||
17902 | #define alc663_mode1_inithook alc663_m51va_inithook | |
17903 | ||
17904 | /* ***************** Mode2 ******************************/ | |
17905 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | |
17906 | unsigned int res) | |
17907 | { | |
17908 | switch (res >> 26) { | |
17909 | case ALC880_HP_EVENT: | |
17910 | alc662_f5z_speaker_automute(codec); | |
17911 | break; | |
17912 | case ALC880_MIC_EVENT: | |
17913 | alc_mic_automute(codec); | |
17914 | break; | |
17915 | } | |
17916 | } | |
17917 | ||
17918 | #define alc662_mode2_setup alc663_mode1_setup | |
17919 | ||
17920 | static void alc662_mode2_inithook(struct hda_codec *codec) | |
17921 | { | |
17922 | alc662_f5z_speaker_automute(codec); | |
17923 | alc_mic_automute(codec); | |
17924 | } | |
17925 | /* ***************** Mode3 ******************************/ | |
17926 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | |
17927 | unsigned int res) | |
17928 | { | |
17929 | switch (res >> 26) { | |
17930 | case ALC880_HP_EVENT: | |
17931 | alc663_two_hp_m1_speaker_automute(codec); | |
17932 | break; | |
17933 | case ALC880_MIC_EVENT: | |
17934 | alc_mic_automute(codec); | |
17935 | break; | |
17936 | } | |
17937 | } | |
17938 | ||
17939 | #define alc663_mode3_setup alc663_mode1_setup | |
17940 | ||
17941 | static void alc663_mode3_inithook(struct hda_codec *codec) | |
17942 | { | |
17943 | alc663_two_hp_m1_speaker_automute(codec); | |
17944 | alc_mic_automute(codec); | |
17945 | } | |
17946 | /* ***************** Mode4 ******************************/ | |
17947 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | |
17948 | unsigned int res) | |
17949 | { | |
17950 | switch (res >> 26) { | |
17951 | case ALC880_HP_EVENT: | |
17952 | alc663_21jd_two_speaker_automute(codec); | |
17953 | break; | |
17954 | case ALC880_MIC_EVENT: | |
17955 | alc_mic_automute(codec); | |
17956 | break; | |
17957 | } | |
17958 | } | |
17959 | ||
17960 | #define alc663_mode4_setup alc663_mode1_setup | |
17961 | ||
17962 | static void alc663_mode4_inithook(struct hda_codec *codec) | |
17963 | { | |
17964 | alc663_21jd_two_speaker_automute(codec); | |
17965 | alc_mic_automute(codec); | |
17966 | } | |
17967 | /* ***************** Mode5 ******************************/ | |
17968 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | |
17969 | unsigned int res) | |
17970 | { | |
17971 | switch (res >> 26) { | |
17972 | case ALC880_HP_EVENT: | |
17973 | alc663_15jd_two_speaker_automute(codec); | |
17974 | break; | |
17975 | case ALC880_MIC_EVENT: | |
17976 | alc_mic_automute(codec); | |
17977 | break; | |
17978 | } | |
17979 | } | |
17980 | ||
17981 | #define alc663_mode5_setup alc663_mode1_setup | |
17982 | ||
17983 | static void alc663_mode5_inithook(struct hda_codec *codec) | |
17984 | { | |
17985 | alc663_15jd_two_speaker_automute(codec); | |
17986 | alc_mic_automute(codec); | |
17987 | } | |
17988 | /* ***************** Mode6 ******************************/ | |
17989 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | |
17990 | unsigned int res) | |
17991 | { | |
17992 | switch (res >> 26) { | |
17993 | case ALC880_HP_EVENT: | |
17994 | alc663_two_hp_m2_speaker_automute(codec); | |
17995 | break; | |
17996 | case ALC880_MIC_EVENT: | |
17997 | alc_mic_automute(codec); | |
17998 | break; | |
17999 | } | |
18000 | } | |
18001 | ||
18002 | #define alc663_mode6_setup alc663_mode1_setup | |
18003 | ||
18004 | static void alc663_mode6_inithook(struct hda_codec *codec) | |
18005 | { | |
18006 | alc663_two_hp_m2_speaker_automute(codec); | |
18007 | alc_mic_automute(codec); | |
18008 | } | |
18009 | ||
18010 | /* ***************** Mode7 ******************************/ | |
18011 | static void alc663_mode7_unsol_event(struct hda_codec *codec, | |
18012 | unsigned int res) | |
18013 | { | |
18014 | switch (res >> 26) { | |
18015 | case ALC880_HP_EVENT: | |
18016 | alc663_two_hp_m7_speaker_automute(codec); | |
18017 | break; | |
18018 | case ALC880_MIC_EVENT: | |
18019 | alc_mic_automute(codec); | |
18020 | break; | |
18021 | } | |
18022 | } | |
18023 | ||
18024 | #define alc663_mode7_setup alc663_mode1_setup | |
18025 | ||
18026 | static void alc663_mode7_inithook(struct hda_codec *codec) | |
18027 | { | |
18028 | alc663_two_hp_m7_speaker_automute(codec); | |
18029 | alc_mic_automute(codec); | |
18030 | } | |
18031 | ||
18032 | /* ***************** Mode8 ******************************/ | |
18033 | static void alc663_mode8_unsol_event(struct hda_codec *codec, | |
18034 | unsigned int res) | |
18035 | { | |
18036 | switch (res >> 26) { | |
18037 | case ALC880_HP_EVENT: | |
18038 | alc663_two_hp_m8_speaker_automute(codec); | |
18039 | break; | |
18040 | case ALC880_MIC_EVENT: | |
18041 | alc_mic_automute(codec); | |
18042 | break; | |
18043 | } | |
18044 | } | |
18045 | ||
18046 | #define alc663_mode8_setup alc663_m51va_setup | |
18047 | ||
18048 | static void alc663_mode8_inithook(struct hda_codec *codec) | |
18049 | { | |
18050 | alc663_two_hp_m8_speaker_automute(codec); | |
18051 | alc_mic_automute(codec); | |
18052 | } | |
18053 | ||
18054 | static void alc663_g71v_hp_automute(struct hda_codec *codec) | |
18055 | { | |
18056 | unsigned int present; | |
18057 | unsigned char bits; | |
18058 | ||
18059 | present = snd_hda_jack_detect(codec, 0x21); | |
18060 | bits = present ? HDA_AMP_MUTE : 0; | |
18061 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
18062 | HDA_AMP_MUTE, bits); | |
18063 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
18064 | HDA_AMP_MUTE, bits); | |
18065 | } | |
18066 | ||
18067 | static void alc663_g71v_front_automute(struct hda_codec *codec) | |
18068 | { | |
18069 | unsigned int present; | |
18070 | unsigned char bits; | |
18071 | ||
18072 | present = snd_hda_jack_detect(codec, 0x15); | |
18073 | bits = present ? HDA_AMP_MUTE : 0; | |
18074 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
18075 | HDA_AMP_MUTE, bits); | |
18076 | } | |
18077 | ||
18078 | static void alc663_g71v_unsol_event(struct hda_codec *codec, | |
18079 | unsigned int res) | |
18080 | { | |
18081 | switch (res >> 26) { | |
18082 | case ALC880_HP_EVENT: | |
18083 | alc663_g71v_hp_automute(codec); | |
18084 | break; | |
18085 | case ALC880_FRONT_EVENT: | |
18086 | alc663_g71v_front_automute(codec); | |
18087 | break; | |
18088 | case ALC880_MIC_EVENT: | |
18089 | alc_mic_automute(codec); | |
18090 | break; | |
18091 | } | |
18092 | } | |
18093 | ||
18094 | #define alc663_g71v_setup alc663_m51va_setup | |
18095 | ||
18096 | static void alc663_g71v_inithook(struct hda_codec *codec) | |
18097 | { | |
18098 | alc663_g71v_front_automute(codec); | |
18099 | alc663_g71v_hp_automute(codec); | |
18100 | alc_mic_automute(codec); | |
18101 | } | |
18102 | ||
18103 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | |
18104 | unsigned int res) | |
18105 | { | |
18106 | switch (res >> 26) { | |
18107 | case ALC880_HP_EVENT: | |
18108 | alc663_m51va_speaker_automute(codec); | |
18109 | break; | |
18110 | case ALC880_MIC_EVENT: | |
18111 | alc_mic_automute(codec); | |
18112 | break; | |
18113 | } | |
18114 | } | |
18115 | ||
18116 | #define alc663_g50v_setup alc663_m51va_setup | |
18117 | ||
18118 | static void alc663_g50v_inithook(struct hda_codec *codec) | |
18119 | { | |
18120 | alc663_m51va_speaker_automute(codec); | |
18121 | alc_mic_automute(codec); | |
18122 | } | |
18123 | ||
18124 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { | |
18125 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
18126 | ALC262_HIPPO_MASTER_SWITCH, | |
18127 | ||
18128 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), | |
18129 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
18130 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
18131 | ||
18132 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
18133 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
18134 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
18135 | { } /* end */ | |
18136 | }; | |
18137 | ||
18138 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { | |
18139 | /* Master Playback automatically created from Speaker and Headphone */ | |
18140 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
18141 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
18142 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
18143 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
18144 | ||
18145 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
18146 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
18147 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
18148 | ||
18149 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
18150 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
18151 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
18152 | { } /* end */ | |
18153 | }; | |
18154 | ||
18155 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
18156 | #define alc662_loopbacks alc880_loopbacks | |
18157 | #endif | |
18158 | ||
18159 | ||
18160 | /* pcm configuration: identical with ALC880 */ | |
18161 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback | |
18162 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture | |
18163 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback | |
18164 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture | |
18165 | ||
18166 | /* | |
18167 | * configuration and preset | |
18168 | */ | |
18169 | static const char *alc662_models[ALC662_MODEL_LAST] = { | |
18170 | [ALC662_3ST_2ch_DIG] = "3stack-dig", | |
18171 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", | |
18172 | [ALC662_3ST_6ch] = "3stack-6ch", | |
18173 | [ALC662_5ST_DIG] = "6stack-dig", | |
18174 | [ALC662_LENOVO_101E] = "lenovo-101e", | |
18175 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", | |
18176 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", | |
18177 | [ALC662_ECS] = "ecs", | |
18178 | [ALC663_ASUS_M51VA] = "m51va", | |
18179 | [ALC663_ASUS_G71V] = "g71v", | |
18180 | [ALC663_ASUS_H13] = "h13", | |
18181 | [ALC663_ASUS_G50V] = "g50v", | |
18182 | [ALC663_ASUS_MODE1] = "asus-mode1", | |
18183 | [ALC662_ASUS_MODE2] = "asus-mode2", | |
18184 | [ALC663_ASUS_MODE3] = "asus-mode3", | |
18185 | [ALC663_ASUS_MODE4] = "asus-mode4", | |
18186 | [ALC663_ASUS_MODE5] = "asus-mode5", | |
18187 | [ALC663_ASUS_MODE6] = "asus-mode6", | |
18188 | [ALC663_ASUS_MODE7] = "asus-mode7", | |
18189 | [ALC663_ASUS_MODE8] = "asus-mode8", | |
18190 | [ALC272_DELL] = "dell", | |
18191 | [ALC272_DELL_ZM1] = "dell-zm1", | |
18192 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", | |
18193 | [ALC662_AUTO] = "auto", | |
18194 | }; | |
18195 | ||
18196 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | |
18197 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), | |
18198 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), | |
18199 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), | |
18200 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), | |
18201 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), | |
18202 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), | |
18203 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), | |
18204 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | |
18205 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | |
18206 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | |
18207 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), | |
18208 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), | |
18209 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | |
18210 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), | |
18211 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), | |
18212 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), | |
18213 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), | |
18214 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), | |
18215 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), | |
18216 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), | |
18217 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), | |
18218 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), | |
18219 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | |
18220 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | |
18221 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | |
18222 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), | |
18223 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), | |
18224 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), | |
18225 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), | |
18226 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), | |
18227 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), | |
18228 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | |
18229 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | |
18230 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), | |
18231 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), | |
18232 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), | |
18233 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), | |
18234 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ | |
18235 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), | |
18236 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), | |
18237 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), | |
18238 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), | |
18239 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), | |
18240 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), | |
18241 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), | |
18242 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | |
18243 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | |
18244 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), | |
18245 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), | |
18246 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | |
18247 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), | |
18248 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), | |
18249 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), | |
18250 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ | |
18251 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | |
18252 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | |
18253 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), | |
18254 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), | |
18255 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), | |
18256 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), | |
18257 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | |
18258 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | |
18259 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | |
18260 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", | |
18261 | ALC662_3ST_6ch_DIG), | |
18262 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), | |
18263 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), | |
18264 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", | |
18265 | ALC662_3ST_6ch_DIG), | |
18266 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), | |
18267 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), | |
18268 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), | |
18269 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), | |
18270 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", | |
18271 | ALC662_3ST_6ch_DIG), | |
18272 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", | |
18273 | ALC663_ASUS_H13), | |
18274 | {} | |
18275 | }; | |
18276 | ||
18277 | static struct alc_config_preset alc662_presets[] = { | |
18278 | [ALC662_3ST_2ch_DIG] = { | |
18279 | .mixers = { alc662_3ST_2ch_mixer }, | |
18280 | .init_verbs = { alc662_init_verbs }, | |
18281 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18282 | .dac_nids = alc662_dac_nids, | |
18283 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18284 | .dig_in_nid = ALC662_DIGIN_NID, | |
18285 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18286 | .channel_mode = alc662_3ST_2ch_modes, | |
18287 | .input_mux = &alc662_capture_source, | |
18288 | }, | |
18289 | [ALC662_3ST_6ch_DIG] = { | |
18290 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, | |
18291 | .init_verbs = { alc662_init_verbs }, | |
18292 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18293 | .dac_nids = alc662_dac_nids, | |
18294 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18295 | .dig_in_nid = ALC662_DIGIN_NID, | |
18296 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18297 | .channel_mode = alc662_3ST_6ch_modes, | |
18298 | .need_dac_fix = 1, | |
18299 | .input_mux = &alc662_capture_source, | |
18300 | }, | |
18301 | [ALC662_3ST_6ch] = { | |
18302 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, | |
18303 | .init_verbs = { alc662_init_verbs }, | |
18304 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18305 | .dac_nids = alc662_dac_nids, | |
18306 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18307 | .channel_mode = alc662_3ST_6ch_modes, | |
18308 | .need_dac_fix = 1, | |
18309 | .input_mux = &alc662_capture_source, | |
18310 | }, | |
18311 | [ALC662_5ST_DIG] = { | |
18312 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, | |
18313 | .init_verbs = { alc662_init_verbs }, | |
18314 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18315 | .dac_nids = alc662_dac_nids, | |
18316 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18317 | .dig_in_nid = ALC662_DIGIN_NID, | |
18318 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | |
18319 | .channel_mode = alc662_5stack_modes, | |
18320 | .input_mux = &alc662_capture_source, | |
18321 | }, | |
18322 | [ALC662_LENOVO_101E] = { | |
18323 | .mixers = { alc662_lenovo_101e_mixer }, | |
18324 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, | |
18325 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18326 | .dac_nids = alc662_dac_nids, | |
18327 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18328 | .channel_mode = alc662_3ST_2ch_modes, | |
18329 | .input_mux = &alc662_lenovo_101e_capture_source, | |
18330 | .unsol_event = alc662_lenovo_101e_unsol_event, | |
18331 | .init_hook = alc662_lenovo_101e_all_automute, | |
18332 | }, | |
18333 | [ALC662_ASUS_EEEPC_P701] = { | |
18334 | .mixers = { alc662_eeepc_p701_mixer }, | |
18335 | .init_verbs = { alc662_init_verbs, | |
18336 | alc662_eeepc_sue_init_verbs }, | |
18337 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18338 | .dac_nids = alc662_dac_nids, | |
18339 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18340 | .channel_mode = alc662_3ST_2ch_modes, | |
18341 | .unsol_event = alc662_eeepc_unsol_event, | |
18342 | .setup = alc662_eeepc_setup, | |
18343 | .init_hook = alc662_eeepc_inithook, | |
18344 | }, | |
18345 | [ALC662_ASUS_EEEPC_EP20] = { | |
18346 | .mixers = { alc662_eeepc_ep20_mixer, | |
18347 | alc662_chmode_mixer }, | |
18348 | .init_verbs = { alc662_init_verbs, | |
18349 | alc662_eeepc_ep20_sue_init_verbs }, | |
18350 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18351 | .dac_nids = alc662_dac_nids, | |
18352 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18353 | .channel_mode = alc662_3ST_6ch_modes, | |
18354 | .input_mux = &alc662_lenovo_101e_capture_source, | |
18355 | .unsol_event = alc662_eeepc_unsol_event, | |
18356 | .setup = alc662_eeepc_ep20_setup, | |
18357 | .init_hook = alc662_eeepc_ep20_inithook, | |
18358 | }, | |
18359 | [ALC662_ECS] = { | |
18360 | .mixers = { alc662_ecs_mixer }, | |
18361 | .init_verbs = { alc662_init_verbs, | |
18362 | alc662_ecs_init_verbs }, | |
18363 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18364 | .dac_nids = alc662_dac_nids, | |
18365 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18366 | .channel_mode = alc662_3ST_2ch_modes, | |
18367 | .unsol_event = alc662_eeepc_unsol_event, | |
18368 | .setup = alc662_eeepc_setup, | |
18369 | .init_hook = alc662_eeepc_inithook, | |
18370 | }, | |
18371 | [ALC663_ASUS_M51VA] = { | |
18372 | .mixers = { alc663_m51va_mixer }, | |
18373 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | |
18374 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18375 | .dac_nids = alc662_dac_nids, | |
18376 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18377 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18378 | .channel_mode = alc662_3ST_2ch_modes, | |
18379 | .unsol_event = alc663_m51va_unsol_event, | |
18380 | .setup = alc663_m51va_setup, | |
18381 | .init_hook = alc663_m51va_inithook, | |
18382 | }, | |
18383 | [ALC663_ASUS_G71V] = { | |
18384 | .mixers = { alc663_g71v_mixer }, | |
18385 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, | |
18386 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18387 | .dac_nids = alc662_dac_nids, | |
18388 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18389 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18390 | .channel_mode = alc662_3ST_2ch_modes, | |
18391 | .unsol_event = alc663_g71v_unsol_event, | |
18392 | .setup = alc663_g71v_setup, | |
18393 | .init_hook = alc663_g71v_inithook, | |
18394 | }, | |
18395 | [ALC663_ASUS_H13] = { | |
18396 | .mixers = { alc663_m51va_mixer }, | |
18397 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | |
18398 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18399 | .dac_nids = alc662_dac_nids, | |
18400 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18401 | .channel_mode = alc662_3ST_2ch_modes, | |
18402 | .unsol_event = alc663_m51va_unsol_event, | |
18403 | .init_hook = alc663_m51va_inithook, | |
18404 | }, | |
18405 | [ALC663_ASUS_G50V] = { | |
18406 | .mixers = { alc663_g50v_mixer }, | |
18407 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, | |
18408 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18409 | .dac_nids = alc662_dac_nids, | |
18410 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18411 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18412 | .channel_mode = alc662_3ST_6ch_modes, | |
18413 | .input_mux = &alc663_capture_source, | |
18414 | .unsol_event = alc663_g50v_unsol_event, | |
18415 | .setup = alc663_g50v_setup, | |
18416 | .init_hook = alc663_g50v_inithook, | |
18417 | }, | |
18418 | [ALC663_ASUS_MODE1] = { | |
18419 | .mixers = { alc663_m51va_mixer }, | |
18420 | .cap_mixer = alc662_auto_capture_mixer, | |
18421 | .init_verbs = { alc662_init_verbs, | |
18422 | alc663_21jd_amic_init_verbs }, | |
18423 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18424 | .hp_nid = 0x03, | |
18425 | .dac_nids = alc662_dac_nids, | |
18426 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18427 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18428 | .channel_mode = alc662_3ST_2ch_modes, | |
18429 | .unsol_event = alc663_mode1_unsol_event, | |
18430 | .setup = alc663_mode1_setup, | |
18431 | .init_hook = alc663_mode1_inithook, | |
18432 | }, | |
18433 | [ALC662_ASUS_MODE2] = { | |
18434 | .mixers = { alc662_1bjd_mixer }, | |
18435 | .cap_mixer = alc662_auto_capture_mixer, | |
18436 | .init_verbs = { alc662_init_verbs, | |
18437 | alc662_1bjd_amic_init_verbs }, | |
18438 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18439 | .dac_nids = alc662_dac_nids, | |
18440 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18441 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18442 | .channel_mode = alc662_3ST_2ch_modes, | |
18443 | .unsol_event = alc662_mode2_unsol_event, | |
18444 | .setup = alc662_mode2_setup, | |
18445 | .init_hook = alc662_mode2_inithook, | |
18446 | }, | |
18447 | [ALC663_ASUS_MODE3] = { | |
18448 | .mixers = { alc663_two_hp_m1_mixer }, | |
18449 | .cap_mixer = alc662_auto_capture_mixer, | |
18450 | .init_verbs = { alc662_init_verbs, | |
18451 | alc663_two_hp_amic_m1_init_verbs }, | |
18452 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18453 | .hp_nid = 0x03, | |
18454 | .dac_nids = alc662_dac_nids, | |
18455 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18456 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18457 | .channel_mode = alc662_3ST_2ch_modes, | |
18458 | .unsol_event = alc663_mode3_unsol_event, | |
18459 | .setup = alc663_mode3_setup, | |
18460 | .init_hook = alc663_mode3_inithook, | |
18461 | }, | |
18462 | [ALC663_ASUS_MODE4] = { | |
18463 | .mixers = { alc663_asus_21jd_clfe_mixer }, | |
18464 | .cap_mixer = alc662_auto_capture_mixer, | |
18465 | .init_verbs = { alc662_init_verbs, | |
18466 | alc663_21jd_amic_init_verbs}, | |
18467 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18468 | .hp_nid = 0x03, | |
18469 | .dac_nids = alc662_dac_nids, | |
18470 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18471 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18472 | .channel_mode = alc662_3ST_2ch_modes, | |
18473 | .unsol_event = alc663_mode4_unsol_event, | |
18474 | .setup = alc663_mode4_setup, | |
18475 | .init_hook = alc663_mode4_inithook, | |
18476 | }, | |
18477 | [ALC663_ASUS_MODE5] = { | |
18478 | .mixers = { alc663_asus_15jd_clfe_mixer }, | |
18479 | .cap_mixer = alc662_auto_capture_mixer, | |
18480 | .init_verbs = { alc662_init_verbs, | |
18481 | alc663_15jd_amic_init_verbs }, | |
18482 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18483 | .hp_nid = 0x03, | |
18484 | .dac_nids = alc662_dac_nids, | |
18485 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18486 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18487 | .channel_mode = alc662_3ST_2ch_modes, | |
18488 | .unsol_event = alc663_mode5_unsol_event, | |
18489 | .setup = alc663_mode5_setup, | |
18490 | .init_hook = alc663_mode5_inithook, | |
18491 | }, | |
18492 | [ALC663_ASUS_MODE6] = { | |
18493 | .mixers = { alc663_two_hp_m2_mixer }, | |
18494 | .cap_mixer = alc662_auto_capture_mixer, | |
18495 | .init_verbs = { alc662_init_verbs, | |
18496 | alc663_two_hp_amic_m2_init_verbs }, | |
18497 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18498 | .hp_nid = 0x03, | |
18499 | .dac_nids = alc662_dac_nids, | |
18500 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18501 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18502 | .channel_mode = alc662_3ST_2ch_modes, | |
18503 | .unsol_event = alc663_mode6_unsol_event, | |
18504 | .setup = alc663_mode6_setup, | |
18505 | .init_hook = alc663_mode6_inithook, | |
18506 | }, | |
18507 | [ALC663_ASUS_MODE7] = { | |
18508 | .mixers = { alc663_mode7_mixer }, | |
18509 | .cap_mixer = alc662_auto_capture_mixer, | |
18510 | .init_verbs = { alc662_init_verbs, | |
18511 | alc663_mode7_init_verbs }, | |
18512 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18513 | .hp_nid = 0x03, | |
18514 | .dac_nids = alc662_dac_nids, | |
18515 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18516 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18517 | .channel_mode = alc662_3ST_2ch_modes, | |
18518 | .unsol_event = alc663_mode7_unsol_event, | |
18519 | .setup = alc663_mode7_setup, | |
18520 | .init_hook = alc663_mode7_inithook, | |
18521 | }, | |
18522 | [ALC663_ASUS_MODE8] = { | |
18523 | .mixers = { alc663_mode8_mixer }, | |
18524 | .cap_mixer = alc662_auto_capture_mixer, | |
18525 | .init_verbs = { alc662_init_verbs, | |
18526 | alc663_mode8_init_verbs }, | |
18527 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18528 | .hp_nid = 0x03, | |
18529 | .dac_nids = alc662_dac_nids, | |
18530 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18531 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18532 | .channel_mode = alc662_3ST_2ch_modes, | |
18533 | .unsol_event = alc663_mode8_unsol_event, | |
18534 | .setup = alc663_mode8_setup, | |
18535 | .init_hook = alc663_mode8_inithook, | |
18536 | }, | |
18537 | [ALC272_DELL] = { | |
18538 | .mixers = { alc663_m51va_mixer }, | |
18539 | .cap_mixer = alc272_auto_capture_mixer, | |
18540 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, | |
18541 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
18542 | .dac_nids = alc662_dac_nids, | |
18543 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18544 | .adc_nids = alc272_adc_nids, | |
18545 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), | |
18546 | .capsrc_nids = alc272_capsrc_nids, | |
18547 | .channel_mode = alc662_3ST_2ch_modes, | |
18548 | .unsol_event = alc663_m51va_unsol_event, | |
18549 | .setup = alc663_m51va_setup, | |
18550 | .init_hook = alc663_m51va_inithook, | |
18551 | }, | |
18552 | [ALC272_DELL_ZM1] = { | |
18553 | .mixers = { alc663_m51va_mixer }, | |
18554 | .cap_mixer = alc662_auto_capture_mixer, | |
18555 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, | |
18556 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
18557 | .dac_nids = alc662_dac_nids, | |
18558 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18559 | .adc_nids = alc662_adc_nids, | |
18560 | .num_adc_nids = 1, | |
18561 | .capsrc_nids = alc662_capsrc_nids, | |
18562 | .channel_mode = alc662_3ST_2ch_modes, | |
18563 | .unsol_event = alc663_m51va_unsol_event, | |
18564 | .setup = alc663_m51va_setup, | |
18565 | .init_hook = alc663_m51va_inithook, | |
18566 | }, | |
18567 | [ALC272_SAMSUNG_NC10] = { | |
18568 | .mixers = { alc272_nc10_mixer }, | |
18569 | .init_verbs = { alc662_init_verbs, | |
18570 | alc663_21jd_amic_init_verbs }, | |
18571 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
18572 | .dac_nids = alc272_dac_nids, | |
18573 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18574 | .channel_mode = alc662_3ST_2ch_modes, | |
18575 | /*.input_mux = &alc272_nc10_capture_source,*/ | |
18576 | .unsol_event = alc663_mode4_unsol_event, | |
18577 | .setup = alc663_mode4_setup, | |
18578 | .init_hook = alc663_mode4_inithook, | |
18579 | }, | |
18580 | }; | |
18581 | ||
18582 | ||
18583 | /* | |
18584 | * BIOS auto configuration | |
18585 | */ | |
18586 | ||
18587 | /* convert from MIX nid to DAC */ | |
18588 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) | |
18589 | { | |
18590 | if (nid == 0x0f) | |
18591 | return 0x02; | |
18592 | else if (nid >= 0x0c && nid <= 0x0e) | |
18593 | return nid - 0x0c + 0x02; | |
18594 | else | |
18595 | return 0; | |
18596 | } | |
18597 | ||
18598 | /* get MIX nid connected to the given pin targeted to DAC */ | |
18599 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, | |
18600 | hda_nid_t dac) | |
18601 | { | |
18602 | hda_nid_t mix[4]; | |
18603 | int i, num; | |
18604 | ||
18605 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); | |
18606 | for (i = 0; i < num; i++) { | |
18607 | if (alc662_mix_to_dac(mix[i]) == dac) | |
18608 | return mix[i]; | |
18609 | } | |
18610 | return 0; | |
18611 | } | |
18612 | ||
18613 | /* look for an empty DAC slot */ | |
18614 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |
18615 | { | |
18616 | struct alc_spec *spec = codec->spec; | |
18617 | hda_nid_t srcs[5]; | |
18618 | int i, j, num; | |
18619 | ||
18620 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); | |
18621 | if (num < 0) | |
18622 | return 0; | |
18623 | for (i = 0; i < num; i++) { | |
18624 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); | |
18625 | if (!nid) | |
18626 | continue; | |
18627 | for (j = 0; j < spec->multiout.num_dacs; j++) | |
18628 | if (spec->multiout.dac_nids[j] == nid) | |
18629 | break; | |
18630 | if (j >= spec->multiout.num_dacs) | |
18631 | return nid; | |
18632 | } | |
18633 | return 0; | |
18634 | } | |
18635 | ||
18636 | /* fill in the dac_nids table from the parsed pin configuration */ | |
18637 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, | |
18638 | const struct auto_pin_cfg *cfg) | |
18639 | { | |
18640 | struct alc_spec *spec = codec->spec; | |
18641 | int i; | |
18642 | hda_nid_t dac; | |
18643 | ||
18644 | spec->multiout.dac_nids = spec->private_dac_nids; | |
18645 | for (i = 0; i < cfg->line_outs; i++) { | |
18646 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); | |
18647 | if (!dac) | |
18648 | continue; | |
18649 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
18650 | } | |
18651 | return 0; | |
18652 | } | |
18653 | ||
18654 | static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, | |
18655 | hda_nid_t nid, unsigned int chs) | |
18656 | { | |
18657 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | |
18658 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | |
18659 | } | |
18660 | ||
18661 | static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, | |
18662 | hda_nid_t nid, unsigned int chs) | |
18663 | { | |
18664 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | |
18665 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); | |
18666 | } | |
18667 | ||
18668 | #define alc662_add_stereo_vol(spec, pfx, nid) \ | |
18669 | alc662_add_vol_ctl(spec, pfx, nid, 3) | |
18670 | #define alc662_add_stereo_sw(spec, pfx, nid) \ | |
18671 | alc662_add_sw_ctl(spec, pfx, nid, 3) | |
18672 | ||
18673 | /* add playback controls from the parsed DAC table */ | |
18674 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, | |
18675 | const struct auto_pin_cfg *cfg) | |
18676 | { | |
18677 | struct alc_spec *spec = codec->spec; | |
18678 | static const char *chname[4] = { | |
18679 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
18680 | }; | |
18681 | hda_nid_t nid, mix; | |
18682 | int i, err; | |
18683 | ||
18684 | for (i = 0; i < cfg->line_outs; i++) { | |
18685 | nid = spec->multiout.dac_nids[i]; | |
18686 | if (!nid) | |
18687 | continue; | |
18688 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); | |
18689 | if (!mix) | |
18690 | continue; | |
18691 | if (i == 2) { | |
18692 | /* Center/LFE */ | |
18693 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); | |
18694 | if (err < 0) | |
18695 | return err; | |
18696 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); | |
18697 | if (err < 0) | |
18698 | return err; | |
18699 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); | |
18700 | if (err < 0) | |
18701 | return err; | |
18702 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); | |
18703 | if (err < 0) | |
18704 | return err; | |
18705 | } else { | |
18706 | const char *pfx; | |
18707 | if (cfg->line_outs == 1 && | |
18708 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | |
18709 | if (cfg->hp_outs) | |
18710 | pfx = "Speaker"; | |
18711 | else | |
18712 | pfx = "PCM"; | |
18713 | } else | |
18714 | pfx = chname[i]; | |
18715 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); | |
18716 | if (err < 0) | |
18717 | return err; | |
18718 | if (cfg->line_outs == 1 && | |
18719 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
18720 | pfx = "Speaker"; | |
18721 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); | |
18722 | if (err < 0) | |
18723 | return err; | |
18724 | } | |
18725 | } | |
18726 | return 0; | |
18727 | } | |
18728 | ||
18729 | /* add playback controls for speaker and HP outputs */ | |
18730 | /* return DAC nid if any new DAC is assigned */ | |
18731 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |
18732 | const char *pfx) | |
18733 | { | |
18734 | struct alc_spec *spec = codec->spec; | |
18735 | hda_nid_t nid, mix; | |
18736 | int err; | |
18737 | ||
18738 | if (!pin) | |
18739 | return 0; | |
18740 | nid = alc662_look_for_dac(codec, pin); | |
18741 | if (!nid) { | |
18742 | /* the corresponding DAC is already occupied */ | |
18743 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) | |
18744 | return 0; /* no way */ | |
18745 | /* create a switch only */ | |
18746 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | |
18747 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
18748 | } | |
18749 | ||
18750 | mix = alc662_dac_to_mix(codec, pin, nid); | |
18751 | if (!mix) | |
18752 | return 0; | |
18753 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); | |
18754 | if (err < 0) | |
18755 | return err; | |
18756 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); | |
18757 | if (err < 0) | |
18758 | return err; | |
18759 | return nid; | |
18760 | } | |
18761 | ||
18762 | /* create playback/capture controls for input pins */ | |
18763 | #define alc662_auto_create_input_ctls \ | |
18764 | alc882_auto_create_input_ctls | |
18765 | ||
18766 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | |
18767 | hda_nid_t nid, int pin_type, | |
18768 | hda_nid_t dac) | |
18769 | { | |
18770 | int i, num; | |
18771 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; | |
18772 | ||
18773 | alc_set_pin_output(codec, nid, pin_type); | |
18774 | /* need the manual connection? */ | |
18775 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); | |
18776 | if (num <= 1) | |
18777 | return; | |
18778 | for (i = 0; i < num; i++) { | |
18779 | if (alc662_mix_to_dac(srcs[i]) != dac) | |
18780 | continue; | |
18781 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); | |
18782 | return; | |
18783 | } | |
18784 | } | |
18785 | ||
18786 | static void alc662_auto_init_multi_out(struct hda_codec *codec) | |
18787 | { | |
18788 | struct alc_spec *spec = codec->spec; | |
18789 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
18790 | int i; | |
18791 | ||
18792 | for (i = 0; i <= HDA_SIDE; i++) { | |
18793 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
18794 | if (nid) | |
18795 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, | |
18796 | spec->multiout.dac_nids[i]); | |
18797 | } | |
18798 | } | |
18799 | ||
18800 | static void alc662_auto_init_hp_out(struct hda_codec *codec) | |
18801 | { | |
18802 | struct alc_spec *spec = codec->spec; | |
18803 | hda_nid_t pin; | |
18804 | ||
18805 | pin = spec->autocfg.hp_pins[0]; | |
18806 | if (pin) | |
18807 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, | |
18808 | spec->multiout.hp_nid); | |
18809 | pin = spec->autocfg.speaker_pins[0]; | |
18810 | if (pin) | |
18811 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, | |
18812 | spec->multiout.extra_out_nid[0]); | |
18813 | } | |
18814 | ||
18815 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID | |
18816 | ||
18817 | static void alc662_auto_init_analog_input(struct hda_codec *codec) | |
18818 | { | |
18819 | struct alc_spec *spec = codec->spec; | |
18820 | int i; | |
18821 | ||
18822 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
18823 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
18824 | if (alc_is_input_pin(codec, nid)) { | |
18825 | alc_set_input_pin(codec, nid, i); | |
18826 | if (nid != ALC662_PIN_CD_NID && | |
18827 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
18828 | snd_hda_codec_write(codec, nid, 0, | |
18829 | AC_VERB_SET_AMP_GAIN_MUTE, | |
18830 | AMP_OUT_MUTE); | |
18831 | } | |
18832 | } | |
18833 | } | |
18834 | ||
18835 | #define alc662_auto_init_input_src alc882_auto_init_input_src | |
18836 | ||
18837 | static int alc662_parse_auto_config(struct hda_codec *codec) | |
18838 | { | |
18839 | struct alc_spec *spec = codec->spec; | |
18840 | int err; | |
18841 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; | |
18842 | ||
18843 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
18844 | alc662_ignore); | |
18845 | if (err < 0) | |
18846 | return err; | |
18847 | if (!spec->autocfg.line_outs) | |
18848 | return 0; /* can't find valid BIOS pin config */ | |
18849 | ||
18850 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); | |
18851 | if (err < 0) | |
18852 | return err; | |
18853 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); | |
18854 | if (err < 0) | |
18855 | return err; | |
18856 | err = alc662_auto_create_extra_out(codec, | |
18857 | spec->autocfg.speaker_pins[0], | |
18858 | "Speaker"); | |
18859 | if (err < 0) | |
18860 | return err; | |
18861 | if (err) | |
18862 | spec->multiout.extra_out_nid[0] = err; | |
18863 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], | |
18864 | "Headphone"); | |
18865 | if (err < 0) | |
18866 | return err; | |
18867 | if (err) | |
18868 | spec->multiout.hp_nid = err; | |
18869 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); | |
18870 | if (err < 0) | |
18871 | return err; | |
18872 | ||
18873 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
18874 | ||
18875 | alc_auto_parse_digital(codec); | |
18876 | ||
18877 | if (spec->kctls.list) | |
18878 | add_mixer(spec, spec->kctls.list); | |
18879 | ||
18880 | spec->num_mux_defs = 1; | |
18881 | spec->input_mux = &spec->private_imux[0]; | |
18882 | ||
18883 | add_verb(spec, alc662_init_verbs); | |
18884 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || | |
18885 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) | |
18886 | add_verb(spec, alc663_init_verbs); | |
18887 | ||
18888 | if (codec->vendor_id == 0x10ec0272) | |
18889 | add_verb(spec, alc272_init_verbs); | |
18890 | ||
18891 | err = alc_auto_add_mic_boost(codec); | |
18892 | if (err < 0) | |
18893 | return err; | |
18894 | ||
18895 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || | |
18896 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) | |
18897 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); | |
18898 | else | |
18899 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
18900 | ||
18901 | return 1; | |
18902 | } | |
18903 | ||
18904 | /* additional initialization for auto-configuration model */ | |
18905 | static void alc662_auto_init(struct hda_codec *codec) | |
18906 | { | |
18907 | struct alc_spec *spec = codec->spec; | |
18908 | alc662_auto_init_multi_out(codec); | |
18909 | alc662_auto_init_hp_out(codec); | |
18910 | alc662_auto_init_analog_input(codec); | |
18911 | alc662_auto_init_input_src(codec); | |
18912 | alc_auto_init_digital(codec); | |
18913 | if (spec->unsol_event) | |
18914 | alc_inithook(codec); | |
18915 | } | |
18916 | ||
18917 | static int patch_alc662(struct hda_codec *codec) | |
18918 | { | |
18919 | struct alc_spec *spec; | |
18920 | int err, board_config; | |
18921 | ||
18922 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
18923 | if (!spec) | |
18924 | return -ENOMEM; | |
18925 | ||
18926 | codec->spec = spec; | |
18927 | ||
18928 | alc_auto_parse_customize_define(codec); | |
18929 | ||
18930 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | |
18931 | ||
18932 | if (alc_read_coef_idx(codec, 0) == 0x8020) | |
18933 | alc_codec_rename(codec, "ALC661"); | |
18934 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && | |
18935 | codec->bus->pci->subsystem_vendor == 0x1025 && | |
18936 | spec->cdefine.platform_type == 1) | |
18937 | alc_codec_rename(codec, "ALC272X"); | |
18938 | ||
18939 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, | |
18940 | alc662_models, | |
18941 | alc662_cfg_tbl); | |
18942 | if (board_config < 0) { | |
18943 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
18944 | codec->chip_name); | |
18945 | board_config = ALC662_AUTO; | |
18946 | } | |
18947 | ||
18948 | if (board_config == ALC662_AUTO) { | |
18949 | /* automatic parse from the BIOS config */ | |
18950 | err = alc662_parse_auto_config(codec); | |
18951 | if (err < 0) { | |
18952 | alc_free(codec); | |
18953 | return err; | |
18954 | } else if (!err) { | |
18955 | printk(KERN_INFO | |
18956 | "hda_codec: Cannot set up configuration " | |
18957 | "from BIOS. Using base mode...\n"); | |
18958 | board_config = ALC662_3ST_2ch_DIG; | |
18959 | } | |
18960 | } | |
18961 | ||
18962 | if (has_cdefine_beep(codec)) { | |
18963 | err = snd_hda_attach_beep_device(codec, 0x1); | |
18964 | if (err < 0) { | |
18965 | alc_free(codec); | |
18966 | return err; | |
18967 | } | |
18968 | } | |
18969 | ||
18970 | if (board_config != ALC662_AUTO) | |
18971 | setup_preset(codec, &alc662_presets[board_config]); | |
18972 | ||
18973 | spec->stream_analog_playback = &alc662_pcm_analog_playback; | |
18974 | spec->stream_analog_capture = &alc662_pcm_analog_capture; | |
18975 | ||
18976 | spec->stream_digital_playback = &alc662_pcm_digital_playback; | |
18977 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | |
18978 | ||
18979 | if (!spec->adc_nids) { | |
18980 | spec->adc_nids = alc662_adc_nids; | |
18981 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | |
18982 | } | |
18983 | if (!spec->capsrc_nids) | |
18984 | spec->capsrc_nids = alc662_capsrc_nids; | |
18985 | ||
18986 | if (!spec->cap_mixer) | |
18987 | set_capture_mixer(codec); | |
18988 | ||
18989 | if (has_cdefine_beep(codec)) { | |
18990 | switch (codec->vendor_id) { | |
18991 | case 0x10ec0662: | |
18992 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
18993 | break; | |
18994 | case 0x10ec0272: | |
18995 | case 0x10ec0663: | |
18996 | case 0x10ec0665: | |
18997 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | |
18998 | break; | |
18999 | case 0x10ec0273: | |
19000 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); | |
19001 | break; | |
19002 | } | |
19003 | } | |
19004 | spec->vmaster_nid = 0x02; | |
19005 | ||
19006 | codec->patch_ops = alc_patch_ops; | |
19007 | if (board_config == ALC662_AUTO) | |
19008 | spec->init_hook = alc662_auto_init; | |
19009 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
19010 | if (!spec->loopback.amplist) | |
19011 | spec->loopback.amplist = alc662_loopbacks; | |
19012 | #endif | |
19013 | ||
19014 | return 0; | |
19015 | } | |
19016 | ||
19017 | static int patch_alc888(struct hda_codec *codec) | |
19018 | { | |
19019 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ | |
19020 | kfree(codec->chip_name); | |
19021 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | |
19022 | if (!codec->chip_name) { | |
19023 | alc_free(codec); | |
19024 | return -ENOMEM; | |
19025 | } | |
19026 | return patch_alc662(codec); | |
19027 | } | |
19028 | return patch_alc882(codec); | |
19029 | } | |
19030 | ||
19031 | /* | |
19032 | * ALC680 support | |
19033 | */ | |
19034 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID | |
19035 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID | |
19036 | #define alc680_modes alc260_modes | |
19037 | ||
19038 | static hda_nid_t alc680_dac_nids[3] = { | |
19039 | /* Lout1, Lout2, hp */ | |
19040 | 0x02, 0x03, 0x04 | |
19041 | }; | |
19042 | ||
19043 | static hda_nid_t alc680_adc_nids[3] = { | |
19044 | /* ADC0-2 */ | |
19045 | /* DMIC, MIC, Line-in*/ | |
19046 | 0x07, 0x08, 0x09 | |
19047 | }; | |
19048 | ||
19049 | /* | |
19050 | * Analog capture ADC cgange | |
19051 | */ | |
19052 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |
19053 | struct hda_codec *codec, | |
19054 | unsigned int stream_tag, | |
19055 | unsigned int format, | |
19056 | struct snd_pcm_substream *substream) | |
19057 | { | |
19058 | struct alc_spec *spec = codec->spec; | |
19059 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
19060 | unsigned int pre_mic, pre_line; | |
19061 | ||
19062 | pre_mic = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_MIC]); | |
19063 | pre_line = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_LINE]); | |
19064 | ||
19065 | spec->cur_adc_stream_tag = stream_tag; | |
19066 | spec->cur_adc_format = format; | |
19067 | ||
19068 | if (pre_mic || pre_line) { | |
19069 | if (pre_mic) | |
19070 | snd_hda_codec_setup_stream(codec, 0x08, stream_tag, 0, | |
19071 | format); | |
19072 | else | |
19073 | snd_hda_codec_setup_stream(codec, 0x09, stream_tag, 0, | |
19074 | format); | |
19075 | } else | |
19076 | snd_hda_codec_setup_stream(codec, 0x07, stream_tag, 0, format); | |
19077 | return 0; | |
19078 | } | |
19079 | ||
19080 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
19081 | struct hda_codec *codec, | |
19082 | struct snd_pcm_substream *substream) | |
19083 | { | |
19084 | snd_hda_codec_cleanup_stream(codec, 0x07); | |
19085 | snd_hda_codec_cleanup_stream(codec, 0x08); | |
19086 | snd_hda_codec_cleanup_stream(codec, 0x09); | |
19087 | return 0; | |
19088 | } | |
19089 | ||
19090 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { | |
19091 | .substreams = 1, /* can be overridden */ | |
19092 | .channels_min = 2, | |
19093 | .channels_max = 2, | |
19094 | /* NID is set in alc_build_pcms */ | |
19095 | .ops = { | |
19096 | .prepare = alc680_capture_pcm_prepare, | |
19097 | .cleanup = alc680_capture_pcm_cleanup | |
19098 | }, | |
19099 | }; | |
19100 | ||
19101 | static struct snd_kcontrol_new alc680_base_mixer[] = { | |
19102 | /* output mixer control */ | |
19103 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
19104 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
19105 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), | |
19106 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
19107 | HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT), | |
19108 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
19109 | HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT), | |
19110 | { } | |
19111 | }; | |
19112 | ||
19113 | static struct hda_bind_ctls alc680_bind_cap_vol = { | |
19114 | .ops = &snd_hda_bind_vol, | |
19115 | .values = { | |
19116 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), | |
19117 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
19118 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
19119 | 0 | |
19120 | }, | |
19121 | }; | |
19122 | ||
19123 | static struct hda_bind_ctls alc680_bind_cap_switch = { | |
19124 | .ops = &snd_hda_bind_sw, | |
19125 | .values = { | |
19126 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), | |
19127 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
19128 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
19129 | 0 | |
19130 | }, | |
19131 | }; | |
19132 | ||
19133 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { | |
19134 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), | |
19135 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), | |
19136 | { } /* end */ | |
19137 | }; | |
19138 | ||
19139 | /* | |
19140 | * generic initialization of ADC, input mixers and output mixers | |
19141 | */ | |
19142 | static struct hda_verb alc680_init_verbs[] = { | |
19143 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
19144 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
19145 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
19146 | ||
19147 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
19148 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
19149 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
19150 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
19151 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
19152 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
19153 | ||
19154 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19155 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19156 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19157 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19158 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19159 | ||
19160 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
19161 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
19162 | ||
19163 | { } | |
19164 | }; | |
19165 | ||
19166 | /* toggle speaker-output according to the hp-jack state */ | |
19167 | static void alc680_base_setup(struct hda_codec *codec) | |
19168 | { | |
19169 | struct alc_spec *spec = codec->spec; | |
19170 | ||
19171 | spec->autocfg.hp_pins[0] = 0x16; | |
19172 | spec->autocfg.speaker_pins[0] = 0x14; | |
19173 | spec->autocfg.speaker_pins[1] = 0x15; | |
19174 | spec->autocfg.input_pins[AUTO_PIN_MIC] = 0x18; | |
19175 | spec->autocfg.input_pins[AUTO_PIN_LINE] = 0x19; | |
19176 | } | |
19177 | ||
19178 | static void alc680_rec_autoswitch(struct hda_codec *codec) | |
19179 | { | |
19180 | struct alc_spec *spec = codec->spec; | |
19181 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
19182 | unsigned int present; | |
19183 | hda_nid_t new_adc; | |
19184 | ||
19185 | present = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_MIC]); | |
19186 | ||
19187 | new_adc = present ? 0x8 : 0x7; | |
19188 | __snd_hda_codec_cleanup_stream(codec, !present ? 0x8 : 0x7, 1); | |
19189 | snd_hda_codec_setup_stream(codec, new_adc, | |
19190 | spec->cur_adc_stream_tag, 0, | |
19191 | spec->cur_adc_format); | |
19192 | ||
19193 | } | |
19194 | ||
19195 | static void alc680_unsol_event(struct hda_codec *codec, | |
19196 | unsigned int res) | |
19197 | { | |
19198 | if ((res >> 26) == ALC880_HP_EVENT) | |
19199 | alc_automute_amp(codec); | |
19200 | if ((res >> 26) == ALC880_MIC_EVENT) | |
19201 | alc680_rec_autoswitch(codec); | |
19202 | } | |
19203 | ||
19204 | static void alc680_inithook(struct hda_codec *codec) | |
19205 | { | |
19206 | alc_automute_amp(codec); | |
19207 | alc680_rec_autoswitch(codec); | |
19208 | } | |
19209 | ||
19210 | /* create input playback/capture controls for the given pin */ | |
19211 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
19212 | const char *ctlname, int idx) | |
19213 | { | |
19214 | hda_nid_t dac; | |
19215 | int err; | |
19216 | ||
19217 | switch (nid) { | |
19218 | case 0x14: | |
19219 | dac = 0x02; | |
19220 | break; | |
19221 | case 0x15: | |
19222 | dac = 0x03; | |
19223 | break; | |
19224 | case 0x16: | |
19225 | dac = 0x04; | |
19226 | break; | |
19227 | default: | |
19228 | return 0; | |
19229 | } | |
19230 | if (spec->multiout.dac_nids[0] != dac && | |
19231 | spec->multiout.dac_nids[1] != dac) { | |
19232 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, | |
19233 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, | |
19234 | HDA_OUTPUT)); | |
19235 | if (err < 0) | |
19236 | return err; | |
19237 | ||
19238 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
19239 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | |
19240 | ||
19241 | if (err < 0) | |
19242 | return err; | |
19243 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
19244 | } | |
19245 | ||
19246 | return 0; | |
19247 | } | |
19248 | ||
19249 | /* add playback controls from the parsed DAC table */ | |
19250 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, | |
19251 | const struct auto_pin_cfg *cfg) | |
19252 | { | |
19253 | hda_nid_t nid; | |
19254 | int err; | |
19255 | ||
19256 | spec->multiout.dac_nids = spec->private_dac_nids; | |
19257 | ||
19258 | nid = cfg->line_out_pins[0]; | |
19259 | if (nid) { | |
19260 | const char *name; | |
19261 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
19262 | name = "Speaker"; | |
19263 | else | |
19264 | name = "Front"; | |
19265 | err = alc680_new_analog_output(spec, nid, name, 0); | |
19266 | if (err < 0) | |
19267 | return err; | |
19268 | } | |
19269 | ||
19270 | nid = cfg->speaker_pins[0]; | |
19271 | if (nid) { | |
19272 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); | |
19273 | if (err < 0) | |
19274 | return err; | |
19275 | } | |
19276 | nid = cfg->hp_pins[0]; | |
19277 | if (nid) { | |
19278 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); | |
19279 | if (err < 0) | |
19280 | return err; | |
19281 | } | |
19282 | ||
19283 | return 0; | |
19284 | } | |
19285 | ||
19286 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, | |
19287 | hda_nid_t nid, int pin_type) | |
19288 | { | |
19289 | alc_set_pin_output(codec, nid, pin_type); | |
19290 | } | |
19291 | ||
19292 | static void alc680_auto_init_multi_out(struct hda_codec *codec) | |
19293 | { | |
19294 | struct alc_spec *spec = codec->spec; | |
19295 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; | |
19296 | if (nid) { | |
19297 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
19298 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); | |
19299 | } | |
19300 | } | |
19301 | ||
19302 | static void alc680_auto_init_hp_out(struct hda_codec *codec) | |
19303 | { | |
19304 | struct alc_spec *spec = codec->spec; | |
19305 | hda_nid_t pin; | |
19306 | ||
19307 | pin = spec->autocfg.hp_pins[0]; | |
19308 | if (pin) | |
19309 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); | |
19310 | pin = spec->autocfg.speaker_pins[0]; | |
19311 | if (pin) | |
19312 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); | |
19313 | } | |
19314 | ||
19315 | /* pcm configuration: identical with ALC880 */ | |
19316 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback | |
19317 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture | |
19318 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture | |
19319 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback | |
19320 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture | |
19321 | ||
19322 | /* | |
19323 | * BIOS auto configuration | |
19324 | */ | |
19325 | static int alc680_parse_auto_config(struct hda_codec *codec) | |
19326 | { | |
19327 | struct alc_spec *spec = codec->spec; | |
19328 | int err; | |
19329 | static hda_nid_t alc680_ignore[] = { 0 }; | |
19330 | ||
19331 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
19332 | alc680_ignore); | |
19333 | if (err < 0) | |
19334 | return err; | |
19335 | ||
19336 | if (!spec->autocfg.line_outs) { | |
19337 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
19338 | spec->multiout.max_channels = 2; | |
19339 | spec->no_analog = 1; | |
19340 | goto dig_only; | |
19341 | } | |
19342 | return 0; /* can't find valid BIOS pin config */ | |
19343 | } | |
19344 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
19345 | if (err < 0) | |
19346 | return err; | |
19347 | ||
19348 | spec->multiout.max_channels = 2; | |
19349 | ||
19350 | dig_only: | |
19351 | /* digital only support output */ | |
19352 | alc_auto_parse_digital(codec); | |
19353 | if (spec->kctls.list) | |
19354 | add_mixer(spec, spec->kctls.list); | |
19355 | ||
19356 | add_verb(spec, alc680_init_verbs); | |
19357 | ||
19358 | err = alc_auto_add_mic_boost(codec); | |
19359 | if (err < 0) | |
19360 | return err; | |
19361 | ||
19362 | return 1; | |
19363 | } | |
19364 | ||
19365 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input | |
19366 | ||
19367 | /* init callback for auto-configuration model -- overriding the default init */ | |
19368 | static void alc680_auto_init(struct hda_codec *codec) | |
19369 | { | |
19370 | struct alc_spec *spec = codec->spec; | |
19371 | alc680_auto_init_multi_out(codec); | |
19372 | alc680_auto_init_hp_out(codec); | |
19373 | alc680_auto_init_analog_input(codec); | |
19374 | alc_auto_init_digital(codec); | |
19375 | if (spec->unsol_event) | |
19376 | alc_inithook(codec); | |
19377 | } | |
19378 | ||
19379 | /* | |
19380 | * configuration and preset | |
19381 | */ | |
19382 | static const char *alc680_models[ALC680_MODEL_LAST] = { | |
19383 | [ALC680_BASE] = "base", | |
19384 | [ALC680_AUTO] = "auto", | |
19385 | }; | |
19386 | ||
19387 | static struct snd_pci_quirk alc680_cfg_tbl[] = { | |
19388 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), | |
19389 | {} | |
19390 | }; | |
19391 | ||
19392 | static struct alc_config_preset alc680_presets[] = { | |
19393 | [ALC680_BASE] = { | |
19394 | .mixers = { alc680_base_mixer }, | |
19395 | .cap_mixer = alc680_master_capture_mixer, | |
19396 | .init_verbs = { alc680_init_verbs }, | |
19397 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), | |
19398 | .dac_nids = alc680_dac_nids, | |
19399 | .dig_out_nid = ALC680_DIGOUT_NID, | |
19400 | .num_channel_mode = ARRAY_SIZE(alc680_modes), | |
19401 | .channel_mode = alc680_modes, | |
19402 | .unsol_event = alc680_unsol_event, | |
19403 | .setup = alc680_base_setup, | |
19404 | .init_hook = alc680_inithook, | |
19405 | ||
19406 | }, | |
19407 | }; | |
19408 | ||
19409 | static int patch_alc680(struct hda_codec *codec) | |
19410 | { | |
19411 | struct alc_spec *spec; | |
19412 | int board_config; | |
19413 | int err; | |
19414 | ||
19415 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
19416 | if (spec == NULL) | |
19417 | return -ENOMEM; | |
19418 | ||
19419 | codec->spec = spec; | |
19420 | ||
19421 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, | |
19422 | alc680_models, | |
19423 | alc680_cfg_tbl); | |
19424 | ||
19425 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { | |
19426 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
19427 | codec->chip_name); | |
19428 | board_config = ALC680_AUTO; | |
19429 | } | |
19430 | ||
19431 | if (board_config == ALC680_AUTO) { | |
19432 | /* automatic parse from the BIOS config */ | |
19433 | err = alc680_parse_auto_config(codec); | |
19434 | if (err < 0) { | |
19435 | alc_free(codec); | |
19436 | return err; | |
19437 | } else if (!err) { | |
19438 | printk(KERN_INFO | |
19439 | "hda_codec: Cannot set up configuration " | |
19440 | "from BIOS. Using base mode...\n"); | |
19441 | board_config = ALC680_BASE; | |
19442 | } | |
19443 | } | |
19444 | ||
19445 | if (board_config != ALC680_AUTO) | |
19446 | setup_preset(codec, &alc680_presets[board_config]); | |
19447 | ||
19448 | spec->stream_analog_playback = &alc680_pcm_analog_playback; | |
19449 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; | |
19450 | spec->stream_digital_playback = &alc680_pcm_digital_playback; | |
19451 | spec->stream_digital_capture = &alc680_pcm_digital_capture; | |
19452 | ||
19453 | if (!spec->adc_nids) { | |
19454 | spec->adc_nids = alc680_adc_nids; | |
19455 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); | |
19456 | } | |
19457 | ||
19458 | if (!spec->cap_mixer) | |
19459 | set_capture_mixer(codec); | |
19460 | ||
19461 | spec->vmaster_nid = 0x02; | |
19462 | ||
19463 | codec->patch_ops = alc_patch_ops; | |
19464 | if (board_config == ALC680_AUTO) | |
19465 | spec->init_hook = alc680_auto_init; | |
19466 | ||
19467 | return 0; | |
19468 | } | |
19469 | ||
19470 | /* | |
19471 | * patch entries | |
19472 | */ | |
19473 | static struct hda_codec_preset snd_hda_preset_realtek[] = { | |
19474 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, | |
19475 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, | |
19476 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, | |
19477 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, | |
19478 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, | |
19479 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, | |
19480 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, | |
19481 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, | |
19482 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", | |
19483 | .patch = patch_alc861 }, | |
19484 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, | |
19485 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | |
19486 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | |
19487 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", | |
19488 | .patch = patch_alc882 }, | |
19489 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", | |
19490 | .patch = patch_alc662 }, | |
19491 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, | |
19492 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, | |
19493 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, | |
19494 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, | |
19495 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, | |
19496 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, | |
19497 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, | |
19498 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", | |
19499 | .patch = patch_alc882 }, | |
19500 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | |
19501 | .patch = patch_alc882 }, | |
19502 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | |
19503 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, | |
19504 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | |
19505 | .patch = patch_alc882 }, | |
19506 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, | |
19507 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, | |
19508 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, | |
19509 | {} /* terminator */ | |
19510 | }; | |
19511 | ||
19512 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); | |
19513 | ||
19514 | MODULE_LICENSE("GPL"); | |
19515 | MODULE_DESCRIPTION("Realtek HD-audio codec"); | |
19516 | ||
19517 | static struct hda_codec_preset_list realtek_list = { | |
19518 | .preset = snd_hda_preset_realtek, | |
19519 | .owner = THIS_MODULE, | |
19520 | }; | |
19521 | ||
19522 | static int __init patch_realtek_init(void) | |
19523 | { | |
19524 | return snd_hda_add_codec_preset(&realtek_list); | |
19525 | } | |
19526 | ||
19527 | static void __exit patch_realtek_exit(void) | |
19528 | { | |
19529 | snd_hda_delete_codec_preset(&realtek_list); | |
19530 | } | |
19531 | ||
19532 | module_init(patch_realtek_init) | |
19533 | module_exit(patch_realtek_exit) |