]>
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_ASUS_AMIC, | |
135 | ALC269_ASUS_DMIC, | |
136 | ALC269_FUJITSU, | |
137 | ALC269_LIFEBOOK, | |
138 | ALC269_AUTO, | |
139 | ALC269_MODEL_LAST /* last tag */ | |
140 | }; | |
141 | ||
142 | /* ALC861 models */ | |
143 | enum { | |
144 | ALC861_3ST, | |
145 | ALC660_3ST, | |
146 | ALC861_3ST_DIG, | |
147 | ALC861_6ST_DIG, | |
148 | ALC861_UNIWILL_M31, | |
149 | ALC861_TOSHIBA, | |
150 | ALC861_ASUS, | |
151 | ALC861_ASUS_LAPTOP, | |
152 | ALC861_AUTO, | |
153 | ALC861_MODEL_LAST, | |
154 | }; | |
155 | ||
156 | /* ALC861-VD models */ | |
157 | enum { | |
158 | ALC660VD_3ST, | |
159 | ALC660VD_3ST_DIG, | |
160 | ALC660VD_ASUS_V1S, | |
161 | ALC861VD_3ST, | |
162 | ALC861VD_3ST_DIG, | |
163 | ALC861VD_6ST_DIG, | |
164 | ALC861VD_LENOVO, | |
165 | ALC861VD_DALLAS, | |
166 | ALC861VD_HP, | |
167 | ALC861VD_AUTO, | |
168 | ALC861VD_MODEL_LAST, | |
169 | }; | |
170 | ||
171 | /* ALC662 models */ | |
172 | enum { | |
173 | ALC662_3ST_2ch_DIG, | |
174 | ALC662_3ST_6ch_DIG, | |
175 | ALC662_3ST_6ch, | |
176 | ALC662_5ST_DIG, | |
177 | ALC662_LENOVO_101E, | |
178 | ALC662_ASUS_EEEPC_P701, | |
179 | ALC662_ASUS_EEEPC_EP20, | |
180 | ALC663_ASUS_M51VA, | |
181 | ALC663_ASUS_G71V, | |
182 | ALC663_ASUS_H13, | |
183 | ALC663_ASUS_G50V, | |
184 | ALC662_ECS, | |
185 | ALC663_ASUS_MODE1, | |
186 | ALC662_ASUS_MODE2, | |
187 | ALC663_ASUS_MODE3, | |
188 | ALC663_ASUS_MODE4, | |
189 | ALC663_ASUS_MODE5, | |
190 | ALC663_ASUS_MODE6, | |
191 | ALC663_ASUS_MODE7, | |
192 | ALC663_ASUS_MODE8, | |
193 | ALC272_DELL, | |
194 | ALC272_DELL_ZM1, | |
195 | ALC272_SAMSUNG_NC10, | |
196 | ALC662_AUTO, | |
197 | ALC662_MODEL_LAST, | |
198 | }; | |
199 | ||
200 | /* ALC882 models */ | |
201 | enum { | |
202 | ALC882_3ST_DIG, | |
203 | ALC882_6ST_DIG, | |
204 | ALC882_ARIMA, | |
205 | ALC882_W2JC, | |
206 | ALC882_TARGA, | |
207 | ALC882_ASUS_A7J, | |
208 | ALC882_ASUS_A7M, | |
209 | ALC885_MACPRO, | |
210 | ALC885_MBP3, | |
211 | ALC885_MB5, | |
212 | ALC885_IMAC24, | |
213 | ALC885_IMAC91, | |
214 | ALC883_3ST_2ch_DIG, | |
215 | ALC883_3ST_6ch_DIG, | |
216 | ALC883_3ST_6ch, | |
217 | ALC883_6ST_DIG, | |
218 | ALC883_TARGA_DIG, | |
219 | ALC883_TARGA_2ch_DIG, | |
220 | ALC883_TARGA_8ch_DIG, | |
221 | ALC883_ACER, | |
222 | ALC883_ACER_ASPIRE, | |
223 | ALC888_ACER_ASPIRE_4930G, | |
224 | ALC888_ACER_ASPIRE_6530G, | |
225 | ALC888_ACER_ASPIRE_8930G, | |
226 | ALC888_ACER_ASPIRE_7730G, | |
227 | ALC883_MEDION, | |
228 | ALC883_MEDION_MD2, | |
229 | ALC883_LAPTOP_EAPD, | |
230 | ALC883_LENOVO_101E_2ch, | |
231 | ALC883_LENOVO_NB0763, | |
232 | ALC888_LENOVO_MS7195_DIG, | |
233 | ALC888_LENOVO_SKY, | |
234 | ALC883_HAIER_W66, | |
235 | ALC888_3ST_HP, | |
236 | ALC888_6ST_DELL, | |
237 | ALC883_MITAC, | |
238 | ALC883_CLEVO_M540R, | |
239 | ALC883_CLEVO_M720, | |
240 | ALC883_FUJITSU_PI2515, | |
241 | ALC888_FUJITSU_XA3530, | |
242 | ALC883_3ST_6ch_INTEL, | |
243 | ALC889A_INTEL, | |
244 | ALC889_INTEL, | |
245 | ALC888_ASUS_M90V, | |
246 | ALC888_ASUS_EEE1601, | |
247 | ALC889A_MB31, | |
248 | ALC1200_ASUS_P5Q, | |
249 | ALC883_SONY_VAIO_TT, | |
250 | ALC882_AUTO, | |
251 | ALC882_MODEL_LAST, | |
252 | }; | |
253 | ||
254 | /* for GPIO Poll */ | |
255 | #define GPIO_MASK 0x03 | |
256 | ||
257 | /* extra amp-initialization sequence types */ | |
258 | enum { | |
259 | ALC_INIT_NONE, | |
260 | ALC_INIT_DEFAULT, | |
261 | ALC_INIT_GPIO1, | |
262 | ALC_INIT_GPIO2, | |
263 | ALC_INIT_GPIO3, | |
264 | }; | |
265 | ||
266 | struct alc_mic_route { | |
267 | hda_nid_t pin; | |
268 | unsigned char mux_idx; | |
269 | unsigned char amix_idx; | |
270 | }; | |
271 | ||
272 | #define MUX_IDX_UNDEF ((unsigned char)-1) | |
273 | ||
274 | struct alc_spec { | |
275 | /* codec parameterization */ | |
276 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ | |
277 | unsigned int num_mixers; | |
278 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ | |
279 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ | |
280 | ||
281 | const struct hda_verb *init_verbs[10]; /* initialization verbs | |
282 | * don't forget NULL | |
283 | * termination! | |
284 | */ | |
285 | unsigned int num_init_verbs; | |
286 | ||
287 | char stream_name_analog[32]; /* analog PCM stream */ | |
288 | struct hda_pcm_stream *stream_analog_playback; | |
289 | struct hda_pcm_stream *stream_analog_capture; | |
290 | struct hda_pcm_stream *stream_analog_alt_playback; | |
291 | struct hda_pcm_stream *stream_analog_alt_capture; | |
292 | ||
293 | char stream_name_digital[32]; /* digital PCM stream */ | |
294 | struct hda_pcm_stream *stream_digital_playback; | |
295 | struct hda_pcm_stream *stream_digital_capture; | |
296 | ||
297 | /* playback */ | |
298 | struct hda_multi_out multiout; /* playback set-up | |
299 | * max_channels, dacs must be set | |
300 | * dig_out_nid and hp_nid are optional | |
301 | */ | |
302 | hda_nid_t alt_dac_nid; | |
303 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ | |
304 | int dig_out_type; | |
305 | ||
306 | /* capture */ | |
307 | unsigned int num_adc_nids; | |
308 | hda_nid_t *adc_nids; | |
309 | hda_nid_t *capsrc_nids; | |
310 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ | |
311 | ||
312 | /* capture source */ | |
313 | unsigned int num_mux_defs; | |
314 | const struct hda_input_mux *input_mux; | |
315 | unsigned int cur_mux[3]; | |
316 | struct alc_mic_route ext_mic; | |
317 | struct alc_mic_route int_mic; | |
318 | ||
319 | /* channel model */ | |
320 | const struct hda_channel_mode *channel_mode; | |
321 | int num_channel_mode; | |
322 | int need_dac_fix; | |
323 | int const_channel_count; | |
324 | int ext_channel_count; | |
325 | ||
326 | /* PCM information */ | |
327 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ | |
328 | ||
329 | /* dynamic controls, init_verbs and input_mux */ | |
330 | struct auto_pin_cfg autocfg; | |
331 | struct snd_array kctls; | |
332 | struct hda_input_mux private_imux[3]; | |
333 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; | |
334 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; | |
335 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; | |
336 | ||
337 | /* hooks */ | |
338 | void (*init_hook)(struct hda_codec *codec); | |
339 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | |
340 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
341 | void (*power_hook)(struct hda_codec *codec, int power); | |
342 | #endif | |
343 | ||
344 | /* for pin sensing */ | |
345 | unsigned int sense_updated: 1; | |
346 | unsigned int jack_present: 1; | |
347 | unsigned int master_sw: 1; | |
348 | unsigned int auto_mic:1; | |
349 | ||
350 | /* other flags */ | |
351 | unsigned int no_analog :1; /* digital I/O only */ | |
352 | int init_amp; | |
353 | ||
354 | /* for virtual master */ | |
355 | hda_nid_t vmaster_nid; | |
356 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
357 | struct hda_loopback_check loopback; | |
358 | #endif | |
359 | ||
360 | /* for PLL fix */ | |
361 | hda_nid_t pll_nid; | |
362 | unsigned int pll_coef_idx, pll_coef_bit; | |
363 | }; | |
364 | ||
365 | /* | |
366 | * configuration template - to be copied to the spec instance | |
367 | */ | |
368 | struct alc_config_preset { | |
369 | struct snd_kcontrol_new *mixers[5]; /* should be identical size | |
370 | * with spec | |
371 | */ | |
372 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ | |
373 | const struct hda_verb *init_verbs[5]; | |
374 | unsigned int num_dacs; | |
375 | hda_nid_t *dac_nids; | |
376 | hda_nid_t dig_out_nid; /* optional */ | |
377 | hda_nid_t hp_nid; /* optional */ | |
378 | hda_nid_t *slave_dig_outs; | |
379 | unsigned int num_adc_nids; | |
380 | hda_nid_t *adc_nids; | |
381 | hda_nid_t *capsrc_nids; | |
382 | hda_nid_t dig_in_nid; | |
383 | unsigned int num_channel_mode; | |
384 | const struct hda_channel_mode *channel_mode; | |
385 | int need_dac_fix; | |
386 | int const_channel_count; | |
387 | unsigned int num_mux_defs; | |
388 | const struct hda_input_mux *input_mux; | |
389 | void (*unsol_event)(struct hda_codec *, unsigned int); | |
390 | void (*setup)(struct hda_codec *); | |
391 | void (*init_hook)(struct hda_codec *); | |
392 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
393 | struct hda_amp_list *loopbacks; | |
394 | void (*power_hook)(struct hda_codec *codec, int power); | |
395 | #endif | |
396 | }; | |
397 | ||
398 | ||
399 | /* | |
400 | * input MUX handling | |
401 | */ | |
402 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, | |
403 | struct snd_ctl_elem_info *uinfo) | |
404 | { | |
405 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
406 | struct alc_spec *spec = codec->spec; | |
407 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); | |
408 | if (mux_idx >= spec->num_mux_defs) | |
409 | mux_idx = 0; | |
410 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); | |
411 | } | |
412 | ||
413 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, | |
414 | struct snd_ctl_elem_value *ucontrol) | |
415 | { | |
416 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
417 | struct alc_spec *spec = codec->spec; | |
418 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
419 | ||
420 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; | |
421 | return 0; | |
422 | } | |
423 | ||
424 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, | |
425 | struct snd_ctl_elem_value *ucontrol) | |
426 | { | |
427 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
428 | struct alc_spec *spec = codec->spec; | |
429 | const struct hda_input_mux *imux; | |
430 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
431 | unsigned int mux_idx; | |
432 | hda_nid_t nid = spec->capsrc_nids ? | |
433 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | |
434 | unsigned int type; | |
435 | ||
436 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | |
437 | imux = &spec->input_mux[mux_idx]; | |
438 | ||
439 | type = get_wcaps_type(get_wcaps(codec, nid)); | |
440 | if (type == AC_WID_AUD_MIX) { | |
441 | /* Matrix-mixer style (e.g. ALC882) */ | |
442 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | |
443 | unsigned int i, idx; | |
444 | ||
445 | idx = ucontrol->value.enumerated.item[0]; | |
446 | if (idx >= imux->num_items) | |
447 | idx = imux->num_items - 1; | |
448 | if (*cur_val == idx) | |
449 | return 0; | |
450 | for (i = 0; i < imux->num_items; i++) { | |
451 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | |
452 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | |
453 | imux->items[i].index, | |
454 | HDA_AMP_MUTE, v); | |
455 | } | |
456 | *cur_val = idx; | |
457 | return 1; | |
458 | } else { | |
459 | /* MUX style (e.g. ALC880) */ | |
460 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, | |
461 | &spec->cur_mux[adc_idx]); | |
462 | } | |
463 | } | |
464 | ||
465 | /* | |
466 | * channel mode setting | |
467 | */ | |
468 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, | |
469 | struct snd_ctl_elem_info *uinfo) | |
470 | { | |
471 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
472 | struct alc_spec *spec = codec->spec; | |
473 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, | |
474 | spec->num_channel_mode); | |
475 | } | |
476 | ||
477 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, | |
478 | struct snd_ctl_elem_value *ucontrol) | |
479 | { | |
480 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
481 | struct alc_spec *spec = codec->spec; | |
482 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, | |
483 | spec->num_channel_mode, | |
484 | spec->ext_channel_count); | |
485 | } | |
486 | ||
487 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, | |
488 | struct snd_ctl_elem_value *ucontrol) | |
489 | { | |
490 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
491 | struct alc_spec *spec = codec->spec; | |
492 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, | |
493 | spec->num_channel_mode, | |
494 | &spec->ext_channel_count); | |
495 | if (err >= 0 && !spec->const_channel_count) { | |
496 | spec->multiout.max_channels = spec->ext_channel_count; | |
497 | if (spec->need_dac_fix) | |
498 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; | |
499 | } | |
500 | return err; | |
501 | } | |
502 | ||
503 | /* | |
504 | * Control the mode of pin widget settings via the mixer. "pc" is used | |
505 | * instead of "%" to avoid consequences of accidently treating the % as | |
506 | * being part of a format specifier. Maximum allowed length of a value is | |
507 | * 63 characters plus NULL terminator. | |
508 | * | |
509 | * Note: some retasking pin complexes seem to ignore requests for input | |
510 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these | |
511 | * are requested. Therefore order this list so that this behaviour will not | |
512 | * cause problems when mixer clients move through the enum sequentially. | |
513 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of | |
514 | * March 2006. | |
515 | */ | |
516 | static char *alc_pin_mode_names[] = { | |
517 | "Mic 50pc bias", "Mic 80pc bias", | |
518 | "Line in", "Line out", "Headphone out", | |
519 | }; | |
520 | static unsigned char alc_pin_mode_values[] = { | |
521 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, | |
522 | }; | |
523 | /* The control can present all 5 options, or it can limit the options based | |
524 | * in the pin being assumed to be exclusively an input or an output pin. In | |
525 | * addition, "input" pins may or may not process the mic bias option | |
526 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to | |
527 | * accept requests for bias as of chip versions up to March 2006) and/or | |
528 | * wiring in the computer. | |
529 | */ | |
530 | #define ALC_PIN_DIR_IN 0x00 | |
531 | #define ALC_PIN_DIR_OUT 0x01 | |
532 | #define ALC_PIN_DIR_INOUT 0x02 | |
533 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | |
534 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | |
535 | ||
536 | /* Info about the pin modes supported by the different pin direction modes. | |
537 | * For each direction the minimum and maximum values are given. | |
538 | */ | |
539 | static signed char alc_pin_mode_dir_info[5][2] = { | |
540 | { 0, 2 }, /* ALC_PIN_DIR_IN */ | |
541 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ | |
542 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ | |
543 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ | |
544 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ | |
545 | }; | |
546 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) | |
547 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) | |
548 | #define alc_pin_mode_n_items(_dir) \ | |
549 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) | |
550 | ||
551 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, | |
552 | struct snd_ctl_elem_info *uinfo) | |
553 | { | |
554 | unsigned int item_num = uinfo->value.enumerated.item; | |
555 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
556 | ||
557 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
558 | uinfo->count = 1; | |
559 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); | |
560 | ||
561 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) | |
562 | item_num = alc_pin_mode_min(dir); | |
563 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); | |
564 | return 0; | |
565 | } | |
566 | ||
567 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, | |
568 | struct snd_ctl_elem_value *ucontrol) | |
569 | { | |
570 | unsigned int i; | |
571 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
572 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
573 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
574 | long *valp = ucontrol->value.integer.value; | |
575 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, | |
576 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
577 | 0x00); | |
578 | ||
579 | /* Find enumerated value for current pinctl setting */ | |
580 | i = alc_pin_mode_min(dir); | |
581 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) | |
582 | i++; | |
583 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); | |
584 | return 0; | |
585 | } | |
586 | ||
587 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, | |
588 | struct snd_ctl_elem_value *ucontrol) | |
589 | { | |
590 | signed int change; | |
591 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
592 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
593 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
594 | long val = *ucontrol->value.integer.value; | |
595 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, | |
596 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
597 | 0x00); | |
598 | ||
599 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) | |
600 | val = alc_pin_mode_min(dir); | |
601 | ||
602 | change = pinctl != alc_pin_mode_values[val]; | |
603 | if (change) { | |
604 | /* Set pin mode to that requested */ | |
605 | snd_hda_codec_write_cache(codec, nid, 0, | |
606 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
607 | alc_pin_mode_values[val]); | |
608 | ||
609 | /* Also enable the retasking pin's input/output as required | |
610 | * for the requested pin mode. Enum values of 2 or less are | |
611 | * input modes. | |
612 | * | |
613 | * Dynamically switching the input/output buffers probably | |
614 | * reduces noise slightly (particularly on input) so we'll | |
615 | * do it. However, having both input and output buffers | |
616 | * enabled simultaneously doesn't seem to be problematic if | |
617 | * this turns out to be necessary in the future. | |
618 | */ | |
619 | if (val <= 2) { | |
620 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
621 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
622 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | |
623 | HDA_AMP_MUTE, 0); | |
624 | } else { | |
625 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | |
626 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
627 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
628 | HDA_AMP_MUTE, 0); | |
629 | } | |
630 | } | |
631 | return change; | |
632 | } | |
633 | ||
634 | #define ALC_PIN_MODE(xname, nid, dir) \ | |
635 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
636 | .info = alc_pin_mode_info, \ | |
637 | .get = alc_pin_mode_get, \ | |
638 | .put = alc_pin_mode_put, \ | |
639 | .private_value = nid | (dir<<16) } | |
640 | ||
641 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged | |
642 | * together using a mask with more than one bit set. This control is | |
643 | * currently used only by the ALC260 test model. At this stage they are not | |
644 | * needed for any "production" models. | |
645 | */ | |
646 | #ifdef CONFIG_SND_DEBUG | |
647 | #define alc_gpio_data_info snd_ctl_boolean_mono_info | |
648 | ||
649 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, | |
650 | struct snd_ctl_elem_value *ucontrol) | |
651 | { | |
652 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
653 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
654 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
655 | long *valp = ucontrol->value.integer.value; | |
656 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
657 | AC_VERB_GET_GPIO_DATA, 0x00); | |
658 | ||
659 | *valp = (val & mask) != 0; | |
660 | return 0; | |
661 | } | |
662 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, | |
663 | struct snd_ctl_elem_value *ucontrol) | |
664 | { | |
665 | signed int change; | |
666 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
667 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
668 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
669 | long val = *ucontrol->value.integer.value; | |
670 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, | |
671 | AC_VERB_GET_GPIO_DATA, | |
672 | 0x00); | |
673 | ||
674 | /* Set/unset the masked GPIO bit(s) as needed */ | |
675 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); | |
676 | if (val == 0) | |
677 | gpio_data &= ~mask; | |
678 | else | |
679 | gpio_data |= mask; | |
680 | snd_hda_codec_write_cache(codec, nid, 0, | |
681 | AC_VERB_SET_GPIO_DATA, gpio_data); | |
682 | ||
683 | return change; | |
684 | } | |
685 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ | |
686 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
687 | .info = alc_gpio_data_info, \ | |
688 | .get = alc_gpio_data_get, \ | |
689 | .put = alc_gpio_data_put, \ | |
690 | .private_value = nid | (mask<<16) } | |
691 | #endif /* CONFIG_SND_DEBUG */ | |
692 | ||
693 | /* A switch control to allow the enabling of the digital IO pins on the | |
694 | * ALC260. This is incredibly simplistic; the intention of this control is | |
695 | * to provide something in the test model allowing digital outputs to be | |
696 | * identified if present. If models are found which can utilise these | |
697 | * outputs a more complete mixer control can be devised for those models if | |
698 | * necessary. | |
699 | */ | |
700 | #ifdef CONFIG_SND_DEBUG | |
701 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info | |
702 | ||
703 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, | |
704 | struct snd_ctl_elem_value *ucontrol) | |
705 | { | |
706 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
707 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
708 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
709 | long *valp = ucontrol->value.integer.value; | |
710 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
711 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); | |
712 | ||
713 | *valp = (val & mask) != 0; | |
714 | return 0; | |
715 | } | |
716 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, | |
717 | struct snd_ctl_elem_value *ucontrol) | |
718 | { | |
719 | signed int change; | |
720 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
721 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
722 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
723 | long val = *ucontrol->value.integer.value; | |
724 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | |
725 | AC_VERB_GET_DIGI_CONVERT_1, | |
726 | 0x00); | |
727 | ||
728 | /* Set/unset the masked control bit(s) as needed */ | |
729 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); | |
730 | if (val==0) | |
731 | ctrl_data &= ~mask; | |
732 | else | |
733 | ctrl_data |= mask; | |
734 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, | |
735 | ctrl_data); | |
736 | ||
737 | return change; | |
738 | } | |
739 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ | |
740 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
741 | .info = alc_spdif_ctrl_info, \ | |
742 | .get = alc_spdif_ctrl_get, \ | |
743 | .put = alc_spdif_ctrl_put, \ | |
744 | .private_value = nid | (mask<<16) } | |
745 | #endif /* CONFIG_SND_DEBUG */ | |
746 | ||
747 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. | |
748 | * Again, this is only used in the ALC26x test models to help identify when | |
749 | * the EAPD line must be asserted for features to work. | |
750 | */ | |
751 | #ifdef CONFIG_SND_DEBUG | |
752 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info | |
753 | ||
754 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, | |
755 | struct snd_ctl_elem_value *ucontrol) | |
756 | { | |
757 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
758 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
759 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
760 | long *valp = ucontrol->value.integer.value; | |
761 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
762 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); | |
763 | ||
764 | *valp = (val & mask) != 0; | |
765 | return 0; | |
766 | } | |
767 | ||
768 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, | |
769 | struct snd_ctl_elem_value *ucontrol) | |
770 | { | |
771 | int change; | |
772 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
773 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
774 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
775 | long val = *ucontrol->value.integer.value; | |
776 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | |
777 | AC_VERB_GET_EAPD_BTLENABLE, | |
778 | 0x00); | |
779 | ||
780 | /* Set/unset the masked control bit(s) as needed */ | |
781 | change = (!val ? 0 : mask) != (ctrl_data & mask); | |
782 | if (!val) | |
783 | ctrl_data &= ~mask; | |
784 | else | |
785 | ctrl_data |= mask; | |
786 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
787 | ctrl_data); | |
788 | ||
789 | return change; | |
790 | } | |
791 | ||
792 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ | |
793 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
794 | .info = alc_eapd_ctrl_info, \ | |
795 | .get = alc_eapd_ctrl_get, \ | |
796 | .put = alc_eapd_ctrl_put, \ | |
797 | .private_value = nid | (mask<<16) } | |
798 | #endif /* CONFIG_SND_DEBUG */ | |
799 | ||
800 | /* | |
801 | * set up the input pin config (depending on the given auto-pin type) | |
802 | */ | |
803 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, | |
804 | int auto_pin_type) | |
805 | { | |
806 | unsigned int val = PIN_IN; | |
807 | ||
808 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { | |
809 | unsigned int pincap; | |
810 | pincap = snd_hda_query_pin_caps(codec, nid); | |
811 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; | |
812 | if (pincap & AC_PINCAP_VREF_80) | |
813 | val = PIN_VREF80; | |
814 | else if (pincap & AC_PINCAP_VREF_50) | |
815 | val = PIN_VREF50; | |
816 | else if (pincap & AC_PINCAP_VREF_100) | |
817 | val = PIN_VREF100; | |
818 | else if (pincap & AC_PINCAP_VREF_GRD) | |
819 | val = PIN_VREFGRD; | |
820 | } | |
821 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); | |
822 | } | |
823 | ||
824 | /* | |
825 | */ | |
826 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) | |
827 | { | |
828 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) | |
829 | return; | |
830 | spec->mixers[spec->num_mixers++] = mix; | |
831 | } | |
832 | ||
833 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) | |
834 | { | |
835 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) | |
836 | return; | |
837 | spec->init_verbs[spec->num_init_verbs++] = verb; | |
838 | } | |
839 | ||
840 | #ifdef CONFIG_PROC_FS | |
841 | /* | |
842 | * hook for proc | |
843 | */ | |
844 | static void print_realtek_coef(struct snd_info_buffer *buffer, | |
845 | struct hda_codec *codec, hda_nid_t nid) | |
846 | { | |
847 | int coeff; | |
848 | ||
849 | if (nid != 0x20) | |
850 | return; | |
851 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); | |
852 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); | |
853 | coeff = snd_hda_codec_read(codec, nid, 0, | |
854 | AC_VERB_GET_COEF_INDEX, 0); | |
855 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); | |
856 | } | |
857 | #else | |
858 | #define print_realtek_coef NULL | |
859 | #endif | |
860 | ||
861 | /* | |
862 | * set up from the preset table | |
863 | */ | |
864 | static void setup_preset(struct hda_codec *codec, | |
865 | const struct alc_config_preset *preset) | |
866 | { | |
867 | struct alc_spec *spec = codec->spec; | |
868 | int i; | |
869 | ||
870 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | |
871 | add_mixer(spec, preset->mixers[i]); | |
872 | spec->cap_mixer = preset->cap_mixer; | |
873 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; | |
874 | i++) | |
875 | add_verb(spec, preset->init_verbs[i]); | |
876 | ||
877 | spec->channel_mode = preset->channel_mode; | |
878 | spec->num_channel_mode = preset->num_channel_mode; | |
879 | spec->need_dac_fix = preset->need_dac_fix; | |
880 | spec->const_channel_count = preset->const_channel_count; | |
881 | ||
882 | if (preset->const_channel_count) | |
883 | spec->multiout.max_channels = preset->const_channel_count; | |
884 | else | |
885 | spec->multiout.max_channels = spec->channel_mode[0].channels; | |
886 | spec->ext_channel_count = spec->channel_mode[0].channels; | |
887 | ||
888 | spec->multiout.num_dacs = preset->num_dacs; | |
889 | spec->multiout.dac_nids = preset->dac_nids; | |
890 | spec->multiout.dig_out_nid = preset->dig_out_nid; | |
891 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; | |
892 | spec->multiout.hp_nid = preset->hp_nid; | |
893 | ||
894 | spec->num_mux_defs = preset->num_mux_defs; | |
895 | if (!spec->num_mux_defs) | |
896 | spec->num_mux_defs = 1; | |
897 | spec->input_mux = preset->input_mux; | |
898 | ||
899 | spec->num_adc_nids = preset->num_adc_nids; | |
900 | spec->adc_nids = preset->adc_nids; | |
901 | spec->capsrc_nids = preset->capsrc_nids; | |
902 | spec->dig_in_nid = preset->dig_in_nid; | |
903 | ||
904 | spec->unsol_event = preset->unsol_event; | |
905 | spec->init_hook = preset->init_hook; | |
906 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
907 | spec->power_hook = preset->power_hook; | |
908 | spec->loopback.amplist = preset->loopbacks; | |
909 | #endif | |
910 | ||
911 | if (preset->setup) | |
912 | preset->setup(codec); | |
913 | } | |
914 | ||
915 | /* Enable GPIO mask and set output */ | |
916 | static struct hda_verb alc_gpio1_init_verbs[] = { | |
917 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
918 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
919 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
920 | { } | |
921 | }; | |
922 | ||
923 | static struct hda_verb alc_gpio2_init_verbs[] = { | |
924 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | |
925 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | |
926 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, | |
927 | { } | |
928 | }; | |
929 | ||
930 | static struct hda_verb alc_gpio3_init_verbs[] = { | |
931 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
932 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
933 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
934 | { } | |
935 | }; | |
936 | ||
937 | /* | |
938 | * Fix hardware PLL issue | |
939 | * On some codecs, the analog PLL gating control must be off while | |
940 | * the default value is 1. | |
941 | */ | |
942 | static void alc_fix_pll(struct hda_codec *codec) | |
943 | { | |
944 | struct alc_spec *spec = codec->spec; | |
945 | unsigned int val; | |
946 | ||
947 | if (!spec->pll_nid) | |
948 | return; | |
949 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
950 | spec->pll_coef_idx); | |
951 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, | |
952 | AC_VERB_GET_PROC_COEF, 0); | |
953 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
954 | spec->pll_coef_idx); | |
955 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, | |
956 | val & ~(1 << spec->pll_coef_bit)); | |
957 | } | |
958 | ||
959 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |
960 | unsigned int coef_idx, unsigned int coef_bit) | |
961 | { | |
962 | struct alc_spec *spec = codec->spec; | |
963 | spec->pll_nid = nid; | |
964 | spec->pll_coef_idx = coef_idx; | |
965 | spec->pll_coef_bit = coef_bit; | |
966 | alc_fix_pll(codec); | |
967 | } | |
968 | ||
969 | static void alc_automute_pin(struct hda_codec *codec) | |
970 | { | |
971 | struct alc_spec *spec = codec->spec; | |
972 | unsigned int nid = spec->autocfg.hp_pins[0]; | |
973 | int i; | |
974 | ||
975 | if (!nid) | |
976 | return; | |
977 | spec->jack_present = snd_hda_jack_detect(codec, nid); | |
978 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { | |
979 | nid = spec->autocfg.speaker_pins[i]; | |
980 | if (!nid) | |
981 | break; | |
982 | snd_hda_codec_write(codec, nid, 0, | |
983 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
984 | spec->jack_present ? 0 : PIN_OUT); | |
985 | } | |
986 | } | |
987 | ||
988 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, | |
989 | hda_nid_t nid) | |
990 | { | |
991 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | |
992 | int i, nums; | |
993 | ||
994 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); | |
995 | for (i = 0; i < nums; i++) | |
996 | if (conn[i] == nid) | |
997 | return i; | |
998 | return -1; | |
999 | } | |
1000 | ||
1001 | static void alc_mic_automute(struct hda_codec *codec) | |
1002 | { | |
1003 | struct alc_spec *spec = codec->spec; | |
1004 | struct alc_mic_route *dead, *alive; | |
1005 | unsigned int present, type; | |
1006 | hda_nid_t cap_nid; | |
1007 | ||
1008 | if (!spec->auto_mic) | |
1009 | return; | |
1010 | if (!spec->int_mic.pin || !spec->ext_mic.pin) | |
1011 | return; | |
1012 | if (snd_BUG_ON(!spec->adc_nids)) | |
1013 | return; | |
1014 | ||
1015 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; | |
1016 | ||
1017 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); | |
1018 | if (present) { | |
1019 | alive = &spec->ext_mic; | |
1020 | dead = &spec->int_mic; | |
1021 | } else { | |
1022 | alive = &spec->int_mic; | |
1023 | dead = &spec->ext_mic; | |
1024 | } | |
1025 | ||
1026 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); | |
1027 | if (type == AC_WID_AUD_MIX) { | |
1028 | /* Matrix-mixer style (e.g. ALC882) */ | |
1029 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | |
1030 | alive->mux_idx, | |
1031 | HDA_AMP_MUTE, 0); | |
1032 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | |
1033 | dead->mux_idx, | |
1034 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
1035 | } else { | |
1036 | /* MUX style (e.g. ALC880) */ | |
1037 | snd_hda_codec_write_cache(codec, cap_nid, 0, | |
1038 | AC_VERB_SET_CONNECT_SEL, | |
1039 | alive->mux_idx); | |
1040 | } | |
1041 | ||
1042 | /* FIXME: analog mixer */ | |
1043 | } | |
1044 | ||
1045 | /* unsolicited event for HP jack sensing */ | |
1046 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | |
1047 | { | |
1048 | if (codec->vendor_id == 0x10ec0880) | |
1049 | res >>= 28; | |
1050 | else | |
1051 | res >>= 26; | |
1052 | switch (res) { | |
1053 | case ALC880_HP_EVENT: | |
1054 | alc_automute_pin(codec); | |
1055 | break; | |
1056 | case ALC880_MIC_EVENT: | |
1057 | alc_mic_automute(codec); | |
1058 | break; | |
1059 | } | |
1060 | } | |
1061 | ||
1062 | static void alc_inithook(struct hda_codec *codec) | |
1063 | { | |
1064 | alc_automute_pin(codec); | |
1065 | alc_mic_automute(codec); | |
1066 | } | |
1067 | ||
1068 | /* additional initialization for ALC888 variants */ | |
1069 | static void alc888_coef_init(struct hda_codec *codec) | |
1070 | { | |
1071 | unsigned int tmp; | |
1072 | ||
1073 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); | |
1074 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
1075 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1076 | if ((tmp & 0xf0) == 0x20) | |
1077 | /* alc888S-VC */ | |
1078 | snd_hda_codec_read(codec, 0x20, 0, | |
1079 | AC_VERB_SET_PROC_COEF, 0x830); | |
1080 | else | |
1081 | /* alc888-VB */ | |
1082 | snd_hda_codec_read(codec, 0x20, 0, | |
1083 | AC_VERB_SET_PROC_COEF, 0x3030); | |
1084 | } | |
1085 | ||
1086 | static void alc889_coef_init(struct hda_codec *codec) | |
1087 | { | |
1088 | unsigned int tmp; | |
1089 | ||
1090 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1091 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
1092 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1093 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); | |
1094 | } | |
1095 | ||
1096 | static void alc_auto_init_amp(struct hda_codec *codec, int type) | |
1097 | { | |
1098 | unsigned int tmp; | |
1099 | ||
1100 | switch (type) { | |
1101 | case ALC_INIT_GPIO1: | |
1102 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); | |
1103 | break; | |
1104 | case ALC_INIT_GPIO2: | |
1105 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); | |
1106 | break; | |
1107 | case ALC_INIT_GPIO3: | |
1108 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); | |
1109 | break; | |
1110 | case ALC_INIT_DEFAULT: | |
1111 | switch (codec->vendor_id) { | |
1112 | case 0x10ec0260: | |
1113 | snd_hda_codec_write(codec, 0x0f, 0, | |
1114 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
1115 | snd_hda_codec_write(codec, 0x10, 0, | |
1116 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
1117 | break; | |
1118 | case 0x10ec0262: | |
1119 | case 0x10ec0267: | |
1120 | case 0x10ec0268: | |
1121 | case 0x10ec0269: | |
1122 | case 0x10ec0272: | |
1123 | case 0x10ec0660: | |
1124 | case 0x10ec0662: | |
1125 | case 0x10ec0663: | |
1126 | case 0x10ec0862: | |
1127 | case 0x10ec0889: | |
1128 | snd_hda_codec_write(codec, 0x14, 0, | |
1129 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
1130 | snd_hda_codec_write(codec, 0x15, 0, | |
1131 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
1132 | break; | |
1133 | } | |
1134 | switch (codec->vendor_id) { | |
1135 | case 0x10ec0260: | |
1136 | snd_hda_codec_write(codec, 0x1a, 0, | |
1137 | AC_VERB_SET_COEF_INDEX, 7); | |
1138 | tmp = snd_hda_codec_read(codec, 0x1a, 0, | |
1139 | AC_VERB_GET_PROC_COEF, 0); | |
1140 | snd_hda_codec_write(codec, 0x1a, 0, | |
1141 | AC_VERB_SET_COEF_INDEX, 7); | |
1142 | snd_hda_codec_write(codec, 0x1a, 0, | |
1143 | AC_VERB_SET_PROC_COEF, | |
1144 | tmp | 0x2010); | |
1145 | break; | |
1146 | case 0x10ec0262: | |
1147 | case 0x10ec0880: | |
1148 | case 0x10ec0882: | |
1149 | case 0x10ec0883: | |
1150 | case 0x10ec0885: | |
1151 | case 0x10ec0887: | |
1152 | case 0x10ec0889: | |
1153 | alc889_coef_init(codec); | |
1154 | break; | |
1155 | case 0x10ec0888: | |
1156 | alc888_coef_init(codec); | |
1157 | break; | |
1158 | case 0x10ec0267: | |
1159 | case 0x10ec0268: | |
1160 | snd_hda_codec_write(codec, 0x20, 0, | |
1161 | AC_VERB_SET_COEF_INDEX, 7); | |
1162 | tmp = snd_hda_codec_read(codec, 0x20, 0, | |
1163 | AC_VERB_GET_PROC_COEF, 0); | |
1164 | snd_hda_codec_write(codec, 0x20, 0, | |
1165 | AC_VERB_SET_COEF_INDEX, 7); | |
1166 | snd_hda_codec_write(codec, 0x20, 0, | |
1167 | AC_VERB_SET_PROC_COEF, | |
1168 | tmp | 0x3000); | |
1169 | break; | |
1170 | } | |
1171 | break; | |
1172 | } | |
1173 | } | |
1174 | ||
1175 | static void alc_init_auto_hp(struct hda_codec *codec) | |
1176 | { | |
1177 | struct alc_spec *spec = codec->spec; | |
1178 | ||
1179 | if (!spec->autocfg.hp_pins[0]) | |
1180 | return; | |
1181 | ||
1182 | if (!spec->autocfg.speaker_pins[0]) { | |
1183 | if (spec->autocfg.line_out_pins[0] && | |
1184 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) | |
1185 | spec->autocfg.speaker_pins[0] = | |
1186 | spec->autocfg.line_out_pins[0]; | |
1187 | else | |
1188 | return; | |
1189 | } | |
1190 | ||
1191 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", | |
1192 | spec->autocfg.hp_pins[0]); | |
1193 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, | |
1194 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
1195 | AC_USRSP_EN | ALC880_HP_EVENT); | |
1196 | spec->unsol_event = alc_sku_unsol_event; | |
1197 | } | |
1198 | ||
1199 | static void alc_init_auto_mic(struct hda_codec *codec) | |
1200 | { | |
1201 | struct alc_spec *spec = codec->spec; | |
1202 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
1203 | hda_nid_t fixed, ext; | |
1204 | int i; | |
1205 | ||
1206 | /* there must be only two mic inputs exclusively */ | |
1207 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) | |
1208 | if (cfg->input_pins[i]) | |
1209 | return; | |
1210 | ||
1211 | fixed = ext = 0; | |
1212 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { | |
1213 | hda_nid_t nid = cfg->input_pins[i]; | |
1214 | unsigned int defcfg; | |
1215 | if (!nid) | |
1216 | return; | |
1217 | defcfg = snd_hda_codec_get_pincfg(codec, nid); | |
1218 | switch (get_defcfg_connect(defcfg)) { | |
1219 | case AC_JACK_PORT_FIXED: | |
1220 | if (fixed) | |
1221 | return; /* already occupied */ | |
1222 | fixed = nid; | |
1223 | break; | |
1224 | case AC_JACK_PORT_COMPLEX: | |
1225 | if (ext) | |
1226 | return; /* already occupied */ | |
1227 | ext = nid; | |
1228 | break; | |
1229 | default: | |
1230 | return; /* invalid entry */ | |
1231 | } | |
1232 | } | |
1233 | if (!ext || !fixed) | |
1234 | return; | |
1235 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) | |
1236 | return; /* no unsol support */ | |
1237 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", | |
1238 | ext, fixed); | |
1239 | spec->ext_mic.pin = ext; | |
1240 | spec->int_mic.pin = fixed; | |
1241 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | |
1242 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | |
1243 | spec->auto_mic = 1; | |
1244 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, | |
1245 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
1246 | AC_USRSP_EN | ALC880_MIC_EVENT); | |
1247 | spec->unsol_event = alc_sku_unsol_event; | |
1248 | } | |
1249 | ||
1250 | /* check subsystem ID and set up device-specific initialization; | |
1251 | * return 1 if initialized, 0 if invalid SSID | |
1252 | */ | |
1253 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. | |
1254 | * 31 ~ 16 : Manufacture ID | |
1255 | * 15 ~ 8 : SKU ID | |
1256 | * 7 ~ 0 : Assembly ID | |
1257 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 | |
1258 | */ | |
1259 | static int alc_subsystem_id(struct hda_codec *codec, | |
1260 | hda_nid_t porta, hda_nid_t porte, | |
1261 | hda_nid_t portd) | |
1262 | { | |
1263 | unsigned int ass, tmp, i; | |
1264 | unsigned nid; | |
1265 | struct alc_spec *spec = codec->spec; | |
1266 | ||
1267 | ass = codec->subsystem_id & 0xffff; | |
1268 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) | |
1269 | goto do_sku; | |
1270 | ||
1271 | /* invalid SSID, check the special NID pin defcfg instead */ | |
1272 | /* | |
1273 | * 31~30 : port connectivity | |
1274 | * 29~21 : reserve | |
1275 | * 20 : PCBEEP input | |
1276 | * 19~16 : Check sum (15:1) | |
1277 | * 15~1 : Custom | |
1278 | * 0 : override | |
1279 | */ | |
1280 | nid = 0x1d; | |
1281 | if (codec->vendor_id == 0x10ec0260) | |
1282 | nid = 0x17; | |
1283 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
1284 | snd_printd("realtek: No valid SSID, " | |
1285 | "checking pincfg 0x%08x for NID 0x%x\n", | |
1286 | ass, nid); | |
1287 | if (!(ass & 1) && !(ass & 0x100000)) | |
1288 | return 0; | |
1289 | if ((ass >> 30) != 1) /* no physical connection */ | |
1290 | return 0; | |
1291 | ||
1292 | /* check sum */ | |
1293 | tmp = 0; | |
1294 | for (i = 1; i < 16; i++) { | |
1295 | if ((ass >> i) & 1) | |
1296 | tmp++; | |
1297 | } | |
1298 | if (((ass >> 16) & 0xf) != tmp) | |
1299 | return 0; | |
1300 | do_sku: | |
1301 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", | |
1302 | ass & 0xffff, codec->vendor_id); | |
1303 | /* | |
1304 | * 0 : override | |
1305 | * 1 : Swap Jack | |
1306 | * 2 : 0 --> Desktop, 1 --> Laptop | |
1307 | * 3~5 : External Amplifier control | |
1308 | * 7~6 : Reserved | |
1309 | */ | |
1310 | tmp = (ass & 0x38) >> 3; /* external Amp control */ | |
1311 | switch (tmp) { | |
1312 | case 1: | |
1313 | spec->init_amp = ALC_INIT_GPIO1; | |
1314 | break; | |
1315 | case 3: | |
1316 | spec->init_amp = ALC_INIT_GPIO2; | |
1317 | break; | |
1318 | case 7: | |
1319 | spec->init_amp = ALC_INIT_GPIO3; | |
1320 | break; | |
1321 | case 5: | |
1322 | spec->init_amp = ALC_INIT_DEFAULT; | |
1323 | break; | |
1324 | } | |
1325 | ||
1326 | /* is laptop or Desktop and enable the function "Mute internal speaker | |
1327 | * when the external headphone out jack is plugged" | |
1328 | */ | |
1329 | if (!(ass & 0x8000)) | |
1330 | return 1; | |
1331 | /* | |
1332 | * 10~8 : Jack location | |
1333 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered | |
1334 | * 14~13: Resvered | |
1335 | * 15 : 1 --> enable the function "Mute internal speaker | |
1336 | * when the external headphone out jack is plugged" | |
1337 | */ | |
1338 | if (!spec->autocfg.hp_pins[0]) { | |
1339 | hda_nid_t nid; | |
1340 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ | |
1341 | if (tmp == 0) | |
1342 | nid = porta; | |
1343 | else if (tmp == 1) | |
1344 | nid = porte; | |
1345 | else if (tmp == 2) | |
1346 | nid = portd; | |
1347 | else | |
1348 | return 1; | |
1349 | for (i = 0; i < spec->autocfg.line_outs; i++) | |
1350 | if (spec->autocfg.line_out_pins[i] == nid) | |
1351 | return 1; | |
1352 | spec->autocfg.hp_pins[0] = nid; | |
1353 | } | |
1354 | ||
1355 | alc_init_auto_hp(codec); | |
1356 | alc_init_auto_mic(codec); | |
1357 | return 1; | |
1358 | } | |
1359 | ||
1360 | static void alc_ssid_check(struct hda_codec *codec, | |
1361 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) | |
1362 | { | |
1363 | if (!alc_subsystem_id(codec, porta, porte, portd)) { | |
1364 | struct alc_spec *spec = codec->spec; | |
1365 | snd_printd("realtek: " | |
1366 | "Enable default setup for auto mode as fallback\n"); | |
1367 | spec->init_amp = ALC_INIT_DEFAULT; | |
1368 | alc_init_auto_hp(codec); | |
1369 | alc_init_auto_mic(codec); | |
1370 | } | |
1371 | } | |
1372 | ||
1373 | /* | |
1374 | * Fix-up pin default configurations and add default verbs | |
1375 | */ | |
1376 | ||
1377 | struct alc_pincfg { | |
1378 | hda_nid_t nid; | |
1379 | u32 val; | |
1380 | }; | |
1381 | ||
1382 | struct alc_fixup { | |
1383 | const struct alc_pincfg *pins; | |
1384 | const struct hda_verb *verbs; | |
1385 | }; | |
1386 | ||
1387 | static void alc_pick_fixup(struct hda_codec *codec, | |
1388 | const struct snd_pci_quirk *quirk, | |
1389 | const struct alc_fixup *fix) | |
1390 | { | |
1391 | const struct alc_pincfg *cfg; | |
1392 | ||
1393 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | |
1394 | if (!quirk) | |
1395 | return; | |
1396 | ||
1397 | fix += quirk->value; | |
1398 | cfg = fix->pins; | |
1399 | if (cfg) { | |
1400 | for (; cfg->nid; cfg++) | |
1401 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | |
1402 | } | |
1403 | if (fix->verbs) | |
1404 | add_verb(codec->spec, fix->verbs); | |
1405 | } | |
1406 | ||
1407 | static int alc_read_coef_idx(struct hda_codec *codec, | |
1408 | unsigned int coef_idx) | |
1409 | { | |
1410 | unsigned int val; | |
1411 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, | |
1412 | coef_idx); | |
1413 | val = snd_hda_codec_read(codec, 0x20, 0, | |
1414 | AC_VERB_GET_PROC_COEF, 0); | |
1415 | return val; | |
1416 | } | |
1417 | ||
1418 | /* | |
1419 | * ALC888 | |
1420 | */ | |
1421 | ||
1422 | /* | |
1423 | * 2ch mode | |
1424 | */ | |
1425 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { | |
1426 | /* Mic-in jack as mic in */ | |
1427 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1428 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1429 | /* Line-in jack as Line in */ | |
1430 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1431 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1432 | /* Line-Out as Front */ | |
1433 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1434 | { } /* end */ | |
1435 | }; | |
1436 | ||
1437 | /* | |
1438 | * 4ch mode | |
1439 | */ | |
1440 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { | |
1441 | /* Mic-in jack as mic in */ | |
1442 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1443 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1444 | /* Line-in jack as Surround */ | |
1445 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1446 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1447 | /* Line-Out as Front */ | |
1448 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1449 | { } /* end */ | |
1450 | }; | |
1451 | ||
1452 | /* | |
1453 | * 6ch mode | |
1454 | */ | |
1455 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { | |
1456 | /* Mic-in jack as CLFE */ | |
1457 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1458 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1459 | /* Line-in jack as Surround */ | |
1460 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1461 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1462 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ | |
1463 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1464 | { } /* end */ | |
1465 | }; | |
1466 | ||
1467 | /* | |
1468 | * 8ch mode | |
1469 | */ | |
1470 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { | |
1471 | /* Mic-in jack as CLFE */ | |
1472 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1473 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1474 | /* Line-in jack as Surround */ | |
1475 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1476 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1477 | /* Line-Out as Side */ | |
1478 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1479 | { } /* end */ | |
1480 | }; | |
1481 | ||
1482 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { | |
1483 | { 2, alc888_4ST_ch2_intel_init }, | |
1484 | { 4, alc888_4ST_ch4_intel_init }, | |
1485 | { 6, alc888_4ST_ch6_intel_init }, | |
1486 | { 8, alc888_4ST_ch8_intel_init }, | |
1487 | }; | |
1488 | ||
1489 | /* | |
1490 | * ALC888 Fujitsu Siemens Amillo xa3530 | |
1491 | */ | |
1492 | ||
1493 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { | |
1494 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1495 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1496 | /* Connect Internal HP to Front */ | |
1497 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1498 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1499 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1500 | /* Connect Bass HP to Front */ | |
1501 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1502 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1503 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1504 | /* Connect Line-Out side jack (SPDIF) to Side */ | |
1505 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1506 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1507 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1508 | /* Connect Mic jack to CLFE */ | |
1509 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1510 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1511 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
1512 | /* Connect Line-in jack to Surround */ | |
1513 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1514 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1515 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1516 | /* Connect HP out jack to Front */ | |
1517 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1518 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1519 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1520 | /* Enable unsolicited event for HP jack and Line-out jack */ | |
1521 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1522 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1523 | {} | |
1524 | }; | |
1525 | ||
1526 | static void alc_automute_amp(struct hda_codec *codec) | |
1527 | { | |
1528 | struct alc_spec *spec = codec->spec; | |
1529 | unsigned int mute; | |
1530 | hda_nid_t nid; | |
1531 | int i; | |
1532 | ||
1533 | spec->jack_present = 0; | |
1534 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { | |
1535 | nid = spec->autocfg.hp_pins[i]; | |
1536 | if (!nid) | |
1537 | break; | |
1538 | if (snd_hda_jack_detect(codec, nid)) { | |
1539 | spec->jack_present = 1; | |
1540 | break; | |
1541 | } | |
1542 | } | |
1543 | ||
1544 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; | |
1545 | /* Toggle internal speakers muting */ | |
1546 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { | |
1547 | nid = spec->autocfg.speaker_pins[i]; | |
1548 | if (!nid) | |
1549 | break; | |
1550 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
1551 | HDA_AMP_MUTE, mute); | |
1552 | } | |
1553 | } | |
1554 | ||
1555 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, | |
1556 | unsigned int res) | |
1557 | { | |
1558 | if (codec->vendor_id == 0x10ec0880) | |
1559 | res >>= 28; | |
1560 | else | |
1561 | res >>= 26; | |
1562 | if (res == ALC880_HP_EVENT) | |
1563 | alc_automute_amp(codec); | |
1564 | } | |
1565 | ||
1566 | static void alc889_automute_setup(struct hda_codec *codec) | |
1567 | { | |
1568 | struct alc_spec *spec = codec->spec; | |
1569 | ||
1570 | spec->autocfg.hp_pins[0] = 0x15; | |
1571 | spec->autocfg.speaker_pins[0] = 0x14; | |
1572 | spec->autocfg.speaker_pins[1] = 0x16; | |
1573 | spec->autocfg.speaker_pins[2] = 0x17; | |
1574 | spec->autocfg.speaker_pins[3] = 0x19; | |
1575 | spec->autocfg.speaker_pins[4] = 0x1a; | |
1576 | } | |
1577 | ||
1578 | static void alc889_intel_init_hook(struct hda_codec *codec) | |
1579 | { | |
1580 | alc889_coef_init(codec); | |
1581 | alc_automute_amp(codec); | |
1582 | } | |
1583 | ||
1584 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) | |
1585 | { | |
1586 | struct alc_spec *spec = codec->spec; | |
1587 | ||
1588 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ | |
1589 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ | |
1590 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ | |
1591 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ | |
1592 | } | |
1593 | ||
1594 | /* | |
1595 | * ALC888 Acer Aspire 4930G model | |
1596 | */ | |
1597 | ||
1598 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { | |
1599 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1600 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1601 | /* Unselect Front Mic by default in input mixer 3 */ | |
1602 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
1603 | /* Enable unsolicited event for HP jack */ | |
1604 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1605 | /* Connect Internal HP to front */ | |
1606 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1607 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1608 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1609 | /* Connect HP out to front */ | |
1610 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1611 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1612 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1613 | { } | |
1614 | }; | |
1615 | ||
1616 | /* | |
1617 | * ALC888 Acer Aspire 6530G model | |
1618 | */ | |
1619 | ||
1620 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { | |
1621 | /* Bias voltage on for external mic port */ | |
1622 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, | |
1623 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1624 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1625 | /* Unselect Front Mic by default in input mixer 3 */ | |
1626 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
1627 | /* Enable unsolicited event for HP jack */ | |
1628 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1629 | /* Enable speaker output */ | |
1630 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1631 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1632 | /* Enable headphone output */ | |
1633 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | |
1634 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1635 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1636 | { } | |
1637 | }; | |
1638 | ||
1639 | /* | |
1640 | * ALC889 Acer Aspire 8930G model | |
1641 | */ | |
1642 | ||
1643 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { | |
1644 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1645 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1646 | /* Unselect Front Mic by default in input mixer 3 */ | |
1647 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
1648 | /* Enable unsolicited event for HP jack */ | |
1649 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1650 | /* Connect Internal Front to Front */ | |
1651 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1652 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1653 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1654 | /* Connect Internal Rear to Rear */ | |
1655 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1656 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1657 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1658 | /* Connect Internal CLFE to CLFE */ | |
1659 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1660 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1661 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
1662 | /* Connect HP out to Front */ | |
1663 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | |
1664 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1665 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1666 | /* Enable all DACs */ | |
1667 | /* DAC DISABLE/MUTE 1? */ | |
1668 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ | |
1669 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, | |
1670 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | |
1671 | /* DAC DISABLE/MUTE 2? */ | |
1672 | /* some bit here disables the other DACs. Init=0x4900 */ | |
1673 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | |
1674 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | |
1675 | /* DMIC fix | |
1676 | * This laptop has a stereo digital microphone. The mics are only 1cm apart | |
1677 | * which makes the stereo useless. However, either the mic or the ALC889 | |
1678 | * makes the signal become a difference/sum signal instead of standard | |
1679 | * stereo, which is annoying. So instead we flip this bit which makes the | |
1680 | * codec replicate the sum signal to both channels, turning it into a | |
1681 | * normal mono mic. | |
1682 | */ | |
1683 | /* DMIC_CONTROL? Init value = 0x0001 */ | |
1684 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
1685 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, | |
1686 | { } | |
1687 | }; | |
1688 | ||
1689 | static struct hda_input_mux alc888_2_capture_sources[2] = { | |
1690 | /* Front mic only available on one ADC */ | |
1691 | { | |
1692 | .num_items = 4, | |
1693 | .items = { | |
1694 | { "Mic", 0x0 }, | |
1695 | { "Line", 0x2 }, | |
1696 | { "CD", 0x4 }, | |
1697 | { "Front Mic", 0xb }, | |
1698 | }, | |
1699 | }, | |
1700 | { | |
1701 | .num_items = 3, | |
1702 | .items = { | |
1703 | { "Mic", 0x0 }, | |
1704 | { "Line", 0x2 }, | |
1705 | { "CD", 0x4 }, | |
1706 | }, | |
1707 | } | |
1708 | }; | |
1709 | ||
1710 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { | |
1711 | /* Interal mic only available on one ADC */ | |
1712 | { | |
1713 | .num_items = 5, | |
1714 | .items = { | |
1715 | { "Ext Mic", 0x0 }, | |
1716 | { "Line In", 0x2 }, | |
1717 | { "CD", 0x4 }, | |
1718 | { "Input Mix", 0xa }, | |
1719 | { "Int Mic", 0xb }, | |
1720 | }, | |
1721 | }, | |
1722 | { | |
1723 | .num_items = 4, | |
1724 | .items = { | |
1725 | { "Ext Mic", 0x0 }, | |
1726 | { "Line In", 0x2 }, | |
1727 | { "CD", 0x4 }, | |
1728 | { "Input Mix", 0xa }, | |
1729 | }, | |
1730 | } | |
1731 | }; | |
1732 | ||
1733 | static struct hda_input_mux alc889_capture_sources[3] = { | |
1734 | /* Digital mic only available on first "ADC" */ | |
1735 | { | |
1736 | .num_items = 5, | |
1737 | .items = { | |
1738 | { "Mic", 0x0 }, | |
1739 | { "Line", 0x2 }, | |
1740 | { "CD", 0x4 }, | |
1741 | { "Front Mic", 0xb }, | |
1742 | { "Input Mix", 0xa }, | |
1743 | }, | |
1744 | }, | |
1745 | { | |
1746 | .num_items = 4, | |
1747 | .items = { | |
1748 | { "Mic", 0x0 }, | |
1749 | { "Line", 0x2 }, | |
1750 | { "CD", 0x4 }, | |
1751 | { "Input Mix", 0xa }, | |
1752 | }, | |
1753 | }, | |
1754 | { | |
1755 | .num_items = 4, | |
1756 | .items = { | |
1757 | { "Mic", 0x0 }, | |
1758 | { "Line", 0x2 }, | |
1759 | { "CD", 0x4 }, | |
1760 | { "Input Mix", 0xa }, | |
1761 | }, | |
1762 | } | |
1763 | }; | |
1764 | ||
1765 | static struct snd_kcontrol_new alc888_base_mixer[] = { | |
1766 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1767 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
1768 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1769 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
1770 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
1771 | HDA_OUTPUT), | |
1772 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
1773 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
1774 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1775 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
1776 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
1777 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
1778 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1779 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1780 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1781 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1782 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
1783 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1784 | { } /* end */ | |
1785 | }; | |
1786 | ||
1787 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { | |
1788 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1789 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
1790 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1791 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
1792 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
1793 | HDA_OUTPUT), | |
1794 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
1795 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
1796 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1797 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1798 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1799 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1800 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
1801 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1802 | { } /* end */ | |
1803 | }; | |
1804 | ||
1805 | ||
1806 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) | |
1807 | { | |
1808 | struct alc_spec *spec = codec->spec; | |
1809 | ||
1810 | spec->autocfg.hp_pins[0] = 0x15; | |
1811 | spec->autocfg.speaker_pins[0] = 0x14; | |
1812 | spec->autocfg.speaker_pins[1] = 0x16; | |
1813 | spec->autocfg.speaker_pins[2] = 0x17; | |
1814 | } | |
1815 | ||
1816 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) | |
1817 | { | |
1818 | struct alc_spec *spec = codec->spec; | |
1819 | ||
1820 | spec->autocfg.hp_pins[0] = 0x15; | |
1821 | spec->autocfg.speaker_pins[0] = 0x14; | |
1822 | spec->autocfg.speaker_pins[1] = 0x16; | |
1823 | spec->autocfg.speaker_pins[2] = 0x17; | |
1824 | } | |
1825 | ||
1826 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) | |
1827 | { | |
1828 | struct alc_spec *spec = codec->spec; | |
1829 | ||
1830 | spec->autocfg.hp_pins[0] = 0x15; | |
1831 | spec->autocfg.speaker_pins[0] = 0x14; | |
1832 | spec->autocfg.speaker_pins[1] = 0x16; | |
1833 | spec->autocfg.speaker_pins[2] = 0x1b; | |
1834 | } | |
1835 | ||
1836 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
1837 | static void alc889_power_eapd(struct hda_codec *codec, int power) | |
1838 | { | |
1839 | snd_hda_codec_write(codec, 0x14, 0, | |
1840 | AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0); | |
1841 | snd_hda_codec_write(codec, 0x15, 0, | |
1842 | AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0); | |
1843 | } | |
1844 | #endif | |
1845 | ||
1846 | /* | |
1847 | * ALC880 3-stack model | |
1848 | * | |
1849 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) | |
1850 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, | |
1851 | * F-Mic = 0x1b, HP = 0x19 | |
1852 | */ | |
1853 | ||
1854 | static hda_nid_t alc880_dac_nids[4] = { | |
1855 | /* front, rear, clfe, rear_surr */ | |
1856 | 0x02, 0x05, 0x04, 0x03 | |
1857 | }; | |
1858 | ||
1859 | static hda_nid_t alc880_adc_nids[3] = { | |
1860 | /* ADC0-2 */ | |
1861 | 0x07, 0x08, 0x09, | |
1862 | }; | |
1863 | ||
1864 | /* The datasheet says the node 0x07 is connected from inputs, | |
1865 | * but it shows zero connection in the real implementation on some devices. | |
1866 | * Note: this is a 915GAV bug, fixed on 915GLV | |
1867 | */ | |
1868 | static hda_nid_t alc880_adc_nids_alt[2] = { | |
1869 | /* ADC1-2 */ | |
1870 | 0x08, 0x09, | |
1871 | }; | |
1872 | ||
1873 | #define ALC880_DIGOUT_NID 0x06 | |
1874 | #define ALC880_DIGIN_NID 0x0a | |
1875 | ||
1876 | static struct hda_input_mux alc880_capture_source = { | |
1877 | .num_items = 4, | |
1878 | .items = { | |
1879 | { "Mic", 0x0 }, | |
1880 | { "Front Mic", 0x3 }, | |
1881 | { "Line", 0x2 }, | |
1882 | { "CD", 0x4 }, | |
1883 | }, | |
1884 | }; | |
1885 | ||
1886 | /* channel source setting (2/6 channel selection for 3-stack) */ | |
1887 | /* 2ch mode */ | |
1888 | static struct hda_verb alc880_threestack_ch2_init[] = { | |
1889 | /* set line-in to input, mute it */ | |
1890 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1891 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1892 | /* set mic-in to input vref 80%, mute it */ | |
1893 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1894 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1895 | { } /* end */ | |
1896 | }; | |
1897 | ||
1898 | /* 6ch mode */ | |
1899 | static struct hda_verb alc880_threestack_ch6_init[] = { | |
1900 | /* set line-in to output, unmute it */ | |
1901 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1902 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1903 | /* set mic-in to output, unmute it */ | |
1904 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1905 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1906 | { } /* end */ | |
1907 | }; | |
1908 | ||
1909 | static struct hda_channel_mode alc880_threestack_modes[2] = { | |
1910 | { 2, alc880_threestack_ch2_init }, | |
1911 | { 6, alc880_threestack_ch6_init }, | |
1912 | }; | |
1913 | ||
1914 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { | |
1915 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1916 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
1917 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
1918 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | |
1919 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
1920 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
1921 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
1922 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1923 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
1924 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1925 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1926 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1927 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1928 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1929 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
1930 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
1931 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), | |
1932 | { | |
1933 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1934 | .name = "Channel Mode", | |
1935 | .info = alc_ch_mode_info, | |
1936 | .get = alc_ch_mode_get, | |
1937 | .put = alc_ch_mode_put, | |
1938 | }, | |
1939 | { } /* end */ | |
1940 | }; | |
1941 | ||
1942 | /* capture mixer elements */ | |
1943 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, | |
1944 | struct snd_ctl_elem_info *uinfo) | |
1945 | { | |
1946 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
1947 | struct alc_spec *spec = codec->spec; | |
1948 | int err; | |
1949 | ||
1950 | mutex_lock(&codec->control_mutex); | |
1951 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, | |
1952 | HDA_INPUT); | |
1953 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); | |
1954 | mutex_unlock(&codec->control_mutex); | |
1955 | return err; | |
1956 | } | |
1957 | ||
1958 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |
1959 | unsigned int size, unsigned int __user *tlv) | |
1960 | { | |
1961 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
1962 | struct alc_spec *spec = codec->spec; | |
1963 | int err; | |
1964 | ||
1965 | mutex_lock(&codec->control_mutex); | |
1966 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, | |
1967 | HDA_INPUT); | |
1968 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); | |
1969 | mutex_unlock(&codec->control_mutex); | |
1970 | return err; | |
1971 | } | |
1972 | ||
1973 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, | |
1974 | struct snd_ctl_elem_value *ucontrol); | |
1975 | ||
1976 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, | |
1977 | struct snd_ctl_elem_value *ucontrol, | |
1978 | getput_call_t func) | |
1979 | { | |
1980 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
1981 | struct alc_spec *spec = codec->spec; | |
1982 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
1983 | int err; | |
1984 | ||
1985 | mutex_lock(&codec->control_mutex); | |
1986 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], | |
1987 | 3, 0, HDA_INPUT); | |
1988 | err = func(kcontrol, ucontrol); | |
1989 | mutex_unlock(&codec->control_mutex); | |
1990 | return err; | |
1991 | } | |
1992 | ||
1993 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, | |
1994 | struct snd_ctl_elem_value *ucontrol) | |
1995 | { | |
1996 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
1997 | snd_hda_mixer_amp_volume_get); | |
1998 | } | |
1999 | ||
2000 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, | |
2001 | struct snd_ctl_elem_value *ucontrol) | |
2002 | { | |
2003 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2004 | snd_hda_mixer_amp_volume_put); | |
2005 | } | |
2006 | ||
2007 | /* capture mixer elements */ | |
2008 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info | |
2009 | ||
2010 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, | |
2011 | struct snd_ctl_elem_value *ucontrol) | |
2012 | { | |
2013 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2014 | snd_hda_mixer_amp_switch_get); | |
2015 | } | |
2016 | ||
2017 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, | |
2018 | struct snd_ctl_elem_value *ucontrol) | |
2019 | { | |
2020 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2021 | snd_hda_mixer_amp_switch_put); | |
2022 | } | |
2023 | ||
2024 | #define _DEFINE_CAPMIX(num) \ | |
2025 | { \ | |
2026 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2027 | .name = "Capture Switch", \ | |
2028 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | |
2029 | .count = num, \ | |
2030 | .info = alc_cap_sw_info, \ | |
2031 | .get = alc_cap_sw_get, \ | |
2032 | .put = alc_cap_sw_put, \ | |
2033 | }, \ | |
2034 | { \ | |
2035 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2036 | .name = "Capture Volume", \ | |
2037 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | |
2038 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | |
2039 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ | |
2040 | .count = num, \ | |
2041 | .info = alc_cap_vol_info, \ | |
2042 | .get = alc_cap_vol_get, \ | |
2043 | .put = alc_cap_vol_put, \ | |
2044 | .tlv = { .c = alc_cap_vol_tlv }, \ | |
2045 | } | |
2046 | ||
2047 | #define _DEFINE_CAPSRC(num) \ | |
2048 | { \ | |
2049 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2050 | /* .name = "Capture Source", */ \ | |
2051 | .name = "Input Source", \ | |
2052 | .count = num, \ | |
2053 | .info = alc_mux_enum_info, \ | |
2054 | .get = alc_mux_enum_get, \ | |
2055 | .put = alc_mux_enum_put, \ | |
2056 | } | |
2057 | ||
2058 | #define DEFINE_CAPMIX(num) \ | |
2059 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | |
2060 | _DEFINE_CAPMIX(num), \ | |
2061 | _DEFINE_CAPSRC(num), \ | |
2062 | { } /* end */ \ | |
2063 | } | |
2064 | ||
2065 | #define DEFINE_CAPMIX_NOSRC(num) \ | |
2066 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ | |
2067 | _DEFINE_CAPMIX(num), \ | |
2068 | { } /* end */ \ | |
2069 | } | |
2070 | ||
2071 | /* up to three ADCs */ | |
2072 | DEFINE_CAPMIX(1); | |
2073 | DEFINE_CAPMIX(2); | |
2074 | DEFINE_CAPMIX(3); | |
2075 | DEFINE_CAPMIX_NOSRC(1); | |
2076 | DEFINE_CAPMIX_NOSRC(2); | |
2077 | DEFINE_CAPMIX_NOSRC(3); | |
2078 | ||
2079 | /* | |
2080 | * ALC880 5-stack model | |
2081 | * | |
2082 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), | |
2083 | * Side = 0x02 (0xd) | |
2084 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 | |
2085 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 | |
2086 | */ | |
2087 | ||
2088 | /* additional mixers to alc880_three_stack_mixer */ | |
2089 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { | |
2090 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2091 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), | |
2092 | { } /* end */ | |
2093 | }; | |
2094 | ||
2095 | /* channel source setting (6/8 channel selection for 5-stack) */ | |
2096 | /* 6ch mode */ | |
2097 | static struct hda_verb alc880_fivestack_ch6_init[] = { | |
2098 | /* set line-in to input, mute it */ | |
2099 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2100 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2101 | { } /* end */ | |
2102 | }; | |
2103 | ||
2104 | /* 8ch mode */ | |
2105 | static struct hda_verb alc880_fivestack_ch8_init[] = { | |
2106 | /* set line-in to output, unmute it */ | |
2107 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2108 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2109 | { } /* end */ | |
2110 | }; | |
2111 | ||
2112 | static struct hda_channel_mode alc880_fivestack_modes[2] = { | |
2113 | { 6, alc880_fivestack_ch6_init }, | |
2114 | { 8, alc880_fivestack_ch8_init }, | |
2115 | }; | |
2116 | ||
2117 | ||
2118 | /* | |
2119 | * ALC880 6-stack model | |
2120 | * | |
2121 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), | |
2122 | * Side = 0x05 (0x0f) | |
2123 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, | |
2124 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b | |
2125 | */ | |
2126 | ||
2127 | static hda_nid_t alc880_6st_dac_nids[4] = { | |
2128 | /* front, rear, clfe, rear_surr */ | |
2129 | 0x02, 0x03, 0x04, 0x05 | |
2130 | }; | |
2131 | ||
2132 | static struct hda_input_mux alc880_6stack_capture_source = { | |
2133 | .num_items = 4, | |
2134 | .items = { | |
2135 | { "Mic", 0x0 }, | |
2136 | { "Front Mic", 0x1 }, | |
2137 | { "Line", 0x2 }, | |
2138 | { "CD", 0x4 }, | |
2139 | }, | |
2140 | }; | |
2141 | ||
2142 | /* fixed 8-channels */ | |
2143 | static struct hda_channel_mode alc880_sixstack_modes[1] = { | |
2144 | { 8, NULL }, | |
2145 | }; | |
2146 | ||
2147 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { | |
2148 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2149 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2150 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2151 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2152 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2153 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2154 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2155 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2156 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
2157 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2158 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2159 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2160 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2161 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2162 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2164 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2165 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2166 | { | |
2167 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2168 | .name = "Channel Mode", | |
2169 | .info = alc_ch_mode_info, | |
2170 | .get = alc_ch_mode_get, | |
2171 | .put = alc_ch_mode_put, | |
2172 | }, | |
2173 | { } /* end */ | |
2174 | }; | |
2175 | ||
2176 | ||
2177 | /* | |
2178 | * ALC880 W810 model | |
2179 | * | |
2180 | * W810 has rear IO for: | |
2181 | * Front (DAC 02) | |
2182 | * Surround (DAC 03) | |
2183 | * Center/LFE (DAC 04) | |
2184 | * Digital out (06) | |
2185 | * | |
2186 | * The system also has a pair of internal speakers, and a headphone jack. | |
2187 | * These are both connected to Line2 on the codec, hence to DAC 02. | |
2188 | * | |
2189 | * There is a variable resistor to control the speaker or headphone | |
2190 | * volume. This is a hardware-only device without a software API. | |
2191 | * | |
2192 | * Plugging headphones in will disable the internal speakers. This is | |
2193 | * implemented in hardware, not via the driver using jack sense. In | |
2194 | * a similar fashion, plugging into the rear socket marked "front" will | |
2195 | * disable both the speakers and headphones. | |
2196 | * | |
2197 | * For input, there's a microphone jack, and an "audio in" jack. | |
2198 | * These may not do anything useful with this driver yet, because I | |
2199 | * haven't setup any initialization verbs for these yet... | |
2200 | */ | |
2201 | ||
2202 | static hda_nid_t alc880_w810_dac_nids[3] = { | |
2203 | /* front, rear/surround, clfe */ | |
2204 | 0x02, 0x03, 0x04 | |
2205 | }; | |
2206 | ||
2207 | /* fixed 6 channels */ | |
2208 | static struct hda_channel_mode alc880_w810_modes[1] = { | |
2209 | { 6, NULL } | |
2210 | }; | |
2211 | ||
2212 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ | |
2213 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { | |
2214 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2215 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2216 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2217 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2218 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2219 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2220 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2221 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2222 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
2223 | { } /* end */ | |
2224 | }; | |
2225 | ||
2226 | ||
2227 | /* | |
2228 | * Z710V model | |
2229 | * | |
2230 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) | |
2231 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), | |
2232 | * Line = 0x1a | |
2233 | */ | |
2234 | ||
2235 | static hda_nid_t alc880_z71v_dac_nids[1] = { | |
2236 | 0x02 | |
2237 | }; | |
2238 | #define ALC880_Z71V_HP_DAC 0x03 | |
2239 | ||
2240 | /* fixed 2 channels */ | |
2241 | static struct hda_channel_mode alc880_2_jack_modes[1] = { | |
2242 | { 2, NULL } | |
2243 | }; | |
2244 | ||
2245 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { | |
2246 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2247 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2248 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2249 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
2250 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2251 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2252 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2253 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2254 | { } /* end */ | |
2255 | }; | |
2256 | ||
2257 | ||
2258 | /* | |
2259 | * ALC880 F1734 model | |
2260 | * | |
2261 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) | |
2262 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 | |
2263 | */ | |
2264 | ||
2265 | static hda_nid_t alc880_f1734_dac_nids[1] = { | |
2266 | 0x03 | |
2267 | }; | |
2268 | #define ALC880_F1734_HP_DAC 0x02 | |
2269 | ||
2270 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { | |
2271 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2272 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2273 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2274 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2275 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2276 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2277 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2278 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2279 | { } /* end */ | |
2280 | }; | |
2281 | ||
2282 | static struct hda_input_mux alc880_f1734_capture_source = { | |
2283 | .num_items = 2, | |
2284 | .items = { | |
2285 | { "Mic", 0x1 }, | |
2286 | { "CD", 0x4 }, | |
2287 | }, | |
2288 | }; | |
2289 | ||
2290 | ||
2291 | /* | |
2292 | * ALC880 ASUS model | |
2293 | * | |
2294 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
2295 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
2296 | * Mic = 0x18, Line = 0x1a | |
2297 | */ | |
2298 | ||
2299 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ | |
2300 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ | |
2301 | ||
2302 | static struct snd_kcontrol_new alc880_asus_mixer[] = { | |
2303 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2304 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2305 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2306 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2307 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2308 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2309 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2310 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2311 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2312 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2313 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2314 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2315 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2316 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2317 | { | |
2318 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2319 | .name = "Channel Mode", | |
2320 | .info = alc_ch_mode_info, | |
2321 | .get = alc_ch_mode_get, | |
2322 | .put = alc_ch_mode_put, | |
2323 | }, | |
2324 | { } /* end */ | |
2325 | }; | |
2326 | ||
2327 | /* | |
2328 | * ALC880 ASUS W1V model | |
2329 | * | |
2330 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
2331 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
2332 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b | |
2333 | */ | |
2334 | ||
2335 | /* additional mixers to alc880_asus_mixer */ | |
2336 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { | |
2337 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
2338 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
2339 | { } /* end */ | |
2340 | }; | |
2341 | ||
2342 | /* TCL S700 */ | |
2343 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { | |
2344 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2345 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
2346 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
2347 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), | |
2348 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), | |
2349 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), | |
2350 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), | |
2351 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
2352 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
2353 | { } /* end */ | |
2354 | }; | |
2355 | ||
2356 | /* Uniwill */ | |
2357 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { | |
2358 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2359 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2360 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2361 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2362 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2363 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2364 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2365 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2366 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2367 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2368 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2369 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2370 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2371 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2372 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2373 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2374 | { | |
2375 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2376 | .name = "Channel Mode", | |
2377 | .info = alc_ch_mode_info, | |
2378 | .get = alc_ch_mode_get, | |
2379 | .put = alc_ch_mode_put, | |
2380 | }, | |
2381 | { } /* end */ | |
2382 | }; | |
2383 | ||
2384 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { | |
2385 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2386 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2387 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2388 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2389 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2390 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2391 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2392 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2393 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2394 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2395 | { } /* end */ | |
2396 | }; | |
2397 | ||
2398 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { | |
2399 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2400 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2401 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2402 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2403 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2404 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2405 | { } /* end */ | |
2406 | }; | |
2407 | ||
2408 | /* | |
2409 | * virtual master controls | |
2410 | */ | |
2411 | ||
2412 | /* | |
2413 | * slave controls for virtual master | |
2414 | */ | |
2415 | static const char *alc_slave_vols[] = { | |
2416 | "Front Playback Volume", | |
2417 | "Surround Playback Volume", | |
2418 | "Center Playback Volume", | |
2419 | "LFE Playback Volume", | |
2420 | "Side Playback Volume", | |
2421 | "Headphone Playback Volume", | |
2422 | "Speaker Playback Volume", | |
2423 | "Mono Playback Volume", | |
2424 | "Line-Out Playback Volume", | |
2425 | "PCM Playback Volume", | |
2426 | NULL, | |
2427 | }; | |
2428 | ||
2429 | static const char *alc_slave_sws[] = { | |
2430 | "Front Playback Switch", | |
2431 | "Surround Playback Switch", | |
2432 | "Center Playback Switch", | |
2433 | "LFE Playback Switch", | |
2434 | "Side Playback Switch", | |
2435 | "Headphone Playback Switch", | |
2436 | "Speaker Playback Switch", | |
2437 | "Mono Playback Switch", | |
2438 | "IEC958 Playback Switch", | |
2439 | "Line-Out Playback Switch", | |
2440 | "PCM Playback Switch", | |
2441 | NULL, | |
2442 | }; | |
2443 | ||
2444 | /* | |
2445 | * build control elements | |
2446 | */ | |
2447 | ||
2448 | static void alc_free_kctls(struct hda_codec *codec); | |
2449 | ||
2450 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | |
2451 | /* additional beep mixers; the actual parameters are overwritten at build */ | |
2452 | static struct snd_kcontrol_new alc_beep_mixer[] = { | |
2453 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), | |
2454 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), | |
2455 | { } /* end */ | |
2456 | }; | |
2457 | #endif | |
2458 | ||
2459 | static int alc_build_controls(struct hda_codec *codec) | |
2460 | { | |
2461 | struct alc_spec *spec = codec->spec; | |
2462 | int err; | |
2463 | int i; | |
2464 | ||
2465 | for (i = 0; i < spec->num_mixers; i++) { | |
2466 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | |
2467 | if (err < 0) | |
2468 | return err; | |
2469 | } | |
2470 | if (spec->cap_mixer) { | |
2471 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); | |
2472 | if (err < 0) | |
2473 | return err; | |
2474 | } | |
2475 | if (spec->multiout.dig_out_nid) { | |
2476 | err = snd_hda_create_spdif_out_ctls(codec, | |
2477 | spec->multiout.dig_out_nid); | |
2478 | if (err < 0) | |
2479 | return err; | |
2480 | if (!spec->no_analog) { | |
2481 | err = snd_hda_create_spdif_share_sw(codec, | |
2482 | &spec->multiout); | |
2483 | if (err < 0) | |
2484 | return err; | |
2485 | spec->multiout.share_spdif = 1; | |
2486 | } | |
2487 | } | |
2488 | if (spec->dig_in_nid) { | |
2489 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | |
2490 | if (err < 0) | |
2491 | return err; | |
2492 | } | |
2493 | ||
2494 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | |
2495 | /* create beep controls if needed */ | |
2496 | if (spec->beep_amp) { | |
2497 | struct snd_kcontrol_new *knew; | |
2498 | for (knew = alc_beep_mixer; knew->name; knew++) { | |
2499 | struct snd_kcontrol *kctl; | |
2500 | kctl = snd_ctl_new1(knew, codec); | |
2501 | if (!kctl) | |
2502 | return -ENOMEM; | |
2503 | kctl->private_value = spec->beep_amp; | |
2504 | err = snd_hda_ctl_add(codec, | |
2505 | get_amp_nid_(spec->beep_amp), kctl); | |
2506 | if (err < 0) | |
2507 | return err; | |
2508 | } | |
2509 | } | |
2510 | #endif | |
2511 | ||
2512 | /* if we have no master control, let's create it */ | |
2513 | if (!spec->no_analog && | |
2514 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | |
2515 | unsigned int vmaster_tlv[4]; | |
2516 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, | |
2517 | HDA_OUTPUT, vmaster_tlv); | |
2518 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", | |
2519 | vmaster_tlv, alc_slave_vols); | |
2520 | if (err < 0) | |
2521 | return err; | |
2522 | } | |
2523 | if (!spec->no_analog && | |
2524 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | |
2525 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", | |
2526 | NULL, alc_slave_sws); | |
2527 | if (err < 0) | |
2528 | return err; | |
2529 | } | |
2530 | ||
2531 | alc_free_kctls(codec); /* no longer needed */ | |
2532 | return 0; | |
2533 | } | |
2534 | ||
2535 | ||
2536 | /* | |
2537 | * initialize the codec volumes, etc | |
2538 | */ | |
2539 | ||
2540 | /* | |
2541 | * generic initialization of ADC, input mixers and output mixers | |
2542 | */ | |
2543 | static struct hda_verb alc880_volume_init_verbs[] = { | |
2544 | /* | |
2545 | * Unmute ADC0-2 and set the default input to mic-in | |
2546 | */ | |
2547 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2549 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2550 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2551 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2552 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2553 | ||
2554 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
2555 | * mixer widget | |
2556 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
2557 | * panel mic (mic 2) | |
2558 | */ | |
2559 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
2560 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
2561 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2562 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
2563 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
2564 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
2565 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
2566 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
2567 | ||
2568 | /* | |
2569 | * Set up output mixers (0x0c - 0x0f) | |
2570 | */ | |
2571 | /* set vol=0 to output mixers */ | |
2572 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2573 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2574 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2575 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2576 | /* set up input amps for analog loopback */ | |
2577 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
2578 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
2579 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2580 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
2581 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2582 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
2583 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2584 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
2585 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2586 | ||
2587 | { } | |
2588 | }; | |
2589 | ||
2590 | /* | |
2591 | * 3-stack pin configuration: | |
2592 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
2593 | */ | |
2594 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { | |
2595 | /* | |
2596 | * preset connection lists of input pins | |
2597 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
2598 | */ | |
2599 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
2600 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2601 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
2602 | ||
2603 | /* | |
2604 | * Set pin mode and muting | |
2605 | */ | |
2606 | /* set front pin widgets 0x14 for output */ | |
2607 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2608 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2609 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
2610 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2611 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2612 | /* Mic2 (as headphone out) for HP output */ | |
2613 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2614 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2615 | /* Line In pin widget for input */ | |
2616 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2617 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2618 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
2619 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2620 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2621 | /* CD pin widget for input */ | |
2622 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2623 | ||
2624 | { } | |
2625 | }; | |
2626 | ||
2627 | /* | |
2628 | * 5-stack pin configuration: | |
2629 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, | |
2630 | * line-in/side = 0x1a, f-mic = 0x1b | |
2631 | */ | |
2632 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { | |
2633 | /* | |
2634 | * preset connection lists of input pins | |
2635 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
2636 | */ | |
2637 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2638 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ | |
2639 | ||
2640 | /* | |
2641 | * Set pin mode and muting | |
2642 | */ | |
2643 | /* set pin widgets 0x14-0x17 for output */ | |
2644 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2645 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2646 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2647 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2648 | /* unmute pins for output (no gain on this amp) */ | |
2649 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2650 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2651 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2652 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2653 | ||
2654 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
2655 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2656 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2657 | /* Mic2 (as headphone out) for HP output */ | |
2658 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2659 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2660 | /* Line In pin widget for input */ | |
2661 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2662 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2663 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
2664 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2665 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2666 | /* CD pin widget for input */ | |
2667 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2668 | ||
2669 | { } | |
2670 | }; | |
2671 | ||
2672 | /* | |
2673 | * W810 pin configuration: | |
2674 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b | |
2675 | */ | |
2676 | static struct hda_verb alc880_pin_w810_init_verbs[] = { | |
2677 | /* hphone/speaker input selector: front DAC */ | |
2678 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, | |
2679 | ||
2680 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2681 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2682 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2683 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2684 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2685 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2686 | ||
2687 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2688 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2689 | ||
2690 | { } | |
2691 | }; | |
2692 | ||
2693 | /* | |
2694 | * Z71V pin configuration: | |
2695 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) | |
2696 | */ | |
2697 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { | |
2698 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2699 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2700 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2701 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2702 | ||
2703 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2704 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2705 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2706 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2707 | ||
2708 | { } | |
2709 | }; | |
2710 | ||
2711 | /* | |
2712 | * 6-stack pin configuration: | |
2713 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, | |
2714 | * f-mic = 0x19, line = 0x1a, HP = 0x1b | |
2715 | */ | |
2716 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { | |
2717 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2718 | ||
2719 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2720 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2721 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2722 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2723 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2724 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2725 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2726 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2727 | ||
2728 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2729 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2730 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2731 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2732 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2733 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2734 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2735 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2736 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2737 | ||
2738 | { } | |
2739 | }; | |
2740 | ||
2741 | /* | |
2742 | * Uniwill pin configuration: | |
2743 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, | |
2744 | * line = 0x1a | |
2745 | */ | |
2746 | static struct hda_verb alc880_uniwill_init_verbs[] = { | |
2747 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2748 | ||
2749 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2750 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2751 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2752 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2753 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2754 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2755 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2756 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2757 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
2758 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
2759 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
2760 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
2761 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
2762 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
2763 | ||
2764 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2765 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2766 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2767 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2768 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2769 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2770 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ | |
2771 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
2772 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2773 | ||
2774 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
2775 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
2776 | ||
2777 | { } | |
2778 | }; | |
2779 | ||
2780 | /* | |
2781 | * Uniwill P53 | |
2782 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, | |
2783 | */ | |
2784 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | |
2785 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2786 | ||
2787 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2788 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2789 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2790 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2791 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2792 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2793 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
2794 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
2795 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
2796 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
2797 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
2798 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
2799 | ||
2800 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2801 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2802 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2803 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2804 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2805 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2806 | ||
2807 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
2808 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, | |
2809 | ||
2810 | { } | |
2811 | }; | |
2812 | ||
2813 | static struct hda_verb alc880_beep_init_verbs[] = { | |
2814 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, | |
2815 | { } | |
2816 | }; | |
2817 | ||
2818 | /* auto-toggle front mic */ | |
2819 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) | |
2820 | { | |
2821 | unsigned int present; | |
2822 | unsigned char bits; | |
2823 | ||
2824 | present = snd_hda_jack_detect(codec, 0x18); | |
2825 | bits = present ? HDA_AMP_MUTE : 0; | |
2826 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
2827 | } | |
2828 | ||
2829 | static void alc880_uniwill_setup(struct hda_codec *codec) | |
2830 | { | |
2831 | struct alc_spec *spec = codec->spec; | |
2832 | ||
2833 | spec->autocfg.hp_pins[0] = 0x14; | |
2834 | spec->autocfg.speaker_pins[0] = 0x15; | |
2835 | spec->autocfg.speaker_pins[0] = 0x16; | |
2836 | } | |
2837 | ||
2838 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | |
2839 | { | |
2840 | alc_automute_amp(codec); | |
2841 | alc880_uniwill_mic_automute(codec); | |
2842 | } | |
2843 | ||
2844 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |
2845 | unsigned int res) | |
2846 | { | |
2847 | /* Looks like the unsol event is incompatible with the standard | |
2848 | * definition. 4bit tag is placed at 28 bit! | |
2849 | */ | |
2850 | switch (res >> 28) { | |
2851 | case ALC880_MIC_EVENT: | |
2852 | alc880_uniwill_mic_automute(codec); | |
2853 | break; | |
2854 | default: | |
2855 | alc_automute_amp_unsol_event(codec, res); | |
2856 | break; | |
2857 | } | |
2858 | } | |
2859 | ||
2860 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) | |
2861 | { | |
2862 | struct alc_spec *spec = codec->spec; | |
2863 | ||
2864 | spec->autocfg.hp_pins[0] = 0x14; | |
2865 | spec->autocfg.speaker_pins[0] = 0x15; | |
2866 | } | |
2867 | ||
2868 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | |
2869 | { | |
2870 | unsigned int present; | |
2871 | ||
2872 | present = snd_hda_codec_read(codec, 0x21, 0, | |
2873 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); | |
2874 | present &= HDA_AMP_VOLMASK; | |
2875 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, | |
2876 | HDA_AMP_VOLMASK, present); | |
2877 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, | |
2878 | HDA_AMP_VOLMASK, present); | |
2879 | } | |
2880 | ||
2881 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, | |
2882 | unsigned int res) | |
2883 | { | |
2884 | /* Looks like the unsol event is incompatible with the standard | |
2885 | * definition. 4bit tag is placed at 28 bit! | |
2886 | */ | |
2887 | if ((res >> 28) == ALC880_DCVOL_EVENT) | |
2888 | alc880_uniwill_p53_dcvol_automute(codec); | |
2889 | else | |
2890 | alc_automute_amp_unsol_event(codec, res); | |
2891 | } | |
2892 | ||
2893 | /* | |
2894 | * F1734 pin configuration: | |
2895 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 | |
2896 | */ | |
2897 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { | |
2898 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2899 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
2900 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2901 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2902 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2903 | ||
2904 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2905 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2906 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2907 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2908 | ||
2909 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2910 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2911 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
2912 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2913 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2914 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2915 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2916 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2917 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2918 | ||
2919 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
2920 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, | |
2921 | ||
2922 | { } | |
2923 | }; | |
2924 | ||
2925 | /* | |
2926 | * ASUS pin configuration: | |
2927 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a | |
2928 | */ | |
2929 | static struct hda_verb alc880_pin_asus_init_verbs[] = { | |
2930 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
2931 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2932 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2933 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2934 | ||
2935 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2936 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2937 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2938 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2939 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2940 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2941 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2942 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2943 | ||
2944 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2945 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2946 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2947 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2948 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2949 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2950 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2951 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2952 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2953 | ||
2954 | { } | |
2955 | }; | |
2956 | ||
2957 | /* Enable GPIO mask and set output */ | |
2958 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs | |
2959 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs | |
2960 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs | |
2961 | ||
2962 | /* Clevo m520g init */ | |
2963 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { | |
2964 | /* headphone output */ | |
2965 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2966 | /* line-out */ | |
2967 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2968 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2969 | /* Line-in */ | |
2970 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2971 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2972 | /* CD */ | |
2973 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2974 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2975 | /* Mic1 (rear panel) */ | |
2976 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2977 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2978 | /* Mic2 (front panel) */ | |
2979 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2980 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2981 | /* headphone */ | |
2982 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2983 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2984 | /* change to EAPD mode */ | |
2985 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2986 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
2987 | ||
2988 | { } | |
2989 | }; | |
2990 | ||
2991 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { | |
2992 | /* change to EAPD mode */ | |
2993 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2994 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
2995 | ||
2996 | /* Headphone output */ | |
2997 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2998 | /* Front output*/ | |
2999 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3000 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3001 | ||
3002 | /* Line In pin widget for input */ | |
3003 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3004 | /* CD pin widget for input */ | |
3005 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3006 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3007 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3008 | ||
3009 | /* change to EAPD mode */ | |
3010 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3011 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
3012 | ||
3013 | { } | |
3014 | }; | |
3015 | ||
3016 | /* | |
3017 | * LG m1 express dual | |
3018 | * | |
3019 | * Pin assignment: | |
3020 | * Rear Line-In/Out (blue): 0x14 | |
3021 | * Build-in Mic-In: 0x15 | |
3022 | * Speaker-out: 0x17 | |
3023 | * HP-Out (green): 0x1b | |
3024 | * Mic-In/Out (red): 0x19 | |
3025 | * SPDIF-Out: 0x1e | |
3026 | */ | |
3027 | ||
3028 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ | |
3029 | static hda_nid_t alc880_lg_dac_nids[3] = { | |
3030 | 0x05, 0x02, 0x03 | |
3031 | }; | |
3032 | ||
3033 | /* seems analog CD is not working */ | |
3034 | static struct hda_input_mux alc880_lg_capture_source = { | |
3035 | .num_items = 3, | |
3036 | .items = { | |
3037 | { "Mic", 0x1 }, | |
3038 | { "Line", 0x5 }, | |
3039 | { "Internal Mic", 0x6 }, | |
3040 | }, | |
3041 | }; | |
3042 | ||
3043 | /* 2,4,6 channel modes */ | |
3044 | static struct hda_verb alc880_lg_ch2_init[] = { | |
3045 | /* set line-in and mic-in to input */ | |
3046 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
3047 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
3048 | { } | |
3049 | }; | |
3050 | ||
3051 | static struct hda_verb alc880_lg_ch4_init[] = { | |
3052 | /* set line-in to out and mic-in to input */ | |
3053 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3054 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
3055 | { } | |
3056 | }; | |
3057 | ||
3058 | static struct hda_verb alc880_lg_ch6_init[] = { | |
3059 | /* set line-in and mic-in to output */ | |
3060 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3061 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3062 | { } | |
3063 | }; | |
3064 | ||
3065 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { | |
3066 | { 2, alc880_lg_ch2_init }, | |
3067 | { 4, alc880_lg_ch4_init }, | |
3068 | { 6, alc880_lg_ch6_init }, | |
3069 | }; | |
3070 | ||
3071 | static struct snd_kcontrol_new alc880_lg_mixer[] = { | |
3072 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
3073 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), | |
3074 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3075 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), | |
3076 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | |
3077 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
3078 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
3079 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
3080 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3081 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3082 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
3083 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
3084 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
3085 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
3086 | { | |
3087 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3088 | .name = "Channel Mode", | |
3089 | .info = alc_ch_mode_info, | |
3090 | .get = alc_ch_mode_get, | |
3091 | .put = alc_ch_mode_put, | |
3092 | }, | |
3093 | { } /* end */ | |
3094 | }; | |
3095 | ||
3096 | static struct hda_verb alc880_lg_init_verbs[] = { | |
3097 | /* set capture source to mic-in */ | |
3098 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3099 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3100 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3101 | /* mute all amp mixer inputs */ | |
3102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, | |
3103 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
3104 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
3105 | /* line-in to input */ | |
3106 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3107 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3108 | /* built-in mic */ | |
3109 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3110 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3111 | /* speaker-out */ | |
3112 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3113 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3114 | /* mic-in to input */ | |
3115 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3116 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3117 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3118 | /* HP-out */ | |
3119 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
3120 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3121 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3122 | /* jack sense */ | |
3123 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3124 | { } | |
3125 | }; | |
3126 | ||
3127 | /* toggle speaker-output according to the hp-jack state */ | |
3128 | static void alc880_lg_setup(struct hda_codec *codec) | |
3129 | { | |
3130 | struct alc_spec *spec = codec->spec; | |
3131 | ||
3132 | spec->autocfg.hp_pins[0] = 0x1b; | |
3133 | spec->autocfg.speaker_pins[0] = 0x17; | |
3134 | } | |
3135 | ||
3136 | /* | |
3137 | * LG LW20 | |
3138 | * | |
3139 | * Pin assignment: | |
3140 | * Speaker-out: 0x14 | |
3141 | * Mic-In: 0x18 | |
3142 | * Built-in Mic-In: 0x19 | |
3143 | * Line-In: 0x1b | |
3144 | * HP-Out: 0x1a | |
3145 | * SPDIF-Out: 0x1e | |
3146 | */ | |
3147 | ||
3148 | static struct hda_input_mux alc880_lg_lw_capture_source = { | |
3149 | .num_items = 3, | |
3150 | .items = { | |
3151 | { "Mic", 0x0 }, | |
3152 | { "Internal Mic", 0x1 }, | |
3153 | { "Line In", 0x2 }, | |
3154 | }, | |
3155 | }; | |
3156 | ||
3157 | #define alc880_lg_lw_modes alc880_threestack_modes | |
3158 | ||
3159 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { | |
3160 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3161 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
3162 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
3163 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | |
3164 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
3165 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
3166 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
3167 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
3168 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
3169 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
3170 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
3171 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3172 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
3173 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
3174 | { | |
3175 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3176 | .name = "Channel Mode", | |
3177 | .info = alc_ch_mode_info, | |
3178 | .get = alc_ch_mode_get, | |
3179 | .put = alc_ch_mode_put, | |
3180 | }, | |
3181 | { } /* end */ | |
3182 | }; | |
3183 | ||
3184 | static struct hda_verb alc880_lg_lw_init_verbs[] = { | |
3185 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3186 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
3187 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
3188 | ||
3189 | /* set capture source to mic-in */ | |
3190 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3191 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3192 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3193 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
3194 | /* speaker-out */ | |
3195 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3196 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3197 | /* HP-out */ | |
3198 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3199 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3200 | /* mic-in to input */ | |
3201 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3202 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3203 | /* built-in mic */ | |
3204 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3205 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3206 | /* jack sense */ | |
3207 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3208 | { } | |
3209 | }; | |
3210 | ||
3211 | /* toggle speaker-output according to the hp-jack state */ | |
3212 | static void alc880_lg_lw_setup(struct hda_codec *codec) | |
3213 | { | |
3214 | struct alc_spec *spec = codec->spec; | |
3215 | ||
3216 | spec->autocfg.hp_pins[0] = 0x1b; | |
3217 | spec->autocfg.speaker_pins[0] = 0x14; | |
3218 | } | |
3219 | ||
3220 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { | |
3221 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3222 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
3223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
3224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3225 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3226 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3227 | { } /* end */ | |
3228 | }; | |
3229 | ||
3230 | static struct hda_input_mux alc880_medion_rim_capture_source = { | |
3231 | .num_items = 2, | |
3232 | .items = { | |
3233 | { "Mic", 0x0 }, | |
3234 | { "Internal Mic", 0x1 }, | |
3235 | }, | |
3236 | }; | |
3237 | ||
3238 | static struct hda_verb alc880_medion_rim_init_verbs[] = { | |
3239 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3240 | ||
3241 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3242 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3243 | ||
3244 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3245 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3246 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3247 | /* Mic2 (as headphone out) for HP output */ | |
3248 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3249 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3250 | /* Internal Speaker */ | |
3251 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3252 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3253 | ||
3254 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3255 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3256 | ||
3257 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3258 | { } | |
3259 | }; | |
3260 | ||
3261 | /* toggle speaker-output according to the hp-jack state */ | |
3262 | static void alc880_medion_rim_automute(struct hda_codec *codec) | |
3263 | { | |
3264 | struct alc_spec *spec = codec->spec; | |
3265 | alc_automute_amp(codec); | |
3266 | /* toggle EAPD */ | |
3267 | if (spec->jack_present) | |
3268 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); | |
3269 | else | |
3270 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); | |
3271 | } | |
3272 | ||
3273 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | |
3274 | unsigned int res) | |
3275 | { | |
3276 | /* Looks like the unsol event is incompatible with the standard | |
3277 | * definition. 4bit tag is placed at 28 bit! | |
3278 | */ | |
3279 | if ((res >> 28) == ALC880_HP_EVENT) | |
3280 | alc880_medion_rim_automute(codec); | |
3281 | } | |
3282 | ||
3283 | static void alc880_medion_rim_setup(struct hda_codec *codec) | |
3284 | { | |
3285 | struct alc_spec *spec = codec->spec; | |
3286 | ||
3287 | spec->autocfg.hp_pins[0] = 0x14; | |
3288 | spec->autocfg.speaker_pins[0] = 0x1b; | |
3289 | } | |
3290 | ||
3291 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3292 | static struct hda_amp_list alc880_loopbacks[] = { | |
3293 | { 0x0b, HDA_INPUT, 0 }, | |
3294 | { 0x0b, HDA_INPUT, 1 }, | |
3295 | { 0x0b, HDA_INPUT, 2 }, | |
3296 | { 0x0b, HDA_INPUT, 3 }, | |
3297 | { 0x0b, HDA_INPUT, 4 }, | |
3298 | { } /* end */ | |
3299 | }; | |
3300 | ||
3301 | static struct hda_amp_list alc880_lg_loopbacks[] = { | |
3302 | { 0x0b, HDA_INPUT, 1 }, | |
3303 | { 0x0b, HDA_INPUT, 6 }, | |
3304 | { 0x0b, HDA_INPUT, 7 }, | |
3305 | { } /* end */ | |
3306 | }; | |
3307 | #endif | |
3308 | ||
3309 | /* | |
3310 | * Common callbacks | |
3311 | */ | |
3312 | ||
3313 | static int alc_init(struct hda_codec *codec) | |
3314 | { | |
3315 | struct alc_spec *spec = codec->spec; | |
3316 | unsigned int i; | |
3317 | ||
3318 | alc_fix_pll(codec); | |
3319 | alc_auto_init_amp(codec, spec->init_amp); | |
3320 | ||
3321 | for (i = 0; i < spec->num_init_verbs; i++) | |
3322 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | |
3323 | ||
3324 | if (spec->init_hook) | |
3325 | spec->init_hook(codec); | |
3326 | ||
3327 | return 0; | |
3328 | } | |
3329 | ||
3330 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) | |
3331 | { | |
3332 | struct alc_spec *spec = codec->spec; | |
3333 | ||
3334 | if (spec->unsol_event) | |
3335 | spec->unsol_event(codec, res); | |
3336 | } | |
3337 | ||
3338 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3339 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) | |
3340 | { | |
3341 | struct alc_spec *spec = codec->spec; | |
3342 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); | |
3343 | } | |
3344 | #endif | |
3345 | ||
3346 | /* | |
3347 | * Analog playback callbacks | |
3348 | */ | |
3349 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
3350 | struct hda_codec *codec, | |
3351 | struct snd_pcm_substream *substream) | |
3352 | { | |
3353 | struct alc_spec *spec = codec->spec; | |
3354 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, | |
3355 | hinfo); | |
3356 | } | |
3357 | ||
3358 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3359 | struct hda_codec *codec, | |
3360 | unsigned int stream_tag, | |
3361 | unsigned int format, | |
3362 | struct snd_pcm_substream *substream) | |
3363 | { | |
3364 | struct alc_spec *spec = codec->spec; | |
3365 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, | |
3366 | stream_tag, format, substream); | |
3367 | } | |
3368 | ||
3369 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3370 | struct hda_codec *codec, | |
3371 | struct snd_pcm_substream *substream) | |
3372 | { | |
3373 | struct alc_spec *spec = codec->spec; | |
3374 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | |
3375 | } | |
3376 | ||
3377 | /* | |
3378 | * Digital out | |
3379 | */ | |
3380 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
3381 | struct hda_codec *codec, | |
3382 | struct snd_pcm_substream *substream) | |
3383 | { | |
3384 | struct alc_spec *spec = codec->spec; | |
3385 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | |
3386 | } | |
3387 | ||
3388 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3389 | struct hda_codec *codec, | |
3390 | unsigned int stream_tag, | |
3391 | unsigned int format, | |
3392 | struct snd_pcm_substream *substream) | |
3393 | { | |
3394 | struct alc_spec *spec = codec->spec; | |
3395 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, | |
3396 | stream_tag, format, substream); | |
3397 | } | |
3398 | ||
3399 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3400 | struct hda_codec *codec, | |
3401 | struct snd_pcm_substream *substream) | |
3402 | { | |
3403 | struct alc_spec *spec = codec->spec; | |
3404 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); | |
3405 | } | |
3406 | ||
3407 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, | |
3408 | struct hda_codec *codec, | |
3409 | struct snd_pcm_substream *substream) | |
3410 | { | |
3411 | struct alc_spec *spec = codec->spec; | |
3412 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | |
3413 | } | |
3414 | ||
3415 | /* | |
3416 | * Analog capture | |
3417 | */ | |
3418 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3419 | struct hda_codec *codec, | |
3420 | unsigned int stream_tag, | |
3421 | unsigned int format, | |
3422 | struct snd_pcm_substream *substream) | |
3423 | { | |
3424 | struct alc_spec *spec = codec->spec; | |
3425 | ||
3426 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], | |
3427 | stream_tag, 0, format); | |
3428 | return 0; | |
3429 | } | |
3430 | ||
3431 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3432 | struct hda_codec *codec, | |
3433 | struct snd_pcm_substream *substream) | |
3434 | { | |
3435 | struct alc_spec *spec = codec->spec; | |
3436 | ||
3437 | snd_hda_codec_cleanup_stream(codec, | |
3438 | spec->adc_nids[substream->number + 1]); | |
3439 | return 0; | |
3440 | } | |
3441 | ||
3442 | ||
3443 | /* | |
3444 | */ | |
3445 | static struct hda_pcm_stream alc880_pcm_analog_playback = { | |
3446 | .substreams = 1, | |
3447 | .channels_min = 2, | |
3448 | .channels_max = 8, | |
3449 | /* NID is set in alc_build_pcms */ | |
3450 | .ops = { | |
3451 | .open = alc880_playback_pcm_open, | |
3452 | .prepare = alc880_playback_pcm_prepare, | |
3453 | .cleanup = alc880_playback_pcm_cleanup | |
3454 | }, | |
3455 | }; | |
3456 | ||
3457 | static struct hda_pcm_stream alc880_pcm_analog_capture = { | |
3458 | .substreams = 1, | |
3459 | .channels_min = 2, | |
3460 | .channels_max = 2, | |
3461 | /* NID is set in alc_build_pcms */ | |
3462 | }; | |
3463 | ||
3464 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { | |
3465 | .substreams = 1, | |
3466 | .channels_min = 2, | |
3467 | .channels_max = 2, | |
3468 | /* NID is set in alc_build_pcms */ | |
3469 | }; | |
3470 | ||
3471 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { | |
3472 | .substreams = 2, /* can be overridden */ | |
3473 | .channels_min = 2, | |
3474 | .channels_max = 2, | |
3475 | /* NID is set in alc_build_pcms */ | |
3476 | .ops = { | |
3477 | .prepare = alc880_alt_capture_pcm_prepare, | |
3478 | .cleanup = alc880_alt_capture_pcm_cleanup | |
3479 | }, | |
3480 | }; | |
3481 | ||
3482 | static struct hda_pcm_stream alc880_pcm_digital_playback = { | |
3483 | .substreams = 1, | |
3484 | .channels_min = 2, | |
3485 | .channels_max = 2, | |
3486 | /* NID is set in alc_build_pcms */ | |
3487 | .ops = { | |
3488 | .open = alc880_dig_playback_pcm_open, | |
3489 | .close = alc880_dig_playback_pcm_close, | |
3490 | .prepare = alc880_dig_playback_pcm_prepare, | |
3491 | .cleanup = alc880_dig_playback_pcm_cleanup | |
3492 | }, | |
3493 | }; | |
3494 | ||
3495 | static struct hda_pcm_stream alc880_pcm_digital_capture = { | |
3496 | .substreams = 1, | |
3497 | .channels_min = 2, | |
3498 | .channels_max = 2, | |
3499 | /* NID is set in alc_build_pcms */ | |
3500 | }; | |
3501 | ||
3502 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ | |
3503 | static struct hda_pcm_stream alc_pcm_null_stream = { | |
3504 | .substreams = 0, | |
3505 | .channels_min = 0, | |
3506 | .channels_max = 0, | |
3507 | }; | |
3508 | ||
3509 | static int alc_build_pcms(struct hda_codec *codec) | |
3510 | { | |
3511 | struct alc_spec *spec = codec->spec; | |
3512 | struct hda_pcm *info = spec->pcm_rec; | |
3513 | int i; | |
3514 | ||
3515 | codec->num_pcms = 1; | |
3516 | codec->pcm_info = info; | |
3517 | ||
3518 | if (spec->no_analog) | |
3519 | goto skip_analog; | |
3520 | ||
3521 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), | |
3522 | "%s Analog", codec->chip_name); | |
3523 | info->name = spec->stream_name_analog; | |
3524 | ||
3525 | if (spec->stream_analog_playback) { | |
3526 | if (snd_BUG_ON(!spec->multiout.dac_nids)) | |
3527 | return -EINVAL; | |
3528 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); | |
3529 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | |
3530 | } | |
3531 | if (spec->stream_analog_capture) { | |
3532 | if (snd_BUG_ON(!spec->adc_nids)) | |
3533 | return -EINVAL; | |
3534 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); | |
3535 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | |
3536 | } | |
3537 | ||
3538 | if (spec->channel_mode) { | |
3539 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; | |
3540 | for (i = 0; i < spec->num_channel_mode; i++) { | |
3541 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { | |
3542 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; | |
3543 | } | |
3544 | } | |
3545 | } | |
3546 | ||
3547 | skip_analog: | |
3548 | /* SPDIF for stream index #1 */ | |
3549 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { | |
3550 | snprintf(spec->stream_name_digital, | |
3551 | sizeof(spec->stream_name_digital), | |
3552 | "%s Digital", codec->chip_name); | |
3553 | codec->num_pcms = 2; | |
3554 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; | |
3555 | info = spec->pcm_rec + 1; | |
3556 | info->name = spec->stream_name_digital; | |
3557 | if (spec->dig_out_type) | |
3558 | info->pcm_type = spec->dig_out_type; | |
3559 | else | |
3560 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | |
3561 | if (spec->multiout.dig_out_nid && | |
3562 | spec->stream_digital_playback) { | |
3563 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); | |
3564 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | |
3565 | } | |
3566 | if (spec->dig_in_nid && | |
3567 | spec->stream_digital_capture) { | |
3568 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); | |
3569 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | |
3570 | } | |
3571 | /* FIXME: do we need this for all Realtek codec models? */ | |
3572 | codec->spdif_status_reset = 1; | |
3573 | } | |
3574 | ||
3575 | if (spec->no_analog) | |
3576 | return 0; | |
3577 | ||
3578 | /* If the use of more than one ADC is requested for the current | |
3579 | * model, configure a second analog capture-only PCM. | |
3580 | */ | |
3581 | /* Additional Analaog capture for index #2 */ | |
3582 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || | |
3583 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { | |
3584 | codec->num_pcms = 3; | |
3585 | info = spec->pcm_rec + 2; | |
3586 | info->name = spec->stream_name_analog; | |
3587 | if (spec->alt_dac_nid) { | |
3588 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
3589 | *spec->stream_analog_alt_playback; | |
3590 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | |
3591 | spec->alt_dac_nid; | |
3592 | } else { | |
3593 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
3594 | alc_pcm_null_stream; | |
3595 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | |
3596 | } | |
3597 | if (spec->num_adc_nids > 1) { | |
3598 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
3599 | *spec->stream_analog_alt_capture; | |
3600 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | |
3601 | spec->adc_nids[1]; | |
3602 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = | |
3603 | spec->num_adc_nids - 1; | |
3604 | } else { | |
3605 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
3606 | alc_pcm_null_stream; | |
3607 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; | |
3608 | } | |
3609 | } | |
3610 | ||
3611 | return 0; | |
3612 | } | |
3613 | ||
3614 | static void alc_free_kctls(struct hda_codec *codec) | |
3615 | { | |
3616 | struct alc_spec *spec = codec->spec; | |
3617 | ||
3618 | if (spec->kctls.list) { | |
3619 | struct snd_kcontrol_new *kctl = spec->kctls.list; | |
3620 | int i; | |
3621 | for (i = 0; i < spec->kctls.used; i++) | |
3622 | kfree(kctl[i].name); | |
3623 | } | |
3624 | snd_array_free(&spec->kctls); | |
3625 | } | |
3626 | ||
3627 | static void alc_free(struct hda_codec *codec) | |
3628 | { | |
3629 | struct alc_spec *spec = codec->spec; | |
3630 | ||
3631 | if (!spec) | |
3632 | return; | |
3633 | ||
3634 | alc_free_kctls(codec); | |
3635 | kfree(spec); | |
3636 | snd_hda_detach_beep_device(codec); | |
3637 | } | |
3638 | ||
3639 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3640 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) | |
3641 | { | |
3642 | struct alc_spec *spec = codec->spec; | |
3643 | if (spec && spec->power_hook) | |
3644 | spec->power_hook(codec, 0); | |
3645 | return 0; | |
3646 | } | |
3647 | #endif | |
3648 | ||
3649 | #ifdef SND_HDA_NEEDS_RESUME | |
3650 | static int alc_resume(struct hda_codec *codec) | |
3651 | { | |
3652 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3653 | struct alc_spec *spec = codec->spec; | |
3654 | #endif | |
3655 | codec->patch_ops.init(codec); | |
3656 | snd_hda_codec_resume_amp(codec); | |
3657 | snd_hda_codec_resume_cache(codec); | |
3658 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3659 | if (spec && spec->power_hook) | |
3660 | spec->power_hook(codec, 1); | |
3661 | #endif | |
3662 | return 0; | |
3663 | } | |
3664 | #endif | |
3665 | ||
3666 | /* | |
3667 | */ | |
3668 | static struct hda_codec_ops alc_patch_ops = { | |
3669 | .build_controls = alc_build_controls, | |
3670 | .build_pcms = alc_build_pcms, | |
3671 | .init = alc_init, | |
3672 | .free = alc_free, | |
3673 | .unsol_event = alc_unsol_event, | |
3674 | #ifdef SND_HDA_NEEDS_RESUME | |
3675 | .resume = alc_resume, | |
3676 | #endif | |
3677 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
3678 | .suspend = alc_suspend, | |
3679 | .check_power_status = alc_check_power_status, | |
3680 | #endif | |
3681 | }; | |
3682 | ||
3683 | ||
3684 | /* | |
3685 | * Test configuration for debugging | |
3686 | * | |
3687 | * Almost all inputs/outputs are enabled. I/O pins can be configured via | |
3688 | * enum controls. | |
3689 | */ | |
3690 | #ifdef CONFIG_SND_DEBUG | |
3691 | static hda_nid_t alc880_test_dac_nids[4] = { | |
3692 | 0x02, 0x03, 0x04, 0x05 | |
3693 | }; | |
3694 | ||
3695 | static struct hda_input_mux alc880_test_capture_source = { | |
3696 | .num_items = 7, | |
3697 | .items = { | |
3698 | { "In-1", 0x0 }, | |
3699 | { "In-2", 0x1 }, | |
3700 | { "In-3", 0x2 }, | |
3701 | { "In-4", 0x3 }, | |
3702 | { "CD", 0x4 }, | |
3703 | { "Front", 0x5 }, | |
3704 | { "Surround", 0x6 }, | |
3705 | }, | |
3706 | }; | |
3707 | ||
3708 | static struct hda_channel_mode alc880_test_modes[4] = { | |
3709 | { 2, NULL }, | |
3710 | { 4, NULL }, | |
3711 | { 6, NULL }, | |
3712 | { 8, NULL }, | |
3713 | }; | |
3714 | ||
3715 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, | |
3716 | struct snd_ctl_elem_info *uinfo) | |
3717 | { | |
3718 | static char *texts[] = { | |
3719 | "N/A", "Line Out", "HP Out", | |
3720 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" | |
3721 | }; | |
3722 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
3723 | uinfo->count = 1; | |
3724 | uinfo->value.enumerated.items = 8; | |
3725 | if (uinfo->value.enumerated.item >= 8) | |
3726 | uinfo->value.enumerated.item = 7; | |
3727 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
3728 | return 0; | |
3729 | } | |
3730 | ||
3731 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, | |
3732 | struct snd_ctl_elem_value *ucontrol) | |
3733 | { | |
3734 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
3735 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
3736 | unsigned int pin_ctl, item = 0; | |
3737 | ||
3738 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | |
3739 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
3740 | if (pin_ctl & AC_PINCTL_OUT_EN) { | |
3741 | if (pin_ctl & AC_PINCTL_HP_EN) | |
3742 | item = 2; | |
3743 | else | |
3744 | item = 1; | |
3745 | } else if (pin_ctl & AC_PINCTL_IN_EN) { | |
3746 | switch (pin_ctl & AC_PINCTL_VREFEN) { | |
3747 | case AC_PINCTL_VREF_HIZ: item = 3; break; | |
3748 | case AC_PINCTL_VREF_50: item = 4; break; | |
3749 | case AC_PINCTL_VREF_GRD: item = 5; break; | |
3750 | case AC_PINCTL_VREF_80: item = 6; break; | |
3751 | case AC_PINCTL_VREF_100: item = 7; break; | |
3752 | } | |
3753 | } | |
3754 | ucontrol->value.enumerated.item[0] = item; | |
3755 | return 0; | |
3756 | } | |
3757 | ||
3758 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, | |
3759 | struct snd_ctl_elem_value *ucontrol) | |
3760 | { | |
3761 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
3762 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
3763 | static unsigned int ctls[] = { | |
3764 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, | |
3765 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, | |
3766 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, | |
3767 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, | |
3768 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, | |
3769 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, | |
3770 | }; | |
3771 | unsigned int old_ctl, new_ctl; | |
3772 | ||
3773 | old_ctl = snd_hda_codec_read(codec, nid, 0, | |
3774 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
3775 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; | |
3776 | if (old_ctl != new_ctl) { | |
3777 | int val; | |
3778 | snd_hda_codec_write_cache(codec, nid, 0, | |
3779 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3780 | new_ctl); | |
3781 | val = ucontrol->value.enumerated.item[0] >= 3 ? | |
3782 | HDA_AMP_MUTE : 0; | |
3783 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
3784 | HDA_AMP_MUTE, val); | |
3785 | return 1; | |
3786 | } | |
3787 | return 0; | |
3788 | } | |
3789 | ||
3790 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, | |
3791 | struct snd_ctl_elem_info *uinfo) | |
3792 | { | |
3793 | static char *texts[] = { | |
3794 | "Front", "Surround", "CLFE", "Side" | |
3795 | }; | |
3796 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
3797 | uinfo->count = 1; | |
3798 | uinfo->value.enumerated.items = 4; | |
3799 | if (uinfo->value.enumerated.item >= 4) | |
3800 | uinfo->value.enumerated.item = 3; | |
3801 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
3802 | return 0; | |
3803 | } | |
3804 | ||
3805 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, | |
3806 | struct snd_ctl_elem_value *ucontrol) | |
3807 | { | |
3808 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
3809 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
3810 | unsigned int sel; | |
3811 | ||
3812 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); | |
3813 | ucontrol->value.enumerated.item[0] = sel & 3; | |
3814 | return 0; | |
3815 | } | |
3816 | ||
3817 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, | |
3818 | struct snd_ctl_elem_value *ucontrol) | |
3819 | { | |
3820 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
3821 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
3822 | unsigned int sel; | |
3823 | ||
3824 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; | |
3825 | if (ucontrol->value.enumerated.item[0] != sel) { | |
3826 | sel = ucontrol->value.enumerated.item[0] & 3; | |
3827 | snd_hda_codec_write_cache(codec, nid, 0, | |
3828 | AC_VERB_SET_CONNECT_SEL, sel); | |
3829 | return 1; | |
3830 | } | |
3831 | return 0; | |
3832 | } | |
3833 | ||
3834 | #define PIN_CTL_TEST(xname,nid) { \ | |
3835 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
3836 | .name = xname, \ | |
3837 | .info = alc_test_pin_ctl_info, \ | |
3838 | .get = alc_test_pin_ctl_get, \ | |
3839 | .put = alc_test_pin_ctl_put, \ | |
3840 | .private_value = nid \ | |
3841 | } | |
3842 | ||
3843 | #define PIN_SRC_TEST(xname,nid) { \ | |
3844 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
3845 | .name = xname, \ | |
3846 | .info = alc_test_pin_src_info, \ | |
3847 | .get = alc_test_pin_src_get, \ | |
3848 | .put = alc_test_pin_src_put, \ | |
3849 | .private_value = nid \ | |
3850 | } | |
3851 | ||
3852 | static struct snd_kcontrol_new alc880_test_mixer[] = { | |
3853 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3854 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
3855 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
3856 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
3857 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
3858 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
3859 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), | |
3860 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
3861 | PIN_CTL_TEST("Front Pin Mode", 0x14), | |
3862 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | |
3863 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | |
3864 | PIN_CTL_TEST("Side Pin Mode", 0x17), | |
3865 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), | |
3866 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), | |
3867 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), | |
3868 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), | |
3869 | PIN_SRC_TEST("In-1 Pin Source", 0x18), | |
3870 | PIN_SRC_TEST("In-2 Pin Source", 0x19), | |
3871 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), | |
3872 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), | |
3873 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
3874 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3875 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3876 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3877 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), | |
3878 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), | |
3879 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
3880 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
3881 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), | |
3882 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
3883 | { | |
3884 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3885 | .name = "Channel Mode", | |
3886 | .info = alc_ch_mode_info, | |
3887 | .get = alc_ch_mode_get, | |
3888 | .put = alc_ch_mode_put, | |
3889 | }, | |
3890 | { } /* end */ | |
3891 | }; | |
3892 | ||
3893 | static struct hda_verb alc880_test_init_verbs[] = { | |
3894 | /* Unmute inputs of 0x0c - 0x0f */ | |
3895 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3896 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3897 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3898 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3899 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3900 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3901 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3902 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3903 | /* Vol output for 0x0c-0x0f */ | |
3904 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3905 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3906 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3907 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3908 | /* Set output pins 0x14-0x17 */ | |
3909 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3910 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3911 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3912 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3913 | /* Unmute output pins 0x14-0x17 */ | |
3914 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3915 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3916 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3917 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3918 | /* Set input pins 0x18-0x1c */ | |
3919 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3920 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3921 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3922 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3923 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3924 | /* Mute input pins 0x18-0x1b */ | |
3925 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3926 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3927 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3928 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3929 | /* ADC set up */ | |
3930 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3931 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3932 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3933 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3934 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3935 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3936 | /* Analog input/passthru */ | |
3937 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3938 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3939 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
3940 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
3941 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
3942 | { } | |
3943 | }; | |
3944 | #endif | |
3945 | ||
3946 | /* | |
3947 | */ | |
3948 | ||
3949 | static const char *alc880_models[ALC880_MODEL_LAST] = { | |
3950 | [ALC880_3ST] = "3stack", | |
3951 | [ALC880_TCL_S700] = "tcl", | |
3952 | [ALC880_3ST_DIG] = "3stack-digout", | |
3953 | [ALC880_CLEVO] = "clevo", | |
3954 | [ALC880_5ST] = "5stack", | |
3955 | [ALC880_5ST_DIG] = "5stack-digout", | |
3956 | [ALC880_W810] = "w810", | |
3957 | [ALC880_Z71V] = "z71v", | |
3958 | [ALC880_6ST] = "6stack", | |
3959 | [ALC880_6ST_DIG] = "6stack-digout", | |
3960 | [ALC880_ASUS] = "asus", | |
3961 | [ALC880_ASUS_W1V] = "asus-w1v", | |
3962 | [ALC880_ASUS_DIG] = "asus-dig", | |
3963 | [ALC880_ASUS_DIG2] = "asus-dig2", | |
3964 | [ALC880_UNIWILL_DIG] = "uniwill", | |
3965 | [ALC880_UNIWILL_P53] = "uniwill-p53", | |
3966 | [ALC880_FUJITSU] = "fujitsu", | |
3967 | [ALC880_F1734] = "F1734", | |
3968 | [ALC880_LG] = "lg", | |
3969 | [ALC880_LG_LW] = "lg-lw", | |
3970 | [ALC880_MEDION_RIM] = "medion", | |
3971 | #ifdef CONFIG_SND_DEBUG | |
3972 | [ALC880_TEST] = "test", | |
3973 | #endif | |
3974 | [ALC880_AUTO] = "auto", | |
3975 | }; | |
3976 | ||
3977 | static struct snd_pci_quirk alc880_cfg_tbl[] = { | |
3978 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), | |
3979 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), | |
3980 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), | |
3981 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), | |
3982 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), | |
3983 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), | |
3984 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), | |
3985 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), | |
3986 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), | |
3987 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), | |
3988 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), | |
3989 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), | |
3990 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), | |
3991 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), | |
3992 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), | |
3993 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), | |
3994 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), | |
3995 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), | |
3996 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ | |
3997 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), | |
3998 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), | |
3999 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), | |
4000 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), | |
4001 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), | |
4002 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), | |
4003 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ | |
4004 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), | |
4005 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), | |
4006 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), | |
4007 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), | |
4008 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), | |
4009 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), | |
4010 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), | |
4011 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), | |
4012 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), | |
4013 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), | |
4014 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), | |
4015 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), | |
4016 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), | |
4017 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), | |
4018 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), | |
4019 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), | |
4020 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), | |
4021 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), | |
4022 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), | |
4023 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), | |
4024 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), | |
4025 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), | |
4026 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), | |
4027 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), | |
4028 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), | |
4029 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), | |
4030 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), | |
4031 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), | |
4032 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), | |
4033 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), | |
4034 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ | |
4035 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), | |
4036 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), | |
4037 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), | |
4038 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), | |
4039 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), | |
4040 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), | |
4041 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), | |
4042 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), | |
4043 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), | |
4044 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), | |
4045 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), | |
4046 | /* default Intel */ | |
4047 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), | |
4048 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), | |
4049 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), | |
4050 | {} | |
4051 | }; | |
4052 | ||
4053 | /* | |
4054 | * ALC880 codec presets | |
4055 | */ | |
4056 | static struct alc_config_preset alc880_presets[] = { | |
4057 | [ALC880_3ST] = { | |
4058 | .mixers = { alc880_three_stack_mixer }, | |
4059 | .init_verbs = { alc880_volume_init_verbs, | |
4060 | alc880_pin_3stack_init_verbs }, | |
4061 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4062 | .dac_nids = alc880_dac_nids, | |
4063 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4064 | .channel_mode = alc880_threestack_modes, | |
4065 | .need_dac_fix = 1, | |
4066 | .input_mux = &alc880_capture_source, | |
4067 | }, | |
4068 | [ALC880_3ST_DIG] = { | |
4069 | .mixers = { alc880_three_stack_mixer }, | |
4070 | .init_verbs = { alc880_volume_init_verbs, | |
4071 | alc880_pin_3stack_init_verbs }, | |
4072 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4073 | .dac_nids = alc880_dac_nids, | |
4074 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4075 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4076 | .channel_mode = alc880_threestack_modes, | |
4077 | .need_dac_fix = 1, | |
4078 | .input_mux = &alc880_capture_source, | |
4079 | }, | |
4080 | [ALC880_TCL_S700] = { | |
4081 | .mixers = { alc880_tcl_s700_mixer }, | |
4082 | .init_verbs = { alc880_volume_init_verbs, | |
4083 | alc880_pin_tcl_S700_init_verbs, | |
4084 | alc880_gpio2_init_verbs }, | |
4085 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4086 | .dac_nids = alc880_dac_nids, | |
4087 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ | |
4088 | .num_adc_nids = 1, /* single ADC */ | |
4089 | .hp_nid = 0x03, | |
4090 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4091 | .channel_mode = alc880_2_jack_modes, | |
4092 | .input_mux = &alc880_capture_source, | |
4093 | }, | |
4094 | [ALC880_5ST] = { | |
4095 | .mixers = { alc880_three_stack_mixer, | |
4096 | alc880_five_stack_mixer}, | |
4097 | .init_verbs = { alc880_volume_init_verbs, | |
4098 | alc880_pin_5stack_init_verbs }, | |
4099 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4100 | .dac_nids = alc880_dac_nids, | |
4101 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), | |
4102 | .channel_mode = alc880_fivestack_modes, | |
4103 | .input_mux = &alc880_capture_source, | |
4104 | }, | |
4105 | [ALC880_5ST_DIG] = { | |
4106 | .mixers = { alc880_three_stack_mixer, | |
4107 | alc880_five_stack_mixer }, | |
4108 | .init_verbs = { alc880_volume_init_verbs, | |
4109 | alc880_pin_5stack_init_verbs }, | |
4110 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4111 | .dac_nids = alc880_dac_nids, | |
4112 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4113 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), | |
4114 | .channel_mode = alc880_fivestack_modes, | |
4115 | .input_mux = &alc880_capture_source, | |
4116 | }, | |
4117 | [ALC880_6ST] = { | |
4118 | .mixers = { alc880_six_stack_mixer }, | |
4119 | .init_verbs = { alc880_volume_init_verbs, | |
4120 | alc880_pin_6stack_init_verbs }, | |
4121 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), | |
4122 | .dac_nids = alc880_6st_dac_nids, | |
4123 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
4124 | .channel_mode = alc880_sixstack_modes, | |
4125 | .input_mux = &alc880_6stack_capture_source, | |
4126 | }, | |
4127 | [ALC880_6ST_DIG] = { | |
4128 | .mixers = { alc880_six_stack_mixer }, | |
4129 | .init_verbs = { alc880_volume_init_verbs, | |
4130 | alc880_pin_6stack_init_verbs }, | |
4131 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), | |
4132 | .dac_nids = alc880_6st_dac_nids, | |
4133 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4134 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
4135 | .channel_mode = alc880_sixstack_modes, | |
4136 | .input_mux = &alc880_6stack_capture_source, | |
4137 | }, | |
4138 | [ALC880_W810] = { | |
4139 | .mixers = { alc880_w810_base_mixer }, | |
4140 | .init_verbs = { alc880_volume_init_verbs, | |
4141 | alc880_pin_w810_init_verbs, | |
4142 | alc880_gpio2_init_verbs }, | |
4143 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), | |
4144 | .dac_nids = alc880_w810_dac_nids, | |
4145 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4146 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
4147 | .channel_mode = alc880_w810_modes, | |
4148 | .input_mux = &alc880_capture_source, | |
4149 | }, | |
4150 | [ALC880_Z71V] = { | |
4151 | .mixers = { alc880_z71v_mixer }, | |
4152 | .init_verbs = { alc880_volume_init_verbs, | |
4153 | alc880_pin_z71v_init_verbs }, | |
4154 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), | |
4155 | .dac_nids = alc880_z71v_dac_nids, | |
4156 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4157 | .hp_nid = 0x03, | |
4158 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4159 | .channel_mode = alc880_2_jack_modes, | |
4160 | .input_mux = &alc880_capture_source, | |
4161 | }, | |
4162 | [ALC880_F1734] = { | |
4163 | .mixers = { alc880_f1734_mixer }, | |
4164 | .init_verbs = { alc880_volume_init_verbs, | |
4165 | alc880_pin_f1734_init_verbs }, | |
4166 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), | |
4167 | .dac_nids = alc880_f1734_dac_nids, | |
4168 | .hp_nid = 0x02, | |
4169 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4170 | .channel_mode = alc880_2_jack_modes, | |
4171 | .input_mux = &alc880_f1734_capture_source, | |
4172 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4173 | .setup = alc880_uniwill_p53_setup, | |
4174 | .init_hook = alc_automute_amp, | |
4175 | }, | |
4176 | [ALC880_ASUS] = { | |
4177 | .mixers = { alc880_asus_mixer }, | |
4178 | .init_verbs = { alc880_volume_init_verbs, | |
4179 | alc880_pin_asus_init_verbs, | |
4180 | alc880_gpio1_init_verbs }, | |
4181 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4182 | .dac_nids = alc880_asus_dac_nids, | |
4183 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4184 | .channel_mode = alc880_asus_modes, | |
4185 | .need_dac_fix = 1, | |
4186 | .input_mux = &alc880_capture_source, | |
4187 | }, | |
4188 | [ALC880_ASUS_DIG] = { | |
4189 | .mixers = { alc880_asus_mixer }, | |
4190 | .init_verbs = { alc880_volume_init_verbs, | |
4191 | alc880_pin_asus_init_verbs, | |
4192 | alc880_gpio1_init_verbs }, | |
4193 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4194 | .dac_nids = alc880_asus_dac_nids, | |
4195 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4196 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4197 | .channel_mode = alc880_asus_modes, | |
4198 | .need_dac_fix = 1, | |
4199 | .input_mux = &alc880_capture_source, | |
4200 | }, | |
4201 | [ALC880_ASUS_DIG2] = { | |
4202 | .mixers = { alc880_asus_mixer }, | |
4203 | .init_verbs = { alc880_volume_init_verbs, | |
4204 | alc880_pin_asus_init_verbs, | |
4205 | alc880_gpio2_init_verbs }, /* use GPIO2 */ | |
4206 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4207 | .dac_nids = alc880_asus_dac_nids, | |
4208 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4209 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4210 | .channel_mode = alc880_asus_modes, | |
4211 | .need_dac_fix = 1, | |
4212 | .input_mux = &alc880_capture_source, | |
4213 | }, | |
4214 | [ALC880_ASUS_W1V] = { | |
4215 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, | |
4216 | .init_verbs = { alc880_volume_init_verbs, | |
4217 | alc880_pin_asus_init_verbs, | |
4218 | alc880_gpio1_init_verbs }, | |
4219 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4220 | .dac_nids = alc880_asus_dac_nids, | |
4221 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4222 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4223 | .channel_mode = alc880_asus_modes, | |
4224 | .need_dac_fix = 1, | |
4225 | .input_mux = &alc880_capture_source, | |
4226 | }, | |
4227 | [ALC880_UNIWILL_DIG] = { | |
4228 | .mixers = { alc880_asus_mixer }, | |
4229 | .init_verbs = { alc880_volume_init_verbs, | |
4230 | alc880_pin_asus_init_verbs }, | |
4231 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4232 | .dac_nids = alc880_asus_dac_nids, | |
4233 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4234 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4235 | .channel_mode = alc880_asus_modes, | |
4236 | .need_dac_fix = 1, | |
4237 | .input_mux = &alc880_capture_source, | |
4238 | }, | |
4239 | [ALC880_UNIWILL] = { | |
4240 | .mixers = { alc880_uniwill_mixer }, | |
4241 | .init_verbs = { alc880_volume_init_verbs, | |
4242 | alc880_uniwill_init_verbs }, | |
4243 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4244 | .dac_nids = alc880_asus_dac_nids, | |
4245 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4246 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4247 | .channel_mode = alc880_threestack_modes, | |
4248 | .need_dac_fix = 1, | |
4249 | .input_mux = &alc880_capture_source, | |
4250 | .unsol_event = alc880_uniwill_unsol_event, | |
4251 | .setup = alc880_uniwill_setup, | |
4252 | .init_hook = alc880_uniwill_init_hook, | |
4253 | }, | |
4254 | [ALC880_UNIWILL_P53] = { | |
4255 | .mixers = { alc880_uniwill_p53_mixer }, | |
4256 | .init_verbs = { alc880_volume_init_verbs, | |
4257 | alc880_uniwill_p53_init_verbs }, | |
4258 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4259 | .dac_nids = alc880_asus_dac_nids, | |
4260 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
4261 | .channel_mode = alc880_threestack_modes, | |
4262 | .input_mux = &alc880_capture_source, | |
4263 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4264 | .setup = alc880_uniwill_p53_setup, | |
4265 | .init_hook = alc_automute_amp, | |
4266 | }, | |
4267 | [ALC880_FUJITSU] = { | |
4268 | .mixers = { alc880_fujitsu_mixer }, | |
4269 | .init_verbs = { alc880_volume_init_verbs, | |
4270 | alc880_uniwill_p53_init_verbs, | |
4271 | alc880_beep_init_verbs }, | |
4272 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4273 | .dac_nids = alc880_dac_nids, | |
4274 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4275 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4276 | .channel_mode = alc880_2_jack_modes, | |
4277 | .input_mux = &alc880_capture_source, | |
4278 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4279 | .setup = alc880_uniwill_p53_setup, | |
4280 | .init_hook = alc_automute_amp, | |
4281 | }, | |
4282 | [ALC880_CLEVO] = { | |
4283 | .mixers = { alc880_three_stack_mixer }, | |
4284 | .init_verbs = { alc880_volume_init_verbs, | |
4285 | alc880_pin_clevo_init_verbs }, | |
4286 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4287 | .dac_nids = alc880_dac_nids, | |
4288 | .hp_nid = 0x03, | |
4289 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4290 | .channel_mode = alc880_threestack_modes, | |
4291 | .need_dac_fix = 1, | |
4292 | .input_mux = &alc880_capture_source, | |
4293 | }, | |
4294 | [ALC880_LG] = { | |
4295 | .mixers = { alc880_lg_mixer }, | |
4296 | .init_verbs = { alc880_volume_init_verbs, | |
4297 | alc880_lg_init_verbs }, | |
4298 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), | |
4299 | .dac_nids = alc880_lg_dac_nids, | |
4300 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4301 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), | |
4302 | .channel_mode = alc880_lg_ch_modes, | |
4303 | .need_dac_fix = 1, | |
4304 | .input_mux = &alc880_lg_capture_source, | |
4305 | .unsol_event = alc_automute_amp_unsol_event, | |
4306 | .setup = alc880_lg_setup, | |
4307 | .init_hook = alc_automute_amp, | |
4308 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
4309 | .loopbacks = alc880_lg_loopbacks, | |
4310 | #endif | |
4311 | }, | |
4312 | [ALC880_LG_LW] = { | |
4313 | .mixers = { alc880_lg_lw_mixer }, | |
4314 | .init_verbs = { alc880_volume_init_verbs, | |
4315 | alc880_lg_lw_init_verbs }, | |
4316 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4317 | .dac_nids = alc880_dac_nids, | |
4318 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4319 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), | |
4320 | .channel_mode = alc880_lg_lw_modes, | |
4321 | .input_mux = &alc880_lg_lw_capture_source, | |
4322 | .unsol_event = alc_automute_amp_unsol_event, | |
4323 | .setup = alc880_lg_lw_setup, | |
4324 | .init_hook = alc_automute_amp, | |
4325 | }, | |
4326 | [ALC880_MEDION_RIM] = { | |
4327 | .mixers = { alc880_medion_rim_mixer }, | |
4328 | .init_verbs = { alc880_volume_init_verbs, | |
4329 | alc880_medion_rim_init_verbs, | |
4330 | alc_gpio2_init_verbs }, | |
4331 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4332 | .dac_nids = alc880_dac_nids, | |
4333 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4334 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4335 | .channel_mode = alc880_2_jack_modes, | |
4336 | .input_mux = &alc880_medion_rim_capture_source, | |
4337 | .unsol_event = alc880_medion_rim_unsol_event, | |
4338 | .setup = alc880_medion_rim_setup, | |
4339 | .init_hook = alc880_medion_rim_automute, | |
4340 | }, | |
4341 | #ifdef CONFIG_SND_DEBUG | |
4342 | [ALC880_TEST] = { | |
4343 | .mixers = { alc880_test_mixer }, | |
4344 | .init_verbs = { alc880_test_init_verbs }, | |
4345 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), | |
4346 | .dac_nids = alc880_test_dac_nids, | |
4347 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4348 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), | |
4349 | .channel_mode = alc880_test_modes, | |
4350 | .input_mux = &alc880_test_capture_source, | |
4351 | }, | |
4352 | #endif | |
4353 | }; | |
4354 | ||
4355 | /* | |
4356 | * Automatic parse of I/O pins from the BIOS configuration | |
4357 | */ | |
4358 | ||
4359 | enum { | |
4360 | ALC_CTL_WIDGET_VOL, | |
4361 | ALC_CTL_WIDGET_MUTE, | |
4362 | ALC_CTL_BIND_MUTE, | |
4363 | }; | |
4364 | static struct snd_kcontrol_new alc880_control_templates[] = { | |
4365 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), | |
4366 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | |
4367 | HDA_BIND_MUTE(NULL, 0, 0, 0), | |
4368 | }; | |
4369 | ||
4370 | /* add dynamic controls */ | |
4371 | static int add_control(struct alc_spec *spec, int type, const char *name, | |
4372 | unsigned long val) | |
4373 | { | |
4374 | struct snd_kcontrol_new *knew; | |
4375 | ||
4376 | snd_array_init(&spec->kctls, sizeof(*knew), 32); | |
4377 | knew = snd_array_new(&spec->kctls); | |
4378 | if (!knew) | |
4379 | return -ENOMEM; | |
4380 | *knew = alc880_control_templates[type]; | |
4381 | knew->name = kstrdup(name, GFP_KERNEL); | |
4382 | if (!knew->name) | |
4383 | return -ENOMEM; | |
4384 | if (get_amp_nid_(val)) | |
4385 | knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val); | |
4386 | knew->private_value = val; | |
4387 | return 0; | |
4388 | } | |
4389 | ||
4390 | static int add_control_with_pfx(struct alc_spec *spec, int type, | |
4391 | const char *pfx, const char *dir, | |
4392 | const char *sfx, unsigned long val) | |
4393 | { | |
4394 | char name[32]; | |
4395 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); | |
4396 | return add_control(spec, type, name, val); | |
4397 | } | |
4398 | ||
4399 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ | |
4400 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) | |
4401 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ | |
4402 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) | |
4403 | ||
4404 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) | |
4405 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | |
4406 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | |
4407 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | |
4408 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) | |
4409 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | |
4410 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | |
4411 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) | |
4412 | #define ALC880_PIN_CD_NID 0x1c | |
4413 | ||
4414 | /* fill in the dac_nids table from the parsed pin configuration */ | |
4415 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, | |
4416 | const struct auto_pin_cfg *cfg) | |
4417 | { | |
4418 | hda_nid_t nid; | |
4419 | int assigned[4]; | |
4420 | int i, j; | |
4421 | ||
4422 | memset(assigned, 0, sizeof(assigned)); | |
4423 | spec->multiout.dac_nids = spec->private_dac_nids; | |
4424 | ||
4425 | /* check the pins hardwired to audio widget */ | |
4426 | for (i = 0; i < cfg->line_outs; i++) { | |
4427 | nid = cfg->line_out_pins[i]; | |
4428 | if (alc880_is_fixed_pin(nid)) { | |
4429 | int idx = alc880_fixed_pin_idx(nid); | |
4430 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); | |
4431 | assigned[idx] = 1; | |
4432 | } | |
4433 | } | |
4434 | /* left pins can be connect to any audio widget */ | |
4435 | for (i = 0; i < cfg->line_outs; i++) { | |
4436 | nid = cfg->line_out_pins[i]; | |
4437 | if (alc880_is_fixed_pin(nid)) | |
4438 | continue; | |
4439 | /* search for an empty channel */ | |
4440 | for (j = 0; j < cfg->line_outs; j++) { | |
4441 | if (!assigned[j]) { | |
4442 | spec->multiout.dac_nids[i] = | |
4443 | alc880_idx_to_dac(j); | |
4444 | assigned[j] = 1; | |
4445 | break; | |
4446 | } | |
4447 | } | |
4448 | } | |
4449 | spec->multiout.num_dacs = cfg->line_outs; | |
4450 | return 0; | |
4451 | } | |
4452 | ||
4453 | /* add playback controls from the parsed DAC table */ | |
4454 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, | |
4455 | const struct auto_pin_cfg *cfg) | |
4456 | { | |
4457 | static const char *chname[4] = { | |
4458 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
4459 | }; | |
4460 | hda_nid_t nid; | |
4461 | int i, err; | |
4462 | ||
4463 | for (i = 0; i < cfg->line_outs; i++) { | |
4464 | if (!spec->multiout.dac_nids[i]) | |
4465 | continue; | |
4466 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); | |
4467 | if (i == 2) { | |
4468 | /* Center/LFE */ | |
4469 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
4470 | "Center", | |
4471 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | |
4472 | HDA_OUTPUT)); | |
4473 | if (err < 0) | |
4474 | return err; | |
4475 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
4476 | "LFE", | |
4477 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
4478 | HDA_OUTPUT)); | |
4479 | if (err < 0) | |
4480 | return err; | |
4481 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
4482 | "Center", | |
4483 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, | |
4484 | HDA_INPUT)); | |
4485 | if (err < 0) | |
4486 | return err; | |
4487 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
4488 | "LFE", | |
4489 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, | |
4490 | HDA_INPUT)); | |
4491 | if (err < 0) | |
4492 | return err; | |
4493 | } else { | |
4494 | const char *pfx; | |
4495 | if (cfg->line_outs == 1 && | |
4496 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
4497 | pfx = "Speaker"; | |
4498 | else | |
4499 | pfx = chname[i]; | |
4500 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | |
4501 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
4502 | HDA_OUTPUT)); | |
4503 | if (err < 0) | |
4504 | return err; | |
4505 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | |
4506 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, | |
4507 | HDA_INPUT)); | |
4508 | if (err < 0) | |
4509 | return err; | |
4510 | } | |
4511 | } | |
4512 | return 0; | |
4513 | } | |
4514 | ||
4515 | /* add playback controls for speaker and HP outputs */ | |
4516 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
4517 | const char *pfx) | |
4518 | { | |
4519 | hda_nid_t nid; | |
4520 | int err; | |
4521 | ||
4522 | if (!pin) | |
4523 | return 0; | |
4524 | ||
4525 | if (alc880_is_fixed_pin(pin)) { | |
4526 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
4527 | /* specify the DAC as the extra output */ | |
4528 | if (!spec->multiout.hp_nid) | |
4529 | spec->multiout.hp_nid = nid; | |
4530 | else | |
4531 | spec->multiout.extra_out_nid[0] = nid; | |
4532 | /* control HP volume/switch on the output mixer amp */ | |
4533 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); | |
4534 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | |
4535 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
4536 | if (err < 0) | |
4537 | return err; | |
4538 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | |
4539 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); | |
4540 | if (err < 0) | |
4541 | return err; | |
4542 | } else if (alc880_is_multi_pin(pin)) { | |
4543 | /* set manual connection */ | |
4544 | /* we have only a switch on HP-out PIN */ | |
4545 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | |
4546 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
4547 | if (err < 0) | |
4548 | return err; | |
4549 | } | |
4550 | return 0; | |
4551 | } | |
4552 | ||
4553 | /* create input playback/capture controls for the given pin */ | |
4554 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, | |
4555 | const char *ctlname, | |
4556 | int idx, hda_nid_t mix_nid) | |
4557 | { | |
4558 | int err; | |
4559 | ||
4560 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, | |
4561 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | |
4562 | if (err < 0) | |
4563 | return err; | |
4564 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
4565 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | |
4566 | if (err < 0) | |
4567 | return err; | |
4568 | return 0; | |
4569 | } | |
4570 | ||
4571 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) | |
4572 | { | |
4573 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | |
4574 | return (pincap & AC_PINCAP_IN) != 0; | |
4575 | } | |
4576 | ||
4577 | /* create playback/capture controls for input pins */ | |
4578 | static int alc_auto_create_input_ctls(struct hda_codec *codec, | |
4579 | const struct auto_pin_cfg *cfg, | |
4580 | hda_nid_t mixer, | |
4581 | hda_nid_t cap1, hda_nid_t cap2) | |
4582 | { | |
4583 | struct alc_spec *spec = codec->spec; | |
4584 | struct hda_input_mux *imux = &spec->private_imux[0]; | |
4585 | int i, err, idx; | |
4586 | ||
4587 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
4588 | hda_nid_t pin; | |
4589 | ||
4590 | pin = cfg->input_pins[i]; | |
4591 | if (!alc_is_input_pin(codec, pin)) | |
4592 | continue; | |
4593 | ||
4594 | if (mixer) { | |
4595 | idx = get_connection_index(codec, mixer, pin); | |
4596 | if (idx >= 0) { | |
4597 | err = new_analog_input(spec, pin, | |
4598 | auto_pin_cfg_labels[i], | |
4599 | idx, mixer); | |
4600 | if (err < 0) | |
4601 | return err; | |
4602 | } | |
4603 | } | |
4604 | ||
4605 | if (!cap1) | |
4606 | continue; | |
4607 | idx = get_connection_index(codec, cap1, pin); | |
4608 | if (idx < 0 && cap2) | |
4609 | idx = get_connection_index(codec, cap2, pin); | |
4610 | if (idx >= 0) { | |
4611 | imux->items[imux->num_items].label = | |
4612 | auto_pin_cfg_labels[i]; | |
4613 | imux->items[imux->num_items].index = idx; | |
4614 | imux->num_items++; | |
4615 | } | |
4616 | } | |
4617 | return 0; | |
4618 | } | |
4619 | ||
4620 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, | |
4621 | const struct auto_pin_cfg *cfg) | |
4622 | { | |
4623 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); | |
4624 | } | |
4625 | ||
4626 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, | |
4627 | unsigned int pin_type) | |
4628 | { | |
4629 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4630 | pin_type); | |
4631 | /* unmute pin */ | |
4632 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
4633 | AMP_OUT_UNMUTE); | |
4634 | } | |
4635 | ||
4636 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, | |
4637 | hda_nid_t nid, int pin_type, | |
4638 | int dac_idx) | |
4639 | { | |
4640 | alc_set_pin_output(codec, nid, pin_type); | |
4641 | /* need the manual connection? */ | |
4642 | if (alc880_is_multi_pin(nid)) { | |
4643 | struct alc_spec *spec = codec->spec; | |
4644 | int idx = alc880_multi_pin_idx(nid); | |
4645 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
4646 | AC_VERB_SET_CONNECT_SEL, | |
4647 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
4648 | } | |
4649 | } | |
4650 | ||
4651 | static int get_pin_type(int line_out_type) | |
4652 | { | |
4653 | if (line_out_type == AUTO_PIN_HP_OUT) | |
4654 | return PIN_HP; | |
4655 | else | |
4656 | return PIN_OUT; | |
4657 | } | |
4658 | ||
4659 | static void alc880_auto_init_multi_out(struct hda_codec *codec) | |
4660 | { | |
4661 | struct alc_spec *spec = codec->spec; | |
4662 | int i; | |
4663 | ||
4664 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
4665 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
4666 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
4667 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); | |
4668 | } | |
4669 | } | |
4670 | ||
4671 | static void alc880_auto_init_extra_out(struct hda_codec *codec) | |
4672 | { | |
4673 | struct alc_spec *spec = codec->spec; | |
4674 | hda_nid_t pin; | |
4675 | ||
4676 | pin = spec->autocfg.speaker_pins[0]; | |
4677 | if (pin) /* connect to front */ | |
4678 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
4679 | pin = spec->autocfg.hp_pins[0]; | |
4680 | if (pin) /* connect to front */ | |
4681 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
4682 | } | |
4683 | ||
4684 | static void alc880_auto_init_analog_input(struct hda_codec *codec) | |
4685 | { | |
4686 | struct alc_spec *spec = codec->spec; | |
4687 | int i; | |
4688 | ||
4689 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
4690 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
4691 | if (alc_is_input_pin(codec, nid)) { | |
4692 | alc_set_input_pin(codec, nid, i); | |
4693 | if (nid != ALC880_PIN_CD_NID && | |
4694 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
4695 | snd_hda_codec_write(codec, nid, 0, | |
4696 | AC_VERB_SET_AMP_GAIN_MUTE, | |
4697 | AMP_OUT_MUTE); | |
4698 | } | |
4699 | } | |
4700 | } | |
4701 | ||
4702 | /* parse the BIOS configuration and set up the alc_spec */ | |
4703 | /* return 1 if successful, 0 if the proper config is not found, | |
4704 | * or a negative error code | |
4705 | */ | |
4706 | static int alc880_parse_auto_config(struct hda_codec *codec) | |
4707 | { | |
4708 | struct alc_spec *spec = codec->spec; | |
4709 | int i, err; | |
4710 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; | |
4711 | ||
4712 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
4713 | alc880_ignore); | |
4714 | if (err < 0) | |
4715 | return err; | |
4716 | if (!spec->autocfg.line_outs) | |
4717 | return 0; /* can't find valid BIOS pin config */ | |
4718 | ||
4719 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | |
4720 | if (err < 0) | |
4721 | return err; | |
4722 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
4723 | if (err < 0) | |
4724 | return err; | |
4725 | err = alc880_auto_create_extra_out(spec, | |
4726 | spec->autocfg.speaker_pins[0], | |
4727 | "Speaker"); | |
4728 | if (err < 0) | |
4729 | return err; | |
4730 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
4731 | "Headphone"); | |
4732 | if (err < 0) | |
4733 | return err; | |
4734 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); | |
4735 | if (err < 0) | |
4736 | return err; | |
4737 | ||
4738 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
4739 | ||
4740 | /* check multiple SPDIF-out (for recent codecs) */ | |
4741 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | |
4742 | hda_nid_t dig_nid; | |
4743 | err = snd_hda_get_connections(codec, | |
4744 | spec->autocfg.dig_out_pins[i], | |
4745 | &dig_nid, 1); | |
4746 | if (err < 0) | |
4747 | continue; | |
4748 | if (!i) | |
4749 | spec->multiout.dig_out_nid = dig_nid; | |
4750 | else { | |
4751 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | |
4752 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) | |
4753 | break; | |
4754 | spec->slave_dig_outs[i - 1] = dig_nid; | |
4755 | } | |
4756 | } | |
4757 | if (spec->autocfg.dig_in_pin) | |
4758 | spec->dig_in_nid = ALC880_DIGIN_NID; | |
4759 | ||
4760 | if (spec->kctls.list) | |
4761 | add_mixer(spec, spec->kctls.list); | |
4762 | ||
4763 | add_verb(spec, alc880_volume_init_verbs); | |
4764 | ||
4765 | spec->num_mux_defs = 1; | |
4766 | spec->input_mux = &spec->private_imux[0]; | |
4767 | ||
4768 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); | |
4769 | ||
4770 | return 1; | |
4771 | } | |
4772 | ||
4773 | /* additional initialization for auto-configuration model */ | |
4774 | static void alc880_auto_init(struct hda_codec *codec) | |
4775 | { | |
4776 | struct alc_spec *spec = codec->spec; | |
4777 | alc880_auto_init_multi_out(codec); | |
4778 | alc880_auto_init_extra_out(codec); | |
4779 | alc880_auto_init_analog_input(codec); | |
4780 | if (spec->unsol_event) | |
4781 | alc_inithook(codec); | |
4782 | } | |
4783 | ||
4784 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only | |
4785 | * one of two digital mic pins, e.g. on ALC272 | |
4786 | */ | |
4787 | static void fixup_automic_adc(struct hda_codec *codec) | |
4788 | { | |
4789 | struct alc_spec *spec = codec->spec; | |
4790 | int i; | |
4791 | ||
4792 | for (i = 0; i < spec->num_adc_nids; i++) { | |
4793 | hda_nid_t cap = spec->capsrc_nids ? | |
4794 | spec->capsrc_nids[i] : spec->adc_nids[i]; | |
4795 | int iidx, eidx; | |
4796 | ||
4797 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); | |
4798 | if (iidx < 0) | |
4799 | continue; | |
4800 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); | |
4801 | if (eidx < 0) | |
4802 | continue; | |
4803 | spec->int_mic.mux_idx = iidx; | |
4804 | spec->ext_mic.mux_idx = eidx; | |
4805 | if (spec->capsrc_nids) | |
4806 | spec->capsrc_nids += i; | |
4807 | spec->adc_nids += i; | |
4808 | spec->num_adc_nids = 1; | |
4809 | return; | |
4810 | } | |
4811 | snd_printd(KERN_INFO "hda_codec: %s: " | |
4812 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", | |
4813 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); | |
4814 | spec->auto_mic = 0; /* disable auto-mic to be sure */ | |
4815 | } | |
4816 | ||
4817 | /* choose the ADC/MUX containing the input pin and initialize the setup */ | |
4818 | static void fixup_single_adc(struct hda_codec *codec) | |
4819 | { | |
4820 | struct alc_spec *spec = codec->spec; | |
4821 | hda_nid_t pin; | |
4822 | int i; | |
4823 | ||
4824 | /* search for the input pin; there must be only one */ | |
4825 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
4826 | if (spec->autocfg.input_pins[i]) { | |
4827 | pin = spec->autocfg.input_pins[i]; | |
4828 | break; | |
4829 | } | |
4830 | } | |
4831 | if (!pin) | |
4832 | return; | |
4833 | ||
4834 | /* set the default connection to that pin */ | |
4835 | for (i = 0; i < spec->num_adc_nids; i++) { | |
4836 | hda_nid_t cap = spec->capsrc_nids ? | |
4837 | spec->capsrc_nids[i] : spec->adc_nids[i]; | |
4838 | int idx; | |
4839 | ||
4840 | idx = get_connection_index(codec, cap, pin); | |
4841 | if (idx < 0) | |
4842 | continue; | |
4843 | /* use only this ADC */ | |
4844 | if (spec->capsrc_nids) | |
4845 | spec->capsrc_nids += i; | |
4846 | spec->adc_nids += i; | |
4847 | spec->num_adc_nids = 1; | |
4848 | /* select or unmute this route */ | |
4849 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { | |
4850 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, | |
4851 | HDA_AMP_MUTE, 0); | |
4852 | } else { | |
4853 | snd_hda_codec_write_cache(codec, cap, 0, | |
4854 | AC_VERB_SET_CONNECT_SEL, idx); | |
4855 | } | |
4856 | return; | |
4857 | } | |
4858 | } | |
4859 | ||
4860 | static void set_capture_mixer(struct hda_codec *codec) | |
4861 | { | |
4862 | struct alc_spec *spec = codec->spec; | |
4863 | static struct snd_kcontrol_new *caps[2][3] = { | |
4864 | { alc_capture_mixer_nosrc1, | |
4865 | alc_capture_mixer_nosrc2, | |
4866 | alc_capture_mixer_nosrc3 }, | |
4867 | { alc_capture_mixer1, | |
4868 | alc_capture_mixer2, | |
4869 | alc_capture_mixer3 }, | |
4870 | }; | |
4871 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { | |
4872 | int mux = 0; | |
4873 | if (spec->auto_mic) | |
4874 | fixup_automic_adc(codec); | |
4875 | else if (spec->input_mux) { | |
4876 | if (spec->input_mux->num_items > 1) | |
4877 | mux = 1; | |
4878 | else if (spec->input_mux->num_items == 1) | |
4879 | fixup_single_adc(codec); | |
4880 | } | |
4881 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; | |
4882 | } | |
4883 | } | |
4884 | ||
4885 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | |
4886 | #define set_beep_amp(spec, nid, idx, dir) \ | |
4887 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) | |
4888 | #else | |
4889 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ | |
4890 | #endif | |
4891 | ||
4892 | /* | |
4893 | * OK, here we have finally the patch for ALC880 | |
4894 | */ | |
4895 | ||
4896 | static int patch_alc880(struct hda_codec *codec) | |
4897 | { | |
4898 | struct alc_spec *spec; | |
4899 | int board_config; | |
4900 | int err; | |
4901 | ||
4902 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
4903 | if (spec == NULL) | |
4904 | return -ENOMEM; | |
4905 | ||
4906 | codec->spec = spec; | |
4907 | ||
4908 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, | |
4909 | alc880_models, | |
4910 | alc880_cfg_tbl); | |
4911 | if (board_config < 0) { | |
4912 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
4913 | codec->chip_name); | |
4914 | board_config = ALC880_AUTO; | |
4915 | } | |
4916 | ||
4917 | if (board_config == ALC880_AUTO) { | |
4918 | /* automatic parse from the BIOS config */ | |
4919 | err = alc880_parse_auto_config(codec); | |
4920 | if (err < 0) { | |
4921 | alc_free(codec); | |
4922 | return err; | |
4923 | } else if (!err) { | |
4924 | printk(KERN_INFO | |
4925 | "hda_codec: Cannot set up configuration " | |
4926 | "from BIOS. Using 3-stack mode...\n"); | |
4927 | board_config = ALC880_3ST; | |
4928 | } | |
4929 | } | |
4930 | ||
4931 | err = snd_hda_attach_beep_device(codec, 0x1); | |
4932 | if (err < 0) { | |
4933 | alc_free(codec); | |
4934 | return err; | |
4935 | } | |
4936 | ||
4937 | if (board_config != ALC880_AUTO) | |
4938 | setup_preset(codec, &alc880_presets[board_config]); | |
4939 | ||
4940 | spec->stream_analog_playback = &alc880_pcm_analog_playback; | |
4941 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | |
4942 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | |
4943 | ||
4944 | spec->stream_digital_playback = &alc880_pcm_digital_playback; | |
4945 | spec->stream_digital_capture = &alc880_pcm_digital_capture; | |
4946 | ||
4947 | if (!spec->adc_nids && spec->input_mux) { | |
4948 | /* check whether NID 0x07 is valid */ | |
4949 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); | |
4950 | /* get type */ | |
4951 | wcap = get_wcaps_type(wcap); | |
4952 | if (wcap != AC_WID_AUD_IN) { | |
4953 | spec->adc_nids = alc880_adc_nids_alt; | |
4954 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | |
4955 | } else { | |
4956 | spec->adc_nids = alc880_adc_nids; | |
4957 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | |
4958 | } | |
4959 | } | |
4960 | set_capture_mixer(codec); | |
4961 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
4962 | ||
4963 | spec->vmaster_nid = 0x0c; | |
4964 | ||
4965 | codec->patch_ops = alc_patch_ops; | |
4966 | if (board_config == ALC880_AUTO) | |
4967 | spec->init_hook = alc880_auto_init; | |
4968 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
4969 | if (!spec->loopback.amplist) | |
4970 | spec->loopback.amplist = alc880_loopbacks; | |
4971 | #endif | |
4972 | codec->proc_widget_hook = print_realtek_coef; | |
4973 | ||
4974 | return 0; | |
4975 | } | |
4976 | ||
4977 | ||
4978 | /* | |
4979 | * ALC260 support | |
4980 | */ | |
4981 | ||
4982 | static hda_nid_t alc260_dac_nids[1] = { | |
4983 | /* front */ | |
4984 | 0x02, | |
4985 | }; | |
4986 | ||
4987 | static hda_nid_t alc260_adc_nids[1] = { | |
4988 | /* ADC0 */ | |
4989 | 0x04, | |
4990 | }; | |
4991 | ||
4992 | static hda_nid_t alc260_adc_nids_alt[1] = { | |
4993 | /* ADC1 */ | |
4994 | 0x05, | |
4995 | }; | |
4996 | ||
4997 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that | |
4998 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. | |
4999 | */ | |
5000 | static hda_nid_t alc260_dual_adc_nids[2] = { | |
5001 | /* ADC0, ADC1 */ | |
5002 | 0x04, 0x05 | |
5003 | }; | |
5004 | ||
5005 | #define ALC260_DIGOUT_NID 0x03 | |
5006 | #define ALC260_DIGIN_NID 0x06 | |
5007 | ||
5008 | static struct hda_input_mux alc260_capture_source = { | |
5009 | .num_items = 4, | |
5010 | .items = { | |
5011 | { "Mic", 0x0 }, | |
5012 | { "Front Mic", 0x1 }, | |
5013 | { "Line", 0x2 }, | |
5014 | { "CD", 0x4 }, | |
5015 | }, | |
5016 | }; | |
5017 | ||
5018 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, | |
5019 | * headphone jack and the internal CD lines since these are the only pins at | |
5020 | * which audio can appear. For flexibility, also allow the option of | |
5021 | * recording the mixer output on the second ADC (ADC0 doesn't have a | |
5022 | * connection to the mixer output). | |
5023 | */ | |
5024 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { | |
5025 | { | |
5026 | .num_items = 3, | |
5027 | .items = { | |
5028 | { "Mic/Line", 0x0 }, | |
5029 | { "CD", 0x4 }, | |
5030 | { "Headphone", 0x2 }, | |
5031 | }, | |
5032 | }, | |
5033 | { | |
5034 | .num_items = 4, | |
5035 | .items = { | |
5036 | { "Mic/Line", 0x0 }, | |
5037 | { "CD", 0x4 }, | |
5038 | { "Headphone", 0x2 }, | |
5039 | { "Mixer", 0x5 }, | |
5040 | }, | |
5041 | }, | |
5042 | ||
5043 | }; | |
5044 | ||
5045 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to | |
5046 | * the Fujitsu S702x, but jacks are marked differently. | |
5047 | */ | |
5048 | static struct hda_input_mux alc260_acer_capture_sources[2] = { | |
5049 | { | |
5050 | .num_items = 4, | |
5051 | .items = { | |
5052 | { "Mic", 0x0 }, | |
5053 | { "Line", 0x2 }, | |
5054 | { "CD", 0x4 }, | |
5055 | { "Headphone", 0x5 }, | |
5056 | }, | |
5057 | }, | |
5058 | { | |
5059 | .num_items = 5, | |
5060 | .items = { | |
5061 | { "Mic", 0x0 }, | |
5062 | { "Line", 0x2 }, | |
5063 | { "CD", 0x4 }, | |
5064 | { "Headphone", 0x6 }, | |
5065 | { "Mixer", 0x5 }, | |
5066 | }, | |
5067 | }, | |
5068 | }; | |
5069 | ||
5070 | /* Maxdata Favorit 100XS */ | |
5071 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { | |
5072 | { | |
5073 | .num_items = 2, | |
5074 | .items = { | |
5075 | { "Line/Mic", 0x0 }, | |
5076 | { "CD", 0x4 }, | |
5077 | }, | |
5078 | }, | |
5079 | { | |
5080 | .num_items = 3, | |
5081 | .items = { | |
5082 | { "Line/Mic", 0x0 }, | |
5083 | { "CD", 0x4 }, | |
5084 | { "Mixer", 0x5 }, | |
5085 | }, | |
5086 | }, | |
5087 | }; | |
5088 | ||
5089 | /* | |
5090 | * This is just place-holder, so there's something for alc_build_pcms to look | |
5091 | * at when it calculates the maximum number of channels. ALC260 has no mixer | |
5092 | * element which allows changing the channel mode, so the verb list is | |
5093 | * never used. | |
5094 | */ | |
5095 | static struct hda_channel_mode alc260_modes[1] = { | |
5096 | { 2, NULL }, | |
5097 | }; | |
5098 | ||
5099 | ||
5100 | /* Mixer combinations | |
5101 | * | |
5102 | * basic: base_output + input + pc_beep + capture | |
5103 | * HP: base_output + input + capture_alt | |
5104 | * HP_3013: hp_3013 + input + capture | |
5105 | * fujitsu: fujitsu + capture | |
5106 | * acer: acer + capture | |
5107 | */ | |
5108 | ||
5109 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { | |
5110 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5111 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | |
5112 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5113 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | |
5114 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
5115 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
5116 | { } /* end */ | |
5117 | }; | |
5118 | ||
5119 | static struct snd_kcontrol_new alc260_input_mixer[] = { | |
5120 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5121 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5122 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5123 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5124 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5125 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5126 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), | |
5127 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), | |
5128 | { } /* end */ | |
5129 | }; | |
5130 | ||
5131 | /* update HP, line and mono out pins according to the master switch */ | |
5132 | static void alc260_hp_master_update(struct hda_codec *codec, | |
5133 | hda_nid_t hp, hda_nid_t line, | |
5134 | hda_nid_t mono) | |
5135 | { | |
5136 | struct alc_spec *spec = codec->spec; | |
5137 | unsigned int val = spec->master_sw ? PIN_HP : 0; | |
5138 | /* change HP and line-out pins */ | |
5139 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5140 | val); | |
5141 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5142 | val); | |
5143 | /* mono (speaker) depending on the HP jack sense */ | |
5144 | val = (val && !spec->jack_present) ? PIN_OUT : 0; | |
5145 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5146 | val); | |
5147 | } | |
5148 | ||
5149 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, | |
5150 | struct snd_ctl_elem_value *ucontrol) | |
5151 | { | |
5152 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5153 | struct alc_spec *spec = codec->spec; | |
5154 | *ucontrol->value.integer.value = spec->master_sw; | |
5155 | return 0; | |
5156 | } | |
5157 | ||
5158 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
5159 | struct snd_ctl_elem_value *ucontrol) | |
5160 | { | |
5161 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5162 | struct alc_spec *spec = codec->spec; | |
5163 | int val = !!*ucontrol->value.integer.value; | |
5164 | hda_nid_t hp, line, mono; | |
5165 | ||
5166 | if (val == spec->master_sw) | |
5167 | return 0; | |
5168 | spec->master_sw = val; | |
5169 | hp = (kcontrol->private_value >> 16) & 0xff; | |
5170 | line = (kcontrol->private_value >> 8) & 0xff; | |
5171 | mono = kcontrol->private_value & 0xff; | |
5172 | alc260_hp_master_update(codec, hp, line, mono); | |
5173 | return 1; | |
5174 | } | |
5175 | ||
5176 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { | |
5177 | { | |
5178 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5179 | .name = "Master Playback Switch", | |
5180 | .info = snd_ctl_boolean_mono_info, | |
5181 | .get = alc260_hp_master_sw_get, | |
5182 | .put = alc260_hp_master_sw_put, | |
5183 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 | |
5184 | }, | |
5185 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5186 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | |
5187 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5188 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | |
5189 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | |
5190 | HDA_OUTPUT), | |
5191 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
5192 | { } /* end */ | |
5193 | }; | |
5194 | ||
5195 | static struct hda_verb alc260_hp_unsol_verbs[] = { | |
5196 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5197 | {}, | |
5198 | }; | |
5199 | ||
5200 | static void alc260_hp_automute(struct hda_codec *codec) | |
5201 | { | |
5202 | struct alc_spec *spec = codec->spec; | |
5203 | ||
5204 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); | |
5205 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); | |
5206 | } | |
5207 | ||
5208 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) | |
5209 | { | |
5210 | if ((res >> 26) == ALC880_HP_EVENT) | |
5211 | alc260_hp_automute(codec); | |
5212 | } | |
5213 | ||
5214 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { | |
5215 | { | |
5216 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5217 | .name = "Master Playback Switch", | |
5218 | .info = snd_ctl_boolean_mono_info, | |
5219 | .get = alc260_hp_master_sw_get, | |
5220 | .put = alc260_hp_master_sw_put, | |
5221 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 | |
5222 | }, | |
5223 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5224 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
5225 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), | |
5226 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), | |
5227 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5228 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
5229 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
5230 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), | |
5231 | { } /* end */ | |
5232 | }; | |
5233 | ||
5234 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { | |
5235 | .ops = &snd_hda_bind_vol, | |
5236 | .values = { | |
5237 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), | |
5238 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | |
5239 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), | |
5240 | 0 | |
5241 | }, | |
5242 | }; | |
5243 | ||
5244 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { | |
5245 | .ops = &snd_hda_bind_sw, | |
5246 | .values = { | |
5247 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), | |
5248 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
5249 | 0 | |
5250 | }, | |
5251 | }; | |
5252 | ||
5253 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { | |
5254 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), | |
5255 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), | |
5256 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), | |
5257 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
5258 | { } /* end */ | |
5259 | }; | |
5260 | ||
5261 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { | |
5262 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5263 | {}, | |
5264 | }; | |
5265 | ||
5266 | static void alc260_hp_3013_automute(struct hda_codec *codec) | |
5267 | { | |
5268 | struct alc_spec *spec = codec->spec; | |
5269 | ||
5270 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | |
5271 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); | |
5272 | } | |
5273 | ||
5274 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, | |
5275 | unsigned int res) | |
5276 | { | |
5277 | if ((res >> 26) == ALC880_HP_EVENT) | |
5278 | alc260_hp_3013_automute(codec); | |
5279 | } | |
5280 | ||
5281 | static void alc260_hp_3012_automute(struct hda_codec *codec) | |
5282 | { | |
5283 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; | |
5284 | ||
5285 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5286 | bits); | |
5287 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5288 | bits); | |
5289 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5290 | bits); | |
5291 | } | |
5292 | ||
5293 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, | |
5294 | unsigned int res) | |
5295 | { | |
5296 | if ((res >> 26) == ALC880_HP_EVENT) | |
5297 | alc260_hp_3012_automute(codec); | |
5298 | } | |
5299 | ||
5300 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | |
5301 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. | |
5302 | */ | |
5303 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { | |
5304 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5305 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), | |
5306 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
5307 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5308 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5309 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5310 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5311 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5312 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5313 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), | |
5314 | { } /* end */ | |
5315 | }; | |
5316 | ||
5317 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current | |
5318 | * versions of the ALC260 don't act on requests to enable mic bias from NID | |
5319 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 | |
5320 | * datasheet doesn't mention this restriction. At this stage it's not clear | |
5321 | * whether this behaviour is intentional or is a hardware bug in chip | |
5322 | * revisions available in early 2006. Therefore for now allow the | |
5323 | * "Headphone Jack Mode" control to span all choices, but if it turns out | |
5324 | * that the lack of mic bias for this NID is intentional we could change the | |
5325 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
5326 | * | |
5327 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 | |
5328 | * don't appear to make the mic bias available from the "line" jack, even | |
5329 | * though the NID used for this jack (0x14) can supply it. The theory is | |
5330 | * that perhaps Acer have included blocking capacitors between the ALC260 | |
5331 | * and the output jack. If this turns out to be the case for all such | |
5332 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT | |
5333 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
5334 | * | |
5335 | * The C20x Tablet series have a mono internal speaker which is controlled | |
5336 | * via the chip's Mono sum widget and pin complex, so include the necessary | |
5337 | * controls for such models. On models without a "mono speaker" the control | |
5338 | * won't do anything. | |
5339 | */ | |
5340 | static struct snd_kcontrol_new alc260_acer_mixer[] = { | |
5341 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5342 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
5343 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | |
5344 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | |
5345 | HDA_OUTPUT), | |
5346 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, | |
5347 | HDA_INPUT), | |
5348 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5349 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5350 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5351 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5352 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5353 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5354 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5355 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
5356 | { } /* end */ | |
5357 | }; | |
5358 | ||
5359 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack | |
5360 | */ | |
5361 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { | |
5362 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5363 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
5364 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | |
5365 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5366 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5367 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5368 | { } /* end */ | |
5369 | }; | |
5370 | ||
5371 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, | |
5372 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. | |
5373 | */ | |
5374 | static struct snd_kcontrol_new alc260_will_mixer[] = { | |
5375 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5376 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
5377 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5378 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5379 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5380 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5381 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5382 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
5383 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5384 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5385 | { } /* end */ | |
5386 | }; | |
5387 | ||
5388 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, | |
5389 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. | |
5390 | */ | |
5391 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { | |
5392 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5393 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
5394 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5395 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5396 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5397 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), | |
5398 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), | |
5399 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5400 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5401 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
5402 | { } /* end */ | |
5403 | }; | |
5404 | ||
5405 | /* | |
5406 | * initialization verbs | |
5407 | */ | |
5408 | static struct hda_verb alc260_init_verbs[] = { | |
5409 | /* Line In pin widget for input */ | |
5410 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
5411 | /* CD pin widget for input */ | |
5412 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
5413 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
5414 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
5415 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
5416 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
5417 | /* LINE-2 is used for line-out in rear */ | |
5418 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5419 | /* select line-out */ | |
5420 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5421 | /* LINE-OUT pin */ | |
5422 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5423 | /* enable HP */ | |
5424 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5425 | /* enable Mono */ | |
5426 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5427 | /* mute capture amp left and right */ | |
5428 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5429 | /* set connection select to line in (default select for this ADC) */ | |
5430 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
5431 | /* mute capture amp left and right */ | |
5432 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5433 | /* set connection select to line in (default select for this ADC) */ | |
5434 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
5435 | /* set vol=0 Line-Out mixer amp left and right */ | |
5436 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5437 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
5438 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5439 | /* set vol=0 HP mixer amp left and right */ | |
5440 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5441 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
5442 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5443 | /* set vol=0 Mono mixer amp left and right */ | |
5444 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5445 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
5446 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5447 | /* unmute LINE-2 out pin */ | |
5448 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5449 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | |
5450 | * Line In 2 = 0x03 | |
5451 | */ | |
5452 | /* mute analog inputs */ | |
5453 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5454 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5455 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5456 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5457 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5458 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | |
5459 | /* mute Front out path */ | |
5460 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5461 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5462 | /* mute Headphone out path */ | |
5463 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5464 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5465 | /* mute Mono out path */ | |
5466 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5467 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5468 | { } | |
5469 | }; | |
5470 | ||
5471 | #if 0 /* should be identical with alc260_init_verbs? */ | |
5472 | static struct hda_verb alc260_hp_init_verbs[] = { | |
5473 | /* Headphone and output */ | |
5474 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
5475 | /* mono output */ | |
5476 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5477 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
5478 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5479 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
5480 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5481 | /* Line In pin widget for input */ | |
5482 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
5483 | /* Line-2 pin widget for output */ | |
5484 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5485 | /* CD pin widget for input */ | |
5486 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
5487 | /* unmute amp left and right */ | |
5488 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
5489 | /* set connection select to line in (default select for this ADC) */ | |
5490 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
5491 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
5492 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
5493 | /* mute pin widget amp left and right (no gain on this amp) */ | |
5494 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
5495 | /* unmute HP mixer amp left and right (volume = 0) */ | |
5496 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
5497 | /* mute pin widget amp left and right (no gain on this amp) */ | |
5498 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
5499 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | |
5500 | * Line In 2 = 0x03 | |
5501 | */ | |
5502 | /* mute analog inputs */ | |
5503 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5505 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5506 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5507 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5508 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | |
5509 | /* Unmute Front out path */ | |
5510 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5511 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
5512 | /* Unmute Headphone out path */ | |
5513 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5514 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
5515 | /* Unmute Mono out path */ | |
5516 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5517 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
5518 | { } | |
5519 | }; | |
5520 | #endif | |
5521 | ||
5522 | static struct hda_verb alc260_hp_3013_init_verbs[] = { | |
5523 | /* Line out and output */ | |
5524 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5525 | /* mono output */ | |
5526 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5527 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
5528 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5529 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
5530 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5531 | /* Line In pin widget for input */ | |
5532 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
5533 | /* Headphone pin widget for output */ | |
5534 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
5535 | /* CD pin widget for input */ | |
5536 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
5537 | /* unmute amp left and right */ | |
5538 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
5539 | /* set connection select to line in (default select for this ADC) */ | |
5540 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
5541 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
5542 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
5543 | /* mute pin widget amp left and right (no gain on this amp) */ | |
5544 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
5545 | /* unmute HP mixer amp left and right (volume = 0) */ | |
5546 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
5547 | /* mute pin widget amp left and right (no gain on this amp) */ | |
5548 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
5549 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | |
5550 | * Line In 2 = 0x03 | |
5551 | */ | |
5552 | /* mute analog inputs */ | |
5553 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5554 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5555 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5556 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5557 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5558 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | |
5559 | /* Unmute Front out path */ | |
5560 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5561 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
5562 | /* Unmute Headphone out path */ | |
5563 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5564 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
5565 | /* Unmute Mono out path */ | |
5566 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5567 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
5568 | { } | |
5569 | }; | |
5570 | ||
5571 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x | |
5572 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD | |
5573 | * audio = 0x16, internal speaker = 0x10. | |
5574 | */ | |
5575 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | |
5576 | /* Disable all GPIOs */ | |
5577 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, | |
5578 | /* Internal speaker is connected to headphone pin */ | |
5579 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5580 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ | |
5581 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5582 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ | |
5583 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
5584 | /* Ensure all other unused pins are disabled and muted. */ | |
5585 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
5586 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5587 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
5588 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5589 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
5590 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5591 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
5592 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5593 | ||
5594 | /* Disable digital (SPDIF) pins */ | |
5595 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
5596 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
5597 | ||
5598 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus | |
5599 | * when acting as an output. | |
5600 | */ | |
5601 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
5602 | ||
5603 | /* Start with output sum widgets muted and their output gains at min */ | |
5604 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5605 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5606 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5607 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5608 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5609 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5610 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5611 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5612 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5613 | ||
5614 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ | |
5615 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5616 | /* Unmute Line1 pin widget output buffer since it starts as an output. | |
5617 | * If the pin mode is changed by the user the pin mode control will | |
5618 | * take care of enabling the pin's input/output buffers as needed. | |
5619 | * Therefore there's no need to enable the input buffer at this | |
5620 | * stage. | |
5621 | */ | |
5622 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5623 | /* Unmute input buffer of pin widget used for Line-in (no equiv | |
5624 | * mixer ctrl) | |
5625 | */ | |
5626 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5627 | ||
5628 | /* Mute capture amp left and right */ | |
5629 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5630 | /* Set ADC connection select to match default mixer setting - line | |
5631 | * in (on mic1 pin) | |
5632 | */ | |
5633 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5634 | ||
5635 | /* Do the same for the second ADC: mute capture input amp and | |
5636 | * set ADC connection to line in (on mic1 pin) | |
5637 | */ | |
5638 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5639 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5640 | ||
5641 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
5642 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
5643 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
5644 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
5645 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
5646 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
5647 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
5648 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
5649 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
5650 | ||
5651 | { } | |
5652 | }; | |
5653 | ||
5654 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and | |
5655 | * similar laptops (adapted from Fujitsu init verbs). | |
5656 | */ | |
5657 | static struct hda_verb alc260_acer_init_verbs[] = { | |
5658 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and | |
5659 | * the headphone jack. Turn this on and rely on the standard mute | |
5660 | * methods whenever the user wants to turn these outputs off. | |
5661 | */ | |
5662 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
5663 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
5664 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
5665 | /* Internal speaker/Headphone jack is connected to Line-out pin */ | |
5666 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5667 | /* Internal microphone/Mic jack is connected to Mic1 pin */ | |
5668 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
5669 | /* Line In jack is connected to Line1 pin */ | |
5670 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
5671 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ | |
5672 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5673 | /* Ensure all other unused pins are disabled and muted. */ | |
5674 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
5675 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5676 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
5677 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5678 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
5679 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5680 | /* Disable digital (SPDIF) pins */ | |
5681 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
5682 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
5683 | ||
5684 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | |
5685 | * bus when acting as outputs. | |
5686 | */ | |
5687 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
5688 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
5689 | ||
5690 | /* Start with output sum widgets muted and their output gains at min */ | |
5691 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5692 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5693 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5694 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5695 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5696 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5697 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5698 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5699 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5700 | ||
5701 | /* Unmute Line-out pin widget amp left and right | |
5702 | * (no equiv mixer ctrl) | |
5703 | */ | |
5704 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5705 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ | |
5706 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5707 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as | |
5708 | * inputs. If the pin mode is changed by the user the pin mode control | |
5709 | * will take care of enabling the pin's input/output buffers as needed. | |
5710 | * Therefore there's no need to enable the input buffer at this | |
5711 | * stage. | |
5712 | */ | |
5713 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5714 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5715 | ||
5716 | /* Mute capture amp left and right */ | |
5717 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5718 | /* Set ADC connection select to match default mixer setting - mic | |
5719 | * (on mic1 pin) | |
5720 | */ | |
5721 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5722 | ||
5723 | /* Do similar with the second ADC: mute capture input amp and | |
5724 | * set ADC connection to mic to match ALSA's default state. | |
5725 | */ | |
5726 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5727 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5728 | ||
5729 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
5730 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
5731 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
5732 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
5733 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
5734 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
5735 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
5736 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
5737 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
5738 | ||
5739 | { } | |
5740 | }; | |
5741 | ||
5742 | /* Initialisation sequence for Maxdata Favorit 100XS | |
5743 | * (adapted from Acer init verbs). | |
5744 | */ | |
5745 | static struct hda_verb alc260_favorit100_init_verbs[] = { | |
5746 | /* GPIO 0 enables the output jack. | |
5747 | * Turn this on and rely on the standard mute | |
5748 | * methods whenever the user wants to turn these outputs off. | |
5749 | */ | |
5750 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
5751 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
5752 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
5753 | /* Line/Mic input jack is connected to Mic1 pin */ | |
5754 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
5755 | /* Ensure all other unused pins are disabled and muted. */ | |
5756 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
5757 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5758 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
5759 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5760 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
5761 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5762 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
5763 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5764 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
5765 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5766 | /* Disable digital (SPDIF) pins */ | |
5767 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
5768 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
5769 | ||
5770 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | |
5771 | * bus when acting as outputs. | |
5772 | */ | |
5773 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
5774 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
5775 | ||
5776 | /* Start with output sum widgets muted and their output gains at min */ | |
5777 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5778 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5779 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5780 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5781 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5782 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5783 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5784 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5785 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5786 | ||
5787 | /* Unmute Line-out pin widget amp left and right | |
5788 | * (no equiv mixer ctrl) | |
5789 | */ | |
5790 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5791 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as | |
5792 | * inputs. If the pin mode is changed by the user the pin mode control | |
5793 | * will take care of enabling the pin's input/output buffers as needed. | |
5794 | * Therefore there's no need to enable the input buffer at this | |
5795 | * stage. | |
5796 | */ | |
5797 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5798 | ||
5799 | /* Mute capture amp left and right */ | |
5800 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5801 | /* Set ADC connection select to match default mixer setting - mic | |
5802 | * (on mic1 pin) | |
5803 | */ | |
5804 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5805 | ||
5806 | /* Do similar with the second ADC: mute capture input amp and | |
5807 | * set ADC connection to mic to match ALSA's default state. | |
5808 | */ | |
5809 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5810 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5811 | ||
5812 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
5813 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
5814 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
5815 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
5816 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
5817 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
5818 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
5819 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
5820 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
5821 | ||
5822 | { } | |
5823 | }; | |
5824 | ||
5825 | static struct hda_verb alc260_will_verbs[] = { | |
5826 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5827 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5828 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5829 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
5830 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
5831 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, | |
5832 | {} | |
5833 | }; | |
5834 | ||
5835 | static struct hda_verb alc260_replacer_672v_verbs[] = { | |
5836 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
5837 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
5838 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, | |
5839 | ||
5840 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
5841 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
5842 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
5843 | ||
5844 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5845 | {} | |
5846 | }; | |
5847 | ||
5848 | /* toggle speaker-output according to the hp-jack state */ | |
5849 | static void alc260_replacer_672v_automute(struct hda_codec *codec) | |
5850 | { | |
5851 | unsigned int present; | |
5852 | ||
5853 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ | |
5854 | present = snd_hda_jack_detect(codec, 0x0f); | |
5855 | if (present) { | |
5856 | snd_hda_codec_write_cache(codec, 0x01, 0, | |
5857 | AC_VERB_SET_GPIO_DATA, 1); | |
5858 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
5859 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5860 | PIN_HP); | |
5861 | } else { | |
5862 | snd_hda_codec_write_cache(codec, 0x01, 0, | |
5863 | AC_VERB_SET_GPIO_DATA, 0); | |
5864 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
5865 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5866 | PIN_OUT); | |
5867 | } | |
5868 | } | |
5869 | ||
5870 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, | |
5871 | unsigned int res) | |
5872 | { | |
5873 | if ((res >> 26) == ALC880_HP_EVENT) | |
5874 | alc260_replacer_672v_automute(codec); | |
5875 | } | |
5876 | ||
5877 | static struct hda_verb alc260_hp_dc7600_verbs[] = { | |
5878 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
5879 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
5880 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5881 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5882 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5883 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5884 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
5885 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5886 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5887 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5888 | {} | |
5889 | }; | |
5890 | ||
5891 | /* Test configuration for debugging, modelled after the ALC880 test | |
5892 | * configuration. | |
5893 | */ | |
5894 | #ifdef CONFIG_SND_DEBUG | |
5895 | static hda_nid_t alc260_test_dac_nids[1] = { | |
5896 | 0x02, | |
5897 | }; | |
5898 | static hda_nid_t alc260_test_adc_nids[2] = { | |
5899 | 0x04, 0x05, | |
5900 | }; | |
5901 | /* For testing the ALC260, each input MUX needs its own definition since | |
5902 | * the signal assignments are different. This assumes that the first ADC | |
5903 | * is NID 0x04. | |
5904 | */ | |
5905 | static struct hda_input_mux alc260_test_capture_sources[2] = { | |
5906 | { | |
5907 | .num_items = 7, | |
5908 | .items = { | |
5909 | { "MIC1 pin", 0x0 }, | |
5910 | { "MIC2 pin", 0x1 }, | |
5911 | { "LINE1 pin", 0x2 }, | |
5912 | { "LINE2 pin", 0x3 }, | |
5913 | { "CD pin", 0x4 }, | |
5914 | { "LINE-OUT pin", 0x5 }, | |
5915 | { "HP-OUT pin", 0x6 }, | |
5916 | }, | |
5917 | }, | |
5918 | { | |
5919 | .num_items = 8, | |
5920 | .items = { | |
5921 | { "MIC1 pin", 0x0 }, | |
5922 | { "MIC2 pin", 0x1 }, | |
5923 | { "LINE1 pin", 0x2 }, | |
5924 | { "LINE2 pin", 0x3 }, | |
5925 | { "CD pin", 0x4 }, | |
5926 | { "Mixer", 0x5 }, | |
5927 | { "LINE-OUT pin", 0x6 }, | |
5928 | { "HP-OUT pin", 0x7 }, | |
5929 | }, | |
5930 | }, | |
5931 | }; | |
5932 | static struct snd_kcontrol_new alc260_test_mixer[] = { | |
5933 | /* Output driver widgets */ | |
5934 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
5935 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
5936 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5937 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), | |
5938 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5939 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), | |
5940 | ||
5941 | /* Modes for retasking pin widgets | |
5942 | * Note: the ALC260 doesn't seem to act on requests to enable mic | |
5943 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't | |
5944 | * mention this restriction. At this stage it's not clear whether | |
5945 | * this behaviour is intentional or is a hardware bug in chip | |
5946 | * revisions available at least up until early 2006. Therefore for | |
5947 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all | |
5948 | * choices, but if it turns out that the lack of mic bias for these | |
5949 | * NIDs is intentional we could change their modes from | |
5950 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
5951 | */ | |
5952 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), | |
5953 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), | |
5954 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
5955 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
5956 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), | |
5957 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), | |
5958 | ||
5959 | /* Loopback mixer controls */ | |
5960 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), | |
5961 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), | |
5962 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), | |
5963 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), | |
5964 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5965 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5966 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), | |
5967 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), | |
5968 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5969 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5970 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), | |
5971 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), | |
5972 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), | |
5973 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), | |
5974 | ||
5975 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
5976 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
5977 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
5978 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
5979 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
5980 | ||
5981 | /* Switches to allow the digital IO pins to be enabled. The datasheet | |
5982 | * is ambigious as to which NID is which; testing on laptops which | |
5983 | * make this output available should provide clarification. | |
5984 | */ | |
5985 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | |
5986 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | |
5987 | ||
5988 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | |
5989 | * this output to turn on an external amplifier. | |
5990 | */ | |
5991 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
5992 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
5993 | ||
5994 | { } /* end */ | |
5995 | }; | |
5996 | static struct hda_verb alc260_test_init_verbs[] = { | |
5997 | /* Enable all GPIOs as outputs with an initial value of 0 */ | |
5998 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, | |
5999 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
6000 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, | |
6001 | ||
6002 | /* Enable retasking pins as output, initially without power amp */ | |
6003 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6004 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6005 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6006 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6007 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6008 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6009 | ||
6010 | /* Disable digital (SPDIF) pins initially, but users can enable | |
6011 | * them via a mixer switch. In the case of SPDIF-out, this initverb | |
6012 | * payload also sets the generation to 0, output to be in "consumer" | |
6013 | * PCM format, copyright asserted, no pre-emphasis and no validity | |
6014 | * control. | |
6015 | */ | |
6016 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6017 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6018 | ||
6019 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the | |
6020 | * OUT1 sum bus when acting as an output. | |
6021 | */ | |
6022 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6023 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, | |
6024 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6025 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, | |
6026 | ||
6027 | /* Start with output sum widgets muted and their output gains at min */ | |
6028 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6029 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6030 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6031 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6032 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6033 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6034 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6035 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6036 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6037 | ||
6038 | /* Unmute retasking pin widget output buffers since the default | |
6039 | * state appears to be output. As the pin mode is changed by the | |
6040 | * user the pin mode control will take care of enabling the pin's | |
6041 | * input/output buffers as needed. | |
6042 | */ | |
6043 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6044 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6045 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6046 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6047 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6048 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6049 | /* Also unmute the mono-out pin widget */ | |
6050 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6051 | ||
6052 | /* Mute capture amp left and right */ | |
6053 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6054 | /* Set ADC connection select to match default mixer setting (mic1 | |
6055 | * pin) | |
6056 | */ | |
6057 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6058 | ||
6059 | /* Do the same for the second ADC: mute capture input amp and | |
6060 | * set ADC connection to mic1 pin | |
6061 | */ | |
6062 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6063 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6064 | ||
6065 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6066 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6067 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6068 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6069 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6070 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6071 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6072 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6073 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6074 | ||
6075 | { } | |
6076 | }; | |
6077 | #endif | |
6078 | ||
6079 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback | |
6080 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture | |
6081 | ||
6082 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback | |
6083 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture | |
6084 | ||
6085 | /* | |
6086 | * for BIOS auto-configuration | |
6087 | */ | |
6088 | ||
6089 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, | |
6090 | const char *pfx, int *vol_bits) | |
6091 | { | |
6092 | hda_nid_t nid_vol; | |
6093 | unsigned long vol_val, sw_val; | |
6094 | int err; | |
6095 | ||
6096 | if (nid >= 0x0f && nid < 0x11) { | |
6097 | nid_vol = nid - 0x7; | |
6098 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
6099 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
6100 | } else if (nid == 0x11) { | |
6101 | nid_vol = nid - 0x7; | |
6102 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); | |
6103 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
6104 | } else if (nid >= 0x12 && nid <= 0x15) { | |
6105 | nid_vol = 0x08; | |
6106 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
6107 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
6108 | } else | |
6109 | return 0; /* N/A */ | |
6110 | ||
6111 | if (!(*vol_bits & (1 << nid_vol))) { | |
6112 | /* first control for the volume widget */ | |
6113 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val); | |
6114 | if (err < 0) | |
6115 | return err; | |
6116 | *vol_bits |= (1 << nid_vol); | |
6117 | } | |
6118 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val); | |
6119 | if (err < 0) | |
6120 | return err; | |
6121 | return 1; | |
6122 | } | |
6123 | ||
6124 | /* add playback controls from the parsed DAC table */ | |
6125 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |
6126 | const struct auto_pin_cfg *cfg) | |
6127 | { | |
6128 | hda_nid_t nid; | |
6129 | int err; | |
6130 | int vols = 0; | |
6131 | ||
6132 | spec->multiout.num_dacs = 1; | |
6133 | spec->multiout.dac_nids = spec->private_dac_nids; | |
6134 | spec->multiout.dac_nids[0] = 0x02; | |
6135 | ||
6136 | nid = cfg->line_out_pins[0]; | |
6137 | if (nid) { | |
6138 | const char *pfx; | |
6139 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) | |
6140 | pfx = "Master"; | |
6141 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
6142 | pfx = "Speaker"; | |
6143 | else | |
6144 | pfx = "Front"; | |
6145 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); | |
6146 | if (err < 0) | |
6147 | return err; | |
6148 | } | |
6149 | ||
6150 | nid = cfg->speaker_pins[0]; | |
6151 | if (nid) { | |
6152 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); | |
6153 | if (err < 0) | |
6154 | return err; | |
6155 | } | |
6156 | ||
6157 | nid = cfg->hp_pins[0]; | |
6158 | if (nid) { | |
6159 | err = alc260_add_playback_controls(spec, nid, "Headphone", | |
6160 | &vols); | |
6161 | if (err < 0) | |
6162 | return err; | |
6163 | } | |
6164 | return 0; | |
6165 | } | |
6166 | ||
6167 | /* create playback/capture controls for input pins */ | |
6168 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, | |
6169 | const struct auto_pin_cfg *cfg) | |
6170 | { | |
6171 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); | |
6172 | } | |
6173 | ||
6174 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |
6175 | hda_nid_t nid, int pin_type, | |
6176 | int sel_idx) | |
6177 | { | |
6178 | alc_set_pin_output(codec, nid, pin_type); | |
6179 | /* need the manual connection? */ | |
6180 | if (nid >= 0x12) { | |
6181 | int idx = nid - 0x12; | |
6182 | snd_hda_codec_write(codec, idx + 0x0b, 0, | |
6183 | AC_VERB_SET_CONNECT_SEL, sel_idx); | |
6184 | } | |
6185 | } | |
6186 | ||
6187 | static void alc260_auto_init_multi_out(struct hda_codec *codec) | |
6188 | { | |
6189 | struct alc_spec *spec = codec->spec; | |
6190 | hda_nid_t nid; | |
6191 | ||
6192 | nid = spec->autocfg.line_out_pins[0]; | |
6193 | if (nid) { | |
6194 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
6195 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); | |
6196 | } | |
6197 | ||
6198 | nid = spec->autocfg.speaker_pins[0]; | |
6199 | if (nid) | |
6200 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | |
6201 | ||
6202 | nid = spec->autocfg.hp_pins[0]; | |
6203 | if (nid) | |
6204 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); | |
6205 | } | |
6206 | ||
6207 | #define ALC260_PIN_CD_NID 0x16 | |
6208 | static void alc260_auto_init_analog_input(struct hda_codec *codec) | |
6209 | { | |
6210 | struct alc_spec *spec = codec->spec; | |
6211 | int i; | |
6212 | ||
6213 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
6214 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
6215 | if (nid >= 0x12) { | |
6216 | alc_set_input_pin(codec, nid, i); | |
6217 | if (nid != ALC260_PIN_CD_NID && | |
6218 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
6219 | snd_hda_codec_write(codec, nid, 0, | |
6220 | AC_VERB_SET_AMP_GAIN_MUTE, | |
6221 | AMP_OUT_MUTE); | |
6222 | } | |
6223 | } | |
6224 | } | |
6225 | ||
6226 | /* | |
6227 | * generic initialization of ADC, input mixers and output mixers | |
6228 | */ | |
6229 | static struct hda_verb alc260_volume_init_verbs[] = { | |
6230 | /* | |
6231 | * Unmute ADC0-1 and set the default input to mic-in | |
6232 | */ | |
6233 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6234 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6235 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6236 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6237 | ||
6238 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
6239 | * mixer widget | |
6240 | * Note: PASD motherboards uses the Line In 2 as the input for | |
6241 | * front panel mic (mic 2) | |
6242 | */ | |
6243 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
6244 | /* mute analog inputs */ | |
6245 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6246 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6247 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6248 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6249 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6250 | ||
6251 | /* | |
6252 | * Set up output mixers (0x08 - 0x0a) | |
6253 | */ | |
6254 | /* set vol=0 to output mixers */ | |
6255 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6256 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6257 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6258 | /* set up input amps for analog loopback */ | |
6259 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
6260 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6261 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6262 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6263 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6264 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6265 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6266 | ||
6267 | { } | |
6268 | }; | |
6269 | ||
6270 | static int alc260_parse_auto_config(struct hda_codec *codec) | |
6271 | { | |
6272 | struct alc_spec *spec = codec->spec; | |
6273 | int err; | |
6274 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; | |
6275 | ||
6276 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
6277 | alc260_ignore); | |
6278 | if (err < 0) | |
6279 | return err; | |
6280 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
6281 | if (err < 0) | |
6282 | return err; | |
6283 | if (!spec->kctls.list) | |
6284 | return 0; /* can't find valid BIOS pin config */ | |
6285 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); | |
6286 | if (err < 0) | |
6287 | return err; | |
6288 | ||
6289 | spec->multiout.max_channels = 2; | |
6290 | ||
6291 | if (spec->autocfg.dig_outs) | |
6292 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; | |
6293 | if (spec->kctls.list) | |
6294 | add_mixer(spec, spec->kctls.list); | |
6295 | ||
6296 | add_verb(spec, alc260_volume_init_verbs); | |
6297 | ||
6298 | spec->num_mux_defs = 1; | |
6299 | spec->input_mux = &spec->private_imux[0]; | |
6300 | ||
6301 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); | |
6302 | ||
6303 | return 1; | |
6304 | } | |
6305 | ||
6306 | /* additional initialization for auto-configuration model */ | |
6307 | static void alc260_auto_init(struct hda_codec *codec) | |
6308 | { | |
6309 | struct alc_spec *spec = codec->spec; | |
6310 | alc260_auto_init_multi_out(codec); | |
6311 | alc260_auto_init_analog_input(codec); | |
6312 | if (spec->unsol_event) | |
6313 | alc_inithook(codec); | |
6314 | } | |
6315 | ||
6316 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
6317 | static struct hda_amp_list alc260_loopbacks[] = { | |
6318 | { 0x07, HDA_INPUT, 0 }, | |
6319 | { 0x07, HDA_INPUT, 1 }, | |
6320 | { 0x07, HDA_INPUT, 2 }, | |
6321 | { 0x07, HDA_INPUT, 3 }, | |
6322 | { 0x07, HDA_INPUT, 4 }, | |
6323 | { } /* end */ | |
6324 | }; | |
6325 | #endif | |
6326 | ||
6327 | /* | |
6328 | * ALC260 configurations | |
6329 | */ | |
6330 | static const char *alc260_models[ALC260_MODEL_LAST] = { | |
6331 | [ALC260_BASIC] = "basic", | |
6332 | [ALC260_HP] = "hp", | |
6333 | [ALC260_HP_3013] = "hp-3013", | |
6334 | [ALC260_HP_DC7600] = "hp-dc7600", | |
6335 | [ALC260_FUJITSU_S702X] = "fujitsu", | |
6336 | [ALC260_ACER] = "acer", | |
6337 | [ALC260_WILL] = "will", | |
6338 | [ALC260_REPLACER_672V] = "replacer", | |
6339 | [ALC260_FAVORIT100] = "favorit100", | |
6340 | #ifdef CONFIG_SND_DEBUG | |
6341 | [ALC260_TEST] = "test", | |
6342 | #endif | |
6343 | [ALC260_AUTO] = "auto", | |
6344 | }; | |
6345 | ||
6346 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | |
6347 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), | |
6348 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), | |
6349 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), | |
6350 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), | |
6351 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), | |
6352 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ | |
6353 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), | |
6354 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), | |
6355 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), | |
6356 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), | |
6357 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | |
6358 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | |
6359 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), | |
6360 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), | |
6361 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), | |
6362 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), | |
6363 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), | |
6364 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), | |
6365 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), | |
6366 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), | |
6367 | {} | |
6368 | }; | |
6369 | ||
6370 | static struct alc_config_preset alc260_presets[] = { | |
6371 | [ALC260_BASIC] = { | |
6372 | .mixers = { alc260_base_output_mixer, | |
6373 | alc260_input_mixer }, | |
6374 | .init_verbs = { alc260_init_verbs }, | |
6375 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6376 | .dac_nids = alc260_dac_nids, | |
6377 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
6378 | .adc_nids = alc260_adc_nids, | |
6379 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6380 | .channel_mode = alc260_modes, | |
6381 | .input_mux = &alc260_capture_source, | |
6382 | }, | |
6383 | [ALC260_HP] = { | |
6384 | .mixers = { alc260_hp_output_mixer, | |
6385 | alc260_input_mixer }, | |
6386 | .init_verbs = { alc260_init_verbs, | |
6387 | alc260_hp_unsol_verbs }, | |
6388 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6389 | .dac_nids = alc260_dac_nids, | |
6390 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | |
6391 | .adc_nids = alc260_adc_nids_alt, | |
6392 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6393 | .channel_mode = alc260_modes, | |
6394 | .input_mux = &alc260_capture_source, | |
6395 | .unsol_event = alc260_hp_unsol_event, | |
6396 | .init_hook = alc260_hp_automute, | |
6397 | }, | |
6398 | [ALC260_HP_DC7600] = { | |
6399 | .mixers = { alc260_hp_dc7600_mixer, | |
6400 | alc260_input_mixer }, | |
6401 | .init_verbs = { alc260_init_verbs, | |
6402 | alc260_hp_dc7600_verbs }, | |
6403 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6404 | .dac_nids = alc260_dac_nids, | |
6405 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | |
6406 | .adc_nids = alc260_adc_nids_alt, | |
6407 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6408 | .channel_mode = alc260_modes, | |
6409 | .input_mux = &alc260_capture_source, | |
6410 | .unsol_event = alc260_hp_3012_unsol_event, | |
6411 | .init_hook = alc260_hp_3012_automute, | |
6412 | }, | |
6413 | [ALC260_HP_3013] = { | |
6414 | .mixers = { alc260_hp_3013_mixer, | |
6415 | alc260_input_mixer }, | |
6416 | .init_verbs = { alc260_hp_3013_init_verbs, | |
6417 | alc260_hp_3013_unsol_verbs }, | |
6418 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6419 | .dac_nids = alc260_dac_nids, | |
6420 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | |
6421 | .adc_nids = alc260_adc_nids_alt, | |
6422 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6423 | .channel_mode = alc260_modes, | |
6424 | .input_mux = &alc260_capture_source, | |
6425 | .unsol_event = alc260_hp_3013_unsol_event, | |
6426 | .init_hook = alc260_hp_3013_automute, | |
6427 | }, | |
6428 | [ALC260_FUJITSU_S702X] = { | |
6429 | .mixers = { alc260_fujitsu_mixer }, | |
6430 | .init_verbs = { alc260_fujitsu_init_verbs }, | |
6431 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6432 | .dac_nids = alc260_dac_nids, | |
6433 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
6434 | .adc_nids = alc260_dual_adc_nids, | |
6435 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6436 | .channel_mode = alc260_modes, | |
6437 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), | |
6438 | .input_mux = alc260_fujitsu_capture_sources, | |
6439 | }, | |
6440 | [ALC260_ACER] = { | |
6441 | .mixers = { alc260_acer_mixer }, | |
6442 | .init_verbs = { alc260_acer_init_verbs }, | |
6443 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6444 | .dac_nids = alc260_dac_nids, | |
6445 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
6446 | .adc_nids = alc260_dual_adc_nids, | |
6447 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6448 | .channel_mode = alc260_modes, | |
6449 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), | |
6450 | .input_mux = alc260_acer_capture_sources, | |
6451 | }, | |
6452 | [ALC260_FAVORIT100] = { | |
6453 | .mixers = { alc260_favorit100_mixer }, | |
6454 | .init_verbs = { alc260_favorit100_init_verbs }, | |
6455 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6456 | .dac_nids = alc260_dac_nids, | |
6457 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
6458 | .adc_nids = alc260_dual_adc_nids, | |
6459 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6460 | .channel_mode = alc260_modes, | |
6461 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), | |
6462 | .input_mux = alc260_favorit100_capture_sources, | |
6463 | }, | |
6464 | [ALC260_WILL] = { | |
6465 | .mixers = { alc260_will_mixer }, | |
6466 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, | |
6467 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6468 | .dac_nids = alc260_dac_nids, | |
6469 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
6470 | .adc_nids = alc260_adc_nids, | |
6471 | .dig_out_nid = ALC260_DIGOUT_NID, | |
6472 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6473 | .channel_mode = alc260_modes, | |
6474 | .input_mux = &alc260_capture_source, | |
6475 | }, | |
6476 | [ALC260_REPLACER_672V] = { | |
6477 | .mixers = { alc260_replacer_672v_mixer }, | |
6478 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, | |
6479 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6480 | .dac_nids = alc260_dac_nids, | |
6481 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
6482 | .adc_nids = alc260_adc_nids, | |
6483 | .dig_out_nid = ALC260_DIGOUT_NID, | |
6484 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6485 | .channel_mode = alc260_modes, | |
6486 | .input_mux = &alc260_capture_source, | |
6487 | .unsol_event = alc260_replacer_672v_unsol_event, | |
6488 | .init_hook = alc260_replacer_672v_automute, | |
6489 | }, | |
6490 | #ifdef CONFIG_SND_DEBUG | |
6491 | [ALC260_TEST] = { | |
6492 | .mixers = { alc260_test_mixer }, | |
6493 | .init_verbs = { alc260_test_init_verbs }, | |
6494 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), | |
6495 | .dac_nids = alc260_test_dac_nids, | |
6496 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), | |
6497 | .adc_nids = alc260_test_adc_nids, | |
6498 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6499 | .channel_mode = alc260_modes, | |
6500 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), | |
6501 | .input_mux = alc260_test_capture_sources, | |
6502 | }, | |
6503 | #endif | |
6504 | }; | |
6505 | ||
6506 | static int patch_alc260(struct hda_codec *codec) | |
6507 | { | |
6508 | struct alc_spec *spec; | |
6509 | int err, board_config; | |
6510 | ||
6511 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
6512 | if (spec == NULL) | |
6513 | return -ENOMEM; | |
6514 | ||
6515 | codec->spec = spec; | |
6516 | ||
6517 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, | |
6518 | alc260_models, | |
6519 | alc260_cfg_tbl); | |
6520 | if (board_config < 0) { | |
6521 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
6522 | codec->chip_name); | |
6523 | board_config = ALC260_AUTO; | |
6524 | } | |
6525 | ||
6526 | if (board_config == ALC260_AUTO) { | |
6527 | /* automatic parse from the BIOS config */ | |
6528 | err = alc260_parse_auto_config(codec); | |
6529 | if (err < 0) { | |
6530 | alc_free(codec); | |
6531 | return err; | |
6532 | } else if (!err) { | |
6533 | printk(KERN_INFO | |
6534 | "hda_codec: Cannot set up configuration " | |
6535 | "from BIOS. Using base mode...\n"); | |
6536 | board_config = ALC260_BASIC; | |
6537 | } | |
6538 | } | |
6539 | ||
6540 | err = snd_hda_attach_beep_device(codec, 0x1); | |
6541 | if (err < 0) { | |
6542 | alc_free(codec); | |
6543 | return err; | |
6544 | } | |
6545 | ||
6546 | if (board_config != ALC260_AUTO) | |
6547 | setup_preset(codec, &alc260_presets[board_config]); | |
6548 | ||
6549 | spec->stream_analog_playback = &alc260_pcm_analog_playback; | |
6550 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | |
6551 | ||
6552 | spec->stream_digital_playback = &alc260_pcm_digital_playback; | |
6553 | spec->stream_digital_capture = &alc260_pcm_digital_capture; | |
6554 | ||
6555 | if (!spec->adc_nids && spec->input_mux) { | |
6556 | /* check whether NID 0x04 is valid */ | |
6557 | unsigned int wcap = get_wcaps(codec, 0x04); | |
6558 | wcap = get_wcaps_type(wcap); | |
6559 | /* get type */ | |
6560 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
6561 | spec->adc_nids = alc260_adc_nids_alt; | |
6562 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); | |
6563 | } else { | |
6564 | spec->adc_nids = alc260_adc_nids; | |
6565 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | |
6566 | } | |
6567 | } | |
6568 | set_capture_mixer(codec); | |
6569 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); | |
6570 | ||
6571 | spec->vmaster_nid = 0x08; | |
6572 | ||
6573 | codec->patch_ops = alc_patch_ops; | |
6574 | if (board_config == ALC260_AUTO) | |
6575 | spec->init_hook = alc260_auto_init; | |
6576 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
6577 | if (!spec->loopback.amplist) | |
6578 | spec->loopback.amplist = alc260_loopbacks; | |
6579 | #endif | |
6580 | codec->proc_widget_hook = print_realtek_coef; | |
6581 | ||
6582 | return 0; | |
6583 | } | |
6584 | ||
6585 | ||
6586 | /* | |
6587 | * ALC882/883/885/888/889 support | |
6588 | * | |
6589 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | |
6590 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
6591 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
6592 | * 6-channel independent captures. | |
6593 | * | |
6594 | * In addition, an independent DAC for the multi-playback (not used in this | |
6595 | * driver yet). | |
6596 | */ | |
6597 | #define ALC882_DIGOUT_NID 0x06 | |
6598 | #define ALC882_DIGIN_NID 0x0a | |
6599 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID | |
6600 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID | |
6601 | #define ALC1200_DIGOUT_NID 0x10 | |
6602 | ||
6603 | ||
6604 | static struct hda_channel_mode alc882_ch_modes[1] = { | |
6605 | { 8, NULL } | |
6606 | }; | |
6607 | ||
6608 | /* DACs */ | |
6609 | static hda_nid_t alc882_dac_nids[4] = { | |
6610 | /* front, rear, clfe, rear_surr */ | |
6611 | 0x02, 0x03, 0x04, 0x05 | |
6612 | }; | |
6613 | #define alc883_dac_nids alc882_dac_nids | |
6614 | ||
6615 | /* ADCs */ | |
6616 | #define alc882_adc_nids alc880_adc_nids | |
6617 | #define alc882_adc_nids_alt alc880_adc_nids_alt | |
6618 | #define alc883_adc_nids alc882_adc_nids_alt | |
6619 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; | |
6620 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; | |
6621 | #define alc889_adc_nids alc880_adc_nids | |
6622 | ||
6623 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; | |
6624 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | |
6625 | #define alc883_capsrc_nids alc882_capsrc_nids_alt | |
6626 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | |
6627 | #define alc889_capsrc_nids alc882_capsrc_nids | |
6628 | ||
6629 | /* input MUX */ | |
6630 | /* FIXME: should be a matrix-type input source selection */ | |
6631 | ||
6632 | static struct hda_input_mux alc882_capture_source = { | |
6633 | .num_items = 4, | |
6634 | .items = { | |
6635 | { "Mic", 0x0 }, | |
6636 | { "Front Mic", 0x1 }, | |
6637 | { "Line", 0x2 }, | |
6638 | { "CD", 0x4 }, | |
6639 | }, | |
6640 | }; | |
6641 | ||
6642 | #define alc883_capture_source alc882_capture_source | |
6643 | ||
6644 | static struct hda_input_mux alc889_capture_source = { | |
6645 | .num_items = 3, | |
6646 | .items = { | |
6647 | { "Front Mic", 0x0 }, | |
6648 | { "Mic", 0x3 }, | |
6649 | { "Line", 0x2 }, | |
6650 | }, | |
6651 | }; | |
6652 | ||
6653 | static struct hda_input_mux mb5_capture_source = { | |
6654 | .num_items = 3, | |
6655 | .items = { | |
6656 | { "Mic", 0x1 }, | |
6657 | { "Line", 0x2 }, | |
6658 | { "CD", 0x4 }, | |
6659 | }, | |
6660 | }; | |
6661 | ||
6662 | static struct hda_input_mux alc883_3stack_6ch_intel = { | |
6663 | .num_items = 4, | |
6664 | .items = { | |
6665 | { "Mic", 0x1 }, | |
6666 | { "Front Mic", 0x0 }, | |
6667 | { "Line", 0x2 }, | |
6668 | { "CD", 0x4 }, | |
6669 | }, | |
6670 | }; | |
6671 | ||
6672 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { | |
6673 | .num_items = 2, | |
6674 | .items = { | |
6675 | { "Mic", 0x1 }, | |
6676 | { "Line", 0x2 }, | |
6677 | }, | |
6678 | }; | |
6679 | ||
6680 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | |
6681 | .num_items = 4, | |
6682 | .items = { | |
6683 | { "Mic", 0x0 }, | |
6684 | { "iMic", 0x1 }, | |
6685 | { "Line", 0x2 }, | |
6686 | { "CD", 0x4 }, | |
6687 | }, | |
6688 | }; | |
6689 | ||
6690 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | |
6691 | .num_items = 2, | |
6692 | .items = { | |
6693 | { "Mic", 0x0 }, | |
6694 | { "Int Mic", 0x1 }, | |
6695 | }, | |
6696 | }; | |
6697 | ||
6698 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | |
6699 | .num_items = 3, | |
6700 | .items = { | |
6701 | { "Mic", 0x0 }, | |
6702 | { "Front Mic", 0x1 }, | |
6703 | { "Line", 0x4 }, | |
6704 | }, | |
6705 | }; | |
6706 | ||
6707 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | |
6708 | .num_items = 2, | |
6709 | .items = { | |
6710 | { "Mic", 0x0 }, | |
6711 | { "Line", 0x2 }, | |
6712 | }, | |
6713 | }; | |
6714 | ||
6715 | static struct hda_input_mux alc889A_mb31_capture_source = { | |
6716 | .num_items = 2, | |
6717 | .items = { | |
6718 | { "Mic", 0x0 }, | |
6719 | /* Front Mic (0x01) unused */ | |
6720 | { "Line", 0x2 }, | |
6721 | /* Line 2 (0x03) unused */ | |
6722 | /* CD (0x04) unused? */ | |
6723 | }, | |
6724 | }; | |
6725 | ||
6726 | /* | |
6727 | * 2ch mode | |
6728 | */ | |
6729 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | |
6730 | { 2, NULL } | |
6731 | }; | |
6732 | ||
6733 | /* | |
6734 | * 2ch mode | |
6735 | */ | |
6736 | static struct hda_verb alc882_3ST_ch2_init[] = { | |
6737 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6738 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6739 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
6740 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6741 | { } /* end */ | |
6742 | }; | |
6743 | ||
6744 | /* | |
6745 | * 4ch mode | |
6746 | */ | |
6747 | static struct hda_verb alc882_3ST_ch4_init[] = { | |
6748 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6749 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6750 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6751 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6752 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6753 | { } /* end */ | |
6754 | }; | |
6755 | ||
6756 | /* | |
6757 | * 6ch mode | |
6758 | */ | |
6759 | static struct hda_verb alc882_3ST_ch6_init[] = { | |
6760 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6761 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6762 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
6763 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6764 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6765 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6766 | { } /* end */ | |
6767 | }; | |
6768 | ||
6769 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { | |
6770 | { 2, alc882_3ST_ch2_init }, | |
6771 | { 4, alc882_3ST_ch4_init }, | |
6772 | { 6, alc882_3ST_ch6_init }, | |
6773 | }; | |
6774 | ||
6775 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes | |
6776 | ||
6777 | /* | |
6778 | * 2ch mode | |
6779 | */ | |
6780 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { | |
6781 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
6782 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6783 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6784 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
6785 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6786 | { } /* end */ | |
6787 | }; | |
6788 | ||
6789 | /* | |
6790 | * 4ch mode | |
6791 | */ | |
6792 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { | |
6793 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6794 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6795 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6796 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6797 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6798 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6799 | { } /* end */ | |
6800 | }; | |
6801 | ||
6802 | /* | |
6803 | * 6ch mode | |
6804 | */ | |
6805 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { | |
6806 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6807 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6808 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6809 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
6810 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6811 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6812 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6813 | { } /* end */ | |
6814 | }; | |
6815 | ||
6816 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { | |
6817 | { 2, alc883_3ST_ch2_clevo_init }, | |
6818 | { 4, alc883_3ST_ch4_clevo_init }, | |
6819 | { 6, alc883_3ST_ch6_clevo_init }, | |
6820 | }; | |
6821 | ||
6822 | ||
6823 | /* | |
6824 | * 6ch mode | |
6825 | */ | |
6826 | static struct hda_verb alc882_sixstack_ch6_init[] = { | |
6827 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
6828 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6829 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6830 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6831 | { } /* end */ | |
6832 | }; | |
6833 | ||
6834 | /* | |
6835 | * 8ch mode | |
6836 | */ | |
6837 | static struct hda_verb alc882_sixstack_ch8_init[] = { | |
6838 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6839 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6840 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6841 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6842 | { } /* end */ | |
6843 | }; | |
6844 | ||
6845 | static struct hda_channel_mode alc882_sixstack_modes[2] = { | |
6846 | { 6, alc882_sixstack_ch6_init }, | |
6847 | { 8, alc882_sixstack_ch8_init }, | |
6848 | }; | |
6849 | ||
6850 | /* | |
6851 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic | |
6852 | */ | |
6853 | ||
6854 | /* | |
6855 | * 2ch mode | |
6856 | */ | |
6857 | static struct hda_verb alc885_mbp_ch2_init[] = { | |
6858 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
6859 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6860 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6861 | { } /* end */ | |
6862 | }; | |
6863 | ||
6864 | /* | |
6865 | * 4ch mode | |
6866 | */ | |
6867 | static struct hda_verb alc885_mbp_ch4_init[] = { | |
6868 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6869 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6870 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6871 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6872 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6873 | { } /* end */ | |
6874 | }; | |
6875 | ||
6876 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { | |
6877 | { 2, alc885_mbp_ch2_init }, | |
6878 | { 4, alc885_mbp_ch4_init }, | |
6879 | }; | |
6880 | ||
6881 | /* | |
6882 | * 2ch | |
6883 | * Speakers/Woofer/HP = Front | |
6884 | * LineIn = Input | |
6885 | */ | |
6886 | static struct hda_verb alc885_mb5_ch2_init[] = { | |
6887 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6888 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
6889 | { } /* end */ | |
6890 | }; | |
6891 | ||
6892 | /* | |
6893 | * 6ch mode | |
6894 | * Speakers/HP = Front | |
6895 | * Woofer = LFE | |
6896 | * LineIn = Surround | |
6897 | */ | |
6898 | static struct hda_verb alc885_mb5_ch6_init[] = { | |
6899 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6900 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6901 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6902 | { } /* end */ | |
6903 | }; | |
6904 | ||
6905 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { | |
6906 | { 2, alc885_mb5_ch2_init }, | |
6907 | { 6, alc885_mb5_ch6_init }, | |
6908 | }; | |
6909 | ||
6910 | ||
6911 | /* | |
6912 | * 2ch mode | |
6913 | */ | |
6914 | static struct hda_verb alc883_4ST_ch2_init[] = { | |
6915 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6916 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6917 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6918 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6919 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
6920 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6921 | { } /* end */ | |
6922 | }; | |
6923 | ||
6924 | /* | |
6925 | * 4ch mode | |
6926 | */ | |
6927 | static struct hda_verb alc883_4ST_ch4_init[] = { | |
6928 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6929 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6930 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6931 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6932 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6933 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6934 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6935 | { } /* end */ | |
6936 | }; | |
6937 | ||
6938 | /* | |
6939 | * 6ch mode | |
6940 | */ | |
6941 | static struct hda_verb alc883_4ST_ch6_init[] = { | |
6942 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6943 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6944 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6945 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6946 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
6947 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6948 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6949 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6950 | { } /* end */ | |
6951 | }; | |
6952 | ||
6953 | /* | |
6954 | * 8ch mode | |
6955 | */ | |
6956 | static struct hda_verb alc883_4ST_ch8_init[] = { | |
6957 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6958 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6959 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
6960 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6961 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6962 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
6963 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6964 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6965 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6966 | { } /* end */ | |
6967 | }; | |
6968 | ||
6969 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { | |
6970 | { 2, alc883_4ST_ch2_init }, | |
6971 | { 4, alc883_4ST_ch4_init }, | |
6972 | { 6, alc883_4ST_ch6_init }, | |
6973 | { 8, alc883_4ST_ch8_init }, | |
6974 | }; | |
6975 | ||
6976 | ||
6977 | /* | |
6978 | * 2ch mode | |
6979 | */ | |
6980 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | |
6981 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6982 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6983 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
6984 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6985 | { } /* end */ | |
6986 | }; | |
6987 | ||
6988 | /* | |
6989 | * 4ch mode | |
6990 | */ | |
6991 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | |
6992 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6993 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6994 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6995 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6996 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6997 | { } /* end */ | |
6998 | }; | |
6999 | ||
7000 | /* | |
7001 | * 6ch mode | |
7002 | */ | |
7003 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | |
7004 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7005 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7006 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7007 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7008 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7009 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7010 | { } /* end */ | |
7011 | }; | |
7012 | ||
7013 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | |
7014 | { 2, alc883_3ST_ch2_intel_init }, | |
7015 | { 4, alc883_3ST_ch4_intel_init }, | |
7016 | { 6, alc883_3ST_ch6_intel_init }, | |
7017 | }; | |
7018 | ||
7019 | /* | |
7020 | * 2ch mode | |
7021 | */ | |
7022 | static struct hda_verb alc889_ch2_intel_init[] = { | |
7023 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7024 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7025 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7026 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7027 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7028 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7029 | { } /* end */ | |
7030 | }; | |
7031 | ||
7032 | /* | |
7033 | * 6ch mode | |
7034 | */ | |
7035 | static struct hda_verb alc889_ch6_intel_init[] = { | |
7036 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7037 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7038 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7039 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7040 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7041 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7042 | { } /* end */ | |
7043 | }; | |
7044 | ||
7045 | /* | |
7046 | * 8ch mode | |
7047 | */ | |
7048 | static struct hda_verb alc889_ch8_intel_init[] = { | |
7049 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7050 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7051 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7052 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7053 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7054 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7055 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7056 | { } /* end */ | |
7057 | }; | |
7058 | ||
7059 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { | |
7060 | { 2, alc889_ch2_intel_init }, | |
7061 | { 6, alc889_ch6_intel_init }, | |
7062 | { 8, alc889_ch8_intel_init }, | |
7063 | }; | |
7064 | ||
7065 | /* | |
7066 | * 6ch mode | |
7067 | */ | |
7068 | static struct hda_verb alc883_sixstack_ch6_init[] = { | |
7069 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7070 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7071 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7072 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7073 | { } /* end */ | |
7074 | }; | |
7075 | ||
7076 | /* | |
7077 | * 8ch mode | |
7078 | */ | |
7079 | static struct hda_verb alc883_sixstack_ch8_init[] = { | |
7080 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7081 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7082 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7083 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7084 | { } /* end */ | |
7085 | }; | |
7086 | ||
7087 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | |
7088 | { 6, alc883_sixstack_ch6_init }, | |
7089 | { 8, alc883_sixstack_ch8_init }, | |
7090 | }; | |
7091 | ||
7092 | ||
7093 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
7094 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
7095 | */ | |
7096 | static struct snd_kcontrol_new alc882_base_mixer[] = { | |
7097 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7098 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7099 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7100 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
7101 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7102 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7103 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7104 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7105 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
7106 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
7107 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7108 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7109 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7110 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7111 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7112 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7113 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7114 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7115 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7116 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
7117 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7118 | { } /* end */ | |
7119 | }; | |
7120 | ||
7121 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { | |
7122 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7123 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7124 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7125 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
7126 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
7127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7128 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | |
7130 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
7131 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), | |
7132 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), | |
7133 | { } /* end */ | |
7134 | }; | |
7135 | ||
7136 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { | |
7137 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7138 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7139 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
7140 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
7141 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7142 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
7143 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | |
7144 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | |
7145 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7146 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7147 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
7148 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
7149 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), | |
7150 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), | |
7151 | { } /* end */ | |
7152 | }; | |
7153 | ||
7154 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { | |
7155 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7156 | HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7157 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), | |
7158 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
7159 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7160 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7161 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | |
7162 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
7163 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), | |
7164 | { } /* end */ | |
7165 | }; | |
7166 | ||
7167 | ||
7168 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { | |
7169 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7170 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7171 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7172 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7173 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7174 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7175 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7176 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7177 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7178 | { } /* end */ | |
7179 | }; | |
7180 | ||
7181 | static struct snd_kcontrol_new alc882_targa_mixer[] = { | |
7182 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7183 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7184 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7185 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7186 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7187 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7188 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7189 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7190 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7191 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7192 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7193 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7194 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
7195 | { } /* end */ | |
7196 | }; | |
7197 | ||
7198 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? | |
7199 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c | |
7200 | */ | |
7201 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { | |
7202 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7203 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7204 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7205 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
7206 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7207 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7208 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7209 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7210 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
7211 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
7212 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7213 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7214 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7215 | { } /* end */ | |
7216 | }; | |
7217 | ||
7218 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { | |
7219 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7220 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7221 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7222 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7223 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7224 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7225 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7226 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7227 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7228 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7229 | { } /* end */ | |
7230 | }; | |
7231 | ||
7232 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { | |
7233 | { | |
7234 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7235 | .name = "Channel Mode", | |
7236 | .info = alc_ch_mode_info, | |
7237 | .get = alc_ch_mode_get, | |
7238 | .put = alc_ch_mode_put, | |
7239 | }, | |
7240 | { } /* end */ | |
7241 | }; | |
7242 | ||
7243 | static struct hda_verb alc882_base_init_verbs[] = { | |
7244 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
7245 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7246 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7247 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7248 | /* Rear mixer */ | |
7249 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7250 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7251 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7252 | /* CLFE mixer */ | |
7253 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7254 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7255 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7256 | /* Side mixer */ | |
7257 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7258 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7259 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7260 | ||
7261 | /* mute analog input loopbacks */ | |
7262 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7263 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7264 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7265 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7266 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7267 | ||
7268 | /* Front Pin: output 0 (0x0c) */ | |
7269 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7270 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7271 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7272 | /* Rear Pin: output 1 (0x0d) */ | |
7273 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7274 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7275 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7276 | /* CLFE Pin: output 2 (0x0e) */ | |
7277 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7278 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7279 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7280 | /* Side Pin: output 3 (0x0f) */ | |
7281 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7282 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7283 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
7284 | /* Mic (rear) pin: input vref at 80% */ | |
7285 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7286 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7287 | /* Front Mic pin: input vref at 80% */ | |
7288 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7289 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7290 | /* Line In pin: input */ | |
7291 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7292 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7293 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
7294 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7295 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7296 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7297 | /* CD pin widget for input */ | |
7298 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7299 | ||
7300 | /* FIXME: use matrix-type input source selection */ | |
7301 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
7302 | /* Input mixer2 */ | |
7303 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7304 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7305 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7306 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7307 | /* Input mixer3 */ | |
7308 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7309 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7310 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7311 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7312 | /* ADC2: mute amp left and right */ | |
7313 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7314 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7315 | /* ADC3: mute amp left and right */ | |
7316 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7317 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7318 | ||
7319 | { } | |
7320 | }; | |
7321 | ||
7322 | static struct hda_verb alc882_adc1_init_verbs[] = { | |
7323 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
7324 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7325 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7326 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7327 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7328 | /* ADC1: mute amp left and right */ | |
7329 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7330 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7331 | { } | |
7332 | }; | |
7333 | ||
7334 | static struct hda_verb alc882_eapd_verbs[] = { | |
7335 | /* change to EAPD mode */ | |
7336 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
7337 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
7338 | { } | |
7339 | }; | |
7340 | ||
7341 | static struct hda_verb alc889_eapd_verbs[] = { | |
7342 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
7343 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
7344 | { } | |
7345 | }; | |
7346 | ||
7347 | static struct hda_verb alc_hp15_unsol_verbs[] = { | |
7348 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
7349 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7350 | {} | |
7351 | }; | |
7352 | ||
7353 | static struct hda_verb alc885_init_verbs[] = { | |
7354 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
7355 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7356 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7357 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7358 | /* Rear mixer */ | |
7359 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7360 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7361 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7362 | /* CLFE mixer */ | |
7363 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7364 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7365 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7366 | /* Side mixer */ | |
7367 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7368 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7369 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7370 | ||
7371 | /* mute analog input loopbacks */ | |
7372 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7373 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7374 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7375 | ||
7376 | /* Front HP Pin: output 0 (0x0c) */ | |
7377 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7378 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7379 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7380 | /* Front Pin: output 0 (0x0c) */ | |
7381 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7382 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7383 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7384 | /* Rear Pin: output 1 (0x0d) */ | |
7385 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7386 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7387 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7388 | /* CLFE Pin: output 2 (0x0e) */ | |
7389 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7390 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7391 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7392 | /* Side Pin: output 3 (0x0f) */ | |
7393 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7394 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7395 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
7396 | /* Mic (rear) pin: input vref at 80% */ | |
7397 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7398 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7399 | /* Front Mic pin: input vref at 80% */ | |
7400 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7401 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7402 | /* Line In pin: input */ | |
7403 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7404 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7405 | ||
7406 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ | |
7407 | /* Input mixer1 */ | |
7408 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
7409 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7410 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7411 | /* Input mixer2 */ | |
7412 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7413 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7414 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7415 | /* Input mixer3 */ | |
7416 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7417 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7418 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7419 | /* ADC2: mute amp left and right */ | |
7420 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7421 | /* ADC3: mute amp left and right */ | |
7422 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7423 | ||
7424 | { } | |
7425 | }; | |
7426 | ||
7427 | static struct hda_verb alc885_init_input_verbs[] = { | |
7428 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7429 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7430 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
7431 | { } | |
7432 | }; | |
7433 | ||
7434 | ||
7435 | /* Unmute Selector 24h and set the default input to front mic */ | |
7436 | static struct hda_verb alc889_init_input_verbs[] = { | |
7437 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7438 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7439 | { } | |
7440 | }; | |
7441 | ||
7442 | ||
7443 | #define alc883_init_verbs alc882_base_init_verbs | |
7444 | ||
7445 | /* Mac Pro test */ | |
7446 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | |
7447 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7448 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7449 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | |
7450 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
7451 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
7452 | /* FIXME: this looks suspicious... | |
7453 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7454 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7455 | */ | |
7456 | { } /* end */ | |
7457 | }; | |
7458 | ||
7459 | static struct hda_verb alc882_macpro_init_verbs[] = { | |
7460 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
7461 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7463 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7464 | /* Front Pin: output 0 (0x0c) */ | |
7465 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7466 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7467 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7468 | /* Front Mic pin: input vref at 80% */ | |
7469 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7470 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7471 | /* Speaker: output */ | |
7472 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7473 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7474 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | |
7475 | /* Headphone output (output 0 - 0x0c) */ | |
7476 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7477 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7478 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7479 | ||
7480 | /* FIXME: use matrix-type input source selection */ | |
7481 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
7482 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
7483 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7484 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7485 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7486 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7487 | /* Input mixer2 */ | |
7488 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7489 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7490 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7491 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7492 | /* Input mixer3 */ | |
7493 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7494 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7496 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7497 | /* ADC1: mute amp left and right */ | |
7498 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7499 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7500 | /* ADC2: mute amp left and right */ | |
7501 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7502 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7503 | /* ADC3: mute amp left and right */ | |
7504 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7505 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7506 | ||
7507 | { } | |
7508 | }; | |
7509 | ||
7510 | /* Macbook 5,1 */ | |
7511 | static struct hda_verb alc885_mb5_init_verbs[] = { | |
7512 | /* DACs */ | |
7513 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7514 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7515 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7516 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7517 | /* Front mixer */ | |
7518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7519 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7520 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7521 | /* Surround mixer */ | |
7522 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7523 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7524 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7525 | /* LFE mixer */ | |
7526 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7527 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7528 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7529 | /* HP mixer */ | |
7530 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7531 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7532 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7533 | /* Front Pin (0x0c) */ | |
7534 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
7535 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7536 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7537 | /* LFE Pin (0x0e) */ | |
7538 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
7539 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7540 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7541 | /* HP Pin (0x0f) */ | |
7542 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7543 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7544 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
7545 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7546 | /* Front Mic pin: input vref at 80% */ | |
7547 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7548 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7549 | /* Line In pin */ | |
7550 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7551 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7552 | ||
7553 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7554 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7555 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7556 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7557 | { } | |
7558 | }; | |
7559 | ||
7560 | /* Macbook Pro rev3 */ | |
7561 | static struct hda_verb alc885_mbp3_init_verbs[] = { | |
7562 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
7563 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7564 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7565 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7566 | /* Rear mixer */ | |
7567 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7568 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7569 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7570 | /* HP mixer */ | |
7571 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7572 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7573 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7574 | /* Front Pin: output 0 (0x0c) */ | |
7575 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7576 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7577 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7578 | /* HP Pin: output 0 (0x0e) */ | |
7579 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | |
7580 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7581 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7582 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7583 | /* Mic (rear) pin: input vref at 80% */ | |
7584 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7585 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7586 | /* Front Mic pin: input vref at 80% */ | |
7587 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7588 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7589 | /* Line In pin: use output 1 when in LineOut mode */ | |
7590 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7591 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7592 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7593 | ||
7594 | /* FIXME: use matrix-type input source selection */ | |
7595 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
7596 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
7597 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7598 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7599 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7600 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7601 | /* Input mixer2 */ | |
7602 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7603 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7604 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7605 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7606 | /* Input mixer3 */ | |
7607 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7608 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7609 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7610 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7611 | /* ADC1: mute amp left and right */ | |
7612 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7613 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7614 | /* ADC2: mute amp left and right */ | |
7615 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7616 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7617 | /* ADC3: mute amp left and right */ | |
7618 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7619 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7620 | ||
7621 | { } | |
7622 | }; | |
7623 | ||
7624 | /* iMac 9,1 */ | |
7625 | static struct hda_verb alc885_imac91_init_verbs[] = { | |
7626 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ | |
7627 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7628 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7629 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7630 | /* Rear mixer */ | |
7631 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7632 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7633 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7634 | /* HP Pin: output 0 (0x0c) */ | |
7635 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7636 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7637 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7638 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7639 | /* Internal Speakers: output 0 (0x0d) */ | |
7640 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7641 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7642 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7643 | /* Mic (rear) pin: input vref at 80% */ | |
7644 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7645 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7646 | /* Front Mic pin: input vref at 80% */ | |
7647 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7648 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7649 | /* Line In pin: use output 1 when in LineOut mode */ | |
7650 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7651 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7652 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7653 | ||
7654 | /* FIXME: use matrix-type input source selection */ | |
7655 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
7656 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
7657 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7658 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7659 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7660 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7661 | /* Input mixer2 */ | |
7662 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7663 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7664 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7665 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7666 | /* Input mixer3 */ | |
7667 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7668 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7669 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7670 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7671 | /* ADC1: mute amp left and right */ | |
7672 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7673 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7674 | /* ADC2: mute amp left and right */ | |
7675 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7676 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7677 | /* ADC3: mute amp left and right */ | |
7678 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7679 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7680 | ||
7681 | { } | |
7682 | }; | |
7683 | ||
7684 | /* iMac 24 mixer. */ | |
7685 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { | |
7686 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7687 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), | |
7688 | { } /* end */ | |
7689 | }; | |
7690 | ||
7691 | /* iMac 24 init verbs. */ | |
7692 | static struct hda_verb alc885_imac24_init_verbs[] = { | |
7693 | /* Internal speakers: output 0 (0x0c) */ | |
7694 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7695 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7696 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7697 | /* Internal speakers: output 0 (0x0c) */ | |
7698 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7699 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7700 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7701 | /* Headphone: output 0 (0x0c) */ | |
7702 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7703 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7704 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7705 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7706 | /* Front Mic: input vref at 80% */ | |
7707 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7708 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7709 | { } | |
7710 | }; | |
7711 | ||
7712 | /* Toggle speaker-output according to the hp-jack state */ | |
7713 | static void alc885_imac24_setup(struct hda_codec *codec) | |
7714 | { | |
7715 | struct alc_spec *spec = codec->spec; | |
7716 | ||
7717 | spec->autocfg.hp_pins[0] = 0x14; | |
7718 | spec->autocfg.speaker_pins[0] = 0x18; | |
7719 | spec->autocfg.speaker_pins[1] = 0x1a; | |
7720 | } | |
7721 | ||
7722 | static void alc885_mbp3_setup(struct hda_codec *codec) | |
7723 | { | |
7724 | struct alc_spec *spec = codec->spec; | |
7725 | ||
7726 | spec->autocfg.hp_pins[0] = 0x15; | |
7727 | spec->autocfg.speaker_pins[0] = 0x14; | |
7728 | } | |
7729 | ||
7730 | static void alc885_mb5_automute(struct hda_codec *codec) | |
7731 | { | |
7732 | unsigned int present; | |
7733 | ||
7734 | present = snd_hda_codec_read(codec, 0x14, 0, | |
7735 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7736 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, | |
7737 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7738 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | |
7739 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7740 | ||
7741 | } | |
7742 | ||
7743 | static void alc885_mb5_unsol_event(struct hda_codec *codec, | |
7744 | unsigned int res) | |
7745 | { | |
7746 | /* Headphone insertion or removal. */ | |
7747 | if ((res >> 26) == ALC880_HP_EVENT) | |
7748 | alc885_mb5_automute(codec); | |
7749 | } | |
7750 | ||
7751 | static void alc885_imac91_automute(struct hda_codec *codec) | |
7752 | { | |
7753 | unsigned int present; | |
7754 | ||
7755 | present = snd_hda_codec_read(codec, 0x14, 0, | |
7756 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7757 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7758 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7759 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | |
7760 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7761 | ||
7762 | } | |
7763 | ||
7764 | static void alc885_imac91_unsol_event(struct hda_codec *codec, | |
7765 | unsigned int res) | |
7766 | { | |
7767 | /* Headphone insertion or removal. */ | |
7768 | if ((res >> 26) == ALC880_HP_EVENT) | |
7769 | alc885_imac91_automute(codec); | |
7770 | } | |
7771 | ||
7772 | static struct hda_verb alc882_targa_verbs[] = { | |
7773 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7774 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7775 | ||
7776 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7777 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7778 | ||
7779 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
7780 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
7781 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
7782 | ||
7783 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7784 | { } /* end */ | |
7785 | }; | |
7786 | ||
7787 | /* toggle speaker-output according to the hp-jack state */ | |
7788 | static void alc882_targa_automute(struct hda_codec *codec) | |
7789 | { | |
7790 | struct alc_spec *spec = codec->spec; | |
7791 | alc_automute_amp(codec); | |
7792 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, | |
7793 | spec->jack_present ? 1 : 3); | |
7794 | } | |
7795 | ||
7796 | static void alc882_targa_setup(struct hda_codec *codec) | |
7797 | { | |
7798 | struct alc_spec *spec = codec->spec; | |
7799 | ||
7800 | spec->autocfg.hp_pins[0] = 0x14; | |
7801 | spec->autocfg.speaker_pins[0] = 0x1b; | |
7802 | } | |
7803 | ||
7804 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | |
7805 | { | |
7806 | if ((res >> 26) == ALC880_HP_EVENT) | |
7807 | alc882_targa_automute(codec); | |
7808 | } | |
7809 | ||
7810 | static struct hda_verb alc882_asus_a7j_verbs[] = { | |
7811 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7812 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7813 | ||
7814 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7815 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7816 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7817 | ||
7818 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
7819 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
7820 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
7821 | ||
7822 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
7823 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
7824 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
7825 | { } /* end */ | |
7826 | }; | |
7827 | ||
7828 | static struct hda_verb alc882_asus_a7m_verbs[] = { | |
7829 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7830 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7831 | ||
7832 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7833 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7834 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7835 | ||
7836 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
7837 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
7838 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
7839 | ||
7840 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
7841 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
7842 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
7843 | { } /* end */ | |
7844 | }; | |
7845 | ||
7846 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) | |
7847 | { | |
7848 | unsigned int gpiostate, gpiomask, gpiodir; | |
7849 | ||
7850 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | |
7851 | AC_VERB_GET_GPIO_DATA, 0); | |
7852 | ||
7853 | if (!muted) | |
7854 | gpiostate |= (1 << pin); | |
7855 | else | |
7856 | gpiostate &= ~(1 << pin); | |
7857 | ||
7858 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | |
7859 | AC_VERB_GET_GPIO_MASK, 0); | |
7860 | gpiomask |= (1 << pin); | |
7861 | ||
7862 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | |
7863 | AC_VERB_GET_GPIO_DIRECTION, 0); | |
7864 | gpiodir |= (1 << pin); | |
7865 | ||
7866 | ||
7867 | snd_hda_codec_write(codec, codec->afg, 0, | |
7868 | AC_VERB_SET_GPIO_MASK, gpiomask); | |
7869 | snd_hda_codec_write(codec, codec->afg, 0, | |
7870 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | |
7871 | ||
7872 | msleep(1); | |
7873 | ||
7874 | snd_hda_codec_write(codec, codec->afg, 0, | |
7875 | AC_VERB_SET_GPIO_DATA, gpiostate); | |
7876 | } | |
7877 | ||
7878 | /* set up GPIO at initialization */ | |
7879 | static void alc885_macpro_init_hook(struct hda_codec *codec) | |
7880 | { | |
7881 | alc882_gpio_mute(codec, 0, 0); | |
7882 | alc882_gpio_mute(codec, 1, 0); | |
7883 | } | |
7884 | ||
7885 | /* set up GPIO and update auto-muting at initialization */ | |
7886 | static void alc885_imac24_init_hook(struct hda_codec *codec) | |
7887 | { | |
7888 | alc885_macpro_init_hook(codec); | |
7889 | alc_automute_amp(codec); | |
7890 | } | |
7891 | ||
7892 | /* | |
7893 | * generic initialization of ADC, input mixers and output mixers | |
7894 | */ | |
7895 | static struct hda_verb alc883_auto_init_verbs[] = { | |
7896 | /* | |
7897 | * Unmute ADC0-2 and set the default input to mic-in | |
7898 | */ | |
7899 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7900 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7901 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7902 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7903 | ||
7904 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
7905 | * mixer widget | |
7906 | * Note: PASD motherboards uses the Line In 2 as the input for | |
7907 | * front panel mic (mic 2) | |
7908 | */ | |
7909 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
7910 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7911 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7912 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7913 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7914 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7915 | ||
7916 | /* | |
7917 | * Set up output mixers (0x0c - 0x0f) | |
7918 | */ | |
7919 | /* set vol=0 to output mixers */ | |
7920 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7921 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7923 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7924 | /* set up input amps for analog loopback */ | |
7925 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
7926 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7927 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7928 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7929 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7930 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7931 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7932 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7933 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7934 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7935 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7936 | ||
7937 | /* FIXME: use matrix-type input source selection */ | |
7938 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
7939 | /* Input mixer2 */ | |
7940 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
7941 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
7942 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
7943 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
7944 | /* Input mixer3 */ | |
7945 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
7946 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
7947 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
7948 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
7949 | ||
7950 | { } | |
7951 | }; | |
7952 | ||
7953 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ | |
7954 | static struct hda_verb alc889A_mb31_ch2_init[] = { | |
7955 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | |
7956 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
7957 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | |
7958 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | |
7959 | { } /* end */ | |
7960 | }; | |
7961 | ||
7962 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ | |
7963 | static struct hda_verb alc889A_mb31_ch4_init[] = { | |
7964 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | |
7965 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
7966 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | |
7967 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | |
7968 | { } /* end */ | |
7969 | }; | |
7970 | ||
7971 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ | |
7972 | static struct hda_verb alc889A_mb31_ch5_init[] = { | |
7973 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ | |
7974 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
7975 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | |
7976 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | |
7977 | { } /* end */ | |
7978 | }; | |
7979 | ||
7980 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ | |
7981 | static struct hda_verb alc889A_mb31_ch6_init[] = { | |
7982 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ | |
7983 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ | |
7984 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | |
7985 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | |
7986 | { } /* end */ | |
7987 | }; | |
7988 | ||
7989 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { | |
7990 | { 2, alc889A_mb31_ch2_init }, | |
7991 | { 4, alc889A_mb31_ch4_init }, | |
7992 | { 5, alc889A_mb31_ch5_init }, | |
7993 | { 6, alc889A_mb31_ch6_init }, | |
7994 | }; | |
7995 | ||
7996 | static struct hda_verb alc883_medion_eapd_verbs[] = { | |
7997 | /* eanable EAPD on medion laptop */ | |
7998 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
7999 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
8000 | { } | |
8001 | }; | |
8002 | ||
8003 | #define alc883_base_mixer alc882_base_mixer | |
8004 | ||
8005 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { | |
8006 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8007 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8008 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8009 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8010 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8011 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8012 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8013 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8014 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8015 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8016 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8017 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8018 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8019 | { } /* end */ | |
8020 | }; | |
8021 | ||
8022 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { | |
8023 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8024 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
8025 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8026 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8027 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8028 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8029 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8030 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8031 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8032 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8033 | { } /* end */ | |
8034 | }; | |
8035 | ||
8036 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { | |
8037 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8038 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
8039 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8040 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8041 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8042 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8043 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8044 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8045 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8046 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8047 | { } /* end */ | |
8048 | }; | |
8049 | ||
8050 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { | |
8051 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8052 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8053 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8054 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8055 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8056 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8057 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8058 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8059 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8060 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8061 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8062 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8063 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8064 | { } /* end */ | |
8065 | }; | |
8066 | ||
8067 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { | |
8068 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8069 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8070 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8071 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8072 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8073 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8074 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8075 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8076 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8077 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8078 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8079 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8080 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8081 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8082 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8083 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8084 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8085 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8086 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8087 | { } /* end */ | |
8088 | }; | |
8089 | ||
8090 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { | |
8091 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8092 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8093 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8094 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8095 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
8096 | HDA_OUTPUT), | |
8097 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8098 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8099 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8100 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8101 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8102 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8103 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8104 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8105 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8106 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
8107 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8108 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8109 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
8110 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8111 | { } /* end */ | |
8112 | }; | |
8113 | ||
8114 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { | |
8115 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8116 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8117 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8118 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8119 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
8120 | HDA_OUTPUT), | |
8121 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8122 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8123 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8124 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8125 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), | |
8126 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8128 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
8130 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), | |
8131 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
8132 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8133 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
8134 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8135 | { } /* end */ | |
8136 | }; | |
8137 | ||
8138 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { | |
8139 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8140 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8141 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8142 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8143 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8144 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8145 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8146 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8147 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8148 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8149 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8150 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8151 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8152 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8153 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8154 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8155 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8156 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8157 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8158 | { } /* end */ | |
8159 | }; | |
8160 | ||
8161 | static struct snd_kcontrol_new alc883_targa_mixer[] = { | |
8162 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8163 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8164 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8165 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8166 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8167 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8168 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8169 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8170 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8171 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8172 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8173 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8174 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8175 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8176 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8177 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8178 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8179 | { } /* end */ | |
8180 | }; | |
8181 | ||
8182 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { | |
8183 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8184 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8185 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8186 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8187 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8188 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8189 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8190 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8191 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8192 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8193 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8194 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8195 | { } /* end */ | |
8196 | }; | |
8197 | ||
8198 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { | |
8199 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8200 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
8201 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8202 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8203 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8204 | { } /* end */ | |
8205 | }; | |
8206 | ||
8207 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { | |
8208 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8209 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8210 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8211 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8212 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8213 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8214 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8215 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8216 | { } /* end */ | |
8217 | }; | |
8218 | ||
8219 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { | |
8220 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8221 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
8222 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8223 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8224 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8225 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8226 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8227 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8228 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8229 | { } /* end */ | |
8230 | }; | |
8231 | ||
8232 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | |
8233 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8234 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8235 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8236 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8237 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8238 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8239 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8240 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8241 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8242 | { } /* end */ | |
8243 | }; | |
8244 | ||
8245 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | |
8246 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8247 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8248 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8249 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8250 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8251 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8252 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8253 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8254 | { } /* end */ | |
8255 | }; | |
8256 | ||
8257 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { | |
8258 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8259 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8260 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8261 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), | |
8262 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8263 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8264 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8265 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8266 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8267 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8268 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8269 | { } /* end */ | |
8270 | }; | |
8271 | ||
8272 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { | |
8273 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8274 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8275 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
8276 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | |
8277 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", | |
8278 | 0x0d, 1, 0x0, HDA_OUTPUT), | |
8279 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
8280 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
8281 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
8282 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8283 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
8284 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8285 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8286 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8287 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8288 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8289 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8290 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8291 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8292 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8293 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8294 | { } /* end */ | |
8295 | }; | |
8296 | ||
8297 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { | |
8298 | /* Output mixers */ | |
8299 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8300 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
8301 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
8302 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
8303 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, | |
8304 | HDA_OUTPUT), | |
8305 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), | |
8306 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), | |
8307 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), | |
8308 | /* Output switches */ | |
8309 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), | |
8310 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), | |
8311 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), | |
8312 | /* Boost mixers */ | |
8313 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), | |
8314 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), | |
8315 | /* Input mixers */ | |
8316 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | |
8317 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
8318 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8319 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8320 | { } /* end */ | |
8321 | }; | |
8322 | ||
8323 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { | |
8324 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8325 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8326 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8327 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8328 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
8329 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8330 | { } /* end */ | |
8331 | }; | |
8332 | ||
8333 | static struct hda_bind_ctls alc883_bind_cap_vol = { | |
8334 | .ops = &snd_hda_bind_vol, | |
8335 | .values = { | |
8336 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
8337 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
8338 | 0 | |
8339 | }, | |
8340 | }; | |
8341 | ||
8342 | static struct hda_bind_ctls alc883_bind_cap_switch = { | |
8343 | .ops = &snd_hda_bind_sw, | |
8344 | .values = { | |
8345 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
8346 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
8347 | 0 | |
8348 | }, | |
8349 | }; | |
8350 | ||
8351 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { | |
8352 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8353 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8354 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8355 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8356 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8357 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8358 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8359 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8360 | { } /* end */ | |
8361 | }; | |
8362 | ||
8363 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { | |
8364 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), | |
8365 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), | |
8366 | { | |
8367 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8368 | /* .name = "Capture Source", */ | |
8369 | .name = "Input Source", | |
8370 | .count = 1, | |
8371 | .info = alc_mux_enum_info, | |
8372 | .get = alc_mux_enum_get, | |
8373 | .put = alc_mux_enum_put, | |
8374 | }, | |
8375 | { } /* end */ | |
8376 | }; | |
8377 | ||
8378 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { | |
8379 | { | |
8380 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8381 | .name = "Channel Mode", | |
8382 | .info = alc_ch_mode_info, | |
8383 | .get = alc_ch_mode_get, | |
8384 | .put = alc_ch_mode_put, | |
8385 | }, | |
8386 | { } /* end */ | |
8387 | }; | |
8388 | ||
8389 | /* toggle speaker-output according to the hp-jack state */ | |
8390 | static void alc883_mitac_setup(struct hda_codec *codec) | |
8391 | { | |
8392 | struct alc_spec *spec = codec->spec; | |
8393 | ||
8394 | spec->autocfg.hp_pins[0] = 0x15; | |
8395 | spec->autocfg.speaker_pins[0] = 0x14; | |
8396 | spec->autocfg.speaker_pins[1] = 0x17; | |
8397 | } | |
8398 | ||
8399 | /* auto-toggle front mic */ | |
8400 | /* | |
8401 | static void alc883_mitac_mic_automute(struct hda_codec *codec) | |
8402 | { | |
8403 | unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0; | |
8404 | ||
8405 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
8406 | } | |
8407 | */ | |
8408 | ||
8409 | static struct hda_verb alc883_mitac_verbs[] = { | |
8410 | /* HP */ | |
8411 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8412 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8413 | /* Subwoofer */ | |
8414 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8415 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8416 | ||
8417 | /* enable unsolicited event */ | |
8418 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8419 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ | |
8420 | ||
8421 | { } /* end */ | |
8422 | }; | |
8423 | ||
8424 | static struct hda_verb alc883_clevo_m540r_verbs[] = { | |
8425 | /* HP */ | |
8426 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8427 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8428 | /* Int speaker */ | |
8429 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ | |
8430 | ||
8431 | /* enable unsolicited event */ | |
8432 | /* | |
8433 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8434 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
8435 | */ | |
8436 | ||
8437 | { } /* end */ | |
8438 | }; | |
8439 | ||
8440 | static struct hda_verb alc883_clevo_m720_verbs[] = { | |
8441 | /* HP */ | |
8442 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8443 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8444 | /* Int speaker */ | |
8445 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8446 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8447 | ||
8448 | /* enable unsolicited event */ | |
8449 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8450 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
8451 | ||
8452 | { } /* end */ | |
8453 | }; | |
8454 | ||
8455 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { | |
8456 | /* HP */ | |
8457 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8458 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8459 | /* Subwoofer */ | |
8460 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8461 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8462 | ||
8463 | /* enable unsolicited event */ | |
8464 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8465 | ||
8466 | { } /* end */ | |
8467 | }; | |
8468 | ||
8469 | static struct hda_verb alc883_targa_verbs[] = { | |
8470 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8471 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8472 | ||
8473 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8474 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8475 | ||
8476 | /* Connect Line-Out side jack (SPDIF) to Side */ | |
8477 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8478 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8479 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
8480 | /* Connect Mic jack to CLFE */ | |
8481 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8482 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8483 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8484 | /* Connect Line-in jack to Surround */ | |
8485 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8486 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8487 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8488 | /* Connect HP out jack to Front */ | |
8489 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8490 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8491 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8492 | ||
8493 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8494 | ||
8495 | { } /* end */ | |
8496 | }; | |
8497 | ||
8498 | static struct hda_verb alc883_lenovo_101e_verbs[] = { | |
8499 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8500 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, | |
8501 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, | |
8502 | { } /* end */ | |
8503 | }; | |
8504 | ||
8505 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { | |
8506 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8507 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8508 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8509 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8510 | { } /* end */ | |
8511 | }; | |
8512 | ||
8513 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { | |
8514 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8515 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8516 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8517 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, | |
8518 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8519 | { } /* end */ | |
8520 | }; | |
8521 | ||
8522 | static struct hda_verb alc883_haier_w66_verbs[] = { | |
8523 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8524 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8525 | ||
8526 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8527 | ||
8528 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8529 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8530 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8531 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8532 | { } /* end */ | |
8533 | }; | |
8534 | ||
8535 | static struct hda_verb alc888_lenovo_sky_verbs[] = { | |
8536 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8537 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8538 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8539 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8540 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8541 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8542 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8543 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8544 | { } /* end */ | |
8545 | }; | |
8546 | ||
8547 | static struct hda_verb alc888_6st_dell_verbs[] = { | |
8548 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8549 | { } | |
8550 | }; | |
8551 | ||
8552 | static struct hda_verb alc883_vaiott_verbs[] = { | |
8553 | /* HP */ | |
8554 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8555 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8556 | ||
8557 | /* enable unsolicited event */ | |
8558 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8559 | ||
8560 | { } /* end */ | |
8561 | }; | |
8562 | ||
8563 | static void alc888_3st_hp_setup(struct hda_codec *codec) | |
8564 | { | |
8565 | struct alc_spec *spec = codec->spec; | |
8566 | ||
8567 | spec->autocfg.hp_pins[0] = 0x1b; | |
8568 | spec->autocfg.speaker_pins[0] = 0x14; | |
8569 | spec->autocfg.speaker_pins[1] = 0x16; | |
8570 | spec->autocfg.speaker_pins[2] = 0x18; | |
8571 | } | |
8572 | ||
8573 | static struct hda_verb alc888_3st_hp_verbs[] = { | |
8574 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ | |
8575 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ | |
8576 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | |
8577 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8578 | { } /* end */ | |
8579 | }; | |
8580 | ||
8581 | /* | |
8582 | * 2ch mode | |
8583 | */ | |
8584 | static struct hda_verb alc888_3st_hp_2ch_init[] = { | |
8585 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
8586 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
8587 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
8588 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
8589 | { } /* end */ | |
8590 | }; | |
8591 | ||
8592 | /* | |
8593 | * 4ch mode | |
8594 | */ | |
8595 | static struct hda_verb alc888_3st_hp_4ch_init[] = { | |
8596 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
8597 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
8598 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
8599 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
8600 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
8601 | { } /* end */ | |
8602 | }; | |
8603 | ||
8604 | /* | |
8605 | * 6ch mode | |
8606 | */ | |
8607 | static struct hda_verb alc888_3st_hp_6ch_init[] = { | |
8608 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
8609 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
8610 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
8611 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
8612 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
8613 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
8614 | { } /* end */ | |
8615 | }; | |
8616 | ||
8617 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { | |
8618 | { 2, alc888_3st_hp_2ch_init }, | |
8619 | { 4, alc888_3st_hp_4ch_init }, | |
8620 | { 6, alc888_3st_hp_6ch_init }, | |
8621 | }; | |
8622 | ||
8623 | /* toggle front-jack and RCA according to the hp-jack state */ | |
8624 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | |
8625 | { | |
8626 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); | |
8627 | ||
8628 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
8629 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
8630 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8631 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
8632 | } | |
8633 | ||
8634 | /* toggle RCA according to the front-jack state */ | |
8635 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) | |
8636 | { | |
8637 | unsigned int present = snd_hda_jack_detect(codec, 0x14); | |
8638 | ||
8639 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8640 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
8641 | } | |
8642 | ||
8643 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, | |
8644 | unsigned int res) | |
8645 | { | |
8646 | if ((res >> 26) == ALC880_HP_EVENT) | |
8647 | alc888_lenovo_ms7195_front_automute(codec); | |
8648 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
8649 | alc888_lenovo_ms7195_rca_automute(codec); | |
8650 | } | |
8651 | ||
8652 | static struct hda_verb alc883_medion_md2_verbs[] = { | |
8653 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8654 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8655 | ||
8656 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8657 | ||
8658 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8659 | { } /* end */ | |
8660 | }; | |
8661 | ||
8662 | /* toggle speaker-output according to the hp-jack state */ | |
8663 | static void alc883_medion_md2_setup(struct hda_codec *codec) | |
8664 | { | |
8665 | struct alc_spec *spec = codec->spec; | |
8666 | ||
8667 | spec->autocfg.hp_pins[0] = 0x14; | |
8668 | spec->autocfg.speaker_pins[0] = 0x15; | |
8669 | } | |
8670 | ||
8671 | /* toggle speaker-output according to the hp-jack state */ | |
8672 | #define alc883_targa_init_hook alc882_targa_init_hook | |
8673 | #define alc883_targa_unsol_event alc882_targa_unsol_event | |
8674 | ||
8675 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) | |
8676 | { | |
8677 | unsigned int present; | |
8678 | ||
8679 | present = snd_hda_jack_detect(codec, 0x18); | |
8680 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | |
8681 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
8682 | } | |
8683 | ||
8684 | static void alc883_clevo_m720_setup(struct hda_codec *codec) | |
8685 | { | |
8686 | struct alc_spec *spec = codec->spec; | |
8687 | ||
8688 | spec->autocfg.hp_pins[0] = 0x15; | |
8689 | spec->autocfg.speaker_pins[0] = 0x14; | |
8690 | } | |
8691 | ||
8692 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | |
8693 | { | |
8694 | alc_automute_amp(codec); | |
8695 | alc883_clevo_m720_mic_automute(codec); | |
8696 | } | |
8697 | ||
8698 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | |
8699 | unsigned int res) | |
8700 | { | |
8701 | switch (res >> 26) { | |
8702 | case ALC880_MIC_EVENT: | |
8703 | alc883_clevo_m720_mic_automute(codec); | |
8704 | break; | |
8705 | default: | |
8706 | alc_automute_amp_unsol_event(codec, res); | |
8707 | break; | |
8708 | } | |
8709 | } | |
8710 | ||
8711 | /* toggle speaker-output according to the hp-jack state */ | |
8712 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) | |
8713 | { | |
8714 | struct alc_spec *spec = codec->spec; | |
8715 | ||
8716 | spec->autocfg.hp_pins[0] = 0x14; | |
8717 | spec->autocfg.speaker_pins[0] = 0x15; | |
8718 | } | |
8719 | ||
8720 | static void alc883_haier_w66_setup(struct hda_codec *codec) | |
8721 | { | |
8722 | struct alc_spec *spec = codec->spec; | |
8723 | ||
8724 | spec->autocfg.hp_pins[0] = 0x1b; | |
8725 | spec->autocfg.speaker_pins[0] = 0x14; | |
8726 | } | |
8727 | ||
8728 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | |
8729 | { | |
8730 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; | |
8731 | ||
8732 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8733 | HDA_AMP_MUTE, bits); | |
8734 | } | |
8735 | ||
8736 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) | |
8737 | { | |
8738 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; | |
8739 | ||
8740 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8741 | HDA_AMP_MUTE, bits); | |
8742 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
8743 | HDA_AMP_MUTE, bits); | |
8744 | } | |
8745 | ||
8746 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |
8747 | unsigned int res) | |
8748 | { | |
8749 | if ((res >> 26) == ALC880_HP_EVENT) | |
8750 | alc883_lenovo_101e_all_automute(codec); | |
8751 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
8752 | alc883_lenovo_101e_ispeaker_automute(codec); | |
8753 | } | |
8754 | ||
8755 | /* toggle speaker-output according to the hp-jack state */ | |
8756 | static void alc883_acer_aspire_setup(struct hda_codec *codec) | |
8757 | { | |
8758 | struct alc_spec *spec = codec->spec; | |
8759 | ||
8760 | spec->autocfg.hp_pins[0] = 0x14; | |
8761 | spec->autocfg.speaker_pins[0] = 0x15; | |
8762 | spec->autocfg.speaker_pins[1] = 0x16; | |
8763 | } | |
8764 | ||
8765 | static struct hda_verb alc883_acer_eapd_verbs[] = { | |
8766 | /* HP Pin: output 0 (0x0c) */ | |
8767 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8768 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8769 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8770 | /* Front Pin: output 0 (0x0c) */ | |
8771 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8772 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8773 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8774 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8775 | /* eanable EAPD on medion laptop */ | |
8776 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
8777 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
8778 | /* enable unsolicited event */ | |
8779 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8780 | { } | |
8781 | }; | |
8782 | ||
8783 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { | |
8784 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8785 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8786 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8787 | { } /* end */ | |
8788 | }; | |
8789 | ||
8790 | static void alc888_6st_dell_setup(struct hda_codec *codec) | |
8791 | { | |
8792 | struct alc_spec *spec = codec->spec; | |
8793 | ||
8794 | spec->autocfg.hp_pins[0] = 0x1b; | |
8795 | spec->autocfg.speaker_pins[0] = 0x14; | |
8796 | spec->autocfg.speaker_pins[1] = 0x15; | |
8797 | spec->autocfg.speaker_pins[2] = 0x16; | |
8798 | spec->autocfg.speaker_pins[3] = 0x17; | |
8799 | } | |
8800 | ||
8801 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) | |
8802 | { | |
8803 | struct alc_spec *spec = codec->spec; | |
8804 | ||
8805 | spec->autocfg.hp_pins[0] = 0x1b; | |
8806 | spec->autocfg.speaker_pins[0] = 0x14; | |
8807 | spec->autocfg.speaker_pins[1] = 0x15; | |
8808 | spec->autocfg.speaker_pins[2] = 0x16; | |
8809 | spec->autocfg.speaker_pins[3] = 0x17; | |
8810 | spec->autocfg.speaker_pins[4] = 0x1a; | |
8811 | } | |
8812 | ||
8813 | static void alc883_vaiott_setup(struct hda_codec *codec) | |
8814 | { | |
8815 | struct alc_spec *spec = codec->spec; | |
8816 | ||
8817 | spec->autocfg.hp_pins[0] = 0x15; | |
8818 | spec->autocfg.speaker_pins[0] = 0x14; | |
8819 | spec->autocfg.speaker_pins[1] = 0x17; | |
8820 | } | |
8821 | ||
8822 | static struct hda_verb alc888_asus_m90v_verbs[] = { | |
8823 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8824 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8825 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8826 | /* enable unsolicited event */ | |
8827 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8828 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
8829 | { } /* end */ | |
8830 | }; | |
8831 | ||
8832 | static void alc883_mode2_setup(struct hda_codec *codec) | |
8833 | { | |
8834 | struct alc_spec *spec = codec->spec; | |
8835 | ||
8836 | spec->autocfg.hp_pins[0] = 0x1b; | |
8837 | spec->autocfg.speaker_pins[0] = 0x14; | |
8838 | spec->autocfg.speaker_pins[1] = 0x15; | |
8839 | spec->autocfg.speaker_pins[2] = 0x16; | |
8840 | spec->ext_mic.pin = 0x18; | |
8841 | spec->int_mic.pin = 0x19; | |
8842 | spec->ext_mic.mux_idx = 0; | |
8843 | spec->int_mic.mux_idx = 1; | |
8844 | spec->auto_mic = 1; | |
8845 | } | |
8846 | ||
8847 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | |
8848 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8849 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8850 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8851 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8852 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8853 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
8854 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, | |
8855 | /* enable unsolicited event */ | |
8856 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8857 | { } /* end */ | |
8858 | }; | |
8859 | ||
8860 | static void alc883_eee1601_inithook(struct hda_codec *codec) | |
8861 | { | |
8862 | struct alc_spec *spec = codec->spec; | |
8863 | ||
8864 | spec->autocfg.hp_pins[0] = 0x14; | |
8865 | spec->autocfg.speaker_pins[0] = 0x1b; | |
8866 | alc_automute_pin(codec); | |
8867 | } | |
8868 | ||
8869 | static struct hda_verb alc889A_mb31_verbs[] = { | |
8870 | /* Init rear pin (used as headphone output) */ | |
8871 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ | |
8872 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ | |
8873 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8874 | /* Init line pin (used as output in 4ch and 6ch mode) */ | |
8875 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ | |
8876 | /* Init line 2 pin (used as headphone out by default) */ | |
8877 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ | |
8878 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ | |
8879 | { } /* end */ | |
8880 | }; | |
8881 | ||
8882 | /* Mute speakers according to the headphone jack state */ | |
8883 | static void alc889A_mb31_automute(struct hda_codec *codec) | |
8884 | { | |
8885 | unsigned int present; | |
8886 | ||
8887 | /* Mute only in 2ch or 4ch mode */ | |
8888 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) | |
8889 | == 0x00) { | |
8890 | present = snd_hda_jack_detect(codec, 0x15); | |
8891 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
8892 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
8893 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
8894 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
8895 | } | |
8896 | } | |
8897 | ||
8898 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) | |
8899 | { | |
8900 | if ((res >> 26) == ALC880_HP_EVENT) | |
8901 | alc889A_mb31_automute(codec); | |
8902 | } | |
8903 | ||
8904 | ||
8905 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
8906 | #define alc882_loopbacks alc880_loopbacks | |
8907 | #endif | |
8908 | ||
8909 | /* pcm configuration: identical with ALC880 */ | |
8910 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback | |
8911 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | |
8912 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | |
8913 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | |
8914 | ||
8915 | static hda_nid_t alc883_slave_dig_outs[] = { | |
8916 | ALC1200_DIGOUT_NID, 0, | |
8917 | }; | |
8918 | ||
8919 | static hda_nid_t alc1200_slave_dig_outs[] = { | |
8920 | ALC883_DIGOUT_NID, 0, | |
8921 | }; | |
8922 | ||
8923 | /* | |
8924 | * configuration and preset | |
8925 | */ | |
8926 | static const char *alc882_models[ALC882_MODEL_LAST] = { | |
8927 | [ALC882_3ST_DIG] = "3stack-dig", | |
8928 | [ALC882_6ST_DIG] = "6stack-dig", | |
8929 | [ALC882_ARIMA] = "arima", | |
8930 | [ALC882_W2JC] = "w2jc", | |
8931 | [ALC882_TARGA] = "targa", | |
8932 | [ALC882_ASUS_A7J] = "asus-a7j", | |
8933 | [ALC882_ASUS_A7M] = "asus-a7m", | |
8934 | [ALC885_MACPRO] = "macpro", | |
8935 | [ALC885_MB5] = "mb5", | |
8936 | [ALC885_MBP3] = "mbp3", | |
8937 | [ALC885_IMAC24] = "imac24", | |
8938 | [ALC885_IMAC91] = "imac91", | |
8939 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", | |
8940 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | |
8941 | [ALC883_3ST_6ch] = "3stack-6ch", | |
8942 | [ALC883_6ST_DIG] = "alc883-6stack-dig", | |
8943 | [ALC883_TARGA_DIG] = "targa-dig", | |
8944 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | |
8945 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", | |
8946 | [ALC883_ACER] = "acer", | |
8947 | [ALC883_ACER_ASPIRE] = "acer-aspire", | |
8948 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", | |
8949 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", | |
8950 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", | |
8951 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", | |
8952 | [ALC883_MEDION] = "medion", | |
8953 | [ALC883_MEDION_MD2] = "medion-md2", | |
8954 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", | |
8955 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", | |
8956 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", | |
8957 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | |
8958 | [ALC888_LENOVO_SKY] = "lenovo-sky", | |
8959 | [ALC883_HAIER_W66] = "haier-w66", | |
8960 | [ALC888_3ST_HP] = "3stack-hp", | |
8961 | [ALC888_6ST_DELL] = "6stack-dell", | |
8962 | [ALC883_MITAC] = "mitac", | |
8963 | [ALC883_CLEVO_M540R] = "clevo-m540r", | |
8964 | [ALC883_CLEVO_M720] = "clevo-m720", | |
8965 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", | |
8966 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", | |
8967 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", | |
8968 | [ALC889A_INTEL] = "intel-alc889a", | |
8969 | [ALC889_INTEL] = "intel-x58", | |
8970 | [ALC1200_ASUS_P5Q] = "asus-p5q", | |
8971 | [ALC889A_MB31] = "mb31", | |
8972 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", | |
8973 | [ALC882_AUTO] = "auto", | |
8974 | }; | |
8975 | ||
8976 | static struct snd_pci_quirk alc882_cfg_tbl[] = { | |
8977 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | |
8978 | ||
8979 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), | |
8980 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), | |
8981 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), | |
8982 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), | |
8983 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | |
8984 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), | |
8985 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", | |
8986 | ALC888_ACER_ASPIRE_4930G), | |
8987 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", | |
8988 | ALC888_ACER_ASPIRE_4930G), | |
8989 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", | |
8990 | ALC888_ACER_ASPIRE_8930G), | |
8991 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", | |
8992 | ALC888_ACER_ASPIRE_8930G), | |
8993 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), | |
8994 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), | |
8995 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | |
8996 | ALC888_ACER_ASPIRE_6530G), | |
8997 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | |
8998 | ALC888_ACER_ASPIRE_6530G), | |
8999 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", | |
9000 | ALC888_ACER_ASPIRE_7730G), | |
9001 | /* default Acer -- disabled as it causes more problems. | |
9002 | * model=auto should work fine now | |
9003 | */ | |
9004 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ | |
9005 | ||
9006 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), | |
9007 | ||
9008 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), | |
9009 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), | |
9010 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | |
9011 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), | |
9012 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), | |
9013 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), | |
9014 | ||
9015 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), | |
9016 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), | |
9017 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), | |
9018 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), | |
9019 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), | |
9020 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), | |
9021 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), | |
9022 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | |
9023 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), | |
9024 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), | |
9025 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), | |
9026 | ||
9027 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), | |
9028 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), | |
9029 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), | |
9030 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), | |
9031 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), | |
9032 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | |
9033 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), | |
9034 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), | |
9035 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), | |
9036 | ||
9037 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), | |
9038 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), | |
9039 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | |
9040 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ | |
9041 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), | |
9042 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | |
9043 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), | |
9044 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), | |
9045 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), | |
9046 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), | |
9047 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), | |
9048 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | |
9049 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), | |
9050 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), | |
9051 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), | |
9052 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), | |
9053 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | |
9054 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | |
9055 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), | |
9056 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), | |
9057 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | |
9058 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | |
9059 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), | |
9060 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), | |
9061 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), | |
9062 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | |
9063 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), | |
9064 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), | |
9065 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), | |
9066 | ||
9067 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), | |
9068 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), | |
9069 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | |
9070 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), | |
9071 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), | |
9072 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | |
9073 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ | |
9074 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | |
9075 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", | |
9076 | ALC883_FUJITSU_PI2515), | |
9077 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", | |
9078 | ALC888_FUJITSU_XA3530), | |
9079 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), | |
9080 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
9081 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
9082 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
9083 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), | |
9084 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), | |
9085 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), | |
9086 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), | |
9087 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | |
9088 | ||
9089 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), | |
9090 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | |
9091 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), | |
9092 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), | |
9093 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), | |
9094 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), | |
9095 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), | |
9096 | ||
9097 | {} | |
9098 | }; | |
9099 | ||
9100 | /* codec SSID table for Intel Mac */ | |
9101 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | |
9102 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), | |
9103 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), | |
9104 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), | |
9105 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), | |
9106 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), | |
9107 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), | |
9108 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), | |
9109 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), | |
9110 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | |
9111 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | |
9112 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), | |
9113 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), | |
9114 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, | |
9115 | * so apparently no perfect solution yet | |
9116 | */ | |
9117 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), | |
9118 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), | |
9119 | {} /* terminator */ | |
9120 | }; | |
9121 | ||
9122 | static struct alc_config_preset alc882_presets[] = { | |
9123 | [ALC882_3ST_DIG] = { | |
9124 | .mixers = { alc882_base_mixer }, | |
9125 | .init_verbs = { alc882_base_init_verbs, | |
9126 | alc882_adc1_init_verbs }, | |
9127 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9128 | .dac_nids = alc882_dac_nids, | |
9129 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9130 | .dig_in_nid = ALC882_DIGIN_NID, | |
9131 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9132 | .channel_mode = alc882_ch_modes, | |
9133 | .need_dac_fix = 1, | |
9134 | .input_mux = &alc882_capture_source, | |
9135 | }, | |
9136 | [ALC882_6ST_DIG] = { | |
9137 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
9138 | .init_verbs = { alc882_base_init_verbs, | |
9139 | alc882_adc1_init_verbs }, | |
9140 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9141 | .dac_nids = alc882_dac_nids, | |
9142 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9143 | .dig_in_nid = ALC882_DIGIN_NID, | |
9144 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
9145 | .channel_mode = alc882_sixstack_modes, | |
9146 | .input_mux = &alc882_capture_source, | |
9147 | }, | |
9148 | [ALC882_ARIMA] = { | |
9149 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
9150 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
9151 | alc882_eapd_verbs }, | |
9152 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9153 | .dac_nids = alc882_dac_nids, | |
9154 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
9155 | .channel_mode = alc882_sixstack_modes, | |
9156 | .input_mux = &alc882_capture_source, | |
9157 | }, | |
9158 | [ALC882_W2JC] = { | |
9159 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | |
9160 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
9161 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, | |
9162 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9163 | .dac_nids = alc882_dac_nids, | |
9164 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
9165 | .channel_mode = alc880_threestack_modes, | |
9166 | .need_dac_fix = 1, | |
9167 | .input_mux = &alc882_capture_source, | |
9168 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9169 | }, | |
9170 | [ALC885_MBP3] = { | |
9171 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | |
9172 | .init_verbs = { alc885_mbp3_init_verbs, | |
9173 | alc880_gpio1_init_verbs }, | |
9174 | .num_dacs = 2, | |
9175 | .dac_nids = alc882_dac_nids, | |
9176 | .hp_nid = 0x04, | |
9177 | .channel_mode = alc885_mbp_4ch_modes, | |
9178 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | |
9179 | .input_mux = &alc882_capture_source, | |
9180 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9181 | .dig_in_nid = ALC882_DIGIN_NID, | |
9182 | .unsol_event = alc_automute_amp_unsol_event, | |
9183 | .setup = alc885_mbp3_setup, | |
9184 | .init_hook = alc_automute_amp, | |
9185 | }, | |
9186 | [ALC885_MB5] = { | |
9187 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, | |
9188 | .init_verbs = { alc885_mb5_init_verbs, | |
9189 | alc880_gpio1_init_verbs }, | |
9190 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9191 | .dac_nids = alc882_dac_nids, | |
9192 | .channel_mode = alc885_mb5_6ch_modes, | |
9193 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), | |
9194 | .input_mux = &mb5_capture_source, | |
9195 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9196 | .dig_in_nid = ALC882_DIGIN_NID, | |
9197 | .unsol_event = alc885_mb5_unsol_event, | |
9198 | .init_hook = alc885_mb5_automute, | |
9199 | }, | |
9200 | [ALC885_MACPRO] = { | |
9201 | .mixers = { alc882_macpro_mixer }, | |
9202 | .init_verbs = { alc882_macpro_init_verbs }, | |
9203 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9204 | .dac_nids = alc882_dac_nids, | |
9205 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9206 | .dig_in_nid = ALC882_DIGIN_NID, | |
9207 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9208 | .channel_mode = alc882_ch_modes, | |
9209 | .input_mux = &alc882_capture_source, | |
9210 | .init_hook = alc885_macpro_init_hook, | |
9211 | }, | |
9212 | [ALC885_IMAC24] = { | |
9213 | .mixers = { alc885_imac24_mixer }, | |
9214 | .init_verbs = { alc885_imac24_init_verbs }, | |
9215 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9216 | .dac_nids = alc882_dac_nids, | |
9217 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9218 | .dig_in_nid = ALC882_DIGIN_NID, | |
9219 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9220 | .channel_mode = alc882_ch_modes, | |
9221 | .input_mux = &alc882_capture_source, | |
9222 | .unsol_event = alc_automute_amp_unsol_event, | |
9223 | .setup = alc885_imac24_setup, | |
9224 | .init_hook = alc885_imac24_init_hook, | |
9225 | }, | |
9226 | [ALC885_IMAC91] = { | |
9227 | .mixers = { alc885_imac91_mixer, alc882_chmode_mixer }, | |
9228 | .init_verbs = { alc885_imac91_init_verbs, | |
9229 | alc880_gpio1_init_verbs }, | |
9230 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9231 | .dac_nids = alc882_dac_nids, | |
9232 | .channel_mode = alc885_mbp_4ch_modes, | |
9233 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | |
9234 | .input_mux = &alc882_capture_source, | |
9235 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9236 | .dig_in_nid = ALC882_DIGIN_NID, | |
9237 | .unsol_event = alc885_imac91_unsol_event, | |
9238 | .init_hook = alc885_imac91_automute, | |
9239 | }, | |
9240 | [ALC882_TARGA] = { | |
9241 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | |
9242 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
9243 | alc880_gpio3_init_verbs, alc882_targa_verbs}, | |
9244 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9245 | .dac_nids = alc882_dac_nids, | |
9246 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9247 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
9248 | .adc_nids = alc882_adc_nids, | |
9249 | .capsrc_nids = alc882_capsrc_nids, | |
9250 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | |
9251 | .channel_mode = alc882_3ST_6ch_modes, | |
9252 | .need_dac_fix = 1, | |
9253 | .input_mux = &alc882_capture_source, | |
9254 | .unsol_event = alc882_targa_unsol_event, | |
9255 | .setup = alc882_targa_setup, | |
9256 | .init_hook = alc882_targa_automute, | |
9257 | }, | |
9258 | [ALC882_ASUS_A7J] = { | |
9259 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | |
9260 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
9261 | alc882_asus_a7j_verbs}, | |
9262 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9263 | .dac_nids = alc882_dac_nids, | |
9264 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9265 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
9266 | .adc_nids = alc882_adc_nids, | |
9267 | .capsrc_nids = alc882_capsrc_nids, | |
9268 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | |
9269 | .channel_mode = alc882_3ST_6ch_modes, | |
9270 | .need_dac_fix = 1, | |
9271 | .input_mux = &alc882_capture_source, | |
9272 | }, | |
9273 | [ALC882_ASUS_A7M] = { | |
9274 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | |
9275 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | |
9276 | alc882_eapd_verbs, alc880_gpio1_init_verbs, | |
9277 | alc882_asus_a7m_verbs }, | |
9278 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9279 | .dac_nids = alc882_dac_nids, | |
9280 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9281 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
9282 | .channel_mode = alc880_threestack_modes, | |
9283 | .need_dac_fix = 1, | |
9284 | .input_mux = &alc882_capture_source, | |
9285 | }, | |
9286 | [ALC883_3ST_2ch_DIG] = { | |
9287 | .mixers = { alc883_3ST_2ch_mixer }, | |
9288 | .init_verbs = { alc883_init_verbs }, | |
9289 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9290 | .dac_nids = alc883_dac_nids, | |
9291 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9292 | .dig_in_nid = ALC883_DIGIN_NID, | |
9293 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9294 | .channel_mode = alc883_3ST_2ch_modes, | |
9295 | .input_mux = &alc883_capture_source, | |
9296 | }, | |
9297 | [ALC883_3ST_6ch_DIG] = { | |
9298 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
9299 | .init_verbs = { alc883_init_verbs }, | |
9300 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9301 | .dac_nids = alc883_dac_nids, | |
9302 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9303 | .dig_in_nid = ALC883_DIGIN_NID, | |
9304 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
9305 | .channel_mode = alc883_3ST_6ch_modes, | |
9306 | .need_dac_fix = 1, | |
9307 | .input_mux = &alc883_capture_source, | |
9308 | }, | |
9309 | [ALC883_3ST_6ch] = { | |
9310 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
9311 | .init_verbs = { alc883_init_verbs }, | |
9312 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9313 | .dac_nids = alc883_dac_nids, | |
9314 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
9315 | .channel_mode = alc883_3ST_6ch_modes, | |
9316 | .need_dac_fix = 1, | |
9317 | .input_mux = &alc883_capture_source, | |
9318 | }, | |
9319 | [ALC883_3ST_6ch_INTEL] = { | |
9320 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, | |
9321 | .init_verbs = { alc883_init_verbs }, | |
9322 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9323 | .dac_nids = alc883_dac_nids, | |
9324 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9325 | .dig_in_nid = ALC883_DIGIN_NID, | |
9326 | .slave_dig_outs = alc883_slave_dig_outs, | |
9327 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), | |
9328 | .channel_mode = alc883_3ST_6ch_intel_modes, | |
9329 | .need_dac_fix = 1, | |
9330 | .input_mux = &alc883_3stack_6ch_intel, | |
9331 | }, | |
9332 | [ALC889A_INTEL] = { | |
9333 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | |
9334 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, | |
9335 | alc_hp15_unsol_verbs }, | |
9336 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9337 | .dac_nids = alc883_dac_nids, | |
9338 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
9339 | .adc_nids = alc889_adc_nids, | |
9340 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9341 | .dig_in_nid = ALC883_DIGIN_NID, | |
9342 | .slave_dig_outs = alc883_slave_dig_outs, | |
9343 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | |
9344 | .channel_mode = alc889_8ch_intel_modes, | |
9345 | .capsrc_nids = alc889_capsrc_nids, | |
9346 | .input_mux = &alc889_capture_source, | |
9347 | .setup = alc889_automute_setup, | |
9348 | .init_hook = alc_automute_amp, | |
9349 | .unsol_event = alc_automute_amp_unsol_event, | |
9350 | .need_dac_fix = 1, | |
9351 | }, | |
9352 | [ALC889_INTEL] = { | |
9353 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | |
9354 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, | |
9355 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, | |
9356 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9357 | .dac_nids = alc883_dac_nids, | |
9358 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
9359 | .adc_nids = alc889_adc_nids, | |
9360 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9361 | .dig_in_nid = ALC883_DIGIN_NID, | |
9362 | .slave_dig_outs = alc883_slave_dig_outs, | |
9363 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | |
9364 | .channel_mode = alc889_8ch_intel_modes, | |
9365 | .capsrc_nids = alc889_capsrc_nids, | |
9366 | .input_mux = &alc889_capture_source, | |
9367 | .setup = alc889_automute_setup, | |
9368 | .init_hook = alc889_intel_init_hook, | |
9369 | .unsol_event = alc_automute_amp_unsol_event, | |
9370 | .need_dac_fix = 1, | |
9371 | }, | |
9372 | [ALC883_6ST_DIG] = { | |
9373 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
9374 | .init_verbs = { alc883_init_verbs }, | |
9375 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9376 | .dac_nids = alc883_dac_nids, | |
9377 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9378 | .dig_in_nid = ALC883_DIGIN_NID, | |
9379 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
9380 | .channel_mode = alc883_sixstack_modes, | |
9381 | .input_mux = &alc883_capture_source, | |
9382 | }, | |
9383 | [ALC883_TARGA_DIG] = { | |
9384 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, | |
9385 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | |
9386 | alc883_targa_verbs}, | |
9387 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9388 | .dac_nids = alc883_dac_nids, | |
9389 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9390 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
9391 | .channel_mode = alc883_3ST_6ch_modes, | |
9392 | .need_dac_fix = 1, | |
9393 | .input_mux = &alc883_capture_source, | |
9394 | .unsol_event = alc883_targa_unsol_event, | |
9395 | .setup = alc882_targa_setup, | |
9396 | .init_hook = alc882_targa_automute, | |
9397 | }, | |
9398 | [ALC883_TARGA_2ch_DIG] = { | |
9399 | .mixers = { alc883_targa_2ch_mixer}, | |
9400 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | |
9401 | alc883_targa_verbs}, | |
9402 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9403 | .dac_nids = alc883_dac_nids, | |
9404 | .adc_nids = alc883_adc_nids_alt, | |
9405 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
9406 | .capsrc_nids = alc883_capsrc_nids, | |
9407 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9408 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9409 | .channel_mode = alc883_3ST_2ch_modes, | |
9410 | .input_mux = &alc883_capture_source, | |
9411 | .unsol_event = alc883_targa_unsol_event, | |
9412 | .setup = alc882_targa_setup, | |
9413 | .init_hook = alc882_targa_automute, | |
9414 | }, | |
9415 | [ALC883_TARGA_8ch_DIG] = { | |
9416 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, | |
9417 | alc883_chmode_mixer }, | |
9418 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | |
9419 | alc883_targa_verbs }, | |
9420 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9421 | .dac_nids = alc883_dac_nids, | |
9422 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
9423 | .adc_nids = alc883_adc_nids_rev, | |
9424 | .capsrc_nids = alc883_capsrc_nids_rev, | |
9425 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9426 | .dig_in_nid = ALC883_DIGIN_NID, | |
9427 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), | |
9428 | .channel_mode = alc883_4ST_8ch_modes, | |
9429 | .need_dac_fix = 1, | |
9430 | .input_mux = &alc883_capture_source, | |
9431 | .unsol_event = alc883_targa_unsol_event, | |
9432 | .setup = alc882_targa_setup, | |
9433 | .init_hook = alc882_targa_automute, | |
9434 | }, | |
9435 | [ALC883_ACER] = { | |
9436 | .mixers = { alc883_base_mixer }, | |
9437 | /* On TravelMate laptops, GPIO 0 enables the internal speaker | |
9438 | * and the headphone jack. Turn this on and rely on the | |
9439 | * standard mute methods whenever the user wants to turn | |
9440 | * these outputs off. | |
9441 | */ | |
9442 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | |
9443 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9444 | .dac_nids = alc883_dac_nids, | |
9445 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9446 | .channel_mode = alc883_3ST_2ch_modes, | |
9447 | .input_mux = &alc883_capture_source, | |
9448 | }, | |
9449 | [ALC883_ACER_ASPIRE] = { | |
9450 | .mixers = { alc883_acer_aspire_mixer }, | |
9451 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, | |
9452 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9453 | .dac_nids = alc883_dac_nids, | |
9454 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9455 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9456 | .channel_mode = alc883_3ST_2ch_modes, | |
9457 | .input_mux = &alc883_capture_source, | |
9458 | .unsol_event = alc_automute_amp_unsol_event, | |
9459 | .setup = alc883_acer_aspire_setup, | |
9460 | .init_hook = alc_automute_amp, | |
9461 | }, | |
9462 | [ALC888_ACER_ASPIRE_4930G] = { | |
9463 | .mixers = { alc888_base_mixer, | |
9464 | alc883_chmode_mixer }, | |
9465 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
9466 | alc888_acer_aspire_4930g_verbs }, | |
9467 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9468 | .dac_nids = alc883_dac_nids, | |
9469 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
9470 | .adc_nids = alc883_adc_nids_rev, | |
9471 | .capsrc_nids = alc883_capsrc_nids_rev, | |
9472 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9473 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
9474 | .channel_mode = alc883_3ST_6ch_modes, | |
9475 | .need_dac_fix = 1, | |
9476 | .num_mux_defs = | |
9477 | ARRAY_SIZE(alc888_2_capture_sources), | |
9478 | .input_mux = alc888_2_capture_sources, | |
9479 | .unsol_event = alc_automute_amp_unsol_event, | |
9480 | .setup = alc888_acer_aspire_4930g_setup, | |
9481 | .init_hook = alc_automute_amp, | |
9482 | }, | |
9483 | [ALC888_ACER_ASPIRE_6530G] = { | |
9484 | .mixers = { alc888_acer_aspire_6530_mixer }, | |
9485 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
9486 | alc888_acer_aspire_6530g_verbs }, | |
9487 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9488 | .dac_nids = alc883_dac_nids, | |
9489 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
9490 | .adc_nids = alc883_adc_nids_rev, | |
9491 | .capsrc_nids = alc883_capsrc_nids_rev, | |
9492 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9493 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9494 | .channel_mode = alc883_3ST_2ch_modes, | |
9495 | .num_mux_defs = | |
9496 | ARRAY_SIZE(alc888_2_capture_sources), | |
9497 | .input_mux = alc888_acer_aspire_6530_sources, | |
9498 | .unsol_event = alc_automute_amp_unsol_event, | |
9499 | .setup = alc888_acer_aspire_6530g_setup, | |
9500 | .init_hook = alc_automute_amp, | |
9501 | }, | |
9502 | [ALC888_ACER_ASPIRE_8930G] = { | |
9503 | .mixers = { alc889_acer_aspire_8930g_mixer, | |
9504 | alc883_chmode_mixer }, | |
9505 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
9506 | alc889_acer_aspire_8930g_verbs, | |
9507 | alc889_eapd_verbs}, | |
9508 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9509 | .dac_nids = alc883_dac_nids, | |
9510 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
9511 | .adc_nids = alc889_adc_nids, | |
9512 | .capsrc_nids = alc889_capsrc_nids, | |
9513 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9514 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
9515 | .channel_mode = alc883_3ST_6ch_modes, | |
9516 | .need_dac_fix = 1, | |
9517 | .const_channel_count = 6, | |
9518 | .num_mux_defs = | |
9519 | ARRAY_SIZE(alc889_capture_sources), | |
9520 | .input_mux = alc889_capture_sources, | |
9521 | .unsol_event = alc_automute_amp_unsol_event, | |
9522 | .setup = alc889_acer_aspire_8930g_setup, | |
9523 | .init_hook = alc_automute_amp, | |
9524 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
9525 | .power_hook = alc889_power_eapd, | |
9526 | #endif | |
9527 | }, | |
9528 | [ALC888_ACER_ASPIRE_7730G] = { | |
9529 | .mixers = { alc883_3ST_6ch_mixer, | |
9530 | alc883_chmode_mixer }, | |
9531 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
9532 | alc888_acer_aspire_7730G_verbs }, | |
9533 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9534 | .dac_nids = alc883_dac_nids, | |
9535 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
9536 | .adc_nids = alc883_adc_nids_rev, | |
9537 | .capsrc_nids = alc883_capsrc_nids_rev, | |
9538 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9539 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
9540 | .channel_mode = alc883_3ST_6ch_modes, | |
9541 | .need_dac_fix = 1, | |
9542 | .const_channel_count = 6, | |
9543 | .input_mux = &alc883_capture_source, | |
9544 | .unsol_event = alc_automute_amp_unsol_event, | |
9545 | .setup = alc888_acer_aspire_6530g_setup, | |
9546 | .init_hook = alc_automute_amp, | |
9547 | }, | |
9548 | [ALC883_MEDION] = { | |
9549 | .mixers = { alc883_fivestack_mixer, | |
9550 | alc883_chmode_mixer }, | |
9551 | .init_verbs = { alc883_init_verbs, | |
9552 | alc883_medion_eapd_verbs }, | |
9553 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9554 | .dac_nids = alc883_dac_nids, | |
9555 | .adc_nids = alc883_adc_nids_alt, | |
9556 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
9557 | .capsrc_nids = alc883_capsrc_nids, | |
9558 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
9559 | .channel_mode = alc883_sixstack_modes, | |
9560 | .input_mux = &alc883_capture_source, | |
9561 | }, | |
9562 | [ALC883_MEDION_MD2] = { | |
9563 | .mixers = { alc883_medion_md2_mixer}, | |
9564 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, | |
9565 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9566 | .dac_nids = alc883_dac_nids, | |
9567 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9568 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9569 | .channel_mode = alc883_3ST_2ch_modes, | |
9570 | .input_mux = &alc883_capture_source, | |
9571 | .unsol_event = alc_automute_amp_unsol_event, | |
9572 | .setup = alc883_medion_md2_setup, | |
9573 | .init_hook = alc_automute_amp, | |
9574 | }, | |
9575 | [ALC883_LAPTOP_EAPD] = { | |
9576 | .mixers = { alc883_base_mixer }, | |
9577 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, | |
9578 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9579 | .dac_nids = alc883_dac_nids, | |
9580 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9581 | .channel_mode = alc883_3ST_2ch_modes, | |
9582 | .input_mux = &alc883_capture_source, | |
9583 | }, | |
9584 | [ALC883_CLEVO_M540R] = { | |
9585 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
9586 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, | |
9587 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9588 | .dac_nids = alc883_dac_nids, | |
9589 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9590 | .dig_in_nid = ALC883_DIGIN_NID, | |
9591 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), | |
9592 | .channel_mode = alc883_3ST_6ch_clevo_modes, | |
9593 | .need_dac_fix = 1, | |
9594 | .input_mux = &alc883_capture_source, | |
9595 | /* This machine has the hardware HP auto-muting, thus | |
9596 | * we need no software mute via unsol event | |
9597 | */ | |
9598 | }, | |
9599 | [ALC883_CLEVO_M720] = { | |
9600 | .mixers = { alc883_clevo_m720_mixer }, | |
9601 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | |
9602 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9603 | .dac_nids = alc883_dac_nids, | |
9604 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9605 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9606 | .channel_mode = alc883_3ST_2ch_modes, | |
9607 | .input_mux = &alc883_capture_source, | |
9608 | .unsol_event = alc883_clevo_m720_unsol_event, | |
9609 | .setup = alc883_clevo_m720_setup, | |
9610 | .init_hook = alc883_clevo_m720_init_hook, | |
9611 | }, | |
9612 | [ALC883_LENOVO_101E_2ch] = { | |
9613 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | |
9614 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | |
9615 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9616 | .dac_nids = alc883_dac_nids, | |
9617 | .adc_nids = alc883_adc_nids_alt, | |
9618 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
9619 | .capsrc_nids = alc883_capsrc_nids, | |
9620 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9621 | .channel_mode = alc883_3ST_2ch_modes, | |
9622 | .input_mux = &alc883_lenovo_101e_capture_source, | |
9623 | .unsol_event = alc883_lenovo_101e_unsol_event, | |
9624 | .init_hook = alc883_lenovo_101e_all_automute, | |
9625 | }, | |
9626 | [ALC883_LENOVO_NB0763] = { | |
9627 | .mixers = { alc883_lenovo_nb0763_mixer }, | |
9628 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | |
9629 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9630 | .dac_nids = alc883_dac_nids, | |
9631 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9632 | .channel_mode = alc883_3ST_2ch_modes, | |
9633 | .need_dac_fix = 1, | |
9634 | .input_mux = &alc883_lenovo_nb0763_capture_source, | |
9635 | .unsol_event = alc_automute_amp_unsol_event, | |
9636 | .setup = alc883_medion_md2_setup, | |
9637 | .init_hook = alc_automute_amp, | |
9638 | }, | |
9639 | [ALC888_LENOVO_MS7195_DIG] = { | |
9640 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
9641 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, | |
9642 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9643 | .dac_nids = alc883_dac_nids, | |
9644 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9645 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
9646 | .channel_mode = alc883_3ST_6ch_modes, | |
9647 | .need_dac_fix = 1, | |
9648 | .input_mux = &alc883_capture_source, | |
9649 | .unsol_event = alc883_lenovo_ms7195_unsol_event, | |
9650 | .init_hook = alc888_lenovo_ms7195_front_automute, | |
9651 | }, | |
9652 | [ALC883_HAIER_W66] = { | |
9653 | .mixers = { alc883_targa_2ch_mixer}, | |
9654 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, | |
9655 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9656 | .dac_nids = alc883_dac_nids, | |
9657 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9658 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9659 | .channel_mode = alc883_3ST_2ch_modes, | |
9660 | .input_mux = &alc883_capture_source, | |
9661 | .unsol_event = alc_automute_amp_unsol_event, | |
9662 | .setup = alc883_haier_w66_setup, | |
9663 | .init_hook = alc_automute_amp, | |
9664 | }, | |
9665 | [ALC888_3ST_HP] = { | |
9666 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
9667 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, | |
9668 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9669 | .dac_nids = alc883_dac_nids, | |
9670 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), | |
9671 | .channel_mode = alc888_3st_hp_modes, | |
9672 | .need_dac_fix = 1, | |
9673 | .input_mux = &alc883_capture_source, | |
9674 | .unsol_event = alc_automute_amp_unsol_event, | |
9675 | .setup = alc888_3st_hp_setup, | |
9676 | .init_hook = alc_automute_amp, | |
9677 | }, | |
9678 | [ALC888_6ST_DELL] = { | |
9679 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
9680 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, | |
9681 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9682 | .dac_nids = alc883_dac_nids, | |
9683 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9684 | .dig_in_nid = ALC883_DIGIN_NID, | |
9685 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
9686 | .channel_mode = alc883_sixstack_modes, | |
9687 | .input_mux = &alc883_capture_source, | |
9688 | .unsol_event = alc_automute_amp_unsol_event, | |
9689 | .setup = alc888_6st_dell_setup, | |
9690 | .init_hook = alc_automute_amp, | |
9691 | }, | |
9692 | [ALC883_MITAC] = { | |
9693 | .mixers = { alc883_mitac_mixer }, | |
9694 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | |
9695 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9696 | .dac_nids = alc883_dac_nids, | |
9697 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9698 | .channel_mode = alc883_3ST_2ch_modes, | |
9699 | .input_mux = &alc883_capture_source, | |
9700 | .unsol_event = alc_automute_amp_unsol_event, | |
9701 | .setup = alc883_mitac_setup, | |
9702 | .init_hook = alc_automute_amp, | |
9703 | }, | |
9704 | [ALC883_FUJITSU_PI2515] = { | |
9705 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | |
9706 | .init_verbs = { alc883_init_verbs, | |
9707 | alc883_2ch_fujitsu_pi2515_verbs}, | |
9708 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9709 | .dac_nids = alc883_dac_nids, | |
9710 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9711 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9712 | .channel_mode = alc883_3ST_2ch_modes, | |
9713 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
9714 | .unsol_event = alc_automute_amp_unsol_event, | |
9715 | .setup = alc883_2ch_fujitsu_pi2515_setup, | |
9716 | .init_hook = alc_automute_amp, | |
9717 | }, | |
9718 | [ALC888_FUJITSU_XA3530] = { | |
9719 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, | |
9720 | .init_verbs = { alc883_init_verbs, | |
9721 | alc888_fujitsu_xa3530_verbs }, | |
9722 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9723 | .dac_nids = alc883_dac_nids, | |
9724 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
9725 | .adc_nids = alc883_adc_nids_rev, | |
9726 | .capsrc_nids = alc883_capsrc_nids_rev, | |
9727 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9728 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), | |
9729 | .channel_mode = alc888_4ST_8ch_intel_modes, | |
9730 | .num_mux_defs = | |
9731 | ARRAY_SIZE(alc888_2_capture_sources), | |
9732 | .input_mux = alc888_2_capture_sources, | |
9733 | .unsol_event = alc_automute_amp_unsol_event, | |
9734 | .setup = alc888_fujitsu_xa3530_setup, | |
9735 | .init_hook = alc_automute_amp, | |
9736 | }, | |
9737 | [ALC888_LENOVO_SKY] = { | |
9738 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | |
9739 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, | |
9740 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9741 | .dac_nids = alc883_dac_nids, | |
9742 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9743 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
9744 | .channel_mode = alc883_sixstack_modes, | |
9745 | .need_dac_fix = 1, | |
9746 | .input_mux = &alc883_lenovo_sky_capture_source, | |
9747 | .unsol_event = alc_automute_amp_unsol_event, | |
9748 | .setup = alc888_lenovo_sky_setup, | |
9749 | .init_hook = alc_automute_amp, | |
9750 | }, | |
9751 | [ALC888_ASUS_M90V] = { | |
9752 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
9753 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, | |
9754 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9755 | .dac_nids = alc883_dac_nids, | |
9756 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9757 | .dig_in_nid = ALC883_DIGIN_NID, | |
9758 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
9759 | .channel_mode = alc883_3ST_6ch_modes, | |
9760 | .need_dac_fix = 1, | |
9761 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
9762 | .unsol_event = alc_sku_unsol_event, | |
9763 | .setup = alc883_mode2_setup, | |
9764 | .init_hook = alc_inithook, | |
9765 | }, | |
9766 | [ALC888_ASUS_EEE1601] = { | |
9767 | .mixers = { alc883_asus_eee1601_mixer }, | |
9768 | .cap_mixer = alc883_asus_eee1601_cap_mixer, | |
9769 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, | |
9770 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9771 | .dac_nids = alc883_dac_nids, | |
9772 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9773 | .dig_in_nid = ALC883_DIGIN_NID, | |
9774 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9775 | .channel_mode = alc883_3ST_2ch_modes, | |
9776 | .need_dac_fix = 1, | |
9777 | .input_mux = &alc883_asus_eee1601_capture_source, | |
9778 | .unsol_event = alc_sku_unsol_event, | |
9779 | .init_hook = alc883_eee1601_inithook, | |
9780 | }, | |
9781 | [ALC1200_ASUS_P5Q] = { | |
9782 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
9783 | .init_verbs = { alc883_init_verbs }, | |
9784 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9785 | .dac_nids = alc883_dac_nids, | |
9786 | .dig_out_nid = ALC1200_DIGOUT_NID, | |
9787 | .dig_in_nid = ALC883_DIGIN_NID, | |
9788 | .slave_dig_outs = alc1200_slave_dig_outs, | |
9789 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
9790 | .channel_mode = alc883_sixstack_modes, | |
9791 | .input_mux = &alc883_capture_source, | |
9792 | }, | |
9793 | [ALC889A_MB31] = { | |
9794 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, | |
9795 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, | |
9796 | alc880_gpio1_init_verbs }, | |
9797 | .adc_nids = alc883_adc_nids, | |
9798 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
9799 | .capsrc_nids = alc883_capsrc_nids, | |
9800 | .dac_nids = alc883_dac_nids, | |
9801 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9802 | .channel_mode = alc889A_mb31_6ch_modes, | |
9803 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), | |
9804 | .input_mux = &alc889A_mb31_capture_source, | |
9805 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9806 | .unsol_event = alc889A_mb31_unsol_event, | |
9807 | .init_hook = alc889A_mb31_automute, | |
9808 | }, | |
9809 | [ALC883_SONY_VAIO_TT] = { | |
9810 | .mixers = { alc883_vaiott_mixer }, | |
9811 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, | |
9812 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9813 | .dac_nids = alc883_dac_nids, | |
9814 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9815 | .channel_mode = alc883_3ST_2ch_modes, | |
9816 | .input_mux = &alc883_capture_source, | |
9817 | .unsol_event = alc_automute_amp_unsol_event, | |
9818 | .setup = alc883_vaiott_setup, | |
9819 | .init_hook = alc_automute_amp, | |
9820 | }, | |
9821 | }; | |
9822 | ||
9823 | ||
9824 | /* | |
9825 | * Pin config fixes | |
9826 | */ | |
9827 | enum { | |
9828 | PINFIX_ABIT_AW9D_MAX | |
9829 | }; | |
9830 | ||
9831 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { | |
9832 | { 0x15, 0x01080104 }, /* side */ | |
9833 | { 0x16, 0x01011012 }, /* rear */ | |
9834 | { 0x17, 0x01016011 }, /* clfe */ | |
9835 | { } | |
9836 | }; | |
9837 | ||
9838 | static const struct alc_fixup alc882_fixups[] = { | |
9839 | [PINFIX_ABIT_AW9D_MAX] = { | |
9840 | .pins = alc882_abit_aw9d_pinfix | |
9841 | }, | |
9842 | }; | |
9843 | ||
9844 | static struct snd_pci_quirk alc882_fixup_tbl[] = { | |
9845 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | |
9846 | {} | |
9847 | }; | |
9848 | ||
9849 | /* | |
9850 | * BIOS auto configuration | |
9851 | */ | |
9852 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, | |
9853 | const struct auto_pin_cfg *cfg) | |
9854 | { | |
9855 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); | |
9856 | } | |
9857 | ||
9858 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | |
9859 | hda_nid_t nid, int pin_type, | |
9860 | int dac_idx) | |
9861 | { | |
9862 | /* set as output */ | |
9863 | struct alc_spec *spec = codec->spec; | |
9864 | int idx; | |
9865 | ||
9866 | alc_set_pin_output(codec, nid, pin_type); | |
9867 | if (spec->multiout.dac_nids[dac_idx] == 0x25) | |
9868 | idx = 4; | |
9869 | else | |
9870 | idx = spec->multiout.dac_nids[dac_idx] - 2; | |
9871 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | |
9872 | ||
9873 | } | |
9874 | ||
9875 | static void alc882_auto_init_multi_out(struct hda_codec *codec) | |
9876 | { | |
9877 | struct alc_spec *spec = codec->spec; | |
9878 | int i; | |
9879 | ||
9880 | for (i = 0; i <= HDA_SIDE; i++) { | |
9881 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
9882 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
9883 | if (nid) | |
9884 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, | |
9885 | i); | |
9886 | } | |
9887 | } | |
9888 | ||
9889 | static void alc882_auto_init_hp_out(struct hda_codec *codec) | |
9890 | { | |
9891 | struct alc_spec *spec = codec->spec; | |
9892 | hda_nid_t pin; | |
9893 | ||
9894 | pin = spec->autocfg.hp_pins[0]; | |
9895 | if (pin) /* connect to front */ | |
9896 | /* use dac 0 */ | |
9897 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
9898 | pin = spec->autocfg.speaker_pins[0]; | |
9899 | if (pin) | |
9900 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
9901 | } | |
9902 | ||
9903 | static void alc882_auto_init_analog_input(struct hda_codec *codec) | |
9904 | { | |
9905 | struct alc_spec *spec = codec->spec; | |
9906 | int i; | |
9907 | ||
9908 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
9909 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
9910 | if (!nid) | |
9911 | continue; | |
9912 | alc_set_input_pin(codec, nid, i); | |
9913 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) | |
9914 | snd_hda_codec_write(codec, nid, 0, | |
9915 | AC_VERB_SET_AMP_GAIN_MUTE, | |
9916 | AMP_OUT_MUTE); | |
9917 | } | |
9918 | } | |
9919 | ||
9920 | static void alc882_auto_init_input_src(struct hda_codec *codec) | |
9921 | { | |
9922 | struct alc_spec *spec = codec->spec; | |
9923 | int c; | |
9924 | ||
9925 | for (c = 0; c < spec->num_adc_nids; c++) { | |
9926 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | |
9927 | hda_nid_t nid = spec->capsrc_nids[c]; | |
9928 | unsigned int mux_idx; | |
9929 | const struct hda_input_mux *imux; | |
9930 | int conns, mute, idx, item; | |
9931 | ||
9932 | conns = snd_hda_get_connections(codec, nid, conn_list, | |
9933 | ARRAY_SIZE(conn_list)); | |
9934 | if (conns < 0) | |
9935 | continue; | |
9936 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | |
9937 | imux = &spec->input_mux[mux_idx]; | |
9938 | for (idx = 0; idx < conns; idx++) { | |
9939 | /* if the current connection is the selected one, | |
9940 | * unmute it as default - otherwise mute it | |
9941 | */ | |
9942 | mute = AMP_IN_MUTE(idx); | |
9943 | for (item = 0; item < imux->num_items; item++) { | |
9944 | if (imux->items[item].index == idx) { | |
9945 | if (spec->cur_mux[c] == item) | |
9946 | mute = AMP_IN_UNMUTE(idx); | |
9947 | break; | |
9948 | } | |
9949 | } | |
9950 | /* check if we have a selector or mixer | |
9951 | * we could check for the widget type instead, but | |
9952 | * just check for Amp-In presence (in case of mixer | |
9953 | * without amp-in there is something wrong, this | |
9954 | * function shouldn't be used or capsrc nid is wrong) | |
9955 | */ | |
9956 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | |
9957 | snd_hda_codec_write(codec, nid, 0, | |
9958 | AC_VERB_SET_AMP_GAIN_MUTE, | |
9959 | mute); | |
9960 | else if (mute != AMP_IN_MUTE(idx)) | |
9961 | snd_hda_codec_write(codec, nid, 0, | |
9962 | AC_VERB_SET_CONNECT_SEL, | |
9963 | idx); | |
9964 | } | |
9965 | } | |
9966 | } | |
9967 | ||
9968 | /* add mic boosts if needed */ | |
9969 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | |
9970 | { | |
9971 | struct alc_spec *spec = codec->spec; | |
9972 | int err; | |
9973 | hda_nid_t nid; | |
9974 | ||
9975 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | |
9976 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | |
9977 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
9978 | "Mic Boost", | |
9979 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
9980 | if (err < 0) | |
9981 | return err; | |
9982 | } | |
9983 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | |
9984 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | |
9985 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
9986 | "Front Mic Boost", | |
9987 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
9988 | if (err < 0) | |
9989 | return err; | |
9990 | } | |
9991 | return 0; | |
9992 | } | |
9993 | ||
9994 | /* almost identical with ALC880 parser... */ | |
9995 | static int alc882_parse_auto_config(struct hda_codec *codec) | |
9996 | { | |
9997 | struct alc_spec *spec = codec->spec; | |
9998 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; | |
9999 | int i, err; | |
10000 | ||
10001 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
10002 | alc882_ignore); | |
10003 | if (err < 0) | |
10004 | return err; | |
10005 | if (!spec->autocfg.line_outs) | |
10006 | return 0; /* can't find valid BIOS pin config */ | |
10007 | ||
10008 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | |
10009 | if (err < 0) | |
10010 | return err; | |
10011 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
10012 | if (err < 0) | |
10013 | return err; | |
10014 | err = alc880_auto_create_extra_out(spec, | |
10015 | spec->autocfg.speaker_pins[0], | |
10016 | "Speaker"); | |
10017 | if (err < 0) | |
10018 | return err; | |
10019 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
10020 | "Headphone"); | |
10021 | if (err < 0) | |
10022 | return err; | |
10023 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); | |
10024 | if (err < 0) | |
10025 | return err; | |
10026 | ||
10027 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
10028 | ||
10029 | /* check multiple SPDIF-out (for recent codecs) */ | |
10030 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | |
10031 | hda_nid_t dig_nid; | |
10032 | err = snd_hda_get_connections(codec, | |
10033 | spec->autocfg.dig_out_pins[i], | |
10034 | &dig_nid, 1); | |
10035 | if (err < 0) | |
10036 | continue; | |
10037 | if (!i) | |
10038 | spec->multiout.dig_out_nid = dig_nid; | |
10039 | else { | |
10040 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | |
10041 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) | |
10042 | break; | |
10043 | spec->slave_dig_outs[i - 1] = dig_nid; | |
10044 | } | |
10045 | } | |
10046 | if (spec->autocfg.dig_in_pin) | |
10047 | spec->dig_in_nid = ALC880_DIGIN_NID; | |
10048 | ||
10049 | if (spec->kctls.list) | |
10050 | add_mixer(spec, spec->kctls.list); | |
10051 | ||
10052 | add_verb(spec, alc883_auto_init_verbs); | |
10053 | /* if ADC 0x07 is available, initialize it, too */ | |
10054 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) | |
10055 | add_verb(spec, alc882_adc1_init_verbs); | |
10056 | ||
10057 | spec->num_mux_defs = 1; | |
10058 | spec->input_mux = &spec->private_imux[0]; | |
10059 | ||
10060 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); | |
10061 | ||
10062 | err = alc_auto_add_mic_boost(codec); | |
10063 | if (err < 0) | |
10064 | return err; | |
10065 | ||
10066 | return 1; /* config found */ | |
10067 | } | |
10068 | ||
10069 | /* additional initialization for auto-configuration model */ | |
10070 | static void alc882_auto_init(struct hda_codec *codec) | |
10071 | { | |
10072 | struct alc_spec *spec = codec->spec; | |
10073 | alc882_auto_init_multi_out(codec); | |
10074 | alc882_auto_init_hp_out(codec); | |
10075 | alc882_auto_init_analog_input(codec); | |
10076 | alc882_auto_init_input_src(codec); | |
10077 | if (spec->unsol_event) | |
10078 | alc_inithook(codec); | |
10079 | } | |
10080 | ||
10081 | static int patch_alc882(struct hda_codec *codec) | |
10082 | { | |
10083 | struct alc_spec *spec; | |
10084 | int err, board_config; | |
10085 | ||
10086 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
10087 | if (spec == NULL) | |
10088 | return -ENOMEM; | |
10089 | ||
10090 | codec->spec = spec; | |
10091 | ||
10092 | switch (codec->vendor_id) { | |
10093 | case 0x10ec0882: | |
10094 | case 0x10ec0885: | |
10095 | break; | |
10096 | default: | |
10097 | /* ALC883 and variants */ | |
10098 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | |
10099 | break; | |
10100 | } | |
10101 | ||
10102 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, | |
10103 | alc882_models, | |
10104 | alc882_cfg_tbl); | |
10105 | ||
10106 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) | |
10107 | board_config = snd_hda_check_board_codec_sid_config(codec, | |
10108 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); | |
10109 | ||
10110 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | |
10111 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
10112 | codec->chip_name); | |
10113 | board_config = ALC882_AUTO; | |
10114 | } | |
10115 | ||
10116 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups); | |
10117 | ||
10118 | if (board_config == ALC882_AUTO) { | |
10119 | /* automatic parse from the BIOS config */ | |
10120 | err = alc882_parse_auto_config(codec); | |
10121 | if (err < 0) { | |
10122 | alc_free(codec); | |
10123 | return err; | |
10124 | } else if (!err) { | |
10125 | printk(KERN_INFO | |
10126 | "hda_codec: Cannot set up configuration " | |
10127 | "from BIOS. Using base mode...\n"); | |
10128 | board_config = ALC882_3ST_DIG; | |
10129 | } | |
10130 | } | |
10131 | ||
10132 | err = snd_hda_attach_beep_device(codec, 0x1); | |
10133 | if (err < 0) { | |
10134 | alc_free(codec); | |
10135 | return err; | |
10136 | } | |
10137 | ||
10138 | if (board_config != ALC882_AUTO) | |
10139 | setup_preset(codec, &alc882_presets[board_config]); | |
10140 | ||
10141 | spec->stream_analog_playback = &alc882_pcm_analog_playback; | |
10142 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | |
10143 | /* FIXME: setup DAC5 */ | |
10144 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ | |
10145 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | |
10146 | ||
10147 | spec->stream_digital_playback = &alc882_pcm_digital_playback; | |
10148 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | |
10149 | ||
10150 | if (codec->vendor_id == 0x10ec0888) | |
10151 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ | |
10152 | ||
10153 | if (!spec->adc_nids && spec->input_mux) { | |
10154 | int i, j; | |
10155 | spec->num_adc_nids = 0; | |
10156 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { | |
10157 | const struct hda_input_mux *imux = spec->input_mux; | |
10158 | hda_nid_t cap; | |
10159 | hda_nid_t items[16]; | |
10160 | hda_nid_t nid = alc882_adc_nids[i]; | |
10161 | unsigned int wcap = get_wcaps(codec, nid); | |
10162 | /* get type */ | |
10163 | wcap = get_wcaps_type(wcap); | |
10164 | if (wcap != AC_WID_AUD_IN) | |
10165 | continue; | |
10166 | spec->private_adc_nids[spec->num_adc_nids] = nid; | |
10167 | err = snd_hda_get_connections(codec, nid, &cap, 1); | |
10168 | if (err < 0) | |
10169 | continue; | |
10170 | err = snd_hda_get_connections(codec, cap, items, | |
10171 | ARRAY_SIZE(items)); | |
10172 | if (err < 0) | |
10173 | continue; | |
10174 | for (j = 0; j < imux->num_items; j++) | |
10175 | if (imux->items[j].index >= err) | |
10176 | break; | |
10177 | if (j < imux->num_items) | |
10178 | continue; | |
10179 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; | |
10180 | spec->num_adc_nids++; | |
10181 | } | |
10182 | spec->adc_nids = spec->private_adc_nids; | |
10183 | spec->capsrc_nids = spec->private_capsrc_nids; | |
10184 | } | |
10185 | ||
10186 | set_capture_mixer(codec); | |
10187 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
10188 | ||
10189 | spec->vmaster_nid = 0x0c; | |
10190 | ||
10191 | codec->patch_ops = alc_patch_ops; | |
10192 | if (board_config == ALC882_AUTO) | |
10193 | spec->init_hook = alc882_auto_init; | |
10194 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
10195 | if (!spec->loopback.amplist) | |
10196 | spec->loopback.amplist = alc882_loopbacks; | |
10197 | #endif | |
10198 | codec->proc_widget_hook = print_realtek_coef; | |
10199 | ||
10200 | return 0; | |
10201 | } | |
10202 | ||
10203 | ||
10204 | /* | |
10205 | * ALC262 support | |
10206 | */ | |
10207 | ||
10208 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | |
10209 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | |
10210 | ||
10211 | #define alc262_dac_nids alc260_dac_nids | |
10212 | #define alc262_adc_nids alc882_adc_nids | |
10213 | #define alc262_adc_nids_alt alc882_adc_nids_alt | |
10214 | #define alc262_capsrc_nids alc882_capsrc_nids | |
10215 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | |
10216 | ||
10217 | #define alc262_modes alc260_modes | |
10218 | #define alc262_capture_source alc882_capture_source | |
10219 | ||
10220 | static hda_nid_t alc262_dmic_adc_nids[1] = { | |
10221 | /* ADC0 */ | |
10222 | 0x09 | |
10223 | }; | |
10224 | ||
10225 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; | |
10226 | ||
10227 | static struct snd_kcontrol_new alc262_base_mixer[] = { | |
10228 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10229 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10230 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
10231 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
10232 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
10233 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
10234 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10235 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10236 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10237 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10238 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
10239 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
10240 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), | |
10241 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10242 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
10243 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
10244 | { } /* end */ | |
10245 | }; | |
10246 | ||
10247 | /* update HP, line and mono-out pins according to the master switch */ | |
10248 | static void alc262_hp_master_update(struct hda_codec *codec) | |
10249 | { | |
10250 | struct alc_spec *spec = codec->spec; | |
10251 | int val = spec->master_sw; | |
10252 | ||
10253 | /* HP & line-out */ | |
10254 | snd_hda_codec_write_cache(codec, 0x1b, 0, | |
10255 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
10256 | val ? PIN_HP : 0); | |
10257 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
10258 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
10259 | val ? PIN_HP : 0); | |
10260 | /* mono (speaker) depending on the HP jack sense */ | |
10261 | val = val && !spec->jack_present; | |
10262 | snd_hda_codec_write_cache(codec, 0x16, 0, | |
10263 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
10264 | val ? PIN_OUT : 0); | |
10265 | } | |
10266 | ||
10267 | static void alc262_hp_bpc_automute(struct hda_codec *codec) | |
10268 | { | |
10269 | struct alc_spec *spec = codec->spec; | |
10270 | ||
10271 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); | |
10272 | alc262_hp_master_update(codec); | |
10273 | } | |
10274 | ||
10275 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) | |
10276 | { | |
10277 | if ((res >> 26) != ALC880_HP_EVENT) | |
10278 | return; | |
10279 | alc262_hp_bpc_automute(codec); | |
10280 | } | |
10281 | ||
10282 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) | |
10283 | { | |
10284 | struct alc_spec *spec = codec->spec; | |
10285 | ||
10286 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | |
10287 | alc262_hp_master_update(codec); | |
10288 | } | |
10289 | ||
10290 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, | |
10291 | unsigned int res) | |
10292 | { | |
10293 | if ((res >> 26) != ALC880_HP_EVENT) | |
10294 | return; | |
10295 | alc262_hp_wildwest_automute(codec); | |
10296 | } | |
10297 | ||
10298 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get | |
10299 | ||
10300 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
10301 | struct snd_ctl_elem_value *ucontrol) | |
10302 | { | |
10303 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
10304 | struct alc_spec *spec = codec->spec; | |
10305 | int val = !!*ucontrol->value.integer.value; | |
10306 | ||
10307 | if (val == spec->master_sw) | |
10308 | return 0; | |
10309 | spec->master_sw = val; | |
10310 | alc262_hp_master_update(codec); | |
10311 | return 1; | |
10312 | } | |
10313 | ||
10314 | #define ALC262_HP_MASTER_SWITCH \ | |
10315 | { \ | |
10316 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
10317 | .name = "Master Playback Switch", \ | |
10318 | .info = snd_ctl_boolean_mono_info, \ | |
10319 | .get = alc262_hp_master_sw_get, \ | |
10320 | .put = alc262_hp_master_sw_put, \ | |
10321 | } | |
10322 | ||
10323 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { | |
10324 | ALC262_HP_MASTER_SWITCH, | |
10325 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10326 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10327 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
10328 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, | |
10329 | HDA_OUTPUT), | |
10330 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
10331 | HDA_OUTPUT), | |
10332 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10333 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10334 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10335 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10336 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
10337 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
10338 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
10339 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
10340 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
10341 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
10342 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
10343 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
10344 | { } /* end */ | |
10345 | }; | |
10346 | ||
10347 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { | |
10348 | ALC262_HP_MASTER_SWITCH, | |
10349 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10350 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
10351 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
10352 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10353 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, | |
10354 | HDA_OUTPUT), | |
10355 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
10356 | HDA_OUTPUT), | |
10357 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
10358 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
10359 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), | |
10360 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10361 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
10362 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
10363 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
10364 | { } /* end */ | |
10365 | }; | |
10366 | ||
10367 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |
10368 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10369 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10370 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), | |
10371 | { } /* end */ | |
10372 | }; | |
10373 | ||
10374 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
10375 | static void alc262_hp_t5735_setup(struct hda_codec *codec) | |
10376 | { | |
10377 | struct alc_spec *spec = codec->spec; | |
10378 | ||
10379 | spec->autocfg.hp_pins[0] = 0x15; | |
10380 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ | |
10381 | } | |
10382 | ||
10383 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | |
10384 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10385 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10386 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
10387 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10388 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10389 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10390 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10391 | { } /* end */ | |
10392 | }; | |
10393 | ||
10394 | static struct hda_verb alc262_hp_t5735_verbs[] = { | |
10395 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
10396 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10397 | ||
10398 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
10399 | { } | |
10400 | }; | |
10401 | ||
10402 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { | |
10403 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10404 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
10405 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
10406 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
10407 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10408 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
10409 | { } /* end */ | |
10410 | }; | |
10411 | ||
10412 | static struct hda_verb alc262_hp_rp5700_verbs[] = { | |
10413 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
10414 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
10415 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
10416 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
10417 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
10418 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10419 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
10420 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
10421 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
10422 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
10423 | {} | |
10424 | }; | |
10425 | ||
10426 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { | |
10427 | .num_items = 1, | |
10428 | .items = { | |
10429 | { "Line", 0x1 }, | |
10430 | }, | |
10431 | }; | |
10432 | ||
10433 | /* bind hp and internal speaker mute (with plug check) as master switch */ | |
10434 | static void alc262_hippo_master_update(struct hda_codec *codec) | |
10435 | { | |
10436 | struct alc_spec *spec = codec->spec; | |
10437 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
10438 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
10439 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
10440 | unsigned int mute; | |
10441 | ||
10442 | /* HP */ | |
10443 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; | |
10444 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, | |
10445 | HDA_AMP_MUTE, mute); | |
10446 | /* mute internal speaker per jack sense */ | |
10447 | if (spec->jack_present) | |
10448 | mute = HDA_AMP_MUTE; | |
10449 | if (line_nid) | |
10450 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, | |
10451 | HDA_AMP_MUTE, mute); | |
10452 | if (speaker_nid && speaker_nid != line_nid) | |
10453 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, | |
10454 | HDA_AMP_MUTE, mute); | |
10455 | } | |
10456 | ||
10457 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get | |
10458 | ||
10459 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, | |
10460 | struct snd_ctl_elem_value *ucontrol) | |
10461 | { | |
10462 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
10463 | struct alc_spec *spec = codec->spec; | |
10464 | int val = !!*ucontrol->value.integer.value; | |
10465 | ||
10466 | if (val == spec->master_sw) | |
10467 | return 0; | |
10468 | spec->master_sw = val; | |
10469 | alc262_hippo_master_update(codec); | |
10470 | return 1; | |
10471 | } | |
10472 | ||
10473 | #define ALC262_HIPPO_MASTER_SWITCH \ | |
10474 | { \ | |
10475 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
10476 | .name = "Master Playback Switch", \ | |
10477 | .info = snd_ctl_boolean_mono_info, \ | |
10478 | .get = alc262_hippo_master_sw_get, \ | |
10479 | .put = alc262_hippo_master_sw_put, \ | |
10480 | } | |
10481 | ||
10482 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { | |
10483 | ALC262_HIPPO_MASTER_SWITCH, | |
10484 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10485 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
10486 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
10487 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
10488 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
10489 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10490 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10491 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10492 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10493 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
10494 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
10495 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
10496 | { } /* end */ | |
10497 | }; | |
10498 | ||
10499 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { | |
10500 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10501 | ALC262_HIPPO_MASTER_SWITCH, | |
10502 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
10503 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
10504 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
10505 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
10506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10508 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10509 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10510 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
10511 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
10512 | { } /* end */ | |
10513 | }; | |
10514 | ||
10515 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
10516 | static void alc262_hippo_automute(struct hda_codec *codec) | |
10517 | { | |
10518 | struct alc_spec *spec = codec->spec; | |
10519 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
10520 | ||
10521 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); | |
10522 | alc262_hippo_master_update(codec); | |
10523 | } | |
10524 | ||
10525 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) | |
10526 | { | |
10527 | if ((res >> 26) != ALC880_HP_EVENT) | |
10528 | return; | |
10529 | alc262_hippo_automute(codec); | |
10530 | } | |
10531 | ||
10532 | static void alc262_hippo_setup(struct hda_codec *codec) | |
10533 | { | |
10534 | struct alc_spec *spec = codec->spec; | |
10535 | ||
10536 | spec->autocfg.hp_pins[0] = 0x15; | |
10537 | spec->autocfg.speaker_pins[0] = 0x14; | |
10538 | } | |
10539 | ||
10540 | static void alc262_hippo1_setup(struct hda_codec *codec) | |
10541 | { | |
10542 | struct alc_spec *spec = codec->spec; | |
10543 | ||
10544 | spec->autocfg.hp_pins[0] = 0x1b; | |
10545 | spec->autocfg.speaker_pins[0] = 0x14; | |
10546 | } | |
10547 | ||
10548 | ||
10549 | static struct snd_kcontrol_new alc262_sony_mixer[] = { | |
10550 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10551 | ALC262_HIPPO_MASTER_SWITCH, | |
10552 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10553 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10554 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10555 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
10556 | { } /* end */ | |
10557 | }; | |
10558 | ||
10559 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { | |
10560 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10561 | ALC262_HIPPO_MASTER_SWITCH, | |
10562 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10563 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10564 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10565 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10566 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
10567 | { } /* end */ | |
10568 | }; | |
10569 | ||
10570 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { | |
10571 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10572 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
10573 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
10574 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
10575 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
10576 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
10577 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10578 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10579 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10580 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10581 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
10582 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
10583 | { } /* end */ | |
10584 | }; | |
10585 | ||
10586 | static struct hda_verb alc262_tyan_verbs[] = { | |
10587 | /* Headphone automute */ | |
10588 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
10589 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10590 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10591 | ||
10592 | /* P11 AUX_IN, white 4-pin connector */ | |
10593 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
10594 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, | |
10595 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, | |
10596 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, | |
10597 | ||
10598 | {} | |
10599 | }; | |
10600 | ||
10601 | /* unsolicited event for HP jack sensing */ | |
10602 | static void alc262_tyan_setup(struct hda_codec *codec) | |
10603 | { | |
10604 | struct alc_spec *spec = codec->spec; | |
10605 | ||
10606 | spec->autocfg.hp_pins[0] = 0x1b; | |
10607 | spec->autocfg.speaker_pins[0] = 0x15; | |
10608 | } | |
10609 | ||
10610 | ||
10611 | #define alc262_capture_mixer alc882_capture_mixer | |
10612 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | |
10613 | ||
10614 | /* | |
10615 | * generic initialization of ADC, input mixers and output mixers | |
10616 | */ | |
10617 | static struct hda_verb alc262_init_verbs[] = { | |
10618 | /* | |
10619 | * Unmute ADC0-2 and set the default input to mic-in | |
10620 | */ | |
10621 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10622 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10623 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10624 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10625 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10626 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10627 | ||
10628 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
10629 | * mixer widget | |
10630 | * Note: PASD motherboards uses the Line In 2 as the input for | |
10631 | * front panel mic (mic 2) | |
10632 | */ | |
10633 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
10634 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
10635 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
10636 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
10637 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
10638 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
10639 | ||
10640 | /* | |
10641 | * Set up output mixers (0x0c - 0x0e) | |
10642 | */ | |
10643 | /* set vol=0 to output mixers */ | |
10644 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10645 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10646 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10647 | /* set up input amps for analog loopback */ | |
10648 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
10649 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10650 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10651 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10652 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10653 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10654 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10655 | ||
10656 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
10657 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
10658 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
10659 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
10660 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10661 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10662 | ||
10663 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
10664 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
10665 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
10666 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
10667 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
10668 | ||
10669 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10670 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
10671 | ||
10672 | /* FIXME: use matrix-type input source selection */ | |
10673 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
10674 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
10675 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10676 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
10677 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
10678 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
10679 | /* Input mixer2 */ | |
10680 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10681 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
10682 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
10683 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
10684 | /* Input mixer3 */ | |
10685 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10686 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
10687 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
10688 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
10689 | ||
10690 | { } | |
10691 | }; | |
10692 | ||
10693 | static struct hda_verb alc262_eapd_verbs[] = { | |
10694 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
10695 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
10696 | { } | |
10697 | }; | |
10698 | ||
10699 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { | |
10700 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
10701 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10702 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
10703 | ||
10704 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
10705 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10706 | {} | |
10707 | }; | |
10708 | ||
10709 | static struct hda_verb alc262_sony_unsol_verbs[] = { | |
10710 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
10711 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10712 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic | |
10713 | ||
10714 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
10715 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10716 | {} | |
10717 | }; | |
10718 | ||
10719 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { | |
10720 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10721 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10722 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10723 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10724 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10725 | { } /* end */ | |
10726 | }; | |
10727 | ||
10728 | static struct hda_verb alc262_toshiba_s06_verbs[] = { | |
10729 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
10730 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
10731 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10732 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10733 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, | |
10734 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
10735 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
10736 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
10737 | {} | |
10738 | }; | |
10739 | ||
10740 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) | |
10741 | { | |
10742 | struct alc_spec *spec = codec->spec; | |
10743 | ||
10744 | spec->autocfg.hp_pins[0] = 0x15; | |
10745 | spec->autocfg.speaker_pins[0] = 0x14; | |
10746 | spec->ext_mic.pin = 0x18; | |
10747 | spec->ext_mic.mux_idx = 0; | |
10748 | spec->int_mic.pin = 0x12; | |
10749 | spec->int_mic.mux_idx = 9; | |
10750 | spec->auto_mic = 1; | |
10751 | } | |
10752 | ||
10753 | /* | |
10754 | * nec model | |
10755 | * 0x15 = headphone | |
10756 | * 0x16 = internal speaker | |
10757 | * 0x18 = external mic | |
10758 | */ | |
10759 | ||
10760 | static struct snd_kcontrol_new alc262_nec_mixer[] = { | |
10761 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
10762 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), | |
10763 | ||
10764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10765 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10766 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10767 | ||
10768 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
10769 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10770 | { } /* end */ | |
10771 | }; | |
10772 | ||
10773 | static struct hda_verb alc262_nec_verbs[] = { | |
10774 | /* Unmute Speaker */ | |
10775 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
10776 | ||
10777 | /* Headphone */ | |
10778 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
10779 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
10780 | ||
10781 | /* External mic to headphone */ | |
10782 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10783 | /* External mic to speaker */ | |
10784 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10785 | {} | |
10786 | }; | |
10787 | ||
10788 | /* | |
10789 | * fujitsu model | |
10790 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, | |
10791 | * 0x1b = port replicator headphone out | |
10792 | */ | |
10793 | ||
10794 | #define ALC_HP_EVENT 0x37 | |
10795 | ||
10796 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { | |
10797 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
10798 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10799 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
10800 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10801 | {} | |
10802 | }; | |
10803 | ||
10804 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { | |
10805 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
10806 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10807 | {} | |
10808 | }; | |
10809 | ||
10810 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { | |
10811 | /* Front Mic pin: input vref at 50% */ | |
10812 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
10813 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10814 | {} | |
10815 | }; | |
10816 | ||
10817 | static struct hda_input_mux alc262_fujitsu_capture_source = { | |
10818 | .num_items = 3, | |
10819 | .items = { | |
10820 | { "Mic", 0x0 }, | |
10821 | { "Int Mic", 0x1 }, | |
10822 | { "CD", 0x4 }, | |
10823 | }, | |
10824 | }; | |
10825 | ||
10826 | static struct hda_input_mux alc262_HP_capture_source = { | |
10827 | .num_items = 5, | |
10828 | .items = { | |
10829 | { "Mic", 0x0 }, | |
10830 | { "Front Mic", 0x1 }, | |
10831 | { "Line", 0x2 }, | |
10832 | { "CD", 0x4 }, | |
10833 | { "AUX IN", 0x6 }, | |
10834 | }, | |
10835 | }; | |
10836 | ||
10837 | static struct hda_input_mux alc262_HP_D7000_capture_source = { | |
10838 | .num_items = 4, | |
10839 | .items = { | |
10840 | { "Mic", 0x0 }, | |
10841 | { "Front Mic", 0x2 }, | |
10842 | { "Line", 0x1 }, | |
10843 | { "CD", 0x4 }, | |
10844 | }, | |
10845 | }; | |
10846 | ||
10847 | /* mute/unmute internal speaker according to the hp jacks and mute state */ | |
10848 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) | |
10849 | { | |
10850 | struct alc_spec *spec = codec->spec; | |
10851 | unsigned int mute; | |
10852 | ||
10853 | if (force || !spec->sense_updated) { | |
10854 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || | |
10855 | snd_hda_jack_detect(codec, 0x1b); | |
10856 | spec->sense_updated = 1; | |
10857 | } | |
10858 | /* unmute internal speaker only if both HPs are unplugged and | |
10859 | * master switch is on | |
10860 | */ | |
10861 | if (spec->jack_present) | |
10862 | mute = HDA_AMP_MUTE; | |
10863 | else | |
10864 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
10865 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
10866 | HDA_AMP_MUTE, mute); | |
10867 | } | |
10868 | ||
10869 | /* unsolicited event for HP jack sensing */ | |
10870 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, | |
10871 | unsigned int res) | |
10872 | { | |
10873 | if ((res >> 26) != ALC_HP_EVENT) | |
10874 | return; | |
10875 | alc262_fujitsu_automute(codec, 1); | |
10876 | } | |
10877 | ||
10878 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) | |
10879 | { | |
10880 | alc262_fujitsu_automute(codec, 1); | |
10881 | } | |
10882 | ||
10883 | /* bind volumes of both NID 0x0c and 0x0d */ | |
10884 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { | |
10885 | .ops = &snd_hda_bind_vol, | |
10886 | .values = { | |
10887 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), | |
10888 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), | |
10889 | 0 | |
10890 | }, | |
10891 | }; | |
10892 | ||
10893 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
10894 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) | |
10895 | { | |
10896 | struct alc_spec *spec = codec->spec; | |
10897 | unsigned int mute; | |
10898 | ||
10899 | if (force || !spec->sense_updated) { | |
10900 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); | |
10901 | spec->sense_updated = 1; | |
10902 | } | |
10903 | if (spec->jack_present) { | |
10904 | /* mute internal speaker */ | |
10905 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
10906 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
10907 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
10908 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
10909 | } else { | |
10910 | /* unmute internal speaker if necessary */ | |
10911 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
10912 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
10913 | HDA_AMP_MUTE, mute); | |
10914 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
10915 | HDA_AMP_MUTE, mute); | |
10916 | } | |
10917 | } | |
10918 | ||
10919 | /* unsolicited event for HP jack sensing */ | |
10920 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, | |
10921 | unsigned int res) | |
10922 | { | |
10923 | if ((res >> 26) != ALC_HP_EVENT) | |
10924 | return; | |
10925 | alc262_lenovo_3000_automute(codec, 1); | |
10926 | } | |
10927 | ||
10928 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, | |
10929 | int dir, int idx, long *valp) | |
10930 | { | |
10931 | int i, change = 0; | |
10932 | ||
10933 | for (i = 0; i < 2; i++, valp++) | |
10934 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, | |
10935 | HDA_AMP_MUTE, | |
10936 | *valp ? 0 : HDA_AMP_MUTE); | |
10937 | return change; | |
10938 | } | |
10939 | ||
10940 | /* bind hp and internal speaker mute (with plug check) */ | |
10941 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | |
10942 | struct snd_ctl_elem_value *ucontrol) | |
10943 | { | |
10944 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
10945 | long *valp = ucontrol->value.integer.value; | |
10946 | int change; | |
10947 | ||
10948 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); | |
10949 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); | |
10950 | if (change) | |
10951 | alc262_fujitsu_automute(codec, 0); | |
10952 | return change; | |
10953 | } | |
10954 | ||
10955 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | |
10956 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
10957 | { | |
10958 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
10959 | .name = "Master Playback Switch", | |
10960 | .info = snd_hda_mixer_amp_switch_info, | |
10961 | .get = snd_hda_mixer_amp_switch_get, | |
10962 | .put = alc262_fujitsu_master_sw_put, | |
10963 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
10964 | }, | |
10965 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
10966 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
10967 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10968 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10969 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10970 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
10971 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
10972 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
10973 | { } /* end */ | |
10974 | }; | |
10975 | ||
10976 | /* bind hp and internal speaker mute (with plug check) */ | |
10977 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, | |
10978 | struct snd_ctl_elem_value *ucontrol) | |
10979 | { | |
10980 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
10981 | long *valp = ucontrol->value.integer.value; | |
10982 | int change; | |
10983 | ||
10984 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); | |
10985 | if (change) | |
10986 | alc262_lenovo_3000_automute(codec, 0); | |
10987 | return change; | |
10988 | } | |
10989 | ||
10990 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | |
10991 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
10992 | { | |
10993 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
10994 | .name = "Master Playback Switch", | |
10995 | .info = snd_hda_mixer_amp_switch_info, | |
10996 | .get = snd_hda_mixer_amp_switch_get, | |
10997 | .put = alc262_lenovo_3000_master_sw_put, | |
10998 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
10999 | }, | |
11000 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11001 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11002 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11003 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11004 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11005 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
11006 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
11007 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
11008 | { } /* end */ | |
11009 | }; | |
11010 | ||
11011 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { | |
11012 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
11013 | ALC262_HIPPO_MASTER_SWITCH, | |
11014 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11015 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11016 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11017 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11018 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11019 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11020 | { } /* end */ | |
11021 | }; | |
11022 | ||
11023 | /* additional init verbs for Benq laptops */ | |
11024 | static struct hda_verb alc262_EAPD_verbs[] = { | |
11025 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
11026 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
11027 | {} | |
11028 | }; | |
11029 | ||
11030 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { | |
11031 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11032 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11033 | ||
11034 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
11035 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
11036 | {} | |
11037 | }; | |
11038 | ||
11039 | /* Samsung Q1 Ultra Vista model setup */ | |
11040 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { | |
11041 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11042 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
11043 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11044 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11045 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
11046 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), | |
11047 | { } /* end */ | |
11048 | }; | |
11049 | ||
11050 | static struct hda_verb alc262_ultra_verbs[] = { | |
11051 | /* output mixer */ | |
11052 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11053 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11054 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11055 | /* speaker */ | |
11056 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11057 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11058 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11059 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11060 | /* HP */ | |
11061 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11062 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11063 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11064 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11065 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11066 | /* internal mic */ | |
11067 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
11068 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11069 | /* ADC, choose mic */ | |
11070 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11071 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11072 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11073 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11074 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11075 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
11076 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
11077 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
11078 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
11079 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | |
11080 | {} | |
11081 | }; | |
11082 | ||
11083 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
11084 | static void alc262_ultra_automute(struct hda_codec *codec) | |
11085 | { | |
11086 | struct alc_spec *spec = codec->spec; | |
11087 | unsigned int mute; | |
11088 | ||
11089 | mute = 0; | |
11090 | /* auto-mute only when HP is used as HP */ | |
11091 | if (!spec->cur_mux[0]) { | |
11092 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | |
11093 | if (spec->jack_present) | |
11094 | mute = HDA_AMP_MUTE; | |
11095 | } | |
11096 | /* mute/unmute internal speaker */ | |
11097 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11098 | HDA_AMP_MUTE, mute); | |
11099 | /* mute/unmute HP */ | |
11100 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
11101 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | |
11102 | } | |
11103 | ||
11104 | /* unsolicited event for HP jack sensing */ | |
11105 | static void alc262_ultra_unsol_event(struct hda_codec *codec, | |
11106 | unsigned int res) | |
11107 | { | |
11108 | if ((res >> 26) != ALC880_HP_EVENT) | |
11109 | return; | |
11110 | alc262_ultra_automute(codec); | |
11111 | } | |
11112 | ||
11113 | static struct hda_input_mux alc262_ultra_capture_source = { | |
11114 | .num_items = 2, | |
11115 | .items = { | |
11116 | { "Mic", 0x1 }, | |
11117 | { "Headphone", 0x7 }, | |
11118 | }, | |
11119 | }; | |
11120 | ||
11121 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | |
11122 | struct snd_ctl_elem_value *ucontrol) | |
11123 | { | |
11124 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11125 | struct alc_spec *spec = codec->spec; | |
11126 | int ret; | |
11127 | ||
11128 | ret = alc_mux_enum_put(kcontrol, ucontrol); | |
11129 | if (!ret) | |
11130 | return 0; | |
11131 | /* reprogram the HP pin as mic or HP according to the input source */ | |
11132 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
11133 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11134 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | |
11135 | alc262_ultra_automute(codec); /* mute/unmute HP */ | |
11136 | return ret; | |
11137 | } | |
11138 | ||
11139 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | |
11140 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | |
11141 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
11142 | { | |
11143 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11144 | .name = "Capture Source", | |
11145 | .info = alc_mux_enum_info, | |
11146 | .get = alc_mux_enum_get, | |
11147 | .put = alc262_ultra_mux_enum_put, | |
11148 | }, | |
11149 | { } /* end */ | |
11150 | }; | |
11151 | ||
11152 | /* We use two mixers depending on the output pin; 0x16 is a mono output | |
11153 | * and thus it's bound with a different mixer. | |
11154 | * This function returns which mixer amp should be used. | |
11155 | */ | |
11156 | static int alc262_check_volbit(hda_nid_t nid) | |
11157 | { | |
11158 | if (!nid) | |
11159 | return 0; | |
11160 | else if (nid == 0x16) | |
11161 | return 2; | |
11162 | else | |
11163 | return 1; | |
11164 | } | |
11165 | ||
11166 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, | |
11167 | const char *pfx, int *vbits) | |
11168 | { | |
11169 | unsigned long val; | |
11170 | int vbit; | |
11171 | ||
11172 | vbit = alc262_check_volbit(nid); | |
11173 | if (!vbit) | |
11174 | return 0; | |
11175 | if (*vbits & vbit) /* a volume control for this mixer already there */ | |
11176 | return 0; | |
11177 | *vbits |= vbit; | |
11178 | if (vbit == 2) | |
11179 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); | |
11180 | else | |
11181 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); | |
11182 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); | |
11183 | } | |
11184 | ||
11185 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, | |
11186 | const char *pfx) | |
11187 | { | |
11188 | unsigned long val; | |
11189 | ||
11190 | if (!nid) | |
11191 | return 0; | |
11192 | if (nid == 0x16) | |
11193 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
11194 | else | |
11195 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
11196 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); | |
11197 | } | |
11198 | ||
11199 | /* add playback controls from the parsed DAC table */ | |
11200 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, | |
11201 | const struct auto_pin_cfg *cfg) | |
11202 | { | |
11203 | const char *pfx; | |
11204 | int vbits; | |
11205 | int err; | |
11206 | ||
11207 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
11208 | spec->multiout.dac_nids = spec->private_dac_nids; | |
11209 | spec->multiout.dac_nids[0] = 2; | |
11210 | ||
11211 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) | |
11212 | pfx = "Master"; | |
11213 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
11214 | pfx = "Speaker"; | |
11215 | else | |
11216 | pfx = "Front"; | |
11217 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); | |
11218 | if (err < 0) | |
11219 | return err; | |
11220 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); | |
11221 | if (err < 0) | |
11222 | return err; | |
11223 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); | |
11224 | if (err < 0) | |
11225 | return err; | |
11226 | ||
11227 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | | |
11228 | alc262_check_volbit(cfg->speaker_pins[0]) | | |
11229 | alc262_check_volbit(cfg->hp_pins[0]); | |
11230 | if (vbits == 1 || vbits == 2) | |
11231 | pfx = "Master"; /* only one mixer is used */ | |
11232 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
11233 | pfx = "Speaker"; | |
11234 | else | |
11235 | pfx = "Front"; | |
11236 | vbits = 0; | |
11237 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); | |
11238 | if (err < 0) | |
11239 | return err; | |
11240 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", | |
11241 | &vbits); | |
11242 | if (err < 0) | |
11243 | return err; | |
11244 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", | |
11245 | &vbits); | |
11246 | if (err < 0) | |
11247 | return err; | |
11248 | return 0; | |
11249 | } | |
11250 | ||
11251 | #define alc262_auto_create_input_ctls \ | |
11252 | alc882_auto_create_input_ctls | |
11253 | ||
11254 | /* | |
11255 | * generic initialization of ADC, input mixers and output mixers | |
11256 | */ | |
11257 | static struct hda_verb alc262_volume_init_verbs[] = { | |
11258 | /* | |
11259 | * Unmute ADC0-2 and set the default input to mic-in | |
11260 | */ | |
11261 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11262 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11263 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11264 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11265 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11266 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11267 | ||
11268 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
11269 | * mixer widget | |
11270 | * Note: PASD motherboards uses the Line In 2 as the input for | |
11271 | * front panel mic (mic 2) | |
11272 | */ | |
11273 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
11274 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11275 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11276 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11277 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11278 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
11279 | ||
11280 | /* | |
11281 | * Set up output mixers (0x0c - 0x0f) | |
11282 | */ | |
11283 | /* set vol=0 to output mixers */ | |
11284 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11285 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11286 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11287 | ||
11288 | /* set up input amps for analog loopback */ | |
11289 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
11290 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11291 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11292 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11293 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11294 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11295 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11296 | ||
11297 | /* FIXME: use matrix-type input source selection */ | |
11298 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
11299 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
11300 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11301 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11302 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11303 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11304 | /* Input mixer2 */ | |
11305 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11306 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11307 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11308 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11309 | /* Input mixer3 */ | |
11310 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11311 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11312 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11313 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11314 | ||
11315 | { } | |
11316 | }; | |
11317 | ||
11318 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { | |
11319 | /* | |
11320 | * Unmute ADC0-2 and set the default input to mic-in | |
11321 | */ | |
11322 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11323 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11324 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11325 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11326 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11327 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11328 | ||
11329 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
11330 | * mixer widget | |
11331 | * Note: PASD motherboards uses the Line In 2 as the input for | |
11332 | * front panel mic (mic 2) | |
11333 | */ | |
11334 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
11335 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11336 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11337 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11338 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11339 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
11340 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
11341 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
11342 | ||
11343 | /* | |
11344 | * Set up output mixers (0x0c - 0x0e) | |
11345 | */ | |
11346 | /* set vol=0 to output mixers */ | |
11347 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11348 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11349 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11350 | ||
11351 | /* set up input amps for analog loopback */ | |
11352 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
11353 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11354 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11355 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11356 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11357 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11358 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11359 | ||
11360 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11361 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
11362 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
11363 | ||
11364 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
11365 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
11366 | ||
11367 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11368 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11369 | ||
11370 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11371 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11372 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11373 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11374 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11375 | ||
11376 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
11377 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
11378 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
11379 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
11380 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
11381 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
11382 | ||
11383 | ||
11384 | /* FIXME: use matrix-type input source selection */ | |
11385 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ | |
11386 | /* Input mixer1: only unmute Mic */ | |
11387 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11388 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | |
11389 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11390 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11391 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11392 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
11393 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
11394 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
11395 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
11396 | /* Input mixer2 */ | |
11397 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11398 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | |
11399 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11400 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11401 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11402 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
11403 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
11404 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
11405 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
11406 | /* Input mixer3 */ | |
11407 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11408 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | |
11409 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11410 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11411 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11412 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
11413 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
11414 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
11415 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
11416 | ||
11417 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
11418 | ||
11419 | { } | |
11420 | }; | |
11421 | ||
11422 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { | |
11423 | /* | |
11424 | * Unmute ADC0-2 and set the default input to mic-in | |
11425 | */ | |
11426 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11427 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11428 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11429 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11430 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11431 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11432 | ||
11433 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
11434 | * mixer widget | |
11435 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
11436 | * panel mic (mic 2) | |
11437 | */ | |
11438 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
11439 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11440 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11441 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11442 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11443 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
11444 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
11445 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
11446 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
11447 | /* | |
11448 | * Set up output mixers (0x0c - 0x0e) | |
11449 | */ | |
11450 | /* set vol=0 to output mixers */ | |
11451 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11452 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11453 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11454 | ||
11455 | /* set up input amps for analog loopback */ | |
11456 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
11457 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11458 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11459 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11460 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11461 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11462 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11463 | ||
11464 | ||
11465 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ | |
11466 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ | |
11467 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ | |
11468 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ | |
11469 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
11470 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ | |
11471 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ | |
11472 | ||
11473 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
11474 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
11475 | ||
11476 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11477 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11478 | ||
11479 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ | |
11480 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
11481 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
11482 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
11483 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
11484 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
11485 | ||
11486 | /* FIXME: use matrix-type input source selection */ | |
11487 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
11488 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
11489 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ | |
11490 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ | |
11491 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ | |
11492 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ | |
11493 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ | |
11494 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
11495 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ | |
11496 | /* Input mixer2 */ | |
11497 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11498 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
11499 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
11500 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
11501 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
11502 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
11503 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
11504 | /* Input mixer3 */ | |
11505 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11506 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
11507 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
11508 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
11509 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
11510 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
11511 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
11512 | ||
11513 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
11514 | ||
11515 | { } | |
11516 | }; | |
11517 | ||
11518 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { | |
11519 | ||
11520 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | |
11521 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
11522 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11523 | ||
11524 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ | |
11525 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
11526 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
11527 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
11528 | ||
11529 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ | |
11530 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11531 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11532 | {} | |
11533 | }; | |
11534 | ||
11535 | ||
11536 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
11537 | #define alc262_loopbacks alc880_loopbacks | |
11538 | #endif | |
11539 | ||
11540 | /* pcm configuration: identical with ALC880 */ | |
11541 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback | |
11542 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture | |
11543 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback | |
11544 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture | |
11545 | ||
11546 | /* | |
11547 | * BIOS auto configuration | |
11548 | */ | |
11549 | static int alc262_parse_auto_config(struct hda_codec *codec) | |
11550 | { | |
11551 | struct alc_spec *spec = codec->spec; | |
11552 | int err; | |
11553 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; | |
11554 | ||
11555 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
11556 | alc262_ignore); | |
11557 | if (err < 0) | |
11558 | return err; | |
11559 | if (!spec->autocfg.line_outs) { | |
11560 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
11561 | spec->multiout.max_channels = 2; | |
11562 | spec->no_analog = 1; | |
11563 | goto dig_only; | |
11564 | } | |
11565 | return 0; /* can't find valid BIOS pin config */ | |
11566 | } | |
11567 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
11568 | if (err < 0) | |
11569 | return err; | |
11570 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); | |
11571 | if (err < 0) | |
11572 | return err; | |
11573 | ||
11574 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
11575 | ||
11576 | dig_only: | |
11577 | if (spec->autocfg.dig_outs) { | |
11578 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; | |
11579 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | |
11580 | } | |
11581 | if (spec->autocfg.dig_in_pin) | |
11582 | spec->dig_in_nid = ALC262_DIGIN_NID; | |
11583 | ||
11584 | if (spec->kctls.list) | |
11585 | add_mixer(spec, spec->kctls.list); | |
11586 | ||
11587 | add_verb(spec, alc262_volume_init_verbs); | |
11588 | spec->num_mux_defs = 1; | |
11589 | spec->input_mux = &spec->private_imux[0]; | |
11590 | ||
11591 | err = alc_auto_add_mic_boost(codec); | |
11592 | if (err < 0) | |
11593 | return err; | |
11594 | ||
11595 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); | |
11596 | ||
11597 | return 1; | |
11598 | } | |
11599 | ||
11600 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out | |
11601 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out | |
11602 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input | |
11603 | #define alc262_auto_init_input_src alc882_auto_init_input_src | |
11604 | ||
11605 | ||
11606 | /* init callback for auto-configuration model -- overriding the default init */ | |
11607 | static void alc262_auto_init(struct hda_codec *codec) | |
11608 | { | |
11609 | struct alc_spec *spec = codec->spec; | |
11610 | alc262_auto_init_multi_out(codec); | |
11611 | alc262_auto_init_hp_out(codec); | |
11612 | alc262_auto_init_analog_input(codec); | |
11613 | alc262_auto_init_input_src(codec); | |
11614 | if (spec->unsol_event) | |
11615 | alc_inithook(codec); | |
11616 | } | |
11617 | ||
11618 | /* | |
11619 | * configuration and preset | |
11620 | */ | |
11621 | static const char *alc262_models[ALC262_MODEL_LAST] = { | |
11622 | [ALC262_BASIC] = "basic", | |
11623 | [ALC262_HIPPO] = "hippo", | |
11624 | [ALC262_HIPPO_1] = "hippo_1", | |
11625 | [ALC262_FUJITSU] = "fujitsu", | |
11626 | [ALC262_HP_BPC] = "hp-bpc", | |
11627 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", | |
11628 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", | |
11629 | [ALC262_HP_RP5700] = "hp-rp5700", | |
11630 | [ALC262_BENQ_ED8] = "benq", | |
11631 | [ALC262_BENQ_T31] = "benq-t31", | |
11632 | [ALC262_SONY_ASSAMD] = "sony-assamd", | |
11633 | [ALC262_TOSHIBA_S06] = "toshiba-s06", | |
11634 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", | |
11635 | [ALC262_ULTRA] = "ultra", | |
11636 | [ALC262_LENOVO_3000] = "lenovo-3000", | |
11637 | [ALC262_NEC] = "nec", | |
11638 | [ALC262_TYAN] = "tyan", | |
11639 | [ALC262_AUTO] = "auto", | |
11640 | }; | |
11641 | ||
11642 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | |
11643 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | |
11644 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), | |
11645 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", | |
11646 | ALC262_HP_BPC), | |
11647 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", | |
11648 | ALC262_HP_BPC), | |
11649 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", | |
11650 | ALC262_HP_BPC), | |
11651 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), | |
11652 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), | |
11653 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), | |
11654 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), | |
11655 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), | |
11656 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), | |
11657 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), | |
11658 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), | |
11659 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), | |
11660 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), | |
11661 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), | |
11662 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", | |
11663 | ALC262_HP_TC_T5735), | |
11664 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), | |
11665 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), | |
11666 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), | |
11667 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), | |
11668 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ | |
11669 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), | |
11670 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), | |
11671 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), | |
11672 | #if 0 /* disable the quirk since model=auto works better in recent versions */ | |
11673 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", | |
11674 | ALC262_SONY_ASSAMD), | |
11675 | #endif | |
11676 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", | |
11677 | ALC262_TOSHIBA_RX1), | |
11678 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), | |
11679 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), | |
11680 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), | |
11681 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), | |
11682 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", | |
11683 | ALC262_ULTRA), | |
11684 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), | |
11685 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), | |
11686 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), | |
11687 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), | |
11688 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | |
11689 | {} | |
11690 | }; | |
11691 | ||
11692 | static struct alc_config_preset alc262_presets[] = { | |
11693 | [ALC262_BASIC] = { | |
11694 | .mixers = { alc262_base_mixer }, | |
11695 | .init_verbs = { alc262_init_verbs }, | |
11696 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11697 | .dac_nids = alc262_dac_nids, | |
11698 | .hp_nid = 0x03, | |
11699 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11700 | .channel_mode = alc262_modes, | |
11701 | .input_mux = &alc262_capture_source, | |
11702 | }, | |
11703 | [ALC262_HIPPO] = { | |
11704 | .mixers = { alc262_hippo_mixer }, | |
11705 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, | |
11706 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11707 | .dac_nids = alc262_dac_nids, | |
11708 | .hp_nid = 0x03, | |
11709 | .dig_out_nid = ALC262_DIGOUT_NID, | |
11710 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11711 | .channel_mode = alc262_modes, | |
11712 | .input_mux = &alc262_capture_source, | |
11713 | .unsol_event = alc262_hippo_unsol_event, | |
11714 | .setup = alc262_hippo_setup, | |
11715 | .init_hook = alc262_hippo_automute, | |
11716 | }, | |
11717 | [ALC262_HIPPO_1] = { | |
11718 | .mixers = { alc262_hippo1_mixer }, | |
11719 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, | |
11720 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11721 | .dac_nids = alc262_dac_nids, | |
11722 | .hp_nid = 0x02, | |
11723 | .dig_out_nid = ALC262_DIGOUT_NID, | |
11724 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11725 | .channel_mode = alc262_modes, | |
11726 | .input_mux = &alc262_capture_source, | |
11727 | .unsol_event = alc262_hippo_unsol_event, | |
11728 | .setup = alc262_hippo1_setup, | |
11729 | .init_hook = alc262_hippo_automute, | |
11730 | }, | |
11731 | [ALC262_FUJITSU] = { | |
11732 | .mixers = { alc262_fujitsu_mixer }, | |
11733 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | |
11734 | alc262_fujitsu_unsol_verbs }, | |
11735 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11736 | .dac_nids = alc262_dac_nids, | |
11737 | .hp_nid = 0x03, | |
11738 | .dig_out_nid = ALC262_DIGOUT_NID, | |
11739 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11740 | .channel_mode = alc262_modes, | |
11741 | .input_mux = &alc262_fujitsu_capture_source, | |
11742 | .unsol_event = alc262_fujitsu_unsol_event, | |
11743 | .init_hook = alc262_fujitsu_init_hook, | |
11744 | }, | |
11745 | [ALC262_HP_BPC] = { | |
11746 | .mixers = { alc262_HP_BPC_mixer }, | |
11747 | .init_verbs = { alc262_HP_BPC_init_verbs }, | |
11748 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11749 | .dac_nids = alc262_dac_nids, | |
11750 | .hp_nid = 0x03, | |
11751 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11752 | .channel_mode = alc262_modes, | |
11753 | .input_mux = &alc262_HP_capture_source, | |
11754 | .unsol_event = alc262_hp_bpc_unsol_event, | |
11755 | .init_hook = alc262_hp_bpc_automute, | |
11756 | }, | |
11757 | [ALC262_HP_BPC_D7000_WF] = { | |
11758 | .mixers = { alc262_HP_BPC_WildWest_mixer }, | |
11759 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
11760 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11761 | .dac_nids = alc262_dac_nids, | |
11762 | .hp_nid = 0x03, | |
11763 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11764 | .channel_mode = alc262_modes, | |
11765 | .input_mux = &alc262_HP_D7000_capture_source, | |
11766 | .unsol_event = alc262_hp_wildwest_unsol_event, | |
11767 | .init_hook = alc262_hp_wildwest_automute, | |
11768 | }, | |
11769 | [ALC262_HP_BPC_D7000_WL] = { | |
11770 | .mixers = { alc262_HP_BPC_WildWest_mixer, | |
11771 | alc262_HP_BPC_WildWest_option_mixer }, | |
11772 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
11773 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11774 | .dac_nids = alc262_dac_nids, | |
11775 | .hp_nid = 0x03, | |
11776 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11777 | .channel_mode = alc262_modes, | |
11778 | .input_mux = &alc262_HP_D7000_capture_source, | |
11779 | .unsol_event = alc262_hp_wildwest_unsol_event, | |
11780 | .init_hook = alc262_hp_wildwest_automute, | |
11781 | }, | |
11782 | [ALC262_HP_TC_T5735] = { | |
11783 | .mixers = { alc262_hp_t5735_mixer }, | |
11784 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, | |
11785 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11786 | .dac_nids = alc262_dac_nids, | |
11787 | .hp_nid = 0x03, | |
11788 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11789 | .channel_mode = alc262_modes, | |
11790 | .input_mux = &alc262_capture_source, | |
11791 | .unsol_event = alc_automute_amp_unsol_event, | |
11792 | .setup = alc262_hp_t5735_setup, | |
11793 | .init_hook = alc_automute_amp, | |
11794 | }, | |
11795 | [ALC262_HP_RP5700] = { | |
11796 | .mixers = { alc262_hp_rp5700_mixer }, | |
11797 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, | |
11798 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11799 | .dac_nids = alc262_dac_nids, | |
11800 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11801 | .channel_mode = alc262_modes, | |
11802 | .input_mux = &alc262_hp_rp5700_capture_source, | |
11803 | }, | |
11804 | [ALC262_BENQ_ED8] = { | |
11805 | .mixers = { alc262_base_mixer }, | |
11806 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | |
11807 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11808 | .dac_nids = alc262_dac_nids, | |
11809 | .hp_nid = 0x03, | |
11810 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11811 | .channel_mode = alc262_modes, | |
11812 | .input_mux = &alc262_capture_source, | |
11813 | }, | |
11814 | [ALC262_SONY_ASSAMD] = { | |
11815 | .mixers = { alc262_sony_mixer }, | |
11816 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, | |
11817 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11818 | .dac_nids = alc262_dac_nids, | |
11819 | .hp_nid = 0x02, | |
11820 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11821 | .channel_mode = alc262_modes, | |
11822 | .input_mux = &alc262_capture_source, | |
11823 | .unsol_event = alc262_hippo_unsol_event, | |
11824 | .setup = alc262_hippo_setup, | |
11825 | .init_hook = alc262_hippo_automute, | |
11826 | }, | |
11827 | [ALC262_BENQ_T31] = { | |
11828 | .mixers = { alc262_benq_t31_mixer }, | |
11829 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, | |
11830 | alc_hp15_unsol_verbs }, | |
11831 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11832 | .dac_nids = alc262_dac_nids, | |
11833 | .hp_nid = 0x03, | |
11834 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11835 | .channel_mode = alc262_modes, | |
11836 | .input_mux = &alc262_capture_source, | |
11837 | .unsol_event = alc262_hippo_unsol_event, | |
11838 | .setup = alc262_hippo_setup, | |
11839 | .init_hook = alc262_hippo_automute, | |
11840 | }, | |
11841 | [ALC262_ULTRA] = { | |
11842 | .mixers = { alc262_ultra_mixer }, | |
11843 | .cap_mixer = alc262_ultra_capture_mixer, | |
11844 | .init_verbs = { alc262_ultra_verbs }, | |
11845 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11846 | .dac_nids = alc262_dac_nids, | |
11847 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11848 | .channel_mode = alc262_modes, | |
11849 | .input_mux = &alc262_ultra_capture_source, | |
11850 | .adc_nids = alc262_adc_nids, /* ADC0 */ | |
11851 | .capsrc_nids = alc262_capsrc_nids, | |
11852 | .num_adc_nids = 1, /* single ADC */ | |
11853 | .unsol_event = alc262_ultra_unsol_event, | |
11854 | .init_hook = alc262_ultra_automute, | |
11855 | }, | |
11856 | [ALC262_LENOVO_3000] = { | |
11857 | .mixers = { alc262_lenovo_3000_mixer }, | |
11858 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | |
11859 | alc262_lenovo_3000_unsol_verbs, | |
11860 | alc262_lenovo_3000_init_verbs }, | |
11861 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11862 | .dac_nids = alc262_dac_nids, | |
11863 | .hp_nid = 0x03, | |
11864 | .dig_out_nid = ALC262_DIGOUT_NID, | |
11865 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11866 | .channel_mode = alc262_modes, | |
11867 | .input_mux = &alc262_fujitsu_capture_source, | |
11868 | .unsol_event = alc262_lenovo_3000_unsol_event, | |
11869 | }, | |
11870 | [ALC262_NEC] = { | |
11871 | .mixers = { alc262_nec_mixer }, | |
11872 | .init_verbs = { alc262_nec_verbs }, | |
11873 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11874 | .dac_nids = alc262_dac_nids, | |
11875 | .hp_nid = 0x03, | |
11876 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11877 | .channel_mode = alc262_modes, | |
11878 | .input_mux = &alc262_capture_source, | |
11879 | }, | |
11880 | [ALC262_TOSHIBA_S06] = { | |
11881 | .mixers = { alc262_toshiba_s06_mixer }, | |
11882 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, | |
11883 | alc262_eapd_verbs }, | |
11884 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11885 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
11886 | .dac_nids = alc262_dac_nids, | |
11887 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ | |
11888 | .num_adc_nids = 1, /* single ADC */ | |
11889 | .dig_out_nid = ALC262_DIGOUT_NID, | |
11890 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11891 | .channel_mode = alc262_modes, | |
11892 | .unsol_event = alc_sku_unsol_event, | |
11893 | .setup = alc262_toshiba_s06_setup, | |
11894 | .init_hook = alc_inithook, | |
11895 | }, | |
11896 | [ALC262_TOSHIBA_RX1] = { | |
11897 | .mixers = { alc262_toshiba_rx1_mixer }, | |
11898 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, | |
11899 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11900 | .dac_nids = alc262_dac_nids, | |
11901 | .hp_nid = 0x03, | |
11902 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11903 | .channel_mode = alc262_modes, | |
11904 | .input_mux = &alc262_capture_source, | |
11905 | .unsol_event = alc262_hippo_unsol_event, | |
11906 | .setup = alc262_hippo_setup, | |
11907 | .init_hook = alc262_hippo_automute, | |
11908 | }, | |
11909 | [ALC262_TYAN] = { | |
11910 | .mixers = { alc262_tyan_mixer }, | |
11911 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, | |
11912 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
11913 | .dac_nids = alc262_dac_nids, | |
11914 | .hp_nid = 0x02, | |
11915 | .dig_out_nid = ALC262_DIGOUT_NID, | |
11916 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
11917 | .channel_mode = alc262_modes, | |
11918 | .input_mux = &alc262_capture_source, | |
11919 | .unsol_event = alc_automute_amp_unsol_event, | |
11920 | .setup = alc262_tyan_setup, | |
11921 | .init_hook = alc_automute_amp, | |
11922 | }, | |
11923 | }; | |
11924 | ||
11925 | static int patch_alc262(struct hda_codec *codec) | |
11926 | { | |
11927 | struct alc_spec *spec; | |
11928 | int board_config; | |
11929 | int err; | |
11930 | ||
11931 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
11932 | if (spec == NULL) | |
11933 | return -ENOMEM; | |
11934 | ||
11935 | codec->spec = spec; | |
11936 | #if 0 | |
11937 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is | |
11938 | * under-run | |
11939 | */ | |
11940 | { | |
11941 | int tmp; | |
11942 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
11943 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
11944 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
11945 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); | |
11946 | } | |
11947 | #endif | |
11948 | ||
11949 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | |
11950 | ||
11951 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, | |
11952 | alc262_models, | |
11953 | alc262_cfg_tbl); | |
11954 | ||
11955 | if (board_config < 0) { | |
11956 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
11957 | codec->chip_name); | |
11958 | board_config = ALC262_AUTO; | |
11959 | } | |
11960 | ||
11961 | if (board_config == ALC262_AUTO) { | |
11962 | /* automatic parse from the BIOS config */ | |
11963 | err = alc262_parse_auto_config(codec); | |
11964 | if (err < 0) { | |
11965 | alc_free(codec); | |
11966 | return err; | |
11967 | } else if (!err) { | |
11968 | printk(KERN_INFO | |
11969 | "hda_codec: Cannot set up configuration " | |
11970 | "from BIOS. Using base mode...\n"); | |
11971 | board_config = ALC262_BASIC; | |
11972 | } | |
11973 | } | |
11974 | ||
11975 | if (!spec->no_analog) { | |
11976 | err = snd_hda_attach_beep_device(codec, 0x1); | |
11977 | if (err < 0) { | |
11978 | alc_free(codec); | |
11979 | return err; | |
11980 | } | |
11981 | } | |
11982 | ||
11983 | if (board_config != ALC262_AUTO) | |
11984 | setup_preset(codec, &alc262_presets[board_config]); | |
11985 | ||
11986 | spec->stream_analog_playback = &alc262_pcm_analog_playback; | |
11987 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | |
11988 | ||
11989 | spec->stream_digital_playback = &alc262_pcm_digital_playback; | |
11990 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | |
11991 | ||
11992 | if (!spec->adc_nids && spec->input_mux) { | |
11993 | int i; | |
11994 | /* check whether the digital-mic has to be supported */ | |
11995 | for (i = 0; i < spec->input_mux->num_items; i++) { | |
11996 | if (spec->input_mux->items[i].index >= 9) | |
11997 | break; | |
11998 | } | |
11999 | if (i < spec->input_mux->num_items) { | |
12000 | /* use only ADC0 */ | |
12001 | spec->adc_nids = alc262_dmic_adc_nids; | |
12002 | spec->num_adc_nids = 1; | |
12003 | spec->capsrc_nids = alc262_dmic_capsrc_nids; | |
12004 | } else { | |
12005 | /* all analog inputs */ | |
12006 | /* check whether NID 0x07 is valid */ | |
12007 | unsigned int wcap = get_wcaps(codec, 0x07); | |
12008 | ||
12009 | /* get type */ | |
12010 | wcap = get_wcaps_type(wcap); | |
12011 | if (wcap != AC_WID_AUD_IN) { | |
12012 | spec->adc_nids = alc262_adc_nids_alt; | |
12013 | spec->num_adc_nids = | |
12014 | ARRAY_SIZE(alc262_adc_nids_alt); | |
12015 | spec->capsrc_nids = alc262_capsrc_nids_alt; | |
12016 | } else { | |
12017 | spec->adc_nids = alc262_adc_nids; | |
12018 | spec->num_adc_nids = | |
12019 | ARRAY_SIZE(alc262_adc_nids); | |
12020 | spec->capsrc_nids = alc262_capsrc_nids; | |
12021 | } | |
12022 | } | |
12023 | } | |
12024 | if (!spec->cap_mixer && !spec->no_analog) | |
12025 | set_capture_mixer(codec); | |
12026 | if (!spec->no_analog) | |
12027 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
12028 | ||
12029 | spec->vmaster_nid = 0x0c; | |
12030 | ||
12031 | codec->patch_ops = alc_patch_ops; | |
12032 | if (board_config == ALC262_AUTO) | |
12033 | spec->init_hook = alc262_auto_init; | |
12034 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
12035 | if (!spec->loopback.amplist) | |
12036 | spec->loopback.amplist = alc262_loopbacks; | |
12037 | #endif | |
12038 | codec->proc_widget_hook = print_realtek_coef; | |
12039 | ||
12040 | return 0; | |
12041 | } | |
12042 | ||
12043 | /* | |
12044 | * ALC268 channel source setting (2 channel) | |
12045 | */ | |
12046 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | |
12047 | #define alc268_modes alc260_modes | |
12048 | ||
12049 | static hda_nid_t alc268_dac_nids[2] = { | |
12050 | /* front, hp */ | |
12051 | 0x02, 0x03 | |
12052 | }; | |
12053 | ||
12054 | static hda_nid_t alc268_adc_nids[2] = { | |
12055 | /* ADC0-1 */ | |
12056 | 0x08, 0x07 | |
12057 | }; | |
12058 | ||
12059 | static hda_nid_t alc268_adc_nids_alt[1] = { | |
12060 | /* ADC0 */ | |
12061 | 0x08 | |
12062 | }; | |
12063 | ||
12064 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; | |
12065 | ||
12066 | static struct snd_kcontrol_new alc268_base_mixer[] = { | |
12067 | /* output mixer control */ | |
12068 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
12069 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
12070 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
12071 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
12072 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12073 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12074 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
12075 | { } | |
12076 | }; | |
12077 | ||
12078 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { | |
12079 | /* output mixer control */ | |
12080 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
12081 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
12082 | ALC262_HIPPO_MASTER_SWITCH, | |
12083 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12084 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12085 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
12086 | { } | |
12087 | }; | |
12088 | ||
12089 | /* bind Beep switches of both NID 0x0f and 0x10 */ | |
12090 | static struct hda_bind_ctls alc268_bind_beep_sw = { | |
12091 | .ops = &snd_hda_bind_sw, | |
12092 | .values = { | |
12093 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | |
12094 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | |
12095 | 0 | |
12096 | }, | |
12097 | }; | |
12098 | ||
12099 | static struct snd_kcontrol_new alc268_beep_mixer[] = { | |
12100 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | |
12101 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | |
12102 | { } | |
12103 | }; | |
12104 | ||
12105 | static struct hda_verb alc268_eapd_verbs[] = { | |
12106 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12107 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12108 | { } | |
12109 | }; | |
12110 | ||
12111 | /* Toshiba specific */ | |
12112 | static struct hda_verb alc268_toshiba_verbs[] = { | |
12113 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12114 | { } /* end */ | |
12115 | }; | |
12116 | ||
12117 | /* Acer specific */ | |
12118 | /* bind volumes of both NID 0x02 and 0x03 */ | |
12119 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { | |
12120 | .ops = &snd_hda_bind_vol, | |
12121 | .values = { | |
12122 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
12123 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
12124 | 0 | |
12125 | }, | |
12126 | }; | |
12127 | ||
12128 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
12129 | static void alc268_acer_automute(struct hda_codec *codec, int force) | |
12130 | { | |
12131 | struct alc_spec *spec = codec->spec; | |
12132 | unsigned int mute; | |
12133 | ||
12134 | if (force || !spec->sense_updated) { | |
12135 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); | |
12136 | spec->sense_updated = 1; | |
12137 | } | |
12138 | if (spec->jack_present) | |
12139 | mute = HDA_AMP_MUTE; /* mute internal speaker */ | |
12140 | else /* unmute internal speaker if necessary */ | |
12141 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
12142 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
12143 | HDA_AMP_MUTE, mute); | |
12144 | } | |
12145 | ||
12146 | ||
12147 | /* bind hp and internal speaker mute (with plug check) */ | |
12148 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, | |
12149 | struct snd_ctl_elem_value *ucontrol) | |
12150 | { | |
12151 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
12152 | long *valp = ucontrol->value.integer.value; | |
12153 | int change; | |
12154 | ||
12155 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); | |
12156 | if (change) | |
12157 | alc268_acer_automute(codec, 0); | |
12158 | return change; | |
12159 | } | |
12160 | ||
12161 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { | |
12162 | /* output mixer control */ | |
12163 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
12164 | { | |
12165 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12166 | .name = "Master Playback Switch", | |
12167 | .info = snd_hda_mixer_amp_switch_info, | |
12168 | .get = snd_hda_mixer_amp_switch_get, | |
12169 | .put = alc268_acer_master_sw_put, | |
12170 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
12171 | }, | |
12172 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), | |
12173 | { } | |
12174 | }; | |
12175 | ||
12176 | static struct snd_kcontrol_new alc268_acer_mixer[] = { | |
12177 | /* output mixer control */ | |
12178 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
12179 | { | |
12180 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12181 | .name = "Master Playback Switch", | |
12182 | .info = snd_hda_mixer_amp_switch_info, | |
12183 | .get = snd_hda_mixer_amp_switch_get, | |
12184 | .put = alc268_acer_master_sw_put, | |
12185 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
12186 | }, | |
12187 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12188 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
12189 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
12190 | { } | |
12191 | }; | |
12192 | ||
12193 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { | |
12194 | /* output mixer control */ | |
12195 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
12196 | { | |
12197 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12198 | .name = "Master Playback Switch", | |
12199 | .info = snd_hda_mixer_amp_switch_info, | |
12200 | .get = snd_hda_mixer_amp_switch_get, | |
12201 | .put = alc268_acer_master_sw_put, | |
12202 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
12203 | }, | |
12204 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12205 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
12206 | { } | |
12207 | }; | |
12208 | ||
12209 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { | |
12210 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12212 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12213 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
12214 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
12215 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, | |
12216 | { } | |
12217 | }; | |
12218 | ||
12219 | static struct hda_verb alc268_acer_verbs[] = { | |
12220 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ | |
12221 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12222 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12223 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12224 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12225 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12226 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12227 | { } | |
12228 | }; | |
12229 | ||
12230 | /* unsolicited event for HP jack sensing */ | |
12231 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event | |
12232 | #define alc268_toshiba_setup alc262_hippo_setup | |
12233 | #define alc268_toshiba_automute alc262_hippo_automute | |
12234 | ||
12235 | static void alc268_acer_unsol_event(struct hda_codec *codec, | |
12236 | unsigned int res) | |
12237 | { | |
12238 | if ((res >> 26) != ALC880_HP_EVENT) | |
12239 | return; | |
12240 | alc268_acer_automute(codec, 1); | |
12241 | } | |
12242 | ||
12243 | static void alc268_acer_init_hook(struct hda_codec *codec) | |
12244 | { | |
12245 | alc268_acer_automute(codec, 1); | |
12246 | } | |
12247 | ||
12248 | /* toggle speaker-output according to the hp-jack state */ | |
12249 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | |
12250 | { | |
12251 | unsigned int present; | |
12252 | unsigned char bits; | |
12253 | ||
12254 | present = snd_hda_jack_detect(codec, 0x15); | |
12255 | bits = present ? AMP_IN_MUTE(0) : 0; | |
12256 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, | |
12257 | AMP_IN_MUTE(0), bits); | |
12258 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, | |
12259 | AMP_IN_MUTE(0), bits); | |
12260 | } | |
12261 | ||
12262 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, | |
12263 | unsigned int res) | |
12264 | { | |
12265 | switch (res >> 26) { | |
12266 | case ALC880_HP_EVENT: | |
12267 | alc268_aspire_one_speaker_automute(codec); | |
12268 | break; | |
12269 | case ALC880_MIC_EVENT: | |
12270 | alc_mic_automute(codec); | |
12271 | break; | |
12272 | } | |
12273 | } | |
12274 | ||
12275 | static void alc268_acer_lc_setup(struct hda_codec *codec) | |
12276 | { | |
12277 | struct alc_spec *spec = codec->spec; | |
12278 | spec->ext_mic.pin = 0x18; | |
12279 | spec->ext_mic.mux_idx = 0; | |
12280 | spec->int_mic.pin = 0x12; | |
12281 | spec->int_mic.mux_idx = 6; | |
12282 | spec->auto_mic = 1; | |
12283 | } | |
12284 | ||
12285 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | |
12286 | { | |
12287 | alc268_aspire_one_speaker_automute(codec); | |
12288 | alc_mic_automute(codec); | |
12289 | } | |
12290 | ||
12291 | static struct snd_kcontrol_new alc268_dell_mixer[] = { | |
12292 | /* output mixer control */ | |
12293 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
12294 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
12295 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
12296 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
12297 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12298 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
12299 | { } | |
12300 | }; | |
12301 | ||
12302 | static struct hda_verb alc268_dell_verbs[] = { | |
12303 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12304 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12305 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12306 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
12307 | { } | |
12308 | }; | |
12309 | ||
12310 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
12311 | static void alc268_dell_setup(struct hda_codec *codec) | |
12312 | { | |
12313 | struct alc_spec *spec = codec->spec; | |
12314 | ||
12315 | spec->autocfg.hp_pins[0] = 0x15; | |
12316 | spec->autocfg.speaker_pins[0] = 0x14; | |
12317 | spec->ext_mic.pin = 0x18; | |
12318 | spec->ext_mic.mux_idx = 0; | |
12319 | spec->int_mic.pin = 0x19; | |
12320 | spec->int_mic.mux_idx = 1; | |
12321 | spec->auto_mic = 1; | |
12322 | } | |
12323 | ||
12324 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { | |
12325 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
12326 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
12327 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
12328 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
12329 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
12330 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), | |
12331 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
12332 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
12333 | { } | |
12334 | }; | |
12335 | ||
12336 | static struct hda_verb alc267_quanta_il1_verbs[] = { | |
12337 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12338 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
12339 | { } | |
12340 | }; | |
12341 | ||
12342 | static void alc267_quanta_il1_setup(struct hda_codec *codec) | |
12343 | { | |
12344 | struct alc_spec *spec = codec->spec; | |
12345 | spec->autocfg.hp_pins[0] = 0x15; | |
12346 | spec->autocfg.speaker_pins[0] = 0x14; | |
12347 | spec->ext_mic.pin = 0x18; | |
12348 | spec->ext_mic.mux_idx = 0; | |
12349 | spec->int_mic.pin = 0x19; | |
12350 | spec->int_mic.mux_idx = 1; | |
12351 | spec->auto_mic = 1; | |
12352 | } | |
12353 | ||
12354 | /* | |
12355 | * generic initialization of ADC, input mixers and output mixers | |
12356 | */ | |
12357 | static struct hda_verb alc268_base_init_verbs[] = { | |
12358 | /* Unmute DAC0-1 and set vol = 0 */ | |
12359 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12360 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12361 | ||
12362 | /* | |
12363 | * Set up output mixers (0x0c - 0x0e) | |
12364 | */ | |
12365 | /* set vol=0 to output mixers */ | |
12366 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12367 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12368 | ||
12369 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12370 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12371 | ||
12372 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
12373 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
12374 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
12375 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12376 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12377 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12378 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12379 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12380 | ||
12381 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12382 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12383 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12384 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12385 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12386 | ||
12387 | /* set PCBEEP vol = 0, mute connections */ | |
12388 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12389 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12390 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12391 | ||
12392 | /* Unmute Selector 23h,24h and set the default input to mic-in */ | |
12393 | ||
12394 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12395 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12396 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12397 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12398 | ||
12399 | { } | |
12400 | }; | |
12401 | ||
12402 | /* | |
12403 | * generic initialization of ADC, input mixers and output mixers | |
12404 | */ | |
12405 | static struct hda_verb alc268_volume_init_verbs[] = { | |
12406 | /* set output DAC */ | |
12407 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12408 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12409 | ||
12410 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12411 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12412 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12413 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12414 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12415 | ||
12416 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12417 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12418 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12419 | ||
12420 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12421 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12422 | ||
12423 | /* set PCBEEP vol = 0, mute connections */ | |
12424 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12425 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12426 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12427 | ||
12428 | { } | |
12429 | }; | |
12430 | ||
12431 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { | |
12432 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
12433 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
12434 | { } /* end */ | |
12435 | }; | |
12436 | ||
12437 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { | |
12438 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
12439 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
12440 | _DEFINE_CAPSRC(1), | |
12441 | { } /* end */ | |
12442 | }; | |
12443 | ||
12444 | static struct snd_kcontrol_new alc268_capture_mixer[] = { | |
12445 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
12446 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
12447 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | |
12448 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | |
12449 | _DEFINE_CAPSRC(2), | |
12450 | { } /* end */ | |
12451 | }; | |
12452 | ||
12453 | static struct hda_input_mux alc268_capture_source = { | |
12454 | .num_items = 4, | |
12455 | .items = { | |
12456 | { "Mic", 0x0 }, | |
12457 | { "Front Mic", 0x1 }, | |
12458 | { "Line", 0x2 }, | |
12459 | { "CD", 0x3 }, | |
12460 | }, | |
12461 | }; | |
12462 | ||
12463 | static struct hda_input_mux alc268_acer_capture_source = { | |
12464 | .num_items = 3, | |
12465 | .items = { | |
12466 | { "Mic", 0x0 }, | |
12467 | { "Internal Mic", 0x1 }, | |
12468 | { "Line", 0x2 }, | |
12469 | }, | |
12470 | }; | |
12471 | ||
12472 | static struct hda_input_mux alc268_acer_dmic_capture_source = { | |
12473 | .num_items = 3, | |
12474 | .items = { | |
12475 | { "Mic", 0x0 }, | |
12476 | { "Internal Mic", 0x6 }, | |
12477 | { "Line", 0x2 }, | |
12478 | }, | |
12479 | }; | |
12480 | ||
12481 | #ifdef CONFIG_SND_DEBUG | |
12482 | static struct snd_kcontrol_new alc268_test_mixer[] = { | |
12483 | /* Volume widgets */ | |
12484 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
12485 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
12486 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
12487 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), | |
12488 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), | |
12489 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), | |
12490 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), | |
12491 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), | |
12492 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), | |
12493 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), | |
12494 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), | |
12495 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), | |
12496 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), | |
12497 | /* The below appears problematic on some hardwares */ | |
12498 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ | |
12499 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
12500 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), | |
12501 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), | |
12502 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), | |
12503 | ||
12504 | /* Modes for retasking pin widgets */ | |
12505 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
12506 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
12507 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), | |
12508 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), | |
12509 | ||
12510 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
12511 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
12512 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
12513 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
12514 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
12515 | ||
12516 | /* Switches to allow the digital SPDIF output pin to be enabled. | |
12517 | * The ALC268 does not have an SPDIF input. | |
12518 | */ | |
12519 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), | |
12520 | ||
12521 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | |
12522 | * this output to turn on an external amplifier. | |
12523 | */ | |
12524 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
12525 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
12526 | ||
12527 | { } /* end */ | |
12528 | }; | |
12529 | #endif | |
12530 | ||
12531 | /* create input playback/capture controls for the given pin */ | |
12532 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
12533 | const char *ctlname, int idx) | |
12534 | { | |
12535 | hda_nid_t dac; | |
12536 | int err; | |
12537 | ||
12538 | switch (nid) { | |
12539 | case 0x14: | |
12540 | case 0x16: | |
12541 | dac = 0x02; | |
12542 | break; | |
12543 | case 0x15: | |
12544 | case 0x21: | |
12545 | dac = 0x03; | |
12546 | break; | |
12547 | default: | |
12548 | return 0; | |
12549 | } | |
12550 | if (spec->multiout.dac_nids[0] != dac && | |
12551 | spec->multiout.dac_nids[1] != dac) { | |
12552 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, | |
12553 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, | |
12554 | HDA_OUTPUT)); | |
12555 | if (err < 0) | |
12556 | return err; | |
12557 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
12558 | } | |
12559 | ||
12560 | if (nid != 0x16) | |
12561 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
12562 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | |
12563 | else /* mono */ | |
12564 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
12565 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); | |
12566 | if (err < 0) | |
12567 | return err; | |
12568 | return 0; | |
12569 | } | |
12570 | ||
12571 | /* add playback controls from the parsed DAC table */ | |
12572 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |
12573 | const struct auto_pin_cfg *cfg) | |
12574 | { | |
12575 | hda_nid_t nid; | |
12576 | int err; | |
12577 | ||
12578 | spec->multiout.dac_nids = spec->private_dac_nids; | |
12579 | ||
12580 | nid = cfg->line_out_pins[0]; | |
12581 | if (nid) { | |
12582 | const char *name; | |
12583 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
12584 | name = "Speaker"; | |
12585 | else | |
12586 | name = "Front"; | |
12587 | err = alc268_new_analog_output(spec, nid, name, 0); | |
12588 | if (err < 0) | |
12589 | return err; | |
12590 | } | |
12591 | ||
12592 | nid = cfg->speaker_pins[0]; | |
12593 | if (nid == 0x1d) { | |
12594 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", | |
12595 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
12596 | if (err < 0) | |
12597 | return err; | |
12598 | } else { | |
12599 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); | |
12600 | if (err < 0) | |
12601 | return err; | |
12602 | } | |
12603 | nid = cfg->hp_pins[0]; | |
12604 | if (nid) { | |
12605 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); | |
12606 | if (err < 0) | |
12607 | return err; | |
12608 | } | |
12609 | ||
12610 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | |
12611 | if (nid == 0x16) { | |
12612 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", | |
12613 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); | |
12614 | if (err < 0) | |
12615 | return err; | |
12616 | } | |
12617 | return 0; | |
12618 | } | |
12619 | ||
12620 | /* create playback/capture controls for input pins */ | |
12621 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, | |
12622 | const struct auto_pin_cfg *cfg) | |
12623 | { | |
12624 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); | |
12625 | } | |
12626 | ||
12627 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, | |
12628 | hda_nid_t nid, int pin_type) | |
12629 | { | |
12630 | int idx; | |
12631 | ||
12632 | alc_set_pin_output(codec, nid, pin_type); | |
12633 | if (nid == 0x14 || nid == 0x16) | |
12634 | idx = 0; | |
12635 | else | |
12636 | idx = 1; | |
12637 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | |
12638 | } | |
12639 | ||
12640 | static void alc268_auto_init_multi_out(struct hda_codec *codec) | |
12641 | { | |
12642 | struct alc_spec *spec = codec->spec; | |
12643 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; | |
12644 | if (nid) { | |
12645 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
12646 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); | |
12647 | } | |
12648 | } | |
12649 | ||
12650 | static void alc268_auto_init_hp_out(struct hda_codec *codec) | |
12651 | { | |
12652 | struct alc_spec *spec = codec->spec; | |
12653 | hda_nid_t pin; | |
12654 | ||
12655 | pin = spec->autocfg.hp_pins[0]; | |
12656 | if (pin) | |
12657 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); | |
12658 | pin = spec->autocfg.speaker_pins[0]; | |
12659 | if (pin) | |
12660 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); | |
12661 | } | |
12662 | ||
12663 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | |
12664 | { | |
12665 | struct alc_spec *spec = codec->spec; | |
12666 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
12667 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
12668 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
12669 | unsigned int dac_vol1, dac_vol2; | |
12670 | ||
12671 | if (line_nid == 0x1d || speaker_nid == 0x1d) { | |
12672 | snd_hda_codec_write(codec, speaker_nid, 0, | |
12673 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
12674 | /* mute mixer inputs from 0x1d */ | |
12675 | snd_hda_codec_write(codec, 0x0f, 0, | |
12676 | AC_VERB_SET_AMP_GAIN_MUTE, | |
12677 | AMP_IN_UNMUTE(1)); | |
12678 | snd_hda_codec_write(codec, 0x10, 0, | |
12679 | AC_VERB_SET_AMP_GAIN_MUTE, | |
12680 | AMP_IN_UNMUTE(1)); | |
12681 | } else { | |
12682 | /* unmute mixer inputs from 0x1d */ | |
12683 | snd_hda_codec_write(codec, 0x0f, 0, | |
12684 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
12685 | snd_hda_codec_write(codec, 0x10, 0, | |
12686 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
12687 | } | |
12688 | ||
12689 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ | |
12690 | if (line_nid == 0x14) | |
12691 | dac_vol2 = AMP_OUT_ZERO; | |
12692 | else if (line_nid == 0x15) | |
12693 | dac_vol1 = AMP_OUT_ZERO; | |
12694 | if (hp_nid == 0x14) | |
12695 | dac_vol2 = AMP_OUT_ZERO; | |
12696 | else if (hp_nid == 0x15) | |
12697 | dac_vol1 = AMP_OUT_ZERO; | |
12698 | if (line_nid != 0x16 || hp_nid != 0x16 || | |
12699 | spec->autocfg.line_out_pins[1] != 0x16 || | |
12700 | spec->autocfg.line_out_pins[2] != 0x16) | |
12701 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; | |
12702 | ||
12703 | snd_hda_codec_write(codec, 0x02, 0, | |
12704 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); | |
12705 | snd_hda_codec_write(codec, 0x03, 0, | |
12706 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); | |
12707 | } | |
12708 | ||
12709 | /* pcm configuration: identical with ALC880 */ | |
12710 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback | |
12711 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture | |
12712 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture | |
12713 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback | |
12714 | ||
12715 | /* | |
12716 | * BIOS auto configuration | |
12717 | */ | |
12718 | static int alc268_parse_auto_config(struct hda_codec *codec) | |
12719 | { | |
12720 | struct alc_spec *spec = codec->spec; | |
12721 | int err; | |
12722 | static hda_nid_t alc268_ignore[] = { 0 }; | |
12723 | ||
12724 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
12725 | alc268_ignore); | |
12726 | if (err < 0) | |
12727 | return err; | |
12728 | if (!spec->autocfg.line_outs) { | |
12729 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
12730 | spec->multiout.max_channels = 2; | |
12731 | spec->no_analog = 1; | |
12732 | goto dig_only; | |
12733 | } | |
12734 | return 0; /* can't find valid BIOS pin config */ | |
12735 | } | |
12736 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
12737 | if (err < 0) | |
12738 | return err; | |
12739 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); | |
12740 | if (err < 0) | |
12741 | return err; | |
12742 | ||
12743 | spec->multiout.max_channels = 2; | |
12744 | ||
12745 | dig_only: | |
12746 | /* digital only support output */ | |
12747 | if (spec->autocfg.dig_outs) { | |
12748 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; | |
12749 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | |
12750 | } | |
12751 | if (spec->kctls.list) | |
12752 | add_mixer(spec, spec->kctls.list); | |
12753 | ||
12754 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) | |
12755 | add_mixer(spec, alc268_beep_mixer); | |
12756 | ||
12757 | add_verb(spec, alc268_volume_init_verbs); | |
12758 | spec->num_mux_defs = 2; | |
12759 | spec->input_mux = &spec->private_imux[0]; | |
12760 | ||
12761 | err = alc_auto_add_mic_boost(codec); | |
12762 | if (err < 0) | |
12763 | return err; | |
12764 | ||
12765 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); | |
12766 | ||
12767 | return 1; | |
12768 | } | |
12769 | ||
12770 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input | |
12771 | ||
12772 | /* init callback for auto-configuration model -- overriding the default init */ | |
12773 | static void alc268_auto_init(struct hda_codec *codec) | |
12774 | { | |
12775 | struct alc_spec *spec = codec->spec; | |
12776 | alc268_auto_init_multi_out(codec); | |
12777 | alc268_auto_init_hp_out(codec); | |
12778 | alc268_auto_init_mono_speaker_out(codec); | |
12779 | alc268_auto_init_analog_input(codec); | |
12780 | if (spec->unsol_event) | |
12781 | alc_inithook(codec); | |
12782 | } | |
12783 | ||
12784 | /* | |
12785 | * configuration and preset | |
12786 | */ | |
12787 | static const char *alc268_models[ALC268_MODEL_LAST] = { | |
12788 | [ALC267_QUANTA_IL1] = "quanta-il1", | |
12789 | [ALC268_3ST] = "3stack", | |
12790 | [ALC268_TOSHIBA] = "toshiba", | |
12791 | [ALC268_ACER] = "acer", | |
12792 | [ALC268_ACER_DMIC] = "acer-dmic", | |
12793 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", | |
12794 | [ALC268_DELL] = "dell", | |
12795 | [ALC268_ZEPTO] = "zepto", | |
12796 | #ifdef CONFIG_SND_DEBUG | |
12797 | [ALC268_TEST] = "test", | |
12798 | #endif | |
12799 | [ALC268_AUTO] = "auto", | |
12800 | }; | |
12801 | ||
12802 | static struct snd_pci_quirk alc268_cfg_tbl[] = { | |
12803 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), | |
12804 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), | |
12805 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), | |
12806 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), | |
12807 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), | |
12808 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", | |
12809 | ALC268_ACER_ASPIRE_ONE), | |
12810 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), | |
12811 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, | |
12812 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), | |
12813 | /* almost compatible with toshiba but with optional digital outs; | |
12814 | * auto-probing seems working fine | |
12815 | */ | |
12816 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", | |
12817 | ALC268_AUTO), | |
12818 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), | |
12819 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), | |
12820 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), | |
12821 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), | |
12822 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), | |
12823 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), | |
12824 | {} | |
12825 | }; | |
12826 | ||
12827 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ | |
12828 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { | |
12829 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), | |
12830 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), | |
12831 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", | |
12832 | ALC268_TOSHIBA), | |
12833 | {} | |
12834 | }; | |
12835 | ||
12836 | static struct alc_config_preset alc268_presets[] = { | |
12837 | [ALC267_QUANTA_IL1] = { | |
12838 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, | |
12839 | alc268_capture_nosrc_mixer }, | |
12840 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
12841 | alc267_quanta_il1_verbs }, | |
12842 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
12843 | .dac_nids = alc268_dac_nids, | |
12844 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
12845 | .adc_nids = alc268_adc_nids_alt, | |
12846 | .hp_nid = 0x03, | |
12847 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
12848 | .channel_mode = alc268_modes, | |
12849 | .unsol_event = alc_sku_unsol_event, | |
12850 | .setup = alc267_quanta_il1_setup, | |
12851 | .init_hook = alc_inithook, | |
12852 | }, | |
12853 | [ALC268_3ST] = { | |
12854 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | |
12855 | alc268_beep_mixer }, | |
12856 | .init_verbs = { alc268_base_init_verbs }, | |
12857 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
12858 | .dac_nids = alc268_dac_nids, | |
12859 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
12860 | .adc_nids = alc268_adc_nids_alt, | |
12861 | .capsrc_nids = alc268_capsrc_nids, | |
12862 | .hp_nid = 0x03, | |
12863 | .dig_out_nid = ALC268_DIGOUT_NID, | |
12864 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
12865 | .channel_mode = alc268_modes, | |
12866 | .input_mux = &alc268_capture_source, | |
12867 | }, | |
12868 | [ALC268_TOSHIBA] = { | |
12869 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, | |
12870 | alc268_beep_mixer }, | |
12871 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
12872 | alc268_toshiba_verbs }, | |
12873 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
12874 | .dac_nids = alc268_dac_nids, | |
12875 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
12876 | .adc_nids = alc268_adc_nids_alt, | |
12877 | .capsrc_nids = alc268_capsrc_nids, | |
12878 | .hp_nid = 0x03, | |
12879 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
12880 | .channel_mode = alc268_modes, | |
12881 | .input_mux = &alc268_capture_source, | |
12882 | .unsol_event = alc268_toshiba_unsol_event, | |
12883 | .setup = alc268_toshiba_setup, | |
12884 | .init_hook = alc268_toshiba_automute, | |
12885 | }, | |
12886 | [ALC268_ACER] = { | |
12887 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, | |
12888 | alc268_beep_mixer }, | |
12889 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
12890 | alc268_acer_verbs }, | |
12891 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
12892 | .dac_nids = alc268_dac_nids, | |
12893 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
12894 | .adc_nids = alc268_adc_nids_alt, | |
12895 | .capsrc_nids = alc268_capsrc_nids, | |
12896 | .hp_nid = 0x02, | |
12897 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
12898 | .channel_mode = alc268_modes, | |
12899 | .input_mux = &alc268_acer_capture_source, | |
12900 | .unsol_event = alc268_acer_unsol_event, | |
12901 | .init_hook = alc268_acer_init_hook, | |
12902 | }, | |
12903 | [ALC268_ACER_DMIC] = { | |
12904 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, | |
12905 | alc268_beep_mixer }, | |
12906 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
12907 | alc268_acer_verbs }, | |
12908 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
12909 | .dac_nids = alc268_dac_nids, | |
12910 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
12911 | .adc_nids = alc268_adc_nids_alt, | |
12912 | .capsrc_nids = alc268_capsrc_nids, | |
12913 | .hp_nid = 0x02, | |
12914 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
12915 | .channel_mode = alc268_modes, | |
12916 | .input_mux = &alc268_acer_dmic_capture_source, | |
12917 | .unsol_event = alc268_acer_unsol_event, | |
12918 | .init_hook = alc268_acer_init_hook, | |
12919 | }, | |
12920 | [ALC268_ACER_ASPIRE_ONE] = { | |
12921 | .mixers = { alc268_acer_aspire_one_mixer, | |
12922 | alc268_beep_mixer, | |
12923 | alc268_capture_nosrc_mixer }, | |
12924 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
12925 | alc268_acer_aspire_one_verbs }, | |
12926 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
12927 | .dac_nids = alc268_dac_nids, | |
12928 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
12929 | .adc_nids = alc268_adc_nids_alt, | |
12930 | .capsrc_nids = alc268_capsrc_nids, | |
12931 | .hp_nid = 0x03, | |
12932 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
12933 | .channel_mode = alc268_modes, | |
12934 | .unsol_event = alc268_acer_lc_unsol_event, | |
12935 | .setup = alc268_acer_lc_setup, | |
12936 | .init_hook = alc268_acer_lc_init_hook, | |
12937 | }, | |
12938 | [ALC268_DELL] = { | |
12939 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, | |
12940 | alc268_capture_nosrc_mixer }, | |
12941 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
12942 | alc268_dell_verbs }, | |
12943 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
12944 | .dac_nids = alc268_dac_nids, | |
12945 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
12946 | .adc_nids = alc268_adc_nids_alt, | |
12947 | .capsrc_nids = alc268_capsrc_nids, | |
12948 | .hp_nid = 0x02, | |
12949 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
12950 | .channel_mode = alc268_modes, | |
12951 | .unsol_event = alc_sku_unsol_event, | |
12952 | .setup = alc268_dell_setup, | |
12953 | .init_hook = alc_inithook, | |
12954 | }, | |
12955 | [ALC268_ZEPTO] = { | |
12956 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | |
12957 | alc268_beep_mixer }, | |
12958 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
12959 | alc268_toshiba_verbs }, | |
12960 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
12961 | .dac_nids = alc268_dac_nids, | |
12962 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
12963 | .adc_nids = alc268_adc_nids_alt, | |
12964 | .capsrc_nids = alc268_capsrc_nids, | |
12965 | .hp_nid = 0x03, | |
12966 | .dig_out_nid = ALC268_DIGOUT_NID, | |
12967 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
12968 | .channel_mode = alc268_modes, | |
12969 | .input_mux = &alc268_capture_source, | |
12970 | .setup = alc268_toshiba_setup, | |
12971 | .init_hook = alc268_toshiba_automute, | |
12972 | }, | |
12973 | #ifdef CONFIG_SND_DEBUG | |
12974 | [ALC268_TEST] = { | |
12975 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, | |
12976 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
12977 | alc268_volume_init_verbs }, | |
12978 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
12979 | .dac_nids = alc268_dac_nids, | |
12980 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
12981 | .adc_nids = alc268_adc_nids_alt, | |
12982 | .capsrc_nids = alc268_capsrc_nids, | |
12983 | .hp_nid = 0x03, | |
12984 | .dig_out_nid = ALC268_DIGOUT_NID, | |
12985 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
12986 | .channel_mode = alc268_modes, | |
12987 | .input_mux = &alc268_capture_source, | |
12988 | }, | |
12989 | #endif | |
12990 | }; | |
12991 | ||
12992 | static int patch_alc268(struct hda_codec *codec) | |
12993 | { | |
12994 | struct alc_spec *spec; | |
12995 | int board_config; | |
12996 | int i, has_beep, err; | |
12997 | ||
12998 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
12999 | if (spec == NULL) | |
13000 | return -ENOMEM; | |
13001 | ||
13002 | codec->spec = spec; | |
13003 | ||
13004 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, | |
13005 | alc268_models, | |
13006 | alc268_cfg_tbl); | |
13007 | ||
13008 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) | |
13009 | board_config = snd_hda_check_board_codec_sid_config(codec, | |
13010 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); | |
13011 | ||
13012 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { | |
13013 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
13014 | codec->chip_name); | |
13015 | board_config = ALC268_AUTO; | |
13016 | } | |
13017 | ||
13018 | if (board_config == ALC268_AUTO) { | |
13019 | /* automatic parse from the BIOS config */ | |
13020 | err = alc268_parse_auto_config(codec); | |
13021 | if (err < 0) { | |
13022 | alc_free(codec); | |
13023 | return err; | |
13024 | } else if (!err) { | |
13025 | printk(KERN_INFO | |
13026 | "hda_codec: Cannot set up configuration " | |
13027 | "from BIOS. Using base mode...\n"); | |
13028 | board_config = ALC268_3ST; | |
13029 | } | |
13030 | } | |
13031 | ||
13032 | if (board_config != ALC268_AUTO) | |
13033 | setup_preset(codec, &alc268_presets[board_config]); | |
13034 | ||
13035 | spec->stream_analog_playback = &alc268_pcm_analog_playback; | |
13036 | spec->stream_analog_capture = &alc268_pcm_analog_capture; | |
13037 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; | |
13038 | ||
13039 | spec->stream_digital_playback = &alc268_pcm_digital_playback; | |
13040 | ||
13041 | has_beep = 0; | |
13042 | for (i = 0; i < spec->num_mixers; i++) { | |
13043 | if (spec->mixers[i] == alc268_beep_mixer) { | |
13044 | has_beep = 1; | |
13045 | break; | |
13046 | } | |
13047 | } | |
13048 | ||
13049 | if (has_beep) { | |
13050 | err = snd_hda_attach_beep_device(codec, 0x1); | |
13051 | if (err < 0) { | |
13052 | alc_free(codec); | |
13053 | return err; | |
13054 | } | |
13055 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) | |
13056 | /* override the amp caps for beep generator */ | |
13057 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | |
13058 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | | |
13059 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
13060 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
13061 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
13062 | } | |
13063 | ||
13064 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { | |
13065 | /* check whether NID 0x07 is valid */ | |
13066 | unsigned int wcap = get_wcaps(codec, 0x07); | |
13067 | int i; | |
13068 | ||
13069 | spec->capsrc_nids = alc268_capsrc_nids; | |
13070 | /* get type */ | |
13071 | wcap = get_wcaps_type(wcap); | |
13072 | if (spec->auto_mic || | |
13073 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
13074 | spec->adc_nids = alc268_adc_nids_alt; | |
13075 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | |
13076 | if (spec->auto_mic) | |
13077 | fixup_automic_adc(codec); | |
13078 | if (spec->auto_mic || spec->input_mux->num_items == 1) | |
13079 | add_mixer(spec, alc268_capture_nosrc_mixer); | |
13080 | else | |
13081 | add_mixer(spec, alc268_capture_alt_mixer); | |
13082 | } else { | |
13083 | spec->adc_nids = alc268_adc_nids; | |
13084 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | |
13085 | add_mixer(spec, alc268_capture_mixer); | |
13086 | } | |
13087 | /* set default input source */ | |
13088 | for (i = 0; i < spec->num_adc_nids; i++) | |
13089 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | |
13090 | 0, AC_VERB_SET_CONNECT_SEL, | |
13091 | i < spec->num_mux_defs ? | |
13092 | spec->input_mux[i].items[0].index : | |
13093 | spec->input_mux->items[0].index); | |
13094 | } | |
13095 | ||
13096 | spec->vmaster_nid = 0x02; | |
13097 | ||
13098 | codec->patch_ops = alc_patch_ops; | |
13099 | if (board_config == ALC268_AUTO) | |
13100 | spec->init_hook = alc268_auto_init; | |
13101 | ||
13102 | codec->proc_widget_hook = print_realtek_coef; | |
13103 | ||
13104 | return 0; | |
13105 | } | |
13106 | ||
13107 | /* | |
13108 | * ALC269 channel source setting (2 channel) | |
13109 | */ | |
13110 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID | |
13111 | ||
13112 | #define alc269_dac_nids alc260_dac_nids | |
13113 | ||
13114 | static hda_nid_t alc269_adc_nids[1] = { | |
13115 | /* ADC1 */ | |
13116 | 0x08, | |
13117 | }; | |
13118 | ||
13119 | static hda_nid_t alc269_capsrc_nids[1] = { | |
13120 | 0x23, | |
13121 | }; | |
13122 | ||
13123 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), | |
13124 | * not a mux! | |
13125 | */ | |
13126 | ||
13127 | #define alc269_modes alc260_modes | |
13128 | #define alc269_capture_source alc880_lg_lw_capture_source | |
13129 | ||
13130 | static struct snd_kcontrol_new alc269_base_mixer[] = { | |
13131 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13132 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13133 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13134 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13137 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13138 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
13139 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
13140 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
13141 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13142 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
13143 | { } /* end */ | |
13144 | }; | |
13145 | ||
13146 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { | |
13147 | /* output mixer control */ | |
13148 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13149 | { | |
13150 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13151 | .name = "Master Playback Switch", | |
13152 | .info = snd_hda_mixer_amp_switch_info, | |
13153 | .get = snd_hda_mixer_amp_switch_get, | |
13154 | .put = alc268_acer_master_sw_put, | |
13155 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13156 | }, | |
13157 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13158 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13159 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13160 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
13161 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
13162 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
13163 | { } | |
13164 | }; | |
13165 | ||
13166 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { | |
13167 | /* output mixer control */ | |
13168 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13169 | { | |
13170 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13171 | .name = "Master Playback Switch", | |
13172 | .info = snd_hda_mixer_amp_switch_info, | |
13173 | .get = snd_hda_mixer_amp_switch_get, | |
13174 | .put = alc268_acer_master_sw_put, | |
13175 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13176 | }, | |
13177 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13178 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13179 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13180 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
13181 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
13182 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
13183 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
13184 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
13185 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), | |
13186 | { } | |
13187 | }; | |
13188 | ||
13189 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { | |
13190 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13191 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13192 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13193 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13194 | { } /* end */ | |
13195 | }; | |
13196 | ||
13197 | /* capture mixer elements */ | |
13198 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { | |
13199 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
13200 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
13201 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13202 | { } /* end */ | |
13203 | }; | |
13204 | ||
13205 | /* FSC amilo */ | |
13206 | #define alc269_fujitsu_mixer alc269_eeepc_mixer | |
13207 | ||
13208 | static struct hda_verb alc269_quanta_fl1_verbs[] = { | |
13209 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13210 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13212 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13213 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13214 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13215 | { } | |
13216 | }; | |
13217 | ||
13218 | static struct hda_verb alc269_lifebook_verbs[] = { | |
13219 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13220 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13221 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13222 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13223 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13224 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13225 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13226 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13227 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13228 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13229 | { } | |
13230 | }; | |
13231 | ||
13232 | /* toggle speaker-output according to the hp-jack state */ | |
13233 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) | |
13234 | { | |
13235 | unsigned int present; | |
13236 | unsigned char bits; | |
13237 | ||
13238 | present = snd_hda_jack_detect(codec, 0x15); | |
13239 | bits = present ? AMP_IN_MUTE(0) : 0; | |
13240 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
13241 | AMP_IN_MUTE(0), bits); | |
13242 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
13243 | AMP_IN_MUTE(0), bits); | |
13244 | ||
13245 | snd_hda_codec_write(codec, 0x20, 0, | |
13246 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
13247 | snd_hda_codec_write(codec, 0x20, 0, | |
13248 | AC_VERB_SET_PROC_COEF, 0x680); | |
13249 | ||
13250 | snd_hda_codec_write(codec, 0x20, 0, | |
13251 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
13252 | snd_hda_codec_write(codec, 0x20, 0, | |
13253 | AC_VERB_SET_PROC_COEF, 0x480); | |
13254 | } | |
13255 | ||
13256 | /* toggle speaker-output according to the hp-jacks state */ | |
13257 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) | |
13258 | { | |
13259 | unsigned int present; | |
13260 | unsigned char bits; | |
13261 | ||
13262 | /* Check laptop headphone socket */ | |
13263 | present = snd_hda_jack_detect(codec, 0x15); | |
13264 | ||
13265 | /* Check port replicator headphone socket */ | |
13266 | present |= snd_hda_jack_detect(codec, 0x1a); | |
13267 | ||
13268 | bits = present ? AMP_IN_MUTE(0) : 0; | |
13269 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
13270 | AMP_IN_MUTE(0), bits); | |
13271 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
13272 | AMP_IN_MUTE(0), bits); | |
13273 | ||
13274 | snd_hda_codec_write(codec, 0x20, 0, | |
13275 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
13276 | snd_hda_codec_write(codec, 0x20, 0, | |
13277 | AC_VERB_SET_PROC_COEF, 0x680); | |
13278 | ||
13279 | snd_hda_codec_write(codec, 0x20, 0, | |
13280 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
13281 | snd_hda_codec_write(codec, 0x20, 0, | |
13282 | AC_VERB_SET_PROC_COEF, 0x480); | |
13283 | } | |
13284 | ||
13285 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) | |
13286 | { | |
13287 | unsigned int present_laptop; | |
13288 | unsigned int present_dock; | |
13289 | ||
13290 | present_laptop = snd_hda_jack_detect(codec, 0x18); | |
13291 | present_dock = snd_hda_jack_detect(codec, 0x1b); | |
13292 | ||
13293 | /* Laptop mic port overrides dock mic port, design decision */ | |
13294 | if (present_dock) | |
13295 | snd_hda_codec_write(codec, 0x23, 0, | |
13296 | AC_VERB_SET_CONNECT_SEL, 0x3); | |
13297 | if (present_laptop) | |
13298 | snd_hda_codec_write(codec, 0x23, 0, | |
13299 | AC_VERB_SET_CONNECT_SEL, 0x0); | |
13300 | if (!present_dock && !present_laptop) | |
13301 | snd_hda_codec_write(codec, 0x23, 0, | |
13302 | AC_VERB_SET_CONNECT_SEL, 0x1); | |
13303 | } | |
13304 | ||
13305 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, | |
13306 | unsigned int res) | |
13307 | { | |
13308 | switch (res >> 26) { | |
13309 | case ALC880_HP_EVENT: | |
13310 | alc269_quanta_fl1_speaker_automute(codec); | |
13311 | break; | |
13312 | case ALC880_MIC_EVENT: | |
13313 | alc_mic_automute(codec); | |
13314 | break; | |
13315 | } | |
13316 | } | |
13317 | ||
13318 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, | |
13319 | unsigned int res) | |
13320 | { | |
13321 | if ((res >> 26) == ALC880_HP_EVENT) | |
13322 | alc269_lifebook_speaker_automute(codec); | |
13323 | if ((res >> 26) == ALC880_MIC_EVENT) | |
13324 | alc269_lifebook_mic_autoswitch(codec); | |
13325 | } | |
13326 | ||
13327 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) | |
13328 | { | |
13329 | struct alc_spec *spec = codec->spec; | |
13330 | spec->ext_mic.pin = 0x18; | |
13331 | spec->ext_mic.mux_idx = 0; | |
13332 | spec->int_mic.pin = 0x19; | |
13333 | spec->int_mic.mux_idx = 1; | |
13334 | spec->auto_mic = 1; | |
13335 | } | |
13336 | ||
13337 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) | |
13338 | { | |
13339 | alc269_quanta_fl1_speaker_automute(codec); | |
13340 | alc_mic_automute(codec); | |
13341 | } | |
13342 | ||
13343 | static void alc269_lifebook_init_hook(struct hda_codec *codec) | |
13344 | { | |
13345 | alc269_lifebook_speaker_automute(codec); | |
13346 | alc269_lifebook_mic_autoswitch(codec); | |
13347 | } | |
13348 | ||
13349 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { | |
13350 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13351 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, | |
13352 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
13353 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
13354 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13355 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13356 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
13357 | {} | |
13358 | }; | |
13359 | ||
13360 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { | |
13361 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13362 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13363 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
13364 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, | |
13365 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13366 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
13367 | {} | |
13368 | }; | |
13369 | ||
13370 | /* toggle speaker-output according to the hp-jack state */ | |
13371 | static void alc269_speaker_automute(struct hda_codec *codec) | |
13372 | { | |
13373 | struct alc_spec *spec = codec->spec; | |
13374 | unsigned int nid = spec->autocfg.hp_pins[0]; | |
13375 | unsigned int present; | |
13376 | unsigned char bits; | |
13377 | ||
13378 | present = snd_hda_jack_detect(codec, nid); | |
13379 | bits = present ? AMP_IN_MUTE(0) : 0; | |
13380 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
13381 | AMP_IN_MUTE(0), bits); | |
13382 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
13383 | AMP_IN_MUTE(0), bits); | |
13384 | } | |
13385 | ||
13386 | /* unsolicited event for HP jack sensing */ | |
13387 | static void alc269_eeepc_unsol_event(struct hda_codec *codec, | |
13388 | unsigned int res) | |
13389 | { | |
13390 | switch (res >> 26) { | |
13391 | case ALC880_HP_EVENT: | |
13392 | alc269_speaker_automute(codec); | |
13393 | break; | |
13394 | case ALC880_MIC_EVENT: | |
13395 | alc_mic_automute(codec); | |
13396 | break; | |
13397 | } | |
13398 | } | |
13399 | ||
13400 | static void alc269_eeepc_dmic_setup(struct hda_codec *codec) | |
13401 | { | |
13402 | struct alc_spec *spec = codec->spec; | |
13403 | spec->ext_mic.pin = 0x18; | |
13404 | spec->ext_mic.mux_idx = 0; | |
13405 | spec->int_mic.pin = 0x12; | |
13406 | spec->int_mic.mux_idx = 5; | |
13407 | spec->auto_mic = 1; | |
13408 | } | |
13409 | ||
13410 | static void alc269_eeepc_amic_setup(struct hda_codec *codec) | |
13411 | { | |
13412 | struct alc_spec *spec = codec->spec; | |
13413 | spec->ext_mic.pin = 0x18; | |
13414 | spec->ext_mic.mux_idx = 0; | |
13415 | spec->int_mic.pin = 0x19; | |
13416 | spec->int_mic.mux_idx = 1; | |
13417 | spec->auto_mic = 1; | |
13418 | } | |
13419 | ||
13420 | static void alc269_eeepc_inithook(struct hda_codec *codec) | |
13421 | { | |
13422 | alc269_speaker_automute(codec); | |
13423 | alc_mic_automute(codec); | |
13424 | } | |
13425 | ||
13426 | /* | |
13427 | * generic initialization of ADC, input mixers and output mixers | |
13428 | */ | |
13429 | static struct hda_verb alc269_init_verbs[] = { | |
13430 | /* | |
13431 | * Unmute ADC0 and set the default input to mic-in | |
13432 | */ | |
13433 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13434 | ||
13435 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the | |
13436 | * analog-loopback mixer widget | |
13437 | * Note: PASD motherboards uses the Line In 2 as the input for | |
13438 | * front panel mic (mic 2) | |
13439 | */ | |
13440 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
13441 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13442 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13443 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
13444 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
13445 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
13446 | ||
13447 | /* | |
13448 | * Set up output mixers (0x0c - 0x0e) | |
13449 | */ | |
13450 | /* set vol=0 to output mixers */ | |
13451 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13452 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13453 | ||
13454 | /* set up input amps for analog loopback */ | |
13455 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
13456 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13457 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13458 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13459 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13460 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13461 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13462 | ||
13463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13464 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13465 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13466 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13467 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13468 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13469 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13470 | ||
13471 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13472 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13473 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13474 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13475 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13476 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13477 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13478 | ||
13479 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13480 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13481 | ||
13482 | /* FIXME: use matrix-type input source selection */ | |
13483 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | |
13484 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
13485 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13486 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13487 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
13488 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
13489 | ||
13490 | /* set EAPD */ | |
13491 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
13492 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
13493 | { } | |
13494 | }; | |
13495 | ||
13496 | #define alc269_auto_create_multi_out_ctls \ | |
13497 | alc268_auto_create_multi_out_ctls | |
13498 | #define alc269_auto_create_input_ctls \ | |
13499 | alc268_auto_create_input_ctls | |
13500 | ||
13501 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
13502 | #define alc269_loopbacks alc880_loopbacks | |
13503 | #endif | |
13504 | ||
13505 | /* pcm configuration: identical with ALC880 */ | |
13506 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback | |
13507 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture | |
13508 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback | |
13509 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture | |
13510 | ||
13511 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { | |
13512 | .substreams = 1, | |
13513 | .channels_min = 2, | |
13514 | .channels_max = 8, | |
13515 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
13516 | /* NID is set in alc_build_pcms */ | |
13517 | .ops = { | |
13518 | .open = alc880_playback_pcm_open, | |
13519 | .prepare = alc880_playback_pcm_prepare, | |
13520 | .cleanup = alc880_playback_pcm_cleanup | |
13521 | }, | |
13522 | }; | |
13523 | ||
13524 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { | |
13525 | .substreams = 1, | |
13526 | .channels_min = 2, | |
13527 | .channels_max = 2, | |
13528 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
13529 | /* NID is set in alc_build_pcms */ | |
13530 | }; | |
13531 | ||
13532 | /* | |
13533 | * BIOS auto configuration | |
13534 | */ | |
13535 | static int alc269_parse_auto_config(struct hda_codec *codec) | |
13536 | { | |
13537 | struct alc_spec *spec = codec->spec; | |
13538 | int err; | |
13539 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; | |
13540 | ||
13541 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
13542 | alc269_ignore); | |
13543 | if (err < 0) | |
13544 | return err; | |
13545 | ||
13546 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
13547 | if (err < 0) | |
13548 | return err; | |
13549 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); | |
13550 | if (err < 0) | |
13551 | return err; | |
13552 | ||
13553 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
13554 | ||
13555 | if (spec->autocfg.dig_outs) | |
13556 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; | |
13557 | ||
13558 | if (spec->kctls.list) | |
13559 | add_mixer(spec, spec->kctls.list); | |
13560 | ||
13561 | add_verb(spec, alc269_init_verbs); | |
13562 | spec->num_mux_defs = 1; | |
13563 | spec->input_mux = &spec->private_imux[0]; | |
13564 | /* set default input source */ | |
13565 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], | |
13566 | 0, AC_VERB_SET_CONNECT_SEL, | |
13567 | spec->input_mux->items[0].index); | |
13568 | ||
13569 | err = alc_auto_add_mic_boost(codec); | |
13570 | if (err < 0) | |
13571 | return err; | |
13572 | ||
13573 | if (!spec->cap_mixer && !spec->no_analog) | |
13574 | set_capture_mixer(codec); | |
13575 | ||
13576 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); | |
13577 | ||
13578 | return 1; | |
13579 | } | |
13580 | ||
13581 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out | |
13582 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out | |
13583 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input | |
13584 | ||
13585 | ||
13586 | /* init callback for auto-configuration model -- overriding the default init */ | |
13587 | static void alc269_auto_init(struct hda_codec *codec) | |
13588 | { | |
13589 | struct alc_spec *spec = codec->spec; | |
13590 | alc269_auto_init_multi_out(codec); | |
13591 | alc269_auto_init_hp_out(codec); | |
13592 | alc269_auto_init_analog_input(codec); | |
13593 | if (spec->unsol_event) | |
13594 | alc_inithook(codec); | |
13595 | } | |
13596 | ||
13597 | /* | |
13598 | * configuration and preset | |
13599 | */ | |
13600 | static const char *alc269_models[ALC269_MODEL_LAST] = { | |
13601 | [ALC269_BASIC] = "basic", | |
13602 | [ALC269_QUANTA_FL1] = "quanta", | |
13603 | [ALC269_ASUS_AMIC] = "asus-amic", | |
13604 | [ALC269_ASUS_DMIC] = "asus-dmic", | |
13605 | [ALC269_FUJITSU] = "fujitsu", | |
13606 | [ALC269_LIFEBOOK] = "lifebook", | |
13607 | [ALC269_AUTO] = "auto", | |
13608 | }; | |
13609 | ||
13610 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | |
13611 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), | |
13612 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", | |
13613 | ALC269_ASUS_AMIC), | |
13614 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC), | |
13615 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC), | |
13616 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC), | |
13617 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC), | |
13618 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC), | |
13619 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC), | |
13620 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC), | |
13621 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC), | |
13622 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC), | |
13623 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC), | |
13624 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC), | |
13625 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC), | |
13626 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC), | |
13627 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC), | |
13628 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC), | |
13629 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC), | |
13630 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC), | |
13631 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC), | |
13632 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC), | |
13633 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC), | |
13634 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC), | |
13635 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC), | |
13636 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC), | |
13637 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC), | |
13638 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC), | |
13639 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC), | |
13640 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC), | |
13641 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC), | |
13642 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", | |
13643 | ALC269_ASUS_DMIC), | |
13644 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", | |
13645 | ALC269_ASUS_DMIC), | |
13646 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC), | |
13647 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC), | |
13648 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), | |
13649 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), | |
13650 | {} | |
13651 | }; | |
13652 | ||
13653 | static struct alc_config_preset alc269_presets[] = { | |
13654 | [ALC269_BASIC] = { | |
13655 | .mixers = { alc269_base_mixer }, | |
13656 | .init_verbs = { alc269_init_verbs }, | |
13657 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
13658 | .dac_nids = alc269_dac_nids, | |
13659 | .hp_nid = 0x03, | |
13660 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
13661 | .channel_mode = alc269_modes, | |
13662 | .input_mux = &alc269_capture_source, | |
13663 | }, | |
13664 | [ALC269_QUANTA_FL1] = { | |
13665 | .mixers = { alc269_quanta_fl1_mixer }, | |
13666 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, | |
13667 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
13668 | .dac_nids = alc269_dac_nids, | |
13669 | .hp_nid = 0x03, | |
13670 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
13671 | .channel_mode = alc269_modes, | |
13672 | .input_mux = &alc269_capture_source, | |
13673 | .unsol_event = alc269_quanta_fl1_unsol_event, | |
13674 | .setup = alc269_quanta_fl1_setup, | |
13675 | .init_hook = alc269_quanta_fl1_init_hook, | |
13676 | }, | |
13677 | [ALC269_ASUS_AMIC] = { | |
13678 | .mixers = { alc269_eeepc_mixer }, | |
13679 | .cap_mixer = alc269_epc_capture_mixer, | |
13680 | .init_verbs = { alc269_init_verbs, | |
13681 | alc269_eeepc_amic_init_verbs }, | |
13682 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
13683 | .dac_nids = alc269_dac_nids, | |
13684 | .hp_nid = 0x03, | |
13685 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
13686 | .channel_mode = alc269_modes, | |
13687 | .unsol_event = alc269_eeepc_unsol_event, | |
13688 | .setup = alc269_eeepc_amic_setup, | |
13689 | .init_hook = alc269_eeepc_inithook, | |
13690 | }, | |
13691 | [ALC269_ASUS_DMIC] = { | |
13692 | .mixers = { alc269_eeepc_mixer }, | |
13693 | .cap_mixer = alc269_epc_capture_mixer, | |
13694 | .init_verbs = { alc269_init_verbs, | |
13695 | alc269_eeepc_dmic_init_verbs }, | |
13696 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
13697 | .dac_nids = alc269_dac_nids, | |
13698 | .hp_nid = 0x03, | |
13699 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
13700 | .channel_mode = alc269_modes, | |
13701 | .unsol_event = alc269_eeepc_unsol_event, | |
13702 | .setup = alc269_eeepc_dmic_setup, | |
13703 | .init_hook = alc269_eeepc_inithook, | |
13704 | }, | |
13705 | [ALC269_FUJITSU] = { | |
13706 | .mixers = { alc269_fujitsu_mixer }, | |
13707 | .cap_mixer = alc269_epc_capture_mixer, | |
13708 | .init_verbs = { alc269_init_verbs, | |
13709 | alc269_eeepc_dmic_init_verbs }, | |
13710 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
13711 | .dac_nids = alc269_dac_nids, | |
13712 | .hp_nid = 0x03, | |
13713 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
13714 | .channel_mode = alc269_modes, | |
13715 | .unsol_event = alc269_eeepc_unsol_event, | |
13716 | .setup = alc269_eeepc_dmic_setup, | |
13717 | .init_hook = alc269_eeepc_inithook, | |
13718 | }, | |
13719 | [ALC269_LIFEBOOK] = { | |
13720 | .mixers = { alc269_lifebook_mixer }, | |
13721 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, | |
13722 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
13723 | .dac_nids = alc269_dac_nids, | |
13724 | .hp_nid = 0x03, | |
13725 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
13726 | .channel_mode = alc269_modes, | |
13727 | .input_mux = &alc269_capture_source, | |
13728 | .unsol_event = alc269_lifebook_unsol_event, | |
13729 | .init_hook = alc269_lifebook_init_hook, | |
13730 | }, | |
13731 | }; | |
13732 | ||
13733 | static int patch_alc269(struct hda_codec *codec) | |
13734 | { | |
13735 | struct alc_spec *spec; | |
13736 | int board_config; | |
13737 | int err; | |
13738 | ||
13739 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
13740 | if (spec == NULL) | |
13741 | return -ENOMEM; | |
13742 | ||
13743 | codec->spec = spec; | |
13744 | ||
13745 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | |
13746 | ||
13747 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ | |
13748 | kfree(codec->chip_name); | |
13749 | codec->chip_name = kstrdup("ALC259", GFP_KERNEL); | |
13750 | if (!codec->chip_name) { | |
13751 | alc_free(codec); | |
13752 | return -ENOMEM; | |
13753 | } | |
13754 | } | |
13755 | ||
13756 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, | |
13757 | alc269_models, | |
13758 | alc269_cfg_tbl); | |
13759 | ||
13760 | if (board_config < 0) { | |
13761 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
13762 | codec->chip_name); | |
13763 | board_config = ALC269_AUTO; | |
13764 | } | |
13765 | ||
13766 | if (board_config == ALC269_AUTO) { | |
13767 | /* automatic parse from the BIOS config */ | |
13768 | err = alc269_parse_auto_config(codec); | |
13769 | if (err < 0) { | |
13770 | alc_free(codec); | |
13771 | return err; | |
13772 | } else if (!err) { | |
13773 | printk(KERN_INFO | |
13774 | "hda_codec: Cannot set up configuration " | |
13775 | "from BIOS. Using base mode...\n"); | |
13776 | board_config = ALC269_BASIC; | |
13777 | } | |
13778 | } | |
13779 | ||
13780 | err = snd_hda_attach_beep_device(codec, 0x1); | |
13781 | if (err < 0) { | |
13782 | alc_free(codec); | |
13783 | return err; | |
13784 | } | |
13785 | ||
13786 | if (board_config != ALC269_AUTO) | |
13787 | setup_preset(codec, &alc269_presets[board_config]); | |
13788 | ||
13789 | if (codec->subsystem_id == 0x17aa3bf8) { | |
13790 | /* Due to a hardware problem on Lenovo Ideadpad, we need to | |
13791 | * fix the sample rate of analog I/O to 44.1kHz | |
13792 | */ | |
13793 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; | |
13794 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; | |
13795 | } else { | |
13796 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
13797 | spec->stream_analog_capture = &alc269_pcm_analog_capture; | |
13798 | } | |
13799 | spec->stream_digital_playback = &alc269_pcm_digital_playback; | |
13800 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | |
13801 | ||
13802 | spec->adc_nids = alc269_adc_nids; | |
13803 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | |
13804 | spec->capsrc_nids = alc269_capsrc_nids; | |
13805 | if (!spec->cap_mixer) | |
13806 | set_capture_mixer(codec); | |
13807 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | |
13808 | ||
13809 | spec->vmaster_nid = 0x02; | |
13810 | ||
13811 | codec->patch_ops = alc_patch_ops; | |
13812 | if (board_config == ALC269_AUTO) | |
13813 | spec->init_hook = alc269_auto_init; | |
13814 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
13815 | if (!spec->loopback.amplist) | |
13816 | spec->loopback.amplist = alc269_loopbacks; | |
13817 | #endif | |
13818 | codec->proc_widget_hook = print_realtek_coef; | |
13819 | ||
13820 | return 0; | |
13821 | } | |
13822 | ||
13823 | /* | |
13824 | * ALC861 channel source setting (2/6 channel selection for 3-stack) | |
13825 | */ | |
13826 | ||
13827 | /* | |
13828 | * set the path ways for 2 channel output | |
13829 | * need to set the codec line out and mic 1 pin widgets to inputs | |
13830 | */ | |
13831 | static struct hda_verb alc861_threestack_ch2_init[] = { | |
13832 | /* set pin widget 1Ah (line in) for input */ | |
13833 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
13834 | /* set pin widget 18h (mic1/2) for input, for mic also enable | |
13835 | * the vref | |
13836 | */ | |
13837 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
13838 | ||
13839 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
13840 | #if 0 | |
13841 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
13842 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
13843 | #endif | |
13844 | { } /* end */ | |
13845 | }; | |
13846 | /* | |
13847 | * 6ch mode | |
13848 | * need to set the codec line out and mic 1 pin widgets to outputs | |
13849 | */ | |
13850 | static struct hda_verb alc861_threestack_ch6_init[] = { | |
13851 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
13852 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
13853 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
13854 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
13855 | ||
13856 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
13857 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
13858 | ||
13859 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
13860 | #if 0 | |
13861 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
13862 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
13863 | #endif | |
13864 | { } /* end */ | |
13865 | }; | |
13866 | ||
13867 | static struct hda_channel_mode alc861_threestack_modes[2] = { | |
13868 | { 2, alc861_threestack_ch2_init }, | |
13869 | { 6, alc861_threestack_ch6_init }, | |
13870 | }; | |
13871 | /* Set mic1 as input and unmute the mixer */ | |
13872 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { | |
13873 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
13874 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
13875 | { } /* end */ | |
13876 | }; | |
13877 | /* Set mic1 as output and mute mixer */ | |
13878 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { | |
13879 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
13880 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
13881 | { } /* end */ | |
13882 | }; | |
13883 | ||
13884 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { | |
13885 | { 2, alc861_uniwill_m31_ch2_init }, | |
13886 | { 4, alc861_uniwill_m31_ch4_init }, | |
13887 | }; | |
13888 | ||
13889 | /* Set mic1 and line-in as input and unmute the mixer */ | |
13890 | static struct hda_verb alc861_asus_ch2_init[] = { | |
13891 | /* set pin widget 1Ah (line in) for input */ | |
13892 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
13893 | /* set pin widget 18h (mic1/2) for input, for mic also enable | |
13894 | * the vref | |
13895 | */ | |
13896 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
13897 | ||
13898 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
13899 | #if 0 | |
13900 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
13901 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
13902 | #endif | |
13903 | { } /* end */ | |
13904 | }; | |
13905 | /* Set mic1 nad line-in as output and mute mixer */ | |
13906 | static struct hda_verb alc861_asus_ch6_init[] = { | |
13907 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
13908 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
13909 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
13910 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
13911 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
13912 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
13913 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
13914 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
13915 | ||
13916 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
13917 | #if 0 | |
13918 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
13919 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
13920 | #endif | |
13921 | { } /* end */ | |
13922 | }; | |
13923 | ||
13924 | static struct hda_channel_mode alc861_asus_modes[2] = { | |
13925 | { 2, alc861_asus_ch2_init }, | |
13926 | { 6, alc861_asus_ch6_init }, | |
13927 | }; | |
13928 | ||
13929 | /* patch-ALC861 */ | |
13930 | ||
13931 | static struct snd_kcontrol_new alc861_base_mixer[] = { | |
13932 | /* output mixer control */ | |
13933 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
13934 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
13935 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
13936 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
13937 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
13938 | ||
13939 | /*Input mixer control */ | |
13940 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
13941 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
13942 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
13943 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
13944 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
13945 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
13946 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
13947 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
13948 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
13949 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
13950 | ||
13951 | { } /* end */ | |
13952 | }; | |
13953 | ||
13954 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { | |
13955 | /* output mixer control */ | |
13956 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
13957 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
13958 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
13959 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
13960 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
13961 | ||
13962 | /* Input mixer control */ | |
13963 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
13964 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
13965 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
13966 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
13967 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
13968 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
13969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
13970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
13971 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
13972 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
13973 | ||
13974 | { | |
13975 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13976 | .name = "Channel Mode", | |
13977 | .info = alc_ch_mode_info, | |
13978 | .get = alc_ch_mode_get, | |
13979 | .put = alc_ch_mode_put, | |
13980 | .private_value = ARRAY_SIZE(alc861_threestack_modes), | |
13981 | }, | |
13982 | { } /* end */ | |
13983 | }; | |
13984 | ||
13985 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { | |
13986 | /* output mixer control */ | |
13987 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
13988 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
13989 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
13990 | ||
13991 | { } /* end */ | |
13992 | }; | |
13993 | ||
13994 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { | |
13995 | /* output mixer control */ | |
13996 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
13997 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
13998 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
13999 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
14000 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
14001 | ||
14002 | /* Input mixer control */ | |
14003 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
14004 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
14005 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
14006 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
14007 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
14008 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
14009 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
14010 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
14011 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
14012 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
14013 | ||
14014 | { | |
14015 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14016 | .name = "Channel Mode", | |
14017 | .info = alc_ch_mode_info, | |
14018 | .get = alc_ch_mode_get, | |
14019 | .put = alc_ch_mode_put, | |
14020 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
14021 | }, | |
14022 | { } /* end */ | |
14023 | }; | |
14024 | ||
14025 | static struct snd_kcontrol_new alc861_asus_mixer[] = { | |
14026 | /* output mixer control */ | |
14027 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
14028 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
14029 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
14030 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
14031 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
14032 | ||
14033 | /* Input mixer control */ | |
14034 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
14035 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
14036 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
14037 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
14038 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
14039 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
14040 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
14041 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
14042 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
14043 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), | |
14044 | ||
14045 | { | |
14046 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14047 | .name = "Channel Mode", | |
14048 | .info = alc_ch_mode_info, | |
14049 | .get = alc_ch_mode_get, | |
14050 | .put = alc_ch_mode_put, | |
14051 | .private_value = ARRAY_SIZE(alc861_asus_modes), | |
14052 | }, | |
14053 | { } | |
14054 | }; | |
14055 | ||
14056 | /* additional mixer */ | |
14057 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { | |
14058 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
14059 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
14060 | { } | |
14061 | }; | |
14062 | ||
14063 | /* | |
14064 | * generic initialization of ADC, input mixers and output mixers | |
14065 | */ | |
14066 | static struct hda_verb alc861_base_init_verbs[] = { | |
14067 | /* | |
14068 | * Unmute ADC0 and set the default input to mic-in | |
14069 | */ | |
14070 | /* port-A for surround (rear panel) */ | |
14071 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14072 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14073 | /* port-B for mic-in (rear panel) with vref */ | |
14074 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14075 | /* port-C for line-in (rear panel) */ | |
14076 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
14077 | /* port-D for Front */ | |
14078 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14079 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14080 | /* port-E for HP out (front panel) */ | |
14081 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
14082 | /* route front PCM to HP */ | |
14083 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14084 | /* port-F for mic-in (front panel) with vref */ | |
14085 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14086 | /* port-G for CLFE (rear panel) */ | |
14087 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14088 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14089 | /* port-H for side (rear panel) */ | |
14090 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14091 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14092 | /* CD-in */ | |
14093 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
14094 | /* route front mic to ADC1*/ | |
14095 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14096 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14097 | ||
14098 | /* Unmute DAC0~3 & spdif out*/ | |
14099 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14100 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14101 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14102 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14103 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14104 | ||
14105 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
14106 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14107 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14108 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14109 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14110 | ||
14111 | /* Unmute Stereo Mixer 15 */ | |
14112 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14113 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14114 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14115 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | |
14116 | ||
14117 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14118 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14119 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14120 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14121 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14122 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14123 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14124 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14125 | /* hp used DAC 3 (Front) */ | |
14126 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
14127 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14128 | ||
14129 | { } | |
14130 | }; | |
14131 | ||
14132 | static struct hda_verb alc861_threestack_init_verbs[] = { | |
14133 | /* | |
14134 | * Unmute ADC0 and set the default input to mic-in | |
14135 | */ | |
14136 | /* port-A for surround (rear panel) */ | |
14137 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
14138 | /* port-B for mic-in (rear panel) with vref */ | |
14139 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14140 | /* port-C for line-in (rear panel) */ | |
14141 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
14142 | /* port-D for Front */ | |
14143 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14144 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14145 | /* port-E for HP out (front panel) */ | |
14146 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
14147 | /* route front PCM to HP */ | |
14148 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14149 | /* port-F for mic-in (front panel) with vref */ | |
14150 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14151 | /* port-G for CLFE (rear panel) */ | |
14152 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
14153 | /* port-H for side (rear panel) */ | |
14154 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
14155 | /* CD-in */ | |
14156 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
14157 | /* route front mic to ADC1*/ | |
14158 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14159 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14160 | /* Unmute DAC0~3 & spdif out*/ | |
14161 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14162 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14163 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14164 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14165 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14166 | ||
14167 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
14168 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14169 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14170 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14171 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14172 | ||
14173 | /* Unmute Stereo Mixer 15 */ | |
14174 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14175 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14176 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14177 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | |
14178 | ||
14179 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14180 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14181 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14182 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14183 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14184 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14185 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14186 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14187 | /* hp used DAC 3 (Front) */ | |
14188 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
14189 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14190 | { } | |
14191 | }; | |
14192 | ||
14193 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | |
14194 | /* | |
14195 | * Unmute ADC0 and set the default input to mic-in | |
14196 | */ | |
14197 | /* port-A for surround (rear panel) */ | |
14198 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
14199 | /* port-B for mic-in (rear panel) with vref */ | |
14200 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14201 | /* port-C for line-in (rear panel) */ | |
14202 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
14203 | /* port-D for Front */ | |
14204 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14205 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14206 | /* port-E for HP out (front panel) */ | |
14207 | /* this has to be set to VREF80 */ | |
14208 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14209 | /* route front PCM to HP */ | |
14210 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14211 | /* port-F for mic-in (front panel) with vref */ | |
14212 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14213 | /* port-G for CLFE (rear panel) */ | |
14214 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
14215 | /* port-H for side (rear panel) */ | |
14216 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
14217 | /* CD-in */ | |
14218 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
14219 | /* route front mic to ADC1*/ | |
14220 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14221 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14222 | /* Unmute DAC0~3 & spdif out*/ | |
14223 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14224 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14225 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14226 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14227 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14228 | ||
14229 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
14230 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14231 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14232 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14233 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14234 | ||
14235 | /* Unmute Stereo Mixer 15 */ | |
14236 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14238 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14239 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | |
14240 | ||
14241 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14242 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14243 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14244 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14245 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14246 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14247 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14248 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14249 | /* hp used DAC 3 (Front) */ | |
14250 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
14251 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14252 | { } | |
14253 | }; | |
14254 | ||
14255 | static struct hda_verb alc861_asus_init_verbs[] = { | |
14256 | /* | |
14257 | * Unmute ADC0 and set the default input to mic-in | |
14258 | */ | |
14259 | /* port-A for surround (rear panel) | |
14260 | * according to codec#0 this is the HP jack | |
14261 | */ | |
14262 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ | |
14263 | /* route front PCM to HP */ | |
14264 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
14265 | /* port-B for mic-in (rear panel) with vref */ | |
14266 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14267 | /* port-C for line-in (rear panel) */ | |
14268 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
14269 | /* port-D for Front */ | |
14270 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14271 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14272 | /* port-E for HP out (front panel) */ | |
14273 | /* this has to be set to VREF80 */ | |
14274 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14275 | /* route front PCM to HP */ | |
14276 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14277 | /* port-F for mic-in (front panel) with vref */ | |
14278 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14279 | /* port-G for CLFE (rear panel) */ | |
14280 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14281 | /* port-H for side (rear panel) */ | |
14282 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14283 | /* CD-in */ | |
14284 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
14285 | /* route front mic to ADC1*/ | |
14286 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14287 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14288 | /* Unmute DAC0~3 & spdif out*/ | |
14289 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14290 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14291 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14292 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14293 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14294 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
14295 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14296 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14297 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14298 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14299 | ||
14300 | /* Unmute Stereo Mixer 15 */ | |
14301 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14302 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14303 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14304 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | |
14305 | ||
14306 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14307 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14308 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14309 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14310 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14311 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14312 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14313 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14314 | /* hp used DAC 3 (Front) */ | |
14315 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
14316 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14317 | { } | |
14318 | }; | |
14319 | ||
14320 | /* additional init verbs for ASUS laptops */ | |
14321 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { | |
14322 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ | |
14323 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ | |
14324 | { } | |
14325 | }; | |
14326 | ||
14327 | /* | |
14328 | * generic initialization of ADC, input mixers and output mixers | |
14329 | */ | |
14330 | static struct hda_verb alc861_auto_init_verbs[] = { | |
14331 | /* | |
14332 | * Unmute ADC0 and set the default input to mic-in | |
14333 | */ | |
14334 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ | |
14335 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14336 | ||
14337 | /* Unmute DAC0~3 & spdif out*/ | |
14338 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
14339 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
14340 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
14341 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
14342 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14343 | ||
14344 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
14345 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14346 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14347 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14348 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14349 | ||
14350 | /* Unmute Stereo Mixer 15 */ | |
14351 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14352 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14353 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14354 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | |
14355 | ||
14356 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
14357 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
14358 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
14359 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
14360 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
14361 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
14362 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
14363 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
14364 | ||
14365 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
14366 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
14367 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
14368 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
14369 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
14370 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
14371 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
14372 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
14373 | ||
14374 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ | |
14375 | ||
14376 | { } | |
14377 | }; | |
14378 | ||
14379 | static struct hda_verb alc861_toshiba_init_verbs[] = { | |
14380 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14381 | ||
14382 | { } | |
14383 | }; | |
14384 | ||
14385 | /* toggle speaker-output according to the hp-jack state */ | |
14386 | static void alc861_toshiba_automute(struct hda_codec *codec) | |
14387 | { | |
14388 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); | |
14389 | ||
14390 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, | |
14391 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
14392 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, | |
14393 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | |
14394 | } | |
14395 | ||
14396 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, | |
14397 | unsigned int res) | |
14398 | { | |
14399 | if ((res >> 26) == ALC880_HP_EVENT) | |
14400 | alc861_toshiba_automute(codec); | |
14401 | } | |
14402 | ||
14403 | /* pcm configuration: identical with ALC880 */ | |
14404 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback | |
14405 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture | |
14406 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback | |
14407 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture | |
14408 | ||
14409 | ||
14410 | #define ALC861_DIGOUT_NID 0x07 | |
14411 | ||
14412 | static struct hda_channel_mode alc861_8ch_modes[1] = { | |
14413 | { 8, NULL } | |
14414 | }; | |
14415 | ||
14416 | static hda_nid_t alc861_dac_nids[4] = { | |
14417 | /* front, surround, clfe, side */ | |
14418 | 0x03, 0x06, 0x05, 0x04 | |
14419 | }; | |
14420 | ||
14421 | static hda_nid_t alc660_dac_nids[3] = { | |
14422 | /* front, clfe, surround */ | |
14423 | 0x03, 0x05, 0x06 | |
14424 | }; | |
14425 | ||
14426 | static hda_nid_t alc861_adc_nids[1] = { | |
14427 | /* ADC0-2 */ | |
14428 | 0x08, | |
14429 | }; | |
14430 | ||
14431 | static struct hda_input_mux alc861_capture_source = { | |
14432 | .num_items = 5, | |
14433 | .items = { | |
14434 | { "Mic", 0x0 }, | |
14435 | { "Front Mic", 0x3 }, | |
14436 | { "Line", 0x1 }, | |
14437 | { "CD", 0x4 }, | |
14438 | { "Mixer", 0x5 }, | |
14439 | }, | |
14440 | }; | |
14441 | ||
14442 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |
14443 | { | |
14444 | struct alc_spec *spec = codec->spec; | |
14445 | hda_nid_t mix, srcs[5]; | |
14446 | int i, j, num; | |
14447 | ||
14448 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) | |
14449 | return 0; | |
14450 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | |
14451 | if (num < 0) | |
14452 | return 0; | |
14453 | for (i = 0; i < num; i++) { | |
14454 | unsigned int type; | |
14455 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); | |
14456 | if (type != AC_WID_AUD_OUT) | |
14457 | continue; | |
14458 | for (j = 0; j < spec->multiout.num_dacs; j++) | |
14459 | if (spec->multiout.dac_nids[j] == srcs[i]) | |
14460 | break; | |
14461 | if (j >= spec->multiout.num_dacs) | |
14462 | return srcs[i]; | |
14463 | } | |
14464 | return 0; | |
14465 | } | |
14466 | ||
14467 | /* fill in the dac_nids table from the parsed pin configuration */ | |
14468 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, | |
14469 | const struct auto_pin_cfg *cfg) | |
14470 | { | |
14471 | struct alc_spec *spec = codec->spec; | |
14472 | int i; | |
14473 | hda_nid_t nid, dac; | |
14474 | ||
14475 | spec->multiout.dac_nids = spec->private_dac_nids; | |
14476 | for (i = 0; i < cfg->line_outs; i++) { | |
14477 | nid = cfg->line_out_pins[i]; | |
14478 | dac = alc861_look_for_dac(codec, nid); | |
14479 | if (!dac) | |
14480 | continue; | |
14481 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
14482 | } | |
14483 | return 0; | |
14484 | } | |
14485 | ||
14486 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, | |
14487 | hda_nid_t nid, unsigned int chs) | |
14488 | { | |
14489 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, | |
14490 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | |
14491 | } | |
14492 | ||
14493 | /* add playback controls from the parsed DAC table */ | |
14494 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, | |
14495 | const struct auto_pin_cfg *cfg) | |
14496 | { | |
14497 | struct alc_spec *spec = codec->spec; | |
14498 | static const char *chname[4] = { | |
14499 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
14500 | }; | |
14501 | hda_nid_t nid; | |
14502 | int i, err; | |
14503 | ||
14504 | if (cfg->line_outs == 1) { | |
14505 | const char *pfx = NULL; | |
14506 | if (!cfg->hp_outs) | |
14507 | pfx = "Master"; | |
14508 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
14509 | pfx = "Speaker"; | |
14510 | if (pfx) { | |
14511 | nid = spec->multiout.dac_nids[0]; | |
14512 | return alc861_create_out_sw(codec, pfx, nid, 3); | |
14513 | } | |
14514 | } | |
14515 | ||
14516 | for (i = 0; i < cfg->line_outs; i++) { | |
14517 | nid = spec->multiout.dac_nids[i]; | |
14518 | if (!nid) | |
14519 | continue; | |
14520 | if (i == 2) { | |
14521 | /* Center/LFE */ | |
14522 | err = alc861_create_out_sw(codec, "Center", nid, 1); | |
14523 | if (err < 0) | |
14524 | return err; | |
14525 | err = alc861_create_out_sw(codec, "LFE", nid, 2); | |
14526 | if (err < 0) | |
14527 | return err; | |
14528 | } else { | |
14529 | err = alc861_create_out_sw(codec, chname[i], nid, 3); | |
14530 | if (err < 0) | |
14531 | return err; | |
14532 | } | |
14533 | } | |
14534 | return 0; | |
14535 | } | |
14536 | ||
14537 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) | |
14538 | { | |
14539 | struct alc_spec *spec = codec->spec; | |
14540 | int err; | |
14541 | hda_nid_t nid; | |
14542 | ||
14543 | if (!pin) | |
14544 | return 0; | |
14545 | ||
14546 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | |
14547 | nid = alc861_look_for_dac(codec, pin); | |
14548 | if (nid) { | |
14549 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); | |
14550 | if (err < 0) | |
14551 | return err; | |
14552 | spec->multiout.hp_nid = nid; | |
14553 | } | |
14554 | } | |
14555 | return 0; | |
14556 | } | |
14557 | ||
14558 | /* create playback/capture controls for input pins */ | |
14559 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, | |
14560 | const struct auto_pin_cfg *cfg) | |
14561 | { | |
14562 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); | |
14563 | } | |
14564 | ||
14565 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, | |
14566 | hda_nid_t nid, | |
14567 | int pin_type, hda_nid_t dac) | |
14568 | { | |
14569 | hda_nid_t mix, srcs[5]; | |
14570 | int i, num; | |
14571 | ||
14572 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
14573 | pin_type); | |
14574 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
14575 | AMP_OUT_UNMUTE); | |
14576 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) | |
14577 | return; | |
14578 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | |
14579 | if (num < 0) | |
14580 | return; | |
14581 | for (i = 0; i < num; i++) { | |
14582 | unsigned int mute; | |
14583 | if (srcs[i] == dac || srcs[i] == 0x15) | |
14584 | mute = AMP_IN_UNMUTE(i); | |
14585 | else | |
14586 | mute = AMP_IN_MUTE(i); | |
14587 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
14588 | mute); | |
14589 | } | |
14590 | } | |
14591 | ||
14592 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | |
14593 | { | |
14594 | struct alc_spec *spec = codec->spec; | |
14595 | int i; | |
14596 | ||
14597 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
14598 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
14599 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
14600 | if (nid) | |
14601 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, | |
14602 | spec->multiout.dac_nids[i]); | |
14603 | } | |
14604 | } | |
14605 | ||
14606 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | |
14607 | { | |
14608 | struct alc_spec *spec = codec->spec; | |
14609 | ||
14610 | if (spec->autocfg.hp_outs) | |
14611 | alc861_auto_set_output_and_unmute(codec, | |
14612 | spec->autocfg.hp_pins[0], | |
14613 | PIN_HP, | |
14614 | spec->multiout.hp_nid); | |
14615 | if (spec->autocfg.speaker_outs) | |
14616 | alc861_auto_set_output_and_unmute(codec, | |
14617 | spec->autocfg.speaker_pins[0], | |
14618 | PIN_OUT, | |
14619 | spec->multiout.dac_nids[0]); | |
14620 | } | |
14621 | ||
14622 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | |
14623 | { | |
14624 | struct alc_spec *spec = codec->spec; | |
14625 | int i; | |
14626 | ||
14627 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
14628 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
14629 | if (nid >= 0x0c && nid <= 0x11) | |
14630 | alc_set_input_pin(codec, nid, i); | |
14631 | } | |
14632 | } | |
14633 | ||
14634 | /* parse the BIOS configuration and set up the alc_spec */ | |
14635 | /* return 1 if successful, 0 if the proper config is not found, | |
14636 | * or a negative error code | |
14637 | */ | |
14638 | static int alc861_parse_auto_config(struct hda_codec *codec) | |
14639 | { | |
14640 | struct alc_spec *spec = codec->spec; | |
14641 | int err; | |
14642 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; | |
14643 | ||
14644 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
14645 | alc861_ignore); | |
14646 | if (err < 0) | |
14647 | return err; | |
14648 | if (!spec->autocfg.line_outs) | |
14649 | return 0; /* can't find valid BIOS pin config */ | |
14650 | ||
14651 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); | |
14652 | if (err < 0) | |
14653 | return err; | |
14654 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); | |
14655 | if (err < 0) | |
14656 | return err; | |
14657 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); | |
14658 | if (err < 0) | |
14659 | return err; | |
14660 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); | |
14661 | if (err < 0) | |
14662 | return err; | |
14663 | ||
14664 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
14665 | ||
14666 | if (spec->autocfg.dig_outs) | |
14667 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; | |
14668 | ||
14669 | if (spec->kctls.list) | |
14670 | add_mixer(spec, spec->kctls.list); | |
14671 | ||
14672 | add_verb(spec, alc861_auto_init_verbs); | |
14673 | ||
14674 | spec->num_mux_defs = 1; | |
14675 | spec->input_mux = &spec->private_imux[0]; | |
14676 | ||
14677 | spec->adc_nids = alc861_adc_nids; | |
14678 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | |
14679 | set_capture_mixer(codec); | |
14680 | ||
14681 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); | |
14682 | ||
14683 | return 1; | |
14684 | } | |
14685 | ||
14686 | /* additional initialization for auto-configuration model */ | |
14687 | static void alc861_auto_init(struct hda_codec *codec) | |
14688 | { | |
14689 | struct alc_spec *spec = codec->spec; | |
14690 | alc861_auto_init_multi_out(codec); | |
14691 | alc861_auto_init_hp_out(codec); | |
14692 | alc861_auto_init_analog_input(codec); | |
14693 | if (spec->unsol_event) | |
14694 | alc_inithook(codec); | |
14695 | } | |
14696 | ||
14697 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
14698 | static struct hda_amp_list alc861_loopbacks[] = { | |
14699 | { 0x15, HDA_INPUT, 0 }, | |
14700 | { 0x15, HDA_INPUT, 1 }, | |
14701 | { 0x15, HDA_INPUT, 2 }, | |
14702 | { 0x15, HDA_INPUT, 3 }, | |
14703 | { } /* end */ | |
14704 | }; | |
14705 | #endif | |
14706 | ||
14707 | ||
14708 | /* | |
14709 | * configuration and preset | |
14710 | */ | |
14711 | static const char *alc861_models[ALC861_MODEL_LAST] = { | |
14712 | [ALC861_3ST] = "3stack", | |
14713 | [ALC660_3ST] = "3stack-660", | |
14714 | [ALC861_3ST_DIG] = "3stack-dig", | |
14715 | [ALC861_6ST_DIG] = "6stack-dig", | |
14716 | [ALC861_UNIWILL_M31] = "uniwill-m31", | |
14717 | [ALC861_TOSHIBA] = "toshiba", | |
14718 | [ALC861_ASUS] = "asus", | |
14719 | [ALC861_ASUS_LAPTOP] = "asus-laptop", | |
14720 | [ALC861_AUTO] = "auto", | |
14721 | }; | |
14722 | ||
14723 | static struct snd_pci_quirk alc861_cfg_tbl[] = { | |
14724 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), | |
14725 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
14726 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
14727 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | |
14728 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), | |
14729 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), | |
14730 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), | |
14731 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) | |
14732 | * Any other models that need this preset? | |
14733 | */ | |
14734 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ | |
14735 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), | |
14736 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), | |
14737 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), | |
14738 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), | |
14739 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), | |
14740 | /* FIXME: the below seems conflict */ | |
14741 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ | |
14742 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), | |
14743 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), | |
14744 | {} | |
14745 | }; | |
14746 | ||
14747 | static struct alc_config_preset alc861_presets[] = { | |
14748 | [ALC861_3ST] = { | |
14749 | .mixers = { alc861_3ST_mixer }, | |
14750 | .init_verbs = { alc861_threestack_init_verbs }, | |
14751 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
14752 | .dac_nids = alc861_dac_nids, | |
14753 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
14754 | .channel_mode = alc861_threestack_modes, | |
14755 | .need_dac_fix = 1, | |
14756 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
14757 | .adc_nids = alc861_adc_nids, | |
14758 | .input_mux = &alc861_capture_source, | |
14759 | }, | |
14760 | [ALC861_3ST_DIG] = { | |
14761 | .mixers = { alc861_base_mixer }, | |
14762 | .init_verbs = { alc861_threestack_init_verbs }, | |
14763 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
14764 | .dac_nids = alc861_dac_nids, | |
14765 | .dig_out_nid = ALC861_DIGOUT_NID, | |
14766 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
14767 | .channel_mode = alc861_threestack_modes, | |
14768 | .need_dac_fix = 1, | |
14769 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
14770 | .adc_nids = alc861_adc_nids, | |
14771 | .input_mux = &alc861_capture_source, | |
14772 | }, | |
14773 | [ALC861_6ST_DIG] = { | |
14774 | .mixers = { alc861_base_mixer }, | |
14775 | .init_verbs = { alc861_base_init_verbs }, | |
14776 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
14777 | .dac_nids = alc861_dac_nids, | |
14778 | .dig_out_nid = ALC861_DIGOUT_NID, | |
14779 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), | |
14780 | .channel_mode = alc861_8ch_modes, | |
14781 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
14782 | .adc_nids = alc861_adc_nids, | |
14783 | .input_mux = &alc861_capture_source, | |
14784 | }, | |
14785 | [ALC660_3ST] = { | |
14786 | .mixers = { alc861_3ST_mixer }, | |
14787 | .init_verbs = { alc861_threestack_init_verbs }, | |
14788 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), | |
14789 | .dac_nids = alc660_dac_nids, | |
14790 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
14791 | .channel_mode = alc861_threestack_modes, | |
14792 | .need_dac_fix = 1, | |
14793 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
14794 | .adc_nids = alc861_adc_nids, | |
14795 | .input_mux = &alc861_capture_source, | |
14796 | }, | |
14797 | [ALC861_UNIWILL_M31] = { | |
14798 | .mixers = { alc861_uniwill_m31_mixer }, | |
14799 | .init_verbs = { alc861_uniwill_m31_init_verbs }, | |
14800 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
14801 | .dac_nids = alc861_dac_nids, | |
14802 | .dig_out_nid = ALC861_DIGOUT_NID, | |
14803 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
14804 | .channel_mode = alc861_uniwill_m31_modes, | |
14805 | .need_dac_fix = 1, | |
14806 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
14807 | .adc_nids = alc861_adc_nids, | |
14808 | .input_mux = &alc861_capture_source, | |
14809 | }, | |
14810 | [ALC861_TOSHIBA] = { | |
14811 | .mixers = { alc861_toshiba_mixer }, | |
14812 | .init_verbs = { alc861_base_init_verbs, | |
14813 | alc861_toshiba_init_verbs }, | |
14814 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
14815 | .dac_nids = alc861_dac_nids, | |
14816 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
14817 | .channel_mode = alc883_3ST_2ch_modes, | |
14818 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
14819 | .adc_nids = alc861_adc_nids, | |
14820 | .input_mux = &alc861_capture_source, | |
14821 | .unsol_event = alc861_toshiba_unsol_event, | |
14822 | .init_hook = alc861_toshiba_automute, | |
14823 | }, | |
14824 | [ALC861_ASUS] = { | |
14825 | .mixers = { alc861_asus_mixer }, | |
14826 | .init_verbs = { alc861_asus_init_verbs }, | |
14827 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
14828 | .dac_nids = alc861_dac_nids, | |
14829 | .dig_out_nid = ALC861_DIGOUT_NID, | |
14830 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), | |
14831 | .channel_mode = alc861_asus_modes, | |
14832 | .need_dac_fix = 1, | |
14833 | .hp_nid = 0x06, | |
14834 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
14835 | .adc_nids = alc861_adc_nids, | |
14836 | .input_mux = &alc861_capture_source, | |
14837 | }, | |
14838 | [ALC861_ASUS_LAPTOP] = { | |
14839 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, | |
14840 | .init_verbs = { alc861_asus_init_verbs, | |
14841 | alc861_asus_laptop_init_verbs }, | |
14842 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
14843 | .dac_nids = alc861_dac_nids, | |
14844 | .dig_out_nid = ALC861_DIGOUT_NID, | |
14845 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
14846 | .channel_mode = alc883_3ST_2ch_modes, | |
14847 | .need_dac_fix = 1, | |
14848 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
14849 | .adc_nids = alc861_adc_nids, | |
14850 | .input_mux = &alc861_capture_source, | |
14851 | }, | |
14852 | }; | |
14853 | ||
14854 | /* Pin config fixes */ | |
14855 | enum { | |
14856 | PINFIX_FSC_AMILO_PI1505, | |
14857 | }; | |
14858 | ||
14859 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { | |
14860 | { 0x0b, 0x0221101f }, /* HP */ | |
14861 | { 0x0f, 0x90170310 }, /* speaker */ | |
14862 | { } | |
14863 | }; | |
14864 | ||
14865 | static const struct alc_fixup alc861_fixups[] = { | |
14866 | [PINFIX_FSC_AMILO_PI1505] = { | |
14867 | .pins = alc861_fsc_amilo_pi1505_pinfix | |
14868 | }, | |
14869 | }; | |
14870 | ||
14871 | static struct snd_pci_quirk alc861_fixup_tbl[] = { | |
14872 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), | |
14873 | {} | |
14874 | }; | |
14875 | ||
14876 | static int patch_alc861(struct hda_codec *codec) | |
14877 | { | |
14878 | struct alc_spec *spec; | |
14879 | int board_config; | |
14880 | int err; | |
14881 | ||
14882 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
14883 | if (spec == NULL) | |
14884 | return -ENOMEM; | |
14885 | ||
14886 | codec->spec = spec; | |
14887 | ||
14888 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, | |
14889 | alc861_models, | |
14890 | alc861_cfg_tbl); | |
14891 | ||
14892 | if (board_config < 0) { | |
14893 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
14894 | codec->chip_name); | |
14895 | board_config = ALC861_AUTO; | |
14896 | } | |
14897 | ||
14898 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups); | |
14899 | ||
14900 | if (board_config == ALC861_AUTO) { | |
14901 | /* automatic parse from the BIOS config */ | |
14902 | err = alc861_parse_auto_config(codec); | |
14903 | if (err < 0) { | |
14904 | alc_free(codec); | |
14905 | return err; | |
14906 | } else if (!err) { | |
14907 | printk(KERN_INFO | |
14908 | "hda_codec: Cannot set up configuration " | |
14909 | "from BIOS. Using base mode...\n"); | |
14910 | board_config = ALC861_3ST_DIG; | |
14911 | } | |
14912 | } | |
14913 | ||
14914 | err = snd_hda_attach_beep_device(codec, 0x23); | |
14915 | if (err < 0) { | |
14916 | alc_free(codec); | |
14917 | return err; | |
14918 | } | |
14919 | ||
14920 | if (board_config != ALC861_AUTO) | |
14921 | setup_preset(codec, &alc861_presets[board_config]); | |
14922 | ||
14923 | spec->stream_analog_playback = &alc861_pcm_analog_playback; | |
14924 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | |
14925 | ||
14926 | spec->stream_digital_playback = &alc861_pcm_digital_playback; | |
14927 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | |
14928 | ||
14929 | if (!spec->cap_mixer) | |
14930 | set_capture_mixer(codec); | |
14931 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); | |
14932 | ||
14933 | spec->vmaster_nid = 0x03; | |
14934 | ||
14935 | codec->patch_ops = alc_patch_ops; | |
14936 | if (board_config == ALC861_AUTO) | |
14937 | spec->init_hook = alc861_auto_init; | |
14938 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
14939 | if (!spec->loopback.amplist) | |
14940 | spec->loopback.amplist = alc861_loopbacks; | |
14941 | #endif | |
14942 | codec->proc_widget_hook = print_realtek_coef; | |
14943 | ||
14944 | return 0; | |
14945 | } | |
14946 | ||
14947 | /* | |
14948 | * ALC861-VD support | |
14949 | * | |
14950 | * Based on ALC882 | |
14951 | * | |
14952 | * In addition, an independent DAC | |
14953 | */ | |
14954 | #define ALC861VD_DIGOUT_NID 0x06 | |
14955 | ||
14956 | static hda_nid_t alc861vd_dac_nids[4] = { | |
14957 | /* front, surr, clfe, side surr */ | |
14958 | 0x02, 0x03, 0x04, 0x05 | |
14959 | }; | |
14960 | ||
14961 | /* dac_nids for ALC660vd are in a different order - according to | |
14962 | * Realtek's driver. | |
14963 | * This should probably result in a different mixer for 6stack models | |
14964 | * of ALC660vd codecs, but for now there is only 3stack mixer | |
14965 | * - and it is the same as in 861vd. | |
14966 | * adc_nids in ALC660vd are (is) the same as in 861vd | |
14967 | */ | |
14968 | static hda_nid_t alc660vd_dac_nids[3] = { | |
14969 | /* front, rear, clfe, rear_surr */ | |
14970 | 0x02, 0x04, 0x03 | |
14971 | }; | |
14972 | ||
14973 | static hda_nid_t alc861vd_adc_nids[1] = { | |
14974 | /* ADC0 */ | |
14975 | 0x09, | |
14976 | }; | |
14977 | ||
14978 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; | |
14979 | ||
14980 | /* input MUX */ | |
14981 | /* FIXME: should be a matrix-type input source selection */ | |
14982 | static struct hda_input_mux alc861vd_capture_source = { | |
14983 | .num_items = 4, | |
14984 | .items = { | |
14985 | { "Mic", 0x0 }, | |
14986 | { "Front Mic", 0x1 }, | |
14987 | { "Line", 0x2 }, | |
14988 | { "CD", 0x4 }, | |
14989 | }, | |
14990 | }; | |
14991 | ||
14992 | static struct hda_input_mux alc861vd_dallas_capture_source = { | |
14993 | .num_items = 2, | |
14994 | .items = { | |
14995 | { "Ext Mic", 0x0 }, | |
14996 | { "Int Mic", 0x1 }, | |
14997 | }, | |
14998 | }; | |
14999 | ||
15000 | static struct hda_input_mux alc861vd_hp_capture_source = { | |
15001 | .num_items = 2, | |
15002 | .items = { | |
15003 | { "Front Mic", 0x0 }, | |
15004 | { "ATAPI Mic", 0x1 }, | |
15005 | }, | |
15006 | }; | |
15007 | ||
15008 | /* | |
15009 | * 2ch mode | |
15010 | */ | |
15011 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { | |
15012 | { 2, NULL } | |
15013 | }; | |
15014 | ||
15015 | /* | |
15016 | * 6ch mode | |
15017 | */ | |
15018 | static struct hda_verb alc861vd_6stack_ch6_init[] = { | |
15019 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15020 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
15021 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
15022 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
15023 | { } /* end */ | |
15024 | }; | |
15025 | ||
15026 | /* | |
15027 | * 8ch mode | |
15028 | */ | |
15029 | static struct hda_verb alc861vd_6stack_ch8_init[] = { | |
15030 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
15031 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
15032 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
15033 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
15034 | { } /* end */ | |
15035 | }; | |
15036 | ||
15037 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { | |
15038 | { 6, alc861vd_6stack_ch6_init }, | |
15039 | { 8, alc861vd_6stack_ch8_init }, | |
15040 | }; | |
15041 | ||
15042 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { | |
15043 | { | |
15044 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15045 | .name = "Channel Mode", | |
15046 | .info = alc_ch_mode_info, | |
15047 | .get = alc_ch_mode_get, | |
15048 | .put = alc_ch_mode_put, | |
15049 | }, | |
15050 | { } /* end */ | |
15051 | }; | |
15052 | ||
15053 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
15054 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
15055 | */ | |
15056 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { | |
15057 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
15058 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
15059 | ||
15060 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
15061 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
15062 | ||
15063 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, | |
15064 | HDA_OUTPUT), | |
15065 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, | |
15066 | HDA_OUTPUT), | |
15067 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
15068 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
15069 | ||
15070 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), | |
15071 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
15072 | ||
15073 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
15074 | ||
15075 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
15076 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
15077 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
15078 | ||
15079 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
15080 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
15081 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
15082 | ||
15083 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
15084 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
15085 | ||
15086 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
15087 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
15088 | ||
15089 | { } /* end */ | |
15090 | }; | |
15091 | ||
15092 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { | |
15093 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
15094 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
15095 | ||
15096 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
15097 | ||
15098 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
15099 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
15100 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
15101 | ||
15102 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
15103 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
15104 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
15105 | ||
15106 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
15107 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
15108 | ||
15109 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
15110 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
15111 | ||
15112 | { } /* end */ | |
15113 | }; | |
15114 | ||
15115 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { | |
15116 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
15117 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ | |
15118 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
15119 | ||
15120 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
15121 | ||
15122 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
15123 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
15124 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
15125 | ||
15126 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
15127 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
15128 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
15129 | ||
15130 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
15131 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
15132 | ||
15133 | { } /* end */ | |
15134 | }; | |
15135 | ||
15136 | /* Pin assignment: Speaker=0x14, HP = 0x15, | |
15137 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d | |
15138 | */ | |
15139 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | |
15140 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
15141 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
15142 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
15143 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
15144 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
15145 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
15146 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
15147 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
15148 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
15149 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
15150 | { } /* end */ | |
15151 | }; | |
15152 | ||
15153 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, | |
15154 | * Front Mic=0x18, ATAPI Mic = 0x19, | |
15155 | */ | |
15156 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { | |
15157 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
15158 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
15159 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
15160 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
15161 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
15162 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
15163 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
15164 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
15165 | ||
15166 | { } /* end */ | |
15167 | }; | |
15168 | ||
15169 | /* | |
15170 | * generic initialization of ADC, input mixers and output mixers | |
15171 | */ | |
15172 | static struct hda_verb alc861vd_volume_init_verbs[] = { | |
15173 | /* | |
15174 | * Unmute ADC0 and set the default input to mic-in | |
15175 | */ | |
15176 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15177 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15178 | ||
15179 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of | |
15180 | * the analog-loopback mixer widget | |
15181 | */ | |
15182 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
15183 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15184 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15185 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
15186 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
15187 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
15188 | ||
15189 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ | |
15190 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15191 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15192 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15193 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
15194 | ||
15195 | /* | |
15196 | * Set up output mixers (0x02 - 0x05) | |
15197 | */ | |
15198 | /* set vol=0 to output mixers */ | |
15199 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15200 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15201 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15202 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15203 | ||
15204 | /* set up input amps for analog loopback */ | |
15205 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
15206 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15207 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15208 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15209 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15210 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15211 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15212 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15213 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15214 | ||
15215 | { } | |
15216 | }; | |
15217 | ||
15218 | /* | |
15219 | * 3-stack pin configuration: | |
15220 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
15221 | */ | |
15222 | static struct hda_verb alc861vd_3stack_init_verbs[] = { | |
15223 | /* | |
15224 | * Set pin mode and muting | |
15225 | */ | |
15226 | /* set front pin widgets 0x14 for output */ | |
15227 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
15228 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15229 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15230 | ||
15231 | /* Mic (rear) pin: input vref at 80% */ | |
15232 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
15233 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15234 | /* Front Mic pin: input vref at 80% */ | |
15235 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
15236 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15237 | /* Line In pin: input */ | |
15238 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15239 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15240 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
15241 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15242 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15243 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15244 | /* CD pin widget for input */ | |
15245 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15246 | ||
15247 | { } | |
15248 | }; | |
15249 | ||
15250 | /* | |
15251 | * 6-stack pin configuration: | |
15252 | */ | |
15253 | static struct hda_verb alc861vd_6stack_init_verbs[] = { | |
15254 | /* | |
15255 | * Set pin mode and muting | |
15256 | */ | |
15257 | /* set front pin widgets 0x14 for output */ | |
15258 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
15259 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15260 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15261 | ||
15262 | /* Rear Pin: output 1 (0x0d) */ | |
15263 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
15264 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15265 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
15266 | /* CLFE Pin: output 2 (0x0e) */ | |
15267 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
15268 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15269 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
15270 | /* Side Pin: output 3 (0x0f) */ | |
15271 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
15272 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15273 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
15274 | ||
15275 | /* Mic (rear) pin: input vref at 80% */ | |
15276 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
15277 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15278 | /* Front Mic pin: input vref at 80% */ | |
15279 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
15280 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15281 | /* Line In pin: input */ | |
15282 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15283 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15284 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
15285 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15286 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15287 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15288 | /* CD pin widget for input */ | |
15289 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15290 | ||
15291 | { } | |
15292 | }; | |
15293 | ||
15294 | static struct hda_verb alc861vd_eapd_verbs[] = { | |
15295 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
15296 | { } | |
15297 | }; | |
15298 | ||
15299 | static struct hda_verb alc660vd_eapd_verbs[] = { | |
15300 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
15301 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
15302 | { } | |
15303 | }; | |
15304 | ||
15305 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { | |
15306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15308 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
15309 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15310 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15311 | {} | |
15312 | }; | |
15313 | ||
15314 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) | |
15315 | { | |
15316 | unsigned int present; | |
15317 | unsigned char bits; | |
15318 | ||
15319 | present = snd_hda_jack_detect(codec, 0x18); | |
15320 | bits = present ? HDA_AMP_MUTE : 0; | |
15321 | ||
15322 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | |
15323 | HDA_AMP_MUTE, bits); | |
15324 | } | |
15325 | ||
15326 | static void alc861vd_lenovo_setup(struct hda_codec *codec) | |
15327 | { | |
15328 | struct alc_spec *spec = codec->spec; | |
15329 | spec->autocfg.hp_pins[0] = 0x1b; | |
15330 | spec->autocfg.speaker_pins[0] = 0x14; | |
15331 | } | |
15332 | ||
15333 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | |
15334 | { | |
15335 | alc_automute_amp(codec); | |
15336 | alc861vd_lenovo_mic_automute(codec); | |
15337 | } | |
15338 | ||
15339 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, | |
15340 | unsigned int res) | |
15341 | { | |
15342 | switch (res >> 26) { | |
15343 | case ALC880_MIC_EVENT: | |
15344 | alc861vd_lenovo_mic_automute(codec); | |
15345 | break; | |
15346 | default: | |
15347 | alc_automute_amp_unsol_event(codec, res); | |
15348 | break; | |
15349 | } | |
15350 | } | |
15351 | ||
15352 | static struct hda_verb alc861vd_dallas_verbs[] = { | |
15353 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15354 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15355 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15356 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15357 | ||
15358 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15359 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15360 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15361 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15362 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15363 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15364 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15365 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15366 | ||
15367 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
15368 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15369 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
15370 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15371 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
15372 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15373 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
15374 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15375 | ||
15376 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
15377 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15378 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
15379 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15380 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15381 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15382 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15383 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15384 | ||
15385 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15386 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
15387 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
15388 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
15389 | ||
15390 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15391 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15392 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15393 | ||
15394 | { } /* end */ | |
15395 | }; | |
15396 | ||
15397 | /* toggle speaker-output according to the hp-jack state */ | |
15398 | static void alc861vd_dallas_setup(struct hda_codec *codec) | |
15399 | { | |
15400 | struct alc_spec *spec = codec->spec; | |
15401 | ||
15402 | spec->autocfg.hp_pins[0] = 0x15; | |
15403 | spec->autocfg.speaker_pins[0] = 0x14; | |
15404 | } | |
15405 | ||
15406 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
15407 | #define alc861vd_loopbacks alc880_loopbacks | |
15408 | #endif | |
15409 | ||
15410 | /* pcm configuration: identical with ALC880 */ | |
15411 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback | |
15412 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture | |
15413 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback | |
15414 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture | |
15415 | ||
15416 | /* | |
15417 | * configuration and preset | |
15418 | */ | |
15419 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { | |
15420 | [ALC660VD_3ST] = "3stack-660", | |
15421 | [ALC660VD_3ST_DIG] = "3stack-660-digout", | |
15422 | [ALC660VD_ASUS_V1S] = "asus-v1s", | |
15423 | [ALC861VD_3ST] = "3stack", | |
15424 | [ALC861VD_3ST_DIG] = "3stack-digout", | |
15425 | [ALC861VD_6ST_DIG] = "6stack-digout", | |
15426 | [ALC861VD_LENOVO] = "lenovo", | |
15427 | [ALC861VD_DALLAS] = "dallas", | |
15428 | [ALC861VD_HP] = "hp", | |
15429 | [ALC861VD_AUTO] = "auto", | |
15430 | }; | |
15431 | ||
15432 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |
15433 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), | |
15434 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | |
15435 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), | |
15436 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ | |
15437 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), | |
15438 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), | |
15439 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), | |
15440 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), | |
15441 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ | |
15442 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), | |
15443 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), | |
15444 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), | |
15445 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), | |
15446 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), | |
15447 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), | |
15448 | {} | |
15449 | }; | |
15450 | ||
15451 | static struct alc_config_preset alc861vd_presets[] = { | |
15452 | [ALC660VD_3ST] = { | |
15453 | .mixers = { alc861vd_3st_mixer }, | |
15454 | .init_verbs = { alc861vd_volume_init_verbs, | |
15455 | alc861vd_3stack_init_verbs }, | |
15456 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
15457 | .dac_nids = alc660vd_dac_nids, | |
15458 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
15459 | .channel_mode = alc861vd_3stack_2ch_modes, | |
15460 | .input_mux = &alc861vd_capture_source, | |
15461 | }, | |
15462 | [ALC660VD_3ST_DIG] = { | |
15463 | .mixers = { alc861vd_3st_mixer }, | |
15464 | .init_verbs = { alc861vd_volume_init_verbs, | |
15465 | alc861vd_3stack_init_verbs }, | |
15466 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
15467 | .dac_nids = alc660vd_dac_nids, | |
15468 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
15469 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
15470 | .channel_mode = alc861vd_3stack_2ch_modes, | |
15471 | .input_mux = &alc861vd_capture_source, | |
15472 | }, | |
15473 | [ALC861VD_3ST] = { | |
15474 | .mixers = { alc861vd_3st_mixer }, | |
15475 | .init_verbs = { alc861vd_volume_init_verbs, | |
15476 | alc861vd_3stack_init_verbs }, | |
15477 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
15478 | .dac_nids = alc861vd_dac_nids, | |
15479 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
15480 | .channel_mode = alc861vd_3stack_2ch_modes, | |
15481 | .input_mux = &alc861vd_capture_source, | |
15482 | }, | |
15483 | [ALC861VD_3ST_DIG] = { | |
15484 | .mixers = { alc861vd_3st_mixer }, | |
15485 | .init_verbs = { alc861vd_volume_init_verbs, | |
15486 | alc861vd_3stack_init_verbs }, | |
15487 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
15488 | .dac_nids = alc861vd_dac_nids, | |
15489 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
15490 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
15491 | .channel_mode = alc861vd_3stack_2ch_modes, | |
15492 | .input_mux = &alc861vd_capture_source, | |
15493 | }, | |
15494 | [ALC861VD_6ST_DIG] = { | |
15495 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, | |
15496 | .init_verbs = { alc861vd_volume_init_verbs, | |
15497 | alc861vd_6stack_init_verbs }, | |
15498 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
15499 | .dac_nids = alc861vd_dac_nids, | |
15500 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
15501 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), | |
15502 | .channel_mode = alc861vd_6stack_modes, | |
15503 | .input_mux = &alc861vd_capture_source, | |
15504 | }, | |
15505 | [ALC861VD_LENOVO] = { | |
15506 | .mixers = { alc861vd_lenovo_mixer }, | |
15507 | .init_verbs = { alc861vd_volume_init_verbs, | |
15508 | alc861vd_3stack_init_verbs, | |
15509 | alc861vd_eapd_verbs, | |
15510 | alc861vd_lenovo_unsol_verbs }, | |
15511 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
15512 | .dac_nids = alc660vd_dac_nids, | |
15513 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
15514 | .channel_mode = alc861vd_3stack_2ch_modes, | |
15515 | .input_mux = &alc861vd_capture_source, | |
15516 | .unsol_event = alc861vd_lenovo_unsol_event, | |
15517 | .setup = alc861vd_lenovo_setup, | |
15518 | .init_hook = alc861vd_lenovo_init_hook, | |
15519 | }, | |
15520 | [ALC861VD_DALLAS] = { | |
15521 | .mixers = { alc861vd_dallas_mixer }, | |
15522 | .init_verbs = { alc861vd_dallas_verbs }, | |
15523 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
15524 | .dac_nids = alc861vd_dac_nids, | |
15525 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
15526 | .channel_mode = alc861vd_3stack_2ch_modes, | |
15527 | .input_mux = &alc861vd_dallas_capture_source, | |
15528 | .unsol_event = alc_automute_amp_unsol_event, | |
15529 | .setup = alc861vd_dallas_setup, | |
15530 | .init_hook = alc_automute_amp, | |
15531 | }, | |
15532 | [ALC861VD_HP] = { | |
15533 | .mixers = { alc861vd_hp_mixer }, | |
15534 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | |
15535 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
15536 | .dac_nids = alc861vd_dac_nids, | |
15537 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
15538 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
15539 | .channel_mode = alc861vd_3stack_2ch_modes, | |
15540 | .input_mux = &alc861vd_hp_capture_source, | |
15541 | .unsol_event = alc_automute_amp_unsol_event, | |
15542 | .setup = alc861vd_dallas_setup, | |
15543 | .init_hook = alc_automute_amp, | |
15544 | }, | |
15545 | [ALC660VD_ASUS_V1S] = { | |
15546 | .mixers = { alc861vd_lenovo_mixer }, | |
15547 | .init_verbs = { alc861vd_volume_init_verbs, | |
15548 | alc861vd_3stack_init_verbs, | |
15549 | alc861vd_eapd_verbs, | |
15550 | alc861vd_lenovo_unsol_verbs }, | |
15551 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
15552 | .dac_nids = alc660vd_dac_nids, | |
15553 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
15554 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
15555 | .channel_mode = alc861vd_3stack_2ch_modes, | |
15556 | .input_mux = &alc861vd_capture_source, | |
15557 | .unsol_event = alc861vd_lenovo_unsol_event, | |
15558 | .setup = alc861vd_lenovo_setup, | |
15559 | .init_hook = alc861vd_lenovo_init_hook, | |
15560 | }, | |
15561 | }; | |
15562 | ||
15563 | /* | |
15564 | * BIOS auto configuration | |
15565 | */ | |
15566 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, | |
15567 | const struct auto_pin_cfg *cfg) | |
15568 | { | |
15569 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0); | |
15570 | } | |
15571 | ||
15572 | ||
15573 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, | |
15574 | hda_nid_t nid, int pin_type, int dac_idx) | |
15575 | { | |
15576 | alc_set_pin_output(codec, nid, pin_type); | |
15577 | } | |
15578 | ||
15579 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) | |
15580 | { | |
15581 | struct alc_spec *spec = codec->spec; | |
15582 | int i; | |
15583 | ||
15584 | for (i = 0; i <= HDA_SIDE; i++) { | |
15585 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
15586 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
15587 | if (nid) | |
15588 | alc861vd_auto_set_output_and_unmute(codec, nid, | |
15589 | pin_type, i); | |
15590 | } | |
15591 | } | |
15592 | ||
15593 | ||
15594 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | |
15595 | { | |
15596 | struct alc_spec *spec = codec->spec; | |
15597 | hda_nid_t pin; | |
15598 | ||
15599 | pin = spec->autocfg.hp_pins[0]; | |
15600 | if (pin) /* connect to front and use dac 0 */ | |
15601 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
15602 | pin = spec->autocfg.speaker_pins[0]; | |
15603 | if (pin) | |
15604 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
15605 | } | |
15606 | ||
15607 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID | |
15608 | ||
15609 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |
15610 | { | |
15611 | struct alc_spec *spec = codec->spec; | |
15612 | int i; | |
15613 | ||
15614 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
15615 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
15616 | if (alc_is_input_pin(codec, nid)) { | |
15617 | alc_set_input_pin(codec, nid, i); | |
15618 | if (nid != ALC861VD_PIN_CD_NID && | |
15619 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
15620 | snd_hda_codec_write(codec, nid, 0, | |
15621 | AC_VERB_SET_AMP_GAIN_MUTE, | |
15622 | AMP_OUT_MUTE); | |
15623 | } | |
15624 | } | |
15625 | } | |
15626 | ||
15627 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src | |
15628 | ||
15629 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) | |
15630 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) | |
15631 | ||
15632 | /* add playback controls from the parsed DAC table */ | |
15633 | /* Based on ALC880 version. But ALC861VD has separate, | |
15634 | * different NIDs for mute/unmute switch and volume control */ | |
15635 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | |
15636 | const struct auto_pin_cfg *cfg) | |
15637 | { | |
15638 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; | |
15639 | hda_nid_t nid_v, nid_s; | |
15640 | int i, err; | |
15641 | ||
15642 | for (i = 0; i < cfg->line_outs; i++) { | |
15643 | if (!spec->multiout.dac_nids[i]) | |
15644 | continue; | |
15645 | nid_v = alc861vd_idx_to_mixer_vol( | |
15646 | alc880_dac_to_idx( | |
15647 | spec->multiout.dac_nids[i])); | |
15648 | nid_s = alc861vd_idx_to_mixer_switch( | |
15649 | alc880_dac_to_idx( | |
15650 | spec->multiout.dac_nids[i])); | |
15651 | ||
15652 | if (i == 2) { | |
15653 | /* Center/LFE */ | |
15654 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
15655 | "Center", | |
15656 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, | |
15657 | HDA_OUTPUT)); | |
15658 | if (err < 0) | |
15659 | return err; | |
15660 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | |
15661 | "LFE", | |
15662 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, | |
15663 | HDA_OUTPUT)); | |
15664 | if (err < 0) | |
15665 | return err; | |
15666 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
15667 | "Center", | |
15668 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, | |
15669 | HDA_INPUT)); | |
15670 | if (err < 0) | |
15671 | return err; | |
15672 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | |
15673 | "LFE", | |
15674 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, | |
15675 | HDA_INPUT)); | |
15676 | if (err < 0) | |
15677 | return err; | |
15678 | } else { | |
15679 | const char *pfx; | |
15680 | if (cfg->line_outs == 1 && | |
15681 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | |
15682 | if (!cfg->hp_pins) | |
15683 | pfx = "Speaker"; | |
15684 | else | |
15685 | pfx = "PCM"; | |
15686 | } else | |
15687 | pfx = chname[i]; | |
15688 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | |
15689 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, | |
15690 | HDA_OUTPUT)); | |
15691 | if (err < 0) | |
15692 | return err; | |
15693 | if (cfg->line_outs == 1 && | |
15694 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
15695 | pfx = "Speaker"; | |
15696 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | |
15697 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, | |
15698 | HDA_INPUT)); | |
15699 | if (err < 0) | |
15700 | return err; | |
15701 | } | |
15702 | } | |
15703 | return 0; | |
15704 | } | |
15705 | ||
15706 | /* add playback controls for speaker and HP outputs */ | |
15707 | /* Based on ALC880 version. But ALC861VD has separate, | |
15708 | * different NIDs for mute/unmute switch and volume control */ | |
15709 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, | |
15710 | hda_nid_t pin, const char *pfx) | |
15711 | { | |
15712 | hda_nid_t nid_v, nid_s; | |
15713 | int err; | |
15714 | ||
15715 | if (!pin) | |
15716 | return 0; | |
15717 | ||
15718 | if (alc880_is_fixed_pin(pin)) { | |
15719 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
15720 | /* specify the DAC as the extra output */ | |
15721 | if (!spec->multiout.hp_nid) | |
15722 | spec->multiout.hp_nid = nid_v; | |
15723 | else | |
15724 | spec->multiout.extra_out_nid[0] = nid_v; | |
15725 | /* control HP volume/switch on the output mixer amp */ | |
15726 | nid_v = alc861vd_idx_to_mixer_vol( | |
15727 | alc880_fixed_pin_idx(pin)); | |
15728 | nid_s = alc861vd_idx_to_mixer_switch( | |
15729 | alc880_fixed_pin_idx(pin)); | |
15730 | ||
15731 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | |
15732 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); | |
15733 | if (err < 0) | |
15734 | return err; | |
15735 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | |
15736 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); | |
15737 | if (err < 0) | |
15738 | return err; | |
15739 | } else if (alc880_is_multi_pin(pin)) { | |
15740 | /* set manual connection */ | |
15741 | /* we have only a switch on HP-out PIN */ | |
15742 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | |
15743 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
15744 | if (err < 0) | |
15745 | return err; | |
15746 | } | |
15747 | return 0; | |
15748 | } | |
15749 | ||
15750 | /* parse the BIOS configuration and set up the alc_spec | |
15751 | * return 1 if successful, 0 if the proper config is not found, | |
15752 | * or a negative error code | |
15753 | * Based on ALC880 version - had to change it to override | |
15754 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ | |
15755 | static int alc861vd_parse_auto_config(struct hda_codec *codec) | |
15756 | { | |
15757 | struct alc_spec *spec = codec->spec; | |
15758 | int err; | |
15759 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; | |
15760 | ||
15761 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
15762 | alc861vd_ignore); | |
15763 | if (err < 0) | |
15764 | return err; | |
15765 | if (!spec->autocfg.line_outs) | |
15766 | return 0; /* can't find valid BIOS pin config */ | |
15767 | ||
15768 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | |
15769 | if (err < 0) | |
15770 | return err; | |
15771 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
15772 | if (err < 0) | |
15773 | return err; | |
15774 | err = alc861vd_auto_create_extra_out(spec, | |
15775 | spec->autocfg.speaker_pins[0], | |
15776 | "Speaker"); | |
15777 | if (err < 0) | |
15778 | return err; | |
15779 | err = alc861vd_auto_create_extra_out(spec, | |
15780 | spec->autocfg.hp_pins[0], | |
15781 | "Headphone"); | |
15782 | if (err < 0) | |
15783 | return err; | |
15784 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); | |
15785 | if (err < 0) | |
15786 | return err; | |
15787 | ||
15788 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
15789 | ||
15790 | if (spec->autocfg.dig_outs) | |
15791 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; | |
15792 | ||
15793 | if (spec->kctls.list) | |
15794 | add_mixer(spec, spec->kctls.list); | |
15795 | ||
15796 | add_verb(spec, alc861vd_volume_init_verbs); | |
15797 | ||
15798 | spec->num_mux_defs = 1; | |
15799 | spec->input_mux = &spec->private_imux[0]; | |
15800 | ||
15801 | err = alc_auto_add_mic_boost(codec); | |
15802 | if (err < 0) | |
15803 | return err; | |
15804 | ||
15805 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); | |
15806 | ||
15807 | return 1; | |
15808 | } | |
15809 | ||
15810 | /* additional initialization for auto-configuration model */ | |
15811 | static void alc861vd_auto_init(struct hda_codec *codec) | |
15812 | { | |
15813 | struct alc_spec *spec = codec->spec; | |
15814 | alc861vd_auto_init_multi_out(codec); | |
15815 | alc861vd_auto_init_hp_out(codec); | |
15816 | alc861vd_auto_init_analog_input(codec); | |
15817 | alc861vd_auto_init_input_src(codec); | |
15818 | if (spec->unsol_event) | |
15819 | alc_inithook(codec); | |
15820 | } | |
15821 | ||
15822 | enum { | |
15823 | ALC660VD_FIX_ASUS_GPIO1 | |
15824 | }; | |
15825 | ||
15826 | /* reset GPIO1 */ | |
15827 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { | |
15828 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
15829 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
15830 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
15831 | { } | |
15832 | }; | |
15833 | ||
15834 | static const struct alc_fixup alc861vd_fixups[] = { | |
15835 | [ALC660VD_FIX_ASUS_GPIO1] = { | |
15836 | .verbs = alc660vd_fix_asus_gpio1_verbs, | |
15837 | }, | |
15838 | }; | |
15839 | ||
15840 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { | |
15841 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), | |
15842 | {} | |
15843 | }; | |
15844 | ||
15845 | static int patch_alc861vd(struct hda_codec *codec) | |
15846 | { | |
15847 | struct alc_spec *spec; | |
15848 | int err, board_config; | |
15849 | ||
15850 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
15851 | if (spec == NULL) | |
15852 | return -ENOMEM; | |
15853 | ||
15854 | codec->spec = spec; | |
15855 | ||
15856 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, | |
15857 | alc861vd_models, | |
15858 | alc861vd_cfg_tbl); | |
15859 | ||
15860 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { | |
15861 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
15862 | codec->chip_name); | |
15863 | board_config = ALC861VD_AUTO; | |
15864 | } | |
15865 | ||
15866 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups); | |
15867 | ||
15868 | if (board_config == ALC861VD_AUTO) { | |
15869 | /* automatic parse from the BIOS config */ | |
15870 | err = alc861vd_parse_auto_config(codec); | |
15871 | if (err < 0) { | |
15872 | alc_free(codec); | |
15873 | return err; | |
15874 | } else if (!err) { | |
15875 | printk(KERN_INFO | |
15876 | "hda_codec: Cannot set up configuration " | |
15877 | "from BIOS. Using base mode...\n"); | |
15878 | board_config = ALC861VD_3ST; | |
15879 | } | |
15880 | } | |
15881 | ||
15882 | err = snd_hda_attach_beep_device(codec, 0x23); | |
15883 | if (err < 0) { | |
15884 | alc_free(codec); | |
15885 | return err; | |
15886 | } | |
15887 | ||
15888 | if (board_config != ALC861VD_AUTO) | |
15889 | setup_preset(codec, &alc861vd_presets[board_config]); | |
15890 | ||
15891 | if (codec->vendor_id == 0x10ec0660) { | |
15892 | /* always turn on EAPD */ | |
15893 | add_verb(spec, alc660vd_eapd_verbs); | |
15894 | } | |
15895 | ||
15896 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; | |
15897 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; | |
15898 | ||
15899 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; | |
15900 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; | |
15901 | ||
15902 | if (!spec->adc_nids) { | |
15903 | spec->adc_nids = alc861vd_adc_nids; | |
15904 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | |
15905 | } | |
15906 | if (!spec->capsrc_nids) | |
15907 | spec->capsrc_nids = alc861vd_capsrc_nids; | |
15908 | ||
15909 | set_capture_mixer(codec); | |
15910 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
15911 | ||
15912 | spec->vmaster_nid = 0x02; | |
15913 | ||
15914 | codec->patch_ops = alc_patch_ops; | |
15915 | ||
15916 | if (board_config == ALC861VD_AUTO) | |
15917 | spec->init_hook = alc861vd_auto_init; | |
15918 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
15919 | if (!spec->loopback.amplist) | |
15920 | spec->loopback.amplist = alc861vd_loopbacks; | |
15921 | #endif | |
15922 | codec->proc_widget_hook = print_realtek_coef; | |
15923 | ||
15924 | return 0; | |
15925 | } | |
15926 | ||
15927 | /* | |
15928 | * ALC662 support | |
15929 | * | |
15930 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible | |
15931 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
15932 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
15933 | * 6-channel independent captures. | |
15934 | * | |
15935 | * In addition, an independent DAC for the multi-playback (not used in this | |
15936 | * driver yet). | |
15937 | */ | |
15938 | #define ALC662_DIGOUT_NID 0x06 | |
15939 | #define ALC662_DIGIN_NID 0x0a | |
15940 | ||
15941 | static hda_nid_t alc662_dac_nids[4] = { | |
15942 | /* front, rear, clfe, rear_surr */ | |
15943 | 0x02, 0x03, 0x04 | |
15944 | }; | |
15945 | ||
15946 | static hda_nid_t alc272_dac_nids[2] = { | |
15947 | 0x02, 0x03 | |
15948 | }; | |
15949 | ||
15950 | static hda_nid_t alc662_adc_nids[2] = { | |
15951 | /* ADC1-2 */ | |
15952 | 0x09, 0x08 | |
15953 | }; | |
15954 | ||
15955 | static hda_nid_t alc272_adc_nids[1] = { | |
15956 | /* ADC1-2 */ | |
15957 | 0x08, | |
15958 | }; | |
15959 | ||
15960 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; | |
15961 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; | |
15962 | ||
15963 | ||
15964 | /* input MUX */ | |
15965 | /* FIXME: should be a matrix-type input source selection */ | |
15966 | static struct hda_input_mux alc662_capture_source = { | |
15967 | .num_items = 4, | |
15968 | .items = { | |
15969 | { "Mic", 0x0 }, | |
15970 | { "Front Mic", 0x1 }, | |
15971 | { "Line", 0x2 }, | |
15972 | { "CD", 0x4 }, | |
15973 | }, | |
15974 | }; | |
15975 | ||
15976 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { | |
15977 | .num_items = 2, | |
15978 | .items = { | |
15979 | { "Mic", 0x1 }, | |
15980 | { "Line", 0x2 }, | |
15981 | }, | |
15982 | }; | |
15983 | ||
15984 | static struct hda_input_mux alc663_capture_source = { | |
15985 | .num_items = 3, | |
15986 | .items = { | |
15987 | { "Mic", 0x0 }, | |
15988 | { "Front Mic", 0x1 }, | |
15989 | { "Line", 0x2 }, | |
15990 | }, | |
15991 | }; | |
15992 | ||
15993 | #if 0 /* set to 1 for testing other input sources below */ | |
15994 | static struct hda_input_mux alc272_nc10_capture_source = { | |
15995 | .num_items = 16, | |
15996 | .items = { | |
15997 | { "Autoselect Mic", 0x0 }, | |
15998 | { "Internal Mic", 0x1 }, | |
15999 | { "In-0x02", 0x2 }, | |
16000 | { "In-0x03", 0x3 }, | |
16001 | { "In-0x04", 0x4 }, | |
16002 | { "In-0x05", 0x5 }, | |
16003 | { "In-0x06", 0x6 }, | |
16004 | { "In-0x07", 0x7 }, | |
16005 | { "In-0x08", 0x8 }, | |
16006 | { "In-0x09", 0x9 }, | |
16007 | { "In-0x0a", 0x0a }, | |
16008 | { "In-0x0b", 0x0b }, | |
16009 | { "In-0x0c", 0x0c }, | |
16010 | { "In-0x0d", 0x0d }, | |
16011 | { "In-0x0e", 0x0e }, | |
16012 | { "In-0x0f", 0x0f }, | |
16013 | }, | |
16014 | }; | |
16015 | #endif | |
16016 | ||
16017 | /* | |
16018 | * 2ch mode | |
16019 | */ | |
16020 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { | |
16021 | { 2, NULL } | |
16022 | }; | |
16023 | ||
16024 | /* | |
16025 | * 2ch mode | |
16026 | */ | |
16027 | static struct hda_verb alc662_3ST_ch2_init[] = { | |
16028 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
16029 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
16030 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
16031 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
16032 | { } /* end */ | |
16033 | }; | |
16034 | ||
16035 | /* | |
16036 | * 6ch mode | |
16037 | */ | |
16038 | static struct hda_verb alc662_3ST_ch6_init[] = { | |
16039 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16040 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
16041 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
16042 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16043 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
16044 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
16045 | { } /* end */ | |
16046 | }; | |
16047 | ||
16048 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { | |
16049 | { 2, alc662_3ST_ch2_init }, | |
16050 | { 6, alc662_3ST_ch6_init }, | |
16051 | }; | |
16052 | ||
16053 | /* | |
16054 | * 2ch mode | |
16055 | */ | |
16056 | static struct hda_verb alc662_sixstack_ch6_init[] = { | |
16057 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
16058 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
16059 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16060 | { } /* end */ | |
16061 | }; | |
16062 | ||
16063 | /* | |
16064 | * 6ch mode | |
16065 | */ | |
16066 | static struct hda_verb alc662_sixstack_ch8_init[] = { | |
16067 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16068 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16069 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16070 | { } /* end */ | |
16071 | }; | |
16072 | ||
16073 | static struct hda_channel_mode alc662_5stack_modes[2] = { | |
16074 | { 2, alc662_sixstack_ch6_init }, | |
16075 | { 6, alc662_sixstack_ch8_init }, | |
16076 | }; | |
16077 | ||
16078 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
16079 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
16080 | */ | |
16081 | ||
16082 | static struct snd_kcontrol_new alc662_base_mixer[] = { | |
16083 | /* output mixer control */ | |
16084 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
16085 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
16086 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
16087 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), | |
16088 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | |
16089 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
16090 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), | |
16091 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
16092 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16093 | ||
16094 | /*Input mixer control */ | |
16095 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), | |
16096 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), | |
16097 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), | |
16098 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), | |
16099 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), | |
16100 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), | |
16101 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), | |
16102 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), | |
16103 | { } /* end */ | |
16104 | }; | |
16105 | ||
16106 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | |
16107 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16108 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
16109 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16110 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16111 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16112 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16113 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16114 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16115 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16116 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16117 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16118 | { } /* end */ | |
16119 | }; | |
16120 | ||
16121 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | |
16122 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16123 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
16124 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16125 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), | |
16126 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | |
16127 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
16128 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), | |
16129 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
16130 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16131 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16132 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16133 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16134 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16137 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16138 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16139 | { } /* end */ | |
16140 | }; | |
16141 | ||
16142 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { | |
16143 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16144 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | |
16145 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16146 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), | |
16147 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16148 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16149 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16150 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16151 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16152 | { } /* end */ | |
16153 | }; | |
16154 | ||
16155 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { | |
16156 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16157 | ALC262_HIPPO_MASTER_SWITCH, | |
16158 | ||
16159 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), | |
16160 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16161 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16162 | ||
16163 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
16164 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16165 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16166 | { } /* end */ | |
16167 | }; | |
16168 | ||
16169 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { | |
16170 | ALC262_HIPPO_MASTER_SWITCH, | |
16171 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16172 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16173 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | |
16174 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
16175 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), | |
16176 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16177 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16178 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16179 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16180 | { } /* end */ | |
16181 | }; | |
16182 | ||
16183 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { | |
16184 | .ops = &snd_hda_bind_vol, | |
16185 | .values = { | |
16186 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
16187 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
16188 | 0 | |
16189 | }, | |
16190 | }; | |
16191 | ||
16192 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { | |
16193 | .ops = &snd_hda_bind_sw, | |
16194 | .values = { | |
16195 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
16196 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
16197 | 0 | |
16198 | }, | |
16199 | }; | |
16200 | ||
16201 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { | |
16202 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
16203 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), | |
16204 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16205 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16206 | { } /* end */ | |
16207 | }; | |
16208 | ||
16209 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { | |
16210 | .ops = &snd_hda_bind_sw, | |
16211 | .values = { | |
16212 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
16213 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
16214 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
16215 | 0 | |
16216 | }, | |
16217 | }; | |
16218 | ||
16219 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { | |
16220 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
16221 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), | |
16222 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16223 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16224 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16225 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16226 | ||
16227 | { } /* end */ | |
16228 | }; | |
16229 | ||
16230 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { | |
16231 | .ops = &snd_hda_bind_sw, | |
16232 | .values = { | |
16233 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
16234 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
16235 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
16236 | 0 | |
16237 | }, | |
16238 | }; | |
16239 | ||
16240 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { | |
16241 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
16242 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), | |
16243 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16244 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16245 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16246 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16247 | { } /* end */ | |
16248 | }; | |
16249 | ||
16250 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { | |
16251 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16252 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
16253 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16254 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16255 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16256 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16257 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16258 | { } /* end */ | |
16259 | }; | |
16260 | ||
16261 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { | |
16262 | .ops = &snd_hda_bind_vol, | |
16263 | .values = { | |
16264 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
16265 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), | |
16266 | 0 | |
16267 | }, | |
16268 | }; | |
16269 | ||
16270 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { | |
16271 | .ops = &snd_hda_bind_sw, | |
16272 | .values = { | |
16273 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
16274 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), | |
16275 | 0 | |
16276 | }, | |
16277 | }; | |
16278 | ||
16279 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { | |
16280 | HDA_BIND_VOL("Master Playback Volume", | |
16281 | &alc663_asus_two_bind_master_vol), | |
16282 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
16283 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16284 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
16285 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16286 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16287 | { } /* end */ | |
16288 | }; | |
16289 | ||
16290 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { | |
16291 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
16292 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
16293 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16294 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
16295 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16296 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16297 | { } /* end */ | |
16298 | }; | |
16299 | ||
16300 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { | |
16301 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16302 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
16303 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16304 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
16305 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
16306 | ||
16307 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16308 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16309 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16310 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16311 | { } /* end */ | |
16312 | }; | |
16313 | ||
16314 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { | |
16315 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16316 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
16317 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
16318 | ||
16319 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16320 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16321 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16322 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16323 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16324 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16325 | { } /* end */ | |
16326 | }; | |
16327 | ||
16328 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { | |
16329 | .ops = &snd_hda_bind_sw, | |
16330 | .values = { | |
16331 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
16332 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
16333 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | |
16334 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
16335 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
16336 | 0 | |
16337 | }, | |
16338 | }; | |
16339 | ||
16340 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { | |
16341 | .ops = &snd_hda_bind_sw, | |
16342 | .values = { | |
16343 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
16344 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | |
16345 | 0 | |
16346 | }, | |
16347 | }; | |
16348 | ||
16349 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { | |
16350 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | |
16351 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | |
16352 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | |
16353 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16354 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
16355 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16356 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16357 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16358 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16359 | { } /* end */ | |
16360 | }; | |
16361 | ||
16362 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { | |
16363 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | |
16364 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | |
16365 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | |
16366 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
16367 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
16368 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16369 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16370 | { } /* end */ | |
16371 | }; | |
16372 | ||
16373 | ||
16374 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { | |
16375 | { | |
16376 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
16377 | .name = "Channel Mode", | |
16378 | .info = alc_ch_mode_info, | |
16379 | .get = alc_ch_mode_get, | |
16380 | .put = alc_ch_mode_put, | |
16381 | }, | |
16382 | { } /* end */ | |
16383 | }; | |
16384 | ||
16385 | static struct hda_verb alc662_init_verbs[] = { | |
16386 | /* ADC: mute amp left and right */ | |
16387 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16388 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16389 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
16390 | ||
16391 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16392 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16393 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
16394 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
16395 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
16396 | ||
16397 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16398 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16399 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16400 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16401 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16402 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16403 | ||
16404 | /* Front Pin: output 0 (0x0c) */ | |
16405 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16406 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16407 | ||
16408 | /* Rear Pin: output 1 (0x0d) */ | |
16409 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16410 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16411 | ||
16412 | /* CLFE Pin: output 2 (0x0e) */ | |
16413 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16414 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16415 | ||
16416 | /* Mic (rear) pin: input vref at 80% */ | |
16417 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16418 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16419 | /* Front Mic pin: input vref at 80% */ | |
16420 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16421 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16422 | /* Line In pin: input */ | |
16423 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16424 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16425 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
16426 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16427 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16428 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16429 | /* CD pin widget for input */ | |
16430 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16431 | ||
16432 | /* FIXME: use matrix-type input source selection */ | |
16433 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
16434 | /* Input mixer */ | |
16435 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16436 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16437 | ||
16438 | /* always trun on EAPD */ | |
16439 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16440 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16441 | ||
16442 | { } | |
16443 | }; | |
16444 | ||
16445 | static struct hda_verb alc662_sue_init_verbs[] = { | |
16446 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
16447 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
16448 | {} | |
16449 | }; | |
16450 | ||
16451 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { | |
16452 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16453 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16454 | {} | |
16455 | }; | |
16456 | ||
16457 | /* Set Unsolicited Event*/ | |
16458 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { | |
16459 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16460 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16461 | {} | |
16462 | }; | |
16463 | ||
16464 | /* | |
16465 | * generic initialization of ADC, input mixers and output mixers | |
16466 | */ | |
16467 | static struct hda_verb alc662_auto_init_verbs[] = { | |
16468 | /* | |
16469 | * Unmute ADC and set the default input to mic-in | |
16470 | */ | |
16471 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16472 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16473 | ||
16474 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
16475 | * mixer widget | |
16476 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
16477 | * panel mic (mic 2) | |
16478 | */ | |
16479 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
16480 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16481 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16482 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
16483 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
16484 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
16485 | ||
16486 | /* | |
16487 | * Set up output mixers (0x0c - 0x0f) | |
16488 | */ | |
16489 | /* set vol=0 to output mixers */ | |
16490 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16491 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16492 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16493 | ||
16494 | /* set up input amps for analog loopback */ | |
16495 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
16496 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16497 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16498 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16499 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16500 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16501 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16502 | ||
16503 | ||
16504 | /* FIXME: use matrix-type input source selection */ | |
16505 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
16506 | /* Input mixer */ | |
16507 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16508 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16509 | { } | |
16510 | }; | |
16511 | ||
16512 | /* additional verbs for ALC663 */ | |
16513 | static struct hda_verb alc663_auto_init_verbs[] = { | |
16514 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16515 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16516 | { } | |
16517 | }; | |
16518 | ||
16519 | static struct hda_verb alc663_m51va_init_verbs[] = { | |
16520 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16521 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16522 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16523 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16524 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
16525 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16526 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
16527 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16528 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16529 | {} | |
16530 | }; | |
16531 | ||
16532 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { | |
16533 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16534 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16535 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
16536 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16537 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16538 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16539 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16540 | {} | |
16541 | }; | |
16542 | ||
16543 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { | |
16544 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16545 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16546 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16547 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
16548 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16549 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16550 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16551 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16552 | {} | |
16553 | }; | |
16554 | ||
16555 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { | |
16556 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16557 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16558 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
16559 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16560 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16561 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16562 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16563 | {} | |
16564 | }; | |
16565 | ||
16566 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { | |
16567 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16568 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16569 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16570 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
16571 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16572 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16573 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
16574 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16575 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16576 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16577 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16578 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16579 | {} | |
16580 | }; | |
16581 | ||
16582 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { | |
16583 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16584 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16585 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16586 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
16587 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16588 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16589 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
16590 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16591 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16592 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16593 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16594 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16595 | {} | |
16596 | }; | |
16597 | ||
16598 | static struct hda_verb alc663_g71v_init_verbs[] = { | |
16599 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16600 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
16601 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ | |
16602 | ||
16603 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16604 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16605 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
16606 | ||
16607 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
16608 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, | |
16609 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
16610 | {} | |
16611 | }; | |
16612 | ||
16613 | static struct hda_verb alc663_g50v_init_verbs[] = { | |
16614 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16615 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16616 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
16617 | ||
16618 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16619 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16620 | {} | |
16621 | }; | |
16622 | ||
16623 | static struct hda_verb alc662_ecs_init_verbs[] = { | |
16624 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | |
16625 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16626 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16627 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16628 | {} | |
16629 | }; | |
16630 | ||
16631 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { | |
16632 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16633 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16634 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16635 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16636 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16637 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16638 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
16639 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16640 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
16641 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16642 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16643 | {} | |
16644 | }; | |
16645 | ||
16646 | static struct hda_verb alc272_dell_init_verbs[] = { | |
16647 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16648 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16649 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16650 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16651 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16652 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16653 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
16654 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16655 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
16656 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16657 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16658 | {} | |
16659 | }; | |
16660 | ||
16661 | static struct hda_verb alc663_mode7_init_verbs[] = { | |
16662 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16663 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16664 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16665 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16666 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16667 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16668 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
16669 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16670 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16671 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
16672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
16674 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16675 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16676 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16677 | {} | |
16678 | }; | |
16679 | ||
16680 | static struct hda_verb alc663_mode8_init_verbs[] = { | |
16681 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16682 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16683 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16684 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
16685 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16686 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16687 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16688 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16689 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16690 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16691 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
16692 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16693 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
16694 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16695 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
16696 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
16697 | {} | |
16698 | }; | |
16699 | ||
16700 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { | |
16701 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
16702 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
16703 | { } /* end */ | |
16704 | }; | |
16705 | ||
16706 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { | |
16707 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
16708 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
16709 | { } /* end */ | |
16710 | }; | |
16711 | ||
16712 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | |
16713 | { | |
16714 | unsigned int present; | |
16715 | unsigned char bits; | |
16716 | ||
16717 | present = snd_hda_jack_detect(codec, 0x14); | |
16718 | bits = present ? HDA_AMP_MUTE : 0; | |
16719 | ||
16720 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
16721 | HDA_AMP_MUTE, bits); | |
16722 | } | |
16723 | ||
16724 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) | |
16725 | { | |
16726 | unsigned int present; | |
16727 | unsigned char bits; | |
16728 | ||
16729 | present = snd_hda_jack_detect(codec, 0x1b); | |
16730 | bits = present ? HDA_AMP_MUTE : 0; | |
16731 | ||
16732 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
16733 | HDA_AMP_MUTE, bits); | |
16734 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
16735 | HDA_AMP_MUTE, bits); | |
16736 | } | |
16737 | ||
16738 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | |
16739 | unsigned int res) | |
16740 | { | |
16741 | if ((res >> 26) == ALC880_HP_EVENT) | |
16742 | alc662_lenovo_101e_all_automute(codec); | |
16743 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
16744 | alc662_lenovo_101e_ispeaker_automute(codec); | |
16745 | } | |
16746 | ||
16747 | /* unsolicited event for HP jack sensing */ | |
16748 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | |
16749 | unsigned int res) | |
16750 | { | |
16751 | if ((res >> 26) == ALC880_MIC_EVENT) | |
16752 | alc_mic_automute(codec); | |
16753 | else | |
16754 | alc262_hippo_unsol_event(codec, res); | |
16755 | } | |
16756 | ||
16757 | static void alc662_eeepc_setup(struct hda_codec *codec) | |
16758 | { | |
16759 | struct alc_spec *spec = codec->spec; | |
16760 | ||
16761 | alc262_hippo1_setup(codec); | |
16762 | spec->ext_mic.pin = 0x18; | |
16763 | spec->ext_mic.mux_idx = 0; | |
16764 | spec->int_mic.pin = 0x19; | |
16765 | spec->int_mic.mux_idx = 1; | |
16766 | spec->auto_mic = 1; | |
16767 | } | |
16768 | ||
16769 | static void alc662_eeepc_inithook(struct hda_codec *codec) | |
16770 | { | |
16771 | alc262_hippo_automute(codec); | |
16772 | alc_mic_automute(codec); | |
16773 | } | |
16774 | ||
16775 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) | |
16776 | { | |
16777 | struct alc_spec *spec = codec->spec; | |
16778 | ||
16779 | spec->autocfg.hp_pins[0] = 0x14; | |
16780 | spec->autocfg.speaker_pins[0] = 0x1b; | |
16781 | } | |
16782 | ||
16783 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update | |
16784 | ||
16785 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) | |
16786 | { | |
16787 | unsigned int present; | |
16788 | unsigned char bits; | |
16789 | ||
16790 | present = snd_hda_jack_detect(codec, 0x21); | |
16791 | bits = present ? HDA_AMP_MUTE : 0; | |
16792 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
16793 | AMP_IN_MUTE(0), bits); | |
16794 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
16795 | AMP_IN_MUTE(0), bits); | |
16796 | } | |
16797 | ||
16798 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | |
16799 | { | |
16800 | unsigned int present; | |
16801 | unsigned char bits; | |
16802 | ||
16803 | present = snd_hda_jack_detect(codec, 0x21); | |
16804 | bits = present ? HDA_AMP_MUTE : 0; | |
16805 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
16806 | AMP_IN_MUTE(0), bits); | |
16807 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
16808 | AMP_IN_MUTE(0), bits); | |
16809 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | |
16810 | AMP_IN_MUTE(0), bits); | |
16811 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | |
16812 | AMP_IN_MUTE(0), bits); | |
16813 | } | |
16814 | ||
16815 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | |
16816 | { | |
16817 | unsigned int present; | |
16818 | unsigned char bits; | |
16819 | ||
16820 | present = snd_hda_jack_detect(codec, 0x15); | |
16821 | bits = present ? HDA_AMP_MUTE : 0; | |
16822 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
16823 | AMP_IN_MUTE(0), bits); | |
16824 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
16825 | AMP_IN_MUTE(0), bits); | |
16826 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | |
16827 | AMP_IN_MUTE(0), bits); | |
16828 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | |
16829 | AMP_IN_MUTE(0), bits); | |
16830 | } | |
16831 | ||
16832 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) | |
16833 | { | |
16834 | unsigned int present; | |
16835 | unsigned char bits; | |
16836 | ||
16837 | present = snd_hda_jack_detect(codec, 0x1b); | |
16838 | bits = present ? 0 : PIN_OUT; | |
16839 | snd_hda_codec_write(codec, 0x14, 0, | |
16840 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | |
16841 | } | |
16842 | ||
16843 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) | |
16844 | { | |
16845 | unsigned int present1, present2; | |
16846 | ||
16847 | present1 = snd_hda_jack_detect(codec, 0x21); | |
16848 | present2 = snd_hda_jack_detect(codec, 0x15); | |
16849 | ||
16850 | if (present1 || present2) { | |
16851 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
16852 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
16853 | } else { | |
16854 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
16855 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
16856 | } | |
16857 | } | |
16858 | ||
16859 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |
16860 | { | |
16861 | unsigned int present1, present2; | |
16862 | ||
16863 | present1 = snd_hda_jack_detect(codec, 0x1b); | |
16864 | present2 = snd_hda_jack_detect(codec, 0x15); | |
16865 | ||
16866 | if (present1 || present2) { | |
16867 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
16868 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); | |
16869 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
16870 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); | |
16871 | } else { | |
16872 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
16873 | AMP_IN_MUTE(0), 0); | |
16874 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
16875 | AMP_IN_MUTE(0), 0); | |
16876 | } | |
16877 | } | |
16878 | ||
16879 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) | |
16880 | { | |
16881 | unsigned int present1, present2; | |
16882 | ||
16883 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | |
16884 | AC_VERB_GET_PIN_SENSE, 0) | |
16885 | & AC_PINSENSE_PRESENCE; | |
16886 | present2 = snd_hda_codec_read(codec, 0x21, 0, | |
16887 | AC_VERB_GET_PIN_SENSE, 0) | |
16888 | & AC_PINSENSE_PRESENCE; | |
16889 | ||
16890 | if (present1 || present2) { | |
16891 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
16892 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
16893 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
16894 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
16895 | } else { | |
16896 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
16897 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
16898 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
16899 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
16900 | } | |
16901 | } | |
16902 | ||
16903 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) | |
16904 | { | |
16905 | unsigned int present1, present2; | |
16906 | ||
16907 | present1 = snd_hda_codec_read(codec, 0x21, 0, | |
16908 | AC_VERB_GET_PIN_SENSE, 0) | |
16909 | & AC_PINSENSE_PRESENCE; | |
16910 | present2 = snd_hda_codec_read(codec, 0x15, 0, | |
16911 | AC_VERB_GET_PIN_SENSE, 0) | |
16912 | & AC_PINSENSE_PRESENCE; | |
16913 | ||
16914 | if (present1 || present2) { | |
16915 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
16916 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
16917 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
16918 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
16919 | } else { | |
16920 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
16921 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
16922 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
16923 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
16924 | } | |
16925 | } | |
16926 | ||
16927 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | |
16928 | unsigned int res) | |
16929 | { | |
16930 | switch (res >> 26) { | |
16931 | case ALC880_HP_EVENT: | |
16932 | alc663_m51va_speaker_automute(codec); | |
16933 | break; | |
16934 | case ALC880_MIC_EVENT: | |
16935 | alc_mic_automute(codec); | |
16936 | break; | |
16937 | } | |
16938 | } | |
16939 | ||
16940 | static void alc663_m51va_setup(struct hda_codec *codec) | |
16941 | { | |
16942 | struct alc_spec *spec = codec->spec; | |
16943 | spec->ext_mic.pin = 0x18; | |
16944 | spec->ext_mic.mux_idx = 0; | |
16945 | spec->int_mic.pin = 0x12; | |
16946 | spec->int_mic.mux_idx = 9; | |
16947 | spec->auto_mic = 1; | |
16948 | } | |
16949 | ||
16950 | static void alc663_m51va_inithook(struct hda_codec *codec) | |
16951 | { | |
16952 | alc663_m51va_speaker_automute(codec); | |
16953 | alc_mic_automute(codec); | |
16954 | } | |
16955 | ||
16956 | /* ***************** Mode1 ******************************/ | |
16957 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event | |
16958 | ||
16959 | static void alc663_mode1_setup(struct hda_codec *codec) | |
16960 | { | |
16961 | struct alc_spec *spec = codec->spec; | |
16962 | spec->ext_mic.pin = 0x18; | |
16963 | spec->ext_mic.mux_idx = 0; | |
16964 | spec->int_mic.pin = 0x19; | |
16965 | spec->int_mic.mux_idx = 1; | |
16966 | spec->auto_mic = 1; | |
16967 | } | |
16968 | ||
16969 | #define alc663_mode1_inithook alc663_m51va_inithook | |
16970 | ||
16971 | /* ***************** Mode2 ******************************/ | |
16972 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | |
16973 | unsigned int res) | |
16974 | { | |
16975 | switch (res >> 26) { | |
16976 | case ALC880_HP_EVENT: | |
16977 | alc662_f5z_speaker_automute(codec); | |
16978 | break; | |
16979 | case ALC880_MIC_EVENT: | |
16980 | alc_mic_automute(codec); | |
16981 | break; | |
16982 | } | |
16983 | } | |
16984 | ||
16985 | #define alc662_mode2_setup alc663_mode1_setup | |
16986 | ||
16987 | static void alc662_mode2_inithook(struct hda_codec *codec) | |
16988 | { | |
16989 | alc662_f5z_speaker_automute(codec); | |
16990 | alc_mic_automute(codec); | |
16991 | } | |
16992 | /* ***************** Mode3 ******************************/ | |
16993 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | |
16994 | unsigned int res) | |
16995 | { | |
16996 | switch (res >> 26) { | |
16997 | case ALC880_HP_EVENT: | |
16998 | alc663_two_hp_m1_speaker_automute(codec); | |
16999 | break; | |
17000 | case ALC880_MIC_EVENT: | |
17001 | alc_mic_automute(codec); | |
17002 | break; | |
17003 | } | |
17004 | } | |
17005 | ||
17006 | #define alc663_mode3_setup alc663_mode1_setup | |
17007 | ||
17008 | static void alc663_mode3_inithook(struct hda_codec *codec) | |
17009 | { | |
17010 | alc663_two_hp_m1_speaker_automute(codec); | |
17011 | alc_mic_automute(codec); | |
17012 | } | |
17013 | /* ***************** Mode4 ******************************/ | |
17014 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | |
17015 | unsigned int res) | |
17016 | { | |
17017 | switch (res >> 26) { | |
17018 | case ALC880_HP_EVENT: | |
17019 | alc663_21jd_two_speaker_automute(codec); | |
17020 | break; | |
17021 | case ALC880_MIC_EVENT: | |
17022 | alc_mic_automute(codec); | |
17023 | break; | |
17024 | } | |
17025 | } | |
17026 | ||
17027 | #define alc663_mode4_setup alc663_mode1_setup | |
17028 | ||
17029 | static void alc663_mode4_inithook(struct hda_codec *codec) | |
17030 | { | |
17031 | alc663_21jd_two_speaker_automute(codec); | |
17032 | alc_mic_automute(codec); | |
17033 | } | |
17034 | /* ***************** Mode5 ******************************/ | |
17035 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | |
17036 | unsigned int res) | |
17037 | { | |
17038 | switch (res >> 26) { | |
17039 | case ALC880_HP_EVENT: | |
17040 | alc663_15jd_two_speaker_automute(codec); | |
17041 | break; | |
17042 | case ALC880_MIC_EVENT: | |
17043 | alc_mic_automute(codec); | |
17044 | break; | |
17045 | } | |
17046 | } | |
17047 | ||
17048 | #define alc663_mode5_setup alc663_mode1_setup | |
17049 | ||
17050 | static void alc663_mode5_inithook(struct hda_codec *codec) | |
17051 | { | |
17052 | alc663_15jd_two_speaker_automute(codec); | |
17053 | alc_mic_automute(codec); | |
17054 | } | |
17055 | /* ***************** Mode6 ******************************/ | |
17056 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | |
17057 | unsigned int res) | |
17058 | { | |
17059 | switch (res >> 26) { | |
17060 | case ALC880_HP_EVENT: | |
17061 | alc663_two_hp_m2_speaker_automute(codec); | |
17062 | break; | |
17063 | case ALC880_MIC_EVENT: | |
17064 | alc_mic_automute(codec); | |
17065 | break; | |
17066 | } | |
17067 | } | |
17068 | ||
17069 | #define alc663_mode6_setup alc663_mode1_setup | |
17070 | ||
17071 | static void alc663_mode6_inithook(struct hda_codec *codec) | |
17072 | { | |
17073 | alc663_two_hp_m2_speaker_automute(codec); | |
17074 | alc_mic_automute(codec); | |
17075 | } | |
17076 | ||
17077 | /* ***************** Mode7 ******************************/ | |
17078 | static void alc663_mode7_unsol_event(struct hda_codec *codec, | |
17079 | unsigned int res) | |
17080 | { | |
17081 | switch (res >> 26) { | |
17082 | case ALC880_HP_EVENT: | |
17083 | alc663_two_hp_m7_speaker_automute(codec); | |
17084 | break; | |
17085 | case ALC880_MIC_EVENT: | |
17086 | alc_mic_automute(codec); | |
17087 | break; | |
17088 | } | |
17089 | } | |
17090 | ||
17091 | #define alc663_mode7_setup alc663_mode1_setup | |
17092 | ||
17093 | static void alc663_mode7_inithook(struct hda_codec *codec) | |
17094 | { | |
17095 | alc663_two_hp_m7_speaker_automute(codec); | |
17096 | alc_mic_automute(codec); | |
17097 | } | |
17098 | ||
17099 | /* ***************** Mode8 ******************************/ | |
17100 | static void alc663_mode8_unsol_event(struct hda_codec *codec, | |
17101 | unsigned int res) | |
17102 | { | |
17103 | switch (res >> 26) { | |
17104 | case ALC880_HP_EVENT: | |
17105 | alc663_two_hp_m8_speaker_automute(codec); | |
17106 | break; | |
17107 | case ALC880_MIC_EVENT: | |
17108 | alc_mic_automute(codec); | |
17109 | break; | |
17110 | } | |
17111 | } | |
17112 | ||
17113 | #define alc663_mode8_setup alc663_m51va_setup | |
17114 | ||
17115 | static void alc663_mode8_inithook(struct hda_codec *codec) | |
17116 | { | |
17117 | alc663_two_hp_m8_speaker_automute(codec); | |
17118 | alc_mic_automute(codec); | |
17119 | } | |
17120 | ||
17121 | static void alc663_g71v_hp_automute(struct hda_codec *codec) | |
17122 | { | |
17123 | unsigned int present; | |
17124 | unsigned char bits; | |
17125 | ||
17126 | present = snd_hda_jack_detect(codec, 0x21); | |
17127 | bits = present ? HDA_AMP_MUTE : 0; | |
17128 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
17129 | HDA_AMP_MUTE, bits); | |
17130 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
17131 | HDA_AMP_MUTE, bits); | |
17132 | } | |
17133 | ||
17134 | static void alc663_g71v_front_automute(struct hda_codec *codec) | |
17135 | { | |
17136 | unsigned int present; | |
17137 | unsigned char bits; | |
17138 | ||
17139 | present = snd_hda_jack_detect(codec, 0x15); | |
17140 | bits = present ? HDA_AMP_MUTE : 0; | |
17141 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
17142 | HDA_AMP_MUTE, bits); | |
17143 | } | |
17144 | ||
17145 | static void alc663_g71v_unsol_event(struct hda_codec *codec, | |
17146 | unsigned int res) | |
17147 | { | |
17148 | switch (res >> 26) { | |
17149 | case ALC880_HP_EVENT: | |
17150 | alc663_g71v_hp_automute(codec); | |
17151 | break; | |
17152 | case ALC880_FRONT_EVENT: | |
17153 | alc663_g71v_front_automute(codec); | |
17154 | break; | |
17155 | case ALC880_MIC_EVENT: | |
17156 | alc_mic_automute(codec); | |
17157 | break; | |
17158 | } | |
17159 | } | |
17160 | ||
17161 | #define alc663_g71v_setup alc663_m51va_setup | |
17162 | ||
17163 | static void alc663_g71v_inithook(struct hda_codec *codec) | |
17164 | { | |
17165 | alc663_g71v_front_automute(codec); | |
17166 | alc663_g71v_hp_automute(codec); | |
17167 | alc_mic_automute(codec); | |
17168 | } | |
17169 | ||
17170 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | |
17171 | unsigned int res) | |
17172 | { | |
17173 | switch (res >> 26) { | |
17174 | case ALC880_HP_EVENT: | |
17175 | alc663_m51va_speaker_automute(codec); | |
17176 | break; | |
17177 | case ALC880_MIC_EVENT: | |
17178 | alc_mic_automute(codec); | |
17179 | break; | |
17180 | } | |
17181 | } | |
17182 | ||
17183 | #define alc663_g50v_setup alc663_m51va_setup | |
17184 | ||
17185 | static void alc663_g50v_inithook(struct hda_codec *codec) | |
17186 | { | |
17187 | alc663_m51va_speaker_automute(codec); | |
17188 | alc_mic_automute(codec); | |
17189 | } | |
17190 | ||
17191 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { | |
17192 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17193 | ALC262_HIPPO_MASTER_SWITCH, | |
17194 | ||
17195 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), | |
17196 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17197 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17198 | ||
17199 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
17200 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17201 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17202 | { } /* end */ | |
17203 | }; | |
17204 | ||
17205 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { | |
17206 | /* Master Playback automatically created from Speaker and Headphone */ | |
17207 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17208 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17209 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17210 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17211 | ||
17212 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17213 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17214 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
17215 | ||
17216 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17217 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17218 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
17219 | { } /* end */ | |
17220 | }; | |
17221 | ||
17222 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
17223 | #define alc662_loopbacks alc880_loopbacks | |
17224 | #endif | |
17225 | ||
17226 | ||
17227 | /* pcm configuration: identical with ALC880 */ | |
17228 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback | |
17229 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture | |
17230 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback | |
17231 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture | |
17232 | ||
17233 | /* | |
17234 | * configuration and preset | |
17235 | */ | |
17236 | static const char *alc662_models[ALC662_MODEL_LAST] = { | |
17237 | [ALC662_3ST_2ch_DIG] = "3stack-dig", | |
17238 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", | |
17239 | [ALC662_3ST_6ch] = "3stack-6ch", | |
17240 | [ALC662_5ST_DIG] = "6stack-dig", | |
17241 | [ALC662_LENOVO_101E] = "lenovo-101e", | |
17242 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", | |
17243 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", | |
17244 | [ALC662_ECS] = "ecs", | |
17245 | [ALC663_ASUS_M51VA] = "m51va", | |
17246 | [ALC663_ASUS_G71V] = "g71v", | |
17247 | [ALC663_ASUS_H13] = "h13", | |
17248 | [ALC663_ASUS_G50V] = "g50v", | |
17249 | [ALC663_ASUS_MODE1] = "asus-mode1", | |
17250 | [ALC662_ASUS_MODE2] = "asus-mode2", | |
17251 | [ALC663_ASUS_MODE3] = "asus-mode3", | |
17252 | [ALC663_ASUS_MODE4] = "asus-mode4", | |
17253 | [ALC663_ASUS_MODE5] = "asus-mode5", | |
17254 | [ALC663_ASUS_MODE6] = "asus-mode6", | |
17255 | [ALC663_ASUS_MODE7] = "asus-mode7", | |
17256 | [ALC663_ASUS_MODE8] = "asus-mode8", | |
17257 | [ALC272_DELL] = "dell", | |
17258 | [ALC272_DELL_ZM1] = "dell-zm1", | |
17259 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", | |
17260 | [ALC662_AUTO] = "auto", | |
17261 | }; | |
17262 | ||
17263 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | |
17264 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), | |
17265 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), | |
17266 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), | |
17267 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), | |
17268 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), | |
17269 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), | |
17270 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | |
17271 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | |
17272 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | |
17273 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), | |
17274 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), | |
17275 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | |
17276 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), | |
17277 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), | |
17278 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), | |
17279 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), | |
17280 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), | |
17281 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), | |
17282 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), | |
17283 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), | |
17284 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), | |
17285 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | |
17286 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | |
17287 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | |
17288 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), | |
17289 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), | |
17290 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), | |
17291 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), | |
17292 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), | |
17293 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), | |
17294 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | |
17295 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | |
17296 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), | |
17297 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), | |
17298 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), | |
17299 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), | |
17300 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ | |
17301 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), | |
17302 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), | |
17303 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), | |
17304 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), | |
17305 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), | |
17306 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), | |
17307 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | |
17308 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | |
17309 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), | |
17310 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), | |
17311 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | |
17312 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), | |
17313 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), | |
17314 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), | |
17315 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ | |
17316 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | |
17317 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | |
17318 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), | |
17319 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), | |
17320 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), | |
17321 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), | |
17322 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | |
17323 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | |
17324 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | |
17325 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", | |
17326 | ALC662_3ST_6ch_DIG), | |
17327 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), | |
17328 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), | |
17329 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", | |
17330 | ALC662_3ST_6ch_DIG), | |
17331 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), | |
17332 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), | |
17333 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), | |
17334 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", | |
17335 | ALC662_3ST_6ch_DIG), | |
17336 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", | |
17337 | ALC663_ASUS_H13), | |
17338 | SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG), | |
17339 | {} | |
17340 | }; | |
17341 | ||
17342 | static struct alc_config_preset alc662_presets[] = { | |
17343 | [ALC662_3ST_2ch_DIG] = { | |
17344 | .mixers = { alc662_3ST_2ch_mixer }, | |
17345 | .init_verbs = { alc662_init_verbs }, | |
17346 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17347 | .dac_nids = alc662_dac_nids, | |
17348 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17349 | .dig_in_nid = ALC662_DIGIN_NID, | |
17350 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17351 | .channel_mode = alc662_3ST_2ch_modes, | |
17352 | .input_mux = &alc662_capture_source, | |
17353 | }, | |
17354 | [ALC662_3ST_6ch_DIG] = { | |
17355 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, | |
17356 | .init_verbs = { alc662_init_verbs }, | |
17357 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17358 | .dac_nids = alc662_dac_nids, | |
17359 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17360 | .dig_in_nid = ALC662_DIGIN_NID, | |
17361 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
17362 | .channel_mode = alc662_3ST_6ch_modes, | |
17363 | .need_dac_fix = 1, | |
17364 | .input_mux = &alc662_capture_source, | |
17365 | }, | |
17366 | [ALC662_3ST_6ch] = { | |
17367 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, | |
17368 | .init_verbs = { alc662_init_verbs }, | |
17369 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17370 | .dac_nids = alc662_dac_nids, | |
17371 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
17372 | .channel_mode = alc662_3ST_6ch_modes, | |
17373 | .need_dac_fix = 1, | |
17374 | .input_mux = &alc662_capture_source, | |
17375 | }, | |
17376 | [ALC662_5ST_DIG] = { | |
17377 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, | |
17378 | .init_verbs = { alc662_init_verbs }, | |
17379 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17380 | .dac_nids = alc662_dac_nids, | |
17381 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17382 | .dig_in_nid = ALC662_DIGIN_NID, | |
17383 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | |
17384 | .channel_mode = alc662_5stack_modes, | |
17385 | .input_mux = &alc662_capture_source, | |
17386 | }, | |
17387 | [ALC662_LENOVO_101E] = { | |
17388 | .mixers = { alc662_lenovo_101e_mixer }, | |
17389 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, | |
17390 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17391 | .dac_nids = alc662_dac_nids, | |
17392 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17393 | .channel_mode = alc662_3ST_2ch_modes, | |
17394 | .input_mux = &alc662_lenovo_101e_capture_source, | |
17395 | .unsol_event = alc662_lenovo_101e_unsol_event, | |
17396 | .init_hook = alc662_lenovo_101e_all_automute, | |
17397 | }, | |
17398 | [ALC662_ASUS_EEEPC_P701] = { | |
17399 | .mixers = { alc662_eeepc_p701_mixer }, | |
17400 | .init_verbs = { alc662_init_verbs, | |
17401 | alc662_eeepc_sue_init_verbs }, | |
17402 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17403 | .dac_nids = alc662_dac_nids, | |
17404 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17405 | .channel_mode = alc662_3ST_2ch_modes, | |
17406 | .unsol_event = alc662_eeepc_unsol_event, | |
17407 | .setup = alc662_eeepc_setup, | |
17408 | .init_hook = alc662_eeepc_inithook, | |
17409 | }, | |
17410 | [ALC662_ASUS_EEEPC_EP20] = { | |
17411 | .mixers = { alc662_eeepc_ep20_mixer, | |
17412 | alc662_chmode_mixer }, | |
17413 | .init_verbs = { alc662_init_verbs, | |
17414 | alc662_eeepc_ep20_sue_init_verbs }, | |
17415 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17416 | .dac_nids = alc662_dac_nids, | |
17417 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
17418 | .channel_mode = alc662_3ST_6ch_modes, | |
17419 | .input_mux = &alc662_lenovo_101e_capture_source, | |
17420 | .unsol_event = alc662_eeepc_unsol_event, | |
17421 | .setup = alc662_eeepc_ep20_setup, | |
17422 | .init_hook = alc662_eeepc_ep20_inithook, | |
17423 | }, | |
17424 | [ALC662_ECS] = { | |
17425 | .mixers = { alc662_ecs_mixer }, | |
17426 | .init_verbs = { alc662_init_verbs, | |
17427 | alc662_ecs_init_verbs }, | |
17428 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17429 | .dac_nids = alc662_dac_nids, | |
17430 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17431 | .channel_mode = alc662_3ST_2ch_modes, | |
17432 | .unsol_event = alc662_eeepc_unsol_event, | |
17433 | .setup = alc662_eeepc_setup, | |
17434 | .init_hook = alc662_eeepc_inithook, | |
17435 | }, | |
17436 | [ALC663_ASUS_M51VA] = { | |
17437 | .mixers = { alc663_m51va_mixer }, | |
17438 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | |
17439 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17440 | .dac_nids = alc662_dac_nids, | |
17441 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17442 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17443 | .channel_mode = alc662_3ST_2ch_modes, | |
17444 | .unsol_event = alc663_m51va_unsol_event, | |
17445 | .setup = alc663_m51va_setup, | |
17446 | .init_hook = alc663_m51va_inithook, | |
17447 | }, | |
17448 | [ALC663_ASUS_G71V] = { | |
17449 | .mixers = { alc663_g71v_mixer }, | |
17450 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, | |
17451 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17452 | .dac_nids = alc662_dac_nids, | |
17453 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17454 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17455 | .channel_mode = alc662_3ST_2ch_modes, | |
17456 | .unsol_event = alc663_g71v_unsol_event, | |
17457 | .setup = alc663_g71v_setup, | |
17458 | .init_hook = alc663_g71v_inithook, | |
17459 | }, | |
17460 | [ALC663_ASUS_H13] = { | |
17461 | .mixers = { alc663_m51va_mixer }, | |
17462 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | |
17463 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17464 | .dac_nids = alc662_dac_nids, | |
17465 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17466 | .channel_mode = alc662_3ST_2ch_modes, | |
17467 | .unsol_event = alc663_m51va_unsol_event, | |
17468 | .init_hook = alc663_m51va_inithook, | |
17469 | }, | |
17470 | [ALC663_ASUS_G50V] = { | |
17471 | .mixers = { alc663_g50v_mixer }, | |
17472 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, | |
17473 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17474 | .dac_nids = alc662_dac_nids, | |
17475 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17476 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
17477 | .channel_mode = alc662_3ST_6ch_modes, | |
17478 | .input_mux = &alc663_capture_source, | |
17479 | .unsol_event = alc663_g50v_unsol_event, | |
17480 | .setup = alc663_g50v_setup, | |
17481 | .init_hook = alc663_g50v_inithook, | |
17482 | }, | |
17483 | [ALC663_ASUS_MODE1] = { | |
17484 | .mixers = { alc663_m51va_mixer }, | |
17485 | .cap_mixer = alc662_auto_capture_mixer, | |
17486 | .init_verbs = { alc662_init_verbs, | |
17487 | alc663_21jd_amic_init_verbs }, | |
17488 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17489 | .hp_nid = 0x03, | |
17490 | .dac_nids = alc662_dac_nids, | |
17491 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17492 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17493 | .channel_mode = alc662_3ST_2ch_modes, | |
17494 | .unsol_event = alc663_mode1_unsol_event, | |
17495 | .setup = alc663_mode1_setup, | |
17496 | .init_hook = alc663_mode1_inithook, | |
17497 | }, | |
17498 | [ALC662_ASUS_MODE2] = { | |
17499 | .mixers = { alc662_1bjd_mixer }, | |
17500 | .cap_mixer = alc662_auto_capture_mixer, | |
17501 | .init_verbs = { alc662_init_verbs, | |
17502 | alc662_1bjd_amic_init_verbs }, | |
17503 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17504 | .dac_nids = alc662_dac_nids, | |
17505 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17506 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17507 | .channel_mode = alc662_3ST_2ch_modes, | |
17508 | .unsol_event = alc662_mode2_unsol_event, | |
17509 | .setup = alc662_mode2_setup, | |
17510 | .init_hook = alc662_mode2_inithook, | |
17511 | }, | |
17512 | [ALC663_ASUS_MODE3] = { | |
17513 | .mixers = { alc663_two_hp_m1_mixer }, | |
17514 | .cap_mixer = alc662_auto_capture_mixer, | |
17515 | .init_verbs = { alc662_init_verbs, | |
17516 | alc663_two_hp_amic_m1_init_verbs }, | |
17517 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17518 | .hp_nid = 0x03, | |
17519 | .dac_nids = alc662_dac_nids, | |
17520 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17521 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17522 | .channel_mode = alc662_3ST_2ch_modes, | |
17523 | .unsol_event = alc663_mode3_unsol_event, | |
17524 | .setup = alc663_mode3_setup, | |
17525 | .init_hook = alc663_mode3_inithook, | |
17526 | }, | |
17527 | [ALC663_ASUS_MODE4] = { | |
17528 | .mixers = { alc663_asus_21jd_clfe_mixer }, | |
17529 | .cap_mixer = alc662_auto_capture_mixer, | |
17530 | .init_verbs = { alc662_init_verbs, | |
17531 | alc663_21jd_amic_init_verbs}, | |
17532 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17533 | .hp_nid = 0x03, | |
17534 | .dac_nids = alc662_dac_nids, | |
17535 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17536 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17537 | .channel_mode = alc662_3ST_2ch_modes, | |
17538 | .unsol_event = alc663_mode4_unsol_event, | |
17539 | .setup = alc663_mode4_setup, | |
17540 | .init_hook = alc663_mode4_inithook, | |
17541 | }, | |
17542 | [ALC663_ASUS_MODE5] = { | |
17543 | .mixers = { alc663_asus_15jd_clfe_mixer }, | |
17544 | .cap_mixer = alc662_auto_capture_mixer, | |
17545 | .init_verbs = { alc662_init_verbs, | |
17546 | alc663_15jd_amic_init_verbs }, | |
17547 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17548 | .hp_nid = 0x03, | |
17549 | .dac_nids = alc662_dac_nids, | |
17550 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17551 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17552 | .channel_mode = alc662_3ST_2ch_modes, | |
17553 | .unsol_event = alc663_mode5_unsol_event, | |
17554 | .setup = alc663_mode5_setup, | |
17555 | .init_hook = alc663_mode5_inithook, | |
17556 | }, | |
17557 | [ALC663_ASUS_MODE6] = { | |
17558 | .mixers = { alc663_two_hp_m2_mixer }, | |
17559 | .cap_mixer = alc662_auto_capture_mixer, | |
17560 | .init_verbs = { alc662_init_verbs, | |
17561 | alc663_two_hp_amic_m2_init_verbs }, | |
17562 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17563 | .hp_nid = 0x03, | |
17564 | .dac_nids = alc662_dac_nids, | |
17565 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17566 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17567 | .channel_mode = alc662_3ST_2ch_modes, | |
17568 | .unsol_event = alc663_mode6_unsol_event, | |
17569 | .setup = alc663_mode6_setup, | |
17570 | .init_hook = alc663_mode6_inithook, | |
17571 | }, | |
17572 | [ALC663_ASUS_MODE7] = { | |
17573 | .mixers = { alc663_mode7_mixer }, | |
17574 | .cap_mixer = alc662_auto_capture_mixer, | |
17575 | .init_verbs = { alc662_init_verbs, | |
17576 | alc663_mode7_init_verbs }, | |
17577 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17578 | .hp_nid = 0x03, | |
17579 | .dac_nids = alc662_dac_nids, | |
17580 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17581 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17582 | .channel_mode = alc662_3ST_2ch_modes, | |
17583 | .unsol_event = alc663_mode7_unsol_event, | |
17584 | .setup = alc663_mode7_setup, | |
17585 | .init_hook = alc663_mode7_inithook, | |
17586 | }, | |
17587 | [ALC663_ASUS_MODE8] = { | |
17588 | .mixers = { alc663_mode8_mixer }, | |
17589 | .cap_mixer = alc662_auto_capture_mixer, | |
17590 | .init_verbs = { alc662_init_verbs, | |
17591 | alc663_mode8_init_verbs }, | |
17592 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
17593 | .hp_nid = 0x03, | |
17594 | .dac_nids = alc662_dac_nids, | |
17595 | .dig_out_nid = ALC662_DIGOUT_NID, | |
17596 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17597 | .channel_mode = alc662_3ST_2ch_modes, | |
17598 | .unsol_event = alc663_mode8_unsol_event, | |
17599 | .setup = alc663_mode8_setup, | |
17600 | .init_hook = alc663_mode8_inithook, | |
17601 | }, | |
17602 | [ALC272_DELL] = { | |
17603 | .mixers = { alc663_m51va_mixer }, | |
17604 | .cap_mixer = alc272_auto_capture_mixer, | |
17605 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, | |
17606 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
17607 | .dac_nids = alc662_dac_nids, | |
17608 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17609 | .adc_nids = alc272_adc_nids, | |
17610 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), | |
17611 | .capsrc_nids = alc272_capsrc_nids, | |
17612 | .channel_mode = alc662_3ST_2ch_modes, | |
17613 | .unsol_event = alc663_m51va_unsol_event, | |
17614 | .setup = alc663_m51va_setup, | |
17615 | .init_hook = alc663_m51va_inithook, | |
17616 | }, | |
17617 | [ALC272_DELL_ZM1] = { | |
17618 | .mixers = { alc663_m51va_mixer }, | |
17619 | .cap_mixer = alc662_auto_capture_mixer, | |
17620 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, | |
17621 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
17622 | .dac_nids = alc662_dac_nids, | |
17623 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17624 | .adc_nids = alc662_adc_nids, | |
17625 | .num_adc_nids = 1, | |
17626 | .capsrc_nids = alc662_capsrc_nids, | |
17627 | .channel_mode = alc662_3ST_2ch_modes, | |
17628 | .unsol_event = alc663_m51va_unsol_event, | |
17629 | .setup = alc663_m51va_setup, | |
17630 | .init_hook = alc663_m51va_inithook, | |
17631 | }, | |
17632 | [ALC272_SAMSUNG_NC10] = { | |
17633 | .mixers = { alc272_nc10_mixer }, | |
17634 | .init_verbs = { alc662_init_verbs, | |
17635 | alc663_21jd_amic_init_verbs }, | |
17636 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
17637 | .dac_nids = alc272_dac_nids, | |
17638 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
17639 | .channel_mode = alc662_3ST_2ch_modes, | |
17640 | /*.input_mux = &alc272_nc10_capture_source,*/ | |
17641 | .unsol_event = alc663_mode4_unsol_event, | |
17642 | .setup = alc663_mode4_setup, | |
17643 | .init_hook = alc663_mode4_inithook, | |
17644 | }, | |
17645 | }; | |
17646 | ||
17647 | ||
17648 | /* | |
17649 | * BIOS auto configuration | |
17650 | */ | |
17651 | ||
17652 | /* convert from MIX nid to DAC */ | |
17653 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) | |
17654 | { | |
17655 | if (nid == 0x0f) | |
17656 | return 0x02; | |
17657 | else if (nid >= 0x0c && nid <= 0x0e) | |
17658 | return nid - 0x0c + 0x02; | |
17659 | else | |
17660 | return 0; | |
17661 | } | |
17662 | ||
17663 | /* get MIX nid connected to the given pin targeted to DAC */ | |
17664 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, | |
17665 | hda_nid_t dac) | |
17666 | { | |
17667 | hda_nid_t mix[4]; | |
17668 | int i, num; | |
17669 | ||
17670 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); | |
17671 | for (i = 0; i < num; i++) { | |
17672 | if (alc662_mix_to_dac(mix[i]) == dac) | |
17673 | return mix[i]; | |
17674 | } | |
17675 | return 0; | |
17676 | } | |
17677 | ||
17678 | /* look for an empty DAC slot */ | |
17679 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |
17680 | { | |
17681 | struct alc_spec *spec = codec->spec; | |
17682 | hda_nid_t srcs[5]; | |
17683 | int i, j, num; | |
17684 | ||
17685 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); | |
17686 | if (num < 0) | |
17687 | return 0; | |
17688 | for (i = 0; i < num; i++) { | |
17689 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); | |
17690 | if (!nid) | |
17691 | continue; | |
17692 | for (j = 0; j < spec->multiout.num_dacs; j++) | |
17693 | if (spec->multiout.dac_nids[j] == nid) | |
17694 | break; | |
17695 | if (j >= spec->multiout.num_dacs) | |
17696 | return nid; | |
17697 | } | |
17698 | return 0; | |
17699 | } | |
17700 | ||
17701 | /* fill in the dac_nids table from the parsed pin configuration */ | |
17702 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, | |
17703 | const struct auto_pin_cfg *cfg) | |
17704 | { | |
17705 | struct alc_spec *spec = codec->spec; | |
17706 | int i; | |
17707 | hda_nid_t dac; | |
17708 | ||
17709 | spec->multiout.dac_nids = spec->private_dac_nids; | |
17710 | for (i = 0; i < cfg->line_outs; i++) { | |
17711 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); | |
17712 | if (!dac) | |
17713 | continue; | |
17714 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
17715 | } | |
17716 | return 0; | |
17717 | } | |
17718 | ||
17719 | static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, | |
17720 | hda_nid_t nid, unsigned int chs) | |
17721 | { | |
17722 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | |
17723 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | |
17724 | } | |
17725 | ||
17726 | static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, | |
17727 | hda_nid_t nid, unsigned int chs) | |
17728 | { | |
17729 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | |
17730 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); | |
17731 | } | |
17732 | ||
17733 | #define alc662_add_stereo_vol(spec, pfx, nid) \ | |
17734 | alc662_add_vol_ctl(spec, pfx, nid, 3) | |
17735 | #define alc662_add_stereo_sw(spec, pfx, nid) \ | |
17736 | alc662_add_sw_ctl(spec, pfx, nid, 3) | |
17737 | ||
17738 | /* add playback controls from the parsed DAC table */ | |
17739 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, | |
17740 | const struct auto_pin_cfg *cfg) | |
17741 | { | |
17742 | struct alc_spec *spec = codec->spec; | |
17743 | static const char *chname[4] = { | |
17744 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
17745 | }; | |
17746 | hda_nid_t nid, mix; | |
17747 | int i, err; | |
17748 | ||
17749 | for (i = 0; i < cfg->line_outs; i++) { | |
17750 | nid = spec->multiout.dac_nids[i]; | |
17751 | if (!nid) | |
17752 | continue; | |
17753 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); | |
17754 | if (!mix) | |
17755 | continue; | |
17756 | if (i == 2) { | |
17757 | /* Center/LFE */ | |
17758 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); | |
17759 | if (err < 0) | |
17760 | return err; | |
17761 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); | |
17762 | if (err < 0) | |
17763 | return err; | |
17764 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); | |
17765 | if (err < 0) | |
17766 | return err; | |
17767 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); | |
17768 | if (err < 0) | |
17769 | return err; | |
17770 | } else { | |
17771 | const char *pfx; | |
17772 | if (cfg->line_outs == 1 && | |
17773 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | |
17774 | if (cfg->hp_outs) | |
17775 | pfx = "Speaker"; | |
17776 | else | |
17777 | pfx = "PCM"; | |
17778 | } else | |
17779 | pfx = chname[i]; | |
17780 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); | |
17781 | if (err < 0) | |
17782 | return err; | |
17783 | if (cfg->line_outs == 1 && | |
17784 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
17785 | pfx = "Speaker"; | |
17786 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); | |
17787 | if (err < 0) | |
17788 | return err; | |
17789 | } | |
17790 | } | |
17791 | return 0; | |
17792 | } | |
17793 | ||
17794 | /* add playback controls for speaker and HP outputs */ | |
17795 | /* return DAC nid if any new DAC is assigned */ | |
17796 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |
17797 | const char *pfx) | |
17798 | { | |
17799 | struct alc_spec *spec = codec->spec; | |
17800 | hda_nid_t nid, mix; | |
17801 | int err; | |
17802 | ||
17803 | if (!pin) | |
17804 | return 0; | |
17805 | nid = alc662_look_for_dac(codec, pin); | |
17806 | if (!nid) { | |
17807 | /* the corresponding DAC is already occupied */ | |
17808 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) | |
17809 | return 0; /* no way */ | |
17810 | /* create a switch only */ | |
17811 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | |
17812 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
17813 | } | |
17814 | ||
17815 | mix = alc662_dac_to_mix(codec, pin, nid); | |
17816 | if (!mix) | |
17817 | return 0; | |
17818 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); | |
17819 | if (err < 0) | |
17820 | return err; | |
17821 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); | |
17822 | if (err < 0) | |
17823 | return err; | |
17824 | return nid; | |
17825 | } | |
17826 | ||
17827 | /* create playback/capture controls for input pins */ | |
17828 | #define alc662_auto_create_input_ctls \ | |
17829 | alc882_auto_create_input_ctls | |
17830 | ||
17831 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | |
17832 | hda_nid_t nid, int pin_type, | |
17833 | hda_nid_t dac) | |
17834 | { | |
17835 | int i, num; | |
17836 | hda_nid_t srcs[4]; | |
17837 | ||
17838 | alc_set_pin_output(codec, nid, pin_type); | |
17839 | /* need the manual connection? */ | |
17840 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); | |
17841 | if (num <= 1) | |
17842 | return; | |
17843 | for (i = 0; i < num; i++) { | |
17844 | if (alc662_mix_to_dac(srcs[i]) != dac) | |
17845 | continue; | |
17846 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); | |
17847 | return; | |
17848 | } | |
17849 | } | |
17850 | ||
17851 | static void alc662_auto_init_multi_out(struct hda_codec *codec) | |
17852 | { | |
17853 | struct alc_spec *spec = codec->spec; | |
17854 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
17855 | int i; | |
17856 | ||
17857 | for (i = 0; i <= HDA_SIDE; i++) { | |
17858 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
17859 | if (nid) | |
17860 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, | |
17861 | spec->multiout.dac_nids[i]); | |
17862 | } | |
17863 | } | |
17864 | ||
17865 | static void alc662_auto_init_hp_out(struct hda_codec *codec) | |
17866 | { | |
17867 | struct alc_spec *spec = codec->spec; | |
17868 | hda_nid_t pin; | |
17869 | ||
17870 | pin = spec->autocfg.hp_pins[0]; | |
17871 | if (pin) | |
17872 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, | |
17873 | spec->multiout.hp_nid); | |
17874 | pin = spec->autocfg.speaker_pins[0]; | |
17875 | if (pin) | |
17876 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, | |
17877 | spec->multiout.extra_out_nid[0]); | |
17878 | } | |
17879 | ||
17880 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID | |
17881 | ||
17882 | static void alc662_auto_init_analog_input(struct hda_codec *codec) | |
17883 | { | |
17884 | struct alc_spec *spec = codec->spec; | |
17885 | int i; | |
17886 | ||
17887 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
17888 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
17889 | if (alc_is_input_pin(codec, nid)) { | |
17890 | alc_set_input_pin(codec, nid, i); | |
17891 | if (nid != ALC662_PIN_CD_NID && | |
17892 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
17893 | snd_hda_codec_write(codec, nid, 0, | |
17894 | AC_VERB_SET_AMP_GAIN_MUTE, | |
17895 | AMP_OUT_MUTE); | |
17896 | } | |
17897 | } | |
17898 | } | |
17899 | ||
17900 | #define alc662_auto_init_input_src alc882_auto_init_input_src | |
17901 | ||
17902 | static int alc662_parse_auto_config(struct hda_codec *codec) | |
17903 | { | |
17904 | struct alc_spec *spec = codec->spec; | |
17905 | int err; | |
17906 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; | |
17907 | ||
17908 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
17909 | alc662_ignore); | |
17910 | if (err < 0) | |
17911 | return err; | |
17912 | if (!spec->autocfg.line_outs) | |
17913 | return 0; /* can't find valid BIOS pin config */ | |
17914 | ||
17915 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); | |
17916 | if (err < 0) | |
17917 | return err; | |
17918 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); | |
17919 | if (err < 0) | |
17920 | return err; | |
17921 | err = alc662_auto_create_extra_out(codec, | |
17922 | spec->autocfg.speaker_pins[0], | |
17923 | "Speaker"); | |
17924 | if (err < 0) | |
17925 | return err; | |
17926 | if (err) | |
17927 | spec->multiout.extra_out_nid[0] = err; | |
17928 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], | |
17929 | "Headphone"); | |
17930 | if (err < 0) | |
17931 | return err; | |
17932 | if (err) | |
17933 | spec->multiout.hp_nid = err; | |
17934 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); | |
17935 | if (err < 0) | |
17936 | return err; | |
17937 | ||
17938 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
17939 | ||
17940 | if (spec->autocfg.dig_outs) | |
17941 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; | |
17942 | ||
17943 | if (spec->kctls.list) | |
17944 | add_mixer(spec, spec->kctls.list); | |
17945 | ||
17946 | spec->num_mux_defs = 1; | |
17947 | spec->input_mux = &spec->private_imux[0]; | |
17948 | ||
17949 | add_verb(spec, alc662_auto_init_verbs); | |
17950 | if (codec->vendor_id == 0x10ec0663) | |
17951 | add_verb(spec, alc663_auto_init_verbs); | |
17952 | ||
17953 | err = alc_auto_add_mic_boost(codec); | |
17954 | if (err < 0) | |
17955 | return err; | |
17956 | ||
17957 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); | |
17958 | ||
17959 | return 1; | |
17960 | } | |
17961 | ||
17962 | /* additional initialization for auto-configuration model */ | |
17963 | static void alc662_auto_init(struct hda_codec *codec) | |
17964 | { | |
17965 | struct alc_spec *spec = codec->spec; | |
17966 | alc662_auto_init_multi_out(codec); | |
17967 | alc662_auto_init_hp_out(codec); | |
17968 | alc662_auto_init_analog_input(codec); | |
17969 | alc662_auto_init_input_src(codec); | |
17970 | if (spec->unsol_event) | |
17971 | alc_inithook(codec); | |
17972 | } | |
17973 | ||
17974 | static int patch_alc662(struct hda_codec *codec) | |
17975 | { | |
17976 | struct alc_spec *spec; | |
17977 | int err, board_config; | |
17978 | ||
17979 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
17980 | if (!spec) | |
17981 | return -ENOMEM; | |
17982 | ||
17983 | codec->spec = spec; | |
17984 | ||
17985 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | |
17986 | ||
17987 | if (alc_read_coef_idx(codec, 0)==0x8020){ | |
17988 | kfree(codec->chip_name); | |
17989 | codec->chip_name = kstrdup("ALC661", GFP_KERNEL); | |
17990 | if (!codec->chip_name) { | |
17991 | alc_free(codec); | |
17992 | return -ENOMEM; | |
17993 | } | |
17994 | } | |
17995 | ||
17996 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, | |
17997 | alc662_models, | |
17998 | alc662_cfg_tbl); | |
17999 | if (board_config < 0) { | |
18000 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
18001 | codec->chip_name); | |
18002 | board_config = ALC662_AUTO; | |
18003 | } | |
18004 | ||
18005 | if (board_config == ALC662_AUTO) { | |
18006 | /* automatic parse from the BIOS config */ | |
18007 | err = alc662_parse_auto_config(codec); | |
18008 | if (err < 0) { | |
18009 | alc_free(codec); | |
18010 | return err; | |
18011 | } else if (!err) { | |
18012 | printk(KERN_INFO | |
18013 | "hda_codec: Cannot set up configuration " | |
18014 | "from BIOS. Using base mode...\n"); | |
18015 | board_config = ALC662_3ST_2ch_DIG; | |
18016 | } | |
18017 | } | |
18018 | ||
18019 | err = snd_hda_attach_beep_device(codec, 0x1); | |
18020 | if (err < 0) { | |
18021 | alc_free(codec); | |
18022 | return err; | |
18023 | } | |
18024 | ||
18025 | if (board_config != ALC662_AUTO) | |
18026 | setup_preset(codec, &alc662_presets[board_config]); | |
18027 | ||
18028 | spec->stream_analog_playback = &alc662_pcm_analog_playback; | |
18029 | spec->stream_analog_capture = &alc662_pcm_analog_capture; | |
18030 | ||
18031 | spec->stream_digital_playback = &alc662_pcm_digital_playback; | |
18032 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | |
18033 | ||
18034 | if (!spec->adc_nids) { | |
18035 | spec->adc_nids = alc662_adc_nids; | |
18036 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | |
18037 | } | |
18038 | if (!spec->capsrc_nids) | |
18039 | spec->capsrc_nids = alc662_capsrc_nids; | |
18040 | ||
18041 | if (!spec->cap_mixer) | |
18042 | set_capture_mixer(codec); | |
18043 | if (codec->vendor_id == 0x10ec0662) | |
18044 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
18045 | else | |
18046 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | |
18047 | ||
18048 | spec->vmaster_nid = 0x02; | |
18049 | ||
18050 | codec->patch_ops = alc_patch_ops; | |
18051 | if (board_config == ALC662_AUTO) | |
18052 | spec->init_hook = alc662_auto_init; | |
18053 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
18054 | if (!spec->loopback.amplist) | |
18055 | spec->loopback.amplist = alc662_loopbacks; | |
18056 | #endif | |
18057 | codec->proc_widget_hook = print_realtek_coef; | |
18058 | ||
18059 | return 0; | |
18060 | } | |
18061 | ||
18062 | static int patch_alc888(struct hda_codec *codec) | |
18063 | { | |
18064 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ | |
18065 | kfree(codec->chip_name); | |
18066 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | |
18067 | if (!codec->chip_name) { | |
18068 | alc_free(codec); | |
18069 | return -ENOMEM; | |
18070 | } | |
18071 | return patch_alc662(codec); | |
18072 | } | |
18073 | return patch_alc882(codec); | |
18074 | } | |
18075 | ||
18076 | /* | |
18077 | * patch entries | |
18078 | */ | |
18079 | static struct hda_codec_preset snd_hda_preset_realtek[] = { | |
18080 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, | |
18081 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, | |
18082 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, | |
18083 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, | |
18084 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, | |
18085 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, | |
18086 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, | |
18087 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, | |
18088 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", | |
18089 | .patch = patch_alc861 }, | |
18090 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, | |
18091 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | |
18092 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | |
18093 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", | |
18094 | .patch = patch_alc882 }, | |
18095 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", | |
18096 | .patch = patch_alc662 }, | |
18097 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, | |
18098 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, | |
18099 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, | |
18100 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, | |
18101 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", | |
18102 | .patch = patch_alc882 }, | |
18103 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | |
18104 | .patch = patch_alc882 }, | |
18105 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | |
18106 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, | |
18107 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | |
18108 | .patch = patch_alc882 }, | |
18109 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, | |
18110 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, | |
18111 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, | |
18112 | {} /* terminator */ | |
18113 | }; | |
18114 | ||
18115 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); | |
18116 | ||
18117 | MODULE_LICENSE("GPL"); | |
18118 | MODULE_DESCRIPTION("Realtek HD-audio codec"); | |
18119 | ||
18120 | static struct hda_codec_preset_list realtek_list = { | |
18121 | .preset = snd_hda_preset_realtek, | |
18122 | .owner = THIS_MODULE, | |
18123 | }; | |
18124 | ||
18125 | static int __init patch_realtek_init(void) | |
18126 | { | |
18127 | return snd_hda_add_codec_preset(&realtek_list); | |
18128 | } | |
18129 | ||
18130 | static void __exit patch_realtek_exit(void) | |
18131 | { | |
18132 | snd_hda_delete_codec_preset(&realtek_list); | |
18133 | } | |
18134 | ||
18135 | module_init(patch_realtek_init) | |
18136 | module_exit(patch_realtek_exit) |