ALSA: hda - Fix Realtek's chained fixup checks
[linux/fpc-iii.git] / sound / pci / hda / patch_realtek.c
blobc82979a8cd0930026e84eced9fa684d4c4ccac84
1 /*
2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
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>
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.
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.
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
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include <sound/jack.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
34 #include "hda_beep.h"
36 #define ALC880_FRONT_EVENT 0x01
37 #define ALC880_DCVOL_EVENT 0x02
38 #define ALC880_HP_EVENT 0x04
39 #define ALC880_MIC_EVENT 0x08
41 /* ALC880 board config type */
42 enum {
43 ALC880_3ST,
44 ALC880_3ST_DIG,
45 ALC880_5ST,
46 ALC880_5ST_DIG,
47 ALC880_W810,
48 ALC880_Z71V,
49 ALC880_6ST,
50 ALC880_6ST_DIG,
51 ALC880_F1734,
52 ALC880_ASUS,
53 ALC880_ASUS_DIG,
54 ALC880_ASUS_W1V,
55 ALC880_ASUS_DIG2,
56 ALC880_FUJITSU,
57 ALC880_UNIWILL_DIG,
58 ALC880_UNIWILL,
59 ALC880_UNIWILL_P53,
60 ALC880_CLEVO,
61 ALC880_TCL_S700,
62 ALC880_LG,
63 ALC880_LG_LW,
64 ALC880_MEDION_RIM,
65 #ifdef CONFIG_SND_DEBUG
66 ALC880_TEST,
67 #endif
68 ALC880_AUTO,
69 ALC880_MODEL_LAST /* last tag */
72 /* ALC260 models */
73 enum {
74 ALC260_BASIC,
75 ALC260_HP,
76 ALC260_HP_DC7600,
77 ALC260_HP_3013,
78 ALC260_FUJITSU_S702X,
79 ALC260_ACER,
80 ALC260_WILL,
81 ALC260_REPLACER_672V,
82 ALC260_FAVORIT100,
83 #ifdef CONFIG_SND_DEBUG
84 ALC260_TEST,
85 #endif
86 ALC260_AUTO,
87 ALC260_MODEL_LAST /* last tag */
90 /* ALC262 models */
91 enum {
92 ALC262_BASIC,
93 ALC262_HIPPO,
94 ALC262_HIPPO_1,
95 ALC262_FUJITSU,
96 ALC262_HP_BPC,
97 ALC262_HP_BPC_D7000_WL,
98 ALC262_HP_BPC_D7000_WF,
99 ALC262_HP_TC_T5735,
100 ALC262_HP_RP5700,
101 ALC262_BENQ_ED8,
102 ALC262_SONY_ASSAMD,
103 ALC262_BENQ_T31,
104 ALC262_ULTRA,
105 ALC262_LENOVO_3000,
106 ALC262_NEC,
107 ALC262_TOSHIBA_S06,
108 ALC262_TOSHIBA_RX1,
109 ALC262_TYAN,
110 ALC262_AUTO,
111 ALC262_MODEL_LAST /* last tag */
114 /* ALC268 models */
115 enum {
116 ALC267_QUANTA_IL1,
117 ALC268_3ST,
118 ALC268_TOSHIBA,
119 ALC268_ACER,
120 ALC268_ACER_DMIC,
121 ALC268_ACER_ASPIRE_ONE,
122 ALC268_DELL,
123 ALC268_ZEPTO,
124 #ifdef CONFIG_SND_DEBUG
125 ALC268_TEST,
126 #endif
127 ALC268_AUTO,
128 ALC268_MODEL_LAST /* last tag */
131 /* ALC269 models */
132 enum {
133 ALC269_BASIC,
134 ALC269_QUANTA_FL1,
135 ALC269_AMIC,
136 ALC269_DMIC,
137 ALC269VB_AMIC,
138 ALC269VB_DMIC,
139 ALC269_FUJITSU,
140 ALC269_LIFEBOOK,
141 ALC271_ACER,
142 ALC269_AUTO,
143 ALC269_MODEL_LAST /* last tag */
146 /* ALC861 models */
147 enum {
148 ALC861_3ST,
149 ALC660_3ST,
150 ALC861_3ST_DIG,
151 ALC861_6ST_DIG,
152 ALC861_UNIWILL_M31,
153 ALC861_TOSHIBA,
154 ALC861_ASUS,
155 ALC861_ASUS_LAPTOP,
156 ALC861_AUTO,
157 ALC861_MODEL_LAST,
160 /* ALC861-VD models */
161 enum {
162 ALC660VD_3ST,
163 ALC660VD_3ST_DIG,
164 ALC660VD_ASUS_V1S,
165 ALC861VD_3ST,
166 ALC861VD_3ST_DIG,
167 ALC861VD_6ST_DIG,
168 ALC861VD_LENOVO,
169 ALC861VD_DALLAS,
170 ALC861VD_HP,
171 ALC861VD_AUTO,
172 ALC861VD_MODEL_LAST,
175 /* ALC662 models */
176 enum {
177 ALC662_3ST_2ch_DIG,
178 ALC662_3ST_6ch_DIG,
179 ALC662_3ST_6ch,
180 ALC662_5ST_DIG,
181 ALC662_LENOVO_101E,
182 ALC662_ASUS_EEEPC_P701,
183 ALC662_ASUS_EEEPC_EP20,
184 ALC663_ASUS_M51VA,
185 ALC663_ASUS_G71V,
186 ALC663_ASUS_H13,
187 ALC663_ASUS_G50V,
188 ALC662_ECS,
189 ALC663_ASUS_MODE1,
190 ALC662_ASUS_MODE2,
191 ALC663_ASUS_MODE3,
192 ALC663_ASUS_MODE4,
193 ALC663_ASUS_MODE5,
194 ALC663_ASUS_MODE6,
195 ALC663_ASUS_MODE7,
196 ALC663_ASUS_MODE8,
197 ALC272_DELL,
198 ALC272_DELL_ZM1,
199 ALC272_SAMSUNG_NC10,
200 ALC662_AUTO,
201 ALC662_MODEL_LAST,
204 /* ALC882 models */
205 enum {
206 ALC882_3ST_DIG,
207 ALC882_6ST_DIG,
208 ALC882_ARIMA,
209 ALC882_W2JC,
210 ALC882_TARGA,
211 ALC882_ASUS_A7J,
212 ALC882_ASUS_A7M,
213 ALC885_MACPRO,
214 ALC885_MBA21,
215 ALC885_MBP3,
216 ALC885_MB5,
217 ALC885_MACMINI3,
218 ALC885_IMAC24,
219 ALC885_IMAC91,
220 ALC883_3ST_2ch_DIG,
221 ALC883_3ST_6ch_DIG,
222 ALC883_3ST_6ch,
223 ALC883_6ST_DIG,
224 ALC883_TARGA_DIG,
225 ALC883_TARGA_2ch_DIG,
226 ALC883_TARGA_8ch_DIG,
227 ALC883_ACER,
228 ALC883_ACER_ASPIRE,
229 ALC888_ACER_ASPIRE_4930G,
230 ALC888_ACER_ASPIRE_6530G,
231 ALC888_ACER_ASPIRE_8930G,
232 ALC888_ACER_ASPIRE_7730G,
233 ALC883_MEDION,
234 ALC883_MEDION_WIM2160,
235 ALC883_LAPTOP_EAPD,
236 ALC883_LENOVO_101E_2ch,
237 ALC883_LENOVO_NB0763,
238 ALC888_LENOVO_MS7195_DIG,
239 ALC888_LENOVO_SKY,
240 ALC883_HAIER_W66,
241 ALC888_3ST_HP,
242 ALC888_6ST_DELL,
243 ALC883_MITAC,
244 ALC883_CLEVO_M540R,
245 ALC883_CLEVO_M720,
246 ALC883_FUJITSU_PI2515,
247 ALC888_FUJITSU_XA3530,
248 ALC883_3ST_6ch_INTEL,
249 ALC889A_INTEL,
250 ALC889_INTEL,
251 ALC888_ASUS_M90V,
252 ALC888_ASUS_EEE1601,
253 ALC889A_MB31,
254 ALC1200_ASUS_P5Q,
255 ALC883_SONY_VAIO_TT,
256 ALC882_AUTO,
257 ALC882_MODEL_LAST,
260 /* ALC680 models */
261 enum {
262 ALC680_BASE,
263 ALC680_AUTO,
264 ALC680_MODEL_LAST,
267 /* for GPIO Poll */
268 #define GPIO_MASK 0x03
270 /* extra amp-initialization sequence types */
271 enum {
272 ALC_INIT_NONE,
273 ALC_INIT_DEFAULT,
274 ALC_INIT_GPIO1,
275 ALC_INIT_GPIO2,
276 ALC_INIT_GPIO3,
279 struct alc_mic_route {
280 hda_nid_t pin;
281 unsigned char mux_idx;
282 unsigned char amix_idx;
285 #define MUX_IDX_UNDEF ((unsigned char)-1)
287 struct alc_customize_define {
288 unsigned int sku_cfg;
289 unsigned char port_connectivity;
290 unsigned char check_sum;
291 unsigned char customization;
292 unsigned char external_amp;
293 unsigned int enable_pcbeep:1;
294 unsigned int platform_type:1;
295 unsigned int swap:1;
296 unsigned int override:1;
297 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
300 struct alc_fixup;
302 struct alc_spec {
303 /* codec parameterization */
304 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
305 unsigned int num_mixers;
306 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
307 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
309 const struct hda_verb *init_verbs[10]; /* initialization verbs
310 * don't forget NULL
311 * termination!
313 unsigned int num_init_verbs;
315 char stream_name_analog[32]; /* analog PCM stream */
316 struct hda_pcm_stream *stream_analog_playback;
317 struct hda_pcm_stream *stream_analog_capture;
318 struct hda_pcm_stream *stream_analog_alt_playback;
319 struct hda_pcm_stream *stream_analog_alt_capture;
321 char stream_name_digital[32]; /* digital PCM stream */
322 struct hda_pcm_stream *stream_digital_playback;
323 struct hda_pcm_stream *stream_digital_capture;
325 /* playback */
326 struct hda_multi_out multiout; /* playback set-up
327 * max_channels, dacs must be set
328 * dig_out_nid and hp_nid are optional
330 hda_nid_t alt_dac_nid;
331 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
332 int dig_out_type;
334 /* capture */
335 unsigned int num_adc_nids;
336 hda_nid_t *adc_nids;
337 hda_nid_t *capsrc_nids;
338 hda_nid_t dig_in_nid; /* digital-in NID; optional */
340 /* capture setup for dynamic dual-adc switch */
341 unsigned int cur_adc_idx;
342 hda_nid_t cur_adc;
343 unsigned int cur_adc_stream_tag;
344 unsigned int cur_adc_format;
346 /* capture source */
347 unsigned int num_mux_defs;
348 const struct hda_input_mux *input_mux;
349 unsigned int cur_mux[3];
350 struct alc_mic_route ext_mic;
351 struct alc_mic_route int_mic;
353 /* channel model */
354 const struct hda_channel_mode *channel_mode;
355 int num_channel_mode;
356 int need_dac_fix;
357 int const_channel_count;
358 int ext_channel_count;
360 /* PCM information */
361 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
363 /* dynamic controls, init_verbs and input_mux */
364 struct auto_pin_cfg autocfg;
365 struct alc_customize_define cdefine;
366 struct snd_array kctls;
367 struct hda_input_mux private_imux[3];
368 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
369 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
370 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
372 /* hooks */
373 void (*init_hook)(struct hda_codec *codec);
374 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
375 #ifdef CONFIG_SND_HDA_POWER_SAVE
376 void (*power_hook)(struct hda_codec *codec);
377 #endif
379 /* for pin sensing */
380 unsigned int sense_updated: 1;
381 unsigned int jack_present: 1;
382 unsigned int master_sw: 1;
383 unsigned int auto_mic:1;
385 /* other flags */
386 unsigned int no_analog :1; /* digital I/O only */
387 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
388 unsigned int single_input_src:1;
389 int init_amp;
390 int codec_variant; /* flag for other variants */
392 /* for virtual master */
393 hda_nid_t vmaster_nid;
394 #ifdef CONFIG_SND_HDA_POWER_SAVE
395 struct hda_loopback_check loopback;
396 #endif
398 /* for PLL fix */
399 hda_nid_t pll_nid;
400 unsigned int pll_coef_idx, pll_coef_bit;
402 /* fix-up list */
403 int fixup_id;
404 const struct alc_fixup *fixup_list;
405 const char *fixup_name;
409 * configuration template - to be copied to the spec instance
411 struct alc_config_preset {
412 struct snd_kcontrol_new *mixers[5]; /* should be identical size
413 * with spec
415 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
416 const struct hda_verb *init_verbs[5];
417 unsigned int num_dacs;
418 hda_nid_t *dac_nids;
419 hda_nid_t dig_out_nid; /* optional */
420 hda_nid_t hp_nid; /* optional */
421 hda_nid_t *slave_dig_outs;
422 unsigned int num_adc_nids;
423 hda_nid_t *adc_nids;
424 hda_nid_t *capsrc_nids;
425 hda_nid_t dig_in_nid;
426 unsigned int num_channel_mode;
427 const struct hda_channel_mode *channel_mode;
428 int need_dac_fix;
429 int const_channel_count;
430 unsigned int num_mux_defs;
431 const struct hda_input_mux *input_mux;
432 void (*unsol_event)(struct hda_codec *, unsigned int);
433 void (*setup)(struct hda_codec *);
434 void (*init_hook)(struct hda_codec *);
435 #ifdef CONFIG_SND_HDA_POWER_SAVE
436 struct hda_amp_list *loopbacks;
437 void (*power_hook)(struct hda_codec *codec);
438 #endif
443 * input MUX handling
445 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
446 struct snd_ctl_elem_info *uinfo)
448 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
449 struct alc_spec *spec = codec->spec;
450 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
451 if (mux_idx >= spec->num_mux_defs)
452 mux_idx = 0;
453 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
454 mux_idx = 0;
455 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
458 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
459 struct snd_ctl_elem_value *ucontrol)
461 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
462 struct alc_spec *spec = codec->spec;
463 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
465 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
466 return 0;
469 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
470 struct snd_ctl_elem_value *ucontrol)
472 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
473 struct alc_spec *spec = codec->spec;
474 const struct hda_input_mux *imux;
475 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
476 unsigned int mux_idx;
477 hda_nid_t nid = spec->capsrc_nids ?
478 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
479 unsigned int type;
481 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
482 imux = &spec->input_mux[mux_idx];
483 if (!imux->num_items && mux_idx > 0)
484 imux = &spec->input_mux[0];
486 type = get_wcaps_type(get_wcaps(codec, nid));
487 if (type == AC_WID_AUD_MIX) {
488 /* Matrix-mixer style (e.g. ALC882) */
489 unsigned int *cur_val = &spec->cur_mux[adc_idx];
490 unsigned int i, idx;
492 idx = ucontrol->value.enumerated.item[0];
493 if (idx >= imux->num_items)
494 idx = imux->num_items - 1;
495 if (*cur_val == idx)
496 return 0;
497 for (i = 0; i < imux->num_items; i++) {
498 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
499 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
500 imux->items[i].index,
501 HDA_AMP_MUTE, v);
503 *cur_val = idx;
504 return 1;
505 } else {
506 /* MUX style (e.g. ALC880) */
507 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
508 &spec->cur_mux[adc_idx]);
513 * channel mode setting
515 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
516 struct snd_ctl_elem_info *uinfo)
518 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
519 struct alc_spec *spec = codec->spec;
520 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
521 spec->num_channel_mode);
524 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
525 struct snd_ctl_elem_value *ucontrol)
527 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
528 struct alc_spec *spec = codec->spec;
529 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
530 spec->num_channel_mode,
531 spec->ext_channel_count);
534 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
535 struct snd_ctl_elem_value *ucontrol)
537 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
538 struct alc_spec *spec = codec->spec;
539 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
540 spec->num_channel_mode,
541 &spec->ext_channel_count);
542 if (err >= 0 && !spec->const_channel_count) {
543 spec->multiout.max_channels = spec->ext_channel_count;
544 if (spec->need_dac_fix)
545 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
547 return err;
551 * Control the mode of pin widget settings via the mixer. "pc" is used
552 * instead of "%" to avoid consequences of accidentally treating the % as
553 * being part of a format specifier. Maximum allowed length of a value is
554 * 63 characters plus NULL terminator.
556 * Note: some retasking pin complexes seem to ignore requests for input
557 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
558 * are requested. Therefore order this list so that this behaviour will not
559 * cause problems when mixer clients move through the enum sequentially.
560 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
561 * March 2006.
563 static char *alc_pin_mode_names[] = {
564 "Mic 50pc bias", "Mic 80pc bias",
565 "Line in", "Line out", "Headphone out",
567 static unsigned char alc_pin_mode_values[] = {
568 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
570 /* The control can present all 5 options, or it can limit the options based
571 * in the pin being assumed to be exclusively an input or an output pin. In
572 * addition, "input" pins may or may not process the mic bias option
573 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
574 * accept requests for bias as of chip versions up to March 2006) and/or
575 * wiring in the computer.
577 #define ALC_PIN_DIR_IN 0x00
578 #define ALC_PIN_DIR_OUT 0x01
579 #define ALC_PIN_DIR_INOUT 0x02
580 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
581 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
583 /* Info about the pin modes supported by the different pin direction modes.
584 * For each direction the minimum and maximum values are given.
586 static signed char alc_pin_mode_dir_info[5][2] = {
587 { 0, 2 }, /* ALC_PIN_DIR_IN */
588 { 3, 4 }, /* ALC_PIN_DIR_OUT */
589 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
590 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
591 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
593 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
594 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
595 #define alc_pin_mode_n_items(_dir) \
596 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
598 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
599 struct snd_ctl_elem_info *uinfo)
601 unsigned int item_num = uinfo->value.enumerated.item;
602 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
604 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
605 uinfo->count = 1;
606 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
608 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
609 item_num = alc_pin_mode_min(dir);
610 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
611 return 0;
614 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
615 struct snd_ctl_elem_value *ucontrol)
617 unsigned int i;
618 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
619 hda_nid_t nid = kcontrol->private_value & 0xffff;
620 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
621 long *valp = ucontrol->value.integer.value;
622 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
623 AC_VERB_GET_PIN_WIDGET_CONTROL,
624 0x00);
626 /* Find enumerated value for current pinctl setting */
627 i = alc_pin_mode_min(dir);
628 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
629 i++;
630 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
631 return 0;
634 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
635 struct snd_ctl_elem_value *ucontrol)
637 signed int change;
638 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
639 hda_nid_t nid = kcontrol->private_value & 0xffff;
640 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
641 long val = *ucontrol->value.integer.value;
642 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
643 AC_VERB_GET_PIN_WIDGET_CONTROL,
644 0x00);
646 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
647 val = alc_pin_mode_min(dir);
649 change = pinctl != alc_pin_mode_values[val];
650 if (change) {
651 /* Set pin mode to that requested */
652 snd_hda_codec_write_cache(codec, nid, 0,
653 AC_VERB_SET_PIN_WIDGET_CONTROL,
654 alc_pin_mode_values[val]);
656 /* Also enable the retasking pin's input/output as required
657 * for the requested pin mode. Enum values of 2 or less are
658 * input modes.
660 * Dynamically switching the input/output buffers probably
661 * reduces noise slightly (particularly on input) so we'll
662 * do it. However, having both input and output buffers
663 * enabled simultaneously doesn't seem to be problematic if
664 * this turns out to be necessary in the future.
666 if (val <= 2) {
667 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
668 HDA_AMP_MUTE, HDA_AMP_MUTE);
669 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
670 HDA_AMP_MUTE, 0);
671 } else {
672 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
673 HDA_AMP_MUTE, HDA_AMP_MUTE);
674 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
675 HDA_AMP_MUTE, 0);
678 return change;
681 #define ALC_PIN_MODE(xname, nid, dir) \
682 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
683 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
684 .info = alc_pin_mode_info, \
685 .get = alc_pin_mode_get, \
686 .put = alc_pin_mode_put, \
687 .private_value = nid | (dir<<16) }
689 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
690 * together using a mask with more than one bit set. This control is
691 * currently used only by the ALC260 test model. At this stage they are not
692 * needed for any "production" models.
694 #ifdef CONFIG_SND_DEBUG
695 #define alc_gpio_data_info snd_ctl_boolean_mono_info
697 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
698 struct snd_ctl_elem_value *ucontrol)
700 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
701 hda_nid_t nid = kcontrol->private_value & 0xffff;
702 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
703 long *valp = ucontrol->value.integer.value;
704 unsigned int val = snd_hda_codec_read(codec, nid, 0,
705 AC_VERB_GET_GPIO_DATA, 0x00);
707 *valp = (val & mask) != 0;
708 return 0;
710 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
711 struct snd_ctl_elem_value *ucontrol)
713 signed int change;
714 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
715 hda_nid_t nid = kcontrol->private_value & 0xffff;
716 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
717 long val = *ucontrol->value.integer.value;
718 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
719 AC_VERB_GET_GPIO_DATA,
720 0x00);
722 /* Set/unset the masked GPIO bit(s) as needed */
723 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
724 if (val == 0)
725 gpio_data &= ~mask;
726 else
727 gpio_data |= mask;
728 snd_hda_codec_write_cache(codec, nid, 0,
729 AC_VERB_SET_GPIO_DATA, gpio_data);
731 return change;
733 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
734 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
735 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
736 .info = alc_gpio_data_info, \
737 .get = alc_gpio_data_get, \
738 .put = alc_gpio_data_put, \
739 .private_value = nid | (mask<<16) }
740 #endif /* CONFIG_SND_DEBUG */
742 /* A switch control to allow the enabling of the digital IO pins on the
743 * ALC260. This is incredibly simplistic; the intention of this control is
744 * to provide something in the test model allowing digital outputs to be
745 * identified if present. If models are found which can utilise these
746 * outputs a more complete mixer control can be devised for those models if
747 * necessary.
749 #ifdef CONFIG_SND_DEBUG
750 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
752 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
753 struct snd_ctl_elem_value *ucontrol)
755 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
756 hda_nid_t nid = kcontrol->private_value & 0xffff;
757 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
758 long *valp = ucontrol->value.integer.value;
759 unsigned int val = snd_hda_codec_read(codec, nid, 0,
760 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
762 *valp = (val & mask) != 0;
763 return 0;
765 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
766 struct snd_ctl_elem_value *ucontrol)
768 signed int change;
769 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
770 hda_nid_t nid = kcontrol->private_value & 0xffff;
771 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
772 long val = *ucontrol->value.integer.value;
773 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
774 AC_VERB_GET_DIGI_CONVERT_1,
775 0x00);
777 /* Set/unset the masked control bit(s) as needed */
778 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
779 if (val==0)
780 ctrl_data &= ~mask;
781 else
782 ctrl_data |= mask;
783 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
784 ctrl_data);
786 return change;
788 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
789 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
790 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
791 .info = alc_spdif_ctrl_info, \
792 .get = alc_spdif_ctrl_get, \
793 .put = alc_spdif_ctrl_put, \
794 .private_value = nid | (mask<<16) }
795 #endif /* CONFIG_SND_DEBUG */
797 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
798 * Again, this is only used in the ALC26x test models to help identify when
799 * the EAPD line must be asserted for features to work.
801 #ifdef CONFIG_SND_DEBUG
802 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
804 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
805 struct snd_ctl_elem_value *ucontrol)
807 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
808 hda_nid_t nid = kcontrol->private_value & 0xffff;
809 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
810 long *valp = ucontrol->value.integer.value;
811 unsigned int val = snd_hda_codec_read(codec, nid, 0,
812 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
814 *valp = (val & mask) != 0;
815 return 0;
818 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
819 struct snd_ctl_elem_value *ucontrol)
821 int change;
822 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
823 hda_nid_t nid = kcontrol->private_value & 0xffff;
824 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
825 long val = *ucontrol->value.integer.value;
826 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
827 AC_VERB_GET_EAPD_BTLENABLE,
828 0x00);
830 /* Set/unset the masked control bit(s) as needed */
831 change = (!val ? 0 : mask) != (ctrl_data & mask);
832 if (!val)
833 ctrl_data &= ~mask;
834 else
835 ctrl_data |= mask;
836 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
837 ctrl_data);
839 return change;
842 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
843 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
844 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
845 .info = alc_eapd_ctrl_info, \
846 .get = alc_eapd_ctrl_get, \
847 .put = alc_eapd_ctrl_put, \
848 .private_value = nid | (mask<<16) }
849 #endif /* CONFIG_SND_DEBUG */
852 * set up the input pin config (depending on the given auto-pin type)
854 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
855 int auto_pin_type)
857 unsigned int val = PIN_IN;
859 if (auto_pin_type == AUTO_PIN_MIC) {
860 unsigned int pincap;
861 unsigned int oldval;
862 oldval = snd_hda_codec_read(codec, nid, 0,
863 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
864 pincap = snd_hda_query_pin_caps(codec, nid);
865 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
866 /* if the default pin setup is vref50, we give it priority */
867 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
868 val = PIN_VREF80;
869 else if (pincap & AC_PINCAP_VREF_50)
870 val = PIN_VREF50;
871 else if (pincap & AC_PINCAP_VREF_100)
872 val = PIN_VREF100;
873 else if (pincap & AC_PINCAP_VREF_GRD)
874 val = PIN_VREFGRD;
876 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
879 static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
881 struct alc_spec *spec = codec->spec;
882 struct auto_pin_cfg *cfg = &spec->autocfg;
884 if (!cfg->line_outs) {
885 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
886 cfg->line_out_pins[cfg->line_outs])
887 cfg->line_outs++;
889 if (!cfg->speaker_outs) {
890 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
891 cfg->speaker_pins[cfg->speaker_outs])
892 cfg->speaker_outs++;
894 if (!cfg->hp_outs) {
895 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
896 cfg->hp_pins[cfg->hp_outs])
897 cfg->hp_outs++;
903 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
905 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
906 return;
907 spec->mixers[spec->num_mixers++] = mix;
910 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
912 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
913 return;
914 spec->init_verbs[spec->num_init_verbs++] = verb;
918 * set up from the preset table
920 static void setup_preset(struct hda_codec *codec,
921 const struct alc_config_preset *preset)
923 struct alc_spec *spec = codec->spec;
924 int i;
926 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
927 add_mixer(spec, preset->mixers[i]);
928 spec->cap_mixer = preset->cap_mixer;
929 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
930 i++)
931 add_verb(spec, preset->init_verbs[i]);
933 spec->channel_mode = preset->channel_mode;
934 spec->num_channel_mode = preset->num_channel_mode;
935 spec->need_dac_fix = preset->need_dac_fix;
936 spec->const_channel_count = preset->const_channel_count;
938 if (preset->const_channel_count)
939 spec->multiout.max_channels = preset->const_channel_count;
940 else
941 spec->multiout.max_channels = spec->channel_mode[0].channels;
942 spec->ext_channel_count = spec->channel_mode[0].channels;
944 spec->multiout.num_dacs = preset->num_dacs;
945 spec->multiout.dac_nids = preset->dac_nids;
946 spec->multiout.dig_out_nid = preset->dig_out_nid;
947 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
948 spec->multiout.hp_nid = preset->hp_nid;
950 spec->num_mux_defs = preset->num_mux_defs;
951 if (!spec->num_mux_defs)
952 spec->num_mux_defs = 1;
953 spec->input_mux = preset->input_mux;
955 spec->num_adc_nids = preset->num_adc_nids;
956 spec->adc_nids = preset->adc_nids;
957 spec->capsrc_nids = preset->capsrc_nids;
958 spec->dig_in_nid = preset->dig_in_nid;
960 spec->unsol_event = preset->unsol_event;
961 spec->init_hook = preset->init_hook;
962 #ifdef CONFIG_SND_HDA_POWER_SAVE
963 spec->power_hook = preset->power_hook;
964 spec->loopback.amplist = preset->loopbacks;
965 #endif
967 if (preset->setup)
968 preset->setup(codec);
970 alc_fixup_autocfg_pin_nums(codec);
973 /* Enable GPIO mask and set output */
974 static struct hda_verb alc_gpio1_init_verbs[] = {
975 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
976 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
977 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
981 static struct hda_verb alc_gpio2_init_verbs[] = {
982 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
983 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
984 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
988 static struct hda_verb alc_gpio3_init_verbs[] = {
989 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
990 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
991 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
996 * Fix hardware PLL issue
997 * On some codecs, the analog PLL gating control must be off while
998 * the default value is 1.
1000 static void alc_fix_pll(struct hda_codec *codec)
1002 struct alc_spec *spec = codec->spec;
1003 unsigned int val;
1005 if (!spec->pll_nid)
1006 return;
1007 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1008 spec->pll_coef_idx);
1009 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1010 AC_VERB_GET_PROC_COEF, 0);
1011 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1012 spec->pll_coef_idx);
1013 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1014 val & ~(1 << spec->pll_coef_bit));
1017 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
1018 unsigned int coef_idx, unsigned int coef_bit)
1020 struct alc_spec *spec = codec->spec;
1021 spec->pll_nid = nid;
1022 spec->pll_coef_idx = coef_idx;
1023 spec->pll_coef_bit = coef_bit;
1024 alc_fix_pll(codec);
1027 static int alc_init_jacks(struct hda_codec *codec)
1029 #ifdef CONFIG_SND_HDA_INPUT_JACK
1030 struct alc_spec *spec = codec->spec;
1031 int err;
1032 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1033 unsigned int mic_nid = spec->ext_mic.pin;
1035 if (hp_nid) {
1036 err = snd_hda_input_jack_add(codec, hp_nid,
1037 SND_JACK_HEADPHONE, NULL);
1038 if (err < 0)
1039 return err;
1040 snd_hda_input_jack_report(codec, hp_nid);
1043 if (mic_nid) {
1044 err = snd_hda_input_jack_add(codec, mic_nid,
1045 SND_JACK_MICROPHONE, NULL);
1046 if (err < 0)
1047 return err;
1048 snd_hda_input_jack_report(codec, mic_nid);
1050 #endif /* CONFIG_SND_HDA_INPUT_JACK */
1051 return 0;
1054 static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1056 struct alc_spec *spec = codec->spec;
1057 unsigned int mute;
1058 hda_nid_t nid;
1059 int i;
1061 spec->jack_present = 0;
1062 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1063 nid = spec->autocfg.hp_pins[i];
1064 if (!nid)
1065 break;
1066 snd_hda_input_jack_report(codec, nid);
1067 spec->jack_present |= snd_hda_jack_detect(codec, nid);
1070 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1071 /* Toggle internal speakers muting */
1072 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1073 nid = spec->autocfg.speaker_pins[i];
1074 if (!nid)
1075 break;
1076 if (pinctl) {
1077 snd_hda_codec_write(codec, nid, 0,
1078 AC_VERB_SET_PIN_WIDGET_CONTROL,
1079 spec->jack_present ? 0 : PIN_OUT);
1080 } else {
1081 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1082 HDA_AMP_MUTE, mute);
1087 static void alc_automute_pin(struct hda_codec *codec)
1089 alc_automute_speaker(codec, 1);
1092 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1093 hda_nid_t nid)
1095 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1096 int i, nums;
1098 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1099 for (i = 0; i < nums; i++)
1100 if (conn[i] == nid)
1101 return i;
1102 return -1;
1105 /* switch the current ADC according to the jack state */
1106 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1108 struct alc_spec *spec = codec->spec;
1109 unsigned int present;
1110 hda_nid_t new_adc;
1112 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1113 if (present)
1114 spec->cur_adc_idx = 1;
1115 else
1116 spec->cur_adc_idx = 0;
1117 new_adc = spec->adc_nids[spec->cur_adc_idx];
1118 if (spec->cur_adc && spec->cur_adc != new_adc) {
1119 /* stream is running, let's swap the current ADC */
1120 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1121 spec->cur_adc = new_adc;
1122 snd_hda_codec_setup_stream(codec, new_adc,
1123 spec->cur_adc_stream_tag, 0,
1124 spec->cur_adc_format);
1128 static void alc_mic_automute(struct hda_codec *codec)
1130 struct alc_spec *spec = codec->spec;
1131 struct alc_mic_route *dead, *alive;
1132 unsigned int present, type;
1133 hda_nid_t cap_nid;
1135 if (!spec->auto_mic)
1136 return;
1137 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1138 return;
1139 if (snd_BUG_ON(!spec->adc_nids))
1140 return;
1142 if (spec->dual_adc_switch) {
1143 alc_dual_mic_adc_auto_switch(codec);
1144 return;
1147 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1149 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1150 if (present) {
1151 alive = &spec->ext_mic;
1152 dead = &spec->int_mic;
1153 } else {
1154 alive = &spec->int_mic;
1155 dead = &spec->ext_mic;
1158 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1159 if (type == AC_WID_AUD_MIX) {
1160 /* Matrix-mixer style (e.g. ALC882) */
1161 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1162 alive->mux_idx,
1163 HDA_AMP_MUTE, 0);
1164 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1165 dead->mux_idx,
1166 HDA_AMP_MUTE, HDA_AMP_MUTE);
1167 } else {
1168 /* MUX style (e.g. ALC880) */
1169 snd_hda_codec_write_cache(codec, cap_nid, 0,
1170 AC_VERB_SET_CONNECT_SEL,
1171 alive->mux_idx);
1173 snd_hda_input_jack_report(codec, spec->ext_mic.pin);
1175 /* FIXME: analog mixer */
1178 /* unsolicited event for HP jack sensing */
1179 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1181 if (codec->vendor_id == 0x10ec0880)
1182 res >>= 28;
1183 else
1184 res >>= 26;
1185 switch (res) {
1186 case ALC880_HP_EVENT:
1187 alc_automute_pin(codec);
1188 break;
1189 case ALC880_MIC_EVENT:
1190 alc_mic_automute(codec);
1191 break;
1195 static void alc_inithook(struct hda_codec *codec)
1197 alc_automute_pin(codec);
1198 alc_mic_automute(codec);
1201 /* additional initialization for ALC888 variants */
1202 static void alc888_coef_init(struct hda_codec *codec)
1204 unsigned int tmp;
1206 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1207 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1208 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1209 if ((tmp & 0xf0) == 0x20)
1210 /* alc888S-VC */
1211 snd_hda_codec_read(codec, 0x20, 0,
1212 AC_VERB_SET_PROC_COEF, 0x830);
1213 else
1214 /* alc888-VB */
1215 snd_hda_codec_read(codec, 0x20, 0,
1216 AC_VERB_SET_PROC_COEF, 0x3030);
1219 static void alc889_coef_init(struct hda_codec *codec)
1221 unsigned int tmp;
1223 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1224 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1225 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1226 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1229 /* turn on/off EAPD control (only if available) */
1230 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1232 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1233 return;
1234 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1235 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1236 on ? 2 : 0);
1239 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1241 unsigned int tmp;
1243 switch (type) {
1244 case ALC_INIT_GPIO1:
1245 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1246 break;
1247 case ALC_INIT_GPIO2:
1248 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1249 break;
1250 case ALC_INIT_GPIO3:
1251 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1252 break;
1253 case ALC_INIT_DEFAULT:
1254 switch (codec->vendor_id) {
1255 case 0x10ec0260:
1256 set_eapd(codec, 0x0f, 1);
1257 set_eapd(codec, 0x10, 1);
1258 break;
1259 case 0x10ec0262:
1260 case 0x10ec0267:
1261 case 0x10ec0268:
1262 case 0x10ec0269:
1263 case 0x10ec0270:
1264 case 0x10ec0272:
1265 case 0x10ec0660:
1266 case 0x10ec0662:
1267 case 0x10ec0663:
1268 case 0x10ec0665:
1269 case 0x10ec0862:
1270 case 0x10ec0889:
1271 set_eapd(codec, 0x14, 1);
1272 set_eapd(codec, 0x15, 1);
1273 break;
1275 switch (codec->vendor_id) {
1276 case 0x10ec0260:
1277 snd_hda_codec_write(codec, 0x1a, 0,
1278 AC_VERB_SET_COEF_INDEX, 7);
1279 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1280 AC_VERB_GET_PROC_COEF, 0);
1281 snd_hda_codec_write(codec, 0x1a, 0,
1282 AC_VERB_SET_COEF_INDEX, 7);
1283 snd_hda_codec_write(codec, 0x1a, 0,
1284 AC_VERB_SET_PROC_COEF,
1285 tmp | 0x2010);
1286 break;
1287 case 0x10ec0262:
1288 case 0x10ec0880:
1289 case 0x10ec0882:
1290 case 0x10ec0883:
1291 case 0x10ec0885:
1292 case 0x10ec0887:
1293 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
1294 alc889_coef_init(codec);
1295 break;
1296 case 0x10ec0888:
1297 alc888_coef_init(codec);
1298 break;
1299 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1300 case 0x10ec0267:
1301 case 0x10ec0268:
1302 snd_hda_codec_write(codec, 0x20, 0,
1303 AC_VERB_SET_COEF_INDEX, 7);
1304 tmp = snd_hda_codec_read(codec, 0x20, 0,
1305 AC_VERB_GET_PROC_COEF, 0);
1306 snd_hda_codec_write(codec, 0x20, 0,
1307 AC_VERB_SET_COEF_INDEX, 7);
1308 snd_hda_codec_write(codec, 0x20, 0,
1309 AC_VERB_SET_PROC_COEF,
1310 tmp | 0x3000);
1311 break;
1312 #endif /* XXX */
1314 break;
1318 static void alc_init_auto_hp(struct hda_codec *codec)
1320 struct alc_spec *spec = codec->spec;
1321 struct auto_pin_cfg *cfg = &spec->autocfg;
1322 int i;
1324 if (!cfg->hp_pins[0]) {
1325 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1326 return;
1329 if (!cfg->speaker_pins[0]) {
1330 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1331 return;
1332 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1333 sizeof(cfg->speaker_pins));
1334 cfg->speaker_outs = cfg->line_outs;
1337 if (!cfg->hp_pins[0]) {
1338 memcpy(cfg->hp_pins, cfg->line_out_pins,
1339 sizeof(cfg->hp_pins));
1340 cfg->hp_outs = cfg->line_outs;
1343 for (i = 0; i < cfg->hp_outs; i++) {
1344 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1345 cfg->hp_pins[i]);
1346 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1347 AC_VERB_SET_UNSOLICITED_ENABLE,
1348 AC_USRSP_EN | ALC880_HP_EVENT);
1350 spec->unsol_event = alc_sku_unsol_event;
1353 static void alc_init_auto_mic(struct hda_codec *codec)
1355 struct alc_spec *spec = codec->spec;
1356 struct auto_pin_cfg *cfg = &spec->autocfg;
1357 hda_nid_t fixed, ext;
1358 int i;
1360 /* there must be only two mic inputs exclusively */
1361 for (i = 0; i < cfg->num_inputs; i++)
1362 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1363 return;
1365 fixed = ext = 0;
1366 for (i = 0; i < cfg->num_inputs; i++) {
1367 hda_nid_t nid = cfg->inputs[i].pin;
1368 unsigned int defcfg;
1369 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1370 switch (snd_hda_get_input_pin_attr(defcfg)) {
1371 case INPUT_PIN_ATTR_INT:
1372 if (fixed)
1373 return; /* already occupied */
1374 fixed = nid;
1375 break;
1376 case INPUT_PIN_ATTR_UNUSED:
1377 return; /* invalid entry */
1378 default:
1379 if (ext)
1380 return; /* already occupied */
1381 ext = nid;
1382 break;
1385 if (!ext || !fixed)
1386 return;
1387 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1388 return; /* no unsol support */
1389 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1390 ext, fixed);
1391 spec->ext_mic.pin = ext;
1392 spec->int_mic.pin = fixed;
1393 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1394 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1395 spec->auto_mic = 1;
1396 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1397 AC_VERB_SET_UNSOLICITED_ENABLE,
1398 AC_USRSP_EN | ALC880_MIC_EVENT);
1399 spec->unsol_event = alc_sku_unsol_event;
1402 /* Could be any non-zero and even value. When used as fixup, tells
1403 * the driver to ignore any present sku defines.
1405 #define ALC_FIXUP_SKU_IGNORE (2)
1407 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1409 unsigned int ass, tmp, i;
1410 unsigned nid = 0;
1411 struct alc_spec *spec = codec->spec;
1413 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1415 if (spec->cdefine.fixup) {
1416 ass = spec->cdefine.sku_cfg;
1417 if (ass == ALC_FIXUP_SKU_IGNORE)
1418 return -1;
1419 goto do_sku;
1422 ass = codec->subsystem_id & 0xffff;
1423 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1424 goto do_sku;
1426 nid = 0x1d;
1427 if (codec->vendor_id == 0x10ec0260)
1428 nid = 0x17;
1429 ass = snd_hda_codec_get_pincfg(codec, nid);
1431 if (!(ass & 1)) {
1432 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1433 codec->chip_name, ass);
1434 return -1;
1437 /* check sum */
1438 tmp = 0;
1439 for (i = 1; i < 16; i++) {
1440 if ((ass >> i) & 1)
1441 tmp++;
1443 if (((ass >> 16) & 0xf) != tmp)
1444 return -1;
1446 spec->cdefine.port_connectivity = ass >> 30;
1447 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1448 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1449 spec->cdefine.customization = ass >> 8;
1450 do_sku:
1451 spec->cdefine.sku_cfg = ass;
1452 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1453 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1454 spec->cdefine.swap = (ass & 0x2) >> 1;
1455 spec->cdefine.override = ass & 0x1;
1457 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1458 nid, spec->cdefine.sku_cfg);
1459 snd_printd("SKU: port_connectivity=0x%x\n",
1460 spec->cdefine.port_connectivity);
1461 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1462 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1463 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1464 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1465 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1466 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1467 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1469 return 0;
1472 /* check subsystem ID and set up device-specific initialization;
1473 * return 1 if initialized, 0 if invalid SSID
1475 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1476 * 31 ~ 16 : Manufacture ID
1477 * 15 ~ 8 : SKU ID
1478 * 7 ~ 0 : Assembly ID
1479 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1481 static int alc_subsystem_id(struct hda_codec *codec,
1482 hda_nid_t porta, hda_nid_t porte,
1483 hda_nid_t portd, hda_nid_t porti)
1485 unsigned int ass, tmp, i;
1486 unsigned nid;
1487 struct alc_spec *spec = codec->spec;
1489 if (spec->cdefine.fixup) {
1490 ass = spec->cdefine.sku_cfg;
1491 if (ass == ALC_FIXUP_SKU_IGNORE)
1492 return 0;
1493 goto do_sku;
1496 ass = codec->subsystem_id & 0xffff;
1497 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1498 goto do_sku;
1500 /* invalid SSID, check the special NID pin defcfg instead */
1502 * 31~30 : port connectivity
1503 * 29~21 : reserve
1504 * 20 : PCBEEP input
1505 * 19~16 : Check sum (15:1)
1506 * 15~1 : Custom
1507 * 0 : override
1509 nid = 0x1d;
1510 if (codec->vendor_id == 0x10ec0260)
1511 nid = 0x17;
1512 ass = snd_hda_codec_get_pincfg(codec, nid);
1513 snd_printd("realtek: No valid SSID, "
1514 "checking pincfg 0x%08x for NID 0x%x\n",
1515 ass, nid);
1516 if (!(ass & 1))
1517 return 0;
1518 if ((ass >> 30) != 1) /* no physical connection */
1519 return 0;
1521 /* check sum */
1522 tmp = 0;
1523 for (i = 1; i < 16; i++) {
1524 if ((ass >> i) & 1)
1525 tmp++;
1527 if (((ass >> 16) & 0xf) != tmp)
1528 return 0;
1529 do_sku:
1530 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1531 ass & 0xffff, codec->vendor_id);
1533 * 0 : override
1534 * 1 : Swap Jack
1535 * 2 : 0 --> Desktop, 1 --> Laptop
1536 * 3~5 : External Amplifier control
1537 * 7~6 : Reserved
1539 tmp = (ass & 0x38) >> 3; /* external Amp control */
1540 switch (tmp) {
1541 case 1:
1542 spec->init_amp = ALC_INIT_GPIO1;
1543 break;
1544 case 3:
1545 spec->init_amp = ALC_INIT_GPIO2;
1546 break;
1547 case 7:
1548 spec->init_amp = ALC_INIT_GPIO3;
1549 break;
1550 case 5:
1551 default:
1552 spec->init_amp = ALC_INIT_DEFAULT;
1553 break;
1556 /* is laptop or Desktop and enable the function "Mute internal speaker
1557 * when the external headphone out jack is plugged"
1559 if (!(ass & 0x8000))
1560 return 1;
1562 * 10~8 : Jack location
1563 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1564 * 14~13: Resvered
1565 * 15 : 1 --> enable the function "Mute internal speaker
1566 * when the external headphone out jack is plugged"
1568 if (!spec->autocfg.hp_pins[0]) {
1569 hda_nid_t nid;
1570 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1571 if (tmp == 0)
1572 nid = porta;
1573 else if (tmp == 1)
1574 nid = porte;
1575 else if (tmp == 2)
1576 nid = portd;
1577 else if (tmp == 3)
1578 nid = porti;
1579 else
1580 return 1;
1581 for (i = 0; i < spec->autocfg.line_outs; i++)
1582 if (spec->autocfg.line_out_pins[i] == nid)
1583 return 1;
1584 spec->autocfg.hp_pins[0] = nid;
1587 alc_init_auto_hp(codec);
1588 alc_init_auto_mic(codec);
1589 return 1;
1592 static void alc_ssid_check(struct hda_codec *codec,
1593 hda_nid_t porta, hda_nid_t porte,
1594 hda_nid_t portd, hda_nid_t porti)
1596 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1597 struct alc_spec *spec = codec->spec;
1598 snd_printd("realtek: "
1599 "Enable default setup for auto mode as fallback\n");
1600 spec->init_amp = ALC_INIT_DEFAULT;
1601 alc_init_auto_hp(codec);
1602 alc_init_auto_mic(codec);
1607 * Fix-up pin default configurations and add default verbs
1610 struct alc_pincfg {
1611 hda_nid_t nid;
1612 u32 val;
1615 struct alc_model_fixup {
1616 const int id;
1617 const char *name;
1620 struct alc_fixup {
1621 int type;
1622 bool chained;
1623 int chain_id;
1624 union {
1625 unsigned int sku;
1626 const struct alc_pincfg *pins;
1627 const struct hda_verb *verbs;
1628 void (*func)(struct hda_codec *codec,
1629 const struct alc_fixup *fix,
1630 int action);
1631 } v;
1634 enum {
1635 ALC_FIXUP_INVALID,
1636 ALC_FIXUP_SKU,
1637 ALC_FIXUP_PINS,
1638 ALC_FIXUP_VERBS,
1639 ALC_FIXUP_FUNC,
1642 enum {
1643 ALC_FIXUP_ACT_PRE_PROBE,
1644 ALC_FIXUP_ACT_PROBE,
1645 ALC_FIXUP_ACT_INIT,
1648 static void alc_apply_fixup(struct hda_codec *codec, int action)
1650 struct alc_spec *spec = codec->spec;
1651 int id = spec->fixup_id;
1652 #ifdef CONFIG_SND_DEBUG_VERBOSE
1653 const char *modelname = spec->fixup_name;
1654 #endif
1655 int depth = 0;
1657 if (!spec->fixup_list)
1658 return;
1660 while (id >= 0) {
1661 const struct alc_fixup *fix = spec->fixup_list + id;
1662 const struct alc_pincfg *cfg;
1664 switch (fix->type) {
1665 case ALC_FIXUP_SKU:
1666 if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
1667 break;;
1668 snd_printdd(KERN_INFO "hda_codec: %s: "
1669 "Apply sku override for %s\n",
1670 codec->chip_name, modelname);
1671 spec->cdefine.sku_cfg = fix->v.sku;
1672 spec->cdefine.fixup = 1;
1673 break;
1674 case ALC_FIXUP_PINS:
1675 cfg = fix->v.pins;
1676 if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
1677 break;
1678 snd_printdd(KERN_INFO "hda_codec: %s: "
1679 "Apply pincfg for %s\n",
1680 codec->chip_name, modelname);
1681 for (; cfg->nid; cfg++)
1682 snd_hda_codec_set_pincfg(codec, cfg->nid,
1683 cfg->val);
1684 break;
1685 case ALC_FIXUP_VERBS:
1686 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
1687 break;
1688 snd_printdd(KERN_INFO "hda_codec: %s: "
1689 "Apply fix-verbs for %s\n",
1690 codec->chip_name, modelname);
1691 add_verb(codec->spec, fix->v.verbs);
1692 break;
1693 case ALC_FIXUP_FUNC:
1694 if (!fix->v.func)
1695 break;
1696 snd_printdd(KERN_INFO "hda_codec: %s: "
1697 "Apply fix-func for %s\n",
1698 codec->chip_name, modelname);
1699 fix->v.func(codec, fix, action);
1700 break;
1701 default:
1702 snd_printk(KERN_ERR "hda_codec: %s: "
1703 "Invalid fixup type %d\n",
1704 codec->chip_name, fix->type);
1705 break;
1707 if (!fix->chained)
1708 break;
1709 if (++depth > 10)
1710 break;
1711 id = fix->chain_id;
1715 static void alc_pick_fixup(struct hda_codec *codec,
1716 const struct alc_model_fixup *models,
1717 const struct snd_pci_quirk *quirk,
1718 const struct alc_fixup *fixlist)
1720 struct alc_spec *spec = codec->spec;
1721 int id = -1;
1722 const char *name = NULL;
1724 if (codec->modelname && models) {
1725 while (models->name) {
1726 if (!strcmp(codec->modelname, models->name)) {
1727 id = models->id;
1728 name = models->name;
1729 break;
1731 models++;
1734 if (id < 0) {
1735 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1736 if (quirk) {
1737 id = quirk->value;
1738 #ifdef CONFIG_SND_DEBUG_VERBOSE
1739 name = quirk->name;
1740 #endif
1744 spec->fixup_id = id;
1745 if (id >= 0) {
1746 spec->fixup_list = fixlist;
1747 spec->fixup_name = name;
1751 static int alc_read_coef_idx(struct hda_codec *codec,
1752 unsigned int coef_idx)
1754 unsigned int val;
1755 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1756 coef_idx);
1757 val = snd_hda_codec_read(codec, 0x20, 0,
1758 AC_VERB_GET_PROC_COEF, 0);
1759 return val;
1762 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
1763 unsigned int coef_val)
1765 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1766 coef_idx);
1767 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
1768 coef_val);
1771 /* set right pin controls for digital I/O */
1772 static void alc_auto_init_digital(struct hda_codec *codec)
1774 struct alc_spec *spec = codec->spec;
1775 int i;
1776 hda_nid_t pin;
1778 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1779 pin = spec->autocfg.dig_out_pins[i];
1780 if (pin) {
1781 snd_hda_codec_write(codec, pin, 0,
1782 AC_VERB_SET_PIN_WIDGET_CONTROL,
1783 PIN_OUT);
1786 pin = spec->autocfg.dig_in_pin;
1787 if (pin)
1788 snd_hda_codec_write(codec, pin, 0,
1789 AC_VERB_SET_PIN_WIDGET_CONTROL,
1790 PIN_IN);
1793 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1794 static void alc_auto_parse_digital(struct hda_codec *codec)
1796 struct alc_spec *spec = codec->spec;
1797 int i, err;
1798 hda_nid_t dig_nid;
1800 /* support multiple SPDIFs; the secondary is set up as a slave */
1801 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1802 err = snd_hda_get_connections(codec,
1803 spec->autocfg.dig_out_pins[i],
1804 &dig_nid, 1);
1805 if (err < 0)
1806 continue;
1807 if (!i) {
1808 spec->multiout.dig_out_nid = dig_nid;
1809 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1810 } else {
1811 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1812 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1813 break;
1814 spec->slave_dig_outs[i - 1] = dig_nid;
1818 if (spec->autocfg.dig_in_pin) {
1819 dig_nid = codec->start_nid;
1820 for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
1821 unsigned int wcaps = get_wcaps(codec, dig_nid);
1822 if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
1823 continue;
1824 if (!(wcaps & AC_WCAP_DIGITAL))
1825 continue;
1826 if (!(wcaps & AC_WCAP_CONN_LIST))
1827 continue;
1828 err = get_connection_index(codec, dig_nid,
1829 spec->autocfg.dig_in_pin);
1830 if (err >= 0) {
1831 spec->dig_in_nid = dig_nid;
1832 break;
1839 * ALC888
1843 * 2ch mode
1845 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1846 /* Mic-in jack as mic in */
1847 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1848 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1849 /* Line-in jack as Line in */
1850 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1851 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1852 /* Line-Out as Front */
1853 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1854 { } /* end */
1858 * 4ch mode
1860 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1861 /* Mic-in jack as mic in */
1862 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1863 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1864 /* Line-in jack as Surround */
1865 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1866 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1867 /* Line-Out as Front */
1868 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1869 { } /* end */
1873 * 6ch mode
1875 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1876 /* Mic-in jack as CLFE */
1877 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1878 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1879 /* Line-in jack as Surround */
1880 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1881 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1882 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1883 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1884 { } /* end */
1888 * 8ch mode
1890 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1891 /* Mic-in jack as CLFE */
1892 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1893 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1894 /* Line-in jack as Surround */
1895 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1896 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1897 /* Line-Out as Side */
1898 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1899 { } /* end */
1902 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1903 { 2, alc888_4ST_ch2_intel_init },
1904 { 4, alc888_4ST_ch4_intel_init },
1905 { 6, alc888_4ST_ch6_intel_init },
1906 { 8, alc888_4ST_ch8_intel_init },
1910 * ALC888 Fujitsu Siemens Amillo xa3530
1913 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1914 /* Front Mic: set to PIN_IN (empty by default) */
1915 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1916 /* Connect Internal HP to Front */
1917 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1918 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1919 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1920 /* Connect Bass HP to Front */
1921 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1922 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1923 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1924 /* Connect Line-Out side jack (SPDIF) to Side */
1925 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1926 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1927 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1928 /* Connect Mic jack to CLFE */
1929 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1930 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1931 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1932 /* Connect Line-in jack to Surround */
1933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1934 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1935 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1936 /* Connect HP out jack to Front */
1937 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1938 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1939 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1940 /* Enable unsolicited event for HP jack and Line-out jack */
1941 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1942 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1946 static void alc_automute_amp(struct hda_codec *codec)
1948 alc_automute_speaker(codec, 0);
1951 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1952 unsigned int res)
1954 if (codec->vendor_id == 0x10ec0880)
1955 res >>= 28;
1956 else
1957 res >>= 26;
1958 if (res == ALC880_HP_EVENT)
1959 alc_automute_amp(codec);
1962 static void alc889_automute_setup(struct hda_codec *codec)
1964 struct alc_spec *spec = codec->spec;
1966 spec->autocfg.hp_pins[0] = 0x15;
1967 spec->autocfg.speaker_pins[0] = 0x14;
1968 spec->autocfg.speaker_pins[1] = 0x16;
1969 spec->autocfg.speaker_pins[2] = 0x17;
1970 spec->autocfg.speaker_pins[3] = 0x19;
1971 spec->autocfg.speaker_pins[4] = 0x1a;
1974 static void alc889_intel_init_hook(struct hda_codec *codec)
1976 alc889_coef_init(codec);
1977 alc_automute_amp(codec);
1980 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1982 struct alc_spec *spec = codec->spec;
1984 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1985 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1986 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1987 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1991 * ALC888 Acer Aspire 4930G model
1994 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1995 /* Front Mic: set to PIN_IN (empty by default) */
1996 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1997 /* Unselect Front Mic by default in input mixer 3 */
1998 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1999 /* Enable unsolicited event for HP jack */
2000 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2001 /* Connect Internal HP to front */
2002 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2003 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2004 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2005 /* Connect HP out to front */
2006 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2008 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2009 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2014 * ALC888 Acer Aspire 6530G model
2017 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2018 /* Route to built-in subwoofer as well as speakers */
2019 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2020 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2021 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2022 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2023 /* Bias voltage on for external mic port */
2024 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2025 /* Front Mic: set to PIN_IN (empty by default) */
2026 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2027 /* Unselect Front Mic by default in input mixer 3 */
2028 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2029 /* Enable unsolicited event for HP jack */
2030 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2031 /* Enable speaker output */
2032 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2033 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2034 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2035 /* Enable headphone output */
2036 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2037 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2038 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2039 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2044 *ALC888 Acer Aspire 7730G model
2047 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2048 /* Bias voltage on for external mic port */
2049 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2050 /* Front Mic: set to PIN_IN (empty by default) */
2051 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2052 /* Unselect Front Mic by default in input mixer 3 */
2053 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2054 /* Enable unsolicited event for HP jack */
2055 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2056 /* Enable speaker output */
2057 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2058 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2059 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2060 /* Enable headphone output */
2061 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2062 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2063 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2064 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2065 /*Enable internal subwoofer */
2066 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2067 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2068 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2069 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
2074 * ALC889 Acer Aspire 8930G model
2077 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2078 /* Front Mic: set to PIN_IN (empty by default) */
2079 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2080 /* Unselect Front Mic by default in input mixer 3 */
2081 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2082 /* Enable unsolicited event for HP jack */
2083 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2084 /* Connect Internal Front to Front */
2085 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2086 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2087 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2088 /* Connect Internal Rear to Rear */
2089 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2090 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2091 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
2092 /* Connect Internal CLFE to CLFE */
2093 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2094 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2095 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
2096 /* Connect HP out to Front */
2097 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2098 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2099 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2100 /* Enable all DACs */
2101 /* DAC DISABLE/MUTE 1? */
2102 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2103 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2104 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2105 /* DAC DISABLE/MUTE 2? */
2106 /* some bit here disables the other DACs. Init=0x4900 */
2107 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2108 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2109 /* DMIC fix
2110 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2111 * which makes the stereo useless. However, either the mic or the ALC889
2112 * makes the signal become a difference/sum signal instead of standard
2113 * stereo, which is annoying. So instead we flip this bit which makes the
2114 * codec replicate the sum signal to both channels, turning it into a
2115 * normal mono mic.
2117 /* DMIC_CONTROL? Init value = 0x0001 */
2118 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2119 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2123 static struct hda_input_mux alc888_2_capture_sources[2] = {
2124 /* Front mic only available on one ADC */
2126 .num_items = 4,
2127 .items = {
2128 { "Mic", 0x0 },
2129 { "Line", 0x2 },
2130 { "CD", 0x4 },
2131 { "Front Mic", 0xb },
2135 .num_items = 3,
2136 .items = {
2137 { "Mic", 0x0 },
2138 { "Line", 0x2 },
2139 { "CD", 0x4 },
2144 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2145 /* Interal mic only available on one ADC */
2147 .num_items = 5,
2148 .items = {
2149 { "Mic", 0x0 },
2150 { "Line In", 0x2 },
2151 { "CD", 0x4 },
2152 { "Input Mix", 0xa },
2153 { "Internal Mic", 0xb },
2157 .num_items = 4,
2158 .items = {
2159 { "Mic", 0x0 },
2160 { "Line In", 0x2 },
2161 { "CD", 0x4 },
2162 { "Input Mix", 0xa },
2167 static struct hda_input_mux alc889_capture_sources[3] = {
2168 /* Digital mic only available on first "ADC" */
2170 .num_items = 5,
2171 .items = {
2172 { "Mic", 0x0 },
2173 { "Line", 0x2 },
2174 { "CD", 0x4 },
2175 { "Front Mic", 0xb },
2176 { "Input Mix", 0xa },
2180 .num_items = 4,
2181 .items = {
2182 { "Mic", 0x0 },
2183 { "Line", 0x2 },
2184 { "CD", 0x4 },
2185 { "Input Mix", 0xa },
2189 .num_items = 4,
2190 .items = {
2191 { "Mic", 0x0 },
2192 { "Line", 0x2 },
2193 { "CD", 0x4 },
2194 { "Input Mix", 0xa },
2199 static struct snd_kcontrol_new alc888_base_mixer[] = {
2200 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2201 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2202 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2203 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2204 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2205 HDA_OUTPUT),
2206 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2207 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2208 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2209 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2210 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2211 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2212 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2213 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2214 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2216 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2217 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2218 { } /* end */
2221 static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2222 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2223 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2224 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2225 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2226 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2227 HDA_OUTPUT),
2228 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2229 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2230 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2231 HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
2232 HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT),
2233 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2234 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2235 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2236 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2237 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2238 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2239 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2240 { } /* end */
2243 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2244 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2245 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2246 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2247 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2248 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2249 HDA_OUTPUT),
2250 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2251 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2252 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2253 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2254 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2255 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2256 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2257 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2258 { } /* end */
2262 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2264 struct alc_spec *spec = codec->spec;
2266 spec->autocfg.hp_pins[0] = 0x15;
2267 spec->autocfg.speaker_pins[0] = 0x14;
2268 spec->autocfg.speaker_pins[1] = 0x16;
2269 spec->autocfg.speaker_pins[2] = 0x17;
2272 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2274 struct alc_spec *spec = codec->spec;
2276 spec->autocfg.hp_pins[0] = 0x15;
2277 spec->autocfg.speaker_pins[0] = 0x14;
2278 spec->autocfg.speaker_pins[1] = 0x16;
2279 spec->autocfg.speaker_pins[2] = 0x17;
2282 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2284 struct alc_spec *spec = codec->spec;
2286 spec->autocfg.hp_pins[0] = 0x15;
2287 spec->autocfg.speaker_pins[0] = 0x14;
2288 spec->autocfg.speaker_pins[1] = 0x16;
2289 spec->autocfg.speaker_pins[2] = 0x17;
2292 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2294 struct alc_spec *spec = codec->spec;
2296 spec->autocfg.hp_pins[0] = 0x15;
2297 spec->autocfg.speaker_pins[0] = 0x14;
2298 spec->autocfg.speaker_pins[1] = 0x16;
2299 spec->autocfg.speaker_pins[2] = 0x1b;
2303 * ALC880 3-stack model
2305 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2306 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2307 * F-Mic = 0x1b, HP = 0x19
2310 static hda_nid_t alc880_dac_nids[4] = {
2311 /* front, rear, clfe, rear_surr */
2312 0x02, 0x05, 0x04, 0x03
2315 static hda_nid_t alc880_adc_nids[3] = {
2316 /* ADC0-2 */
2317 0x07, 0x08, 0x09,
2320 /* The datasheet says the node 0x07 is connected from inputs,
2321 * but it shows zero connection in the real implementation on some devices.
2322 * Note: this is a 915GAV bug, fixed on 915GLV
2324 static hda_nid_t alc880_adc_nids_alt[2] = {
2325 /* ADC1-2 */
2326 0x08, 0x09,
2329 #define ALC880_DIGOUT_NID 0x06
2330 #define ALC880_DIGIN_NID 0x0a
2332 static struct hda_input_mux alc880_capture_source = {
2333 .num_items = 4,
2334 .items = {
2335 { "Mic", 0x0 },
2336 { "Front Mic", 0x3 },
2337 { "Line", 0x2 },
2338 { "CD", 0x4 },
2342 /* channel source setting (2/6 channel selection for 3-stack) */
2343 /* 2ch mode */
2344 static struct hda_verb alc880_threestack_ch2_init[] = {
2345 /* set line-in to input, mute it */
2346 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2347 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2348 /* set mic-in to input vref 80%, mute it */
2349 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2350 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2351 { } /* end */
2354 /* 6ch mode */
2355 static struct hda_verb alc880_threestack_ch6_init[] = {
2356 /* set line-in to output, unmute it */
2357 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2358 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2359 /* set mic-in to output, unmute it */
2360 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2361 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2362 { } /* end */
2365 static struct hda_channel_mode alc880_threestack_modes[2] = {
2366 { 2, alc880_threestack_ch2_init },
2367 { 6, alc880_threestack_ch6_init },
2370 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2371 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2372 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2373 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2374 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2375 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2376 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2377 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2378 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2379 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2380 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2381 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2382 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2383 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2384 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2385 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2386 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2387 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2389 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2390 .name = "Channel Mode",
2391 .info = alc_ch_mode_info,
2392 .get = alc_ch_mode_get,
2393 .put = alc_ch_mode_put,
2395 { } /* end */
2398 /* capture mixer elements */
2399 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2400 struct snd_ctl_elem_info *uinfo)
2402 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2403 struct alc_spec *spec = codec->spec;
2404 int err;
2406 mutex_lock(&codec->control_mutex);
2407 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2408 HDA_INPUT);
2409 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2410 mutex_unlock(&codec->control_mutex);
2411 return err;
2414 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2415 unsigned int size, unsigned int __user *tlv)
2417 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2418 struct alc_spec *spec = codec->spec;
2419 int err;
2421 mutex_lock(&codec->control_mutex);
2422 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2423 HDA_INPUT);
2424 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2425 mutex_unlock(&codec->control_mutex);
2426 return err;
2429 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2430 struct snd_ctl_elem_value *ucontrol);
2432 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2433 struct snd_ctl_elem_value *ucontrol,
2434 getput_call_t func)
2436 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2437 struct alc_spec *spec = codec->spec;
2438 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2439 int err;
2441 mutex_lock(&codec->control_mutex);
2442 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2443 3, 0, HDA_INPUT);
2444 err = func(kcontrol, ucontrol);
2445 mutex_unlock(&codec->control_mutex);
2446 return err;
2449 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2450 struct snd_ctl_elem_value *ucontrol)
2452 return alc_cap_getput_caller(kcontrol, ucontrol,
2453 snd_hda_mixer_amp_volume_get);
2456 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2457 struct snd_ctl_elem_value *ucontrol)
2459 return alc_cap_getput_caller(kcontrol, ucontrol,
2460 snd_hda_mixer_amp_volume_put);
2463 /* capture mixer elements */
2464 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2466 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2467 struct snd_ctl_elem_value *ucontrol)
2469 return alc_cap_getput_caller(kcontrol, ucontrol,
2470 snd_hda_mixer_amp_switch_get);
2473 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2474 struct snd_ctl_elem_value *ucontrol)
2476 return alc_cap_getput_caller(kcontrol, ucontrol,
2477 snd_hda_mixer_amp_switch_put);
2480 #define _DEFINE_CAPMIX(num) \
2482 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2483 .name = "Capture Switch", \
2484 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2485 .count = num, \
2486 .info = alc_cap_sw_info, \
2487 .get = alc_cap_sw_get, \
2488 .put = alc_cap_sw_put, \
2489 }, \
2491 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2492 .name = "Capture Volume", \
2493 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2494 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2495 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2496 .count = num, \
2497 .info = alc_cap_vol_info, \
2498 .get = alc_cap_vol_get, \
2499 .put = alc_cap_vol_put, \
2500 .tlv = { .c = alc_cap_vol_tlv }, \
2503 #define _DEFINE_CAPSRC(num) \
2505 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2506 /* .name = "Capture Source", */ \
2507 .name = "Input Source", \
2508 .count = num, \
2509 .info = alc_mux_enum_info, \
2510 .get = alc_mux_enum_get, \
2511 .put = alc_mux_enum_put, \
2514 #define DEFINE_CAPMIX(num) \
2515 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2516 _DEFINE_CAPMIX(num), \
2517 _DEFINE_CAPSRC(num), \
2518 { } /* end */ \
2521 #define DEFINE_CAPMIX_NOSRC(num) \
2522 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2523 _DEFINE_CAPMIX(num), \
2524 { } /* end */ \
2527 /* up to three ADCs */
2528 DEFINE_CAPMIX(1);
2529 DEFINE_CAPMIX(2);
2530 DEFINE_CAPMIX(3);
2531 DEFINE_CAPMIX_NOSRC(1);
2532 DEFINE_CAPMIX_NOSRC(2);
2533 DEFINE_CAPMIX_NOSRC(3);
2536 * ALC880 5-stack model
2538 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2539 * Side = 0x02 (0xd)
2540 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2541 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2544 /* additional mixers to alc880_three_stack_mixer */
2545 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2546 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2547 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2548 { } /* end */
2551 /* channel source setting (6/8 channel selection for 5-stack) */
2552 /* 6ch mode */
2553 static struct hda_verb alc880_fivestack_ch6_init[] = {
2554 /* set line-in to input, mute it */
2555 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2556 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2557 { } /* end */
2560 /* 8ch mode */
2561 static struct hda_verb alc880_fivestack_ch8_init[] = {
2562 /* set line-in to output, unmute it */
2563 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2564 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2565 { } /* end */
2568 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2569 { 6, alc880_fivestack_ch6_init },
2570 { 8, alc880_fivestack_ch8_init },
2575 * ALC880 6-stack model
2577 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2578 * Side = 0x05 (0x0f)
2579 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2580 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2583 static hda_nid_t alc880_6st_dac_nids[4] = {
2584 /* front, rear, clfe, rear_surr */
2585 0x02, 0x03, 0x04, 0x05
2588 static struct hda_input_mux alc880_6stack_capture_source = {
2589 .num_items = 4,
2590 .items = {
2591 { "Mic", 0x0 },
2592 { "Front Mic", 0x1 },
2593 { "Line", 0x2 },
2594 { "CD", 0x4 },
2598 /* fixed 8-channels */
2599 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2600 { 8, NULL },
2603 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2604 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2605 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2606 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2607 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2608 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2609 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2610 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2611 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2612 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2613 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2614 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2615 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2616 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2617 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2618 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2619 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2620 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2621 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2623 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2624 .name = "Channel Mode",
2625 .info = alc_ch_mode_info,
2626 .get = alc_ch_mode_get,
2627 .put = alc_ch_mode_put,
2629 { } /* end */
2634 * ALC880 W810 model
2636 * W810 has rear IO for:
2637 * Front (DAC 02)
2638 * Surround (DAC 03)
2639 * Center/LFE (DAC 04)
2640 * Digital out (06)
2642 * The system also has a pair of internal speakers, and a headphone jack.
2643 * These are both connected to Line2 on the codec, hence to DAC 02.
2645 * There is a variable resistor to control the speaker or headphone
2646 * volume. This is a hardware-only device without a software API.
2648 * Plugging headphones in will disable the internal speakers. This is
2649 * implemented in hardware, not via the driver using jack sense. In
2650 * a similar fashion, plugging into the rear socket marked "front" will
2651 * disable both the speakers and headphones.
2653 * For input, there's a microphone jack, and an "audio in" jack.
2654 * These may not do anything useful with this driver yet, because I
2655 * haven't setup any initialization verbs for these yet...
2658 static hda_nid_t alc880_w810_dac_nids[3] = {
2659 /* front, rear/surround, clfe */
2660 0x02, 0x03, 0x04
2663 /* fixed 6 channels */
2664 static struct hda_channel_mode alc880_w810_modes[1] = {
2665 { 6, NULL }
2668 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2669 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2670 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2671 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2672 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2673 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2674 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2675 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2676 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2677 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2678 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2679 { } /* end */
2684 * Z710V model
2686 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2687 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2688 * Line = 0x1a
2691 static hda_nid_t alc880_z71v_dac_nids[1] = {
2692 0x02
2694 #define ALC880_Z71V_HP_DAC 0x03
2696 /* fixed 2 channels */
2697 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2698 { 2, NULL }
2701 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2702 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2703 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2704 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2705 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2706 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2707 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2710 { } /* end */
2715 * ALC880 F1734 model
2717 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2718 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2721 static hda_nid_t alc880_f1734_dac_nids[1] = {
2722 0x03
2724 #define ALC880_F1734_HP_DAC 0x02
2726 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2727 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2728 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2729 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2730 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2731 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2732 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2733 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2734 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2735 { } /* end */
2738 static struct hda_input_mux alc880_f1734_capture_source = {
2739 .num_items = 2,
2740 .items = {
2741 { "Mic", 0x1 },
2742 { "CD", 0x4 },
2748 * ALC880 ASUS model
2750 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2751 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2752 * Mic = 0x18, Line = 0x1a
2755 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2756 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2758 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2759 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2760 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2761 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2762 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2763 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2764 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2765 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2766 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2767 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2768 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2769 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2770 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2772 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2774 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2775 .name = "Channel Mode",
2776 .info = alc_ch_mode_info,
2777 .get = alc_ch_mode_get,
2778 .put = alc_ch_mode_put,
2780 { } /* end */
2784 * ALC880 ASUS W1V model
2786 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2787 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2788 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2791 /* additional mixers to alc880_asus_mixer */
2792 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2793 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2794 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2795 { } /* end */
2798 /* TCL S700 */
2799 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2800 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2801 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2802 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2803 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2804 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2805 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2806 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2807 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2808 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2809 { } /* end */
2812 /* Uniwill */
2813 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2814 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2815 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2816 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2817 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2818 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2819 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2820 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2821 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2822 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2823 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2824 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2825 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2826 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2827 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2828 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2829 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2831 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2832 .name = "Channel Mode",
2833 .info = alc_ch_mode_info,
2834 .get = alc_ch_mode_get,
2835 .put = alc_ch_mode_put,
2837 { } /* end */
2840 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2841 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2842 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2843 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2844 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2845 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2846 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2849 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2850 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2851 { } /* end */
2854 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2855 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2856 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2857 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2858 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2861 { } /* end */
2865 * virtual master controls
2869 * slave controls for virtual master
2871 static const char * const alc_slave_vols[] = {
2872 "Front Playback Volume",
2873 "Surround Playback Volume",
2874 "Center Playback Volume",
2875 "LFE Playback Volume",
2876 "Side Playback Volume",
2877 "Headphone Playback Volume",
2878 "Speaker Playback Volume",
2879 "Mono Playback Volume",
2880 "Line-Out Playback Volume",
2881 "PCM Playback Volume",
2882 NULL,
2885 static const char * const alc_slave_sws[] = {
2886 "Front Playback Switch",
2887 "Surround Playback Switch",
2888 "Center Playback Switch",
2889 "LFE Playback Switch",
2890 "Side Playback Switch",
2891 "Headphone Playback Switch",
2892 "Speaker Playback Switch",
2893 "Mono Playback Switch",
2894 "IEC958 Playback Switch",
2895 "Line-Out Playback Switch",
2896 "PCM Playback Switch",
2897 NULL,
2901 * build control elements
2904 #define NID_MAPPING (-1)
2906 #define SUBDEV_SPEAKER_ (0 << 6)
2907 #define SUBDEV_HP_ (1 << 6)
2908 #define SUBDEV_LINE_ (2 << 6)
2909 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2910 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2911 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2913 static void alc_free_kctls(struct hda_codec *codec);
2915 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2916 /* additional beep mixers; the actual parameters are overwritten at build */
2917 static struct snd_kcontrol_new alc_beep_mixer[] = {
2918 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2919 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2920 { } /* end */
2922 #endif
2924 static int alc_build_controls(struct hda_codec *codec)
2926 struct alc_spec *spec = codec->spec;
2927 struct snd_kcontrol *kctl = NULL;
2928 struct snd_kcontrol_new *knew;
2929 int i, j, err;
2930 unsigned int u;
2931 hda_nid_t nid;
2933 for (i = 0; i < spec->num_mixers; i++) {
2934 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2935 if (err < 0)
2936 return err;
2938 if (spec->cap_mixer) {
2939 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2940 if (err < 0)
2941 return err;
2943 if (spec->multiout.dig_out_nid) {
2944 err = snd_hda_create_spdif_out_ctls(codec,
2945 spec->multiout.dig_out_nid);
2946 if (err < 0)
2947 return err;
2948 if (!spec->no_analog) {
2949 err = snd_hda_create_spdif_share_sw(codec,
2950 &spec->multiout);
2951 if (err < 0)
2952 return err;
2953 spec->multiout.share_spdif = 1;
2956 if (spec->dig_in_nid) {
2957 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2958 if (err < 0)
2959 return err;
2962 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2963 /* create beep controls if needed */
2964 if (spec->beep_amp) {
2965 struct snd_kcontrol_new *knew;
2966 for (knew = alc_beep_mixer; knew->name; knew++) {
2967 struct snd_kcontrol *kctl;
2968 kctl = snd_ctl_new1(knew, codec);
2969 if (!kctl)
2970 return -ENOMEM;
2971 kctl->private_value = spec->beep_amp;
2972 err = snd_hda_ctl_add(codec, 0, kctl);
2973 if (err < 0)
2974 return err;
2977 #endif
2979 /* if we have no master control, let's create it */
2980 if (!spec->no_analog &&
2981 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2982 unsigned int vmaster_tlv[4];
2983 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2984 HDA_OUTPUT, vmaster_tlv);
2985 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2986 vmaster_tlv, alc_slave_vols);
2987 if (err < 0)
2988 return err;
2990 if (!spec->no_analog &&
2991 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2992 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2993 NULL, alc_slave_sws);
2994 if (err < 0)
2995 return err;
2998 /* assign Capture Source enums to NID */
2999 if (spec->capsrc_nids || spec->adc_nids) {
3000 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
3001 if (!kctl)
3002 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3003 for (i = 0; kctl && i < kctl->count; i++) {
3004 hda_nid_t *nids = spec->capsrc_nids;
3005 if (!nids)
3006 nids = spec->adc_nids;
3007 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
3008 if (err < 0)
3009 return err;
3012 if (spec->cap_mixer) {
3013 const char *kname = kctl ? kctl->id.name : NULL;
3014 for (knew = spec->cap_mixer; knew->name; knew++) {
3015 if (kname && strcmp(knew->name, kname) == 0)
3016 continue;
3017 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3018 for (i = 0; kctl && i < kctl->count; i++) {
3019 err = snd_hda_add_nid(codec, kctl, i,
3020 spec->adc_nids[i]);
3021 if (err < 0)
3022 return err;
3027 /* other nid->control mapping */
3028 for (i = 0; i < spec->num_mixers; i++) {
3029 for (knew = spec->mixers[i]; knew->name; knew++) {
3030 if (knew->iface != NID_MAPPING)
3031 continue;
3032 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3033 if (kctl == NULL)
3034 continue;
3035 u = knew->subdevice;
3036 for (j = 0; j < 4; j++, u >>= 8) {
3037 nid = u & 0x3f;
3038 if (nid == 0)
3039 continue;
3040 switch (u & 0xc0) {
3041 case SUBDEV_SPEAKER_:
3042 nid = spec->autocfg.speaker_pins[nid];
3043 break;
3044 case SUBDEV_LINE_:
3045 nid = spec->autocfg.line_out_pins[nid];
3046 break;
3047 case SUBDEV_HP_:
3048 nid = spec->autocfg.hp_pins[nid];
3049 break;
3050 default:
3051 continue;
3053 err = snd_hda_add_nid(codec, kctl, 0, nid);
3054 if (err < 0)
3055 return err;
3057 u = knew->private_value;
3058 for (j = 0; j < 4; j++, u >>= 8) {
3059 nid = u & 0xff;
3060 if (nid == 0)
3061 continue;
3062 err = snd_hda_add_nid(codec, kctl, 0, nid);
3063 if (err < 0)
3064 return err;
3069 alc_free_kctls(codec); /* no longer needed */
3071 return 0;
3076 * initialize the codec volumes, etc
3080 * generic initialization of ADC, input mixers and output mixers
3082 static struct hda_verb alc880_volume_init_verbs[] = {
3084 * Unmute ADC0-2 and set the default input to mic-in
3086 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3087 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3088 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3089 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3090 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3091 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3093 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3094 * mixer widget
3095 * Note: PASD motherboards uses the Line In 2 as the input for front
3096 * panel mic (mic 2)
3098 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3099 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3103 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3104 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3105 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3108 * Set up output mixers (0x0c - 0x0f)
3110 /* set vol=0 to output mixers */
3111 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3112 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3113 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3114 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3115 /* set up input amps for analog loopback */
3116 /* Amp Indices: DAC = 0, mixer = 1 */
3117 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3118 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3119 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3120 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3121 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3122 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3123 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3124 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3130 * 3-stack pin configuration:
3131 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3133 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3135 * preset connection lists of input pins
3136 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3138 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3139 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3140 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3143 * Set pin mode and muting
3145 /* set front pin widgets 0x14 for output */
3146 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3147 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3148 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3149 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3150 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3151 /* Mic2 (as headphone out) for HP output */
3152 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3153 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3154 /* Line In pin widget for input */
3155 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3156 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3157 /* Line2 (as front mic) pin widget for input and vref at 80% */
3158 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3159 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3160 /* CD pin widget for input */
3161 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3167 * 5-stack pin configuration:
3168 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3169 * line-in/side = 0x1a, f-mic = 0x1b
3171 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3173 * preset connection lists of input pins
3174 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3176 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3177 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3180 * Set pin mode and muting
3182 /* set pin widgets 0x14-0x17 for output */
3183 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3184 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3185 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3186 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3187 /* unmute pins for output (no gain on this amp) */
3188 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3189 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3190 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3191 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3193 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3194 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3195 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3196 /* Mic2 (as headphone out) for HP output */
3197 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3198 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3199 /* Line In pin widget for input */
3200 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3201 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3202 /* Line2 (as front mic) pin widget for input and vref at 80% */
3203 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3204 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3205 /* CD pin widget for input */
3206 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3212 * W810 pin configuration:
3213 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3215 static struct hda_verb alc880_pin_w810_init_verbs[] = {
3216 /* hphone/speaker input selector: front DAC */
3217 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3219 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3220 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3221 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3222 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3223 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3224 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3226 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3227 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3233 * Z71V pin configuration:
3234 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3236 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3237 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3238 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3239 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3240 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3242 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3243 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3244 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3245 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3251 * 6-stack pin configuration:
3252 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3253 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3255 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3256 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3259 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3260 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3261 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3262 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3263 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3264 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3265 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3267 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3268 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3269 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3270 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3271 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3272 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3273 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3274 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3275 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3281 * Uniwill pin configuration:
3282 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3283 * line = 0x1a
3285 static struct hda_verb alc880_uniwill_init_verbs[] = {
3286 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3289 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3291 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3292 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3293 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3294 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3295 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3297 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3298 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3299 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3300 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3301 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3303 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3304 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3305 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3306 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3307 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3308 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3309 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3310 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3311 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3313 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3314 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3320 * Uniwill P53
3321 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3323 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3324 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3327 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3328 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3329 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3330 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3331 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3334 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3335 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3336 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3337 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3339 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3340 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3341 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3342 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3343 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3344 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3346 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3347 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3352 static struct hda_verb alc880_beep_init_verbs[] = {
3353 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3357 /* auto-toggle front mic */
3358 static void alc88x_simple_mic_automute(struct hda_codec *codec)
3360 unsigned int present;
3361 unsigned char bits;
3363 present = snd_hda_jack_detect(codec, 0x18);
3364 bits = present ? HDA_AMP_MUTE : 0;
3365 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3368 static void alc880_uniwill_setup(struct hda_codec *codec)
3370 struct alc_spec *spec = codec->spec;
3372 spec->autocfg.hp_pins[0] = 0x14;
3373 spec->autocfg.speaker_pins[0] = 0x15;
3374 spec->autocfg.speaker_pins[0] = 0x16;
3377 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3379 alc_automute_amp(codec);
3380 alc88x_simple_mic_automute(codec);
3383 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3384 unsigned int res)
3386 /* Looks like the unsol event is incompatible with the standard
3387 * definition. 4bit tag is placed at 28 bit!
3389 switch (res >> 28) {
3390 case ALC880_MIC_EVENT:
3391 alc88x_simple_mic_automute(codec);
3392 break;
3393 default:
3394 alc_automute_amp_unsol_event(codec, res);
3395 break;
3399 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3401 struct alc_spec *spec = codec->spec;
3403 spec->autocfg.hp_pins[0] = 0x14;
3404 spec->autocfg.speaker_pins[0] = 0x15;
3407 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3409 unsigned int present;
3411 present = snd_hda_codec_read(codec, 0x21, 0,
3412 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3413 present &= HDA_AMP_VOLMASK;
3414 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3415 HDA_AMP_VOLMASK, present);
3416 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3417 HDA_AMP_VOLMASK, present);
3420 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3421 unsigned int res)
3423 /* Looks like the unsol event is incompatible with the standard
3424 * definition. 4bit tag is placed at 28 bit!
3426 if ((res >> 28) == ALC880_DCVOL_EVENT)
3427 alc880_uniwill_p53_dcvol_automute(codec);
3428 else
3429 alc_automute_amp_unsol_event(codec, res);
3433 * F1734 pin configuration:
3434 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3436 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3437 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3438 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3439 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3440 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3441 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3443 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3444 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3445 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3448 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3449 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3450 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3451 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3452 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3453 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3454 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3455 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3456 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3458 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3459 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3465 * ASUS pin configuration:
3466 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3468 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3469 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3470 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3471 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3472 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3475 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3476 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3477 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3478 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3479 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3480 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3481 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3483 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3484 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3485 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3486 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3487 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3488 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3489 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3490 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3491 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3496 /* Enable GPIO mask and set output */
3497 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3498 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3499 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3501 /* Clevo m520g init */
3502 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3503 /* headphone output */
3504 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3505 /* line-out */
3506 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3507 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3508 /* Line-in */
3509 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3510 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3511 /* CD */
3512 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3513 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3514 /* Mic1 (rear panel) */
3515 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3516 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3517 /* Mic2 (front panel) */
3518 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3519 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3520 /* headphone */
3521 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3522 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3523 /* change to EAPD mode */
3524 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3525 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3530 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3531 /* change to EAPD mode */
3532 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3533 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3535 /* Headphone output */
3536 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3537 /* Front output*/
3538 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3539 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3541 /* Line In pin widget for input */
3542 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3543 /* CD pin widget for input */
3544 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3545 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3546 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3548 /* change to EAPD mode */
3549 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3550 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3556 * LG m1 express dual
3558 * Pin assignment:
3559 * Rear Line-In/Out (blue): 0x14
3560 * Build-in Mic-In: 0x15
3561 * Speaker-out: 0x17
3562 * HP-Out (green): 0x1b
3563 * Mic-In/Out (red): 0x19
3564 * SPDIF-Out: 0x1e
3567 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3568 static hda_nid_t alc880_lg_dac_nids[3] = {
3569 0x05, 0x02, 0x03
3572 /* seems analog CD is not working */
3573 static struct hda_input_mux alc880_lg_capture_source = {
3574 .num_items = 3,
3575 .items = {
3576 { "Mic", 0x1 },
3577 { "Line", 0x5 },
3578 { "Internal Mic", 0x6 },
3582 /* 2,4,6 channel modes */
3583 static struct hda_verb alc880_lg_ch2_init[] = {
3584 /* set line-in and mic-in to input */
3585 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3586 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3590 static struct hda_verb alc880_lg_ch4_init[] = {
3591 /* set line-in to out and mic-in to input */
3592 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3593 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3597 static struct hda_verb alc880_lg_ch6_init[] = {
3598 /* set line-in and mic-in to output */
3599 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3600 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3604 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3605 { 2, alc880_lg_ch2_init },
3606 { 4, alc880_lg_ch4_init },
3607 { 6, alc880_lg_ch6_init },
3610 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3611 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3612 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3613 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3614 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3615 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3616 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3617 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3618 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3619 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3620 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3621 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3622 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3623 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3624 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3626 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3627 .name = "Channel Mode",
3628 .info = alc_ch_mode_info,
3629 .get = alc_ch_mode_get,
3630 .put = alc_ch_mode_put,
3632 { } /* end */
3635 static struct hda_verb alc880_lg_init_verbs[] = {
3636 /* set capture source to mic-in */
3637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3638 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3639 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3640 /* mute all amp mixer inputs */
3641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3644 /* line-in to input */
3645 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3646 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3647 /* built-in mic */
3648 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3649 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3650 /* speaker-out */
3651 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3652 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3653 /* mic-in to input */
3654 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3655 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3656 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3657 /* HP-out */
3658 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3659 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3660 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3661 /* jack sense */
3662 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3666 /* toggle speaker-output according to the hp-jack state */
3667 static void alc880_lg_setup(struct hda_codec *codec)
3669 struct alc_spec *spec = codec->spec;
3671 spec->autocfg.hp_pins[0] = 0x1b;
3672 spec->autocfg.speaker_pins[0] = 0x17;
3676 * LG LW20
3678 * Pin assignment:
3679 * Speaker-out: 0x14
3680 * Mic-In: 0x18
3681 * Built-in Mic-In: 0x19
3682 * Line-In: 0x1b
3683 * HP-Out: 0x1a
3684 * SPDIF-Out: 0x1e
3687 static struct hda_input_mux alc880_lg_lw_capture_source = {
3688 .num_items = 3,
3689 .items = {
3690 { "Mic", 0x0 },
3691 { "Internal Mic", 0x1 },
3692 { "Line In", 0x2 },
3696 #define alc880_lg_lw_modes alc880_threestack_modes
3698 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3699 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3700 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3701 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3702 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3703 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3704 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3705 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3706 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3707 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3708 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3709 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3710 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3711 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3712 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3714 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3715 .name = "Channel Mode",
3716 .info = alc_ch_mode_info,
3717 .get = alc_ch_mode_get,
3718 .put = alc_ch_mode_put,
3720 { } /* end */
3723 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3724 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3725 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3726 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3728 /* set capture source to mic-in */
3729 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3730 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3731 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3733 /* speaker-out */
3734 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3735 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3736 /* HP-out */
3737 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3738 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3739 /* mic-in to input */
3740 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3741 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3742 /* built-in mic */
3743 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3744 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3745 /* jack sense */
3746 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3750 /* toggle speaker-output according to the hp-jack state */
3751 static void alc880_lg_lw_setup(struct hda_codec *codec)
3753 struct alc_spec *spec = codec->spec;
3755 spec->autocfg.hp_pins[0] = 0x1b;
3756 spec->autocfg.speaker_pins[0] = 0x14;
3759 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3760 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3761 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3762 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3763 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3764 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3765 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3766 { } /* end */
3769 static struct hda_input_mux alc880_medion_rim_capture_source = {
3770 .num_items = 2,
3771 .items = {
3772 { "Mic", 0x0 },
3773 { "Internal Mic", 0x1 },
3777 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3778 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3780 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3781 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3783 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3784 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3785 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3786 /* Mic2 (as headphone out) for HP output */
3787 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3788 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3789 /* Internal Speaker */
3790 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3791 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3793 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3794 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3796 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3800 /* toggle speaker-output according to the hp-jack state */
3801 static void alc880_medion_rim_automute(struct hda_codec *codec)
3803 struct alc_spec *spec = codec->spec;
3804 alc_automute_amp(codec);
3805 /* toggle EAPD */
3806 if (spec->jack_present)
3807 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3808 else
3809 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3812 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3813 unsigned int res)
3815 /* Looks like the unsol event is incompatible with the standard
3816 * definition. 4bit tag is placed at 28 bit!
3818 if ((res >> 28) == ALC880_HP_EVENT)
3819 alc880_medion_rim_automute(codec);
3822 static void alc880_medion_rim_setup(struct hda_codec *codec)
3824 struct alc_spec *spec = codec->spec;
3826 spec->autocfg.hp_pins[0] = 0x14;
3827 spec->autocfg.speaker_pins[0] = 0x1b;
3830 #ifdef CONFIG_SND_HDA_POWER_SAVE
3831 static struct hda_amp_list alc880_loopbacks[] = {
3832 { 0x0b, HDA_INPUT, 0 },
3833 { 0x0b, HDA_INPUT, 1 },
3834 { 0x0b, HDA_INPUT, 2 },
3835 { 0x0b, HDA_INPUT, 3 },
3836 { 0x0b, HDA_INPUT, 4 },
3837 { } /* end */
3840 static struct hda_amp_list alc880_lg_loopbacks[] = {
3841 { 0x0b, HDA_INPUT, 1 },
3842 { 0x0b, HDA_INPUT, 6 },
3843 { 0x0b, HDA_INPUT, 7 },
3844 { } /* end */
3846 #endif
3849 * Common callbacks
3852 static void alc_init_special_input_src(struct hda_codec *codec);
3854 static int alc_init(struct hda_codec *codec)
3856 struct alc_spec *spec = codec->spec;
3857 unsigned int i;
3859 alc_fix_pll(codec);
3860 alc_auto_init_amp(codec, spec->init_amp);
3862 for (i = 0; i < spec->num_init_verbs; i++)
3863 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3864 alc_init_special_input_src(codec);
3866 if (spec->init_hook)
3867 spec->init_hook(codec);
3869 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
3871 hda_call_check_power_status(codec, 0x01);
3872 return 0;
3875 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3877 struct alc_spec *spec = codec->spec;
3879 if (spec->unsol_event)
3880 spec->unsol_event(codec, res);
3883 #ifdef CONFIG_SND_HDA_POWER_SAVE
3884 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3886 struct alc_spec *spec = codec->spec;
3887 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3889 #endif
3892 * Analog playback callbacks
3894 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3895 struct hda_codec *codec,
3896 struct snd_pcm_substream *substream)
3898 struct alc_spec *spec = codec->spec;
3899 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3900 hinfo);
3903 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3904 struct hda_codec *codec,
3905 unsigned int stream_tag,
3906 unsigned int format,
3907 struct snd_pcm_substream *substream)
3909 struct alc_spec *spec = codec->spec;
3910 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3911 stream_tag, format, substream);
3914 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3915 struct hda_codec *codec,
3916 struct snd_pcm_substream *substream)
3918 struct alc_spec *spec = codec->spec;
3919 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3923 * Digital out
3925 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3926 struct hda_codec *codec,
3927 struct snd_pcm_substream *substream)
3929 struct alc_spec *spec = codec->spec;
3930 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3933 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3934 struct hda_codec *codec,
3935 unsigned int stream_tag,
3936 unsigned int format,
3937 struct snd_pcm_substream *substream)
3939 struct alc_spec *spec = codec->spec;
3940 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3941 stream_tag, format, substream);
3944 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3945 struct hda_codec *codec,
3946 struct snd_pcm_substream *substream)
3948 struct alc_spec *spec = codec->spec;
3949 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3952 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3953 struct hda_codec *codec,
3954 struct snd_pcm_substream *substream)
3956 struct alc_spec *spec = codec->spec;
3957 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3961 * Analog capture
3963 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3964 struct hda_codec *codec,
3965 unsigned int stream_tag,
3966 unsigned int format,
3967 struct snd_pcm_substream *substream)
3969 struct alc_spec *spec = codec->spec;
3971 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3972 stream_tag, 0, format);
3973 return 0;
3976 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3977 struct hda_codec *codec,
3978 struct snd_pcm_substream *substream)
3980 struct alc_spec *spec = codec->spec;
3982 snd_hda_codec_cleanup_stream(codec,
3983 spec->adc_nids[substream->number + 1]);
3984 return 0;
3987 /* analog capture with dynamic dual-adc changes */
3988 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3989 struct hda_codec *codec,
3990 unsigned int stream_tag,
3991 unsigned int format,
3992 struct snd_pcm_substream *substream)
3994 struct alc_spec *spec = codec->spec;
3995 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
3996 spec->cur_adc_stream_tag = stream_tag;
3997 spec->cur_adc_format = format;
3998 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
3999 return 0;
4002 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4003 struct hda_codec *codec,
4004 struct snd_pcm_substream *substream)
4006 struct alc_spec *spec = codec->spec;
4007 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
4008 spec->cur_adc = 0;
4009 return 0;
4012 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
4013 .substreams = 1,
4014 .channels_min = 2,
4015 .channels_max = 2,
4016 .nid = 0, /* fill later */
4017 .ops = {
4018 .prepare = dualmic_capture_pcm_prepare,
4019 .cleanup = dualmic_capture_pcm_cleanup
4025 static struct hda_pcm_stream alc880_pcm_analog_playback = {
4026 .substreams = 1,
4027 .channels_min = 2,
4028 .channels_max = 8,
4029 /* NID is set in alc_build_pcms */
4030 .ops = {
4031 .open = alc880_playback_pcm_open,
4032 .prepare = alc880_playback_pcm_prepare,
4033 .cleanup = alc880_playback_pcm_cleanup
4037 static struct hda_pcm_stream alc880_pcm_analog_capture = {
4038 .substreams = 1,
4039 .channels_min = 2,
4040 .channels_max = 2,
4041 /* NID is set in alc_build_pcms */
4044 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4045 .substreams = 1,
4046 .channels_min = 2,
4047 .channels_max = 2,
4048 /* NID is set in alc_build_pcms */
4051 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4052 .substreams = 2, /* can be overridden */
4053 .channels_min = 2,
4054 .channels_max = 2,
4055 /* NID is set in alc_build_pcms */
4056 .ops = {
4057 .prepare = alc880_alt_capture_pcm_prepare,
4058 .cleanup = alc880_alt_capture_pcm_cleanup
4062 static struct hda_pcm_stream alc880_pcm_digital_playback = {
4063 .substreams = 1,
4064 .channels_min = 2,
4065 .channels_max = 2,
4066 /* NID is set in alc_build_pcms */
4067 .ops = {
4068 .open = alc880_dig_playback_pcm_open,
4069 .close = alc880_dig_playback_pcm_close,
4070 .prepare = alc880_dig_playback_pcm_prepare,
4071 .cleanup = alc880_dig_playback_pcm_cleanup
4075 static struct hda_pcm_stream alc880_pcm_digital_capture = {
4076 .substreams = 1,
4077 .channels_min = 2,
4078 .channels_max = 2,
4079 /* NID is set in alc_build_pcms */
4082 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4083 static struct hda_pcm_stream alc_pcm_null_stream = {
4084 .substreams = 0,
4085 .channels_min = 0,
4086 .channels_max = 0,
4089 static int alc_build_pcms(struct hda_codec *codec)
4091 struct alc_spec *spec = codec->spec;
4092 struct hda_pcm *info = spec->pcm_rec;
4093 int i;
4095 codec->num_pcms = 1;
4096 codec->pcm_info = info;
4098 if (spec->no_analog)
4099 goto skip_analog;
4101 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4102 "%s Analog", codec->chip_name);
4103 info->name = spec->stream_name_analog;
4105 if (spec->stream_analog_playback) {
4106 if (snd_BUG_ON(!spec->multiout.dac_nids))
4107 return -EINVAL;
4108 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4109 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4111 if (spec->stream_analog_capture) {
4112 if (snd_BUG_ON(!spec->adc_nids))
4113 return -EINVAL;
4114 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4115 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4118 if (spec->channel_mode) {
4119 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4120 for (i = 0; i < spec->num_channel_mode; i++) {
4121 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4122 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4127 skip_analog:
4128 /* SPDIF for stream index #1 */
4129 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4130 snprintf(spec->stream_name_digital,
4131 sizeof(spec->stream_name_digital),
4132 "%s Digital", codec->chip_name);
4133 codec->num_pcms = 2;
4134 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4135 info = spec->pcm_rec + 1;
4136 info->name = spec->stream_name_digital;
4137 if (spec->dig_out_type)
4138 info->pcm_type = spec->dig_out_type;
4139 else
4140 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4141 if (spec->multiout.dig_out_nid &&
4142 spec->stream_digital_playback) {
4143 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4144 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4146 if (spec->dig_in_nid &&
4147 spec->stream_digital_capture) {
4148 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4149 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4151 /* FIXME: do we need this for all Realtek codec models? */
4152 codec->spdif_status_reset = 1;
4155 if (spec->no_analog)
4156 return 0;
4158 /* If the use of more than one ADC is requested for the current
4159 * model, configure a second analog capture-only PCM.
4161 /* Additional Analaog capture for index #2 */
4162 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4163 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4164 codec->num_pcms = 3;
4165 info = spec->pcm_rec + 2;
4166 info->name = spec->stream_name_analog;
4167 if (spec->alt_dac_nid) {
4168 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4169 *spec->stream_analog_alt_playback;
4170 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4171 spec->alt_dac_nid;
4172 } else {
4173 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4174 alc_pcm_null_stream;
4175 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4177 if (spec->num_adc_nids > 1) {
4178 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4179 *spec->stream_analog_alt_capture;
4180 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4181 spec->adc_nids[1];
4182 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4183 spec->num_adc_nids - 1;
4184 } else {
4185 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4186 alc_pcm_null_stream;
4187 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4191 return 0;
4194 static inline void alc_shutup(struct hda_codec *codec)
4196 snd_hda_shutup_pins(codec);
4199 static void alc_free_kctls(struct hda_codec *codec)
4201 struct alc_spec *spec = codec->spec;
4203 if (spec->kctls.list) {
4204 struct snd_kcontrol_new *kctl = spec->kctls.list;
4205 int i;
4206 for (i = 0; i < spec->kctls.used; i++)
4207 kfree(kctl[i].name);
4209 snd_array_free(&spec->kctls);
4212 static void alc_free(struct hda_codec *codec)
4214 struct alc_spec *spec = codec->spec;
4216 if (!spec)
4217 return;
4219 alc_shutup(codec);
4220 snd_hda_input_jack_free(codec);
4221 alc_free_kctls(codec);
4222 kfree(spec);
4223 snd_hda_detach_beep_device(codec);
4226 #ifdef CONFIG_SND_HDA_POWER_SAVE
4227 static void alc_power_eapd(struct hda_codec *codec)
4229 /* We currently only handle front, HP */
4230 switch (codec->vendor_id) {
4231 case 0x10ec0260:
4232 set_eapd(codec, 0x0f, 0);
4233 set_eapd(codec, 0x10, 0);
4234 break;
4235 case 0x10ec0262:
4236 case 0x10ec0267:
4237 case 0x10ec0268:
4238 case 0x10ec0269:
4239 case 0x10ec0270:
4240 case 0x10ec0272:
4241 case 0x10ec0660:
4242 case 0x10ec0662:
4243 case 0x10ec0663:
4244 case 0x10ec0665:
4245 case 0x10ec0862:
4246 case 0x10ec0889:
4247 set_eapd(codec, 0x14, 0);
4248 set_eapd(codec, 0x15, 0);
4249 break;
4253 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4255 struct alc_spec *spec = codec->spec;
4256 alc_shutup(codec);
4257 if (spec && spec->power_hook)
4258 spec->power_hook(codec);
4259 return 0;
4261 #endif
4263 #ifdef SND_HDA_NEEDS_RESUME
4264 static int alc_resume(struct hda_codec *codec)
4266 codec->patch_ops.init(codec);
4267 snd_hda_codec_resume_amp(codec);
4268 snd_hda_codec_resume_cache(codec);
4269 hda_call_check_power_status(codec, 0x01);
4270 return 0;
4272 #endif
4276 static struct hda_codec_ops alc_patch_ops = {
4277 .build_controls = alc_build_controls,
4278 .build_pcms = alc_build_pcms,
4279 .init = alc_init,
4280 .free = alc_free,
4281 .unsol_event = alc_unsol_event,
4282 #ifdef SND_HDA_NEEDS_RESUME
4283 .resume = alc_resume,
4284 #endif
4285 #ifdef CONFIG_SND_HDA_POWER_SAVE
4286 .suspend = alc_suspend,
4287 .check_power_status = alc_check_power_status,
4288 #endif
4289 .reboot_notify = alc_shutup,
4292 /* replace the codec chip_name with the given string */
4293 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4295 kfree(codec->chip_name);
4296 codec->chip_name = kstrdup(name, GFP_KERNEL);
4297 if (!codec->chip_name) {
4298 alc_free(codec);
4299 return -ENOMEM;
4301 return 0;
4305 * Test configuration for debugging
4307 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4308 * enum controls.
4310 #ifdef CONFIG_SND_DEBUG
4311 static hda_nid_t alc880_test_dac_nids[4] = {
4312 0x02, 0x03, 0x04, 0x05
4315 static struct hda_input_mux alc880_test_capture_source = {
4316 .num_items = 7,
4317 .items = {
4318 { "In-1", 0x0 },
4319 { "In-2", 0x1 },
4320 { "In-3", 0x2 },
4321 { "In-4", 0x3 },
4322 { "CD", 0x4 },
4323 { "Front", 0x5 },
4324 { "Surround", 0x6 },
4328 static struct hda_channel_mode alc880_test_modes[4] = {
4329 { 2, NULL },
4330 { 4, NULL },
4331 { 6, NULL },
4332 { 8, NULL },
4335 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4336 struct snd_ctl_elem_info *uinfo)
4338 static char *texts[] = {
4339 "N/A", "Line Out", "HP Out",
4340 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4342 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4343 uinfo->count = 1;
4344 uinfo->value.enumerated.items = 8;
4345 if (uinfo->value.enumerated.item >= 8)
4346 uinfo->value.enumerated.item = 7;
4347 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4348 return 0;
4351 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4352 struct snd_ctl_elem_value *ucontrol)
4354 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4355 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4356 unsigned int pin_ctl, item = 0;
4358 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4359 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4360 if (pin_ctl & AC_PINCTL_OUT_EN) {
4361 if (pin_ctl & AC_PINCTL_HP_EN)
4362 item = 2;
4363 else
4364 item = 1;
4365 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4366 switch (pin_ctl & AC_PINCTL_VREFEN) {
4367 case AC_PINCTL_VREF_HIZ: item = 3; break;
4368 case AC_PINCTL_VREF_50: item = 4; break;
4369 case AC_PINCTL_VREF_GRD: item = 5; break;
4370 case AC_PINCTL_VREF_80: item = 6; break;
4371 case AC_PINCTL_VREF_100: item = 7; break;
4374 ucontrol->value.enumerated.item[0] = item;
4375 return 0;
4378 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4379 struct snd_ctl_elem_value *ucontrol)
4381 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4382 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4383 static unsigned int ctls[] = {
4384 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4385 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4386 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4387 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4388 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4389 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4391 unsigned int old_ctl, new_ctl;
4393 old_ctl = snd_hda_codec_read(codec, nid, 0,
4394 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4395 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4396 if (old_ctl != new_ctl) {
4397 int val;
4398 snd_hda_codec_write_cache(codec, nid, 0,
4399 AC_VERB_SET_PIN_WIDGET_CONTROL,
4400 new_ctl);
4401 val = ucontrol->value.enumerated.item[0] >= 3 ?
4402 HDA_AMP_MUTE : 0;
4403 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4404 HDA_AMP_MUTE, val);
4405 return 1;
4407 return 0;
4410 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4411 struct snd_ctl_elem_info *uinfo)
4413 static char *texts[] = {
4414 "Front", "Surround", "CLFE", "Side"
4416 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4417 uinfo->count = 1;
4418 uinfo->value.enumerated.items = 4;
4419 if (uinfo->value.enumerated.item >= 4)
4420 uinfo->value.enumerated.item = 3;
4421 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4422 return 0;
4425 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4426 struct snd_ctl_elem_value *ucontrol)
4428 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4429 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4430 unsigned int sel;
4432 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4433 ucontrol->value.enumerated.item[0] = sel & 3;
4434 return 0;
4437 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4438 struct snd_ctl_elem_value *ucontrol)
4440 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4441 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4442 unsigned int sel;
4444 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4445 if (ucontrol->value.enumerated.item[0] != sel) {
4446 sel = ucontrol->value.enumerated.item[0] & 3;
4447 snd_hda_codec_write_cache(codec, nid, 0,
4448 AC_VERB_SET_CONNECT_SEL, sel);
4449 return 1;
4451 return 0;
4454 #define PIN_CTL_TEST(xname,nid) { \
4455 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4456 .name = xname, \
4457 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4458 .info = alc_test_pin_ctl_info, \
4459 .get = alc_test_pin_ctl_get, \
4460 .put = alc_test_pin_ctl_put, \
4461 .private_value = nid \
4464 #define PIN_SRC_TEST(xname,nid) { \
4465 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4466 .name = xname, \
4467 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4468 .info = alc_test_pin_src_info, \
4469 .get = alc_test_pin_src_get, \
4470 .put = alc_test_pin_src_put, \
4471 .private_value = nid \
4474 static struct snd_kcontrol_new alc880_test_mixer[] = {
4475 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4476 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4477 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4478 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4479 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4480 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4481 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4482 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4483 PIN_CTL_TEST("Front Pin Mode", 0x14),
4484 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4485 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4486 PIN_CTL_TEST("Side Pin Mode", 0x17),
4487 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4488 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4489 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4490 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4491 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4492 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4493 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4494 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4495 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4496 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4497 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4498 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4499 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4500 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4501 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4502 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4503 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4504 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4506 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4507 .name = "Channel Mode",
4508 .info = alc_ch_mode_info,
4509 .get = alc_ch_mode_get,
4510 .put = alc_ch_mode_put,
4512 { } /* end */
4515 static struct hda_verb alc880_test_init_verbs[] = {
4516 /* Unmute inputs of 0x0c - 0x0f */
4517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4519 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4521 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4522 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4523 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4524 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4525 /* Vol output for 0x0c-0x0f */
4526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4527 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4528 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4529 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4530 /* Set output pins 0x14-0x17 */
4531 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4532 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4533 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4534 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4535 /* Unmute output pins 0x14-0x17 */
4536 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4537 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4538 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4539 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4540 /* Set input pins 0x18-0x1c */
4541 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4542 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4543 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4544 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4545 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4546 /* Mute input pins 0x18-0x1b */
4547 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4548 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4549 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4550 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4551 /* ADC set up */
4552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4553 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4554 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4555 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4556 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4557 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4558 /* Analog input/passthru */
4559 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4560 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4561 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4562 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4563 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4566 #endif
4571 static const char * const alc880_models[ALC880_MODEL_LAST] = {
4572 [ALC880_3ST] = "3stack",
4573 [ALC880_TCL_S700] = "tcl",
4574 [ALC880_3ST_DIG] = "3stack-digout",
4575 [ALC880_CLEVO] = "clevo",
4576 [ALC880_5ST] = "5stack",
4577 [ALC880_5ST_DIG] = "5stack-digout",
4578 [ALC880_W810] = "w810",
4579 [ALC880_Z71V] = "z71v",
4580 [ALC880_6ST] = "6stack",
4581 [ALC880_6ST_DIG] = "6stack-digout",
4582 [ALC880_ASUS] = "asus",
4583 [ALC880_ASUS_W1V] = "asus-w1v",
4584 [ALC880_ASUS_DIG] = "asus-dig",
4585 [ALC880_ASUS_DIG2] = "asus-dig2",
4586 [ALC880_UNIWILL_DIG] = "uniwill",
4587 [ALC880_UNIWILL_P53] = "uniwill-p53",
4588 [ALC880_FUJITSU] = "fujitsu",
4589 [ALC880_F1734] = "F1734",
4590 [ALC880_LG] = "lg",
4591 [ALC880_LG_LW] = "lg-lw",
4592 [ALC880_MEDION_RIM] = "medion",
4593 #ifdef CONFIG_SND_DEBUG
4594 [ALC880_TEST] = "test",
4595 #endif
4596 [ALC880_AUTO] = "auto",
4599 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4600 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4601 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4602 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4603 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4604 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4605 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4606 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4607 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4608 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4609 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4610 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4611 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4612 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4613 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4614 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4615 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4616 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4617 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4618 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4619 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4620 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4621 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4622 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4623 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4624 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4625 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4626 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4627 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4628 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4629 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4630 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4631 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4632 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4633 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4634 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4635 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4636 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4637 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4638 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4639 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4640 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734),
4641 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4642 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4643 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4644 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4645 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4646 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4647 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4648 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4649 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4650 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4651 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4652 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4653 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
4654 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4655 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4656 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4657 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4658 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4659 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4660 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4661 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4662 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4663 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4664 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4665 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4666 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4667 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4668 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4669 /* default Intel */
4670 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4671 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4672 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4677 * ALC880 codec presets
4679 static struct alc_config_preset alc880_presets[] = {
4680 [ALC880_3ST] = {
4681 .mixers = { alc880_three_stack_mixer },
4682 .init_verbs = { alc880_volume_init_verbs,
4683 alc880_pin_3stack_init_verbs },
4684 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4685 .dac_nids = alc880_dac_nids,
4686 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4687 .channel_mode = alc880_threestack_modes,
4688 .need_dac_fix = 1,
4689 .input_mux = &alc880_capture_source,
4691 [ALC880_3ST_DIG] = {
4692 .mixers = { alc880_three_stack_mixer },
4693 .init_verbs = { alc880_volume_init_verbs,
4694 alc880_pin_3stack_init_verbs },
4695 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4696 .dac_nids = alc880_dac_nids,
4697 .dig_out_nid = ALC880_DIGOUT_NID,
4698 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4699 .channel_mode = alc880_threestack_modes,
4700 .need_dac_fix = 1,
4701 .input_mux = &alc880_capture_source,
4703 [ALC880_TCL_S700] = {
4704 .mixers = { alc880_tcl_s700_mixer },
4705 .init_verbs = { alc880_volume_init_verbs,
4706 alc880_pin_tcl_S700_init_verbs,
4707 alc880_gpio2_init_verbs },
4708 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4709 .dac_nids = alc880_dac_nids,
4710 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4711 .num_adc_nids = 1, /* single ADC */
4712 .hp_nid = 0x03,
4713 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4714 .channel_mode = alc880_2_jack_modes,
4715 .input_mux = &alc880_capture_source,
4717 [ALC880_5ST] = {
4718 .mixers = { alc880_three_stack_mixer,
4719 alc880_five_stack_mixer},
4720 .init_verbs = { alc880_volume_init_verbs,
4721 alc880_pin_5stack_init_verbs },
4722 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4723 .dac_nids = alc880_dac_nids,
4724 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4725 .channel_mode = alc880_fivestack_modes,
4726 .input_mux = &alc880_capture_source,
4728 [ALC880_5ST_DIG] = {
4729 .mixers = { alc880_three_stack_mixer,
4730 alc880_five_stack_mixer },
4731 .init_verbs = { alc880_volume_init_verbs,
4732 alc880_pin_5stack_init_verbs },
4733 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4734 .dac_nids = alc880_dac_nids,
4735 .dig_out_nid = ALC880_DIGOUT_NID,
4736 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4737 .channel_mode = alc880_fivestack_modes,
4738 .input_mux = &alc880_capture_source,
4740 [ALC880_6ST] = {
4741 .mixers = { alc880_six_stack_mixer },
4742 .init_verbs = { alc880_volume_init_verbs,
4743 alc880_pin_6stack_init_verbs },
4744 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4745 .dac_nids = alc880_6st_dac_nids,
4746 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4747 .channel_mode = alc880_sixstack_modes,
4748 .input_mux = &alc880_6stack_capture_source,
4750 [ALC880_6ST_DIG] = {
4751 .mixers = { alc880_six_stack_mixer },
4752 .init_verbs = { alc880_volume_init_verbs,
4753 alc880_pin_6stack_init_verbs },
4754 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4755 .dac_nids = alc880_6st_dac_nids,
4756 .dig_out_nid = ALC880_DIGOUT_NID,
4757 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4758 .channel_mode = alc880_sixstack_modes,
4759 .input_mux = &alc880_6stack_capture_source,
4761 [ALC880_W810] = {
4762 .mixers = { alc880_w810_base_mixer },
4763 .init_verbs = { alc880_volume_init_verbs,
4764 alc880_pin_w810_init_verbs,
4765 alc880_gpio2_init_verbs },
4766 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4767 .dac_nids = alc880_w810_dac_nids,
4768 .dig_out_nid = ALC880_DIGOUT_NID,
4769 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4770 .channel_mode = alc880_w810_modes,
4771 .input_mux = &alc880_capture_source,
4773 [ALC880_Z71V] = {
4774 .mixers = { alc880_z71v_mixer },
4775 .init_verbs = { alc880_volume_init_verbs,
4776 alc880_pin_z71v_init_verbs },
4777 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4778 .dac_nids = alc880_z71v_dac_nids,
4779 .dig_out_nid = ALC880_DIGOUT_NID,
4780 .hp_nid = 0x03,
4781 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4782 .channel_mode = alc880_2_jack_modes,
4783 .input_mux = &alc880_capture_source,
4785 [ALC880_F1734] = {
4786 .mixers = { alc880_f1734_mixer },
4787 .init_verbs = { alc880_volume_init_verbs,
4788 alc880_pin_f1734_init_verbs },
4789 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4790 .dac_nids = alc880_f1734_dac_nids,
4791 .hp_nid = 0x02,
4792 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4793 .channel_mode = alc880_2_jack_modes,
4794 .input_mux = &alc880_f1734_capture_source,
4795 .unsol_event = alc880_uniwill_p53_unsol_event,
4796 .setup = alc880_uniwill_p53_setup,
4797 .init_hook = alc_automute_amp,
4799 [ALC880_ASUS] = {
4800 .mixers = { alc880_asus_mixer },
4801 .init_verbs = { alc880_volume_init_verbs,
4802 alc880_pin_asus_init_verbs,
4803 alc880_gpio1_init_verbs },
4804 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4805 .dac_nids = alc880_asus_dac_nids,
4806 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4807 .channel_mode = alc880_asus_modes,
4808 .need_dac_fix = 1,
4809 .input_mux = &alc880_capture_source,
4811 [ALC880_ASUS_DIG] = {
4812 .mixers = { alc880_asus_mixer },
4813 .init_verbs = { alc880_volume_init_verbs,
4814 alc880_pin_asus_init_verbs,
4815 alc880_gpio1_init_verbs },
4816 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4817 .dac_nids = alc880_asus_dac_nids,
4818 .dig_out_nid = ALC880_DIGOUT_NID,
4819 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4820 .channel_mode = alc880_asus_modes,
4821 .need_dac_fix = 1,
4822 .input_mux = &alc880_capture_source,
4824 [ALC880_ASUS_DIG2] = {
4825 .mixers = { alc880_asus_mixer },
4826 .init_verbs = { alc880_volume_init_verbs,
4827 alc880_pin_asus_init_verbs,
4828 alc880_gpio2_init_verbs }, /* use GPIO2 */
4829 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4830 .dac_nids = alc880_asus_dac_nids,
4831 .dig_out_nid = ALC880_DIGOUT_NID,
4832 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4833 .channel_mode = alc880_asus_modes,
4834 .need_dac_fix = 1,
4835 .input_mux = &alc880_capture_source,
4837 [ALC880_ASUS_W1V] = {
4838 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4839 .init_verbs = { alc880_volume_init_verbs,
4840 alc880_pin_asus_init_verbs,
4841 alc880_gpio1_init_verbs },
4842 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4843 .dac_nids = alc880_asus_dac_nids,
4844 .dig_out_nid = ALC880_DIGOUT_NID,
4845 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4846 .channel_mode = alc880_asus_modes,
4847 .need_dac_fix = 1,
4848 .input_mux = &alc880_capture_source,
4850 [ALC880_UNIWILL_DIG] = {
4851 .mixers = { alc880_asus_mixer },
4852 .init_verbs = { alc880_volume_init_verbs,
4853 alc880_pin_asus_init_verbs },
4854 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4855 .dac_nids = alc880_asus_dac_nids,
4856 .dig_out_nid = ALC880_DIGOUT_NID,
4857 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4858 .channel_mode = alc880_asus_modes,
4859 .need_dac_fix = 1,
4860 .input_mux = &alc880_capture_source,
4862 [ALC880_UNIWILL] = {
4863 .mixers = { alc880_uniwill_mixer },
4864 .init_verbs = { alc880_volume_init_verbs,
4865 alc880_uniwill_init_verbs },
4866 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4867 .dac_nids = alc880_asus_dac_nids,
4868 .dig_out_nid = ALC880_DIGOUT_NID,
4869 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4870 .channel_mode = alc880_threestack_modes,
4871 .need_dac_fix = 1,
4872 .input_mux = &alc880_capture_source,
4873 .unsol_event = alc880_uniwill_unsol_event,
4874 .setup = alc880_uniwill_setup,
4875 .init_hook = alc880_uniwill_init_hook,
4877 [ALC880_UNIWILL_P53] = {
4878 .mixers = { alc880_uniwill_p53_mixer },
4879 .init_verbs = { alc880_volume_init_verbs,
4880 alc880_uniwill_p53_init_verbs },
4881 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4882 .dac_nids = alc880_asus_dac_nids,
4883 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4884 .channel_mode = alc880_threestack_modes,
4885 .input_mux = &alc880_capture_source,
4886 .unsol_event = alc880_uniwill_p53_unsol_event,
4887 .setup = alc880_uniwill_p53_setup,
4888 .init_hook = alc_automute_amp,
4890 [ALC880_FUJITSU] = {
4891 .mixers = { alc880_fujitsu_mixer },
4892 .init_verbs = { alc880_volume_init_verbs,
4893 alc880_uniwill_p53_init_verbs,
4894 alc880_beep_init_verbs },
4895 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4896 .dac_nids = alc880_dac_nids,
4897 .dig_out_nid = ALC880_DIGOUT_NID,
4898 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4899 .channel_mode = alc880_2_jack_modes,
4900 .input_mux = &alc880_capture_source,
4901 .unsol_event = alc880_uniwill_p53_unsol_event,
4902 .setup = alc880_uniwill_p53_setup,
4903 .init_hook = alc_automute_amp,
4905 [ALC880_CLEVO] = {
4906 .mixers = { alc880_three_stack_mixer },
4907 .init_verbs = { alc880_volume_init_verbs,
4908 alc880_pin_clevo_init_verbs },
4909 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4910 .dac_nids = alc880_dac_nids,
4911 .hp_nid = 0x03,
4912 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4913 .channel_mode = alc880_threestack_modes,
4914 .need_dac_fix = 1,
4915 .input_mux = &alc880_capture_source,
4917 [ALC880_LG] = {
4918 .mixers = { alc880_lg_mixer },
4919 .init_verbs = { alc880_volume_init_verbs,
4920 alc880_lg_init_verbs },
4921 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4922 .dac_nids = alc880_lg_dac_nids,
4923 .dig_out_nid = ALC880_DIGOUT_NID,
4924 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4925 .channel_mode = alc880_lg_ch_modes,
4926 .need_dac_fix = 1,
4927 .input_mux = &alc880_lg_capture_source,
4928 .unsol_event = alc_automute_amp_unsol_event,
4929 .setup = alc880_lg_setup,
4930 .init_hook = alc_automute_amp,
4931 #ifdef CONFIG_SND_HDA_POWER_SAVE
4932 .loopbacks = alc880_lg_loopbacks,
4933 #endif
4935 [ALC880_LG_LW] = {
4936 .mixers = { alc880_lg_lw_mixer },
4937 .init_verbs = { alc880_volume_init_verbs,
4938 alc880_lg_lw_init_verbs },
4939 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4940 .dac_nids = alc880_dac_nids,
4941 .dig_out_nid = ALC880_DIGOUT_NID,
4942 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4943 .channel_mode = alc880_lg_lw_modes,
4944 .input_mux = &alc880_lg_lw_capture_source,
4945 .unsol_event = alc_automute_amp_unsol_event,
4946 .setup = alc880_lg_lw_setup,
4947 .init_hook = alc_automute_amp,
4949 [ALC880_MEDION_RIM] = {
4950 .mixers = { alc880_medion_rim_mixer },
4951 .init_verbs = { alc880_volume_init_verbs,
4952 alc880_medion_rim_init_verbs,
4953 alc_gpio2_init_verbs },
4954 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4955 .dac_nids = alc880_dac_nids,
4956 .dig_out_nid = ALC880_DIGOUT_NID,
4957 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4958 .channel_mode = alc880_2_jack_modes,
4959 .input_mux = &alc880_medion_rim_capture_source,
4960 .unsol_event = alc880_medion_rim_unsol_event,
4961 .setup = alc880_medion_rim_setup,
4962 .init_hook = alc880_medion_rim_automute,
4964 #ifdef CONFIG_SND_DEBUG
4965 [ALC880_TEST] = {
4966 .mixers = { alc880_test_mixer },
4967 .init_verbs = { alc880_test_init_verbs },
4968 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4969 .dac_nids = alc880_test_dac_nids,
4970 .dig_out_nid = ALC880_DIGOUT_NID,
4971 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4972 .channel_mode = alc880_test_modes,
4973 .input_mux = &alc880_test_capture_source,
4975 #endif
4979 * Automatic parse of I/O pins from the BIOS configuration
4982 enum {
4983 ALC_CTL_WIDGET_VOL,
4984 ALC_CTL_WIDGET_MUTE,
4985 ALC_CTL_BIND_MUTE,
4987 static struct snd_kcontrol_new alc880_control_templates[] = {
4988 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4989 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4990 HDA_BIND_MUTE(NULL, 0, 0, 0),
4993 /* add dynamic controls */
4994 static int add_control(struct alc_spec *spec, int type, const char *name,
4995 int cidx, unsigned long val)
4997 struct snd_kcontrol_new *knew;
4999 snd_array_init(&spec->kctls, sizeof(*knew), 32);
5000 knew = snd_array_new(&spec->kctls);
5001 if (!knew)
5002 return -ENOMEM;
5003 *knew = alc880_control_templates[type];
5004 knew->name = kstrdup(name, GFP_KERNEL);
5005 if (!knew->name)
5006 return -ENOMEM;
5007 knew->index = cidx;
5008 if (get_amp_nid_(val))
5009 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
5010 knew->private_value = val;
5011 return 0;
5014 static int add_control_with_pfx(struct alc_spec *spec, int type,
5015 const char *pfx, const char *dir,
5016 const char *sfx, int cidx, unsigned long val)
5018 char name[32];
5019 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
5020 return add_control(spec, type, name, cidx, val);
5023 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5024 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5025 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5026 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5027 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5028 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5029 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5030 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5032 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5033 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5034 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5035 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5036 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5037 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5038 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5039 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5040 #define ALC880_PIN_CD_NID 0x1c
5042 /* fill in the dac_nids table from the parsed pin configuration */
5043 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
5044 const struct auto_pin_cfg *cfg)
5046 hda_nid_t nid;
5047 int assigned[4];
5048 int i, j;
5050 memset(assigned, 0, sizeof(assigned));
5051 spec->multiout.dac_nids = spec->private_dac_nids;
5053 /* check the pins hardwired to audio widget */
5054 for (i = 0; i < cfg->line_outs; i++) {
5055 nid = cfg->line_out_pins[i];
5056 if (alc880_is_fixed_pin(nid)) {
5057 int idx = alc880_fixed_pin_idx(nid);
5058 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
5059 assigned[idx] = 1;
5062 /* left pins can be connect to any audio widget */
5063 for (i = 0; i < cfg->line_outs; i++) {
5064 nid = cfg->line_out_pins[i];
5065 if (alc880_is_fixed_pin(nid))
5066 continue;
5067 /* search for an empty channel */
5068 for (j = 0; j < cfg->line_outs; j++) {
5069 if (!assigned[j]) {
5070 spec->multiout.dac_nids[i] =
5071 alc880_idx_to_dac(j);
5072 assigned[j] = 1;
5073 break;
5077 spec->multiout.num_dacs = cfg->line_outs;
5078 return 0;
5081 static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5082 bool can_be_master)
5084 if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5085 return "Master";
5087 switch (cfg->line_out_type) {
5088 case AUTO_PIN_SPEAKER_OUT:
5089 if (cfg->line_outs == 1)
5090 return "Speaker";
5091 break;
5092 case AUTO_PIN_HP_OUT:
5093 return "Headphone";
5094 default:
5095 if (cfg->line_outs == 1)
5096 return "PCM";
5097 break;
5099 return NULL;
5102 /* add playback controls from the parsed DAC table */
5103 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5104 const struct auto_pin_cfg *cfg)
5106 static const char * const chname[4] = {
5107 "Front", "Surround", NULL /*CLFE*/, "Side"
5109 const char *pfx = alc_get_line_out_pfx(cfg, false);
5110 hda_nid_t nid;
5111 int i, err;
5113 for (i = 0; i < cfg->line_outs; i++) {
5114 if (!spec->multiout.dac_nids[i])
5115 continue;
5116 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5117 if (!pfx && i == 2) {
5118 /* Center/LFE */
5119 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5120 "Center",
5121 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5122 HDA_OUTPUT));
5123 if (err < 0)
5124 return err;
5125 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5126 "LFE",
5127 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5128 HDA_OUTPUT));
5129 if (err < 0)
5130 return err;
5131 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5132 "Center",
5133 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5134 HDA_INPUT));
5135 if (err < 0)
5136 return err;
5137 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5138 "LFE",
5139 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5140 HDA_INPUT));
5141 if (err < 0)
5142 return err;
5143 } else {
5144 const char *name = pfx;
5145 int index = i;
5146 if (!name) {
5147 name = chname[i];
5148 index = 0;
5150 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5151 name, index,
5152 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5153 HDA_OUTPUT));
5154 if (err < 0)
5155 return err;
5156 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5157 name, index,
5158 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5159 HDA_INPUT));
5160 if (err < 0)
5161 return err;
5164 return 0;
5167 /* add playback controls for speaker and HP outputs */
5168 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5169 const char *pfx)
5171 hda_nid_t nid;
5172 int err;
5174 if (!pin)
5175 return 0;
5177 if (alc880_is_fixed_pin(pin)) {
5178 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5179 /* specify the DAC as the extra output */
5180 if (!spec->multiout.hp_nid)
5181 spec->multiout.hp_nid = nid;
5182 else
5183 spec->multiout.extra_out_nid[0] = nid;
5184 /* control HP volume/switch on the output mixer amp */
5185 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5186 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5187 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5188 if (err < 0)
5189 return err;
5190 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5191 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5192 if (err < 0)
5193 return err;
5194 } else if (alc880_is_multi_pin(pin)) {
5195 /* set manual connection */
5196 /* we have only a switch on HP-out PIN */
5197 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5198 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5199 if (err < 0)
5200 return err;
5202 return 0;
5205 /* create input playback/capture controls for the given pin */
5206 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5207 const char *ctlname, int ctlidx,
5208 int idx, hda_nid_t mix_nid)
5210 int err;
5212 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5213 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5214 if (err < 0)
5215 return err;
5216 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5217 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5218 if (err < 0)
5219 return err;
5220 return 0;
5223 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5225 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5226 return (pincap & AC_PINCAP_IN) != 0;
5229 /* create playback/capture controls for input pins */
5230 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5231 const struct auto_pin_cfg *cfg,
5232 hda_nid_t mixer,
5233 hda_nid_t cap1, hda_nid_t cap2)
5235 struct alc_spec *spec = codec->spec;
5236 struct hda_input_mux *imux = &spec->private_imux[0];
5237 int i, err, idx, type_idx = 0;
5238 const char *prev_label = NULL;
5240 for (i = 0; i < cfg->num_inputs; i++) {
5241 hda_nid_t pin;
5242 const char *label;
5244 pin = cfg->inputs[i].pin;
5245 if (!alc_is_input_pin(codec, pin))
5246 continue;
5248 label = hda_get_autocfg_input_label(codec, cfg, i);
5249 if (prev_label && !strcmp(label, prev_label))
5250 type_idx++;
5251 else
5252 type_idx = 0;
5253 prev_label = label;
5255 if (mixer) {
5256 idx = get_connection_index(codec, mixer, pin);
5257 if (idx >= 0) {
5258 err = new_analog_input(spec, pin,
5259 label, type_idx,
5260 idx, mixer);
5261 if (err < 0)
5262 return err;
5266 if (!cap1)
5267 continue;
5268 idx = get_connection_index(codec, cap1, pin);
5269 if (idx < 0 && cap2)
5270 idx = get_connection_index(codec, cap2, pin);
5271 if (idx >= 0)
5272 snd_hda_add_imux_item(imux, label, idx, NULL);
5274 return 0;
5277 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5278 const struct auto_pin_cfg *cfg)
5280 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5283 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5284 unsigned int pin_type)
5286 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5287 pin_type);
5288 /* unmute pin */
5289 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5290 AMP_OUT_UNMUTE);
5293 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5294 hda_nid_t nid, int pin_type,
5295 int dac_idx)
5297 alc_set_pin_output(codec, nid, pin_type);
5298 /* need the manual connection? */
5299 if (alc880_is_multi_pin(nid)) {
5300 struct alc_spec *spec = codec->spec;
5301 int idx = alc880_multi_pin_idx(nid);
5302 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5303 AC_VERB_SET_CONNECT_SEL,
5304 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5308 static int get_pin_type(int line_out_type)
5310 if (line_out_type == AUTO_PIN_HP_OUT)
5311 return PIN_HP;
5312 else
5313 return PIN_OUT;
5316 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5318 struct alc_spec *spec = codec->spec;
5319 int i;
5321 for (i = 0; i < spec->autocfg.line_outs; i++) {
5322 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5323 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5324 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5328 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5330 struct alc_spec *spec = codec->spec;
5331 hda_nid_t pin;
5333 pin = spec->autocfg.speaker_pins[0];
5334 if (pin) /* connect to front */
5335 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5336 pin = spec->autocfg.hp_pins[0];
5337 if (pin) /* connect to front */
5338 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5341 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5343 struct alc_spec *spec = codec->spec;
5344 struct auto_pin_cfg *cfg = &spec->autocfg;
5345 int i;
5347 for (i = 0; i < cfg->num_inputs; i++) {
5348 hda_nid_t nid = cfg->inputs[i].pin;
5349 if (alc_is_input_pin(codec, nid)) {
5350 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5351 if (nid != ALC880_PIN_CD_NID &&
5352 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5353 snd_hda_codec_write(codec, nid, 0,
5354 AC_VERB_SET_AMP_GAIN_MUTE,
5355 AMP_OUT_MUTE);
5360 static void alc880_auto_init_input_src(struct hda_codec *codec)
5362 struct alc_spec *spec = codec->spec;
5363 int c;
5365 for (c = 0; c < spec->num_adc_nids; c++) {
5366 unsigned int mux_idx;
5367 const struct hda_input_mux *imux;
5368 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5369 imux = &spec->input_mux[mux_idx];
5370 if (!imux->num_items && mux_idx > 0)
5371 imux = &spec->input_mux[0];
5372 if (imux)
5373 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5374 AC_VERB_SET_CONNECT_SEL,
5375 imux->items[0].index);
5379 /* parse the BIOS configuration and set up the alc_spec */
5380 /* return 1 if successful, 0 if the proper config is not found,
5381 * or a negative error code
5383 static int alc880_parse_auto_config(struct hda_codec *codec)
5385 struct alc_spec *spec = codec->spec;
5386 int err;
5387 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5389 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5390 alc880_ignore);
5391 if (err < 0)
5392 return err;
5393 if (!spec->autocfg.line_outs)
5394 return 0; /* can't find valid BIOS pin config */
5396 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5397 if (err < 0)
5398 return err;
5399 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5400 if (err < 0)
5401 return err;
5402 err = alc880_auto_create_extra_out(spec,
5403 spec->autocfg.speaker_pins[0],
5404 "Speaker");
5405 if (err < 0)
5406 return err;
5407 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5408 "Headphone");
5409 if (err < 0)
5410 return err;
5411 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5412 if (err < 0)
5413 return err;
5415 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5417 alc_auto_parse_digital(codec);
5419 if (spec->kctls.list)
5420 add_mixer(spec, spec->kctls.list);
5422 add_verb(spec, alc880_volume_init_verbs);
5424 spec->num_mux_defs = 1;
5425 spec->input_mux = &spec->private_imux[0];
5427 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5429 return 1;
5432 /* additional initialization for auto-configuration model */
5433 static void alc880_auto_init(struct hda_codec *codec)
5435 struct alc_spec *spec = codec->spec;
5436 alc880_auto_init_multi_out(codec);
5437 alc880_auto_init_extra_out(codec);
5438 alc880_auto_init_analog_input(codec);
5439 alc880_auto_init_input_src(codec);
5440 alc_auto_init_digital(codec);
5441 if (spec->unsol_event)
5442 alc_inithook(codec);
5445 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5446 * one of two digital mic pins, e.g. on ALC272
5448 static void fixup_automic_adc(struct hda_codec *codec)
5450 struct alc_spec *spec = codec->spec;
5451 int i;
5453 for (i = 0; i < spec->num_adc_nids; i++) {
5454 hda_nid_t cap = spec->capsrc_nids ?
5455 spec->capsrc_nids[i] : spec->adc_nids[i];
5456 int iidx, eidx;
5458 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5459 if (iidx < 0)
5460 continue;
5461 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5462 if (eidx < 0)
5463 continue;
5464 spec->int_mic.mux_idx = iidx;
5465 spec->ext_mic.mux_idx = eidx;
5466 if (spec->capsrc_nids)
5467 spec->capsrc_nids += i;
5468 spec->adc_nids += i;
5469 spec->num_adc_nids = 1;
5470 return;
5472 snd_printd(KERN_INFO "hda_codec: %s: "
5473 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5474 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5475 spec->auto_mic = 0; /* disable auto-mic to be sure */
5478 /* select or unmute the given capsrc route */
5479 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5480 int idx)
5482 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5483 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5484 HDA_AMP_MUTE, 0);
5485 } else {
5486 snd_hda_codec_write_cache(codec, cap, 0,
5487 AC_VERB_SET_CONNECT_SEL, idx);
5491 /* set the default connection to that pin */
5492 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5494 struct alc_spec *spec = codec->spec;
5495 int i;
5497 for (i = 0; i < spec->num_adc_nids; i++) {
5498 hda_nid_t cap = spec->capsrc_nids ?
5499 spec->capsrc_nids[i] : spec->adc_nids[i];
5500 int idx;
5502 idx = get_connection_index(codec, cap, pin);
5503 if (idx < 0)
5504 continue;
5505 select_or_unmute_capsrc(codec, cap, idx);
5506 return i; /* return the found index */
5508 return -1; /* not found */
5511 /* choose the ADC/MUX containing the input pin and initialize the setup */
5512 static void fixup_single_adc(struct hda_codec *codec)
5514 struct alc_spec *spec = codec->spec;
5515 struct auto_pin_cfg *cfg = &spec->autocfg;
5516 int i;
5518 /* search for the input pin; there must be only one */
5519 if (cfg->num_inputs != 1)
5520 return;
5521 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5522 if (i >= 0) {
5523 /* use only this ADC */
5524 if (spec->capsrc_nids)
5525 spec->capsrc_nids += i;
5526 spec->adc_nids += i;
5527 spec->num_adc_nids = 1;
5528 spec->single_input_src = 1;
5532 /* initialize dual adcs */
5533 static void fixup_dual_adc_switch(struct hda_codec *codec)
5535 struct alc_spec *spec = codec->spec;
5536 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5537 init_capsrc_for_pin(codec, spec->int_mic.pin);
5540 /* initialize some special cases for input sources */
5541 static void alc_init_special_input_src(struct hda_codec *codec)
5543 struct alc_spec *spec = codec->spec;
5544 if (spec->dual_adc_switch)
5545 fixup_dual_adc_switch(codec);
5546 else if (spec->single_input_src)
5547 init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin);
5550 static void set_capture_mixer(struct hda_codec *codec)
5552 struct alc_spec *spec = codec->spec;
5553 static struct snd_kcontrol_new *caps[2][3] = {
5554 { alc_capture_mixer_nosrc1,
5555 alc_capture_mixer_nosrc2,
5556 alc_capture_mixer_nosrc3 },
5557 { alc_capture_mixer1,
5558 alc_capture_mixer2,
5559 alc_capture_mixer3 },
5561 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5562 int mux = 0;
5563 int num_adcs = spec->num_adc_nids;
5564 if (spec->dual_adc_switch)
5565 num_adcs = 1;
5566 else if (spec->auto_mic)
5567 fixup_automic_adc(codec);
5568 else if (spec->input_mux) {
5569 if (spec->input_mux->num_items > 1)
5570 mux = 1;
5571 else if (spec->input_mux->num_items == 1)
5572 fixup_single_adc(codec);
5574 spec->cap_mixer = caps[mux][num_adcs - 1];
5578 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5579 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5580 int num_nids)
5582 struct alc_spec *spec = codec->spec;
5583 struct auto_pin_cfg *cfg = &spec->autocfg;
5584 int n;
5585 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5587 for (n = 0; n < num_nids; n++) {
5588 hda_nid_t adc, cap;
5589 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5590 int nconns, i, j;
5592 adc = nids[n];
5593 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5594 continue;
5595 cap = adc;
5596 nconns = snd_hda_get_connections(codec, cap, conn,
5597 ARRAY_SIZE(conn));
5598 if (nconns == 1) {
5599 cap = conn[0];
5600 nconns = snd_hda_get_connections(codec, cap, conn,
5601 ARRAY_SIZE(conn));
5603 if (nconns <= 0)
5604 continue;
5605 if (!fallback_adc) {
5606 fallback_adc = adc;
5607 fallback_cap = cap;
5609 for (i = 0; i < cfg->num_inputs; i++) {
5610 hda_nid_t nid = cfg->inputs[i].pin;
5611 for (j = 0; j < nconns; j++) {
5612 if (conn[j] == nid)
5613 break;
5615 if (j >= nconns)
5616 break;
5618 if (i >= cfg->num_inputs) {
5619 int num_adcs = spec->num_adc_nids;
5620 spec->private_adc_nids[num_adcs] = adc;
5621 spec->private_capsrc_nids[num_adcs] = cap;
5622 spec->num_adc_nids++;
5623 spec->adc_nids = spec->private_adc_nids;
5624 if (adc != cap)
5625 spec->capsrc_nids = spec->private_capsrc_nids;
5628 if (!spec->num_adc_nids) {
5629 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5630 " using fallback 0x%x\n",
5631 codec->chip_name, fallback_adc);
5632 spec->private_adc_nids[0] = fallback_adc;
5633 spec->adc_nids = spec->private_adc_nids;
5634 if (fallback_adc != fallback_cap) {
5635 spec->private_capsrc_nids[0] = fallback_cap;
5636 spec->capsrc_nids = spec->private_adc_nids;
5641 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5642 #define set_beep_amp(spec, nid, idx, dir) \
5643 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5645 static struct snd_pci_quirk beep_white_list[] = {
5646 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5647 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5648 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
5649 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5653 static inline int has_cdefine_beep(struct hda_codec *codec)
5655 struct alc_spec *spec = codec->spec;
5656 const struct snd_pci_quirk *q;
5657 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5658 if (q)
5659 return q->value;
5660 return spec->cdefine.enable_pcbeep;
5662 #else
5663 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5664 #define has_cdefine_beep(codec) 0
5665 #endif
5668 * OK, here we have finally the patch for ALC880
5671 static int patch_alc880(struct hda_codec *codec)
5673 struct alc_spec *spec;
5674 int board_config;
5675 int err;
5677 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5678 if (spec == NULL)
5679 return -ENOMEM;
5681 codec->spec = spec;
5683 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5684 alc880_models,
5685 alc880_cfg_tbl);
5686 if (board_config < 0) {
5687 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5688 codec->chip_name);
5689 board_config = ALC880_AUTO;
5692 if (board_config == ALC880_AUTO) {
5693 /* automatic parse from the BIOS config */
5694 err = alc880_parse_auto_config(codec);
5695 if (err < 0) {
5696 alc_free(codec);
5697 return err;
5698 } else if (!err) {
5699 printk(KERN_INFO
5700 "hda_codec: Cannot set up configuration "
5701 "from BIOS. Using 3-stack mode...\n");
5702 board_config = ALC880_3ST;
5706 err = snd_hda_attach_beep_device(codec, 0x1);
5707 if (err < 0) {
5708 alc_free(codec);
5709 return err;
5712 if (board_config != ALC880_AUTO)
5713 setup_preset(codec, &alc880_presets[board_config]);
5715 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5716 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5717 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5719 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5720 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5722 if (!spec->adc_nids && spec->input_mux) {
5723 /* check whether NID 0x07 is valid */
5724 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5725 /* get type */
5726 wcap = get_wcaps_type(wcap);
5727 if (wcap != AC_WID_AUD_IN) {
5728 spec->adc_nids = alc880_adc_nids_alt;
5729 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5730 } else {
5731 spec->adc_nids = alc880_adc_nids;
5732 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5735 set_capture_mixer(codec);
5736 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5738 spec->vmaster_nid = 0x0c;
5740 codec->patch_ops = alc_patch_ops;
5741 if (board_config == ALC880_AUTO)
5742 spec->init_hook = alc880_auto_init;
5743 #ifdef CONFIG_SND_HDA_POWER_SAVE
5744 if (!spec->loopback.amplist)
5745 spec->loopback.amplist = alc880_loopbacks;
5746 #endif
5748 return 0;
5753 * ALC260 support
5756 static hda_nid_t alc260_dac_nids[1] = {
5757 /* front */
5758 0x02,
5761 static hda_nid_t alc260_adc_nids[1] = {
5762 /* ADC0 */
5763 0x04,
5766 static hda_nid_t alc260_adc_nids_alt[1] = {
5767 /* ADC1 */
5768 0x05,
5771 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5772 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5774 static hda_nid_t alc260_dual_adc_nids[2] = {
5775 /* ADC0, ADC1 */
5776 0x04, 0x05
5779 #define ALC260_DIGOUT_NID 0x03
5780 #define ALC260_DIGIN_NID 0x06
5782 static struct hda_input_mux alc260_capture_source = {
5783 .num_items = 4,
5784 .items = {
5785 { "Mic", 0x0 },
5786 { "Front Mic", 0x1 },
5787 { "Line", 0x2 },
5788 { "CD", 0x4 },
5792 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5793 * headphone jack and the internal CD lines since these are the only pins at
5794 * which audio can appear. For flexibility, also allow the option of
5795 * recording the mixer output on the second ADC (ADC0 doesn't have a
5796 * connection to the mixer output).
5798 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5800 .num_items = 3,
5801 .items = {
5802 { "Mic/Line", 0x0 },
5803 { "CD", 0x4 },
5804 { "Headphone", 0x2 },
5808 .num_items = 4,
5809 .items = {
5810 { "Mic/Line", 0x0 },
5811 { "CD", 0x4 },
5812 { "Headphone", 0x2 },
5813 { "Mixer", 0x5 },
5819 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5820 * the Fujitsu S702x, but jacks are marked differently.
5822 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5824 .num_items = 4,
5825 .items = {
5826 { "Mic", 0x0 },
5827 { "Line", 0x2 },
5828 { "CD", 0x4 },
5829 { "Headphone", 0x5 },
5833 .num_items = 5,
5834 .items = {
5835 { "Mic", 0x0 },
5836 { "Line", 0x2 },
5837 { "CD", 0x4 },
5838 { "Headphone", 0x6 },
5839 { "Mixer", 0x5 },
5844 /* Maxdata Favorit 100XS */
5845 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5847 .num_items = 2,
5848 .items = {
5849 { "Line/Mic", 0x0 },
5850 { "CD", 0x4 },
5854 .num_items = 3,
5855 .items = {
5856 { "Line/Mic", 0x0 },
5857 { "CD", 0x4 },
5858 { "Mixer", 0x5 },
5864 * This is just place-holder, so there's something for alc_build_pcms to look
5865 * at when it calculates the maximum number of channels. ALC260 has no mixer
5866 * element which allows changing the channel mode, so the verb list is
5867 * never used.
5869 static struct hda_channel_mode alc260_modes[1] = {
5870 { 2, NULL },
5874 /* Mixer combinations
5876 * basic: base_output + input + pc_beep + capture
5877 * HP: base_output + input + capture_alt
5878 * HP_3013: hp_3013 + input + capture
5879 * fujitsu: fujitsu + capture
5880 * acer: acer + capture
5883 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5884 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5885 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5886 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5887 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5888 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5889 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5890 { } /* end */
5893 static struct snd_kcontrol_new alc260_input_mixer[] = {
5894 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5895 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5896 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5897 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5898 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5899 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5900 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5901 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5902 { } /* end */
5905 /* update HP, line and mono out pins according to the master switch */
5906 static void alc260_hp_master_update(struct hda_codec *codec,
5907 hda_nid_t hp, hda_nid_t line,
5908 hda_nid_t mono)
5910 struct alc_spec *spec = codec->spec;
5911 unsigned int val = spec->master_sw ? PIN_HP : 0;
5912 /* change HP and line-out pins */
5913 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5914 val);
5915 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5916 val);
5917 /* mono (speaker) depending on the HP jack sense */
5918 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5919 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5920 val);
5923 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5924 struct snd_ctl_elem_value *ucontrol)
5926 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5927 struct alc_spec *spec = codec->spec;
5928 *ucontrol->value.integer.value = spec->master_sw;
5929 return 0;
5932 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5933 struct snd_ctl_elem_value *ucontrol)
5935 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5936 struct alc_spec *spec = codec->spec;
5937 int val = !!*ucontrol->value.integer.value;
5938 hda_nid_t hp, line, mono;
5940 if (val == spec->master_sw)
5941 return 0;
5942 spec->master_sw = val;
5943 hp = (kcontrol->private_value >> 16) & 0xff;
5944 line = (kcontrol->private_value >> 8) & 0xff;
5945 mono = kcontrol->private_value & 0xff;
5946 alc260_hp_master_update(codec, hp, line, mono);
5947 return 1;
5950 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5952 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5953 .name = "Master Playback Switch",
5954 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5955 .info = snd_ctl_boolean_mono_info,
5956 .get = alc260_hp_master_sw_get,
5957 .put = alc260_hp_master_sw_put,
5958 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5960 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5961 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5962 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5963 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5964 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5965 HDA_OUTPUT),
5966 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5967 { } /* end */
5970 static struct hda_verb alc260_hp_unsol_verbs[] = {
5971 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5975 static void alc260_hp_automute(struct hda_codec *codec)
5977 struct alc_spec *spec = codec->spec;
5979 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5980 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5983 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5985 if ((res >> 26) == ALC880_HP_EVENT)
5986 alc260_hp_automute(codec);
5989 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5991 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5992 .name = "Master Playback Switch",
5993 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5994 .info = snd_ctl_boolean_mono_info,
5995 .get = alc260_hp_master_sw_get,
5996 .put = alc260_hp_master_sw_put,
5997 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5999 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6000 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6001 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
6002 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
6003 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6004 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6005 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6006 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
6007 { } /* end */
6010 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6011 .ops = &snd_hda_bind_vol,
6012 .values = {
6013 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
6014 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
6015 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
6020 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
6021 .ops = &snd_hda_bind_sw,
6022 .values = {
6023 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
6024 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
6029 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6030 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6031 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6032 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
6033 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6034 { } /* end */
6037 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6038 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6042 static void alc260_hp_3013_automute(struct hda_codec *codec)
6044 struct alc_spec *spec = codec->spec;
6046 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
6047 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
6050 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
6051 unsigned int res)
6053 if ((res >> 26) == ALC880_HP_EVENT)
6054 alc260_hp_3013_automute(codec);
6057 static void alc260_hp_3012_automute(struct hda_codec *codec)
6059 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6061 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6062 bits);
6063 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6064 bits);
6065 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6066 bits);
6069 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6070 unsigned int res)
6072 if ((res >> 26) == ALC880_HP_EVENT)
6073 alc260_hp_3012_automute(codec);
6076 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6077 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6079 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6080 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6081 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6082 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6083 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6084 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6085 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6086 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6087 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6088 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6089 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6090 { } /* end */
6093 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6094 * versions of the ALC260 don't act on requests to enable mic bias from NID
6095 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6096 * datasheet doesn't mention this restriction. At this stage it's not clear
6097 * whether this behaviour is intentional or is a hardware bug in chip
6098 * revisions available in early 2006. Therefore for now allow the
6099 * "Headphone Jack Mode" control to span all choices, but if it turns out
6100 * that the lack of mic bias for this NID is intentional we could change the
6101 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6103 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6104 * don't appear to make the mic bias available from the "line" jack, even
6105 * though the NID used for this jack (0x14) can supply it. The theory is
6106 * that perhaps Acer have included blocking capacitors between the ALC260
6107 * and the output jack. If this turns out to be the case for all such
6108 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6109 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6111 * The C20x Tablet series have a mono internal speaker which is controlled
6112 * via the chip's Mono sum widget and pin complex, so include the necessary
6113 * controls for such models. On models without a "mono speaker" the control
6114 * won't do anything.
6116 static struct snd_kcontrol_new alc260_acer_mixer[] = {
6117 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6118 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6119 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6120 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6121 HDA_OUTPUT),
6122 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6123 HDA_INPUT),
6124 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6125 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6127 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6128 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6129 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6130 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6131 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6132 { } /* end */
6135 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6137 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6138 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6139 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6140 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6141 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6142 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6143 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6144 { } /* end */
6147 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6148 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6150 static struct snd_kcontrol_new alc260_will_mixer[] = {
6151 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6152 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6154 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6155 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6156 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6157 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6158 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6159 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6160 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6161 { } /* end */
6164 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6165 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6167 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6168 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6169 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6171 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6172 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6173 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6174 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6175 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6176 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6177 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6178 { } /* end */
6182 * initialization verbs
6184 static struct hda_verb alc260_init_verbs[] = {
6185 /* Line In pin widget for input */
6186 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6187 /* CD pin widget for input */
6188 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6189 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6190 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6191 /* Mic2 (front panel) pin widget for input and vref at 80% */
6192 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6193 /* LINE-2 is used for line-out in rear */
6194 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6195 /* select line-out */
6196 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6197 /* LINE-OUT pin */
6198 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6199 /* enable HP */
6200 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6201 /* enable Mono */
6202 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6203 /* mute capture amp left and right */
6204 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6205 /* set connection select to line in (default select for this ADC) */
6206 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6207 /* mute capture amp left and right */
6208 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6209 /* set connection select to line in (default select for this ADC) */
6210 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6211 /* set vol=0 Line-Out mixer amp left and right */
6212 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6213 /* unmute pin widget amp left and right (no gain on this amp) */
6214 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6215 /* set vol=0 HP mixer amp left and right */
6216 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6217 /* unmute pin widget amp left and right (no gain on this amp) */
6218 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6219 /* set vol=0 Mono mixer amp left and right */
6220 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6221 /* unmute pin widget amp left and right (no gain on this amp) */
6222 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6223 /* unmute LINE-2 out pin */
6224 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6225 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6226 * Line In 2 = 0x03
6228 /* mute analog inputs */
6229 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6230 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6231 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6232 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6234 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6235 /* mute Front out path */
6236 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6237 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6238 /* mute Headphone out path */
6239 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6240 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6241 /* mute Mono out path */
6242 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6243 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6247 #if 0 /* should be identical with alc260_init_verbs? */
6248 static struct hda_verb alc260_hp_init_verbs[] = {
6249 /* Headphone and output */
6250 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6251 /* mono output */
6252 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6253 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6254 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6255 /* Mic2 (front panel) pin widget for input and vref at 80% */
6256 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6257 /* Line In pin widget for input */
6258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6259 /* Line-2 pin widget for output */
6260 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6261 /* CD pin widget for input */
6262 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6263 /* unmute amp left and right */
6264 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6265 /* set connection select to line in (default select for this ADC) */
6266 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6267 /* unmute Line-Out mixer amp left and right (volume = 0) */
6268 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6269 /* mute pin widget amp left and right (no gain on this amp) */
6270 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6271 /* unmute HP mixer amp left and right (volume = 0) */
6272 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6273 /* mute pin widget amp left and right (no gain on this amp) */
6274 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6275 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6276 * Line In 2 = 0x03
6278 /* mute analog inputs */
6279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6281 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6282 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6283 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6284 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6285 /* Unmute Front out path */
6286 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6287 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6288 /* Unmute Headphone out path */
6289 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6290 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6291 /* Unmute Mono out path */
6292 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6293 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6296 #endif
6298 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6299 /* Line out and output */
6300 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6301 /* mono output */
6302 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6303 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6304 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6305 /* Mic2 (front panel) pin widget for input and vref at 80% */
6306 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6307 /* Line In pin widget for input */
6308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6309 /* Headphone pin widget for output */
6310 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6311 /* CD pin widget for input */
6312 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6313 /* unmute amp left and right */
6314 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6315 /* set connection select to line in (default select for this ADC) */
6316 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6317 /* unmute Line-Out mixer amp left and right (volume = 0) */
6318 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6319 /* mute pin widget amp left and right (no gain on this amp) */
6320 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6321 /* unmute HP mixer amp left and right (volume = 0) */
6322 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6323 /* mute pin widget amp left and right (no gain on this amp) */
6324 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6325 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6326 * Line In 2 = 0x03
6328 /* mute analog inputs */
6329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6334 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6335 /* Unmute Front out path */
6336 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6337 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6338 /* Unmute Headphone out path */
6339 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6340 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6341 /* Unmute Mono out path */
6342 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6343 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6347 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6348 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6349 * audio = 0x16, internal speaker = 0x10.
6351 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6352 /* Disable all GPIOs */
6353 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6354 /* Internal speaker is connected to headphone pin */
6355 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6356 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6358 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6359 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6360 /* Ensure all other unused pins are disabled and muted. */
6361 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6362 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6363 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6364 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6365 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6366 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6367 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6370 /* Disable digital (SPDIF) pins */
6371 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6372 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6374 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6375 * when acting as an output.
6377 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6379 /* Start with output sum widgets muted and their output gains at min */
6380 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6381 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6382 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6383 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6384 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6385 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6386 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6387 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6388 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6390 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6391 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6392 /* Unmute Line1 pin widget output buffer since it starts as an output.
6393 * If the pin mode is changed by the user the pin mode control will
6394 * take care of enabling the pin's input/output buffers as needed.
6395 * Therefore there's no need to enable the input buffer at this
6396 * stage.
6398 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6399 /* Unmute input buffer of pin widget used for Line-in (no equiv
6400 * mixer ctrl)
6402 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6404 /* Mute capture amp left and right */
6405 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6406 /* Set ADC connection select to match default mixer setting - line
6407 * in (on mic1 pin)
6409 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6411 /* Do the same for the second ADC: mute capture input amp and
6412 * set ADC connection to line in (on mic1 pin)
6414 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6415 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6417 /* Mute all inputs to mixer widget (even unconnected ones) */
6418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6420 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6421 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6422 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6423 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6424 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6425 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6430 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6431 * similar laptops (adapted from Fujitsu init verbs).
6433 static struct hda_verb alc260_acer_init_verbs[] = {
6434 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6435 * the headphone jack. Turn this on and rely on the standard mute
6436 * methods whenever the user wants to turn these outputs off.
6438 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6439 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6440 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6441 /* Internal speaker/Headphone jack is connected to Line-out pin */
6442 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6443 /* Internal microphone/Mic jack is connected to Mic1 pin */
6444 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6445 /* Line In jack is connected to Line1 pin */
6446 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6447 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6448 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6449 /* Ensure all other unused pins are disabled and muted. */
6450 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6451 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6452 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6453 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6454 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6455 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6456 /* Disable digital (SPDIF) pins */
6457 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6458 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6460 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6461 * bus when acting as outputs.
6463 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6464 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6466 /* Start with output sum widgets muted and their output gains at min */
6467 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6468 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6469 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6470 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6471 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6472 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6473 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6474 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6475 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6477 /* Unmute Line-out pin widget amp left and right
6478 * (no equiv mixer ctrl)
6480 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6481 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6482 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6483 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6484 * inputs. If the pin mode is changed by the user the pin mode control
6485 * will take care of enabling the pin's input/output buffers as needed.
6486 * Therefore there's no need to enable the input buffer at this
6487 * stage.
6489 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6490 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6492 /* Mute capture amp left and right */
6493 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6494 /* Set ADC connection select to match default mixer setting - mic
6495 * (on mic1 pin)
6497 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6499 /* Do similar with the second ADC: mute capture input amp and
6500 * set ADC connection to mic to match ALSA's default state.
6502 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6503 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6505 /* Mute all inputs to mixer widget (even unconnected ones) */
6506 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6508 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6509 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6510 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6512 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6513 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6518 /* Initialisation sequence for Maxdata Favorit 100XS
6519 * (adapted from Acer init verbs).
6521 static struct hda_verb alc260_favorit100_init_verbs[] = {
6522 /* GPIO 0 enables the output jack.
6523 * Turn this on and rely on the standard mute
6524 * methods whenever the user wants to turn these outputs off.
6526 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6527 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6528 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6529 /* Line/Mic input jack is connected to Mic1 pin */
6530 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6531 /* Ensure all other unused pins are disabled and muted. */
6532 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6533 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6534 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6535 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6536 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6537 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6538 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6539 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6540 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6541 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6542 /* Disable digital (SPDIF) pins */
6543 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6544 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6546 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6547 * bus when acting as outputs.
6549 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6550 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6552 /* Start with output sum widgets muted and their output gains at min */
6553 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6554 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6555 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6556 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6557 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6558 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6559 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6560 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6561 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6563 /* Unmute Line-out pin widget amp left and right
6564 * (no equiv mixer ctrl)
6566 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6567 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6568 * inputs. If the pin mode is changed by the user the pin mode control
6569 * will take care of enabling the pin's input/output buffers as needed.
6570 * Therefore there's no need to enable the input buffer at this
6571 * stage.
6573 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6575 /* Mute capture amp left and right */
6576 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6577 /* Set ADC connection select to match default mixer setting - mic
6578 * (on mic1 pin)
6580 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6582 /* Do similar with the second ADC: mute capture input amp and
6583 * set ADC connection to mic to match ALSA's default state.
6585 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6586 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6588 /* Mute all inputs to mixer widget (even unconnected ones) */
6589 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6590 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6591 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6592 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6593 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6594 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6595 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6601 static struct hda_verb alc260_will_verbs[] = {
6602 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6603 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6604 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6605 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6606 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6607 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6611 static struct hda_verb alc260_replacer_672v_verbs[] = {
6612 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6613 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6614 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6616 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6617 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6618 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6620 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6624 /* toggle speaker-output according to the hp-jack state */
6625 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6627 unsigned int present;
6629 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6630 present = snd_hda_jack_detect(codec, 0x0f);
6631 if (present) {
6632 snd_hda_codec_write_cache(codec, 0x01, 0,
6633 AC_VERB_SET_GPIO_DATA, 1);
6634 snd_hda_codec_write_cache(codec, 0x0f, 0,
6635 AC_VERB_SET_PIN_WIDGET_CONTROL,
6636 PIN_HP);
6637 } else {
6638 snd_hda_codec_write_cache(codec, 0x01, 0,
6639 AC_VERB_SET_GPIO_DATA, 0);
6640 snd_hda_codec_write_cache(codec, 0x0f, 0,
6641 AC_VERB_SET_PIN_WIDGET_CONTROL,
6642 PIN_OUT);
6646 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6647 unsigned int res)
6649 if ((res >> 26) == ALC880_HP_EVENT)
6650 alc260_replacer_672v_automute(codec);
6653 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6654 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6655 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6656 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6657 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6658 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6659 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6660 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6661 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6662 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6663 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6667 /* Test configuration for debugging, modelled after the ALC880 test
6668 * configuration.
6670 #ifdef CONFIG_SND_DEBUG
6671 static hda_nid_t alc260_test_dac_nids[1] = {
6672 0x02,
6674 static hda_nid_t alc260_test_adc_nids[2] = {
6675 0x04, 0x05,
6677 /* For testing the ALC260, each input MUX needs its own definition since
6678 * the signal assignments are different. This assumes that the first ADC
6679 * is NID 0x04.
6681 static struct hda_input_mux alc260_test_capture_sources[2] = {
6683 .num_items = 7,
6684 .items = {
6685 { "MIC1 pin", 0x0 },
6686 { "MIC2 pin", 0x1 },
6687 { "LINE1 pin", 0x2 },
6688 { "LINE2 pin", 0x3 },
6689 { "CD pin", 0x4 },
6690 { "LINE-OUT pin", 0x5 },
6691 { "HP-OUT pin", 0x6 },
6695 .num_items = 8,
6696 .items = {
6697 { "MIC1 pin", 0x0 },
6698 { "MIC2 pin", 0x1 },
6699 { "LINE1 pin", 0x2 },
6700 { "LINE2 pin", 0x3 },
6701 { "CD pin", 0x4 },
6702 { "Mixer", 0x5 },
6703 { "LINE-OUT pin", 0x6 },
6704 { "HP-OUT pin", 0x7 },
6708 static struct snd_kcontrol_new alc260_test_mixer[] = {
6709 /* Output driver widgets */
6710 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6711 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6712 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6713 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6714 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6715 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6717 /* Modes for retasking pin widgets
6718 * Note: the ALC260 doesn't seem to act on requests to enable mic
6719 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6720 * mention this restriction. At this stage it's not clear whether
6721 * this behaviour is intentional or is a hardware bug in chip
6722 * revisions available at least up until early 2006. Therefore for
6723 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6724 * choices, but if it turns out that the lack of mic bias for these
6725 * NIDs is intentional we could change their modes from
6726 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6728 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6729 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6730 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6731 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6732 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6733 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6735 /* Loopback mixer controls */
6736 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6737 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6738 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6739 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6740 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6741 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6742 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6743 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6744 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6745 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6746 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6747 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6748 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6749 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6751 /* Controls for GPIO pins, assuming they are configured as outputs */
6752 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6753 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6754 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6755 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6757 /* Switches to allow the digital IO pins to be enabled. The datasheet
6758 * is ambigious as to which NID is which; testing on laptops which
6759 * make this output available should provide clarification.
6761 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6762 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6764 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6765 * this output to turn on an external amplifier.
6767 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6768 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6770 { } /* end */
6772 static struct hda_verb alc260_test_init_verbs[] = {
6773 /* Enable all GPIOs as outputs with an initial value of 0 */
6774 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6775 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6776 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6778 /* Enable retasking pins as output, initially without power amp */
6779 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6780 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6781 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6782 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6783 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6784 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6786 /* Disable digital (SPDIF) pins initially, but users can enable
6787 * them via a mixer switch. In the case of SPDIF-out, this initverb
6788 * payload also sets the generation to 0, output to be in "consumer"
6789 * PCM format, copyright asserted, no pre-emphasis and no validity
6790 * control.
6792 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6793 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6795 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6796 * OUT1 sum bus when acting as an output.
6798 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6799 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6800 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6801 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6803 /* Start with output sum widgets muted and their output gains at min */
6804 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6805 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6806 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6807 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6808 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6809 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6810 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6811 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6812 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6814 /* Unmute retasking pin widget output buffers since the default
6815 * state appears to be output. As the pin mode is changed by the
6816 * user the pin mode control will take care of enabling the pin's
6817 * input/output buffers as needed.
6819 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6820 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6821 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6822 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6823 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6824 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6825 /* Also unmute the mono-out pin widget */
6826 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6828 /* Mute capture amp left and right */
6829 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6830 /* Set ADC connection select to match default mixer setting (mic1
6831 * pin)
6833 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6835 /* Do the same for the second ADC: mute capture input amp and
6836 * set ADC connection to mic1 pin
6838 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6839 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6841 /* Mute all inputs to mixer widget (even unconnected ones) */
6842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6843 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6844 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6845 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6846 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6847 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6849 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6853 #endif
6855 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6856 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6858 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6859 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6862 * for BIOS auto-configuration
6865 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6866 const char *pfx, int *vol_bits)
6868 hda_nid_t nid_vol;
6869 unsigned long vol_val, sw_val;
6870 int err;
6872 if (nid >= 0x0f && nid < 0x11) {
6873 nid_vol = nid - 0x7;
6874 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6875 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6876 } else if (nid == 0x11) {
6877 nid_vol = nid - 0x7;
6878 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6879 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6880 } else if (nid >= 0x12 && nid <= 0x15) {
6881 nid_vol = 0x08;
6882 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6883 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6884 } else
6885 return 0; /* N/A */
6887 if (!(*vol_bits & (1 << nid_vol))) {
6888 /* first control for the volume widget */
6889 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6890 if (err < 0)
6891 return err;
6892 *vol_bits |= (1 << nid_vol);
6894 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6895 if (err < 0)
6896 return err;
6897 return 1;
6900 /* add playback controls from the parsed DAC table */
6901 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6902 const struct auto_pin_cfg *cfg)
6904 hda_nid_t nid;
6905 int err;
6906 int vols = 0;
6908 spec->multiout.num_dacs = 1;
6909 spec->multiout.dac_nids = spec->private_dac_nids;
6910 spec->multiout.dac_nids[0] = 0x02;
6912 nid = cfg->line_out_pins[0];
6913 if (nid) {
6914 const char *pfx;
6915 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6916 pfx = "Master";
6917 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6918 pfx = "Speaker";
6919 else
6920 pfx = "Front";
6921 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6922 if (err < 0)
6923 return err;
6926 nid = cfg->speaker_pins[0];
6927 if (nid) {
6928 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6929 if (err < 0)
6930 return err;
6933 nid = cfg->hp_pins[0];
6934 if (nid) {
6935 err = alc260_add_playback_controls(spec, nid, "Headphone",
6936 &vols);
6937 if (err < 0)
6938 return err;
6940 return 0;
6943 /* create playback/capture controls for input pins */
6944 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6945 const struct auto_pin_cfg *cfg)
6947 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6950 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6951 hda_nid_t nid, int pin_type,
6952 int sel_idx)
6954 alc_set_pin_output(codec, nid, pin_type);
6955 /* need the manual connection? */
6956 if (nid >= 0x12) {
6957 int idx = nid - 0x12;
6958 snd_hda_codec_write(codec, idx + 0x0b, 0,
6959 AC_VERB_SET_CONNECT_SEL, sel_idx);
6963 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6965 struct alc_spec *spec = codec->spec;
6966 hda_nid_t nid;
6968 nid = spec->autocfg.line_out_pins[0];
6969 if (nid) {
6970 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6971 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6974 nid = spec->autocfg.speaker_pins[0];
6975 if (nid)
6976 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6978 nid = spec->autocfg.hp_pins[0];
6979 if (nid)
6980 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6983 #define ALC260_PIN_CD_NID 0x16
6984 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6986 struct alc_spec *spec = codec->spec;
6987 struct auto_pin_cfg *cfg = &spec->autocfg;
6988 int i;
6990 for (i = 0; i < cfg->num_inputs; i++) {
6991 hda_nid_t nid = cfg->inputs[i].pin;
6992 if (nid >= 0x12) {
6993 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
6994 if (nid != ALC260_PIN_CD_NID &&
6995 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6996 snd_hda_codec_write(codec, nid, 0,
6997 AC_VERB_SET_AMP_GAIN_MUTE,
6998 AMP_OUT_MUTE);
7003 #define alc260_auto_init_input_src alc880_auto_init_input_src
7006 * generic initialization of ADC, input mixers and output mixers
7008 static struct hda_verb alc260_volume_init_verbs[] = {
7010 * Unmute ADC0-1 and set the default input to mic-in
7012 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
7013 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7014 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
7015 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7017 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7018 * mixer widget
7019 * Note: PASD motherboards uses the Line In 2 as the input for
7020 * front panel mic (mic 2)
7022 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7023 /* mute analog inputs */
7024 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7026 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7031 * Set up output mixers (0x08 - 0x0a)
7033 /* set vol=0 to output mixers */
7034 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7035 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7036 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7037 /* set up input amps for analog loopback */
7038 /* Amp Indices: DAC = 0, mixer = 1 */
7039 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7040 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7041 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7042 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7043 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7044 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7049 static int alc260_parse_auto_config(struct hda_codec *codec)
7051 struct alc_spec *spec = codec->spec;
7052 int err;
7053 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
7055 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7056 alc260_ignore);
7057 if (err < 0)
7058 return err;
7059 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7060 if (err < 0)
7061 return err;
7062 if (!spec->kctls.list)
7063 return 0; /* can't find valid BIOS pin config */
7064 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7065 if (err < 0)
7066 return err;
7068 spec->multiout.max_channels = 2;
7070 if (spec->autocfg.dig_outs)
7071 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7072 if (spec->kctls.list)
7073 add_mixer(spec, spec->kctls.list);
7075 add_verb(spec, alc260_volume_init_verbs);
7077 spec->num_mux_defs = 1;
7078 spec->input_mux = &spec->private_imux[0];
7080 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7082 return 1;
7085 /* additional initialization for auto-configuration model */
7086 static void alc260_auto_init(struct hda_codec *codec)
7088 struct alc_spec *spec = codec->spec;
7089 alc260_auto_init_multi_out(codec);
7090 alc260_auto_init_analog_input(codec);
7091 alc260_auto_init_input_src(codec);
7092 alc_auto_init_digital(codec);
7093 if (spec->unsol_event)
7094 alc_inithook(codec);
7097 #ifdef CONFIG_SND_HDA_POWER_SAVE
7098 static struct hda_amp_list alc260_loopbacks[] = {
7099 { 0x07, HDA_INPUT, 0 },
7100 { 0x07, HDA_INPUT, 1 },
7101 { 0x07, HDA_INPUT, 2 },
7102 { 0x07, HDA_INPUT, 3 },
7103 { 0x07, HDA_INPUT, 4 },
7104 { } /* end */
7106 #endif
7109 * Pin config fixes
7111 enum {
7112 PINFIX_HP_DC5750,
7115 static const struct alc_fixup alc260_fixups[] = {
7116 [PINFIX_HP_DC5750] = {
7117 .type = ALC_FIXUP_PINS,
7118 .v.pins = (const struct alc_pincfg[]) {
7119 { 0x11, 0x90130110 }, /* speaker */
7125 static struct snd_pci_quirk alc260_fixup_tbl[] = {
7126 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7131 * ALC260 configurations
7133 static const char * const alc260_models[ALC260_MODEL_LAST] = {
7134 [ALC260_BASIC] = "basic",
7135 [ALC260_HP] = "hp",
7136 [ALC260_HP_3013] = "hp-3013",
7137 [ALC260_HP_DC7600] = "hp-dc7600",
7138 [ALC260_FUJITSU_S702X] = "fujitsu",
7139 [ALC260_ACER] = "acer",
7140 [ALC260_WILL] = "will",
7141 [ALC260_REPLACER_672V] = "replacer",
7142 [ALC260_FAVORIT100] = "favorit100",
7143 #ifdef CONFIG_SND_DEBUG
7144 [ALC260_TEST] = "test",
7145 #endif
7146 [ALC260_AUTO] = "auto",
7149 static struct snd_pci_quirk alc260_cfg_tbl[] = {
7150 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7151 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7152 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7153 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7154 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7155 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7156 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7157 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7158 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7159 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7160 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7161 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7162 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7163 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7164 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7165 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7166 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7167 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7168 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7169 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7173 static struct alc_config_preset alc260_presets[] = {
7174 [ALC260_BASIC] = {
7175 .mixers = { alc260_base_output_mixer,
7176 alc260_input_mixer },
7177 .init_verbs = { alc260_init_verbs },
7178 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7179 .dac_nids = alc260_dac_nids,
7180 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7181 .adc_nids = alc260_dual_adc_nids,
7182 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7183 .channel_mode = alc260_modes,
7184 .input_mux = &alc260_capture_source,
7186 [ALC260_HP] = {
7187 .mixers = { alc260_hp_output_mixer,
7188 alc260_input_mixer },
7189 .init_verbs = { alc260_init_verbs,
7190 alc260_hp_unsol_verbs },
7191 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7192 .dac_nids = alc260_dac_nids,
7193 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7194 .adc_nids = alc260_adc_nids_alt,
7195 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7196 .channel_mode = alc260_modes,
7197 .input_mux = &alc260_capture_source,
7198 .unsol_event = alc260_hp_unsol_event,
7199 .init_hook = alc260_hp_automute,
7201 [ALC260_HP_DC7600] = {
7202 .mixers = { alc260_hp_dc7600_mixer,
7203 alc260_input_mixer },
7204 .init_verbs = { alc260_init_verbs,
7205 alc260_hp_dc7600_verbs },
7206 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7207 .dac_nids = alc260_dac_nids,
7208 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7209 .adc_nids = alc260_adc_nids_alt,
7210 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7211 .channel_mode = alc260_modes,
7212 .input_mux = &alc260_capture_source,
7213 .unsol_event = alc260_hp_3012_unsol_event,
7214 .init_hook = alc260_hp_3012_automute,
7216 [ALC260_HP_3013] = {
7217 .mixers = { alc260_hp_3013_mixer,
7218 alc260_input_mixer },
7219 .init_verbs = { alc260_hp_3013_init_verbs,
7220 alc260_hp_3013_unsol_verbs },
7221 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7222 .dac_nids = alc260_dac_nids,
7223 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7224 .adc_nids = alc260_adc_nids_alt,
7225 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7226 .channel_mode = alc260_modes,
7227 .input_mux = &alc260_capture_source,
7228 .unsol_event = alc260_hp_3013_unsol_event,
7229 .init_hook = alc260_hp_3013_automute,
7231 [ALC260_FUJITSU_S702X] = {
7232 .mixers = { alc260_fujitsu_mixer },
7233 .init_verbs = { alc260_fujitsu_init_verbs },
7234 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7235 .dac_nids = alc260_dac_nids,
7236 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7237 .adc_nids = alc260_dual_adc_nids,
7238 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7239 .channel_mode = alc260_modes,
7240 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7241 .input_mux = alc260_fujitsu_capture_sources,
7243 [ALC260_ACER] = {
7244 .mixers = { alc260_acer_mixer },
7245 .init_verbs = { alc260_acer_init_verbs },
7246 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7247 .dac_nids = alc260_dac_nids,
7248 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7249 .adc_nids = alc260_dual_adc_nids,
7250 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7251 .channel_mode = alc260_modes,
7252 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7253 .input_mux = alc260_acer_capture_sources,
7255 [ALC260_FAVORIT100] = {
7256 .mixers = { alc260_favorit100_mixer },
7257 .init_verbs = { alc260_favorit100_init_verbs },
7258 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7259 .dac_nids = alc260_dac_nids,
7260 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7261 .adc_nids = alc260_dual_adc_nids,
7262 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7263 .channel_mode = alc260_modes,
7264 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7265 .input_mux = alc260_favorit100_capture_sources,
7267 [ALC260_WILL] = {
7268 .mixers = { alc260_will_mixer },
7269 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7270 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7271 .dac_nids = alc260_dac_nids,
7272 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7273 .adc_nids = alc260_adc_nids,
7274 .dig_out_nid = ALC260_DIGOUT_NID,
7275 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7276 .channel_mode = alc260_modes,
7277 .input_mux = &alc260_capture_source,
7279 [ALC260_REPLACER_672V] = {
7280 .mixers = { alc260_replacer_672v_mixer },
7281 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7282 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7283 .dac_nids = alc260_dac_nids,
7284 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7285 .adc_nids = alc260_adc_nids,
7286 .dig_out_nid = ALC260_DIGOUT_NID,
7287 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7288 .channel_mode = alc260_modes,
7289 .input_mux = &alc260_capture_source,
7290 .unsol_event = alc260_replacer_672v_unsol_event,
7291 .init_hook = alc260_replacer_672v_automute,
7293 #ifdef CONFIG_SND_DEBUG
7294 [ALC260_TEST] = {
7295 .mixers = { alc260_test_mixer },
7296 .init_verbs = { alc260_test_init_verbs },
7297 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7298 .dac_nids = alc260_test_dac_nids,
7299 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7300 .adc_nids = alc260_test_adc_nids,
7301 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7302 .channel_mode = alc260_modes,
7303 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7304 .input_mux = alc260_test_capture_sources,
7306 #endif
7309 static int patch_alc260(struct hda_codec *codec)
7311 struct alc_spec *spec;
7312 int err, board_config;
7314 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7315 if (spec == NULL)
7316 return -ENOMEM;
7318 codec->spec = spec;
7320 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7321 alc260_models,
7322 alc260_cfg_tbl);
7323 if (board_config < 0) {
7324 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7325 codec->chip_name);
7326 board_config = ALC260_AUTO;
7329 if (board_config == ALC260_AUTO) {
7330 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7331 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7334 if (board_config == ALC260_AUTO) {
7335 /* automatic parse from the BIOS config */
7336 err = alc260_parse_auto_config(codec);
7337 if (err < 0) {
7338 alc_free(codec);
7339 return err;
7340 } else if (!err) {
7341 printk(KERN_INFO
7342 "hda_codec: Cannot set up configuration "
7343 "from BIOS. Using base mode...\n");
7344 board_config = ALC260_BASIC;
7348 err = snd_hda_attach_beep_device(codec, 0x1);
7349 if (err < 0) {
7350 alc_free(codec);
7351 return err;
7354 if (board_config != ALC260_AUTO)
7355 setup_preset(codec, &alc260_presets[board_config]);
7357 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7358 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7359 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7361 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7362 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7364 if (!spec->adc_nids && spec->input_mux) {
7365 /* check whether NID 0x04 is valid */
7366 unsigned int wcap = get_wcaps(codec, 0x04);
7367 wcap = get_wcaps_type(wcap);
7368 /* get type */
7369 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7370 spec->adc_nids = alc260_adc_nids_alt;
7371 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7372 } else {
7373 spec->adc_nids = alc260_adc_nids;
7374 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7377 set_capture_mixer(codec);
7378 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7380 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7382 spec->vmaster_nid = 0x08;
7384 codec->patch_ops = alc_patch_ops;
7385 if (board_config == ALC260_AUTO)
7386 spec->init_hook = alc260_auto_init;
7387 #ifdef CONFIG_SND_HDA_POWER_SAVE
7388 if (!spec->loopback.amplist)
7389 spec->loopback.amplist = alc260_loopbacks;
7390 #endif
7392 return 0;
7397 * ALC882/883/885/888/889 support
7399 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7400 * configuration. Each pin widget can choose any input DACs and a mixer.
7401 * Each ADC is connected from a mixer of all inputs. This makes possible
7402 * 6-channel independent captures.
7404 * In addition, an independent DAC for the multi-playback (not used in this
7405 * driver yet).
7407 #define ALC882_DIGOUT_NID 0x06
7408 #define ALC882_DIGIN_NID 0x0a
7409 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7410 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7411 #define ALC1200_DIGOUT_NID 0x10
7414 static struct hda_channel_mode alc882_ch_modes[1] = {
7415 { 8, NULL }
7418 /* DACs */
7419 static hda_nid_t alc882_dac_nids[4] = {
7420 /* front, rear, clfe, rear_surr */
7421 0x02, 0x03, 0x04, 0x05
7423 #define alc883_dac_nids alc882_dac_nids
7425 /* ADCs */
7426 #define alc882_adc_nids alc880_adc_nids
7427 #define alc882_adc_nids_alt alc880_adc_nids_alt
7428 #define alc883_adc_nids alc882_adc_nids_alt
7429 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7430 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7431 #define alc889_adc_nids alc880_adc_nids
7433 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7434 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7435 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7436 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7437 #define alc889_capsrc_nids alc882_capsrc_nids
7439 /* input MUX */
7440 /* FIXME: should be a matrix-type input source selection */
7442 static struct hda_input_mux alc882_capture_source = {
7443 .num_items = 4,
7444 .items = {
7445 { "Mic", 0x0 },
7446 { "Front Mic", 0x1 },
7447 { "Line", 0x2 },
7448 { "CD", 0x4 },
7452 #define alc883_capture_source alc882_capture_source
7454 static struct hda_input_mux alc889_capture_source = {
7455 .num_items = 3,
7456 .items = {
7457 { "Front Mic", 0x0 },
7458 { "Mic", 0x3 },
7459 { "Line", 0x2 },
7463 static struct hda_input_mux mb5_capture_source = {
7464 .num_items = 3,
7465 .items = {
7466 { "Mic", 0x1 },
7467 { "Line", 0x7 },
7468 { "CD", 0x4 },
7472 static struct hda_input_mux macmini3_capture_source = {
7473 .num_items = 2,
7474 .items = {
7475 { "Line", 0x2 },
7476 { "CD", 0x4 },
7480 static struct hda_input_mux alc883_3stack_6ch_intel = {
7481 .num_items = 4,
7482 .items = {
7483 { "Mic", 0x1 },
7484 { "Front Mic", 0x0 },
7485 { "Line", 0x2 },
7486 { "CD", 0x4 },
7490 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7491 .num_items = 2,
7492 .items = {
7493 { "Mic", 0x1 },
7494 { "Line", 0x2 },
7498 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7499 .num_items = 4,
7500 .items = {
7501 { "Mic", 0x0 },
7502 { "Internal Mic", 0x1 },
7503 { "Line", 0x2 },
7504 { "CD", 0x4 },
7508 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7509 .num_items = 2,
7510 .items = {
7511 { "Mic", 0x0 },
7512 { "Internal Mic", 0x1 },
7516 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7517 .num_items = 3,
7518 .items = {
7519 { "Mic", 0x0 },
7520 { "Front Mic", 0x1 },
7521 { "Line", 0x4 },
7525 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7526 .num_items = 2,
7527 .items = {
7528 { "Mic", 0x0 },
7529 { "Line", 0x2 },
7533 static struct hda_input_mux alc889A_mb31_capture_source = {
7534 .num_items = 2,
7535 .items = {
7536 { "Mic", 0x0 },
7537 /* Front Mic (0x01) unused */
7538 { "Line", 0x2 },
7539 /* Line 2 (0x03) unused */
7540 /* CD (0x04) unused? */
7544 static struct hda_input_mux alc889A_imac91_capture_source = {
7545 .num_items = 2,
7546 .items = {
7547 { "Mic", 0x01 },
7548 { "Line", 0x2 }, /* Not sure! */
7553 * 2ch mode
7555 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7556 { 2, NULL }
7560 * 2ch mode
7562 static struct hda_verb alc882_3ST_ch2_init[] = {
7563 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7564 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7565 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7566 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7567 { } /* end */
7571 * 4ch mode
7573 static struct hda_verb alc882_3ST_ch4_init[] = {
7574 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7575 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7576 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7577 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7578 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7579 { } /* end */
7583 * 6ch mode
7585 static struct hda_verb alc882_3ST_ch6_init[] = {
7586 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7587 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7588 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7589 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7590 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7591 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7592 { } /* end */
7595 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7596 { 2, alc882_3ST_ch2_init },
7597 { 4, alc882_3ST_ch4_init },
7598 { 6, alc882_3ST_ch6_init },
7601 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7604 * 2ch mode
7606 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7607 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7608 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7609 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7610 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7611 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7612 { } /* end */
7616 * 4ch mode
7618 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7619 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7620 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7621 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7622 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7623 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7624 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7625 { } /* end */
7629 * 6ch mode
7631 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7632 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7633 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7634 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7635 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7636 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7637 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7638 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7639 { } /* end */
7642 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7643 { 2, alc883_3ST_ch2_clevo_init },
7644 { 4, alc883_3ST_ch4_clevo_init },
7645 { 6, alc883_3ST_ch6_clevo_init },
7650 * 6ch mode
7652 static struct hda_verb alc882_sixstack_ch6_init[] = {
7653 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7654 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7655 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7656 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7657 { } /* end */
7661 * 8ch mode
7663 static struct hda_verb alc882_sixstack_ch8_init[] = {
7664 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7665 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7666 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7667 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7668 { } /* end */
7671 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7672 { 6, alc882_sixstack_ch6_init },
7673 { 8, alc882_sixstack_ch8_init },
7677 /* Macbook Air 2,1 */
7679 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7680 { 2, NULL },
7684 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7688 * 2ch mode
7690 static struct hda_verb alc885_mbp_ch2_init[] = {
7691 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7692 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7693 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7694 { } /* end */
7698 * 4ch mode
7700 static struct hda_verb alc885_mbp_ch4_init[] = {
7701 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7702 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7703 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7704 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7705 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7706 { } /* end */
7709 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7710 { 2, alc885_mbp_ch2_init },
7711 { 4, alc885_mbp_ch4_init },
7715 * 2ch
7716 * Speakers/Woofer/HP = Front
7717 * LineIn = Input
7719 static struct hda_verb alc885_mb5_ch2_init[] = {
7720 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7721 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7722 { } /* end */
7726 * 6ch mode
7727 * Speakers/HP = Front
7728 * Woofer = LFE
7729 * LineIn = Surround
7731 static struct hda_verb alc885_mb5_ch6_init[] = {
7732 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7733 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7734 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7735 { } /* end */
7738 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7739 { 2, alc885_mb5_ch2_init },
7740 { 6, alc885_mb5_ch6_init },
7743 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7746 * 2ch mode
7748 static struct hda_verb alc883_4ST_ch2_init[] = {
7749 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7750 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7751 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7752 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7753 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7754 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7755 { } /* end */
7759 * 4ch mode
7761 static struct hda_verb alc883_4ST_ch4_init[] = {
7762 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7763 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7764 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7765 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7766 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7767 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7768 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7769 { } /* end */
7773 * 6ch mode
7775 static struct hda_verb alc883_4ST_ch6_init[] = {
7776 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7777 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7778 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7779 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7780 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7781 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7782 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7783 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7784 { } /* end */
7788 * 8ch mode
7790 static struct hda_verb alc883_4ST_ch8_init[] = {
7791 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7792 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7793 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7794 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7795 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7796 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7797 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7798 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7799 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7800 { } /* end */
7803 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7804 { 2, alc883_4ST_ch2_init },
7805 { 4, alc883_4ST_ch4_init },
7806 { 6, alc883_4ST_ch6_init },
7807 { 8, alc883_4ST_ch8_init },
7812 * 2ch mode
7814 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7815 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7816 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7817 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7818 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7819 { } /* end */
7823 * 4ch mode
7825 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7826 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7827 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7828 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7829 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7830 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7831 { } /* end */
7835 * 6ch mode
7837 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7838 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7839 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7840 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7841 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7842 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7843 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7844 { } /* end */
7847 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7848 { 2, alc883_3ST_ch2_intel_init },
7849 { 4, alc883_3ST_ch4_intel_init },
7850 { 6, alc883_3ST_ch6_intel_init },
7854 * 2ch mode
7856 static struct hda_verb alc889_ch2_intel_init[] = {
7857 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7858 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7859 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7860 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7861 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7862 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7863 { } /* end */
7867 * 6ch mode
7869 static struct hda_verb alc889_ch6_intel_init[] = {
7870 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7871 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7872 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7873 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7874 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7875 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7876 { } /* end */
7880 * 8ch mode
7882 static struct hda_verb alc889_ch8_intel_init[] = {
7883 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7884 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7885 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7886 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7887 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7888 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7889 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7890 { } /* end */
7893 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7894 { 2, alc889_ch2_intel_init },
7895 { 6, alc889_ch6_intel_init },
7896 { 8, alc889_ch8_intel_init },
7900 * 6ch mode
7902 static struct hda_verb alc883_sixstack_ch6_init[] = {
7903 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7904 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7905 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7906 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7907 { } /* end */
7911 * 8ch mode
7913 static struct hda_verb alc883_sixstack_ch8_init[] = {
7914 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7915 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7916 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7917 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7918 { } /* end */
7921 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7922 { 6, alc883_sixstack_ch6_init },
7923 { 8, alc883_sixstack_ch8_init },
7927 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7928 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7930 static struct snd_kcontrol_new alc882_base_mixer[] = {
7931 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7932 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7933 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7934 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7935 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7936 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7937 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7938 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7939 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7940 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7941 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7942 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7943 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7944 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7945 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7946 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7947 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
7948 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7949 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7950 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
7951 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7952 { } /* end */
7955 /* Macbook Air 2,1 same control for HP and internal Speaker */
7957 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7958 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7959 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7964 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7965 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7966 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7967 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7968 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7969 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7970 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7971 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7972 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7973 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7974 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
7975 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
7976 { } /* end */
7979 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7980 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7981 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7982 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7983 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7984 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7985 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7986 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7987 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7988 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7989 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7990 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7991 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
7993 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
7994 { } /* end */
7997 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7998 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7999 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8000 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8001 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8002 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8003 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8004 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8005 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8006 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8007 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8008 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8009 { } /* end */
8012 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
8013 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8014 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8015 { } /* end */
8019 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8020 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8021 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8022 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8023 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8024 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8025 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8027 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8028 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8029 { } /* end */
8032 static struct snd_kcontrol_new alc882_targa_mixer[] = {
8033 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8034 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8035 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8036 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8037 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8038 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8039 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8040 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8041 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8042 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8043 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8044 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8045 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8046 { } /* end */
8049 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8050 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8052 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8053 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8054 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8055 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8056 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8057 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8058 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8059 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8060 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8061 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8062 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8063 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8065 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8066 { } /* end */
8069 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8070 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8071 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8072 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8073 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8074 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8075 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8076 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8077 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8078 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8079 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8080 { } /* end */
8083 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8086 .name = "Channel Mode",
8087 .info = alc_ch_mode_info,
8088 .get = alc_ch_mode_get,
8089 .put = alc_ch_mode_put,
8091 { } /* end */
8094 static struct hda_verb alc882_base_init_verbs[] = {
8095 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8096 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8098 /* Rear mixer */
8099 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8100 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8101 /* CLFE mixer */
8102 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8103 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8104 /* Side mixer */
8105 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8106 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8108 /* Front Pin: output 0 (0x0c) */
8109 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8110 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8111 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8112 /* Rear Pin: output 1 (0x0d) */
8113 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8114 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8115 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8116 /* CLFE Pin: output 2 (0x0e) */
8117 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8118 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8119 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8120 /* Side Pin: output 3 (0x0f) */
8121 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8122 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8123 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8124 /* Mic (rear) pin: input vref at 80% */
8125 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8126 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8127 /* Front Mic pin: input vref at 80% */
8128 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8129 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8130 /* Line In pin: input */
8131 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8132 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8133 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8134 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8135 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8136 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8137 /* CD pin widget for input */
8138 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8140 /* FIXME: use matrix-type input source selection */
8141 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8142 /* Input mixer2 */
8143 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8144 /* Input mixer3 */
8145 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8146 /* ADC2: mute amp left and right */
8147 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8148 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8149 /* ADC3: mute amp left and right */
8150 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8151 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8156 static struct hda_verb alc882_adc1_init_verbs[] = {
8157 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8158 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8159 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8160 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8161 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8162 /* ADC1: mute amp left and right */
8163 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8164 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8168 static struct hda_verb alc882_eapd_verbs[] = {
8169 /* change to EAPD mode */
8170 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8171 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8175 static struct hda_verb alc889_eapd_verbs[] = {
8176 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8177 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8181 static struct hda_verb alc_hp15_unsol_verbs[] = {
8182 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8183 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8187 static struct hda_verb alc885_init_verbs[] = {
8188 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8190 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8191 /* Rear mixer */
8192 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8193 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8194 /* CLFE mixer */
8195 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8196 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8197 /* Side mixer */
8198 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8199 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8201 /* Front HP Pin: output 0 (0x0c) */
8202 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8203 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8204 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8205 /* Front Pin: output 0 (0x0c) */
8206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8207 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8208 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8209 /* Rear Pin: output 1 (0x0d) */
8210 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8211 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8212 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8213 /* CLFE Pin: output 2 (0x0e) */
8214 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8215 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8216 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8217 /* Side Pin: output 3 (0x0f) */
8218 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8219 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8220 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8221 /* Mic (rear) pin: input vref at 80% */
8222 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8223 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8224 /* Front Mic pin: input vref at 80% */
8225 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8226 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8227 /* Line In pin: input */
8228 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8229 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8231 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8232 /* Input mixer1 */
8233 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8234 /* Input mixer2 */
8235 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8236 /* Input mixer3 */
8237 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8238 /* ADC2: mute amp left and right */
8239 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8240 /* ADC3: mute amp left and right */
8241 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8246 static struct hda_verb alc885_init_input_verbs[] = {
8247 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8248 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8249 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8254 /* Unmute Selector 24h and set the default input to front mic */
8255 static struct hda_verb alc889_init_input_verbs[] = {
8256 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8257 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8262 #define alc883_init_verbs alc882_base_init_verbs
8264 /* Mac Pro test */
8265 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8266 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8267 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8269 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8270 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8271 /* FIXME: this looks suspicious...
8272 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8273 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8275 { } /* end */
8278 static struct hda_verb alc882_macpro_init_verbs[] = {
8279 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8280 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8281 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8283 /* Front Pin: output 0 (0x0c) */
8284 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8285 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8286 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8287 /* Front Mic pin: input vref at 80% */
8288 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8289 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8290 /* Speaker: output */
8291 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8292 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8293 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8294 /* Headphone output (output 0 - 0x0c) */
8295 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8296 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8297 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8299 /* FIXME: use matrix-type input source selection */
8300 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8301 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8302 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8304 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8305 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8306 /* Input mixer2 */
8307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8311 /* Input mixer3 */
8312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8316 /* ADC1: mute amp left and right */
8317 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8318 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8319 /* ADC2: mute amp left and right */
8320 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8321 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8322 /* ADC3: mute amp left and right */
8323 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8324 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8329 /* Macbook 5,1 */
8330 static struct hda_verb alc885_mb5_init_verbs[] = {
8331 /* DACs */
8332 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8333 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8334 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8335 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8336 /* Front mixer */
8337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8339 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8340 /* Surround mixer */
8341 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8342 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8343 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8344 /* LFE mixer */
8345 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8348 /* HP mixer */
8349 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8350 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8351 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8352 /* Front Pin (0x0c) */
8353 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8354 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8355 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8356 /* LFE Pin (0x0e) */
8357 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8358 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8359 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8360 /* HP Pin (0x0f) */
8361 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8362 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8363 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8364 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8365 /* Front Mic pin: input vref at 80% */
8366 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8367 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8368 /* Line In pin */
8369 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8370 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8374 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8378 /* Macmini 3,1 */
8379 static struct hda_verb alc885_macmini3_init_verbs[] = {
8380 /* DACs */
8381 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8382 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8383 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8384 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8385 /* Front mixer */
8386 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8387 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8388 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8389 /* Surround mixer */
8390 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8391 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8392 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8393 /* LFE mixer */
8394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8395 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8396 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8397 /* HP mixer */
8398 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8399 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8400 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8401 /* Front Pin (0x0c) */
8402 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8403 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8404 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8405 /* LFE Pin (0x0e) */
8406 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8407 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8408 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8409 /* HP Pin (0x0f) */
8410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8411 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8412 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8413 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8414 /* Line In pin */
8415 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8418 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8420 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8421 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8426 static struct hda_verb alc885_mba21_init_verbs[] = {
8427 /*Internal and HP Speaker Mixer*/
8428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8430 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8431 /*Internal Speaker Pin (0x0c)*/
8432 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8433 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8434 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8435 /* HP Pin: output 0 (0x0e) */
8436 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8437 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8438 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8439 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8440 /* Line in (is hp when jack connected)*/
8441 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8442 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8448 /* Macbook Pro rev3 */
8449 static struct hda_verb alc885_mbp3_init_verbs[] = {
8450 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8451 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8452 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8453 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8454 /* Rear mixer */
8455 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8456 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8457 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8458 /* HP mixer */
8459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8460 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8461 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8462 /* Front Pin: output 0 (0x0c) */
8463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8464 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8465 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8466 /* HP Pin: output 0 (0x0e) */
8467 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8468 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8469 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8470 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8471 /* Mic (rear) pin: input vref at 80% */
8472 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8473 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8474 /* Front Mic pin: input vref at 80% */
8475 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8476 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8477 /* Line In pin: use output 1 when in LineOut mode */
8478 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8479 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8480 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8482 /* FIXME: use matrix-type input source selection */
8483 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8484 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8485 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8486 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8487 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8488 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8489 /* Input mixer2 */
8490 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8491 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8492 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8493 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8494 /* Input mixer3 */
8495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8496 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8497 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8498 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8499 /* ADC1: mute amp left and right */
8500 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8501 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8502 /* ADC2: mute amp left and right */
8503 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8504 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8505 /* ADC3: mute amp left and right */
8506 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8507 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8512 /* iMac 9,1 */
8513 static struct hda_verb alc885_imac91_init_verbs[] = {
8514 /* Internal Speaker Pin (0x0c) */
8515 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8516 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8517 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8518 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8519 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8520 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8521 /* HP Pin: Rear */
8522 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8523 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8524 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8525 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8526 /* Line in Rear */
8527 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8528 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8529 /* Front Mic pin: input vref at 80% */
8530 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8531 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8532 /* Rear mixer */
8533 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8534 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8535 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8536 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8538 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8539 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8540 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8541 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8542 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8544 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8545 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8547 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8549 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8550 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8555 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8556 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8557 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8558 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8559 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8560 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8561 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8562 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8563 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8567 /* iMac 24 mixer. */
8568 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8569 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8570 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8571 { } /* end */
8574 /* iMac 24 init verbs. */
8575 static struct hda_verb alc885_imac24_init_verbs[] = {
8576 /* Internal speakers: output 0 (0x0c) */
8577 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8578 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8579 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8580 /* Internal speakers: output 0 (0x0c) */
8581 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8582 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8583 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8584 /* Headphone: output 0 (0x0c) */
8585 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8586 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8587 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8588 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8589 /* Front Mic: input vref at 80% */
8590 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8591 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8595 /* Toggle speaker-output according to the hp-jack state */
8596 static void alc885_imac24_setup(struct hda_codec *codec)
8598 struct alc_spec *spec = codec->spec;
8600 spec->autocfg.hp_pins[0] = 0x14;
8601 spec->autocfg.speaker_pins[0] = 0x18;
8602 spec->autocfg.speaker_pins[1] = 0x1a;
8605 #define alc885_mb5_setup alc885_imac24_setup
8606 #define alc885_macmini3_setup alc885_imac24_setup
8608 /* Macbook Air 2,1 */
8609 static void alc885_mba21_setup(struct hda_codec *codec)
8611 struct alc_spec *spec = codec->spec;
8613 spec->autocfg.hp_pins[0] = 0x14;
8614 spec->autocfg.speaker_pins[0] = 0x18;
8619 static void alc885_mbp3_setup(struct hda_codec *codec)
8621 struct alc_spec *spec = codec->spec;
8623 spec->autocfg.hp_pins[0] = 0x15;
8624 spec->autocfg.speaker_pins[0] = 0x14;
8627 static void alc885_imac91_setup(struct hda_codec *codec)
8629 struct alc_spec *spec = codec->spec;
8631 spec->autocfg.hp_pins[0] = 0x14;
8632 spec->autocfg.speaker_pins[0] = 0x18;
8633 spec->autocfg.speaker_pins[1] = 0x1a;
8636 static struct hda_verb alc882_targa_verbs[] = {
8637 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8638 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8640 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8641 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8643 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8644 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8645 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8647 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8648 { } /* end */
8651 /* toggle speaker-output according to the hp-jack state */
8652 static void alc882_targa_automute(struct hda_codec *codec)
8654 struct alc_spec *spec = codec->spec;
8655 alc_automute_amp(codec);
8656 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8657 spec->jack_present ? 1 : 3);
8660 static void alc882_targa_setup(struct hda_codec *codec)
8662 struct alc_spec *spec = codec->spec;
8664 spec->autocfg.hp_pins[0] = 0x14;
8665 spec->autocfg.speaker_pins[0] = 0x1b;
8668 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8670 if ((res >> 26) == ALC880_HP_EVENT)
8671 alc882_targa_automute(codec);
8674 static struct hda_verb alc882_asus_a7j_verbs[] = {
8675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8676 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8678 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8679 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8680 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8682 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8683 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8684 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8686 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8687 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8688 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8689 { } /* end */
8692 static struct hda_verb alc882_asus_a7m_verbs[] = {
8693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8696 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8697 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8698 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8700 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8701 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8702 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8704 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8705 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8706 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8707 { } /* end */
8710 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8712 unsigned int gpiostate, gpiomask, gpiodir;
8714 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8715 AC_VERB_GET_GPIO_DATA, 0);
8717 if (!muted)
8718 gpiostate |= (1 << pin);
8719 else
8720 gpiostate &= ~(1 << pin);
8722 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8723 AC_VERB_GET_GPIO_MASK, 0);
8724 gpiomask |= (1 << pin);
8726 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8727 AC_VERB_GET_GPIO_DIRECTION, 0);
8728 gpiodir |= (1 << pin);
8731 snd_hda_codec_write(codec, codec->afg, 0,
8732 AC_VERB_SET_GPIO_MASK, gpiomask);
8733 snd_hda_codec_write(codec, codec->afg, 0,
8734 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8736 msleep(1);
8738 snd_hda_codec_write(codec, codec->afg, 0,
8739 AC_VERB_SET_GPIO_DATA, gpiostate);
8742 /* set up GPIO at initialization */
8743 static void alc885_macpro_init_hook(struct hda_codec *codec)
8745 alc882_gpio_mute(codec, 0, 0);
8746 alc882_gpio_mute(codec, 1, 0);
8749 /* set up GPIO and update auto-muting at initialization */
8750 static void alc885_imac24_init_hook(struct hda_codec *codec)
8752 alc885_macpro_init_hook(codec);
8753 alc_automute_amp(codec);
8757 * generic initialization of ADC, input mixers and output mixers
8759 static struct hda_verb alc883_auto_init_verbs[] = {
8761 * Unmute ADC0-2 and set the default input to mic-in
8763 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8764 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8765 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8766 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8769 * Set up output mixers (0x0c - 0x0f)
8771 /* set vol=0 to output mixers */
8772 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8773 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8774 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8775 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8776 /* set up input amps for analog loopback */
8777 /* Amp Indices: DAC = 0, mixer = 1 */
8778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8779 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8780 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8781 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8782 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8783 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8784 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8785 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8786 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8787 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8789 /* FIXME: use matrix-type input source selection */
8790 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8791 /* Input mixer2 */
8792 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8793 /* Input mixer3 */
8794 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8798 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8799 static struct hda_verb alc889A_mb31_ch2_init[] = {
8800 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8801 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8802 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8803 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8804 { } /* end */
8807 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8808 static struct hda_verb alc889A_mb31_ch4_init[] = {
8809 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8810 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8811 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8812 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8813 { } /* end */
8816 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8817 static struct hda_verb alc889A_mb31_ch5_init[] = {
8818 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8819 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8820 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8821 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8822 { } /* end */
8825 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8826 static struct hda_verb alc889A_mb31_ch6_init[] = {
8827 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8828 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8829 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8830 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8831 { } /* end */
8834 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8835 { 2, alc889A_mb31_ch2_init },
8836 { 4, alc889A_mb31_ch4_init },
8837 { 5, alc889A_mb31_ch5_init },
8838 { 6, alc889A_mb31_ch6_init },
8841 static struct hda_verb alc883_medion_eapd_verbs[] = {
8842 /* eanable EAPD on medion laptop */
8843 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8844 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8848 #define alc883_base_mixer alc882_base_mixer
8850 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8851 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8852 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8853 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8854 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8855 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8856 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8857 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8858 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8859 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8861 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8862 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8863 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8864 { } /* end */
8867 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8868 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8869 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8870 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8871 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8872 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8873 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8875 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8876 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8877 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8878 { } /* end */
8881 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8882 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8883 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8884 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8885 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8886 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8887 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8888 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8889 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8890 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8891 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8892 { } /* end */
8895 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8896 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8897 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8898 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8899 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8900 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8901 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8902 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8903 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8904 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8905 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8906 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8907 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8908 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8909 { } /* end */
8912 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8913 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8914 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8915 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8916 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8917 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8918 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8919 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8920 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8921 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8922 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8923 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8924 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8925 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8927 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8928 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8929 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8930 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8931 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8932 { } /* end */
8935 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8936 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8937 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8938 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8939 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8940 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8941 HDA_OUTPUT),
8942 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8943 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8944 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8945 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8946 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8947 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8948 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8949 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8950 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8951 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
8952 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8953 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8954 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
8955 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8956 { } /* end */
8959 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8960 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8961 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8962 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8963 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8964 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8965 HDA_OUTPUT),
8966 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8967 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8968 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8969 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8970 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8971 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8972 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8973 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8975 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
8976 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8977 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8978 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
8979 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8980 { } /* end */
8983 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8984 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8985 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8986 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8987 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8988 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8989 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8990 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8991 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8992 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8993 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8994 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8995 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8996 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8998 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8999 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9000 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9001 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9002 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9003 { } /* end */
9006 static struct snd_kcontrol_new alc883_targa_mixer[] = {
9007 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9008 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9010 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9011 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9012 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9013 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9014 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9015 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9016 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9017 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9018 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9019 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9020 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9021 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9022 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9023 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9024 { } /* end */
9027 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9028 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9029 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9031 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9032 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9033 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9034 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9035 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9036 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9037 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9038 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9039 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9040 { } /* end */
9043 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9044 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9045 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9046 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9047 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9048 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9049 { } /* end */
9052 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9053 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9054 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9055 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9056 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9057 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9058 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9059 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9060 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9061 { } /* end */
9064 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9065 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9066 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9067 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9068 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9069 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9070 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9071 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9072 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9073 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9074 { } /* end */
9077 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9078 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9079 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9080 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9081 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9082 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9083 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9084 { } /* end */
9087 static struct hda_verb alc883_medion_wim2160_verbs[] = {
9088 /* Unmute front mixer */
9089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9092 /* Set speaker pin to front mixer */
9093 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9095 /* Init headphone pin */
9096 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9097 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9098 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9099 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9101 { } /* end */
9104 /* toggle speaker-output according to the hp-jack state */
9105 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9107 struct alc_spec *spec = codec->spec;
9109 spec->autocfg.hp_pins[0] = 0x1a;
9110 spec->autocfg.speaker_pins[0] = 0x15;
9113 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9114 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9115 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9117 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9118 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9120 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9121 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9122 { } /* end */
9125 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9126 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9127 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9128 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9129 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9130 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9131 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9133 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9135 { } /* end */
9138 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9139 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9140 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9141 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9142 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9143 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9144 0x0d, 1, 0x0, HDA_OUTPUT),
9145 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9146 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9147 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9148 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9149 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9150 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9151 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9152 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9153 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9155 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9156 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9157 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9158 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9159 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9160 { } /* end */
9163 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9164 /* Output mixers */
9165 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9166 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9167 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9168 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9169 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9170 HDA_OUTPUT),
9171 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9172 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9173 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9174 /* Output switches */
9175 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9176 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9177 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9178 /* Boost mixers */
9179 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
9180 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
9181 /* Input mixers */
9182 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9183 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9184 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9185 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9186 { } /* end */
9189 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9190 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9191 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9194 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9195 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9196 { } /* end */
9199 static struct hda_bind_ctls alc883_bind_cap_vol = {
9200 .ops = &snd_hda_bind_vol,
9201 .values = {
9202 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9203 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9208 static struct hda_bind_ctls alc883_bind_cap_switch = {
9209 .ops = &snd_hda_bind_sw,
9210 .values = {
9211 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9212 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9217 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9218 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9219 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9220 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9221 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9222 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9224 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9225 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9226 { } /* end */
9229 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9230 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9231 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9233 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9234 /* .name = "Capture Source", */
9235 .name = "Input Source",
9236 .count = 1,
9237 .info = alc_mux_enum_info,
9238 .get = alc_mux_enum_get,
9239 .put = alc_mux_enum_put,
9241 { } /* end */
9244 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9246 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9247 .name = "Channel Mode",
9248 .info = alc_ch_mode_info,
9249 .get = alc_ch_mode_get,
9250 .put = alc_ch_mode_put,
9252 { } /* end */
9255 /* toggle speaker-output according to the hp-jack state */
9256 static void alc883_mitac_setup(struct hda_codec *codec)
9258 struct alc_spec *spec = codec->spec;
9260 spec->autocfg.hp_pins[0] = 0x15;
9261 spec->autocfg.speaker_pins[0] = 0x14;
9262 spec->autocfg.speaker_pins[1] = 0x17;
9265 static struct hda_verb alc883_mitac_verbs[] = {
9266 /* HP */
9267 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9268 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9269 /* Subwoofer */
9270 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9271 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9273 /* enable unsolicited event */
9274 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9275 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9277 { } /* end */
9280 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9281 /* HP */
9282 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9283 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9284 /* Int speaker */
9285 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9287 /* enable unsolicited event */
9289 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9290 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9293 { } /* end */
9296 static struct hda_verb alc883_clevo_m720_verbs[] = {
9297 /* HP */
9298 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9299 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9300 /* Int speaker */
9301 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9302 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9304 /* enable unsolicited event */
9305 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9306 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9308 { } /* end */
9311 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9312 /* HP */
9313 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9314 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9315 /* Subwoofer */
9316 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9317 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9319 /* enable unsolicited event */
9320 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9322 { } /* end */
9325 static struct hda_verb alc883_targa_verbs[] = {
9326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9329 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9330 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9332 /* Connect Line-Out side jack (SPDIF) to Side */
9333 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9334 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9335 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9336 /* Connect Mic jack to CLFE */
9337 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9338 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9339 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9340 /* Connect Line-in jack to Surround */
9341 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9342 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9343 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9344 /* Connect HP out jack to Front */
9345 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9346 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9347 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9349 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9351 { } /* end */
9354 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9355 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9356 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9357 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9358 { } /* end */
9361 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9362 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9364 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9365 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9366 { } /* end */
9369 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9372 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9373 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9374 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9375 { } /* end */
9378 static struct hda_verb alc883_haier_w66_verbs[] = {
9379 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9380 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9382 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9384 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9385 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9386 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9387 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9388 { } /* end */
9391 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9392 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9393 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9394 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9395 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9396 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9397 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9398 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9399 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9400 { } /* end */
9403 static struct hda_verb alc888_6st_dell_verbs[] = {
9404 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9408 static struct hda_verb alc883_vaiott_verbs[] = {
9409 /* HP */
9410 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9411 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9413 /* enable unsolicited event */
9414 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9416 { } /* end */
9419 static void alc888_3st_hp_setup(struct hda_codec *codec)
9421 struct alc_spec *spec = codec->spec;
9423 spec->autocfg.hp_pins[0] = 0x1b;
9424 spec->autocfg.speaker_pins[0] = 0x14;
9425 spec->autocfg.speaker_pins[1] = 0x16;
9426 spec->autocfg.speaker_pins[2] = 0x18;
9429 static struct hda_verb alc888_3st_hp_verbs[] = {
9430 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9431 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9432 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9433 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9434 { } /* end */
9438 * 2ch mode
9440 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9441 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9442 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9443 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9444 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9445 { } /* end */
9449 * 4ch mode
9451 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9452 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9453 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9454 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9455 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9456 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9457 { } /* end */
9461 * 6ch mode
9463 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9464 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9465 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9466 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9467 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9468 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9469 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9470 { } /* end */
9473 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9474 { 2, alc888_3st_hp_2ch_init },
9475 { 4, alc888_3st_hp_4ch_init },
9476 { 6, alc888_3st_hp_6ch_init },
9479 /* toggle front-jack and RCA according to the hp-jack state */
9480 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9482 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9484 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9485 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9486 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9487 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9490 /* toggle RCA according to the front-jack state */
9491 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9493 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9495 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9496 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9499 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9500 unsigned int res)
9502 if ((res >> 26) == ALC880_HP_EVENT)
9503 alc888_lenovo_ms7195_front_automute(codec);
9504 if ((res >> 26) == ALC880_FRONT_EVENT)
9505 alc888_lenovo_ms7195_rca_automute(codec);
9508 /* toggle speaker-output according to the hp-jack state */
9509 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9511 struct alc_spec *spec = codec->spec;
9513 spec->autocfg.hp_pins[0] = 0x14;
9514 spec->autocfg.speaker_pins[0] = 0x15;
9517 /* toggle speaker-output according to the hp-jack state */
9518 #define alc883_targa_init_hook alc882_targa_init_hook
9519 #define alc883_targa_unsol_event alc882_targa_unsol_event
9521 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9523 struct alc_spec *spec = codec->spec;
9525 spec->autocfg.hp_pins[0] = 0x15;
9526 spec->autocfg.speaker_pins[0] = 0x14;
9529 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9531 alc_automute_amp(codec);
9532 alc88x_simple_mic_automute(codec);
9535 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9536 unsigned int res)
9538 switch (res >> 26) {
9539 case ALC880_MIC_EVENT:
9540 alc88x_simple_mic_automute(codec);
9541 break;
9542 default:
9543 alc_automute_amp_unsol_event(codec, res);
9544 break;
9548 /* toggle speaker-output according to the hp-jack state */
9549 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9551 struct alc_spec *spec = codec->spec;
9553 spec->autocfg.hp_pins[0] = 0x14;
9554 spec->autocfg.speaker_pins[0] = 0x15;
9557 static void alc883_haier_w66_setup(struct hda_codec *codec)
9559 struct alc_spec *spec = codec->spec;
9561 spec->autocfg.hp_pins[0] = 0x1b;
9562 spec->autocfg.speaker_pins[0] = 0x14;
9565 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9567 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9569 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9570 HDA_AMP_MUTE, bits);
9573 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9575 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9577 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9578 HDA_AMP_MUTE, bits);
9579 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9580 HDA_AMP_MUTE, bits);
9583 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9584 unsigned int res)
9586 if ((res >> 26) == ALC880_HP_EVENT)
9587 alc883_lenovo_101e_all_automute(codec);
9588 if ((res >> 26) == ALC880_FRONT_EVENT)
9589 alc883_lenovo_101e_ispeaker_automute(codec);
9592 /* toggle speaker-output according to the hp-jack state */
9593 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9595 struct alc_spec *spec = codec->spec;
9597 spec->autocfg.hp_pins[0] = 0x14;
9598 spec->autocfg.speaker_pins[0] = 0x15;
9599 spec->autocfg.speaker_pins[1] = 0x16;
9602 static struct hda_verb alc883_acer_eapd_verbs[] = {
9603 /* HP Pin: output 0 (0x0c) */
9604 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9605 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9606 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9607 /* Front Pin: output 0 (0x0c) */
9608 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9609 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9610 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9611 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9612 /* eanable EAPD on medion laptop */
9613 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9614 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9615 /* enable unsolicited event */
9616 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9620 static void alc888_6st_dell_setup(struct hda_codec *codec)
9622 struct alc_spec *spec = codec->spec;
9624 spec->autocfg.hp_pins[0] = 0x1b;
9625 spec->autocfg.speaker_pins[0] = 0x14;
9626 spec->autocfg.speaker_pins[1] = 0x15;
9627 spec->autocfg.speaker_pins[2] = 0x16;
9628 spec->autocfg.speaker_pins[3] = 0x17;
9631 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9633 struct alc_spec *spec = codec->spec;
9635 spec->autocfg.hp_pins[0] = 0x1b;
9636 spec->autocfg.speaker_pins[0] = 0x14;
9637 spec->autocfg.speaker_pins[1] = 0x15;
9638 spec->autocfg.speaker_pins[2] = 0x16;
9639 spec->autocfg.speaker_pins[3] = 0x17;
9640 spec->autocfg.speaker_pins[4] = 0x1a;
9643 static void alc883_vaiott_setup(struct hda_codec *codec)
9645 struct alc_spec *spec = codec->spec;
9647 spec->autocfg.hp_pins[0] = 0x15;
9648 spec->autocfg.speaker_pins[0] = 0x14;
9649 spec->autocfg.speaker_pins[1] = 0x17;
9652 static struct hda_verb alc888_asus_m90v_verbs[] = {
9653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9656 /* enable unsolicited event */
9657 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9658 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9659 { } /* end */
9662 static void alc883_mode2_setup(struct hda_codec *codec)
9664 struct alc_spec *spec = codec->spec;
9666 spec->autocfg.hp_pins[0] = 0x1b;
9667 spec->autocfg.speaker_pins[0] = 0x14;
9668 spec->autocfg.speaker_pins[1] = 0x15;
9669 spec->autocfg.speaker_pins[2] = 0x16;
9670 spec->ext_mic.pin = 0x18;
9671 spec->int_mic.pin = 0x19;
9672 spec->ext_mic.mux_idx = 0;
9673 spec->int_mic.mux_idx = 1;
9674 spec->auto_mic = 1;
9677 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9678 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9679 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9681 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9682 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9683 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9684 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9685 /* enable unsolicited event */
9686 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9687 { } /* end */
9690 static void alc883_eee1601_inithook(struct hda_codec *codec)
9692 struct alc_spec *spec = codec->spec;
9694 spec->autocfg.hp_pins[0] = 0x14;
9695 spec->autocfg.speaker_pins[0] = 0x1b;
9696 alc_automute_pin(codec);
9699 static struct hda_verb alc889A_mb31_verbs[] = {
9700 /* Init rear pin (used as headphone output) */
9701 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9702 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9703 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9704 /* Init line pin (used as output in 4ch and 6ch mode) */
9705 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9706 /* Init line 2 pin (used as headphone out by default) */
9707 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9708 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9709 { } /* end */
9712 /* Mute speakers according to the headphone jack state */
9713 static void alc889A_mb31_automute(struct hda_codec *codec)
9715 unsigned int present;
9717 /* Mute only in 2ch or 4ch mode */
9718 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9719 == 0x00) {
9720 present = snd_hda_jack_detect(codec, 0x15);
9721 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9722 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9723 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9724 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9728 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9730 if ((res >> 26) == ALC880_HP_EVENT)
9731 alc889A_mb31_automute(codec);
9735 #ifdef CONFIG_SND_HDA_POWER_SAVE
9736 #define alc882_loopbacks alc880_loopbacks
9737 #endif
9739 /* pcm configuration: identical with ALC880 */
9740 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9741 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9742 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9743 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9745 static hda_nid_t alc883_slave_dig_outs[] = {
9746 ALC1200_DIGOUT_NID, 0,
9749 static hda_nid_t alc1200_slave_dig_outs[] = {
9750 ALC883_DIGOUT_NID, 0,
9754 * configuration and preset
9756 static const char * const alc882_models[ALC882_MODEL_LAST] = {
9757 [ALC882_3ST_DIG] = "3stack-dig",
9758 [ALC882_6ST_DIG] = "6stack-dig",
9759 [ALC882_ARIMA] = "arima",
9760 [ALC882_W2JC] = "w2jc",
9761 [ALC882_TARGA] = "targa",
9762 [ALC882_ASUS_A7J] = "asus-a7j",
9763 [ALC882_ASUS_A7M] = "asus-a7m",
9764 [ALC885_MACPRO] = "macpro",
9765 [ALC885_MB5] = "mb5",
9766 [ALC885_MACMINI3] = "macmini3",
9767 [ALC885_MBA21] = "mba21",
9768 [ALC885_MBP3] = "mbp3",
9769 [ALC885_IMAC24] = "imac24",
9770 [ALC885_IMAC91] = "imac91",
9771 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9772 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9773 [ALC883_3ST_6ch] = "3stack-6ch",
9774 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9775 [ALC883_TARGA_DIG] = "targa-dig",
9776 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9777 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9778 [ALC883_ACER] = "acer",
9779 [ALC883_ACER_ASPIRE] = "acer-aspire",
9780 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9781 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9782 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9783 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9784 [ALC883_MEDION] = "medion",
9785 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9786 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9787 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9788 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9789 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9790 [ALC888_LENOVO_SKY] = "lenovo-sky",
9791 [ALC883_HAIER_W66] = "haier-w66",
9792 [ALC888_3ST_HP] = "3stack-hp",
9793 [ALC888_6ST_DELL] = "6stack-dell",
9794 [ALC883_MITAC] = "mitac",
9795 [ALC883_CLEVO_M540R] = "clevo-m540r",
9796 [ALC883_CLEVO_M720] = "clevo-m720",
9797 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9798 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9799 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9800 [ALC889A_INTEL] = "intel-alc889a",
9801 [ALC889_INTEL] = "intel-x58",
9802 [ALC1200_ASUS_P5Q] = "asus-p5q",
9803 [ALC889A_MB31] = "mb31",
9804 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9805 [ALC882_AUTO] = "auto",
9808 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9809 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9811 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9812 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9813 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9814 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9815 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9816 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9817 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9818 ALC888_ACER_ASPIRE_4930G),
9819 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9820 ALC888_ACER_ASPIRE_4930G),
9821 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9822 ALC888_ACER_ASPIRE_8930G),
9823 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9824 ALC888_ACER_ASPIRE_8930G),
9825 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9826 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9827 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9828 ALC888_ACER_ASPIRE_6530G),
9829 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9830 ALC888_ACER_ASPIRE_6530G),
9831 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9832 ALC888_ACER_ASPIRE_7730G),
9833 /* default Acer -- disabled as it causes more problems.
9834 * model=auto should work fine now
9836 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9838 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9840 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG),
9841 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9842 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9843 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9844 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9845 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9847 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9848 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9849 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9850 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9851 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9852 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9853 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9854 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9855 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9856 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9857 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9859 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9860 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9861 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9862 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9863 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9864 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9865 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9866 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9867 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9869 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9870 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9871 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9872 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9873 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9874 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9875 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9876 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9877 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9878 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9879 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9880 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9881 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9882 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9883 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9884 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9885 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9886 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9887 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9888 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9889 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9890 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9891 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9892 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9893 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9894 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9895 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9896 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9897 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9898 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9899 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9901 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9902 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9903 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9904 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9905 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9906 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9907 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9908 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9909 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9910 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9911 ALC883_FUJITSU_PI2515),
9912 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9913 ALC888_FUJITSU_XA3530),
9914 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9915 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9916 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9917 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9918 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9919 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9920 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9921 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9923 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9924 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9925 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9926 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9927 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9928 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9929 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9934 /* codec SSID table for Intel Mac */
9935 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9936 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9937 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9938 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9939 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9940 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9941 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9942 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9943 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9944 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9945 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9946 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9947 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9948 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9949 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9950 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9951 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9952 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9953 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9954 * so apparently no perfect solution yet
9956 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9957 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9958 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9959 {} /* terminator */
9962 static struct alc_config_preset alc882_presets[] = {
9963 [ALC882_3ST_DIG] = {
9964 .mixers = { alc882_base_mixer },
9965 .init_verbs = { alc882_base_init_verbs,
9966 alc882_adc1_init_verbs },
9967 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9968 .dac_nids = alc882_dac_nids,
9969 .dig_out_nid = ALC882_DIGOUT_NID,
9970 .dig_in_nid = ALC882_DIGIN_NID,
9971 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9972 .channel_mode = alc882_ch_modes,
9973 .need_dac_fix = 1,
9974 .input_mux = &alc882_capture_source,
9976 [ALC882_6ST_DIG] = {
9977 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9978 .init_verbs = { alc882_base_init_verbs,
9979 alc882_adc1_init_verbs },
9980 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9981 .dac_nids = alc882_dac_nids,
9982 .dig_out_nid = ALC882_DIGOUT_NID,
9983 .dig_in_nid = ALC882_DIGIN_NID,
9984 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9985 .channel_mode = alc882_sixstack_modes,
9986 .input_mux = &alc882_capture_source,
9988 [ALC882_ARIMA] = {
9989 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9990 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9991 alc882_eapd_verbs },
9992 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9993 .dac_nids = alc882_dac_nids,
9994 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9995 .channel_mode = alc882_sixstack_modes,
9996 .input_mux = &alc882_capture_source,
9998 [ALC882_W2JC] = {
9999 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
10000 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10001 alc882_eapd_verbs, alc880_gpio1_init_verbs },
10002 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10003 .dac_nids = alc882_dac_nids,
10004 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10005 .channel_mode = alc880_threestack_modes,
10006 .need_dac_fix = 1,
10007 .input_mux = &alc882_capture_source,
10008 .dig_out_nid = ALC882_DIGOUT_NID,
10010 [ALC885_MBA21] = {
10011 .mixers = { alc885_mba21_mixer },
10012 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
10013 .num_dacs = 2,
10014 .dac_nids = alc882_dac_nids,
10015 .channel_mode = alc885_mba21_ch_modes,
10016 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10017 .input_mux = &alc882_capture_source,
10018 .unsol_event = alc_automute_amp_unsol_event,
10019 .setup = alc885_mba21_setup,
10020 .init_hook = alc_automute_amp,
10022 [ALC885_MBP3] = {
10023 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
10024 .init_verbs = { alc885_mbp3_init_verbs,
10025 alc880_gpio1_init_verbs },
10026 .num_dacs = 2,
10027 .dac_nids = alc882_dac_nids,
10028 .hp_nid = 0x04,
10029 .channel_mode = alc885_mbp_4ch_modes,
10030 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10031 .input_mux = &alc882_capture_source,
10032 .dig_out_nid = ALC882_DIGOUT_NID,
10033 .dig_in_nid = ALC882_DIGIN_NID,
10034 .unsol_event = alc_automute_amp_unsol_event,
10035 .setup = alc885_mbp3_setup,
10036 .init_hook = alc_automute_amp,
10038 [ALC885_MB5] = {
10039 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10040 .init_verbs = { alc885_mb5_init_verbs,
10041 alc880_gpio1_init_verbs },
10042 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10043 .dac_nids = alc882_dac_nids,
10044 .channel_mode = alc885_mb5_6ch_modes,
10045 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10046 .input_mux = &mb5_capture_source,
10047 .dig_out_nid = ALC882_DIGOUT_NID,
10048 .dig_in_nid = ALC882_DIGIN_NID,
10049 .unsol_event = alc_automute_amp_unsol_event,
10050 .setup = alc885_mb5_setup,
10051 .init_hook = alc_automute_amp,
10053 [ALC885_MACMINI3] = {
10054 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10055 .init_verbs = { alc885_macmini3_init_verbs,
10056 alc880_gpio1_init_verbs },
10057 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10058 .dac_nids = alc882_dac_nids,
10059 .channel_mode = alc885_macmini3_6ch_modes,
10060 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10061 .input_mux = &macmini3_capture_source,
10062 .dig_out_nid = ALC882_DIGOUT_NID,
10063 .dig_in_nid = ALC882_DIGIN_NID,
10064 .unsol_event = alc_automute_amp_unsol_event,
10065 .setup = alc885_macmini3_setup,
10066 .init_hook = alc_automute_amp,
10068 [ALC885_MACPRO] = {
10069 .mixers = { alc882_macpro_mixer },
10070 .init_verbs = { alc882_macpro_init_verbs },
10071 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10072 .dac_nids = alc882_dac_nids,
10073 .dig_out_nid = ALC882_DIGOUT_NID,
10074 .dig_in_nid = ALC882_DIGIN_NID,
10075 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10076 .channel_mode = alc882_ch_modes,
10077 .input_mux = &alc882_capture_source,
10078 .init_hook = alc885_macpro_init_hook,
10080 [ALC885_IMAC24] = {
10081 .mixers = { alc885_imac24_mixer },
10082 .init_verbs = { alc885_imac24_init_verbs },
10083 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10084 .dac_nids = alc882_dac_nids,
10085 .dig_out_nid = ALC882_DIGOUT_NID,
10086 .dig_in_nid = ALC882_DIGIN_NID,
10087 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10088 .channel_mode = alc882_ch_modes,
10089 .input_mux = &alc882_capture_source,
10090 .unsol_event = alc_automute_amp_unsol_event,
10091 .setup = alc885_imac24_setup,
10092 .init_hook = alc885_imac24_init_hook,
10094 [ALC885_IMAC91] = {
10095 .mixers = {alc885_imac91_mixer},
10096 .init_verbs = { alc885_imac91_init_verbs,
10097 alc880_gpio1_init_verbs },
10098 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10099 .dac_nids = alc882_dac_nids,
10100 .channel_mode = alc885_mba21_ch_modes,
10101 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10102 .input_mux = &alc889A_imac91_capture_source,
10103 .dig_out_nid = ALC882_DIGOUT_NID,
10104 .dig_in_nid = ALC882_DIGIN_NID,
10105 .unsol_event = alc_automute_amp_unsol_event,
10106 .setup = alc885_imac91_setup,
10107 .init_hook = alc_automute_amp,
10109 [ALC882_TARGA] = {
10110 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10111 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10112 alc880_gpio3_init_verbs, alc882_targa_verbs},
10113 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10114 .dac_nids = alc882_dac_nids,
10115 .dig_out_nid = ALC882_DIGOUT_NID,
10116 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10117 .adc_nids = alc882_adc_nids,
10118 .capsrc_nids = alc882_capsrc_nids,
10119 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10120 .channel_mode = alc882_3ST_6ch_modes,
10121 .need_dac_fix = 1,
10122 .input_mux = &alc882_capture_source,
10123 .unsol_event = alc882_targa_unsol_event,
10124 .setup = alc882_targa_setup,
10125 .init_hook = alc882_targa_automute,
10127 [ALC882_ASUS_A7J] = {
10128 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10129 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10130 alc882_asus_a7j_verbs},
10131 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10132 .dac_nids = alc882_dac_nids,
10133 .dig_out_nid = ALC882_DIGOUT_NID,
10134 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10135 .adc_nids = alc882_adc_nids,
10136 .capsrc_nids = alc882_capsrc_nids,
10137 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10138 .channel_mode = alc882_3ST_6ch_modes,
10139 .need_dac_fix = 1,
10140 .input_mux = &alc882_capture_source,
10142 [ALC882_ASUS_A7M] = {
10143 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10144 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10145 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10146 alc882_asus_a7m_verbs },
10147 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10148 .dac_nids = alc882_dac_nids,
10149 .dig_out_nid = ALC882_DIGOUT_NID,
10150 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10151 .channel_mode = alc880_threestack_modes,
10152 .need_dac_fix = 1,
10153 .input_mux = &alc882_capture_source,
10155 [ALC883_3ST_2ch_DIG] = {
10156 .mixers = { alc883_3ST_2ch_mixer },
10157 .init_verbs = { alc883_init_verbs },
10158 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10159 .dac_nids = alc883_dac_nids,
10160 .dig_out_nid = ALC883_DIGOUT_NID,
10161 .dig_in_nid = ALC883_DIGIN_NID,
10162 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10163 .channel_mode = alc883_3ST_2ch_modes,
10164 .input_mux = &alc883_capture_source,
10166 [ALC883_3ST_6ch_DIG] = {
10167 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10168 .init_verbs = { alc883_init_verbs },
10169 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10170 .dac_nids = alc883_dac_nids,
10171 .dig_out_nid = ALC883_DIGOUT_NID,
10172 .dig_in_nid = ALC883_DIGIN_NID,
10173 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10174 .channel_mode = alc883_3ST_6ch_modes,
10175 .need_dac_fix = 1,
10176 .input_mux = &alc883_capture_source,
10178 [ALC883_3ST_6ch] = {
10179 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10180 .init_verbs = { alc883_init_verbs },
10181 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10182 .dac_nids = alc883_dac_nids,
10183 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10184 .channel_mode = alc883_3ST_6ch_modes,
10185 .need_dac_fix = 1,
10186 .input_mux = &alc883_capture_source,
10188 [ALC883_3ST_6ch_INTEL] = {
10189 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10190 .init_verbs = { alc883_init_verbs },
10191 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10192 .dac_nids = alc883_dac_nids,
10193 .dig_out_nid = ALC883_DIGOUT_NID,
10194 .dig_in_nid = ALC883_DIGIN_NID,
10195 .slave_dig_outs = alc883_slave_dig_outs,
10196 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10197 .channel_mode = alc883_3ST_6ch_intel_modes,
10198 .need_dac_fix = 1,
10199 .input_mux = &alc883_3stack_6ch_intel,
10201 [ALC889A_INTEL] = {
10202 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10203 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10204 alc_hp15_unsol_verbs },
10205 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10206 .dac_nids = alc883_dac_nids,
10207 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10208 .adc_nids = alc889_adc_nids,
10209 .dig_out_nid = ALC883_DIGOUT_NID,
10210 .dig_in_nid = ALC883_DIGIN_NID,
10211 .slave_dig_outs = alc883_slave_dig_outs,
10212 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10213 .channel_mode = alc889_8ch_intel_modes,
10214 .capsrc_nids = alc889_capsrc_nids,
10215 .input_mux = &alc889_capture_source,
10216 .setup = alc889_automute_setup,
10217 .init_hook = alc_automute_amp,
10218 .unsol_event = alc_automute_amp_unsol_event,
10219 .need_dac_fix = 1,
10221 [ALC889_INTEL] = {
10222 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10223 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10224 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10225 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10226 .dac_nids = alc883_dac_nids,
10227 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10228 .adc_nids = alc889_adc_nids,
10229 .dig_out_nid = ALC883_DIGOUT_NID,
10230 .dig_in_nid = ALC883_DIGIN_NID,
10231 .slave_dig_outs = alc883_slave_dig_outs,
10232 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10233 .channel_mode = alc889_8ch_intel_modes,
10234 .capsrc_nids = alc889_capsrc_nids,
10235 .input_mux = &alc889_capture_source,
10236 .setup = alc889_automute_setup,
10237 .init_hook = alc889_intel_init_hook,
10238 .unsol_event = alc_automute_amp_unsol_event,
10239 .need_dac_fix = 1,
10241 [ALC883_6ST_DIG] = {
10242 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10243 .init_verbs = { alc883_init_verbs },
10244 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10245 .dac_nids = alc883_dac_nids,
10246 .dig_out_nid = ALC883_DIGOUT_NID,
10247 .dig_in_nid = ALC883_DIGIN_NID,
10248 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10249 .channel_mode = alc883_sixstack_modes,
10250 .input_mux = &alc883_capture_source,
10252 [ALC883_TARGA_DIG] = {
10253 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10254 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10255 alc883_targa_verbs},
10256 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10257 .dac_nids = alc883_dac_nids,
10258 .dig_out_nid = ALC883_DIGOUT_NID,
10259 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10260 .channel_mode = alc883_3ST_6ch_modes,
10261 .need_dac_fix = 1,
10262 .input_mux = &alc883_capture_source,
10263 .unsol_event = alc883_targa_unsol_event,
10264 .setup = alc882_targa_setup,
10265 .init_hook = alc882_targa_automute,
10267 [ALC883_TARGA_2ch_DIG] = {
10268 .mixers = { alc883_targa_2ch_mixer},
10269 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10270 alc883_targa_verbs},
10271 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10272 .dac_nids = alc883_dac_nids,
10273 .adc_nids = alc883_adc_nids_alt,
10274 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10275 .capsrc_nids = alc883_capsrc_nids,
10276 .dig_out_nid = ALC883_DIGOUT_NID,
10277 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10278 .channel_mode = alc883_3ST_2ch_modes,
10279 .input_mux = &alc883_capture_source,
10280 .unsol_event = alc883_targa_unsol_event,
10281 .setup = alc882_targa_setup,
10282 .init_hook = alc882_targa_automute,
10284 [ALC883_TARGA_8ch_DIG] = {
10285 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10286 alc883_chmode_mixer },
10287 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10288 alc883_targa_verbs },
10289 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10290 .dac_nids = alc883_dac_nids,
10291 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10292 .adc_nids = alc883_adc_nids_rev,
10293 .capsrc_nids = alc883_capsrc_nids_rev,
10294 .dig_out_nid = ALC883_DIGOUT_NID,
10295 .dig_in_nid = ALC883_DIGIN_NID,
10296 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10297 .channel_mode = alc883_4ST_8ch_modes,
10298 .need_dac_fix = 1,
10299 .input_mux = &alc883_capture_source,
10300 .unsol_event = alc883_targa_unsol_event,
10301 .setup = alc882_targa_setup,
10302 .init_hook = alc882_targa_automute,
10304 [ALC883_ACER] = {
10305 .mixers = { alc883_base_mixer },
10306 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10307 * and the headphone jack. Turn this on and rely on the
10308 * standard mute methods whenever the user wants to turn
10309 * these outputs off.
10311 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10312 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10313 .dac_nids = alc883_dac_nids,
10314 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10315 .channel_mode = alc883_3ST_2ch_modes,
10316 .input_mux = &alc883_capture_source,
10318 [ALC883_ACER_ASPIRE] = {
10319 .mixers = { alc883_acer_aspire_mixer },
10320 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10321 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10322 .dac_nids = alc883_dac_nids,
10323 .dig_out_nid = ALC883_DIGOUT_NID,
10324 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10325 .channel_mode = alc883_3ST_2ch_modes,
10326 .input_mux = &alc883_capture_source,
10327 .unsol_event = alc_automute_amp_unsol_event,
10328 .setup = alc883_acer_aspire_setup,
10329 .init_hook = alc_automute_amp,
10331 [ALC888_ACER_ASPIRE_4930G] = {
10332 .mixers = { alc888_acer_aspire_4930g_mixer,
10333 alc883_chmode_mixer },
10334 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10335 alc888_acer_aspire_4930g_verbs },
10336 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10337 .dac_nids = alc883_dac_nids,
10338 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10339 .adc_nids = alc883_adc_nids_rev,
10340 .capsrc_nids = alc883_capsrc_nids_rev,
10341 .dig_out_nid = ALC883_DIGOUT_NID,
10342 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10343 .channel_mode = alc883_3ST_6ch_modes,
10344 .need_dac_fix = 1,
10345 .const_channel_count = 6,
10346 .num_mux_defs =
10347 ARRAY_SIZE(alc888_2_capture_sources),
10348 .input_mux = alc888_2_capture_sources,
10349 .unsol_event = alc_automute_amp_unsol_event,
10350 .setup = alc888_acer_aspire_4930g_setup,
10351 .init_hook = alc_automute_amp,
10353 [ALC888_ACER_ASPIRE_6530G] = {
10354 .mixers = { alc888_acer_aspire_6530_mixer },
10355 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10356 alc888_acer_aspire_6530g_verbs },
10357 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10358 .dac_nids = alc883_dac_nids,
10359 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10360 .adc_nids = alc883_adc_nids_rev,
10361 .capsrc_nids = alc883_capsrc_nids_rev,
10362 .dig_out_nid = ALC883_DIGOUT_NID,
10363 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10364 .channel_mode = alc883_3ST_2ch_modes,
10365 .num_mux_defs =
10366 ARRAY_SIZE(alc888_2_capture_sources),
10367 .input_mux = alc888_acer_aspire_6530_sources,
10368 .unsol_event = alc_automute_amp_unsol_event,
10369 .setup = alc888_acer_aspire_6530g_setup,
10370 .init_hook = alc_automute_amp,
10372 [ALC888_ACER_ASPIRE_8930G] = {
10373 .mixers = { alc889_acer_aspire_8930g_mixer,
10374 alc883_chmode_mixer },
10375 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10376 alc889_acer_aspire_8930g_verbs,
10377 alc889_eapd_verbs},
10378 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10379 .dac_nids = alc883_dac_nids,
10380 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10381 .adc_nids = alc889_adc_nids,
10382 .capsrc_nids = alc889_capsrc_nids,
10383 .dig_out_nid = ALC883_DIGOUT_NID,
10384 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10385 .channel_mode = alc883_3ST_6ch_modes,
10386 .need_dac_fix = 1,
10387 .const_channel_count = 6,
10388 .num_mux_defs =
10389 ARRAY_SIZE(alc889_capture_sources),
10390 .input_mux = alc889_capture_sources,
10391 .unsol_event = alc_automute_amp_unsol_event,
10392 .setup = alc889_acer_aspire_8930g_setup,
10393 .init_hook = alc_automute_amp,
10394 #ifdef CONFIG_SND_HDA_POWER_SAVE
10395 .power_hook = alc_power_eapd,
10396 #endif
10398 [ALC888_ACER_ASPIRE_7730G] = {
10399 .mixers = { alc883_3ST_6ch_mixer,
10400 alc883_chmode_mixer },
10401 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10402 alc888_acer_aspire_7730G_verbs },
10403 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10404 .dac_nids = alc883_dac_nids,
10405 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10406 .adc_nids = alc883_adc_nids_rev,
10407 .capsrc_nids = alc883_capsrc_nids_rev,
10408 .dig_out_nid = ALC883_DIGOUT_NID,
10409 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10410 .channel_mode = alc883_3ST_6ch_modes,
10411 .need_dac_fix = 1,
10412 .const_channel_count = 6,
10413 .input_mux = &alc883_capture_source,
10414 .unsol_event = alc_automute_amp_unsol_event,
10415 .setup = alc888_acer_aspire_7730g_setup,
10416 .init_hook = alc_automute_amp,
10418 [ALC883_MEDION] = {
10419 .mixers = { alc883_fivestack_mixer,
10420 alc883_chmode_mixer },
10421 .init_verbs = { alc883_init_verbs,
10422 alc883_medion_eapd_verbs },
10423 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10424 .dac_nids = alc883_dac_nids,
10425 .adc_nids = alc883_adc_nids_alt,
10426 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10427 .capsrc_nids = alc883_capsrc_nids,
10428 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10429 .channel_mode = alc883_sixstack_modes,
10430 .input_mux = &alc883_capture_source,
10432 [ALC883_MEDION_WIM2160] = {
10433 .mixers = { alc883_medion_wim2160_mixer },
10434 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10435 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10436 .dac_nids = alc883_dac_nids,
10437 .dig_out_nid = ALC883_DIGOUT_NID,
10438 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10439 .adc_nids = alc883_adc_nids,
10440 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10441 .channel_mode = alc883_3ST_2ch_modes,
10442 .input_mux = &alc883_capture_source,
10443 .unsol_event = alc_automute_amp_unsol_event,
10444 .setup = alc883_medion_wim2160_setup,
10445 .init_hook = alc_automute_amp,
10447 [ALC883_LAPTOP_EAPD] = {
10448 .mixers = { alc883_base_mixer },
10449 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10450 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10451 .dac_nids = alc883_dac_nids,
10452 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10453 .channel_mode = alc883_3ST_2ch_modes,
10454 .input_mux = &alc883_capture_source,
10456 [ALC883_CLEVO_M540R] = {
10457 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10458 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10459 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10460 .dac_nids = alc883_dac_nids,
10461 .dig_out_nid = ALC883_DIGOUT_NID,
10462 .dig_in_nid = ALC883_DIGIN_NID,
10463 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10464 .channel_mode = alc883_3ST_6ch_clevo_modes,
10465 .need_dac_fix = 1,
10466 .input_mux = &alc883_capture_source,
10467 /* This machine has the hardware HP auto-muting, thus
10468 * we need no software mute via unsol event
10471 [ALC883_CLEVO_M720] = {
10472 .mixers = { alc883_clevo_m720_mixer },
10473 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10474 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10475 .dac_nids = alc883_dac_nids,
10476 .dig_out_nid = ALC883_DIGOUT_NID,
10477 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10478 .channel_mode = alc883_3ST_2ch_modes,
10479 .input_mux = &alc883_capture_source,
10480 .unsol_event = alc883_clevo_m720_unsol_event,
10481 .setup = alc883_clevo_m720_setup,
10482 .init_hook = alc883_clevo_m720_init_hook,
10484 [ALC883_LENOVO_101E_2ch] = {
10485 .mixers = { alc883_lenovo_101e_2ch_mixer},
10486 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10487 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10488 .dac_nids = alc883_dac_nids,
10489 .adc_nids = alc883_adc_nids_alt,
10490 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10491 .capsrc_nids = alc883_capsrc_nids,
10492 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10493 .channel_mode = alc883_3ST_2ch_modes,
10494 .input_mux = &alc883_lenovo_101e_capture_source,
10495 .unsol_event = alc883_lenovo_101e_unsol_event,
10496 .init_hook = alc883_lenovo_101e_all_automute,
10498 [ALC883_LENOVO_NB0763] = {
10499 .mixers = { alc883_lenovo_nb0763_mixer },
10500 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10501 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10502 .dac_nids = alc883_dac_nids,
10503 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10504 .channel_mode = alc883_3ST_2ch_modes,
10505 .need_dac_fix = 1,
10506 .input_mux = &alc883_lenovo_nb0763_capture_source,
10507 .unsol_event = alc_automute_amp_unsol_event,
10508 .setup = alc883_lenovo_nb0763_setup,
10509 .init_hook = alc_automute_amp,
10511 [ALC888_LENOVO_MS7195_DIG] = {
10512 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10513 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10514 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10515 .dac_nids = alc883_dac_nids,
10516 .dig_out_nid = ALC883_DIGOUT_NID,
10517 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10518 .channel_mode = alc883_3ST_6ch_modes,
10519 .need_dac_fix = 1,
10520 .input_mux = &alc883_capture_source,
10521 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10522 .init_hook = alc888_lenovo_ms7195_front_automute,
10524 [ALC883_HAIER_W66] = {
10525 .mixers = { alc883_targa_2ch_mixer},
10526 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10527 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10528 .dac_nids = alc883_dac_nids,
10529 .dig_out_nid = ALC883_DIGOUT_NID,
10530 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10531 .channel_mode = alc883_3ST_2ch_modes,
10532 .input_mux = &alc883_capture_source,
10533 .unsol_event = alc_automute_amp_unsol_event,
10534 .setup = alc883_haier_w66_setup,
10535 .init_hook = alc_automute_amp,
10537 [ALC888_3ST_HP] = {
10538 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10539 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10540 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10541 .dac_nids = alc883_dac_nids,
10542 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10543 .channel_mode = alc888_3st_hp_modes,
10544 .need_dac_fix = 1,
10545 .input_mux = &alc883_capture_source,
10546 .unsol_event = alc_automute_amp_unsol_event,
10547 .setup = alc888_3st_hp_setup,
10548 .init_hook = alc_automute_amp,
10550 [ALC888_6ST_DELL] = {
10551 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10552 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10553 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10554 .dac_nids = alc883_dac_nids,
10555 .dig_out_nid = ALC883_DIGOUT_NID,
10556 .dig_in_nid = ALC883_DIGIN_NID,
10557 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10558 .channel_mode = alc883_sixstack_modes,
10559 .input_mux = &alc883_capture_source,
10560 .unsol_event = alc_automute_amp_unsol_event,
10561 .setup = alc888_6st_dell_setup,
10562 .init_hook = alc_automute_amp,
10564 [ALC883_MITAC] = {
10565 .mixers = { alc883_mitac_mixer },
10566 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10567 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10568 .dac_nids = alc883_dac_nids,
10569 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10570 .channel_mode = alc883_3ST_2ch_modes,
10571 .input_mux = &alc883_capture_source,
10572 .unsol_event = alc_automute_amp_unsol_event,
10573 .setup = alc883_mitac_setup,
10574 .init_hook = alc_automute_amp,
10576 [ALC883_FUJITSU_PI2515] = {
10577 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10578 .init_verbs = { alc883_init_verbs,
10579 alc883_2ch_fujitsu_pi2515_verbs},
10580 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10581 .dac_nids = alc883_dac_nids,
10582 .dig_out_nid = ALC883_DIGOUT_NID,
10583 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10584 .channel_mode = alc883_3ST_2ch_modes,
10585 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10586 .unsol_event = alc_automute_amp_unsol_event,
10587 .setup = alc883_2ch_fujitsu_pi2515_setup,
10588 .init_hook = alc_automute_amp,
10590 [ALC888_FUJITSU_XA3530] = {
10591 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10592 .init_verbs = { alc883_init_verbs,
10593 alc888_fujitsu_xa3530_verbs },
10594 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10595 .dac_nids = alc883_dac_nids,
10596 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10597 .adc_nids = alc883_adc_nids_rev,
10598 .capsrc_nids = alc883_capsrc_nids_rev,
10599 .dig_out_nid = ALC883_DIGOUT_NID,
10600 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10601 .channel_mode = alc888_4ST_8ch_intel_modes,
10602 .num_mux_defs =
10603 ARRAY_SIZE(alc888_2_capture_sources),
10604 .input_mux = alc888_2_capture_sources,
10605 .unsol_event = alc_automute_amp_unsol_event,
10606 .setup = alc888_fujitsu_xa3530_setup,
10607 .init_hook = alc_automute_amp,
10609 [ALC888_LENOVO_SKY] = {
10610 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10611 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10612 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10613 .dac_nids = alc883_dac_nids,
10614 .dig_out_nid = ALC883_DIGOUT_NID,
10615 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10616 .channel_mode = alc883_sixstack_modes,
10617 .need_dac_fix = 1,
10618 .input_mux = &alc883_lenovo_sky_capture_source,
10619 .unsol_event = alc_automute_amp_unsol_event,
10620 .setup = alc888_lenovo_sky_setup,
10621 .init_hook = alc_automute_amp,
10623 [ALC888_ASUS_M90V] = {
10624 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10625 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10626 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10627 .dac_nids = alc883_dac_nids,
10628 .dig_out_nid = ALC883_DIGOUT_NID,
10629 .dig_in_nid = ALC883_DIGIN_NID,
10630 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10631 .channel_mode = alc883_3ST_6ch_modes,
10632 .need_dac_fix = 1,
10633 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10634 .unsol_event = alc_sku_unsol_event,
10635 .setup = alc883_mode2_setup,
10636 .init_hook = alc_inithook,
10638 [ALC888_ASUS_EEE1601] = {
10639 .mixers = { alc883_asus_eee1601_mixer },
10640 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10641 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10642 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10643 .dac_nids = alc883_dac_nids,
10644 .dig_out_nid = ALC883_DIGOUT_NID,
10645 .dig_in_nid = ALC883_DIGIN_NID,
10646 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10647 .channel_mode = alc883_3ST_2ch_modes,
10648 .need_dac_fix = 1,
10649 .input_mux = &alc883_asus_eee1601_capture_source,
10650 .unsol_event = alc_sku_unsol_event,
10651 .init_hook = alc883_eee1601_inithook,
10653 [ALC1200_ASUS_P5Q] = {
10654 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10655 .init_verbs = { alc883_init_verbs },
10656 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10657 .dac_nids = alc883_dac_nids,
10658 .dig_out_nid = ALC1200_DIGOUT_NID,
10659 .dig_in_nid = ALC883_DIGIN_NID,
10660 .slave_dig_outs = alc1200_slave_dig_outs,
10661 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10662 .channel_mode = alc883_sixstack_modes,
10663 .input_mux = &alc883_capture_source,
10665 [ALC889A_MB31] = {
10666 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10667 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10668 alc880_gpio1_init_verbs },
10669 .adc_nids = alc883_adc_nids,
10670 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10671 .capsrc_nids = alc883_capsrc_nids,
10672 .dac_nids = alc883_dac_nids,
10673 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10674 .channel_mode = alc889A_mb31_6ch_modes,
10675 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10676 .input_mux = &alc889A_mb31_capture_source,
10677 .dig_out_nid = ALC883_DIGOUT_NID,
10678 .unsol_event = alc889A_mb31_unsol_event,
10679 .init_hook = alc889A_mb31_automute,
10681 [ALC883_SONY_VAIO_TT] = {
10682 .mixers = { alc883_vaiott_mixer },
10683 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10684 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10685 .dac_nids = alc883_dac_nids,
10686 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10687 .channel_mode = alc883_3ST_2ch_modes,
10688 .input_mux = &alc883_capture_source,
10689 .unsol_event = alc_automute_amp_unsol_event,
10690 .setup = alc883_vaiott_setup,
10691 .init_hook = alc_automute_amp,
10697 * Pin config fixes
10699 enum {
10700 PINFIX_ABIT_AW9D_MAX,
10701 PINFIX_LENOVO_Y530,
10702 PINFIX_PB_M5210,
10703 PINFIX_ACER_ASPIRE_7736,
10706 static const struct alc_fixup alc882_fixups[] = {
10707 [PINFIX_ABIT_AW9D_MAX] = {
10708 .type = ALC_FIXUP_PINS,
10709 .v.pins = (const struct alc_pincfg[]) {
10710 { 0x15, 0x01080104 }, /* side */
10711 { 0x16, 0x01011012 }, /* rear */
10712 { 0x17, 0x01016011 }, /* clfe */
10716 [PINFIX_LENOVO_Y530] = {
10717 .type = ALC_FIXUP_PINS,
10718 .v.pins = (const struct alc_pincfg[]) {
10719 { 0x15, 0x99130112 }, /* rear int speakers */
10720 { 0x16, 0x99130111 }, /* subwoofer */
10724 [PINFIX_PB_M5210] = {
10725 .type = ALC_FIXUP_VERBS,
10726 .v.verbs = (const struct hda_verb[]) {
10727 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10731 [PINFIX_ACER_ASPIRE_7736] = {
10732 .type = ALC_FIXUP_SKU,
10733 .v.sku = ALC_FIXUP_SKU_IGNORE,
10737 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10738 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10739 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
10740 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10741 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10746 * BIOS auto configuration
10748 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10749 const struct auto_pin_cfg *cfg)
10751 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10754 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10755 hda_nid_t nid, int pin_type,
10756 hda_nid_t dac)
10758 int idx;
10760 /* set as output */
10761 alc_set_pin_output(codec, nid, pin_type);
10763 if (dac == 0x25)
10764 idx = 4;
10765 else if (dac >= 0x02 && dac <= 0x05)
10766 idx = dac - 2;
10767 else
10768 return;
10769 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10772 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10774 struct alc_spec *spec = codec->spec;
10775 int i;
10777 for (i = 0; i <= HDA_SIDE; i++) {
10778 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10779 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10780 if (nid)
10781 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10782 spec->multiout.dac_nids[i]);
10786 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10788 struct alc_spec *spec = codec->spec;
10789 hda_nid_t pin, dac;
10790 int i;
10792 if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) {
10793 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10794 pin = spec->autocfg.hp_pins[i];
10795 if (!pin)
10796 break;
10797 dac = spec->multiout.hp_nid;
10798 if (!dac)
10799 dac = spec->multiout.dac_nids[0]; /* to front */
10800 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10804 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) {
10805 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10806 pin = spec->autocfg.speaker_pins[i];
10807 if (!pin)
10808 break;
10809 dac = spec->multiout.extra_out_nid[0];
10810 if (!dac)
10811 dac = spec->multiout.dac_nids[0]; /* to front */
10812 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10817 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10819 struct alc_spec *spec = codec->spec;
10820 struct auto_pin_cfg *cfg = &spec->autocfg;
10821 int i;
10823 for (i = 0; i < cfg->num_inputs; i++) {
10824 hda_nid_t nid = cfg->inputs[i].pin;
10825 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10826 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10827 snd_hda_codec_write(codec, nid, 0,
10828 AC_VERB_SET_AMP_GAIN_MUTE,
10829 AMP_OUT_MUTE);
10833 static void alc882_auto_init_input_src(struct hda_codec *codec)
10835 struct alc_spec *spec = codec->spec;
10836 int c;
10838 for (c = 0; c < spec->num_adc_nids; c++) {
10839 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10840 hda_nid_t nid = spec->capsrc_nids[c];
10841 unsigned int mux_idx;
10842 const struct hda_input_mux *imux;
10843 int conns, mute, idx, item;
10845 conns = snd_hda_get_connections(codec, nid, conn_list,
10846 ARRAY_SIZE(conn_list));
10847 if (conns < 0)
10848 continue;
10849 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10850 imux = &spec->input_mux[mux_idx];
10851 if (!imux->num_items && mux_idx > 0)
10852 imux = &spec->input_mux[0];
10853 for (idx = 0; idx < conns; idx++) {
10854 /* if the current connection is the selected one,
10855 * unmute it as default - otherwise mute it
10857 mute = AMP_IN_MUTE(idx);
10858 for (item = 0; item < imux->num_items; item++) {
10859 if (imux->items[item].index == idx) {
10860 if (spec->cur_mux[c] == item)
10861 mute = AMP_IN_UNMUTE(idx);
10862 break;
10865 /* check if we have a selector or mixer
10866 * we could check for the widget type instead, but
10867 * just check for Amp-In presence (in case of mixer
10868 * without amp-in there is something wrong, this
10869 * function shouldn't be used or capsrc nid is wrong)
10871 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10872 snd_hda_codec_write(codec, nid, 0,
10873 AC_VERB_SET_AMP_GAIN_MUTE,
10874 mute);
10875 else if (mute != AMP_IN_MUTE(idx))
10876 snd_hda_codec_write(codec, nid, 0,
10877 AC_VERB_SET_CONNECT_SEL,
10878 idx);
10883 /* add mic boosts if needed */
10884 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10886 struct alc_spec *spec = codec->spec;
10887 struct auto_pin_cfg *cfg = &spec->autocfg;
10888 int i, err;
10889 int type_idx = 0;
10890 hda_nid_t nid;
10891 const char *prev_label = NULL;
10893 for (i = 0; i < cfg->num_inputs; i++) {
10894 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10895 break;
10896 nid = cfg->inputs[i].pin;
10897 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10898 const char *label;
10899 char boost_label[32];
10901 label = hda_get_autocfg_input_label(codec, cfg, i);
10902 if (prev_label && !strcmp(label, prev_label))
10903 type_idx++;
10904 else
10905 type_idx = 0;
10906 prev_label = label;
10908 snprintf(boost_label, sizeof(boost_label),
10909 "%s Boost Volume", label);
10910 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10911 boost_label, type_idx,
10912 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10913 if (err < 0)
10914 return err;
10917 return 0;
10920 /* almost identical with ALC880 parser... */
10921 static int alc882_parse_auto_config(struct hda_codec *codec)
10923 struct alc_spec *spec = codec->spec;
10924 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10925 int err;
10927 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10928 alc882_ignore);
10929 if (err < 0)
10930 return err;
10931 if (!spec->autocfg.line_outs)
10932 return 0; /* can't find valid BIOS pin config */
10934 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10935 if (err < 0)
10936 return err;
10937 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10938 if (err < 0)
10939 return err;
10940 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10941 "Headphone");
10942 if (err < 0)
10943 return err;
10944 err = alc880_auto_create_extra_out(spec,
10945 spec->autocfg.speaker_pins[0],
10946 "Speaker");
10947 if (err < 0)
10948 return err;
10949 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10950 if (err < 0)
10951 return err;
10953 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10955 alc_auto_parse_digital(codec);
10957 if (spec->kctls.list)
10958 add_mixer(spec, spec->kctls.list);
10960 add_verb(spec, alc883_auto_init_verbs);
10961 /* if ADC 0x07 is available, initialize it, too */
10962 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10963 add_verb(spec, alc882_adc1_init_verbs);
10965 spec->num_mux_defs = 1;
10966 spec->input_mux = &spec->private_imux[0];
10968 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10970 err = alc_auto_add_mic_boost(codec);
10971 if (err < 0)
10972 return err;
10974 return 1; /* config found */
10977 /* additional initialization for auto-configuration model */
10978 static void alc882_auto_init(struct hda_codec *codec)
10980 struct alc_spec *spec = codec->spec;
10981 alc882_auto_init_multi_out(codec);
10982 alc882_auto_init_hp_out(codec);
10983 alc882_auto_init_analog_input(codec);
10984 alc882_auto_init_input_src(codec);
10985 alc_auto_init_digital(codec);
10986 if (spec->unsol_event)
10987 alc_inithook(codec);
10990 static int patch_alc882(struct hda_codec *codec)
10992 struct alc_spec *spec;
10993 int err, board_config;
10995 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10996 if (spec == NULL)
10997 return -ENOMEM;
10999 codec->spec = spec;
11001 switch (codec->vendor_id) {
11002 case 0x10ec0882:
11003 case 0x10ec0885:
11004 break;
11005 default:
11006 /* ALC883 and variants */
11007 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11008 break;
11011 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
11012 alc882_models,
11013 alc882_cfg_tbl);
11015 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
11016 board_config = snd_hda_check_board_codec_sid_config(codec,
11017 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
11019 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
11020 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11021 codec->chip_name);
11022 board_config = ALC882_AUTO;
11025 if (board_config == ALC882_AUTO) {
11026 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11027 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11030 alc_auto_parse_customize_define(codec);
11032 if (board_config == ALC882_AUTO) {
11033 /* automatic parse from the BIOS config */
11034 err = alc882_parse_auto_config(codec);
11035 if (err < 0) {
11036 alc_free(codec);
11037 return err;
11038 } else if (!err) {
11039 printk(KERN_INFO
11040 "hda_codec: Cannot set up configuration "
11041 "from BIOS. Using base mode...\n");
11042 board_config = ALC882_3ST_DIG;
11046 if (has_cdefine_beep(codec)) {
11047 err = snd_hda_attach_beep_device(codec, 0x1);
11048 if (err < 0) {
11049 alc_free(codec);
11050 return err;
11054 if (board_config != ALC882_AUTO)
11055 setup_preset(codec, &alc882_presets[board_config]);
11057 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11058 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11059 /* FIXME: setup DAC5 */
11060 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11061 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11063 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11064 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11066 if (!spec->adc_nids && spec->input_mux) {
11067 int i, j;
11068 spec->num_adc_nids = 0;
11069 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11070 const struct hda_input_mux *imux = spec->input_mux;
11071 hda_nid_t cap;
11072 hda_nid_t items[16];
11073 hda_nid_t nid = alc882_adc_nids[i];
11074 unsigned int wcap = get_wcaps(codec, nid);
11075 /* get type */
11076 wcap = get_wcaps_type(wcap);
11077 if (wcap != AC_WID_AUD_IN)
11078 continue;
11079 spec->private_adc_nids[spec->num_adc_nids] = nid;
11080 err = snd_hda_get_connections(codec, nid, &cap, 1);
11081 if (err < 0)
11082 continue;
11083 err = snd_hda_get_connections(codec, cap, items,
11084 ARRAY_SIZE(items));
11085 if (err < 0)
11086 continue;
11087 for (j = 0; j < imux->num_items; j++)
11088 if (imux->items[j].index >= err)
11089 break;
11090 if (j < imux->num_items)
11091 continue;
11092 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11093 spec->num_adc_nids++;
11095 spec->adc_nids = spec->private_adc_nids;
11096 spec->capsrc_nids = spec->private_capsrc_nids;
11099 set_capture_mixer(codec);
11101 if (has_cdefine_beep(codec))
11102 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11104 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11106 spec->vmaster_nid = 0x0c;
11108 codec->patch_ops = alc_patch_ops;
11109 if (board_config == ALC882_AUTO)
11110 spec->init_hook = alc882_auto_init;
11112 alc_init_jacks(codec);
11113 #ifdef CONFIG_SND_HDA_POWER_SAVE
11114 if (!spec->loopback.amplist)
11115 spec->loopback.amplist = alc882_loopbacks;
11116 #endif
11118 return 0;
11123 * ALC262 support
11126 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11127 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11129 #define alc262_dac_nids alc260_dac_nids
11130 #define alc262_adc_nids alc882_adc_nids
11131 #define alc262_adc_nids_alt alc882_adc_nids_alt
11132 #define alc262_capsrc_nids alc882_capsrc_nids
11133 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11135 #define alc262_modes alc260_modes
11136 #define alc262_capture_source alc882_capture_source
11138 static hda_nid_t alc262_dmic_adc_nids[1] = {
11139 /* ADC0 */
11140 0x09
11143 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11145 static struct snd_kcontrol_new alc262_base_mixer[] = {
11146 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11147 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11148 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11149 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11150 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11151 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11153 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11154 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11155 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11156 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11157 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11158 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11159 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11160 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11161 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11162 { } /* end */
11165 /* update HP, line and mono-out pins according to the master switch */
11166 static void alc262_hp_master_update(struct hda_codec *codec)
11168 struct alc_spec *spec = codec->spec;
11169 int val = spec->master_sw;
11171 /* HP & line-out */
11172 snd_hda_codec_write_cache(codec, 0x1b, 0,
11173 AC_VERB_SET_PIN_WIDGET_CONTROL,
11174 val ? PIN_HP : 0);
11175 snd_hda_codec_write_cache(codec, 0x15, 0,
11176 AC_VERB_SET_PIN_WIDGET_CONTROL,
11177 val ? PIN_HP : 0);
11178 /* mono (speaker) depending on the HP jack sense */
11179 val = val && !spec->jack_present;
11180 snd_hda_codec_write_cache(codec, 0x16, 0,
11181 AC_VERB_SET_PIN_WIDGET_CONTROL,
11182 val ? PIN_OUT : 0);
11185 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11187 struct alc_spec *spec = codec->spec;
11189 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11190 alc262_hp_master_update(codec);
11193 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11195 if ((res >> 26) != ALC880_HP_EVENT)
11196 return;
11197 alc262_hp_bpc_automute(codec);
11200 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11202 struct alc_spec *spec = codec->spec;
11204 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11205 alc262_hp_master_update(codec);
11208 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11209 unsigned int res)
11211 if ((res >> 26) != ALC880_HP_EVENT)
11212 return;
11213 alc262_hp_wildwest_automute(codec);
11216 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11218 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11219 struct snd_ctl_elem_value *ucontrol)
11221 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11222 struct alc_spec *spec = codec->spec;
11223 int val = !!*ucontrol->value.integer.value;
11225 if (val == spec->master_sw)
11226 return 0;
11227 spec->master_sw = val;
11228 alc262_hp_master_update(codec);
11229 return 1;
11232 #define ALC262_HP_MASTER_SWITCH \
11234 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11235 .name = "Master Playback Switch", \
11236 .info = snd_ctl_boolean_mono_info, \
11237 .get = alc262_hp_master_sw_get, \
11238 .put = alc262_hp_master_sw_put, \
11239 }, \
11241 .iface = NID_MAPPING, \
11242 .name = "Master Playback Switch", \
11243 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11247 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11248 ALC262_HP_MASTER_SWITCH,
11249 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11250 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11251 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11252 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11253 HDA_OUTPUT),
11254 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11255 HDA_OUTPUT),
11256 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11257 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11258 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11259 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11260 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11261 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11262 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11263 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11264 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11265 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11266 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11267 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11268 { } /* end */
11271 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11272 ALC262_HP_MASTER_SWITCH,
11273 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11274 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11275 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11276 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11277 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11278 HDA_OUTPUT),
11279 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11280 HDA_OUTPUT),
11281 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11282 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11283 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11284 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11285 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11286 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11287 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11288 { } /* end */
11291 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11292 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11293 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11294 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11295 { } /* end */
11298 /* mute/unmute internal speaker according to the hp jack and mute state */
11299 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11301 struct alc_spec *spec = codec->spec;
11303 spec->autocfg.hp_pins[0] = 0x15;
11304 spec->autocfg.speaker_pins[0] = 0x14;
11307 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11308 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11309 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11310 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11311 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11312 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11313 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11314 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11315 { } /* end */
11318 static struct hda_verb alc262_hp_t5735_verbs[] = {
11319 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11320 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11322 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11326 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11327 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11328 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11329 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11330 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11331 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11332 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11333 { } /* end */
11336 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11337 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11338 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11339 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11340 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11341 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11342 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11343 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11344 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11346 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11350 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11351 .num_items = 1,
11352 .items = {
11353 { "Line", 0x1 },
11357 /* bind hp and internal speaker mute (with plug check) as master switch */
11358 static void alc262_hippo_master_update(struct hda_codec *codec)
11360 struct alc_spec *spec = codec->spec;
11361 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11362 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11363 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11364 unsigned int mute;
11366 /* HP */
11367 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11368 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11369 HDA_AMP_MUTE, mute);
11370 /* mute internal speaker per jack sense */
11371 if (spec->jack_present)
11372 mute = HDA_AMP_MUTE;
11373 if (line_nid)
11374 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11375 HDA_AMP_MUTE, mute);
11376 if (speaker_nid && speaker_nid != line_nid)
11377 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11378 HDA_AMP_MUTE, mute);
11381 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11383 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11384 struct snd_ctl_elem_value *ucontrol)
11386 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11387 struct alc_spec *spec = codec->spec;
11388 int val = !!*ucontrol->value.integer.value;
11390 if (val == spec->master_sw)
11391 return 0;
11392 spec->master_sw = val;
11393 alc262_hippo_master_update(codec);
11394 return 1;
11397 #define ALC262_HIPPO_MASTER_SWITCH \
11399 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11400 .name = "Master Playback Switch", \
11401 .info = snd_ctl_boolean_mono_info, \
11402 .get = alc262_hippo_master_sw_get, \
11403 .put = alc262_hippo_master_sw_put, \
11404 }, \
11406 .iface = NID_MAPPING, \
11407 .name = "Master Playback Switch", \
11408 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11409 (SUBDEV_SPEAKER(0) << 16), \
11412 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11413 ALC262_HIPPO_MASTER_SWITCH,
11414 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11415 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11416 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11417 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11418 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11419 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11420 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11421 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11422 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11423 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11424 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11425 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11426 { } /* end */
11429 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11430 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11431 ALC262_HIPPO_MASTER_SWITCH,
11432 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11433 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11434 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11435 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11436 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11437 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11438 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11439 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11440 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11441 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11442 { } /* end */
11445 /* mute/unmute internal speaker according to the hp jack and mute state */
11446 static void alc262_hippo_automute(struct hda_codec *codec)
11448 struct alc_spec *spec = codec->spec;
11449 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11451 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11452 alc262_hippo_master_update(codec);
11455 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11457 if ((res >> 26) != ALC880_HP_EVENT)
11458 return;
11459 alc262_hippo_automute(codec);
11462 static void alc262_hippo_setup(struct hda_codec *codec)
11464 struct alc_spec *spec = codec->spec;
11466 spec->autocfg.hp_pins[0] = 0x15;
11467 spec->autocfg.speaker_pins[0] = 0x14;
11470 static void alc262_hippo1_setup(struct hda_codec *codec)
11472 struct alc_spec *spec = codec->spec;
11474 spec->autocfg.hp_pins[0] = 0x1b;
11475 spec->autocfg.speaker_pins[0] = 0x14;
11479 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11480 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11481 ALC262_HIPPO_MASTER_SWITCH,
11482 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11483 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11484 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11485 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11486 { } /* end */
11489 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11490 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11491 ALC262_HIPPO_MASTER_SWITCH,
11492 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11493 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11494 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11495 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11496 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11497 { } /* end */
11500 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11501 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11502 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11503 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11504 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11505 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11506 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11507 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11508 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11509 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11510 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11511 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11512 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11513 { } /* end */
11516 static struct hda_verb alc262_tyan_verbs[] = {
11517 /* Headphone automute */
11518 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11519 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11520 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11522 /* P11 AUX_IN, white 4-pin connector */
11523 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11524 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11525 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11526 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11531 /* unsolicited event for HP jack sensing */
11532 static void alc262_tyan_setup(struct hda_codec *codec)
11534 struct alc_spec *spec = codec->spec;
11536 spec->autocfg.hp_pins[0] = 0x1b;
11537 spec->autocfg.speaker_pins[0] = 0x15;
11541 #define alc262_capture_mixer alc882_capture_mixer
11542 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11545 * generic initialization of ADC, input mixers and output mixers
11547 static struct hda_verb alc262_init_verbs[] = {
11549 * Unmute ADC0-2 and set the default input to mic-in
11551 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11553 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11554 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11555 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11556 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11558 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11559 * mixer widget
11560 * Note: PASD motherboards uses the Line In 2 as the input for
11561 * front panel mic (mic 2)
11563 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11564 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11565 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11566 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11567 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11571 * Set up output mixers (0x0c - 0x0e)
11573 /* set vol=0 to output mixers */
11574 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11575 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11576 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11577 /* set up input amps for analog loopback */
11578 /* Amp Indices: DAC = 0, mixer = 1 */
11579 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11581 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11582 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11583 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11584 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11586 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11587 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11588 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11589 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11590 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11591 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11593 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11594 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11595 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11596 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11597 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11599 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11600 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11602 /* FIXME: use matrix-type input source selection */
11603 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11604 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11605 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11606 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11607 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11608 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11609 /* Input mixer2 */
11610 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11611 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11612 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11613 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11614 /* Input mixer3 */
11615 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11616 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11623 static struct hda_verb alc262_eapd_verbs[] = {
11624 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11625 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11629 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11630 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11631 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11632 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11634 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11635 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11639 static struct hda_verb alc262_sony_unsol_verbs[] = {
11640 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11641 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11642 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11644 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11645 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11649 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11650 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11651 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11652 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11653 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11654 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11655 { } /* end */
11658 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11659 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11660 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11661 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11662 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11663 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11664 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11665 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11666 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11670 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11672 struct alc_spec *spec = codec->spec;
11674 spec->autocfg.hp_pins[0] = 0x15;
11675 spec->autocfg.speaker_pins[0] = 0x14;
11676 spec->ext_mic.pin = 0x18;
11677 spec->ext_mic.mux_idx = 0;
11678 spec->int_mic.pin = 0x12;
11679 spec->int_mic.mux_idx = 9;
11680 spec->auto_mic = 1;
11684 * nec model
11685 * 0x15 = headphone
11686 * 0x16 = internal speaker
11687 * 0x18 = external mic
11690 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11691 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11692 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11694 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11695 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11696 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11698 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11699 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11700 { } /* end */
11703 static struct hda_verb alc262_nec_verbs[] = {
11704 /* Unmute Speaker */
11705 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11707 /* Headphone */
11708 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11709 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11711 /* External mic to headphone */
11712 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11713 /* External mic to speaker */
11714 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11719 * fujitsu model
11720 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11721 * 0x1b = port replicator headphone out
11724 #define ALC_HP_EVENT 0x37
11726 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11727 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11729 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11730 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11734 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11735 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11736 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11740 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11741 /* Front Mic pin: input vref at 50% */
11742 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11747 static struct hda_input_mux alc262_fujitsu_capture_source = {
11748 .num_items = 3,
11749 .items = {
11750 { "Mic", 0x0 },
11751 { "Internal Mic", 0x1 },
11752 { "CD", 0x4 },
11756 static struct hda_input_mux alc262_HP_capture_source = {
11757 .num_items = 5,
11758 .items = {
11759 { "Mic", 0x0 },
11760 { "Front Mic", 0x1 },
11761 { "Line", 0x2 },
11762 { "CD", 0x4 },
11763 { "AUX IN", 0x6 },
11767 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11768 .num_items = 4,
11769 .items = {
11770 { "Mic", 0x0 },
11771 { "Front Mic", 0x2 },
11772 { "Line", 0x1 },
11773 { "CD", 0x4 },
11777 /* mute/unmute internal speaker according to the hp jacks and mute state */
11778 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11780 struct alc_spec *spec = codec->spec;
11781 unsigned int mute;
11783 if (force || !spec->sense_updated) {
11784 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11785 snd_hda_jack_detect(codec, 0x1b);
11786 spec->sense_updated = 1;
11788 /* unmute internal speaker only if both HPs are unplugged and
11789 * master switch is on
11791 if (spec->jack_present)
11792 mute = HDA_AMP_MUTE;
11793 else
11794 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11795 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11796 HDA_AMP_MUTE, mute);
11799 /* unsolicited event for HP jack sensing */
11800 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11801 unsigned int res)
11803 if ((res >> 26) != ALC_HP_EVENT)
11804 return;
11805 alc262_fujitsu_automute(codec, 1);
11808 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11810 alc262_fujitsu_automute(codec, 1);
11813 /* bind volumes of both NID 0x0c and 0x0d */
11814 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11815 .ops = &snd_hda_bind_vol,
11816 .values = {
11817 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11818 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11823 /* mute/unmute internal speaker according to the hp jack and mute state */
11824 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11826 struct alc_spec *spec = codec->spec;
11827 unsigned int mute;
11829 if (force || !spec->sense_updated) {
11830 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11831 spec->sense_updated = 1;
11833 if (spec->jack_present) {
11834 /* mute internal speaker */
11835 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11836 HDA_AMP_MUTE, HDA_AMP_MUTE);
11837 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11838 HDA_AMP_MUTE, HDA_AMP_MUTE);
11839 } else {
11840 /* unmute internal speaker if necessary */
11841 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11842 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11843 HDA_AMP_MUTE, mute);
11844 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11845 HDA_AMP_MUTE, mute);
11849 /* unsolicited event for HP jack sensing */
11850 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11851 unsigned int res)
11853 if ((res >> 26) != ALC_HP_EVENT)
11854 return;
11855 alc262_lenovo_3000_automute(codec, 1);
11858 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11859 int dir, int idx, long *valp)
11861 int i, change = 0;
11863 for (i = 0; i < 2; i++, valp++)
11864 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11865 HDA_AMP_MUTE,
11866 *valp ? 0 : HDA_AMP_MUTE);
11867 return change;
11870 /* bind hp and internal speaker mute (with plug check) */
11871 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11872 struct snd_ctl_elem_value *ucontrol)
11874 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11875 long *valp = ucontrol->value.integer.value;
11876 int change;
11878 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11879 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11880 if (change)
11881 alc262_fujitsu_automute(codec, 0);
11882 return change;
11885 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11886 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11888 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11889 .name = "Master Playback Switch",
11890 .subdevice = HDA_SUBDEV_AMP_FLAG,
11891 .info = snd_hda_mixer_amp_switch_info,
11892 .get = snd_hda_mixer_amp_switch_get,
11893 .put = alc262_fujitsu_master_sw_put,
11894 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11897 .iface = NID_MAPPING,
11898 .name = "Master Playback Switch",
11899 .private_value = 0x1b,
11901 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11902 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11903 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11904 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11905 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11906 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11907 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11908 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11909 { } /* end */
11912 /* bind hp and internal speaker mute (with plug check) */
11913 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11914 struct snd_ctl_elem_value *ucontrol)
11916 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11917 long *valp = ucontrol->value.integer.value;
11918 int change;
11920 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11921 if (change)
11922 alc262_lenovo_3000_automute(codec, 0);
11923 return change;
11926 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11927 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11929 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11930 .name = "Master Playback Switch",
11931 .subdevice = HDA_SUBDEV_AMP_FLAG,
11932 .info = snd_hda_mixer_amp_switch_info,
11933 .get = snd_hda_mixer_amp_switch_get,
11934 .put = alc262_lenovo_3000_master_sw_put,
11935 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11937 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11938 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11939 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11940 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11941 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11942 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11943 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11944 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11945 { } /* end */
11948 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11949 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11950 ALC262_HIPPO_MASTER_SWITCH,
11951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11952 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11953 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11954 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11955 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11956 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11957 { } /* end */
11960 /* additional init verbs for Benq laptops */
11961 static struct hda_verb alc262_EAPD_verbs[] = {
11962 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11963 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11967 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11968 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11969 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11971 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11972 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11976 /* Samsung Q1 Ultra Vista model setup */
11977 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11978 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11979 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11981 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11982 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
11983 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
11984 { } /* end */
11987 static struct hda_verb alc262_ultra_verbs[] = {
11988 /* output mixer */
11989 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11990 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11991 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11992 /* speaker */
11993 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11994 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11995 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11996 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11997 /* HP */
11998 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11999 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12000 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12001 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12002 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12003 /* internal mic */
12004 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12005 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12006 /* ADC, choose mic */
12007 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12008 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12009 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12010 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12011 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12012 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12013 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12014 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12015 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12016 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
12020 /* mute/unmute internal speaker according to the hp jack and mute state */
12021 static void alc262_ultra_automute(struct hda_codec *codec)
12023 struct alc_spec *spec = codec->spec;
12024 unsigned int mute;
12026 mute = 0;
12027 /* auto-mute only when HP is used as HP */
12028 if (!spec->cur_mux[0]) {
12029 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
12030 if (spec->jack_present)
12031 mute = HDA_AMP_MUTE;
12033 /* mute/unmute internal speaker */
12034 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12035 HDA_AMP_MUTE, mute);
12036 /* mute/unmute HP */
12037 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12038 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
12041 /* unsolicited event for HP jack sensing */
12042 static void alc262_ultra_unsol_event(struct hda_codec *codec,
12043 unsigned int res)
12045 if ((res >> 26) != ALC880_HP_EVENT)
12046 return;
12047 alc262_ultra_automute(codec);
12050 static struct hda_input_mux alc262_ultra_capture_source = {
12051 .num_items = 2,
12052 .items = {
12053 { "Mic", 0x1 },
12054 { "Headphone", 0x7 },
12058 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12059 struct snd_ctl_elem_value *ucontrol)
12061 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12062 struct alc_spec *spec = codec->spec;
12063 int ret;
12065 ret = alc_mux_enum_put(kcontrol, ucontrol);
12066 if (!ret)
12067 return 0;
12068 /* reprogram the HP pin as mic or HP according to the input source */
12069 snd_hda_codec_write_cache(codec, 0x15, 0,
12070 AC_VERB_SET_PIN_WIDGET_CONTROL,
12071 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12072 alc262_ultra_automute(codec); /* mute/unmute HP */
12073 return ret;
12076 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12077 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12078 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12080 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12081 .name = "Capture Source",
12082 .info = alc_mux_enum_info,
12083 .get = alc_mux_enum_get,
12084 .put = alc262_ultra_mux_enum_put,
12087 .iface = NID_MAPPING,
12088 .name = "Capture Source",
12089 .private_value = 0x15,
12091 { } /* end */
12094 /* We use two mixers depending on the output pin; 0x16 is a mono output
12095 * and thus it's bound with a different mixer.
12096 * This function returns which mixer amp should be used.
12098 static int alc262_check_volbit(hda_nid_t nid)
12100 if (!nid)
12101 return 0;
12102 else if (nid == 0x16)
12103 return 2;
12104 else
12105 return 1;
12108 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12109 const char *pfx, int *vbits, int idx)
12111 unsigned long val;
12112 int vbit;
12114 vbit = alc262_check_volbit(nid);
12115 if (!vbit)
12116 return 0;
12117 if (*vbits & vbit) /* a volume control for this mixer already there */
12118 return 0;
12119 *vbits |= vbit;
12120 if (vbit == 2)
12121 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12122 else
12123 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12124 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12127 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12128 const char *pfx, int idx)
12130 unsigned long val;
12132 if (!nid)
12133 return 0;
12134 if (nid == 0x16)
12135 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12136 else
12137 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12138 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12141 /* add playback controls from the parsed DAC table */
12142 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12143 const struct auto_pin_cfg *cfg)
12145 const char *pfx;
12146 int vbits;
12147 int i, err;
12149 spec->multiout.num_dacs = 1; /* only use one dac */
12150 spec->multiout.dac_nids = spec->private_dac_nids;
12151 spec->multiout.dac_nids[0] = 2;
12153 pfx = alc_get_line_out_pfx(cfg, true);
12154 if (!pfx)
12155 pfx = "Front";
12156 for (i = 0; i < 2; i++) {
12157 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12158 if (err < 0)
12159 return err;
12160 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12161 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12162 "Speaker", i);
12163 if (err < 0)
12164 return err;
12166 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12167 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12168 "Headphone", i);
12169 if (err < 0)
12170 return err;
12174 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12175 alc262_check_volbit(cfg->speaker_pins[0]) |
12176 alc262_check_volbit(cfg->hp_pins[0]);
12177 if (vbits == 1 || vbits == 2)
12178 pfx = "Master"; /* only one mixer is used */
12179 vbits = 0;
12180 for (i = 0; i < 2; i++) {
12181 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12182 &vbits, i);
12183 if (err < 0)
12184 return err;
12185 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12186 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12187 "Speaker", &vbits, i);
12188 if (err < 0)
12189 return err;
12191 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12192 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12193 "Headphone", &vbits, i);
12194 if (err < 0)
12195 return err;
12198 return 0;
12201 #define alc262_auto_create_input_ctls \
12202 alc882_auto_create_input_ctls
12205 * generic initialization of ADC, input mixers and output mixers
12207 static struct hda_verb alc262_volume_init_verbs[] = {
12209 * Unmute ADC0-2 and set the default input to mic-in
12211 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12212 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12213 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12214 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12215 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12216 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12218 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12219 * mixer widget
12220 * Note: PASD motherboards uses the Line In 2 as the input for
12221 * front panel mic (mic 2)
12223 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12224 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12225 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12226 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12227 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12228 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12231 * Set up output mixers (0x0c - 0x0f)
12233 /* set vol=0 to output mixers */
12234 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12235 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12236 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12238 /* set up input amps for analog loopback */
12239 /* Amp Indices: DAC = 0, mixer = 1 */
12240 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12241 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12242 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12243 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12245 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12247 /* FIXME: use matrix-type input source selection */
12248 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12249 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12250 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12251 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12252 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12253 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12254 /* Input mixer2 */
12255 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12256 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12257 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12258 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12259 /* Input mixer3 */
12260 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12261 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12268 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12270 * Unmute ADC0-2 and set the default input to mic-in
12272 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12274 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12275 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12276 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12277 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12279 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12280 * mixer widget
12281 * Note: PASD motherboards uses the Line In 2 as the input for
12282 * front panel mic (mic 2)
12284 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12291 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12294 * Set up output mixers (0x0c - 0x0e)
12296 /* set vol=0 to output mixers */
12297 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12298 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12301 /* set up input amps for analog loopback */
12302 /* Amp Indices: DAC = 0, mixer = 1 */
12303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12304 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12305 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12306 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12307 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12308 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12310 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12311 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12312 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12314 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12315 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12317 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12318 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12320 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12321 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12322 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12323 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12324 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12326 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12327 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12328 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12329 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12330 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12331 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12334 /* FIXME: use matrix-type input source selection */
12335 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12336 /* Input mixer1: only unmute Mic */
12337 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12339 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12340 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12341 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12342 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12343 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12344 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12345 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12346 /* Input mixer2 */
12347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12350 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12351 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12352 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12353 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12354 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12355 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12356 /* Input mixer3 */
12357 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12358 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12359 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12360 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12361 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12362 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12363 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12367 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12372 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12374 * Unmute ADC0-2 and set the default input to mic-in
12376 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12377 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12378 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12379 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12380 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12381 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12383 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12384 * mixer widget
12385 * Note: PASD motherboards uses the Line In 2 as the input for front
12386 * panel mic (mic 2)
12388 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12389 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12390 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12391 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12392 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12393 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12394 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12395 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12396 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12398 * Set up output mixers (0x0c - 0x0e)
12400 /* set vol=0 to output mixers */
12401 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12402 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12403 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12405 /* set up input amps for analog loopback */
12406 /* Amp Indices: DAC = 0, mixer = 1 */
12407 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12408 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12409 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12410 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12411 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12412 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12415 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12416 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12417 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12418 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12419 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12420 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12421 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12423 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12424 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12426 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12427 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12429 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12430 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12431 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12432 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12433 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12434 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12436 /* FIXME: use matrix-type input source selection */
12437 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12438 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12439 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12440 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12441 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12442 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12443 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12444 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12445 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12446 /* Input mixer2 */
12447 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12448 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12449 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12450 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12451 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12452 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12453 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12454 /* Input mixer3 */
12455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12460 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12461 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12463 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12468 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12470 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12471 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12472 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12474 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12475 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12476 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12477 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12479 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12480 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12481 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12486 * Pin config fixes
12488 enum {
12489 PINFIX_FSC_H270,
12492 static const struct alc_fixup alc262_fixups[] = {
12493 [PINFIX_FSC_H270] = {
12494 .type = ALC_FIXUP_PINS,
12495 .v.pins = (const struct alc_pincfg[]) {
12496 { 0x14, 0x99130110 }, /* speaker */
12497 { 0x15, 0x0221142f }, /* front HP */
12498 { 0x1b, 0x0121141f }, /* rear HP */
12504 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12505 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12510 #ifdef CONFIG_SND_HDA_POWER_SAVE
12511 #define alc262_loopbacks alc880_loopbacks
12512 #endif
12514 /* pcm configuration: identical with ALC880 */
12515 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12516 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12517 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12518 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12521 * BIOS auto configuration
12523 static int alc262_parse_auto_config(struct hda_codec *codec)
12525 struct alc_spec *spec = codec->spec;
12526 int err;
12527 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12529 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12530 alc262_ignore);
12531 if (err < 0)
12532 return err;
12533 if (!spec->autocfg.line_outs) {
12534 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12535 spec->multiout.max_channels = 2;
12536 spec->no_analog = 1;
12537 goto dig_only;
12539 return 0; /* can't find valid BIOS pin config */
12541 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12542 if (err < 0)
12543 return err;
12544 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12545 if (err < 0)
12546 return err;
12548 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12550 dig_only:
12551 alc_auto_parse_digital(codec);
12553 if (spec->kctls.list)
12554 add_mixer(spec, spec->kctls.list);
12556 add_verb(spec, alc262_volume_init_verbs);
12557 spec->num_mux_defs = 1;
12558 spec->input_mux = &spec->private_imux[0];
12560 err = alc_auto_add_mic_boost(codec);
12561 if (err < 0)
12562 return err;
12564 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12566 return 1;
12569 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12570 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12571 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12572 #define alc262_auto_init_input_src alc882_auto_init_input_src
12575 /* init callback for auto-configuration model -- overriding the default init */
12576 static void alc262_auto_init(struct hda_codec *codec)
12578 struct alc_spec *spec = codec->spec;
12579 alc262_auto_init_multi_out(codec);
12580 alc262_auto_init_hp_out(codec);
12581 alc262_auto_init_analog_input(codec);
12582 alc262_auto_init_input_src(codec);
12583 alc_auto_init_digital(codec);
12584 if (spec->unsol_event)
12585 alc_inithook(codec);
12589 * configuration and preset
12591 static const char * const alc262_models[ALC262_MODEL_LAST] = {
12592 [ALC262_BASIC] = "basic",
12593 [ALC262_HIPPO] = "hippo",
12594 [ALC262_HIPPO_1] = "hippo_1",
12595 [ALC262_FUJITSU] = "fujitsu",
12596 [ALC262_HP_BPC] = "hp-bpc",
12597 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12598 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12599 [ALC262_HP_RP5700] = "hp-rp5700",
12600 [ALC262_BENQ_ED8] = "benq",
12601 [ALC262_BENQ_T31] = "benq-t31",
12602 [ALC262_SONY_ASSAMD] = "sony-assamd",
12603 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12604 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12605 [ALC262_ULTRA] = "ultra",
12606 [ALC262_LENOVO_3000] = "lenovo-3000",
12607 [ALC262_NEC] = "nec",
12608 [ALC262_TYAN] = "tyan",
12609 [ALC262_AUTO] = "auto",
12612 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12613 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12614 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12615 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12616 ALC262_HP_BPC),
12617 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12618 ALC262_HP_BPC),
12619 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12620 ALC262_HP_BPC),
12621 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12622 ALC262_HP_BPC),
12623 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12624 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12625 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12626 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12627 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12628 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12629 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12630 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12631 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12632 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12633 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12634 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12635 ALC262_HP_TC_T5735),
12636 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12637 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12638 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12639 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12640 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12641 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12642 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12643 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12644 #if 0 /* disable the quirk since model=auto works better in recent versions */
12645 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12646 ALC262_SONY_ASSAMD),
12647 #endif
12648 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12649 ALC262_TOSHIBA_RX1),
12650 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12651 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12652 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12653 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12654 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12655 ALC262_ULTRA),
12656 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12657 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12658 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12659 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12660 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12664 static struct alc_config_preset alc262_presets[] = {
12665 [ALC262_BASIC] = {
12666 .mixers = { alc262_base_mixer },
12667 .init_verbs = { alc262_init_verbs },
12668 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12669 .dac_nids = alc262_dac_nids,
12670 .hp_nid = 0x03,
12671 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12672 .channel_mode = alc262_modes,
12673 .input_mux = &alc262_capture_source,
12675 [ALC262_HIPPO] = {
12676 .mixers = { alc262_hippo_mixer },
12677 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12678 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12679 .dac_nids = alc262_dac_nids,
12680 .hp_nid = 0x03,
12681 .dig_out_nid = ALC262_DIGOUT_NID,
12682 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12683 .channel_mode = alc262_modes,
12684 .input_mux = &alc262_capture_source,
12685 .unsol_event = alc262_hippo_unsol_event,
12686 .setup = alc262_hippo_setup,
12687 .init_hook = alc262_hippo_automute,
12689 [ALC262_HIPPO_1] = {
12690 .mixers = { alc262_hippo1_mixer },
12691 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12692 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12693 .dac_nids = alc262_dac_nids,
12694 .hp_nid = 0x02,
12695 .dig_out_nid = ALC262_DIGOUT_NID,
12696 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12697 .channel_mode = alc262_modes,
12698 .input_mux = &alc262_capture_source,
12699 .unsol_event = alc262_hippo_unsol_event,
12700 .setup = alc262_hippo1_setup,
12701 .init_hook = alc262_hippo_automute,
12703 [ALC262_FUJITSU] = {
12704 .mixers = { alc262_fujitsu_mixer },
12705 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12706 alc262_fujitsu_unsol_verbs },
12707 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12708 .dac_nids = alc262_dac_nids,
12709 .hp_nid = 0x03,
12710 .dig_out_nid = ALC262_DIGOUT_NID,
12711 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12712 .channel_mode = alc262_modes,
12713 .input_mux = &alc262_fujitsu_capture_source,
12714 .unsol_event = alc262_fujitsu_unsol_event,
12715 .init_hook = alc262_fujitsu_init_hook,
12717 [ALC262_HP_BPC] = {
12718 .mixers = { alc262_HP_BPC_mixer },
12719 .init_verbs = { alc262_HP_BPC_init_verbs },
12720 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12721 .dac_nids = alc262_dac_nids,
12722 .hp_nid = 0x03,
12723 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12724 .channel_mode = alc262_modes,
12725 .input_mux = &alc262_HP_capture_source,
12726 .unsol_event = alc262_hp_bpc_unsol_event,
12727 .init_hook = alc262_hp_bpc_automute,
12729 [ALC262_HP_BPC_D7000_WF] = {
12730 .mixers = { alc262_HP_BPC_WildWest_mixer },
12731 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12732 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12733 .dac_nids = alc262_dac_nids,
12734 .hp_nid = 0x03,
12735 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12736 .channel_mode = alc262_modes,
12737 .input_mux = &alc262_HP_D7000_capture_source,
12738 .unsol_event = alc262_hp_wildwest_unsol_event,
12739 .init_hook = alc262_hp_wildwest_automute,
12741 [ALC262_HP_BPC_D7000_WL] = {
12742 .mixers = { alc262_HP_BPC_WildWest_mixer,
12743 alc262_HP_BPC_WildWest_option_mixer },
12744 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12745 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12746 .dac_nids = alc262_dac_nids,
12747 .hp_nid = 0x03,
12748 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12749 .channel_mode = alc262_modes,
12750 .input_mux = &alc262_HP_D7000_capture_source,
12751 .unsol_event = alc262_hp_wildwest_unsol_event,
12752 .init_hook = alc262_hp_wildwest_automute,
12754 [ALC262_HP_TC_T5735] = {
12755 .mixers = { alc262_hp_t5735_mixer },
12756 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12757 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12758 .dac_nids = alc262_dac_nids,
12759 .hp_nid = 0x03,
12760 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12761 .channel_mode = alc262_modes,
12762 .input_mux = &alc262_capture_source,
12763 .unsol_event = alc_sku_unsol_event,
12764 .setup = alc262_hp_t5735_setup,
12765 .init_hook = alc_inithook,
12767 [ALC262_HP_RP5700] = {
12768 .mixers = { alc262_hp_rp5700_mixer },
12769 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12770 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12771 .dac_nids = alc262_dac_nids,
12772 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12773 .channel_mode = alc262_modes,
12774 .input_mux = &alc262_hp_rp5700_capture_source,
12776 [ALC262_BENQ_ED8] = {
12777 .mixers = { alc262_base_mixer },
12778 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12779 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12780 .dac_nids = alc262_dac_nids,
12781 .hp_nid = 0x03,
12782 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12783 .channel_mode = alc262_modes,
12784 .input_mux = &alc262_capture_source,
12786 [ALC262_SONY_ASSAMD] = {
12787 .mixers = { alc262_sony_mixer },
12788 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12789 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12790 .dac_nids = alc262_dac_nids,
12791 .hp_nid = 0x02,
12792 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12793 .channel_mode = alc262_modes,
12794 .input_mux = &alc262_capture_source,
12795 .unsol_event = alc262_hippo_unsol_event,
12796 .setup = alc262_hippo_setup,
12797 .init_hook = alc262_hippo_automute,
12799 [ALC262_BENQ_T31] = {
12800 .mixers = { alc262_benq_t31_mixer },
12801 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12802 alc_hp15_unsol_verbs },
12803 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12804 .dac_nids = alc262_dac_nids,
12805 .hp_nid = 0x03,
12806 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12807 .channel_mode = alc262_modes,
12808 .input_mux = &alc262_capture_source,
12809 .unsol_event = alc262_hippo_unsol_event,
12810 .setup = alc262_hippo_setup,
12811 .init_hook = alc262_hippo_automute,
12813 [ALC262_ULTRA] = {
12814 .mixers = { alc262_ultra_mixer },
12815 .cap_mixer = alc262_ultra_capture_mixer,
12816 .init_verbs = { alc262_ultra_verbs },
12817 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12818 .dac_nids = alc262_dac_nids,
12819 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12820 .channel_mode = alc262_modes,
12821 .input_mux = &alc262_ultra_capture_source,
12822 .adc_nids = alc262_adc_nids, /* ADC0 */
12823 .capsrc_nids = alc262_capsrc_nids,
12824 .num_adc_nids = 1, /* single ADC */
12825 .unsol_event = alc262_ultra_unsol_event,
12826 .init_hook = alc262_ultra_automute,
12828 [ALC262_LENOVO_3000] = {
12829 .mixers = { alc262_lenovo_3000_mixer },
12830 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12831 alc262_lenovo_3000_unsol_verbs,
12832 alc262_lenovo_3000_init_verbs },
12833 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12834 .dac_nids = alc262_dac_nids,
12835 .hp_nid = 0x03,
12836 .dig_out_nid = ALC262_DIGOUT_NID,
12837 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12838 .channel_mode = alc262_modes,
12839 .input_mux = &alc262_fujitsu_capture_source,
12840 .unsol_event = alc262_lenovo_3000_unsol_event,
12842 [ALC262_NEC] = {
12843 .mixers = { alc262_nec_mixer },
12844 .init_verbs = { alc262_nec_verbs },
12845 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12846 .dac_nids = alc262_dac_nids,
12847 .hp_nid = 0x03,
12848 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12849 .channel_mode = alc262_modes,
12850 .input_mux = &alc262_capture_source,
12852 [ALC262_TOSHIBA_S06] = {
12853 .mixers = { alc262_toshiba_s06_mixer },
12854 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12855 alc262_eapd_verbs },
12856 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12857 .capsrc_nids = alc262_dmic_capsrc_nids,
12858 .dac_nids = alc262_dac_nids,
12859 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12860 .num_adc_nids = 1, /* single ADC */
12861 .dig_out_nid = ALC262_DIGOUT_NID,
12862 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12863 .channel_mode = alc262_modes,
12864 .unsol_event = alc_sku_unsol_event,
12865 .setup = alc262_toshiba_s06_setup,
12866 .init_hook = alc_inithook,
12868 [ALC262_TOSHIBA_RX1] = {
12869 .mixers = { alc262_toshiba_rx1_mixer },
12870 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12871 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12872 .dac_nids = alc262_dac_nids,
12873 .hp_nid = 0x03,
12874 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12875 .channel_mode = alc262_modes,
12876 .input_mux = &alc262_capture_source,
12877 .unsol_event = alc262_hippo_unsol_event,
12878 .setup = alc262_hippo_setup,
12879 .init_hook = alc262_hippo_automute,
12881 [ALC262_TYAN] = {
12882 .mixers = { alc262_tyan_mixer },
12883 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12884 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12885 .dac_nids = alc262_dac_nids,
12886 .hp_nid = 0x02,
12887 .dig_out_nid = ALC262_DIGOUT_NID,
12888 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12889 .channel_mode = alc262_modes,
12890 .input_mux = &alc262_capture_source,
12891 .unsol_event = alc_automute_amp_unsol_event,
12892 .setup = alc262_tyan_setup,
12893 .init_hook = alc_automute_amp,
12897 static int patch_alc262(struct hda_codec *codec)
12899 struct alc_spec *spec;
12900 int board_config;
12901 int err;
12903 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12904 if (spec == NULL)
12905 return -ENOMEM;
12907 codec->spec = spec;
12908 #if 0
12909 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12910 * under-run
12913 int tmp;
12914 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12915 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12916 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12917 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12919 #endif
12920 alc_auto_parse_customize_define(codec);
12922 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12924 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12925 alc262_models,
12926 alc262_cfg_tbl);
12928 if (board_config < 0) {
12929 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12930 codec->chip_name);
12931 board_config = ALC262_AUTO;
12934 if (board_config == ALC262_AUTO) {
12935 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
12936 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
12939 if (board_config == ALC262_AUTO) {
12940 /* automatic parse from the BIOS config */
12941 err = alc262_parse_auto_config(codec);
12942 if (err < 0) {
12943 alc_free(codec);
12944 return err;
12945 } else if (!err) {
12946 printk(KERN_INFO
12947 "hda_codec: Cannot set up configuration "
12948 "from BIOS. Using base mode...\n");
12949 board_config = ALC262_BASIC;
12953 if (!spec->no_analog && has_cdefine_beep(codec)) {
12954 err = snd_hda_attach_beep_device(codec, 0x1);
12955 if (err < 0) {
12956 alc_free(codec);
12957 return err;
12961 if (board_config != ALC262_AUTO)
12962 setup_preset(codec, &alc262_presets[board_config]);
12964 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12965 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12967 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12968 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12970 if (!spec->adc_nids && spec->input_mux) {
12971 int i;
12972 /* check whether the digital-mic has to be supported */
12973 for (i = 0; i < spec->input_mux->num_items; i++) {
12974 if (spec->input_mux->items[i].index >= 9)
12975 break;
12977 if (i < spec->input_mux->num_items) {
12978 /* use only ADC0 */
12979 spec->adc_nids = alc262_dmic_adc_nids;
12980 spec->num_adc_nids = 1;
12981 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12982 } else {
12983 /* all analog inputs */
12984 /* check whether NID 0x07 is valid */
12985 unsigned int wcap = get_wcaps(codec, 0x07);
12987 /* get type */
12988 wcap = get_wcaps_type(wcap);
12989 if (wcap != AC_WID_AUD_IN) {
12990 spec->adc_nids = alc262_adc_nids_alt;
12991 spec->num_adc_nids =
12992 ARRAY_SIZE(alc262_adc_nids_alt);
12993 spec->capsrc_nids = alc262_capsrc_nids_alt;
12994 } else {
12995 spec->adc_nids = alc262_adc_nids;
12996 spec->num_adc_nids =
12997 ARRAY_SIZE(alc262_adc_nids);
12998 spec->capsrc_nids = alc262_capsrc_nids;
13002 if (!spec->cap_mixer && !spec->no_analog)
13003 set_capture_mixer(codec);
13004 if (!spec->no_analog && has_cdefine_beep(codec))
13005 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13007 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
13009 spec->vmaster_nid = 0x0c;
13011 codec->patch_ops = alc_patch_ops;
13012 if (board_config == ALC262_AUTO)
13013 spec->init_hook = alc262_auto_init;
13015 alc_init_jacks(codec);
13016 #ifdef CONFIG_SND_HDA_POWER_SAVE
13017 if (!spec->loopback.amplist)
13018 spec->loopback.amplist = alc262_loopbacks;
13019 #endif
13021 return 0;
13025 * ALC268 channel source setting (2 channel)
13027 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13028 #define alc268_modes alc260_modes
13030 static hda_nid_t alc268_dac_nids[2] = {
13031 /* front, hp */
13032 0x02, 0x03
13035 static hda_nid_t alc268_adc_nids[2] = {
13036 /* ADC0-1 */
13037 0x08, 0x07
13040 static hda_nid_t alc268_adc_nids_alt[1] = {
13041 /* ADC0 */
13042 0x08
13045 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13047 static struct snd_kcontrol_new alc268_base_mixer[] = {
13048 /* output mixer control */
13049 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13050 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13051 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13052 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13053 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13054 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13055 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13059 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13060 /* output mixer control */
13061 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13062 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13063 ALC262_HIPPO_MASTER_SWITCH,
13064 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13065 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13066 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13070 /* bind Beep switches of both NID 0x0f and 0x10 */
13071 static struct hda_bind_ctls alc268_bind_beep_sw = {
13072 .ops = &snd_hda_bind_sw,
13073 .values = {
13074 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13075 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13080 static struct snd_kcontrol_new alc268_beep_mixer[] = {
13081 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13082 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13086 static struct hda_verb alc268_eapd_verbs[] = {
13087 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13088 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13092 /* Toshiba specific */
13093 static struct hda_verb alc268_toshiba_verbs[] = {
13094 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13095 { } /* end */
13098 /* Acer specific */
13099 /* bind volumes of both NID 0x02 and 0x03 */
13100 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13101 .ops = &snd_hda_bind_vol,
13102 .values = {
13103 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13104 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13109 /* mute/unmute internal speaker according to the hp jack and mute state */
13110 static void alc268_acer_automute(struct hda_codec *codec, int force)
13112 struct alc_spec *spec = codec->spec;
13113 unsigned int mute;
13115 if (force || !spec->sense_updated) {
13116 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13117 spec->sense_updated = 1;
13119 if (spec->jack_present)
13120 mute = HDA_AMP_MUTE; /* mute internal speaker */
13121 else /* unmute internal speaker if necessary */
13122 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13123 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13124 HDA_AMP_MUTE, mute);
13128 /* bind hp and internal speaker mute (with plug check) */
13129 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13130 struct snd_ctl_elem_value *ucontrol)
13132 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13133 long *valp = ucontrol->value.integer.value;
13134 int change;
13136 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13137 if (change)
13138 alc268_acer_automute(codec, 0);
13139 return change;
13142 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13143 /* output mixer control */
13144 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13146 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13147 .name = "Master Playback Switch",
13148 .subdevice = HDA_SUBDEV_AMP_FLAG,
13149 .info = snd_hda_mixer_amp_switch_info,
13150 .get = snd_hda_mixer_amp_switch_get,
13151 .put = alc268_acer_master_sw_put,
13152 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13154 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13158 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13159 /* output mixer control */
13160 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13162 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13163 .name = "Master Playback Switch",
13164 .subdevice = HDA_SUBDEV_AMP_FLAG,
13165 .info = snd_hda_mixer_amp_switch_info,
13166 .get = snd_hda_mixer_amp_switch_get,
13167 .put = alc268_acer_master_sw_put,
13168 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13170 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13171 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13172 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13176 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13177 /* output mixer control */
13178 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13180 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13181 .name = "Master Playback Switch",
13182 .subdevice = HDA_SUBDEV_AMP_FLAG,
13183 .info = snd_hda_mixer_amp_switch_info,
13184 .get = snd_hda_mixer_amp_switch_get,
13185 .put = alc268_acer_master_sw_put,
13186 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13188 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13189 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13193 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13194 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13195 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13196 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13197 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13198 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13199 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13203 static struct hda_verb alc268_acer_verbs[] = {
13204 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13205 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13207 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13208 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13209 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13210 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13214 /* unsolicited event for HP jack sensing */
13215 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13216 #define alc268_toshiba_setup alc262_hippo_setup
13217 #define alc268_toshiba_automute alc262_hippo_automute
13219 static void alc268_acer_unsol_event(struct hda_codec *codec,
13220 unsigned int res)
13222 if ((res >> 26) != ALC880_HP_EVENT)
13223 return;
13224 alc268_acer_automute(codec, 1);
13227 static void alc268_acer_init_hook(struct hda_codec *codec)
13229 alc268_acer_automute(codec, 1);
13232 /* toggle speaker-output according to the hp-jack state */
13233 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13235 unsigned int present;
13236 unsigned char bits;
13238 present = snd_hda_jack_detect(codec, 0x15);
13239 bits = present ? HDA_AMP_MUTE : 0;
13240 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13241 HDA_AMP_MUTE, bits);
13242 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13243 HDA_AMP_MUTE, bits);
13246 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13247 unsigned int res)
13249 switch (res >> 26) {
13250 case ALC880_HP_EVENT:
13251 alc268_aspire_one_speaker_automute(codec);
13252 break;
13253 case ALC880_MIC_EVENT:
13254 alc_mic_automute(codec);
13255 break;
13259 static void alc268_acer_lc_setup(struct hda_codec *codec)
13261 struct alc_spec *spec = codec->spec;
13262 spec->ext_mic.pin = 0x18;
13263 spec->ext_mic.mux_idx = 0;
13264 spec->int_mic.pin = 0x12;
13265 spec->int_mic.mux_idx = 6;
13266 spec->auto_mic = 1;
13269 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13271 alc268_aspire_one_speaker_automute(codec);
13272 alc_mic_automute(codec);
13275 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13276 /* output mixer control */
13277 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13278 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13279 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13280 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13281 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13282 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13286 static struct hda_verb alc268_dell_verbs[] = {
13287 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13288 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13289 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13290 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13294 /* mute/unmute internal speaker according to the hp jack and mute state */
13295 static void alc268_dell_setup(struct hda_codec *codec)
13297 struct alc_spec *spec = codec->spec;
13299 spec->autocfg.hp_pins[0] = 0x15;
13300 spec->autocfg.speaker_pins[0] = 0x14;
13301 spec->ext_mic.pin = 0x18;
13302 spec->ext_mic.mux_idx = 0;
13303 spec->int_mic.pin = 0x19;
13304 spec->int_mic.mux_idx = 1;
13305 spec->auto_mic = 1;
13308 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13309 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13310 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13311 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13312 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13313 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13314 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13315 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13316 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13320 static struct hda_verb alc267_quanta_il1_verbs[] = {
13321 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13322 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13326 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13328 struct alc_spec *spec = codec->spec;
13329 spec->autocfg.hp_pins[0] = 0x15;
13330 spec->autocfg.speaker_pins[0] = 0x14;
13331 spec->ext_mic.pin = 0x18;
13332 spec->ext_mic.mux_idx = 0;
13333 spec->int_mic.pin = 0x19;
13334 spec->int_mic.mux_idx = 1;
13335 spec->auto_mic = 1;
13339 * generic initialization of ADC, input mixers and output mixers
13341 static struct hda_verb alc268_base_init_verbs[] = {
13342 /* Unmute DAC0-1 and set vol = 0 */
13343 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13344 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13347 * Set up output mixers (0x0c - 0x0e)
13349 /* set vol=0 to output mixers */
13350 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13351 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13353 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13354 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13356 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13357 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13358 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13359 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13360 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13361 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13362 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13363 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13365 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13367 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13368 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13369 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13371 /* set PCBEEP vol = 0, mute connections */
13372 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13373 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13374 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13376 /* Unmute Selector 23h,24h and set the default input to mic-in */
13378 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13380 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13381 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13387 * generic initialization of ADC, input mixers and output mixers
13389 static struct hda_verb alc268_volume_init_verbs[] = {
13390 /* set output DAC */
13391 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13392 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13394 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13395 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13396 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13397 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13398 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13400 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13401 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13402 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13404 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13405 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13407 /* set PCBEEP vol = 0, mute connections */
13408 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13409 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13410 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13415 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13416 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13417 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13418 { } /* end */
13421 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13422 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13423 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13424 _DEFINE_CAPSRC(1),
13425 { } /* end */
13428 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13429 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13430 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13431 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13432 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13433 _DEFINE_CAPSRC(2),
13434 { } /* end */
13437 static struct hda_input_mux alc268_capture_source = {
13438 .num_items = 4,
13439 .items = {
13440 { "Mic", 0x0 },
13441 { "Front Mic", 0x1 },
13442 { "Line", 0x2 },
13443 { "CD", 0x3 },
13447 static struct hda_input_mux alc268_acer_capture_source = {
13448 .num_items = 3,
13449 .items = {
13450 { "Mic", 0x0 },
13451 { "Internal Mic", 0x1 },
13452 { "Line", 0x2 },
13456 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13457 .num_items = 3,
13458 .items = {
13459 { "Mic", 0x0 },
13460 { "Internal Mic", 0x6 },
13461 { "Line", 0x2 },
13465 #ifdef CONFIG_SND_DEBUG
13466 static struct snd_kcontrol_new alc268_test_mixer[] = {
13467 /* Volume widgets */
13468 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13469 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13470 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13471 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13472 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13473 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13474 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13475 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13476 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13477 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13478 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13479 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13480 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13481 /* The below appears problematic on some hardwares */
13482 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13483 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13484 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13485 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13486 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13488 /* Modes for retasking pin widgets */
13489 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13490 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13491 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13492 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13494 /* Controls for GPIO pins, assuming they are configured as outputs */
13495 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13496 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13497 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13498 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13500 /* Switches to allow the digital SPDIF output pin to be enabled.
13501 * The ALC268 does not have an SPDIF input.
13503 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13505 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13506 * this output to turn on an external amplifier.
13508 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13509 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13511 { } /* end */
13513 #endif
13515 /* create input playback/capture controls for the given pin */
13516 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13517 const char *ctlname, int idx)
13519 hda_nid_t dac;
13520 int err;
13522 switch (nid) {
13523 case 0x14:
13524 case 0x16:
13525 dac = 0x02;
13526 break;
13527 case 0x15:
13528 case 0x1a: /* ALC259/269 only */
13529 case 0x1b: /* ALC259/269 only */
13530 case 0x21: /* ALC269vb has this pin, too */
13531 dac = 0x03;
13532 break;
13533 default:
13534 snd_printd(KERN_WARNING "hda_codec: "
13535 "ignoring pin 0x%x as unknown\n", nid);
13536 return 0;
13538 if (spec->multiout.dac_nids[0] != dac &&
13539 spec->multiout.dac_nids[1] != dac) {
13540 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13541 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13542 HDA_OUTPUT));
13543 if (err < 0)
13544 return err;
13545 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13548 if (nid != 0x16)
13549 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13550 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13551 else /* mono */
13552 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13553 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13554 if (err < 0)
13555 return err;
13556 return 0;
13559 /* add playback controls from the parsed DAC table */
13560 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13561 const struct auto_pin_cfg *cfg)
13563 hda_nid_t nid;
13564 int err;
13566 spec->multiout.dac_nids = spec->private_dac_nids;
13568 nid = cfg->line_out_pins[0];
13569 if (nid) {
13570 const char *name;
13571 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13572 name = "Speaker";
13573 else
13574 name = "Front";
13575 err = alc268_new_analog_output(spec, nid, name, 0);
13576 if (err < 0)
13577 return err;
13580 nid = cfg->speaker_pins[0];
13581 if (nid == 0x1d) {
13582 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13583 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13584 if (err < 0)
13585 return err;
13586 } else if (nid) {
13587 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13588 if (err < 0)
13589 return err;
13591 nid = cfg->hp_pins[0];
13592 if (nid) {
13593 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13594 if (err < 0)
13595 return err;
13598 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13599 if (nid == 0x16) {
13600 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13601 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13602 if (err < 0)
13603 return err;
13605 return 0;
13608 /* create playback/capture controls for input pins */
13609 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13610 const struct auto_pin_cfg *cfg)
13612 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13615 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13616 hda_nid_t nid, int pin_type)
13618 int idx;
13620 alc_set_pin_output(codec, nid, pin_type);
13621 if (nid == 0x14 || nid == 0x16)
13622 idx = 0;
13623 else
13624 idx = 1;
13625 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13628 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13630 struct alc_spec *spec = codec->spec;
13631 int i;
13633 for (i = 0; i < spec->autocfg.line_outs; i++) {
13634 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13635 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13636 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13640 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13642 struct alc_spec *spec = codec->spec;
13643 hda_nid_t pin;
13644 int i;
13646 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13647 pin = spec->autocfg.hp_pins[i];
13648 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13650 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13651 pin = spec->autocfg.speaker_pins[i];
13652 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13654 if (spec->autocfg.mono_out_pin)
13655 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13656 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13659 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13661 struct alc_spec *spec = codec->spec;
13662 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13663 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13664 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13665 unsigned int dac_vol1, dac_vol2;
13667 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13668 snd_hda_codec_write(codec, speaker_nid, 0,
13669 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13670 /* mute mixer inputs from 0x1d */
13671 snd_hda_codec_write(codec, 0x0f, 0,
13672 AC_VERB_SET_AMP_GAIN_MUTE,
13673 AMP_IN_UNMUTE(1));
13674 snd_hda_codec_write(codec, 0x10, 0,
13675 AC_VERB_SET_AMP_GAIN_MUTE,
13676 AMP_IN_UNMUTE(1));
13677 } else {
13678 /* unmute mixer inputs from 0x1d */
13679 snd_hda_codec_write(codec, 0x0f, 0,
13680 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13681 snd_hda_codec_write(codec, 0x10, 0,
13682 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13685 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13686 if (line_nid == 0x14)
13687 dac_vol2 = AMP_OUT_ZERO;
13688 else if (line_nid == 0x15)
13689 dac_vol1 = AMP_OUT_ZERO;
13690 if (hp_nid == 0x14)
13691 dac_vol2 = AMP_OUT_ZERO;
13692 else if (hp_nid == 0x15)
13693 dac_vol1 = AMP_OUT_ZERO;
13694 if (line_nid != 0x16 || hp_nid != 0x16 ||
13695 spec->autocfg.line_out_pins[1] != 0x16 ||
13696 spec->autocfg.line_out_pins[2] != 0x16)
13697 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13699 snd_hda_codec_write(codec, 0x02, 0,
13700 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13701 snd_hda_codec_write(codec, 0x03, 0,
13702 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13705 /* pcm configuration: identical with ALC880 */
13706 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13707 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13708 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13709 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13712 * BIOS auto configuration
13714 static int alc268_parse_auto_config(struct hda_codec *codec)
13716 struct alc_spec *spec = codec->spec;
13717 int err;
13718 static hda_nid_t alc268_ignore[] = { 0 };
13720 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13721 alc268_ignore);
13722 if (err < 0)
13723 return err;
13724 if (!spec->autocfg.line_outs) {
13725 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13726 spec->multiout.max_channels = 2;
13727 spec->no_analog = 1;
13728 goto dig_only;
13730 return 0; /* can't find valid BIOS pin config */
13732 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13733 if (err < 0)
13734 return err;
13735 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13736 if (err < 0)
13737 return err;
13739 spec->multiout.max_channels = 2;
13741 dig_only:
13742 /* digital only support output */
13743 alc_auto_parse_digital(codec);
13744 if (spec->kctls.list)
13745 add_mixer(spec, spec->kctls.list);
13747 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13748 add_mixer(spec, alc268_beep_mixer);
13750 add_verb(spec, alc268_volume_init_verbs);
13751 spec->num_mux_defs = 2;
13752 spec->input_mux = &spec->private_imux[0];
13754 err = alc_auto_add_mic_boost(codec);
13755 if (err < 0)
13756 return err;
13758 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13760 return 1;
13763 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13764 #define alc268_auto_init_input_src alc882_auto_init_input_src
13766 /* init callback for auto-configuration model -- overriding the default init */
13767 static void alc268_auto_init(struct hda_codec *codec)
13769 struct alc_spec *spec = codec->spec;
13770 alc268_auto_init_multi_out(codec);
13771 alc268_auto_init_hp_out(codec);
13772 alc268_auto_init_mono_speaker_out(codec);
13773 alc268_auto_init_analog_input(codec);
13774 alc268_auto_init_input_src(codec);
13775 alc_auto_init_digital(codec);
13776 if (spec->unsol_event)
13777 alc_inithook(codec);
13781 * configuration and preset
13783 static const char * const alc268_models[ALC268_MODEL_LAST] = {
13784 [ALC267_QUANTA_IL1] = "quanta-il1",
13785 [ALC268_3ST] = "3stack",
13786 [ALC268_TOSHIBA] = "toshiba",
13787 [ALC268_ACER] = "acer",
13788 [ALC268_ACER_DMIC] = "acer-dmic",
13789 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13790 [ALC268_DELL] = "dell",
13791 [ALC268_ZEPTO] = "zepto",
13792 #ifdef CONFIG_SND_DEBUG
13793 [ALC268_TEST] = "test",
13794 #endif
13795 [ALC268_AUTO] = "auto",
13798 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13799 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13800 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13801 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13802 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13803 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13804 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13805 ALC268_ACER_ASPIRE_ONE),
13806 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13807 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13808 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13809 /* almost compatible with toshiba but with optional digital outs;
13810 * auto-probing seems working fine
13812 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13813 ALC268_AUTO),
13814 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13815 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13816 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13817 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13818 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13822 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13823 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13824 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13825 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13826 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13827 ALC268_TOSHIBA),
13831 static struct alc_config_preset alc268_presets[] = {
13832 [ALC267_QUANTA_IL1] = {
13833 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13834 alc268_capture_nosrc_mixer },
13835 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13836 alc267_quanta_il1_verbs },
13837 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13838 .dac_nids = alc268_dac_nids,
13839 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13840 .adc_nids = alc268_adc_nids_alt,
13841 .hp_nid = 0x03,
13842 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13843 .channel_mode = alc268_modes,
13844 .unsol_event = alc_sku_unsol_event,
13845 .setup = alc267_quanta_il1_setup,
13846 .init_hook = alc_inithook,
13848 [ALC268_3ST] = {
13849 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13850 alc268_beep_mixer },
13851 .init_verbs = { alc268_base_init_verbs },
13852 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13853 .dac_nids = alc268_dac_nids,
13854 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13855 .adc_nids = alc268_adc_nids_alt,
13856 .capsrc_nids = alc268_capsrc_nids,
13857 .hp_nid = 0x03,
13858 .dig_out_nid = ALC268_DIGOUT_NID,
13859 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13860 .channel_mode = alc268_modes,
13861 .input_mux = &alc268_capture_source,
13863 [ALC268_TOSHIBA] = {
13864 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13865 alc268_beep_mixer },
13866 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13867 alc268_toshiba_verbs },
13868 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13869 .dac_nids = alc268_dac_nids,
13870 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13871 .adc_nids = alc268_adc_nids_alt,
13872 .capsrc_nids = alc268_capsrc_nids,
13873 .hp_nid = 0x03,
13874 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13875 .channel_mode = alc268_modes,
13876 .input_mux = &alc268_capture_source,
13877 .unsol_event = alc268_toshiba_unsol_event,
13878 .setup = alc268_toshiba_setup,
13879 .init_hook = alc268_toshiba_automute,
13881 [ALC268_ACER] = {
13882 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13883 alc268_beep_mixer },
13884 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13885 alc268_acer_verbs },
13886 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13887 .dac_nids = alc268_dac_nids,
13888 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13889 .adc_nids = alc268_adc_nids_alt,
13890 .capsrc_nids = alc268_capsrc_nids,
13891 .hp_nid = 0x02,
13892 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13893 .channel_mode = alc268_modes,
13894 .input_mux = &alc268_acer_capture_source,
13895 .unsol_event = alc268_acer_unsol_event,
13896 .init_hook = alc268_acer_init_hook,
13898 [ALC268_ACER_DMIC] = {
13899 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13900 alc268_beep_mixer },
13901 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13902 alc268_acer_verbs },
13903 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13904 .dac_nids = alc268_dac_nids,
13905 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13906 .adc_nids = alc268_adc_nids_alt,
13907 .capsrc_nids = alc268_capsrc_nids,
13908 .hp_nid = 0x02,
13909 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13910 .channel_mode = alc268_modes,
13911 .input_mux = &alc268_acer_dmic_capture_source,
13912 .unsol_event = alc268_acer_unsol_event,
13913 .init_hook = alc268_acer_init_hook,
13915 [ALC268_ACER_ASPIRE_ONE] = {
13916 .mixers = { alc268_acer_aspire_one_mixer,
13917 alc268_beep_mixer,
13918 alc268_capture_nosrc_mixer },
13919 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13920 alc268_acer_aspire_one_verbs },
13921 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13922 .dac_nids = alc268_dac_nids,
13923 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13924 .adc_nids = alc268_adc_nids_alt,
13925 .capsrc_nids = alc268_capsrc_nids,
13926 .hp_nid = 0x03,
13927 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13928 .channel_mode = alc268_modes,
13929 .unsol_event = alc268_acer_lc_unsol_event,
13930 .setup = alc268_acer_lc_setup,
13931 .init_hook = alc268_acer_lc_init_hook,
13933 [ALC268_DELL] = {
13934 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13935 alc268_capture_nosrc_mixer },
13936 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13937 alc268_dell_verbs },
13938 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13939 .dac_nids = alc268_dac_nids,
13940 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13941 .adc_nids = alc268_adc_nids_alt,
13942 .capsrc_nids = alc268_capsrc_nids,
13943 .hp_nid = 0x02,
13944 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13945 .channel_mode = alc268_modes,
13946 .unsol_event = alc_sku_unsol_event,
13947 .setup = alc268_dell_setup,
13948 .init_hook = alc_inithook,
13950 [ALC268_ZEPTO] = {
13951 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13952 alc268_beep_mixer },
13953 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13954 alc268_toshiba_verbs },
13955 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13956 .dac_nids = alc268_dac_nids,
13957 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13958 .adc_nids = alc268_adc_nids_alt,
13959 .capsrc_nids = alc268_capsrc_nids,
13960 .hp_nid = 0x03,
13961 .dig_out_nid = ALC268_DIGOUT_NID,
13962 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13963 .channel_mode = alc268_modes,
13964 .input_mux = &alc268_capture_source,
13965 .setup = alc268_toshiba_setup,
13966 .init_hook = alc268_toshiba_automute,
13968 #ifdef CONFIG_SND_DEBUG
13969 [ALC268_TEST] = {
13970 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13971 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13972 alc268_volume_init_verbs },
13973 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13974 .dac_nids = alc268_dac_nids,
13975 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13976 .adc_nids = alc268_adc_nids_alt,
13977 .capsrc_nids = alc268_capsrc_nids,
13978 .hp_nid = 0x03,
13979 .dig_out_nid = ALC268_DIGOUT_NID,
13980 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13981 .channel_mode = alc268_modes,
13982 .input_mux = &alc268_capture_source,
13984 #endif
13987 static int patch_alc268(struct hda_codec *codec)
13989 struct alc_spec *spec;
13990 int board_config;
13991 int i, has_beep, err;
13993 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13994 if (spec == NULL)
13995 return -ENOMEM;
13997 codec->spec = spec;
13999 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
14000 alc268_models,
14001 alc268_cfg_tbl);
14003 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
14004 board_config = snd_hda_check_board_codec_sid_config(codec,
14005 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
14007 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
14008 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14009 codec->chip_name);
14010 board_config = ALC268_AUTO;
14013 if (board_config == ALC268_AUTO) {
14014 /* automatic parse from the BIOS config */
14015 err = alc268_parse_auto_config(codec);
14016 if (err < 0) {
14017 alc_free(codec);
14018 return err;
14019 } else if (!err) {
14020 printk(KERN_INFO
14021 "hda_codec: Cannot set up configuration "
14022 "from BIOS. Using base mode...\n");
14023 board_config = ALC268_3ST;
14027 if (board_config != ALC268_AUTO)
14028 setup_preset(codec, &alc268_presets[board_config]);
14030 spec->stream_analog_playback = &alc268_pcm_analog_playback;
14031 spec->stream_analog_capture = &alc268_pcm_analog_capture;
14032 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
14034 spec->stream_digital_playback = &alc268_pcm_digital_playback;
14036 has_beep = 0;
14037 for (i = 0; i < spec->num_mixers; i++) {
14038 if (spec->mixers[i] == alc268_beep_mixer) {
14039 has_beep = 1;
14040 break;
14044 if (has_beep) {
14045 err = snd_hda_attach_beep_device(codec, 0x1);
14046 if (err < 0) {
14047 alc_free(codec);
14048 return err;
14050 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14051 /* override the amp caps for beep generator */
14052 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14053 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14054 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14055 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14056 (0 << AC_AMPCAP_MUTE_SHIFT));
14059 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14060 /* check whether NID 0x07 is valid */
14061 unsigned int wcap = get_wcaps(codec, 0x07);
14063 spec->capsrc_nids = alc268_capsrc_nids;
14064 /* get type */
14065 wcap = get_wcaps_type(wcap);
14066 if (spec->auto_mic ||
14067 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14068 spec->adc_nids = alc268_adc_nids_alt;
14069 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14070 if (spec->auto_mic)
14071 fixup_automic_adc(codec);
14072 if (spec->auto_mic || spec->input_mux->num_items == 1)
14073 add_mixer(spec, alc268_capture_nosrc_mixer);
14074 else
14075 add_mixer(spec, alc268_capture_alt_mixer);
14076 } else {
14077 spec->adc_nids = alc268_adc_nids;
14078 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14079 add_mixer(spec, alc268_capture_mixer);
14083 spec->vmaster_nid = 0x02;
14085 codec->patch_ops = alc_patch_ops;
14086 if (board_config == ALC268_AUTO)
14087 spec->init_hook = alc268_auto_init;
14089 alc_init_jacks(codec);
14091 return 0;
14095 * ALC269 channel source setting (2 channel)
14097 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14099 #define alc269_dac_nids alc260_dac_nids
14101 static hda_nid_t alc269_adc_nids[1] = {
14102 /* ADC1 */
14103 0x08,
14106 static hda_nid_t alc269_capsrc_nids[1] = {
14107 0x23,
14110 static hda_nid_t alc269vb_adc_nids[1] = {
14111 /* ADC1 */
14112 0x09,
14115 static hda_nid_t alc269vb_capsrc_nids[1] = {
14116 0x22,
14119 static hda_nid_t alc269_adc_candidates[] = {
14120 0x08, 0x09, 0x07, 0x11,
14123 #define alc269_modes alc260_modes
14124 #define alc269_capture_source alc880_lg_lw_capture_source
14126 static struct snd_kcontrol_new alc269_base_mixer[] = {
14127 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14128 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14133 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14134 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14135 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14136 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14137 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14138 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14139 { } /* end */
14142 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14143 /* output mixer control */
14144 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14146 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14147 .name = "Master Playback Switch",
14148 .subdevice = HDA_SUBDEV_AMP_FLAG,
14149 .info = snd_hda_mixer_amp_switch_info,
14150 .get = snd_hda_mixer_amp_switch_get,
14151 .put = alc268_acer_master_sw_put,
14152 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14155 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14156 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14157 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14158 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14159 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14163 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14164 /* output mixer control */
14165 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14167 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14168 .name = "Master Playback Switch",
14169 .subdevice = HDA_SUBDEV_AMP_FLAG,
14170 .info = snd_hda_mixer_amp_switch_info,
14171 .get = snd_hda_mixer_amp_switch_get,
14172 .put = alc268_acer_master_sw_put,
14173 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14175 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14176 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14177 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14178 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14179 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14180 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14181 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14182 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14183 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14187 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14188 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14189 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14190 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14191 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14192 { } /* end */
14195 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14196 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14197 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14199 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14200 { } /* end */
14203 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14204 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14205 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14206 { } /* end */
14209 /* capture mixer elements */
14210 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14211 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14212 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14213 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14214 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14215 { } /* end */
14218 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14219 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14220 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14221 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14222 { } /* end */
14225 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14226 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14227 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14228 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14229 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14230 { } /* end */
14233 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14234 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14235 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14236 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14237 { } /* end */
14240 /* FSC amilo */
14241 #define alc269_fujitsu_mixer alc269_laptop_mixer
14243 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14244 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14245 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14246 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14247 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14248 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14249 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14253 static struct hda_verb alc269_lifebook_verbs[] = {
14254 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14255 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14256 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14258 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14259 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14260 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14261 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14262 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14263 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14267 /* toggle speaker-output according to the hp-jack state */
14268 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14270 unsigned int present;
14271 unsigned char bits;
14273 present = snd_hda_jack_detect(codec, 0x15);
14274 bits = present ? HDA_AMP_MUTE : 0;
14275 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14276 HDA_AMP_MUTE, bits);
14277 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14278 HDA_AMP_MUTE, bits);
14280 snd_hda_codec_write(codec, 0x20, 0,
14281 AC_VERB_SET_COEF_INDEX, 0x0c);
14282 snd_hda_codec_write(codec, 0x20, 0,
14283 AC_VERB_SET_PROC_COEF, 0x680);
14285 snd_hda_codec_write(codec, 0x20, 0,
14286 AC_VERB_SET_COEF_INDEX, 0x0c);
14287 snd_hda_codec_write(codec, 0x20, 0,
14288 AC_VERB_SET_PROC_COEF, 0x480);
14291 /* toggle speaker-output according to the hp-jacks state */
14292 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14294 unsigned int present;
14295 unsigned char bits;
14297 /* Check laptop headphone socket */
14298 present = snd_hda_jack_detect(codec, 0x15);
14300 /* Check port replicator headphone socket */
14301 present |= snd_hda_jack_detect(codec, 0x1a);
14303 bits = present ? HDA_AMP_MUTE : 0;
14304 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14305 HDA_AMP_MUTE, bits);
14306 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14307 HDA_AMP_MUTE, bits);
14309 snd_hda_codec_write(codec, 0x20, 0,
14310 AC_VERB_SET_COEF_INDEX, 0x0c);
14311 snd_hda_codec_write(codec, 0x20, 0,
14312 AC_VERB_SET_PROC_COEF, 0x680);
14314 snd_hda_codec_write(codec, 0x20, 0,
14315 AC_VERB_SET_COEF_INDEX, 0x0c);
14316 snd_hda_codec_write(codec, 0x20, 0,
14317 AC_VERB_SET_PROC_COEF, 0x480);
14320 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14322 unsigned int present_laptop;
14323 unsigned int present_dock;
14325 present_laptop = snd_hda_jack_detect(codec, 0x18);
14326 present_dock = snd_hda_jack_detect(codec, 0x1b);
14328 /* Laptop mic port overrides dock mic port, design decision */
14329 if (present_dock)
14330 snd_hda_codec_write(codec, 0x23, 0,
14331 AC_VERB_SET_CONNECT_SEL, 0x3);
14332 if (present_laptop)
14333 snd_hda_codec_write(codec, 0x23, 0,
14334 AC_VERB_SET_CONNECT_SEL, 0x0);
14335 if (!present_dock && !present_laptop)
14336 snd_hda_codec_write(codec, 0x23, 0,
14337 AC_VERB_SET_CONNECT_SEL, 0x1);
14340 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14341 unsigned int res)
14343 switch (res >> 26) {
14344 case ALC880_HP_EVENT:
14345 alc269_quanta_fl1_speaker_automute(codec);
14346 break;
14347 case ALC880_MIC_EVENT:
14348 alc_mic_automute(codec);
14349 break;
14353 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14354 unsigned int res)
14356 if ((res >> 26) == ALC880_HP_EVENT)
14357 alc269_lifebook_speaker_automute(codec);
14358 if ((res >> 26) == ALC880_MIC_EVENT)
14359 alc269_lifebook_mic_autoswitch(codec);
14362 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14364 struct alc_spec *spec = codec->spec;
14365 spec->autocfg.hp_pins[0] = 0x15;
14366 spec->autocfg.speaker_pins[0] = 0x14;
14367 spec->ext_mic.pin = 0x18;
14368 spec->ext_mic.mux_idx = 0;
14369 spec->int_mic.pin = 0x19;
14370 spec->int_mic.mux_idx = 1;
14371 spec->auto_mic = 1;
14374 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14376 alc269_quanta_fl1_speaker_automute(codec);
14377 alc_mic_automute(codec);
14380 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14382 alc269_lifebook_speaker_automute(codec);
14383 alc269_lifebook_mic_autoswitch(codec);
14386 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14387 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14388 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14389 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14390 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14391 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14392 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14393 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14397 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14398 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14399 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14400 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14401 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14402 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14403 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14407 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14408 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14409 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14410 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14411 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14412 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14413 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14414 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14418 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14419 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14420 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14421 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14422 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14423 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14424 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14425 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14429 static struct hda_verb alc271_acer_dmic_verbs[] = {
14430 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14431 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14432 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14433 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14434 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14435 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14436 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14437 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14438 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14439 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14443 /* toggle speaker-output according to the hp-jack state */
14444 static void alc269_speaker_automute(struct hda_codec *codec)
14446 struct alc_spec *spec = codec->spec;
14447 unsigned int nid = spec->autocfg.hp_pins[0];
14448 unsigned int present;
14449 unsigned char bits;
14451 present = snd_hda_jack_detect(codec, nid);
14452 bits = present ? HDA_AMP_MUTE : 0;
14453 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14454 HDA_AMP_MUTE, bits);
14455 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14456 HDA_AMP_MUTE, bits);
14457 snd_hda_input_jack_report(codec, nid);
14460 /* unsolicited event for HP jack sensing */
14461 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14462 unsigned int res)
14464 switch (res >> 26) {
14465 case ALC880_HP_EVENT:
14466 alc269_speaker_automute(codec);
14467 break;
14468 case ALC880_MIC_EVENT:
14469 alc_mic_automute(codec);
14470 break;
14474 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14476 struct alc_spec *spec = codec->spec;
14477 spec->autocfg.hp_pins[0] = 0x15;
14478 spec->autocfg.speaker_pins[0] = 0x14;
14479 spec->ext_mic.pin = 0x18;
14480 spec->ext_mic.mux_idx = 0;
14481 spec->int_mic.pin = 0x19;
14482 spec->int_mic.mux_idx = 1;
14483 spec->auto_mic = 1;
14486 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14488 struct alc_spec *spec = codec->spec;
14489 spec->autocfg.hp_pins[0] = 0x15;
14490 spec->autocfg.speaker_pins[0] = 0x14;
14491 spec->ext_mic.pin = 0x18;
14492 spec->ext_mic.mux_idx = 0;
14493 spec->int_mic.pin = 0x12;
14494 spec->int_mic.mux_idx = 5;
14495 spec->auto_mic = 1;
14498 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14500 struct alc_spec *spec = codec->spec;
14501 spec->autocfg.hp_pins[0] = 0x21;
14502 spec->autocfg.speaker_pins[0] = 0x14;
14503 spec->ext_mic.pin = 0x18;
14504 spec->ext_mic.mux_idx = 0;
14505 spec->int_mic.pin = 0x19;
14506 spec->int_mic.mux_idx = 1;
14507 spec->auto_mic = 1;
14510 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14512 struct alc_spec *spec = codec->spec;
14513 spec->autocfg.hp_pins[0] = 0x21;
14514 spec->autocfg.speaker_pins[0] = 0x14;
14515 spec->ext_mic.pin = 0x18;
14516 spec->ext_mic.mux_idx = 0;
14517 spec->int_mic.pin = 0x12;
14518 spec->int_mic.mux_idx = 6;
14519 spec->auto_mic = 1;
14522 static void alc269_laptop_inithook(struct hda_codec *codec)
14524 alc269_speaker_automute(codec);
14525 alc_mic_automute(codec);
14529 * generic initialization of ADC, input mixers and output mixers
14531 static struct hda_verb alc269_init_verbs[] = {
14533 * Unmute ADC0 and set the default input to mic-in
14535 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14538 * Set up output mixers (0x02 - 0x03)
14540 /* set vol=0 to output mixers */
14541 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14542 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14544 /* set up input amps for analog loopback */
14545 /* Amp Indices: DAC = 0, mixer = 1 */
14546 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14548 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14549 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14550 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14551 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14553 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14554 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14555 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14556 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14557 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14558 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14559 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14561 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14562 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14564 /* FIXME: use Mux-type input source selection */
14565 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14566 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14567 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14569 /* set EAPD */
14570 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14574 static struct hda_verb alc269vb_init_verbs[] = {
14576 * Unmute ADC0 and set the default input to mic-in
14578 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14581 * Set up output mixers (0x02 - 0x03)
14583 /* set vol=0 to output mixers */
14584 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14585 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14587 /* set up input amps for analog loopback */
14588 /* Amp Indices: DAC = 0, mixer = 1 */
14589 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14590 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14591 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14592 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14593 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14594 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14596 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14597 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14598 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14599 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14600 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14601 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14602 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14604 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14605 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14607 /* FIXME: use Mux-type input source selection */
14608 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14609 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14610 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14612 /* set EAPD */
14613 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14617 #define alc269_auto_create_multi_out_ctls \
14618 alc268_auto_create_multi_out_ctls
14619 #define alc269_auto_create_input_ctls \
14620 alc268_auto_create_input_ctls
14622 #ifdef CONFIG_SND_HDA_POWER_SAVE
14623 #define alc269_loopbacks alc880_loopbacks
14624 #endif
14626 /* pcm configuration: identical with ALC880 */
14627 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14628 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14629 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14630 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14632 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14633 .substreams = 1,
14634 .channels_min = 2,
14635 .channels_max = 8,
14636 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14637 /* NID is set in alc_build_pcms */
14638 .ops = {
14639 .open = alc880_playback_pcm_open,
14640 .prepare = alc880_playback_pcm_prepare,
14641 .cleanup = alc880_playback_pcm_cleanup
14645 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14646 .substreams = 1,
14647 .channels_min = 2,
14648 .channels_max = 2,
14649 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14650 /* NID is set in alc_build_pcms */
14653 #ifdef CONFIG_SND_HDA_POWER_SAVE
14654 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14656 switch (codec->subsystem_id) {
14657 case 0x103c1586:
14658 return 1;
14660 return 0;
14663 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14665 /* update mute-LED according to the speaker mute state */
14666 if (nid == 0x01 || nid == 0x14) {
14667 int pinval;
14668 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14669 HDA_AMP_MUTE)
14670 pinval = 0x24;
14671 else
14672 pinval = 0x20;
14673 /* mic2 vref pin is used for mute LED control */
14674 snd_hda_codec_update_cache(codec, 0x19, 0,
14675 AC_VERB_SET_PIN_WIDGET_CONTROL,
14676 pinval);
14678 return alc_check_power_status(codec, nid);
14680 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14682 static int alc275_setup_dual_adc(struct hda_codec *codec)
14684 struct alc_spec *spec = codec->spec;
14686 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14687 return 0;
14688 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14689 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14690 if (spec->ext_mic.pin <= 0x12) {
14691 spec->private_adc_nids[0] = 0x08;
14692 spec->private_adc_nids[1] = 0x11;
14693 spec->private_capsrc_nids[0] = 0x23;
14694 spec->private_capsrc_nids[1] = 0x22;
14695 } else {
14696 spec->private_adc_nids[0] = 0x11;
14697 spec->private_adc_nids[1] = 0x08;
14698 spec->private_capsrc_nids[0] = 0x22;
14699 spec->private_capsrc_nids[1] = 0x23;
14701 spec->adc_nids = spec->private_adc_nids;
14702 spec->capsrc_nids = spec->private_capsrc_nids;
14703 spec->num_adc_nids = 2;
14704 spec->dual_adc_switch = 1;
14705 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14706 spec->adc_nids[0], spec->adc_nids[1]);
14707 return 1;
14709 return 0;
14712 /* different alc269-variants */
14713 enum {
14714 ALC269_TYPE_NORMAL,
14715 ALC269_TYPE_ALC258,
14716 ALC269_TYPE_ALC259,
14717 ALC269_TYPE_ALC269VB,
14718 ALC269_TYPE_ALC270,
14719 ALC269_TYPE_ALC271X,
14723 * BIOS auto configuration
14725 static int alc269_parse_auto_config(struct hda_codec *codec)
14727 struct alc_spec *spec = codec->spec;
14728 int err;
14729 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14731 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14732 alc269_ignore);
14733 if (err < 0)
14734 return err;
14736 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14737 if (err < 0)
14738 return err;
14739 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14740 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14741 else
14742 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14743 0x22, 0);
14744 if (err < 0)
14745 return err;
14747 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14749 alc_auto_parse_digital(codec);
14751 if (spec->kctls.list)
14752 add_mixer(spec, spec->kctls.list);
14754 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14755 add_verb(spec, alc269vb_init_verbs);
14756 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14757 } else {
14758 add_verb(spec, alc269_init_verbs);
14759 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14762 spec->num_mux_defs = 1;
14763 spec->input_mux = &spec->private_imux[0];
14765 if (!alc275_setup_dual_adc(codec))
14766 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14767 sizeof(alc269_adc_candidates));
14769 err = alc_auto_add_mic_boost(codec);
14770 if (err < 0)
14771 return err;
14773 if (!spec->cap_mixer && !spec->no_analog)
14774 set_capture_mixer(codec);
14776 return 1;
14779 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14780 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14781 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14782 #define alc269_auto_init_input_src alc882_auto_init_input_src
14785 /* init callback for auto-configuration model -- overriding the default init */
14786 static void alc269_auto_init(struct hda_codec *codec)
14788 struct alc_spec *spec = codec->spec;
14789 alc269_auto_init_multi_out(codec);
14790 alc269_auto_init_hp_out(codec);
14791 alc269_auto_init_analog_input(codec);
14792 if (!spec->dual_adc_switch)
14793 alc269_auto_init_input_src(codec);
14794 alc_auto_init_digital(codec);
14795 if (spec->unsol_event)
14796 alc_inithook(codec);
14799 #ifdef SND_HDA_NEEDS_RESUME
14800 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14802 int val = alc_read_coef_idx(codec, 0x04);
14803 if (power_up)
14804 val |= 1 << 11;
14805 else
14806 val &= ~(1 << 11);
14807 alc_write_coef_idx(codec, 0x04, val);
14810 #ifdef CONFIG_SND_HDA_POWER_SAVE
14811 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14813 struct alc_spec *spec = codec->spec;
14815 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14816 alc269_toggle_power_output(codec, 0);
14817 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14818 alc269_toggle_power_output(codec, 0);
14819 msleep(150);
14822 alc_shutup(codec);
14823 if (spec && spec->power_hook)
14824 spec->power_hook(codec);
14825 return 0;
14827 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14829 static int alc269_resume(struct hda_codec *codec)
14831 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14832 alc269_toggle_power_output(codec, 0);
14833 msleep(150);
14836 codec->patch_ops.init(codec);
14838 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14839 alc269_toggle_power_output(codec, 1);
14840 msleep(200);
14843 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14844 alc269_toggle_power_output(codec, 1);
14846 snd_hda_codec_resume_amp(codec);
14847 snd_hda_codec_resume_cache(codec);
14848 hda_call_check_power_status(codec, 0x01);
14849 return 0;
14851 #endif /* SND_HDA_NEEDS_RESUME */
14853 static void alc269_fixup_hweq(struct hda_codec *codec,
14854 const struct alc_fixup *fix, int action)
14856 int coef;
14858 if (action != ALC_FIXUP_ACT_INIT)
14859 return;
14860 coef = alc_read_coef_idx(codec, 0x1e);
14861 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14864 static void alc271_fixup_dmic(struct hda_codec *codec,
14865 const struct alc_fixup *fix, int action)
14867 static struct hda_verb verbs[] = {
14868 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14869 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14872 unsigned int cfg;
14874 if (strcmp(codec->chip_name, "ALC271X"))
14875 return;
14876 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
14877 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
14878 snd_hda_sequence_write(codec, verbs);
14881 enum {
14882 ALC269_FIXUP_SONY_VAIO,
14883 ALC275_FIXUP_SONY_VAIO_GPIO2,
14884 ALC269_FIXUP_DELL_M101Z,
14885 ALC269_FIXUP_SKU_IGNORE,
14886 ALC269_FIXUP_ASUS_G73JW,
14887 ALC269_FIXUP_LENOVO_EAPD,
14888 ALC275_FIXUP_SONY_HWEQ,
14889 ALC271_FIXUP_DMIC,
14892 static const struct alc_fixup alc269_fixups[] = {
14893 [ALC269_FIXUP_SONY_VAIO] = {
14894 .type = ALC_FIXUP_VERBS,
14895 .v.verbs = (const struct hda_verb[]) {
14896 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14900 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14901 .type = ALC_FIXUP_VERBS,
14902 .v.verbs = (const struct hda_verb[]) {
14903 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14904 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14905 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14908 .chained = true,
14909 .chain_id = ALC269_FIXUP_SONY_VAIO
14911 [ALC269_FIXUP_DELL_M101Z] = {
14912 .type = ALC_FIXUP_VERBS,
14913 .v.verbs = (const struct hda_verb[]) {
14914 /* Enables internal speaker */
14915 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14916 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14920 [ALC269_FIXUP_SKU_IGNORE] = {
14921 .type = ALC_FIXUP_SKU,
14922 .v.sku = ALC_FIXUP_SKU_IGNORE,
14924 [ALC269_FIXUP_ASUS_G73JW] = {
14925 .type = ALC_FIXUP_PINS,
14926 .v.pins = (const struct alc_pincfg[]) {
14927 { 0x17, 0x99130111 }, /* subwoofer */
14931 [ALC269_FIXUP_LENOVO_EAPD] = {
14932 .type = ALC_FIXUP_VERBS,
14933 .v.verbs = (const struct hda_verb[]) {
14934 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14938 [ALC275_FIXUP_SONY_HWEQ] = {
14939 .type = ALC_FIXUP_FUNC,
14940 .v.func = alc269_fixup_hweq,
14941 .chained = true,
14942 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14944 [ALC271_FIXUP_DMIC] = {
14945 .type = ALC_FIXUP_FUNC,
14946 .v.func = alc271_fixup_dmic,
14950 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14951 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14952 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14953 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14954 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14955 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14956 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
14957 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14958 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
14959 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14960 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
14961 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
14962 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14963 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
14969 * configuration and preset
14971 static const char * const alc269_models[ALC269_MODEL_LAST] = {
14972 [ALC269_BASIC] = "basic",
14973 [ALC269_QUANTA_FL1] = "quanta",
14974 [ALC269_AMIC] = "laptop-amic",
14975 [ALC269_DMIC] = "laptop-dmic",
14976 [ALC269_FUJITSU] = "fujitsu",
14977 [ALC269_LIFEBOOK] = "lifebook",
14978 [ALC269_AUTO] = "auto",
14981 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14982 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14983 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14984 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14985 ALC269_AMIC),
14986 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14987 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14988 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14989 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14990 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14991 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14992 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14993 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14994 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14995 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC),
14996 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14997 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14998 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14999 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
15000 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
15001 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
15002 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
15003 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
15004 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
15005 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
15006 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
15007 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
15008 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
15009 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
15010 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
15011 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
15012 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
15013 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
15014 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
15015 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
15016 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
15017 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
15018 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
15019 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
15020 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
15021 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
15022 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
15023 ALC269_DMIC),
15024 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
15025 ALC269_DMIC),
15026 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
15027 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
15028 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
15029 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
15030 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
15031 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
15032 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
15033 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
15034 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
15035 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
15039 static struct alc_config_preset alc269_presets[] = {
15040 [ALC269_BASIC] = {
15041 .mixers = { alc269_base_mixer },
15042 .init_verbs = { alc269_init_verbs },
15043 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15044 .dac_nids = alc269_dac_nids,
15045 .hp_nid = 0x03,
15046 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15047 .channel_mode = alc269_modes,
15048 .input_mux = &alc269_capture_source,
15050 [ALC269_QUANTA_FL1] = {
15051 .mixers = { alc269_quanta_fl1_mixer },
15052 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
15053 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15054 .dac_nids = alc269_dac_nids,
15055 .hp_nid = 0x03,
15056 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15057 .channel_mode = alc269_modes,
15058 .input_mux = &alc269_capture_source,
15059 .unsol_event = alc269_quanta_fl1_unsol_event,
15060 .setup = alc269_quanta_fl1_setup,
15061 .init_hook = alc269_quanta_fl1_init_hook,
15063 [ALC269_AMIC] = {
15064 .mixers = { alc269_laptop_mixer },
15065 .cap_mixer = alc269_laptop_analog_capture_mixer,
15066 .init_verbs = { alc269_init_verbs,
15067 alc269_laptop_amic_init_verbs },
15068 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15069 .dac_nids = alc269_dac_nids,
15070 .hp_nid = 0x03,
15071 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15072 .channel_mode = alc269_modes,
15073 .unsol_event = alc269_laptop_unsol_event,
15074 .setup = alc269_laptop_amic_setup,
15075 .init_hook = alc269_laptop_inithook,
15077 [ALC269_DMIC] = {
15078 .mixers = { alc269_laptop_mixer },
15079 .cap_mixer = alc269_laptop_digital_capture_mixer,
15080 .init_verbs = { alc269_init_verbs,
15081 alc269_laptop_dmic_init_verbs },
15082 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15083 .dac_nids = alc269_dac_nids,
15084 .hp_nid = 0x03,
15085 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15086 .channel_mode = alc269_modes,
15087 .unsol_event = alc269_laptop_unsol_event,
15088 .setup = alc269_laptop_dmic_setup,
15089 .init_hook = alc269_laptop_inithook,
15091 [ALC269VB_AMIC] = {
15092 .mixers = { alc269vb_laptop_mixer },
15093 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
15094 .init_verbs = { alc269vb_init_verbs,
15095 alc269vb_laptop_amic_init_verbs },
15096 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15097 .dac_nids = alc269_dac_nids,
15098 .hp_nid = 0x03,
15099 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15100 .channel_mode = alc269_modes,
15101 .unsol_event = alc269_laptop_unsol_event,
15102 .setup = alc269vb_laptop_amic_setup,
15103 .init_hook = alc269_laptop_inithook,
15105 [ALC269VB_DMIC] = {
15106 .mixers = { alc269vb_laptop_mixer },
15107 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15108 .init_verbs = { alc269vb_init_verbs,
15109 alc269vb_laptop_dmic_init_verbs },
15110 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15111 .dac_nids = alc269_dac_nids,
15112 .hp_nid = 0x03,
15113 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15114 .channel_mode = alc269_modes,
15115 .unsol_event = alc269_laptop_unsol_event,
15116 .setup = alc269vb_laptop_dmic_setup,
15117 .init_hook = alc269_laptop_inithook,
15119 [ALC269_FUJITSU] = {
15120 .mixers = { alc269_fujitsu_mixer },
15121 .cap_mixer = alc269_laptop_digital_capture_mixer,
15122 .init_verbs = { alc269_init_verbs,
15123 alc269_laptop_dmic_init_verbs },
15124 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15125 .dac_nids = alc269_dac_nids,
15126 .hp_nid = 0x03,
15127 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15128 .channel_mode = alc269_modes,
15129 .unsol_event = alc269_laptop_unsol_event,
15130 .setup = alc269_laptop_dmic_setup,
15131 .init_hook = alc269_laptop_inithook,
15133 [ALC269_LIFEBOOK] = {
15134 .mixers = { alc269_lifebook_mixer },
15135 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15136 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15137 .dac_nids = alc269_dac_nids,
15138 .hp_nid = 0x03,
15139 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15140 .channel_mode = alc269_modes,
15141 .input_mux = &alc269_capture_source,
15142 .unsol_event = alc269_lifebook_unsol_event,
15143 .init_hook = alc269_lifebook_init_hook,
15145 [ALC271_ACER] = {
15146 .mixers = { alc269_asus_mixer },
15147 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15148 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15149 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15150 .dac_nids = alc269_dac_nids,
15151 .adc_nids = alc262_dmic_adc_nids,
15152 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15153 .capsrc_nids = alc262_dmic_capsrc_nids,
15154 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15155 .channel_mode = alc269_modes,
15156 .input_mux = &alc269_capture_source,
15157 .dig_out_nid = ALC880_DIGOUT_NID,
15158 .unsol_event = alc_sku_unsol_event,
15159 .setup = alc269vb_laptop_dmic_setup,
15160 .init_hook = alc_inithook,
15164 static int alc269_fill_coef(struct hda_codec *codec)
15166 int val;
15168 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15169 alc_write_coef_idx(codec, 0xf, 0x960b);
15170 alc_write_coef_idx(codec, 0xe, 0x8817);
15173 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15174 alc_write_coef_idx(codec, 0xf, 0x960b);
15175 alc_write_coef_idx(codec, 0xe, 0x8814);
15178 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15179 val = alc_read_coef_idx(codec, 0x04);
15180 /* Power up output pin */
15181 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15184 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15185 val = alc_read_coef_idx(codec, 0xd);
15186 if ((val & 0x0c00) >> 10 != 0x1) {
15187 /* Capless ramp up clock control */
15188 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15190 val = alc_read_coef_idx(codec, 0x17);
15191 if ((val & 0x01c0) >> 6 != 0x4) {
15192 /* Class D power on reset */
15193 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15196 return 0;
15199 static int patch_alc269(struct hda_codec *codec)
15201 struct alc_spec *spec;
15202 int board_config, coef;
15203 int err;
15205 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15206 if (spec == NULL)
15207 return -ENOMEM;
15209 codec->spec = spec;
15211 alc_auto_parse_customize_define(codec);
15213 if (codec->vendor_id == 0x10ec0269) {
15214 coef = alc_read_coef_idx(codec, 0);
15215 if ((coef & 0x00f0) == 0x0010) {
15216 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15217 spec->cdefine.platform_type == 1) {
15218 alc_codec_rename(codec, "ALC271X");
15219 spec->codec_variant = ALC269_TYPE_ALC271X;
15220 } else if ((coef & 0xf000) == 0x1000) {
15221 spec->codec_variant = ALC269_TYPE_ALC270;
15222 } else if ((coef & 0xf000) == 0x2000) {
15223 alc_codec_rename(codec, "ALC259");
15224 spec->codec_variant = ALC269_TYPE_ALC259;
15225 } else if ((coef & 0xf000) == 0x3000) {
15226 alc_codec_rename(codec, "ALC258");
15227 spec->codec_variant = ALC269_TYPE_ALC258;
15228 } else {
15229 alc_codec_rename(codec, "ALC269VB");
15230 spec->codec_variant = ALC269_TYPE_ALC269VB;
15232 } else
15233 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15234 alc269_fill_coef(codec);
15237 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15238 alc269_models,
15239 alc269_cfg_tbl);
15241 if (board_config < 0) {
15242 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15243 codec->chip_name);
15244 board_config = ALC269_AUTO;
15247 if (board_config == ALC269_AUTO) {
15248 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15249 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15252 if (board_config == ALC269_AUTO) {
15253 /* automatic parse from the BIOS config */
15254 err = alc269_parse_auto_config(codec);
15255 if (err < 0) {
15256 alc_free(codec);
15257 return err;
15258 } else if (!err) {
15259 printk(KERN_INFO
15260 "hda_codec: Cannot set up configuration "
15261 "from BIOS. Using base mode...\n");
15262 board_config = ALC269_BASIC;
15266 if (has_cdefine_beep(codec)) {
15267 err = snd_hda_attach_beep_device(codec, 0x1);
15268 if (err < 0) {
15269 alc_free(codec);
15270 return err;
15274 if (board_config != ALC269_AUTO)
15275 setup_preset(codec, &alc269_presets[board_config]);
15277 if (board_config == ALC269_QUANTA_FL1) {
15278 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15279 * fix the sample rate of analog I/O to 44.1kHz
15281 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15282 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15283 } else if (spec->dual_adc_switch) {
15284 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15285 /* switch ADC dynamically */
15286 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15287 } else {
15288 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15289 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15291 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15292 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15294 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15295 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15296 spec->adc_nids = alc269_adc_nids;
15297 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15298 spec->capsrc_nids = alc269_capsrc_nids;
15299 } else {
15300 spec->adc_nids = alc269vb_adc_nids;
15301 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15302 spec->capsrc_nids = alc269vb_capsrc_nids;
15306 if (!spec->cap_mixer)
15307 set_capture_mixer(codec);
15308 if (has_cdefine_beep(codec))
15309 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15311 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15313 spec->vmaster_nid = 0x02;
15315 codec->patch_ops = alc_patch_ops;
15316 #ifdef CONFIG_SND_HDA_POWER_SAVE
15317 codec->patch_ops.suspend = alc269_suspend;
15318 #endif
15319 #ifdef SND_HDA_NEEDS_RESUME
15320 codec->patch_ops.resume = alc269_resume;
15321 #endif
15322 if (board_config == ALC269_AUTO)
15323 spec->init_hook = alc269_auto_init;
15325 alc_init_jacks(codec);
15326 #ifdef CONFIG_SND_HDA_POWER_SAVE
15327 if (!spec->loopback.amplist)
15328 spec->loopback.amplist = alc269_loopbacks;
15329 if (alc269_mic2_for_mute_led(codec))
15330 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15331 #endif
15333 return 0;
15337 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15341 * set the path ways for 2 channel output
15342 * need to set the codec line out and mic 1 pin widgets to inputs
15344 static struct hda_verb alc861_threestack_ch2_init[] = {
15345 /* set pin widget 1Ah (line in) for input */
15346 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15347 /* set pin widget 18h (mic1/2) for input, for mic also enable
15348 * the vref
15350 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15352 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15353 #if 0
15354 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15355 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15356 #endif
15357 { } /* end */
15360 * 6ch mode
15361 * need to set the codec line out and mic 1 pin widgets to outputs
15363 static struct hda_verb alc861_threestack_ch6_init[] = {
15364 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15365 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15366 /* set pin widget 18h (mic1) for output (CLFE)*/
15367 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15369 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15370 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15372 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15373 #if 0
15374 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15375 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15376 #endif
15377 { } /* end */
15380 static struct hda_channel_mode alc861_threestack_modes[2] = {
15381 { 2, alc861_threestack_ch2_init },
15382 { 6, alc861_threestack_ch6_init },
15384 /* Set mic1 as input and unmute the mixer */
15385 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15386 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15387 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15388 { } /* end */
15390 /* Set mic1 as output and mute mixer */
15391 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15392 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15393 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15394 { } /* end */
15397 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15398 { 2, alc861_uniwill_m31_ch2_init },
15399 { 4, alc861_uniwill_m31_ch4_init },
15402 /* Set mic1 and line-in as input and unmute the mixer */
15403 static struct hda_verb alc861_asus_ch2_init[] = {
15404 /* set pin widget 1Ah (line in) for input */
15405 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15406 /* set pin widget 18h (mic1/2) for input, for mic also enable
15407 * the vref
15409 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15411 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15412 #if 0
15413 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15414 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15415 #endif
15416 { } /* end */
15418 /* Set mic1 nad line-in as output and mute mixer */
15419 static struct hda_verb alc861_asus_ch6_init[] = {
15420 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15421 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15422 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15423 /* set pin widget 18h (mic1) for output (CLFE)*/
15424 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15425 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15426 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15427 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15429 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15430 #if 0
15431 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15432 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15433 #endif
15434 { } /* end */
15437 static struct hda_channel_mode alc861_asus_modes[2] = {
15438 { 2, alc861_asus_ch2_init },
15439 { 6, alc861_asus_ch6_init },
15442 /* patch-ALC861 */
15444 static struct snd_kcontrol_new alc861_base_mixer[] = {
15445 /* output mixer control */
15446 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15447 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15448 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15449 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15450 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15452 /*Input mixer control */
15453 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15454 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15455 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15456 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15457 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15458 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15460 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15461 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15462 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15464 { } /* end */
15467 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15468 /* output mixer control */
15469 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15470 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15471 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15472 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15473 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15475 /* Input mixer control */
15476 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15477 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15478 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15479 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15480 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15481 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15482 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15483 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15484 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15485 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15488 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15489 .name = "Channel Mode",
15490 .info = alc_ch_mode_info,
15491 .get = alc_ch_mode_get,
15492 .put = alc_ch_mode_put,
15493 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15495 { } /* end */
15498 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15499 /* output mixer control */
15500 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15502 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15504 { } /* end */
15507 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15508 /* output mixer control */
15509 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15510 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15511 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15512 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15513 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15515 /* Input mixer control */
15516 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15517 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15518 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15519 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15520 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15521 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15522 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15523 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15524 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15525 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15528 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15529 .name = "Channel Mode",
15530 .info = alc_ch_mode_info,
15531 .get = alc_ch_mode_get,
15532 .put = alc_ch_mode_put,
15533 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15535 { } /* end */
15538 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15539 /* output mixer control */
15540 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15541 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15542 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15543 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15544 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15546 /* Input mixer control */
15547 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15548 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15549 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15550 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15551 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15552 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15553 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15554 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15555 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15556 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15559 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15560 .name = "Channel Mode",
15561 .info = alc_ch_mode_info,
15562 .get = alc_ch_mode_get,
15563 .put = alc_ch_mode_put,
15564 .private_value = ARRAY_SIZE(alc861_asus_modes),
15569 /* additional mixer */
15570 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15571 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15572 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15577 * generic initialization of ADC, input mixers and output mixers
15579 static struct hda_verb alc861_base_init_verbs[] = {
15581 * Unmute ADC0 and set the default input to mic-in
15583 /* port-A for surround (rear panel) */
15584 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15585 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15586 /* port-B for mic-in (rear panel) with vref */
15587 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15588 /* port-C for line-in (rear panel) */
15589 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15590 /* port-D for Front */
15591 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15592 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15593 /* port-E for HP out (front panel) */
15594 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15595 /* route front PCM to HP */
15596 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15597 /* port-F for mic-in (front panel) with vref */
15598 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15599 /* port-G for CLFE (rear panel) */
15600 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15601 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15602 /* port-H for side (rear panel) */
15603 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15604 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15605 /* CD-in */
15606 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15607 /* route front mic to ADC1*/
15608 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15609 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15611 /* Unmute DAC0~3 & spdif out*/
15612 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15613 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15614 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15615 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15618 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15619 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15620 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15621 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15622 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15624 /* Unmute Stereo Mixer 15 */
15625 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15626 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15627 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15628 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15630 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15631 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15632 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15633 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15634 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15635 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15636 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15637 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15638 /* hp used DAC 3 (Front) */
15639 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15640 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15645 static struct hda_verb alc861_threestack_init_verbs[] = {
15647 * Unmute ADC0 and set the default input to mic-in
15649 /* port-A for surround (rear panel) */
15650 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15651 /* port-B for mic-in (rear panel) with vref */
15652 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15653 /* port-C for line-in (rear panel) */
15654 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15655 /* port-D for Front */
15656 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15657 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15658 /* port-E for HP out (front panel) */
15659 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15660 /* route front PCM to HP */
15661 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15662 /* port-F for mic-in (front panel) with vref */
15663 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15664 /* port-G for CLFE (rear panel) */
15665 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15666 /* port-H for side (rear panel) */
15667 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15668 /* CD-in */
15669 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15670 /* route front mic to ADC1*/
15671 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15672 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15673 /* Unmute DAC0~3 & spdif out*/
15674 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15675 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15676 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15677 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15678 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15680 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15681 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15682 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15683 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15684 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15686 /* Unmute Stereo Mixer 15 */
15687 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15688 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15692 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15693 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15694 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15695 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15696 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15697 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15698 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15699 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15700 /* hp used DAC 3 (Front) */
15701 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15702 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15706 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15708 * Unmute ADC0 and set the default input to mic-in
15710 /* port-A for surround (rear panel) */
15711 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15712 /* port-B for mic-in (rear panel) with vref */
15713 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15714 /* port-C for line-in (rear panel) */
15715 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15716 /* port-D for Front */
15717 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15718 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15719 /* port-E for HP out (front panel) */
15720 /* this has to be set to VREF80 */
15721 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15722 /* route front PCM to HP */
15723 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15724 /* port-F for mic-in (front panel) with vref */
15725 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15726 /* port-G for CLFE (rear panel) */
15727 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15728 /* port-H for side (rear panel) */
15729 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15730 /* CD-in */
15731 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15732 /* route front mic to ADC1*/
15733 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15734 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15735 /* Unmute DAC0~3 & spdif out*/
15736 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15737 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15738 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15739 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15742 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15743 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15744 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15745 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15746 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15748 /* Unmute Stereo Mixer 15 */
15749 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15751 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15752 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15754 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15755 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15756 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15757 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15758 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15759 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15760 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15761 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15762 /* hp used DAC 3 (Front) */
15763 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15764 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15768 static struct hda_verb alc861_asus_init_verbs[] = {
15770 * Unmute ADC0 and set the default input to mic-in
15772 /* port-A for surround (rear panel)
15773 * according to codec#0 this is the HP jack
15775 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15776 /* route front PCM to HP */
15777 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15778 /* port-B for mic-in (rear panel) with vref */
15779 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15780 /* port-C for line-in (rear panel) */
15781 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15782 /* port-D for Front */
15783 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15784 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15785 /* port-E for HP out (front panel) */
15786 /* this has to be set to VREF80 */
15787 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15788 /* route front PCM to HP */
15789 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15790 /* port-F for mic-in (front panel) with vref */
15791 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15792 /* port-G for CLFE (rear panel) */
15793 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15794 /* port-H for side (rear panel) */
15795 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15796 /* CD-in */
15797 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15798 /* route front mic to ADC1*/
15799 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15800 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15801 /* Unmute DAC0~3 & spdif out*/
15802 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15803 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15804 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15805 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15806 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15807 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15808 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15809 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15810 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15811 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15813 /* Unmute Stereo Mixer 15 */
15814 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15815 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15819 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15820 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15821 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15822 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15824 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15825 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15826 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15827 /* hp used DAC 3 (Front) */
15828 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15829 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15833 /* additional init verbs for ASUS laptops */
15834 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15835 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15836 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15841 * generic initialization of ADC, input mixers and output mixers
15843 static struct hda_verb alc861_auto_init_verbs[] = {
15845 * Unmute ADC0 and set the default input to mic-in
15847 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15848 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15850 /* Unmute DAC0~3 & spdif out*/
15851 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15852 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15853 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15854 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15855 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15857 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15858 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15859 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15860 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15861 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15863 /* Unmute Stereo Mixer 15 */
15864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15865 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15866 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15867 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15869 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15870 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15871 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15872 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15873 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15874 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15875 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15876 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15878 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15879 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15881 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15882 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15883 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15884 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15885 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15887 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15892 static struct hda_verb alc861_toshiba_init_verbs[] = {
15893 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15898 /* toggle speaker-output according to the hp-jack state */
15899 static void alc861_toshiba_automute(struct hda_codec *codec)
15901 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15903 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15904 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15905 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15906 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15909 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15910 unsigned int res)
15912 if ((res >> 26) == ALC880_HP_EVENT)
15913 alc861_toshiba_automute(codec);
15916 /* pcm configuration: identical with ALC880 */
15917 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15918 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15919 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15920 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15923 #define ALC861_DIGOUT_NID 0x07
15925 static struct hda_channel_mode alc861_8ch_modes[1] = {
15926 { 8, NULL }
15929 static hda_nid_t alc861_dac_nids[4] = {
15930 /* front, surround, clfe, side */
15931 0x03, 0x06, 0x05, 0x04
15934 static hda_nid_t alc660_dac_nids[3] = {
15935 /* front, clfe, surround */
15936 0x03, 0x05, 0x06
15939 static hda_nid_t alc861_adc_nids[1] = {
15940 /* ADC0-2 */
15941 0x08,
15944 static struct hda_input_mux alc861_capture_source = {
15945 .num_items = 5,
15946 .items = {
15947 { "Mic", 0x0 },
15948 { "Front Mic", 0x3 },
15949 { "Line", 0x1 },
15950 { "CD", 0x4 },
15951 { "Mixer", 0x5 },
15955 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15957 struct alc_spec *spec = codec->spec;
15958 hda_nid_t mix, srcs[5];
15959 int i, j, num;
15961 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15962 return 0;
15963 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15964 if (num < 0)
15965 return 0;
15966 for (i = 0; i < num; i++) {
15967 unsigned int type;
15968 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15969 if (type != AC_WID_AUD_OUT)
15970 continue;
15971 for (j = 0; j < spec->multiout.num_dacs; j++)
15972 if (spec->multiout.dac_nids[j] == srcs[i])
15973 break;
15974 if (j >= spec->multiout.num_dacs)
15975 return srcs[i];
15977 return 0;
15980 /* fill in the dac_nids table from the parsed pin configuration */
15981 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15982 const struct auto_pin_cfg *cfg)
15984 struct alc_spec *spec = codec->spec;
15985 int i;
15986 hda_nid_t nid, dac;
15988 spec->multiout.dac_nids = spec->private_dac_nids;
15989 for (i = 0; i < cfg->line_outs; i++) {
15990 nid = cfg->line_out_pins[i];
15991 dac = alc861_look_for_dac(codec, nid);
15992 if (!dac)
15993 continue;
15994 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15996 return 0;
15999 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
16000 hda_nid_t nid, int idx, unsigned int chs)
16002 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
16003 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
16006 #define alc861_create_out_sw(codec, pfx, nid, chs) \
16007 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
16009 /* add playback controls from the parsed DAC table */
16010 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
16011 const struct auto_pin_cfg *cfg)
16013 struct alc_spec *spec = codec->spec;
16014 static const char * const chname[4] = {
16015 "Front", "Surround", NULL /*CLFE*/, "Side"
16017 const char *pfx = alc_get_line_out_pfx(cfg, true);
16018 hda_nid_t nid;
16019 int i, err;
16021 for (i = 0; i < cfg->line_outs; i++) {
16022 nid = spec->multiout.dac_nids[i];
16023 if (!nid)
16024 continue;
16025 if (!pfx && i == 2) {
16026 /* Center/LFE */
16027 err = alc861_create_out_sw(codec, "Center", nid, 1);
16028 if (err < 0)
16029 return err;
16030 err = alc861_create_out_sw(codec, "LFE", nid, 2);
16031 if (err < 0)
16032 return err;
16033 } else {
16034 const char *name = pfx;
16035 int index = i;
16036 if (!name) {
16037 name = chname[i];
16038 index = 0;
16040 err = __alc861_create_out_sw(codec, name, nid, index, 3);
16041 if (err < 0)
16042 return err;
16045 return 0;
16048 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
16050 struct alc_spec *spec = codec->spec;
16051 int err;
16052 hda_nid_t nid;
16054 if (!pin)
16055 return 0;
16057 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
16058 nid = alc861_look_for_dac(codec, pin);
16059 if (nid) {
16060 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
16061 if (err < 0)
16062 return err;
16063 spec->multiout.hp_nid = nid;
16066 return 0;
16069 /* create playback/capture controls for input pins */
16070 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
16071 const struct auto_pin_cfg *cfg)
16073 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
16076 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
16077 hda_nid_t nid,
16078 int pin_type, hda_nid_t dac)
16080 hda_nid_t mix, srcs[5];
16081 int i, num;
16083 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
16084 pin_type);
16085 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16086 AMP_OUT_UNMUTE);
16087 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
16088 return;
16089 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16090 if (num < 0)
16091 return;
16092 for (i = 0; i < num; i++) {
16093 unsigned int mute;
16094 if (srcs[i] == dac || srcs[i] == 0x15)
16095 mute = AMP_IN_UNMUTE(i);
16096 else
16097 mute = AMP_IN_MUTE(i);
16098 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16099 mute);
16103 static void alc861_auto_init_multi_out(struct hda_codec *codec)
16105 struct alc_spec *spec = codec->spec;
16106 int i;
16108 for (i = 0; i < spec->autocfg.line_outs; i++) {
16109 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16110 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16111 if (nid)
16112 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
16113 spec->multiout.dac_nids[i]);
16117 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16119 struct alc_spec *spec = codec->spec;
16121 if (spec->autocfg.hp_outs)
16122 alc861_auto_set_output_and_unmute(codec,
16123 spec->autocfg.hp_pins[0],
16124 PIN_HP,
16125 spec->multiout.hp_nid);
16126 if (spec->autocfg.speaker_outs)
16127 alc861_auto_set_output_and_unmute(codec,
16128 spec->autocfg.speaker_pins[0],
16129 PIN_OUT,
16130 spec->multiout.dac_nids[0]);
16133 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16135 struct alc_spec *spec = codec->spec;
16136 struct auto_pin_cfg *cfg = &spec->autocfg;
16137 int i;
16139 for (i = 0; i < cfg->num_inputs; i++) {
16140 hda_nid_t nid = cfg->inputs[i].pin;
16141 if (nid >= 0x0c && nid <= 0x11)
16142 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16146 /* parse the BIOS configuration and set up the alc_spec */
16147 /* return 1 if successful, 0 if the proper config is not found,
16148 * or a negative error code
16150 static int alc861_parse_auto_config(struct hda_codec *codec)
16152 struct alc_spec *spec = codec->spec;
16153 int err;
16154 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16156 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16157 alc861_ignore);
16158 if (err < 0)
16159 return err;
16160 if (!spec->autocfg.line_outs)
16161 return 0; /* can't find valid BIOS pin config */
16163 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16164 if (err < 0)
16165 return err;
16166 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16167 if (err < 0)
16168 return err;
16169 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16170 if (err < 0)
16171 return err;
16172 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16173 if (err < 0)
16174 return err;
16176 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16178 alc_auto_parse_digital(codec);
16180 if (spec->kctls.list)
16181 add_mixer(spec, spec->kctls.list);
16183 add_verb(spec, alc861_auto_init_verbs);
16185 spec->num_mux_defs = 1;
16186 spec->input_mux = &spec->private_imux[0];
16188 spec->adc_nids = alc861_adc_nids;
16189 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16190 set_capture_mixer(codec);
16192 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16194 return 1;
16197 /* additional initialization for auto-configuration model */
16198 static void alc861_auto_init(struct hda_codec *codec)
16200 struct alc_spec *spec = codec->spec;
16201 alc861_auto_init_multi_out(codec);
16202 alc861_auto_init_hp_out(codec);
16203 alc861_auto_init_analog_input(codec);
16204 alc_auto_init_digital(codec);
16205 if (spec->unsol_event)
16206 alc_inithook(codec);
16209 #ifdef CONFIG_SND_HDA_POWER_SAVE
16210 static struct hda_amp_list alc861_loopbacks[] = {
16211 { 0x15, HDA_INPUT, 0 },
16212 { 0x15, HDA_INPUT, 1 },
16213 { 0x15, HDA_INPUT, 2 },
16214 { 0x15, HDA_INPUT, 3 },
16215 { } /* end */
16217 #endif
16221 * configuration and preset
16223 static const char * const alc861_models[ALC861_MODEL_LAST] = {
16224 [ALC861_3ST] = "3stack",
16225 [ALC660_3ST] = "3stack-660",
16226 [ALC861_3ST_DIG] = "3stack-dig",
16227 [ALC861_6ST_DIG] = "6stack-dig",
16228 [ALC861_UNIWILL_M31] = "uniwill-m31",
16229 [ALC861_TOSHIBA] = "toshiba",
16230 [ALC861_ASUS] = "asus",
16231 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16232 [ALC861_AUTO] = "auto",
16235 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16236 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16237 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16238 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16239 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16240 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16241 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16242 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16243 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16244 * Any other models that need this preset?
16246 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16247 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16248 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16249 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16250 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16251 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16252 /* FIXME: the below seems conflict */
16253 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16254 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16255 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16259 static struct alc_config_preset alc861_presets[] = {
16260 [ALC861_3ST] = {
16261 .mixers = { alc861_3ST_mixer },
16262 .init_verbs = { alc861_threestack_init_verbs },
16263 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16264 .dac_nids = alc861_dac_nids,
16265 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16266 .channel_mode = alc861_threestack_modes,
16267 .need_dac_fix = 1,
16268 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16269 .adc_nids = alc861_adc_nids,
16270 .input_mux = &alc861_capture_source,
16272 [ALC861_3ST_DIG] = {
16273 .mixers = { alc861_base_mixer },
16274 .init_verbs = { alc861_threestack_init_verbs },
16275 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16276 .dac_nids = alc861_dac_nids,
16277 .dig_out_nid = ALC861_DIGOUT_NID,
16278 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16279 .channel_mode = alc861_threestack_modes,
16280 .need_dac_fix = 1,
16281 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16282 .adc_nids = alc861_adc_nids,
16283 .input_mux = &alc861_capture_source,
16285 [ALC861_6ST_DIG] = {
16286 .mixers = { alc861_base_mixer },
16287 .init_verbs = { alc861_base_init_verbs },
16288 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16289 .dac_nids = alc861_dac_nids,
16290 .dig_out_nid = ALC861_DIGOUT_NID,
16291 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16292 .channel_mode = alc861_8ch_modes,
16293 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16294 .adc_nids = alc861_adc_nids,
16295 .input_mux = &alc861_capture_source,
16297 [ALC660_3ST] = {
16298 .mixers = { alc861_3ST_mixer },
16299 .init_verbs = { alc861_threestack_init_verbs },
16300 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16301 .dac_nids = alc660_dac_nids,
16302 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16303 .channel_mode = alc861_threestack_modes,
16304 .need_dac_fix = 1,
16305 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16306 .adc_nids = alc861_adc_nids,
16307 .input_mux = &alc861_capture_source,
16309 [ALC861_UNIWILL_M31] = {
16310 .mixers = { alc861_uniwill_m31_mixer },
16311 .init_verbs = { alc861_uniwill_m31_init_verbs },
16312 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16313 .dac_nids = alc861_dac_nids,
16314 .dig_out_nid = ALC861_DIGOUT_NID,
16315 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16316 .channel_mode = alc861_uniwill_m31_modes,
16317 .need_dac_fix = 1,
16318 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16319 .adc_nids = alc861_adc_nids,
16320 .input_mux = &alc861_capture_source,
16322 [ALC861_TOSHIBA] = {
16323 .mixers = { alc861_toshiba_mixer },
16324 .init_verbs = { alc861_base_init_verbs,
16325 alc861_toshiba_init_verbs },
16326 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16327 .dac_nids = alc861_dac_nids,
16328 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16329 .channel_mode = alc883_3ST_2ch_modes,
16330 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16331 .adc_nids = alc861_adc_nids,
16332 .input_mux = &alc861_capture_source,
16333 .unsol_event = alc861_toshiba_unsol_event,
16334 .init_hook = alc861_toshiba_automute,
16336 [ALC861_ASUS] = {
16337 .mixers = { alc861_asus_mixer },
16338 .init_verbs = { alc861_asus_init_verbs },
16339 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16340 .dac_nids = alc861_dac_nids,
16341 .dig_out_nid = ALC861_DIGOUT_NID,
16342 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16343 .channel_mode = alc861_asus_modes,
16344 .need_dac_fix = 1,
16345 .hp_nid = 0x06,
16346 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16347 .adc_nids = alc861_adc_nids,
16348 .input_mux = &alc861_capture_source,
16350 [ALC861_ASUS_LAPTOP] = {
16351 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16352 .init_verbs = { alc861_asus_init_verbs,
16353 alc861_asus_laptop_init_verbs },
16354 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16355 .dac_nids = alc861_dac_nids,
16356 .dig_out_nid = ALC861_DIGOUT_NID,
16357 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16358 .channel_mode = alc883_3ST_2ch_modes,
16359 .need_dac_fix = 1,
16360 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16361 .adc_nids = alc861_adc_nids,
16362 .input_mux = &alc861_capture_source,
16366 /* Pin config fixes */
16367 enum {
16368 PINFIX_FSC_AMILO_PI1505,
16371 static const struct alc_fixup alc861_fixups[] = {
16372 [PINFIX_FSC_AMILO_PI1505] = {
16373 .type = ALC_FIXUP_PINS,
16374 .v.pins = (const struct alc_pincfg[]) {
16375 { 0x0b, 0x0221101f }, /* HP */
16376 { 0x0f, 0x90170310 }, /* speaker */
16382 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16383 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16387 static int patch_alc861(struct hda_codec *codec)
16389 struct alc_spec *spec;
16390 int board_config;
16391 int err;
16393 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16394 if (spec == NULL)
16395 return -ENOMEM;
16397 codec->spec = spec;
16399 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16400 alc861_models,
16401 alc861_cfg_tbl);
16403 if (board_config < 0) {
16404 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16405 codec->chip_name);
16406 board_config = ALC861_AUTO;
16409 if (board_config == ALC861_AUTO) {
16410 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16411 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16414 if (board_config == ALC861_AUTO) {
16415 /* automatic parse from the BIOS config */
16416 err = alc861_parse_auto_config(codec);
16417 if (err < 0) {
16418 alc_free(codec);
16419 return err;
16420 } else if (!err) {
16421 printk(KERN_INFO
16422 "hda_codec: Cannot set up configuration "
16423 "from BIOS. Using base mode...\n");
16424 board_config = ALC861_3ST_DIG;
16428 err = snd_hda_attach_beep_device(codec, 0x23);
16429 if (err < 0) {
16430 alc_free(codec);
16431 return err;
16434 if (board_config != ALC861_AUTO)
16435 setup_preset(codec, &alc861_presets[board_config]);
16437 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16438 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16440 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16441 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16443 if (!spec->cap_mixer)
16444 set_capture_mixer(codec);
16445 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16447 spec->vmaster_nid = 0x03;
16449 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16451 codec->patch_ops = alc_patch_ops;
16452 if (board_config == ALC861_AUTO) {
16453 spec->init_hook = alc861_auto_init;
16454 #ifdef CONFIG_SND_HDA_POWER_SAVE
16455 spec->power_hook = alc_power_eapd;
16456 #endif
16458 #ifdef CONFIG_SND_HDA_POWER_SAVE
16459 if (!spec->loopback.amplist)
16460 spec->loopback.amplist = alc861_loopbacks;
16461 #endif
16463 return 0;
16467 * ALC861-VD support
16469 * Based on ALC882
16471 * In addition, an independent DAC
16473 #define ALC861VD_DIGOUT_NID 0x06
16475 static hda_nid_t alc861vd_dac_nids[4] = {
16476 /* front, surr, clfe, side surr */
16477 0x02, 0x03, 0x04, 0x05
16480 /* dac_nids for ALC660vd are in a different order - according to
16481 * Realtek's driver.
16482 * This should probably result in a different mixer for 6stack models
16483 * of ALC660vd codecs, but for now there is only 3stack mixer
16484 * - and it is the same as in 861vd.
16485 * adc_nids in ALC660vd are (is) the same as in 861vd
16487 static hda_nid_t alc660vd_dac_nids[3] = {
16488 /* front, rear, clfe, rear_surr */
16489 0x02, 0x04, 0x03
16492 static hda_nid_t alc861vd_adc_nids[1] = {
16493 /* ADC0 */
16494 0x09,
16497 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16499 /* input MUX */
16500 /* FIXME: should be a matrix-type input source selection */
16501 static struct hda_input_mux alc861vd_capture_source = {
16502 .num_items = 4,
16503 .items = {
16504 { "Mic", 0x0 },
16505 { "Front Mic", 0x1 },
16506 { "Line", 0x2 },
16507 { "CD", 0x4 },
16511 static struct hda_input_mux alc861vd_dallas_capture_source = {
16512 .num_items = 2,
16513 .items = {
16514 { "Mic", 0x0 },
16515 { "Internal Mic", 0x1 },
16519 static struct hda_input_mux alc861vd_hp_capture_source = {
16520 .num_items = 2,
16521 .items = {
16522 { "Front Mic", 0x0 },
16523 { "ATAPI Mic", 0x1 },
16528 * 2ch mode
16530 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16531 { 2, NULL }
16535 * 6ch mode
16537 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16538 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16539 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16540 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16541 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16542 { } /* end */
16546 * 8ch mode
16548 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16549 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16550 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16551 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16552 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16553 { } /* end */
16556 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16557 { 6, alc861vd_6stack_ch6_init },
16558 { 8, alc861vd_6stack_ch8_init },
16561 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16563 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16564 .name = "Channel Mode",
16565 .info = alc_ch_mode_info,
16566 .get = alc_ch_mode_get,
16567 .put = alc_ch_mode_put,
16569 { } /* end */
16572 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16573 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16575 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16576 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16577 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16579 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16580 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16582 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16583 HDA_OUTPUT),
16584 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16585 HDA_OUTPUT),
16586 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16587 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16589 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16590 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16592 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16594 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16595 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16596 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16598 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16599 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16600 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16602 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16603 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16605 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16606 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16608 { } /* end */
16611 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16612 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16613 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16615 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16617 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16618 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16619 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16621 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16622 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16623 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16625 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16626 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16628 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16629 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16631 { } /* end */
16634 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16635 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16636 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16637 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16639 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16641 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16645 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16646 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16647 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16649 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16650 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16652 { } /* end */
16655 /* Pin assignment: Speaker=0x14, HP = 0x15,
16656 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16658 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16659 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16660 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16661 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16662 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16663 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16664 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16665 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16666 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16667 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16668 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16669 { } /* end */
16672 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16673 * Front Mic=0x18, ATAPI Mic = 0x19,
16675 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16676 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16677 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16678 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16679 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16680 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16681 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16682 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16683 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16685 { } /* end */
16689 * generic initialization of ADC, input mixers and output mixers
16691 static struct hda_verb alc861vd_volume_init_verbs[] = {
16693 * Unmute ADC0 and set the default input to mic-in
16695 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16696 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16698 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16699 * the analog-loopback mixer widget
16701 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16702 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16705 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16706 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16708 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16710 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16711 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16712 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16715 * Set up output mixers (0x02 - 0x05)
16717 /* set vol=0 to output mixers */
16718 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16719 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16720 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16721 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16723 /* set up input amps for analog loopback */
16724 /* Amp Indices: DAC = 0, mixer = 1 */
16725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16726 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16727 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16728 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16729 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16730 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16731 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16732 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16738 * 3-stack pin configuration:
16739 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16741 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16743 * Set pin mode and muting
16745 /* set front pin widgets 0x14 for output */
16746 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16747 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16748 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16750 /* Mic (rear) pin: input vref at 80% */
16751 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16752 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16753 /* Front Mic pin: input vref at 80% */
16754 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16755 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16756 /* Line In pin: input */
16757 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16758 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16759 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16760 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16761 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16762 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16763 /* CD pin widget for input */
16764 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16770 * 6-stack pin configuration:
16772 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16774 * Set pin mode and muting
16776 /* set front pin widgets 0x14 for output */
16777 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16778 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16779 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16781 /* Rear Pin: output 1 (0x0d) */
16782 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16783 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16784 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16785 /* CLFE Pin: output 2 (0x0e) */
16786 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16787 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16788 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16789 /* Side Pin: output 3 (0x0f) */
16790 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16791 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16792 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16794 /* Mic (rear) pin: input vref at 80% */
16795 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16796 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16797 /* Front Mic pin: input vref at 80% */
16798 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16799 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16800 /* Line In pin: input */
16801 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16802 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16803 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16804 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16805 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16806 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16807 /* CD pin widget for input */
16808 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16813 static struct hda_verb alc861vd_eapd_verbs[] = {
16814 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16818 static struct hda_verb alc660vd_eapd_verbs[] = {
16819 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16820 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16824 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16825 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16826 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16828 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16829 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16833 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16835 struct alc_spec *spec = codec->spec;
16836 spec->autocfg.hp_pins[0] = 0x1b;
16837 spec->autocfg.speaker_pins[0] = 0x14;
16840 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16842 alc_automute_amp(codec);
16843 alc88x_simple_mic_automute(codec);
16846 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16847 unsigned int res)
16849 switch (res >> 26) {
16850 case ALC880_MIC_EVENT:
16851 alc88x_simple_mic_automute(codec);
16852 break;
16853 default:
16854 alc_automute_amp_unsol_event(codec, res);
16855 break;
16859 static struct hda_verb alc861vd_dallas_verbs[] = {
16860 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16861 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16862 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16863 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16865 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16866 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16867 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16868 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16869 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16870 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16871 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16872 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16874 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16875 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16876 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16877 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16878 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16879 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16880 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16881 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16883 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16884 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16885 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16886 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16887 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16888 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16889 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16890 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16892 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16893 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16894 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16895 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16897 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16898 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16899 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16901 { } /* end */
16904 /* toggle speaker-output according to the hp-jack state */
16905 static void alc861vd_dallas_setup(struct hda_codec *codec)
16907 struct alc_spec *spec = codec->spec;
16909 spec->autocfg.hp_pins[0] = 0x15;
16910 spec->autocfg.speaker_pins[0] = 0x14;
16913 #ifdef CONFIG_SND_HDA_POWER_SAVE
16914 #define alc861vd_loopbacks alc880_loopbacks
16915 #endif
16917 /* pcm configuration: identical with ALC880 */
16918 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16919 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16920 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16921 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16924 * configuration and preset
16926 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16927 [ALC660VD_3ST] = "3stack-660",
16928 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16929 [ALC660VD_ASUS_V1S] = "asus-v1s",
16930 [ALC861VD_3ST] = "3stack",
16931 [ALC861VD_3ST_DIG] = "3stack-digout",
16932 [ALC861VD_6ST_DIG] = "6stack-digout",
16933 [ALC861VD_LENOVO] = "lenovo",
16934 [ALC861VD_DALLAS] = "dallas",
16935 [ALC861VD_HP] = "hp",
16936 [ALC861VD_AUTO] = "auto",
16939 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16940 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16941 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16942 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16943 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16944 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16945 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16946 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16947 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16948 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16949 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16950 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16951 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16952 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16953 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16954 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16958 static struct alc_config_preset alc861vd_presets[] = {
16959 [ALC660VD_3ST] = {
16960 .mixers = { alc861vd_3st_mixer },
16961 .init_verbs = { alc861vd_volume_init_verbs,
16962 alc861vd_3stack_init_verbs },
16963 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16964 .dac_nids = alc660vd_dac_nids,
16965 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16966 .channel_mode = alc861vd_3stack_2ch_modes,
16967 .input_mux = &alc861vd_capture_source,
16969 [ALC660VD_3ST_DIG] = {
16970 .mixers = { alc861vd_3st_mixer },
16971 .init_verbs = { alc861vd_volume_init_verbs,
16972 alc861vd_3stack_init_verbs },
16973 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16974 .dac_nids = alc660vd_dac_nids,
16975 .dig_out_nid = ALC861VD_DIGOUT_NID,
16976 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16977 .channel_mode = alc861vd_3stack_2ch_modes,
16978 .input_mux = &alc861vd_capture_source,
16980 [ALC861VD_3ST] = {
16981 .mixers = { alc861vd_3st_mixer },
16982 .init_verbs = { alc861vd_volume_init_verbs,
16983 alc861vd_3stack_init_verbs },
16984 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16985 .dac_nids = alc861vd_dac_nids,
16986 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16987 .channel_mode = alc861vd_3stack_2ch_modes,
16988 .input_mux = &alc861vd_capture_source,
16990 [ALC861VD_3ST_DIG] = {
16991 .mixers = { alc861vd_3st_mixer },
16992 .init_verbs = { alc861vd_volume_init_verbs,
16993 alc861vd_3stack_init_verbs },
16994 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16995 .dac_nids = alc861vd_dac_nids,
16996 .dig_out_nid = ALC861VD_DIGOUT_NID,
16997 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16998 .channel_mode = alc861vd_3stack_2ch_modes,
16999 .input_mux = &alc861vd_capture_source,
17001 [ALC861VD_6ST_DIG] = {
17002 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
17003 .init_verbs = { alc861vd_volume_init_verbs,
17004 alc861vd_6stack_init_verbs },
17005 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17006 .dac_nids = alc861vd_dac_nids,
17007 .dig_out_nid = ALC861VD_DIGOUT_NID,
17008 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
17009 .channel_mode = alc861vd_6stack_modes,
17010 .input_mux = &alc861vd_capture_source,
17012 [ALC861VD_LENOVO] = {
17013 .mixers = { alc861vd_lenovo_mixer },
17014 .init_verbs = { alc861vd_volume_init_verbs,
17015 alc861vd_3stack_init_verbs,
17016 alc861vd_eapd_verbs,
17017 alc861vd_lenovo_unsol_verbs },
17018 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17019 .dac_nids = alc660vd_dac_nids,
17020 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17021 .channel_mode = alc861vd_3stack_2ch_modes,
17022 .input_mux = &alc861vd_capture_source,
17023 .unsol_event = alc861vd_lenovo_unsol_event,
17024 .setup = alc861vd_lenovo_setup,
17025 .init_hook = alc861vd_lenovo_init_hook,
17027 [ALC861VD_DALLAS] = {
17028 .mixers = { alc861vd_dallas_mixer },
17029 .init_verbs = { alc861vd_dallas_verbs },
17030 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17031 .dac_nids = alc861vd_dac_nids,
17032 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17033 .channel_mode = alc861vd_3stack_2ch_modes,
17034 .input_mux = &alc861vd_dallas_capture_source,
17035 .unsol_event = alc_automute_amp_unsol_event,
17036 .setup = alc861vd_dallas_setup,
17037 .init_hook = alc_automute_amp,
17039 [ALC861VD_HP] = {
17040 .mixers = { alc861vd_hp_mixer },
17041 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
17042 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17043 .dac_nids = alc861vd_dac_nids,
17044 .dig_out_nid = ALC861VD_DIGOUT_NID,
17045 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17046 .channel_mode = alc861vd_3stack_2ch_modes,
17047 .input_mux = &alc861vd_hp_capture_source,
17048 .unsol_event = alc_automute_amp_unsol_event,
17049 .setup = alc861vd_dallas_setup,
17050 .init_hook = alc_automute_amp,
17052 [ALC660VD_ASUS_V1S] = {
17053 .mixers = { alc861vd_lenovo_mixer },
17054 .init_verbs = { alc861vd_volume_init_verbs,
17055 alc861vd_3stack_init_verbs,
17056 alc861vd_eapd_verbs,
17057 alc861vd_lenovo_unsol_verbs },
17058 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17059 .dac_nids = alc660vd_dac_nids,
17060 .dig_out_nid = ALC861VD_DIGOUT_NID,
17061 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17062 .channel_mode = alc861vd_3stack_2ch_modes,
17063 .input_mux = &alc861vd_capture_source,
17064 .unsol_event = alc861vd_lenovo_unsol_event,
17065 .setup = alc861vd_lenovo_setup,
17066 .init_hook = alc861vd_lenovo_init_hook,
17071 * BIOS auto configuration
17073 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
17074 const struct auto_pin_cfg *cfg)
17076 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
17080 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
17081 hda_nid_t nid, int pin_type, int dac_idx)
17083 alc_set_pin_output(codec, nid, pin_type);
17086 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
17088 struct alc_spec *spec = codec->spec;
17089 int i;
17091 for (i = 0; i <= HDA_SIDE; i++) {
17092 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17093 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17094 if (nid)
17095 alc861vd_auto_set_output_and_unmute(codec, nid,
17096 pin_type, i);
17101 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
17103 struct alc_spec *spec = codec->spec;
17104 hda_nid_t pin;
17106 pin = spec->autocfg.hp_pins[0];
17107 if (pin) /* connect to front and use dac 0 */
17108 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17109 pin = spec->autocfg.speaker_pins[0];
17110 if (pin)
17111 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17114 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17116 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17118 struct alc_spec *spec = codec->spec;
17119 struct auto_pin_cfg *cfg = &spec->autocfg;
17120 int i;
17122 for (i = 0; i < cfg->num_inputs; i++) {
17123 hda_nid_t nid = cfg->inputs[i].pin;
17124 if (alc_is_input_pin(codec, nid)) {
17125 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17126 if (nid != ALC861VD_PIN_CD_NID &&
17127 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17128 snd_hda_codec_write(codec, nid, 0,
17129 AC_VERB_SET_AMP_GAIN_MUTE,
17130 AMP_OUT_MUTE);
17135 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17137 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17138 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17140 /* add playback controls from the parsed DAC table */
17141 /* Based on ALC880 version. But ALC861VD has separate,
17142 * different NIDs for mute/unmute switch and volume control */
17143 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17144 const struct auto_pin_cfg *cfg)
17146 static const char * const chname[4] = {
17147 "Front", "Surround", "CLFE", "Side"
17149 const char *pfx = alc_get_line_out_pfx(cfg, true);
17150 hda_nid_t nid_v, nid_s;
17151 int i, err;
17153 for (i = 0; i < cfg->line_outs; i++) {
17154 if (!spec->multiout.dac_nids[i])
17155 continue;
17156 nid_v = alc861vd_idx_to_mixer_vol(
17157 alc880_dac_to_idx(
17158 spec->multiout.dac_nids[i]));
17159 nid_s = alc861vd_idx_to_mixer_switch(
17160 alc880_dac_to_idx(
17161 spec->multiout.dac_nids[i]));
17163 if (!pfx && i == 2) {
17164 /* Center/LFE */
17165 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17166 "Center",
17167 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17168 HDA_OUTPUT));
17169 if (err < 0)
17170 return err;
17171 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17172 "LFE",
17173 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17174 HDA_OUTPUT));
17175 if (err < 0)
17176 return err;
17177 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17178 "Center",
17179 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17180 HDA_INPUT));
17181 if (err < 0)
17182 return err;
17183 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17184 "LFE",
17185 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17186 HDA_INPUT));
17187 if (err < 0)
17188 return err;
17189 } else {
17190 const char *name = pfx;
17191 int index = i;
17192 if (!name) {
17193 name = chname[i];
17194 index = 0;
17196 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17197 name, index,
17198 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17199 HDA_OUTPUT));
17200 if (err < 0)
17201 return err;
17202 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17203 name, index,
17204 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17205 HDA_INPUT));
17206 if (err < 0)
17207 return err;
17210 return 0;
17213 /* add playback controls for speaker and HP outputs */
17214 /* Based on ALC880 version. But ALC861VD has separate,
17215 * different NIDs for mute/unmute switch and volume control */
17216 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17217 hda_nid_t pin, const char *pfx)
17219 hda_nid_t nid_v, nid_s;
17220 int err;
17222 if (!pin)
17223 return 0;
17225 if (alc880_is_fixed_pin(pin)) {
17226 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17227 /* specify the DAC as the extra output */
17228 if (!spec->multiout.hp_nid)
17229 spec->multiout.hp_nid = nid_v;
17230 else
17231 spec->multiout.extra_out_nid[0] = nid_v;
17232 /* control HP volume/switch on the output mixer amp */
17233 nid_v = alc861vd_idx_to_mixer_vol(
17234 alc880_fixed_pin_idx(pin));
17235 nid_s = alc861vd_idx_to_mixer_switch(
17236 alc880_fixed_pin_idx(pin));
17238 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17239 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17240 if (err < 0)
17241 return err;
17242 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17243 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17244 if (err < 0)
17245 return err;
17246 } else if (alc880_is_multi_pin(pin)) {
17247 /* set manual connection */
17248 /* we have only a switch on HP-out PIN */
17249 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17250 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17251 if (err < 0)
17252 return err;
17254 return 0;
17257 /* parse the BIOS configuration and set up the alc_spec
17258 * return 1 if successful, 0 if the proper config is not found,
17259 * or a negative error code
17260 * Based on ALC880 version - had to change it to override
17261 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17262 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17264 struct alc_spec *spec = codec->spec;
17265 int err;
17266 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17268 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17269 alc861vd_ignore);
17270 if (err < 0)
17271 return err;
17272 if (!spec->autocfg.line_outs)
17273 return 0; /* can't find valid BIOS pin config */
17275 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17276 if (err < 0)
17277 return err;
17278 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17279 if (err < 0)
17280 return err;
17281 err = alc861vd_auto_create_extra_out(spec,
17282 spec->autocfg.speaker_pins[0],
17283 "Speaker");
17284 if (err < 0)
17285 return err;
17286 err = alc861vd_auto_create_extra_out(spec,
17287 spec->autocfg.hp_pins[0],
17288 "Headphone");
17289 if (err < 0)
17290 return err;
17291 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17292 if (err < 0)
17293 return err;
17295 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17297 alc_auto_parse_digital(codec);
17299 if (spec->kctls.list)
17300 add_mixer(spec, spec->kctls.list);
17302 add_verb(spec, alc861vd_volume_init_verbs);
17304 spec->num_mux_defs = 1;
17305 spec->input_mux = &spec->private_imux[0];
17307 err = alc_auto_add_mic_boost(codec);
17308 if (err < 0)
17309 return err;
17311 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17313 return 1;
17316 /* additional initialization for auto-configuration model */
17317 static void alc861vd_auto_init(struct hda_codec *codec)
17319 struct alc_spec *spec = codec->spec;
17320 alc861vd_auto_init_multi_out(codec);
17321 alc861vd_auto_init_hp_out(codec);
17322 alc861vd_auto_init_analog_input(codec);
17323 alc861vd_auto_init_input_src(codec);
17324 alc_auto_init_digital(codec);
17325 if (spec->unsol_event)
17326 alc_inithook(codec);
17329 enum {
17330 ALC660VD_FIX_ASUS_GPIO1
17333 /* reset GPIO1 */
17334 static const struct alc_fixup alc861vd_fixups[] = {
17335 [ALC660VD_FIX_ASUS_GPIO1] = {
17336 .type = ALC_FIXUP_VERBS,
17337 .v.verbs = (const struct hda_verb[]) {
17338 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17339 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17340 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17346 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17347 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17351 static int patch_alc861vd(struct hda_codec *codec)
17353 struct alc_spec *spec;
17354 int err, board_config;
17356 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17357 if (spec == NULL)
17358 return -ENOMEM;
17360 codec->spec = spec;
17362 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17363 alc861vd_models,
17364 alc861vd_cfg_tbl);
17366 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17367 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17368 codec->chip_name);
17369 board_config = ALC861VD_AUTO;
17372 if (board_config == ALC861VD_AUTO) {
17373 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17374 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17377 if (board_config == ALC861VD_AUTO) {
17378 /* automatic parse from the BIOS config */
17379 err = alc861vd_parse_auto_config(codec);
17380 if (err < 0) {
17381 alc_free(codec);
17382 return err;
17383 } else if (!err) {
17384 printk(KERN_INFO
17385 "hda_codec: Cannot set up configuration "
17386 "from BIOS. Using base mode...\n");
17387 board_config = ALC861VD_3ST;
17391 err = snd_hda_attach_beep_device(codec, 0x23);
17392 if (err < 0) {
17393 alc_free(codec);
17394 return err;
17397 if (board_config != ALC861VD_AUTO)
17398 setup_preset(codec, &alc861vd_presets[board_config]);
17400 if (codec->vendor_id == 0x10ec0660) {
17401 /* always turn on EAPD */
17402 add_verb(spec, alc660vd_eapd_verbs);
17405 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17406 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17408 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17409 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17411 if (!spec->adc_nids) {
17412 spec->adc_nids = alc861vd_adc_nids;
17413 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17415 if (!spec->capsrc_nids)
17416 spec->capsrc_nids = alc861vd_capsrc_nids;
17418 set_capture_mixer(codec);
17419 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17421 spec->vmaster_nid = 0x02;
17423 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17425 codec->patch_ops = alc_patch_ops;
17427 if (board_config == ALC861VD_AUTO)
17428 spec->init_hook = alc861vd_auto_init;
17429 #ifdef CONFIG_SND_HDA_POWER_SAVE
17430 if (!spec->loopback.amplist)
17431 spec->loopback.amplist = alc861vd_loopbacks;
17432 #endif
17434 return 0;
17438 * ALC662 support
17440 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17441 * configuration. Each pin widget can choose any input DACs and a mixer.
17442 * Each ADC is connected from a mixer of all inputs. This makes possible
17443 * 6-channel independent captures.
17445 * In addition, an independent DAC for the multi-playback (not used in this
17446 * driver yet).
17448 #define ALC662_DIGOUT_NID 0x06
17449 #define ALC662_DIGIN_NID 0x0a
17451 static hda_nid_t alc662_dac_nids[4] = {
17452 /* front, rear, clfe, rear_surr */
17453 0x02, 0x03, 0x04
17456 static hda_nid_t alc272_dac_nids[2] = {
17457 0x02, 0x03
17460 static hda_nid_t alc662_adc_nids[2] = {
17461 /* ADC1-2 */
17462 0x09, 0x08
17465 static hda_nid_t alc272_adc_nids[1] = {
17466 /* ADC1-2 */
17467 0x08,
17470 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17471 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17474 /* input MUX */
17475 /* FIXME: should be a matrix-type input source selection */
17476 static struct hda_input_mux alc662_capture_source = {
17477 .num_items = 4,
17478 .items = {
17479 { "Mic", 0x0 },
17480 { "Front Mic", 0x1 },
17481 { "Line", 0x2 },
17482 { "CD", 0x4 },
17486 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17487 .num_items = 2,
17488 .items = {
17489 { "Mic", 0x1 },
17490 { "Line", 0x2 },
17494 static struct hda_input_mux alc663_capture_source = {
17495 .num_items = 3,
17496 .items = {
17497 { "Mic", 0x0 },
17498 { "Front Mic", 0x1 },
17499 { "Line", 0x2 },
17503 #if 0 /* set to 1 for testing other input sources below */
17504 static struct hda_input_mux alc272_nc10_capture_source = {
17505 .num_items = 16,
17506 .items = {
17507 { "Autoselect Mic", 0x0 },
17508 { "Internal Mic", 0x1 },
17509 { "In-0x02", 0x2 },
17510 { "In-0x03", 0x3 },
17511 { "In-0x04", 0x4 },
17512 { "In-0x05", 0x5 },
17513 { "In-0x06", 0x6 },
17514 { "In-0x07", 0x7 },
17515 { "In-0x08", 0x8 },
17516 { "In-0x09", 0x9 },
17517 { "In-0x0a", 0x0a },
17518 { "In-0x0b", 0x0b },
17519 { "In-0x0c", 0x0c },
17520 { "In-0x0d", 0x0d },
17521 { "In-0x0e", 0x0e },
17522 { "In-0x0f", 0x0f },
17525 #endif
17528 * 2ch mode
17530 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17531 { 2, NULL }
17535 * 2ch mode
17537 static struct hda_verb alc662_3ST_ch2_init[] = {
17538 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17539 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17540 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17541 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17542 { } /* end */
17546 * 6ch mode
17548 static struct hda_verb alc662_3ST_ch6_init[] = {
17549 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17550 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17551 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17552 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17553 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17554 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17555 { } /* end */
17558 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17559 { 2, alc662_3ST_ch2_init },
17560 { 6, alc662_3ST_ch6_init },
17564 * 2ch mode
17566 static struct hda_verb alc662_sixstack_ch6_init[] = {
17567 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17568 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17569 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17570 { } /* end */
17574 * 6ch mode
17576 static struct hda_verb alc662_sixstack_ch8_init[] = {
17577 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17578 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17579 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17580 { } /* end */
17583 static struct hda_channel_mode alc662_5stack_modes[2] = {
17584 { 2, alc662_sixstack_ch6_init },
17585 { 6, alc662_sixstack_ch8_init },
17588 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17589 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17592 static struct snd_kcontrol_new alc662_base_mixer[] = {
17593 /* output mixer control */
17594 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17595 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17596 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17597 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17598 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17599 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17600 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17601 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17602 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17604 /*Input mixer control */
17605 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17606 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17607 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17608 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17609 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17610 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17611 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17612 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17613 { } /* end */
17616 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17617 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17618 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17619 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17620 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17621 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17622 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17623 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17624 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17625 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17626 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17627 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17628 { } /* end */
17631 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17632 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17633 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17634 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17635 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17636 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17637 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17638 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17639 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17640 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17641 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17642 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17643 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17644 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17646 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17647 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17648 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17649 { } /* end */
17652 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17653 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17654 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17655 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17656 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17657 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17658 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17659 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17660 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17661 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17662 { } /* end */
17665 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17666 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17667 ALC262_HIPPO_MASTER_SWITCH,
17669 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17671 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17673 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17674 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17675 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17676 { } /* end */
17679 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17680 ALC262_HIPPO_MASTER_SWITCH,
17681 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17682 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17683 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17684 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17685 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17686 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17687 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17688 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17689 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17690 { } /* end */
17693 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17694 .ops = &snd_hda_bind_vol,
17695 .values = {
17696 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17697 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17702 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17703 .ops = &snd_hda_bind_sw,
17704 .values = {
17705 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17706 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17711 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17712 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17713 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17714 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17715 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17716 { } /* end */
17719 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17720 .ops = &snd_hda_bind_sw,
17721 .values = {
17722 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17723 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17724 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17729 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17730 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17731 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17734 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17735 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17737 { } /* end */
17740 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17741 .ops = &snd_hda_bind_sw,
17742 .values = {
17743 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17744 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17745 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17750 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17751 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17752 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17753 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17754 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17755 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17756 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17757 { } /* end */
17760 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17761 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17762 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17763 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17765 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17766 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17767 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17768 { } /* end */
17771 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17772 .ops = &snd_hda_bind_vol,
17773 .values = {
17774 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17775 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17780 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17781 .ops = &snd_hda_bind_sw,
17782 .values = {
17783 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17784 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17789 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17790 HDA_BIND_VOL("Master Playback Volume",
17791 &alc663_asus_two_bind_master_vol),
17792 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17793 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17794 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17797 { } /* end */
17800 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17801 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17802 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17803 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17804 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17805 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17806 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17807 { } /* end */
17810 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17811 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17812 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17813 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17814 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17815 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17818 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17819 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17820 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17821 { } /* end */
17824 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17825 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17826 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17827 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17829 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17830 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17831 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17832 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17833 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17834 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17835 { } /* end */
17838 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17839 .ops = &snd_hda_bind_sw,
17840 .values = {
17841 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17842 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17843 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17844 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17845 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17850 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17851 .ops = &snd_hda_bind_sw,
17852 .values = {
17853 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17854 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17859 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17860 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17861 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17862 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17863 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17864 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17865 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17866 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17867 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17869 { } /* end */
17872 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17873 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17874 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17875 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17876 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17877 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17880 { } /* end */
17884 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17886 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17887 .name = "Channel Mode",
17888 .info = alc_ch_mode_info,
17889 .get = alc_ch_mode_get,
17890 .put = alc_ch_mode_put,
17892 { } /* end */
17895 static struct hda_verb alc662_init_verbs[] = {
17896 /* ADC: mute amp left and right */
17897 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17898 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17902 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17903 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17904 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17905 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17907 /* Front Pin: output 0 (0x0c) */
17908 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17909 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17911 /* Rear Pin: output 1 (0x0d) */
17912 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17913 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17915 /* CLFE Pin: output 2 (0x0e) */
17916 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17917 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17919 /* Mic (rear) pin: input vref at 80% */
17920 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17921 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17922 /* Front Mic pin: input vref at 80% */
17923 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17924 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17925 /* Line In pin: input */
17926 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17927 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17928 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17929 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17930 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17931 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17932 /* CD pin widget for input */
17933 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17935 /* FIXME: use matrix-type input source selection */
17936 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17937 /* Input mixer */
17938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17939 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17941 /* always trun on EAPD */
17942 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17943 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17948 static struct hda_verb alc663_init_verbs[] = {
17949 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17950 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17951 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17952 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17953 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17954 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17958 static struct hda_verb alc272_init_verbs[] = {
17959 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17960 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17961 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17962 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17963 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17964 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17965 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17966 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17970 static struct hda_verb alc662_sue_init_verbs[] = {
17971 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17972 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17976 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17977 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17978 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17982 /* Set Unsolicited Event*/
17983 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17984 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17985 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17989 static struct hda_verb alc663_m51va_init_verbs[] = {
17990 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17991 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17992 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17993 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17994 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17995 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17996 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17997 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17998 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18002 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
18003 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18004 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18005 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18006 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18007 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18008 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18009 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18013 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
18014 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18015 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18016 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18017 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18018 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18019 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18020 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18021 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18025 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
18026 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18027 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18028 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18030 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18031 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18032 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18036 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
18037 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18038 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18039 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18040 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18041 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18042 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18043 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18044 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18045 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18046 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18047 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18048 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18052 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
18053 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18054 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18055 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18056 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18057 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18058 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18059 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18060 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18061 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18062 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18063 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18064 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18068 static struct hda_verb alc663_g71v_init_verbs[] = {
18069 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18070 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18071 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
18073 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18074 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18075 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18077 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18078 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
18079 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18083 static struct hda_verb alc663_g50v_init_verbs[] = {
18084 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18085 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18086 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18088 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18089 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18093 static struct hda_verb alc662_ecs_init_verbs[] = {
18094 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
18095 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18096 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18097 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18101 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
18102 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18103 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18104 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18105 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18106 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18107 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18108 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18111 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18112 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18116 static struct hda_verb alc272_dell_init_verbs[] = {
18117 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18118 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18120 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18121 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18122 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18123 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18124 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18125 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18126 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18127 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18131 static struct hda_verb alc663_mode7_init_verbs[] = {
18132 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18133 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18134 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18135 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18136 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18137 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18138 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18139 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18140 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18141 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18142 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18143 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18144 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18145 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18146 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18150 static struct hda_verb alc663_mode8_init_verbs[] = {
18151 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18152 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18153 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18154 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18155 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18156 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18157 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18158 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18159 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18160 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18161 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18162 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18163 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18164 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18165 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18166 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18170 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18171 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18172 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18173 { } /* end */
18176 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18177 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18178 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18179 { } /* end */
18182 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18184 unsigned int present;
18185 unsigned char bits;
18187 present = snd_hda_jack_detect(codec, 0x14);
18188 bits = present ? HDA_AMP_MUTE : 0;
18190 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18191 HDA_AMP_MUTE, bits);
18194 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18196 unsigned int present;
18197 unsigned char bits;
18199 present = snd_hda_jack_detect(codec, 0x1b);
18200 bits = present ? HDA_AMP_MUTE : 0;
18202 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18203 HDA_AMP_MUTE, bits);
18204 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18205 HDA_AMP_MUTE, bits);
18208 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18209 unsigned int res)
18211 if ((res >> 26) == ALC880_HP_EVENT)
18212 alc662_lenovo_101e_all_automute(codec);
18213 if ((res >> 26) == ALC880_FRONT_EVENT)
18214 alc662_lenovo_101e_ispeaker_automute(codec);
18217 /* unsolicited event for HP jack sensing */
18218 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18219 unsigned int res)
18221 if ((res >> 26) == ALC880_MIC_EVENT)
18222 alc_mic_automute(codec);
18223 else
18224 alc262_hippo_unsol_event(codec, res);
18227 static void alc662_eeepc_setup(struct hda_codec *codec)
18229 struct alc_spec *spec = codec->spec;
18231 alc262_hippo1_setup(codec);
18232 spec->ext_mic.pin = 0x18;
18233 spec->ext_mic.mux_idx = 0;
18234 spec->int_mic.pin = 0x19;
18235 spec->int_mic.mux_idx = 1;
18236 spec->auto_mic = 1;
18239 static void alc662_eeepc_inithook(struct hda_codec *codec)
18241 alc262_hippo_automute(codec);
18242 alc_mic_automute(codec);
18245 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18247 struct alc_spec *spec = codec->spec;
18249 spec->autocfg.hp_pins[0] = 0x14;
18250 spec->autocfg.speaker_pins[0] = 0x1b;
18253 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18255 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18257 unsigned int present;
18258 unsigned char bits;
18260 present = snd_hda_jack_detect(codec, 0x21);
18261 bits = present ? HDA_AMP_MUTE : 0;
18262 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18263 HDA_AMP_MUTE, bits);
18264 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18265 HDA_AMP_MUTE, bits);
18268 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18270 unsigned int present;
18271 unsigned char bits;
18273 present = snd_hda_jack_detect(codec, 0x21);
18274 bits = present ? HDA_AMP_MUTE : 0;
18275 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18276 HDA_AMP_MUTE, bits);
18277 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18278 HDA_AMP_MUTE, bits);
18279 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18280 HDA_AMP_MUTE, bits);
18281 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18282 HDA_AMP_MUTE, bits);
18285 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18287 unsigned int present;
18288 unsigned char bits;
18290 present = snd_hda_jack_detect(codec, 0x15);
18291 bits = present ? HDA_AMP_MUTE : 0;
18292 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18293 HDA_AMP_MUTE, bits);
18294 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18295 HDA_AMP_MUTE, bits);
18296 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18297 HDA_AMP_MUTE, bits);
18298 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18299 HDA_AMP_MUTE, bits);
18302 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18304 unsigned int present;
18305 unsigned char bits;
18307 present = snd_hda_jack_detect(codec, 0x1b);
18308 bits = present ? 0 : PIN_OUT;
18309 snd_hda_codec_write(codec, 0x14, 0,
18310 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18313 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18315 unsigned int present1, present2;
18317 present1 = snd_hda_jack_detect(codec, 0x21);
18318 present2 = snd_hda_jack_detect(codec, 0x15);
18320 if (present1 || present2) {
18321 snd_hda_codec_write_cache(codec, 0x14, 0,
18322 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18323 } else {
18324 snd_hda_codec_write_cache(codec, 0x14, 0,
18325 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18329 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18331 unsigned int present1, present2;
18333 present1 = snd_hda_jack_detect(codec, 0x1b);
18334 present2 = snd_hda_jack_detect(codec, 0x15);
18336 if (present1 || present2) {
18337 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18338 HDA_AMP_MUTE, HDA_AMP_MUTE);
18339 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18340 HDA_AMP_MUTE, HDA_AMP_MUTE);
18341 } else {
18342 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18343 HDA_AMP_MUTE, 0);
18344 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18345 HDA_AMP_MUTE, 0);
18349 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18351 unsigned int present1, present2;
18353 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18354 AC_VERB_GET_PIN_SENSE, 0)
18355 & AC_PINSENSE_PRESENCE;
18356 present2 = snd_hda_codec_read(codec, 0x21, 0,
18357 AC_VERB_GET_PIN_SENSE, 0)
18358 & AC_PINSENSE_PRESENCE;
18360 if (present1 || present2) {
18361 snd_hda_codec_write_cache(codec, 0x14, 0,
18362 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18363 snd_hda_codec_write_cache(codec, 0x17, 0,
18364 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18365 } else {
18366 snd_hda_codec_write_cache(codec, 0x14, 0,
18367 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18368 snd_hda_codec_write_cache(codec, 0x17, 0,
18369 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18373 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18375 unsigned int present1, present2;
18377 present1 = snd_hda_codec_read(codec, 0x21, 0,
18378 AC_VERB_GET_PIN_SENSE, 0)
18379 & AC_PINSENSE_PRESENCE;
18380 present2 = snd_hda_codec_read(codec, 0x15, 0,
18381 AC_VERB_GET_PIN_SENSE, 0)
18382 & AC_PINSENSE_PRESENCE;
18384 if (present1 || present2) {
18385 snd_hda_codec_write_cache(codec, 0x14, 0,
18386 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18387 snd_hda_codec_write_cache(codec, 0x17, 0,
18388 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18389 } else {
18390 snd_hda_codec_write_cache(codec, 0x14, 0,
18391 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18392 snd_hda_codec_write_cache(codec, 0x17, 0,
18393 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18397 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18398 unsigned int res)
18400 switch (res >> 26) {
18401 case ALC880_HP_EVENT:
18402 alc663_m51va_speaker_automute(codec);
18403 break;
18404 case ALC880_MIC_EVENT:
18405 alc_mic_automute(codec);
18406 break;
18410 static void alc663_m51va_setup(struct hda_codec *codec)
18412 struct alc_spec *spec = codec->spec;
18413 spec->ext_mic.pin = 0x18;
18414 spec->ext_mic.mux_idx = 0;
18415 spec->int_mic.pin = 0x12;
18416 spec->int_mic.mux_idx = 9;
18417 spec->auto_mic = 1;
18420 static void alc663_m51va_inithook(struct hda_codec *codec)
18422 alc663_m51va_speaker_automute(codec);
18423 alc_mic_automute(codec);
18426 /* ***************** Mode1 ******************************/
18427 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18429 static void alc663_mode1_setup(struct hda_codec *codec)
18431 struct alc_spec *spec = codec->spec;
18432 spec->ext_mic.pin = 0x18;
18433 spec->ext_mic.mux_idx = 0;
18434 spec->int_mic.pin = 0x19;
18435 spec->int_mic.mux_idx = 1;
18436 spec->auto_mic = 1;
18439 #define alc663_mode1_inithook alc663_m51va_inithook
18441 /* ***************** Mode2 ******************************/
18442 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18443 unsigned int res)
18445 switch (res >> 26) {
18446 case ALC880_HP_EVENT:
18447 alc662_f5z_speaker_automute(codec);
18448 break;
18449 case ALC880_MIC_EVENT:
18450 alc_mic_automute(codec);
18451 break;
18455 #define alc662_mode2_setup alc663_mode1_setup
18457 static void alc662_mode2_inithook(struct hda_codec *codec)
18459 alc662_f5z_speaker_automute(codec);
18460 alc_mic_automute(codec);
18462 /* ***************** Mode3 ******************************/
18463 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18464 unsigned int res)
18466 switch (res >> 26) {
18467 case ALC880_HP_EVENT:
18468 alc663_two_hp_m1_speaker_automute(codec);
18469 break;
18470 case ALC880_MIC_EVENT:
18471 alc_mic_automute(codec);
18472 break;
18476 #define alc663_mode3_setup alc663_mode1_setup
18478 static void alc663_mode3_inithook(struct hda_codec *codec)
18480 alc663_two_hp_m1_speaker_automute(codec);
18481 alc_mic_automute(codec);
18483 /* ***************** Mode4 ******************************/
18484 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18485 unsigned int res)
18487 switch (res >> 26) {
18488 case ALC880_HP_EVENT:
18489 alc663_21jd_two_speaker_automute(codec);
18490 break;
18491 case ALC880_MIC_EVENT:
18492 alc_mic_automute(codec);
18493 break;
18497 #define alc663_mode4_setup alc663_mode1_setup
18499 static void alc663_mode4_inithook(struct hda_codec *codec)
18501 alc663_21jd_two_speaker_automute(codec);
18502 alc_mic_automute(codec);
18504 /* ***************** Mode5 ******************************/
18505 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18506 unsigned int res)
18508 switch (res >> 26) {
18509 case ALC880_HP_EVENT:
18510 alc663_15jd_two_speaker_automute(codec);
18511 break;
18512 case ALC880_MIC_EVENT:
18513 alc_mic_automute(codec);
18514 break;
18518 #define alc663_mode5_setup alc663_mode1_setup
18520 static void alc663_mode5_inithook(struct hda_codec *codec)
18522 alc663_15jd_two_speaker_automute(codec);
18523 alc_mic_automute(codec);
18525 /* ***************** Mode6 ******************************/
18526 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18527 unsigned int res)
18529 switch (res >> 26) {
18530 case ALC880_HP_EVENT:
18531 alc663_two_hp_m2_speaker_automute(codec);
18532 break;
18533 case ALC880_MIC_EVENT:
18534 alc_mic_automute(codec);
18535 break;
18539 #define alc663_mode6_setup alc663_mode1_setup
18541 static void alc663_mode6_inithook(struct hda_codec *codec)
18543 alc663_two_hp_m2_speaker_automute(codec);
18544 alc_mic_automute(codec);
18547 /* ***************** Mode7 ******************************/
18548 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18549 unsigned int res)
18551 switch (res >> 26) {
18552 case ALC880_HP_EVENT:
18553 alc663_two_hp_m7_speaker_automute(codec);
18554 break;
18555 case ALC880_MIC_EVENT:
18556 alc_mic_automute(codec);
18557 break;
18561 #define alc663_mode7_setup alc663_mode1_setup
18563 static void alc663_mode7_inithook(struct hda_codec *codec)
18565 alc663_two_hp_m7_speaker_automute(codec);
18566 alc_mic_automute(codec);
18569 /* ***************** Mode8 ******************************/
18570 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18571 unsigned int res)
18573 switch (res >> 26) {
18574 case ALC880_HP_EVENT:
18575 alc663_two_hp_m8_speaker_automute(codec);
18576 break;
18577 case ALC880_MIC_EVENT:
18578 alc_mic_automute(codec);
18579 break;
18583 #define alc663_mode8_setup alc663_m51va_setup
18585 static void alc663_mode8_inithook(struct hda_codec *codec)
18587 alc663_two_hp_m8_speaker_automute(codec);
18588 alc_mic_automute(codec);
18591 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18593 unsigned int present;
18594 unsigned char bits;
18596 present = snd_hda_jack_detect(codec, 0x21);
18597 bits = present ? HDA_AMP_MUTE : 0;
18598 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18599 HDA_AMP_MUTE, bits);
18600 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18601 HDA_AMP_MUTE, bits);
18604 static void alc663_g71v_front_automute(struct hda_codec *codec)
18606 unsigned int present;
18607 unsigned char bits;
18609 present = snd_hda_jack_detect(codec, 0x15);
18610 bits = present ? HDA_AMP_MUTE : 0;
18611 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18612 HDA_AMP_MUTE, bits);
18615 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18616 unsigned int res)
18618 switch (res >> 26) {
18619 case ALC880_HP_EVENT:
18620 alc663_g71v_hp_automute(codec);
18621 break;
18622 case ALC880_FRONT_EVENT:
18623 alc663_g71v_front_automute(codec);
18624 break;
18625 case ALC880_MIC_EVENT:
18626 alc_mic_automute(codec);
18627 break;
18631 #define alc663_g71v_setup alc663_m51va_setup
18633 static void alc663_g71v_inithook(struct hda_codec *codec)
18635 alc663_g71v_front_automute(codec);
18636 alc663_g71v_hp_automute(codec);
18637 alc_mic_automute(codec);
18640 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18641 unsigned int res)
18643 switch (res >> 26) {
18644 case ALC880_HP_EVENT:
18645 alc663_m51va_speaker_automute(codec);
18646 break;
18647 case ALC880_MIC_EVENT:
18648 alc_mic_automute(codec);
18649 break;
18653 #define alc663_g50v_setup alc663_m51va_setup
18655 static void alc663_g50v_inithook(struct hda_codec *codec)
18657 alc663_m51va_speaker_automute(codec);
18658 alc_mic_automute(codec);
18661 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18662 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18663 ALC262_HIPPO_MASTER_SWITCH,
18665 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18666 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18667 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18669 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18670 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18671 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18672 { } /* end */
18675 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18676 /* Master Playback automatically created from Speaker and Headphone */
18677 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18678 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18679 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18680 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18683 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18684 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18686 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18687 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18688 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18689 { } /* end */
18692 #ifdef CONFIG_SND_HDA_POWER_SAVE
18693 #define alc662_loopbacks alc880_loopbacks
18694 #endif
18697 /* pcm configuration: identical with ALC880 */
18698 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18699 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18700 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18701 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18704 * configuration and preset
18706 static const char * const alc662_models[ALC662_MODEL_LAST] = {
18707 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18708 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18709 [ALC662_3ST_6ch] = "3stack-6ch",
18710 [ALC662_5ST_DIG] = "6stack-dig",
18711 [ALC662_LENOVO_101E] = "lenovo-101e",
18712 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18713 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18714 [ALC662_ECS] = "ecs",
18715 [ALC663_ASUS_M51VA] = "m51va",
18716 [ALC663_ASUS_G71V] = "g71v",
18717 [ALC663_ASUS_H13] = "h13",
18718 [ALC663_ASUS_G50V] = "g50v",
18719 [ALC663_ASUS_MODE1] = "asus-mode1",
18720 [ALC662_ASUS_MODE2] = "asus-mode2",
18721 [ALC663_ASUS_MODE3] = "asus-mode3",
18722 [ALC663_ASUS_MODE4] = "asus-mode4",
18723 [ALC663_ASUS_MODE5] = "asus-mode5",
18724 [ALC663_ASUS_MODE6] = "asus-mode6",
18725 [ALC663_ASUS_MODE7] = "asus-mode7",
18726 [ALC663_ASUS_MODE8] = "asus-mode8",
18727 [ALC272_DELL] = "dell",
18728 [ALC272_DELL_ZM1] = "dell-zm1",
18729 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18730 [ALC662_AUTO] = "auto",
18733 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18734 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18735 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18736 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18737 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18738 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18739 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18740 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18741 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18742 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18743 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18744 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18745 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18746 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18747 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18748 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18749 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18750 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18751 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18752 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18753 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18754 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18755 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18756 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18757 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18758 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18759 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18760 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18761 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18762 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18763 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18764 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18765 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18766 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18767 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18768 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18769 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18770 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18771 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18772 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18773 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18774 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18775 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18776 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18777 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18778 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18779 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18780 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18781 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18782 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18783 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18784 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18785 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18786 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18787 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18788 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18789 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18790 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18791 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18792 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18793 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18794 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18795 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18796 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18797 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18798 ALC662_3ST_6ch_DIG),
18799 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18800 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18801 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18802 ALC662_3ST_6ch_DIG),
18803 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18804 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18805 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18806 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18807 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18808 ALC662_3ST_6ch_DIG),
18809 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18810 ALC663_ASUS_H13),
18811 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E),
18815 static struct alc_config_preset alc662_presets[] = {
18816 [ALC662_3ST_2ch_DIG] = {
18817 .mixers = { alc662_3ST_2ch_mixer },
18818 .init_verbs = { alc662_init_verbs },
18819 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18820 .dac_nids = alc662_dac_nids,
18821 .dig_out_nid = ALC662_DIGOUT_NID,
18822 .dig_in_nid = ALC662_DIGIN_NID,
18823 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18824 .channel_mode = alc662_3ST_2ch_modes,
18825 .input_mux = &alc662_capture_source,
18827 [ALC662_3ST_6ch_DIG] = {
18828 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18829 .init_verbs = { alc662_init_verbs },
18830 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18831 .dac_nids = alc662_dac_nids,
18832 .dig_out_nid = ALC662_DIGOUT_NID,
18833 .dig_in_nid = ALC662_DIGIN_NID,
18834 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18835 .channel_mode = alc662_3ST_6ch_modes,
18836 .need_dac_fix = 1,
18837 .input_mux = &alc662_capture_source,
18839 [ALC662_3ST_6ch] = {
18840 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18841 .init_verbs = { alc662_init_verbs },
18842 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18843 .dac_nids = alc662_dac_nids,
18844 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18845 .channel_mode = alc662_3ST_6ch_modes,
18846 .need_dac_fix = 1,
18847 .input_mux = &alc662_capture_source,
18849 [ALC662_5ST_DIG] = {
18850 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18851 .init_verbs = { alc662_init_verbs },
18852 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18853 .dac_nids = alc662_dac_nids,
18854 .dig_out_nid = ALC662_DIGOUT_NID,
18855 .dig_in_nid = ALC662_DIGIN_NID,
18856 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18857 .channel_mode = alc662_5stack_modes,
18858 .input_mux = &alc662_capture_source,
18860 [ALC662_LENOVO_101E] = {
18861 .mixers = { alc662_lenovo_101e_mixer },
18862 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18863 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18864 .dac_nids = alc662_dac_nids,
18865 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18866 .channel_mode = alc662_3ST_2ch_modes,
18867 .input_mux = &alc662_lenovo_101e_capture_source,
18868 .unsol_event = alc662_lenovo_101e_unsol_event,
18869 .init_hook = alc662_lenovo_101e_all_automute,
18871 [ALC662_ASUS_EEEPC_P701] = {
18872 .mixers = { alc662_eeepc_p701_mixer },
18873 .init_verbs = { alc662_init_verbs,
18874 alc662_eeepc_sue_init_verbs },
18875 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18876 .dac_nids = alc662_dac_nids,
18877 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18878 .channel_mode = alc662_3ST_2ch_modes,
18879 .unsol_event = alc662_eeepc_unsol_event,
18880 .setup = alc662_eeepc_setup,
18881 .init_hook = alc662_eeepc_inithook,
18883 [ALC662_ASUS_EEEPC_EP20] = {
18884 .mixers = { alc662_eeepc_ep20_mixer,
18885 alc662_chmode_mixer },
18886 .init_verbs = { alc662_init_verbs,
18887 alc662_eeepc_ep20_sue_init_verbs },
18888 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18889 .dac_nids = alc662_dac_nids,
18890 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18891 .channel_mode = alc662_3ST_6ch_modes,
18892 .input_mux = &alc662_lenovo_101e_capture_source,
18893 .unsol_event = alc662_eeepc_unsol_event,
18894 .setup = alc662_eeepc_ep20_setup,
18895 .init_hook = alc662_eeepc_ep20_inithook,
18897 [ALC662_ECS] = {
18898 .mixers = { alc662_ecs_mixer },
18899 .init_verbs = { alc662_init_verbs,
18900 alc662_ecs_init_verbs },
18901 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18902 .dac_nids = alc662_dac_nids,
18903 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18904 .channel_mode = alc662_3ST_2ch_modes,
18905 .unsol_event = alc662_eeepc_unsol_event,
18906 .setup = alc662_eeepc_setup,
18907 .init_hook = alc662_eeepc_inithook,
18909 [ALC663_ASUS_M51VA] = {
18910 .mixers = { alc663_m51va_mixer },
18911 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18912 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18913 .dac_nids = alc662_dac_nids,
18914 .dig_out_nid = ALC662_DIGOUT_NID,
18915 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18916 .channel_mode = alc662_3ST_2ch_modes,
18917 .unsol_event = alc663_m51va_unsol_event,
18918 .setup = alc663_m51va_setup,
18919 .init_hook = alc663_m51va_inithook,
18921 [ALC663_ASUS_G71V] = {
18922 .mixers = { alc663_g71v_mixer },
18923 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18924 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18925 .dac_nids = alc662_dac_nids,
18926 .dig_out_nid = ALC662_DIGOUT_NID,
18927 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18928 .channel_mode = alc662_3ST_2ch_modes,
18929 .unsol_event = alc663_g71v_unsol_event,
18930 .setup = alc663_g71v_setup,
18931 .init_hook = alc663_g71v_inithook,
18933 [ALC663_ASUS_H13] = {
18934 .mixers = { alc663_m51va_mixer },
18935 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18936 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18937 .dac_nids = alc662_dac_nids,
18938 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18939 .channel_mode = alc662_3ST_2ch_modes,
18940 .unsol_event = alc663_m51va_unsol_event,
18941 .init_hook = alc663_m51va_inithook,
18943 [ALC663_ASUS_G50V] = {
18944 .mixers = { alc663_g50v_mixer },
18945 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18946 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18947 .dac_nids = alc662_dac_nids,
18948 .dig_out_nid = ALC662_DIGOUT_NID,
18949 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18950 .channel_mode = alc662_3ST_6ch_modes,
18951 .input_mux = &alc663_capture_source,
18952 .unsol_event = alc663_g50v_unsol_event,
18953 .setup = alc663_g50v_setup,
18954 .init_hook = alc663_g50v_inithook,
18956 [ALC663_ASUS_MODE1] = {
18957 .mixers = { alc663_m51va_mixer },
18958 .cap_mixer = alc662_auto_capture_mixer,
18959 .init_verbs = { alc662_init_verbs,
18960 alc663_21jd_amic_init_verbs },
18961 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18962 .hp_nid = 0x03,
18963 .dac_nids = alc662_dac_nids,
18964 .dig_out_nid = ALC662_DIGOUT_NID,
18965 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18966 .channel_mode = alc662_3ST_2ch_modes,
18967 .unsol_event = alc663_mode1_unsol_event,
18968 .setup = alc663_mode1_setup,
18969 .init_hook = alc663_mode1_inithook,
18971 [ALC662_ASUS_MODE2] = {
18972 .mixers = { alc662_1bjd_mixer },
18973 .cap_mixer = alc662_auto_capture_mixer,
18974 .init_verbs = { alc662_init_verbs,
18975 alc662_1bjd_amic_init_verbs },
18976 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18977 .dac_nids = alc662_dac_nids,
18978 .dig_out_nid = ALC662_DIGOUT_NID,
18979 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18980 .channel_mode = alc662_3ST_2ch_modes,
18981 .unsol_event = alc662_mode2_unsol_event,
18982 .setup = alc662_mode2_setup,
18983 .init_hook = alc662_mode2_inithook,
18985 [ALC663_ASUS_MODE3] = {
18986 .mixers = { alc663_two_hp_m1_mixer },
18987 .cap_mixer = alc662_auto_capture_mixer,
18988 .init_verbs = { alc662_init_verbs,
18989 alc663_two_hp_amic_m1_init_verbs },
18990 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18991 .hp_nid = 0x03,
18992 .dac_nids = alc662_dac_nids,
18993 .dig_out_nid = ALC662_DIGOUT_NID,
18994 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18995 .channel_mode = alc662_3ST_2ch_modes,
18996 .unsol_event = alc663_mode3_unsol_event,
18997 .setup = alc663_mode3_setup,
18998 .init_hook = alc663_mode3_inithook,
19000 [ALC663_ASUS_MODE4] = {
19001 .mixers = { alc663_asus_21jd_clfe_mixer },
19002 .cap_mixer = alc662_auto_capture_mixer,
19003 .init_verbs = { alc662_init_verbs,
19004 alc663_21jd_amic_init_verbs},
19005 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19006 .hp_nid = 0x03,
19007 .dac_nids = alc662_dac_nids,
19008 .dig_out_nid = ALC662_DIGOUT_NID,
19009 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19010 .channel_mode = alc662_3ST_2ch_modes,
19011 .unsol_event = alc663_mode4_unsol_event,
19012 .setup = alc663_mode4_setup,
19013 .init_hook = alc663_mode4_inithook,
19015 [ALC663_ASUS_MODE5] = {
19016 .mixers = { alc663_asus_15jd_clfe_mixer },
19017 .cap_mixer = alc662_auto_capture_mixer,
19018 .init_verbs = { alc662_init_verbs,
19019 alc663_15jd_amic_init_verbs },
19020 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19021 .hp_nid = 0x03,
19022 .dac_nids = alc662_dac_nids,
19023 .dig_out_nid = ALC662_DIGOUT_NID,
19024 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19025 .channel_mode = alc662_3ST_2ch_modes,
19026 .unsol_event = alc663_mode5_unsol_event,
19027 .setup = alc663_mode5_setup,
19028 .init_hook = alc663_mode5_inithook,
19030 [ALC663_ASUS_MODE6] = {
19031 .mixers = { alc663_two_hp_m2_mixer },
19032 .cap_mixer = alc662_auto_capture_mixer,
19033 .init_verbs = { alc662_init_verbs,
19034 alc663_two_hp_amic_m2_init_verbs },
19035 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19036 .hp_nid = 0x03,
19037 .dac_nids = alc662_dac_nids,
19038 .dig_out_nid = ALC662_DIGOUT_NID,
19039 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19040 .channel_mode = alc662_3ST_2ch_modes,
19041 .unsol_event = alc663_mode6_unsol_event,
19042 .setup = alc663_mode6_setup,
19043 .init_hook = alc663_mode6_inithook,
19045 [ALC663_ASUS_MODE7] = {
19046 .mixers = { alc663_mode7_mixer },
19047 .cap_mixer = alc662_auto_capture_mixer,
19048 .init_verbs = { alc662_init_verbs,
19049 alc663_mode7_init_verbs },
19050 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19051 .hp_nid = 0x03,
19052 .dac_nids = alc662_dac_nids,
19053 .dig_out_nid = ALC662_DIGOUT_NID,
19054 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19055 .channel_mode = alc662_3ST_2ch_modes,
19056 .unsol_event = alc663_mode7_unsol_event,
19057 .setup = alc663_mode7_setup,
19058 .init_hook = alc663_mode7_inithook,
19060 [ALC663_ASUS_MODE8] = {
19061 .mixers = { alc663_mode8_mixer },
19062 .cap_mixer = alc662_auto_capture_mixer,
19063 .init_verbs = { alc662_init_verbs,
19064 alc663_mode8_init_verbs },
19065 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19066 .hp_nid = 0x03,
19067 .dac_nids = alc662_dac_nids,
19068 .dig_out_nid = ALC662_DIGOUT_NID,
19069 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19070 .channel_mode = alc662_3ST_2ch_modes,
19071 .unsol_event = alc663_mode8_unsol_event,
19072 .setup = alc663_mode8_setup,
19073 .init_hook = alc663_mode8_inithook,
19075 [ALC272_DELL] = {
19076 .mixers = { alc663_m51va_mixer },
19077 .cap_mixer = alc272_auto_capture_mixer,
19078 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
19079 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19080 .dac_nids = alc662_dac_nids,
19081 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19082 .adc_nids = alc272_adc_nids,
19083 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
19084 .capsrc_nids = alc272_capsrc_nids,
19085 .channel_mode = alc662_3ST_2ch_modes,
19086 .unsol_event = alc663_m51va_unsol_event,
19087 .setup = alc663_m51va_setup,
19088 .init_hook = alc663_m51va_inithook,
19090 [ALC272_DELL_ZM1] = {
19091 .mixers = { alc663_m51va_mixer },
19092 .cap_mixer = alc662_auto_capture_mixer,
19093 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
19094 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19095 .dac_nids = alc662_dac_nids,
19096 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19097 .adc_nids = alc662_adc_nids,
19098 .num_adc_nids = 1,
19099 .capsrc_nids = alc662_capsrc_nids,
19100 .channel_mode = alc662_3ST_2ch_modes,
19101 .unsol_event = alc663_m51va_unsol_event,
19102 .setup = alc663_m51va_setup,
19103 .init_hook = alc663_m51va_inithook,
19105 [ALC272_SAMSUNG_NC10] = {
19106 .mixers = { alc272_nc10_mixer },
19107 .init_verbs = { alc662_init_verbs,
19108 alc663_21jd_amic_init_verbs },
19109 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19110 .dac_nids = alc272_dac_nids,
19111 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19112 .channel_mode = alc662_3ST_2ch_modes,
19113 /*.input_mux = &alc272_nc10_capture_source,*/
19114 .unsol_event = alc663_mode4_unsol_event,
19115 .setup = alc663_mode4_setup,
19116 .init_hook = alc663_mode4_inithook,
19122 * BIOS auto configuration
19125 /* convert from MIX nid to DAC */
19126 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19128 if (nid == 0x0f)
19129 return 0x02;
19130 else if (nid >= 0x0c && nid <= 0x0e)
19131 return nid - 0x0c + 0x02;
19132 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19133 return 0x25;
19134 else
19135 return 0;
19138 /* get MIX nid connected to the given pin targeted to DAC */
19139 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19140 hda_nid_t dac)
19142 hda_nid_t mix[5];
19143 int i, num;
19145 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19146 for (i = 0; i < num; i++) {
19147 if (alc662_mix_to_dac(mix[i]) == dac)
19148 return mix[i];
19150 return 0;
19153 /* look for an empty DAC slot */
19154 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19156 struct alc_spec *spec = codec->spec;
19157 hda_nid_t srcs[5];
19158 int i, j, num;
19160 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19161 if (num < 0)
19162 return 0;
19163 for (i = 0; i < num; i++) {
19164 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19165 if (!nid)
19166 continue;
19167 for (j = 0; j < spec->multiout.num_dacs; j++)
19168 if (spec->multiout.dac_nids[j] == nid)
19169 break;
19170 if (j >= spec->multiout.num_dacs)
19171 return nid;
19173 return 0;
19176 /* fill in the dac_nids table from the parsed pin configuration */
19177 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19178 const struct auto_pin_cfg *cfg)
19180 struct alc_spec *spec = codec->spec;
19181 int i;
19182 hda_nid_t dac;
19184 spec->multiout.dac_nids = spec->private_dac_nids;
19185 for (i = 0; i < cfg->line_outs; i++) {
19186 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19187 if (!dac)
19188 continue;
19189 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19191 return 0;
19194 static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19195 hda_nid_t nid, int idx, unsigned int chs)
19197 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx,
19198 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19201 static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19202 hda_nid_t nid, int idx, unsigned int chs)
19204 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
19205 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19208 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19209 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19210 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19211 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19212 #define alc662_add_stereo_vol(spec, pfx, nid) \
19213 alc662_add_vol_ctl(spec, pfx, nid, 3)
19214 #define alc662_add_stereo_sw(spec, pfx, nid) \
19215 alc662_add_sw_ctl(spec, pfx, nid, 3)
19217 /* add playback controls from the parsed DAC table */
19218 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19219 const struct auto_pin_cfg *cfg)
19221 struct alc_spec *spec = codec->spec;
19222 static const char * const chname[4] = {
19223 "Front", "Surround", NULL /*CLFE*/, "Side"
19225 const char *pfx = alc_get_line_out_pfx(cfg, true);
19226 hda_nid_t nid, mix;
19227 int i, err;
19229 for (i = 0; i < cfg->line_outs; i++) {
19230 nid = spec->multiout.dac_nids[i];
19231 if (!nid)
19232 continue;
19233 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19234 if (!mix)
19235 continue;
19236 if (!pfx && i == 2) {
19237 /* Center/LFE */
19238 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19239 if (err < 0)
19240 return err;
19241 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19242 if (err < 0)
19243 return err;
19244 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19245 if (err < 0)
19246 return err;
19247 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19248 if (err < 0)
19249 return err;
19250 } else {
19251 const char *name = pfx;
19252 int index = i;
19253 if (!name) {
19254 name = chname[i];
19255 index = 0;
19257 err = __alc662_add_vol_ctl(spec, name, nid, index, 3);
19258 if (err < 0)
19259 return err;
19260 err = __alc662_add_sw_ctl(spec, name, mix, index, 3);
19261 if (err < 0)
19262 return err;
19265 return 0;
19268 /* add playback controls for speaker and HP outputs */
19269 /* return DAC nid if any new DAC is assigned */
19270 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19271 const char *pfx)
19273 struct alc_spec *spec = codec->spec;
19274 hda_nid_t nid, mix;
19275 int err;
19277 if (!pin)
19278 return 0;
19279 nid = alc662_look_for_dac(codec, pin);
19280 if (!nid) {
19281 /* the corresponding DAC is already occupied */
19282 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19283 return 0; /* no way */
19284 /* create a switch only */
19285 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19286 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19289 mix = alc662_dac_to_mix(codec, pin, nid);
19290 if (!mix)
19291 return 0;
19292 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19293 if (err < 0)
19294 return err;
19295 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19296 if (err < 0)
19297 return err;
19298 return nid;
19301 /* create playback/capture controls for input pins */
19302 #define alc662_auto_create_input_ctls \
19303 alc882_auto_create_input_ctls
19305 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19306 hda_nid_t nid, int pin_type,
19307 hda_nid_t dac)
19309 int i, num;
19310 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19312 alc_set_pin_output(codec, nid, pin_type);
19313 /* need the manual connection? */
19314 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19315 if (num <= 1)
19316 return;
19317 for (i = 0; i < num; i++) {
19318 if (alc662_mix_to_dac(srcs[i]) != dac)
19319 continue;
19320 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19321 return;
19325 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19327 struct alc_spec *spec = codec->spec;
19328 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19329 int i;
19331 for (i = 0; i <= HDA_SIDE; i++) {
19332 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19333 if (nid)
19334 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19335 spec->multiout.dac_nids[i]);
19339 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19341 struct alc_spec *spec = codec->spec;
19342 hda_nid_t pin;
19344 pin = spec->autocfg.hp_pins[0];
19345 if (pin)
19346 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19347 spec->multiout.hp_nid);
19348 pin = spec->autocfg.speaker_pins[0];
19349 if (pin)
19350 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19351 spec->multiout.extra_out_nid[0]);
19354 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19356 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19358 struct alc_spec *spec = codec->spec;
19359 struct auto_pin_cfg *cfg = &spec->autocfg;
19360 int i;
19362 for (i = 0; i < cfg->num_inputs; i++) {
19363 hda_nid_t nid = cfg->inputs[i].pin;
19364 if (alc_is_input_pin(codec, nid)) {
19365 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19366 if (nid != ALC662_PIN_CD_NID &&
19367 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19368 snd_hda_codec_write(codec, nid, 0,
19369 AC_VERB_SET_AMP_GAIN_MUTE,
19370 AMP_OUT_MUTE);
19375 #define alc662_auto_init_input_src alc882_auto_init_input_src
19377 static int alc662_parse_auto_config(struct hda_codec *codec)
19379 struct alc_spec *spec = codec->spec;
19380 int err;
19381 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19383 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19384 alc662_ignore);
19385 if (err < 0)
19386 return err;
19387 if (!spec->autocfg.line_outs)
19388 return 0; /* can't find valid BIOS pin config */
19390 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19391 if (err < 0)
19392 return err;
19393 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19394 if (err < 0)
19395 return err;
19396 err = alc662_auto_create_extra_out(codec,
19397 spec->autocfg.speaker_pins[0],
19398 "Speaker");
19399 if (err < 0)
19400 return err;
19401 if (err)
19402 spec->multiout.extra_out_nid[0] = err;
19403 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19404 "Headphone");
19405 if (err < 0)
19406 return err;
19407 if (err)
19408 spec->multiout.hp_nid = err;
19409 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19410 if (err < 0)
19411 return err;
19413 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19415 alc_auto_parse_digital(codec);
19417 if (spec->kctls.list)
19418 add_mixer(spec, spec->kctls.list);
19420 spec->num_mux_defs = 1;
19421 spec->input_mux = &spec->private_imux[0];
19423 add_verb(spec, alc662_init_verbs);
19424 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19425 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19426 add_verb(spec, alc663_init_verbs);
19428 if (codec->vendor_id == 0x10ec0272)
19429 add_verb(spec, alc272_init_verbs);
19431 err = alc_auto_add_mic_boost(codec);
19432 if (err < 0)
19433 return err;
19435 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19436 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19437 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19438 else
19439 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19441 return 1;
19444 /* additional initialization for auto-configuration model */
19445 static void alc662_auto_init(struct hda_codec *codec)
19447 struct alc_spec *spec = codec->spec;
19448 alc662_auto_init_multi_out(codec);
19449 alc662_auto_init_hp_out(codec);
19450 alc662_auto_init_analog_input(codec);
19451 alc662_auto_init_input_src(codec);
19452 alc_auto_init_digital(codec);
19453 if (spec->unsol_event)
19454 alc_inithook(codec);
19457 static void alc272_fixup_mario(struct hda_codec *codec,
19458 const struct alc_fixup *fix, int action)
19460 if (action != ALC_FIXUP_ACT_PROBE)
19461 return;
19462 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19463 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19464 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19465 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19466 (0 << AC_AMPCAP_MUTE_SHIFT)))
19467 printk(KERN_WARNING
19468 "hda_codec: failed to override amp caps for NID 0x2\n");
19471 enum {
19472 ALC662_FIXUP_ASPIRE,
19473 ALC662_FIXUP_IDEAPAD,
19474 ALC272_FIXUP_MARIO,
19475 ALC662_FIXUP_CZC_P10T,
19476 ALC662_FIXUP_SKU_IGNORE,
19479 static const struct alc_fixup alc662_fixups[] = {
19480 [ALC662_FIXUP_ASPIRE] = {
19481 .type = ALC_FIXUP_PINS,
19482 .v.pins = (const struct alc_pincfg[]) {
19483 { 0x15, 0x99130112 }, /* subwoofer */
19487 [ALC662_FIXUP_IDEAPAD] = {
19488 .type = ALC_FIXUP_PINS,
19489 .v.pins = (const struct alc_pincfg[]) {
19490 { 0x17, 0x99130112 }, /* subwoofer */
19494 [ALC272_FIXUP_MARIO] = {
19495 .type = ALC_FIXUP_FUNC,
19496 .v.func = alc272_fixup_mario,
19498 [ALC662_FIXUP_CZC_P10T] = {
19499 .type = ALC_FIXUP_VERBS,
19500 .v.verbs = (const struct hda_verb[]) {
19501 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19505 [ALC662_FIXUP_SKU_IGNORE] = {
19506 .type = ALC_FIXUP_SKU,
19507 .v.sku = ALC_FIXUP_SKU_IGNORE,
19511 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19512 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19513 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
19514 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19515 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19516 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19517 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19518 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19522 static const struct alc_model_fixup alc662_fixup_models[] = {
19523 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19528 static int patch_alc662(struct hda_codec *codec)
19530 struct alc_spec *spec;
19531 int err, board_config;
19532 int coef;
19534 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19535 if (!spec)
19536 return -ENOMEM;
19538 codec->spec = spec;
19540 alc_auto_parse_customize_define(codec);
19542 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19544 coef = alc_read_coef_idx(codec, 0);
19545 if (coef == 0x8020 || coef == 0x8011)
19546 alc_codec_rename(codec, "ALC661");
19547 else if (coef & (1 << 14) &&
19548 codec->bus->pci->subsystem_vendor == 0x1025 &&
19549 spec->cdefine.platform_type == 1)
19550 alc_codec_rename(codec, "ALC272X");
19551 else if (coef == 0x4011)
19552 alc_codec_rename(codec, "ALC656");
19554 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19555 alc662_models,
19556 alc662_cfg_tbl);
19557 if (board_config < 0) {
19558 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19559 codec->chip_name);
19560 board_config = ALC662_AUTO;
19563 if (board_config == ALC662_AUTO) {
19564 alc_pick_fixup(codec, alc662_fixup_models,
19565 alc662_fixup_tbl, alc662_fixups);
19566 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19567 /* automatic parse from the BIOS config */
19568 err = alc662_parse_auto_config(codec);
19569 if (err < 0) {
19570 alc_free(codec);
19571 return err;
19572 } else if (!err) {
19573 printk(KERN_INFO
19574 "hda_codec: Cannot set up configuration "
19575 "from BIOS. Using base mode...\n");
19576 board_config = ALC662_3ST_2ch_DIG;
19580 if (has_cdefine_beep(codec)) {
19581 err = snd_hda_attach_beep_device(codec, 0x1);
19582 if (err < 0) {
19583 alc_free(codec);
19584 return err;
19588 if (board_config != ALC662_AUTO)
19589 setup_preset(codec, &alc662_presets[board_config]);
19591 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19592 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19594 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19595 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19597 if (!spec->adc_nids) {
19598 spec->adc_nids = alc662_adc_nids;
19599 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19601 if (!spec->capsrc_nids)
19602 spec->capsrc_nids = alc662_capsrc_nids;
19604 if (!spec->cap_mixer)
19605 set_capture_mixer(codec);
19607 if (has_cdefine_beep(codec)) {
19608 switch (codec->vendor_id) {
19609 case 0x10ec0662:
19610 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19611 break;
19612 case 0x10ec0272:
19613 case 0x10ec0663:
19614 case 0x10ec0665:
19615 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19616 break;
19617 case 0x10ec0273:
19618 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19619 break;
19622 spec->vmaster_nid = 0x02;
19624 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19626 codec->patch_ops = alc_patch_ops;
19627 if (board_config == ALC662_AUTO)
19628 spec->init_hook = alc662_auto_init;
19630 alc_init_jacks(codec);
19632 #ifdef CONFIG_SND_HDA_POWER_SAVE
19633 if (!spec->loopback.amplist)
19634 spec->loopback.amplist = alc662_loopbacks;
19635 #endif
19637 return 0;
19640 static int patch_alc888(struct hda_codec *codec)
19642 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19643 kfree(codec->chip_name);
19644 if (codec->vendor_id == 0x10ec0887)
19645 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19646 else
19647 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19648 if (!codec->chip_name) {
19649 alc_free(codec);
19650 return -ENOMEM;
19652 return patch_alc662(codec);
19654 return patch_alc882(codec);
19658 * ALC680 support
19660 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19661 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19662 #define alc680_modes alc260_modes
19664 static hda_nid_t alc680_dac_nids[3] = {
19665 /* Lout1, Lout2, hp */
19666 0x02, 0x03, 0x04
19669 static hda_nid_t alc680_adc_nids[3] = {
19670 /* ADC0-2 */
19671 /* DMIC, MIC, Line-in*/
19672 0x07, 0x08, 0x09
19676 * Analog capture ADC cgange
19678 static void alc680_rec_autoswitch(struct hda_codec *codec)
19680 struct alc_spec *spec = codec->spec;
19681 struct auto_pin_cfg *cfg = &spec->autocfg;
19682 int pin_found = 0;
19683 int type_found = AUTO_PIN_LAST;
19684 hda_nid_t nid;
19685 int i;
19687 for (i = 0; i < cfg->num_inputs; i++) {
19688 nid = cfg->inputs[i].pin;
19689 if (!(snd_hda_query_pin_caps(codec, nid) &
19690 AC_PINCAP_PRES_DETECT))
19691 continue;
19692 if (snd_hda_jack_detect(codec, nid)) {
19693 if (cfg->inputs[i].type < type_found) {
19694 type_found = cfg->inputs[i].type;
19695 pin_found = nid;
19700 nid = 0x07;
19701 if (pin_found)
19702 snd_hda_get_connections(codec, pin_found, &nid, 1);
19704 if (nid != spec->cur_adc)
19705 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19706 spec->cur_adc = nid;
19707 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19708 spec->cur_adc_format);
19711 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19712 struct hda_codec *codec,
19713 unsigned int stream_tag,
19714 unsigned int format,
19715 struct snd_pcm_substream *substream)
19717 struct alc_spec *spec = codec->spec;
19719 spec->cur_adc = 0x07;
19720 spec->cur_adc_stream_tag = stream_tag;
19721 spec->cur_adc_format = format;
19723 alc680_rec_autoswitch(codec);
19724 return 0;
19727 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19728 struct hda_codec *codec,
19729 struct snd_pcm_substream *substream)
19731 snd_hda_codec_cleanup_stream(codec, 0x07);
19732 snd_hda_codec_cleanup_stream(codec, 0x08);
19733 snd_hda_codec_cleanup_stream(codec, 0x09);
19734 return 0;
19737 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19738 .substreams = 1, /* can be overridden */
19739 .channels_min = 2,
19740 .channels_max = 2,
19741 /* NID is set in alc_build_pcms */
19742 .ops = {
19743 .prepare = alc680_capture_pcm_prepare,
19744 .cleanup = alc680_capture_pcm_cleanup
19748 static struct snd_kcontrol_new alc680_base_mixer[] = {
19749 /* output mixer control */
19750 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19751 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19752 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19753 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19754 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19755 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19756 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19760 static struct hda_bind_ctls alc680_bind_cap_vol = {
19761 .ops = &snd_hda_bind_vol,
19762 .values = {
19763 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19764 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19765 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19770 static struct hda_bind_ctls alc680_bind_cap_switch = {
19771 .ops = &snd_hda_bind_sw,
19772 .values = {
19773 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19774 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19775 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19780 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19781 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19782 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19783 { } /* end */
19787 * generic initialization of ADC, input mixers and output mixers
19789 static struct hda_verb alc680_init_verbs[] = {
19790 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19791 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19792 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19794 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19795 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19796 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19797 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19798 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19799 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19801 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19802 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19803 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19804 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19805 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19807 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19808 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19809 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19814 /* toggle speaker-output according to the hp-jack state */
19815 static void alc680_base_setup(struct hda_codec *codec)
19817 struct alc_spec *spec = codec->spec;
19819 spec->autocfg.hp_pins[0] = 0x16;
19820 spec->autocfg.speaker_pins[0] = 0x14;
19821 spec->autocfg.speaker_pins[1] = 0x15;
19822 spec->autocfg.num_inputs = 2;
19823 spec->autocfg.inputs[0].pin = 0x18;
19824 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19825 spec->autocfg.inputs[1].pin = 0x19;
19826 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19829 static void alc680_unsol_event(struct hda_codec *codec,
19830 unsigned int res)
19832 if ((res >> 26) == ALC880_HP_EVENT)
19833 alc_automute_amp(codec);
19834 if ((res >> 26) == ALC880_MIC_EVENT)
19835 alc680_rec_autoswitch(codec);
19838 static void alc680_inithook(struct hda_codec *codec)
19840 alc_automute_amp(codec);
19841 alc680_rec_autoswitch(codec);
19844 /* create input playback/capture controls for the given pin */
19845 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19846 const char *ctlname, int idx)
19848 hda_nid_t dac;
19849 int err;
19851 switch (nid) {
19852 case 0x14:
19853 dac = 0x02;
19854 break;
19855 case 0x15:
19856 dac = 0x03;
19857 break;
19858 case 0x16:
19859 dac = 0x04;
19860 break;
19861 default:
19862 return 0;
19864 if (spec->multiout.dac_nids[0] != dac &&
19865 spec->multiout.dac_nids[1] != dac) {
19866 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19867 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19868 HDA_OUTPUT));
19869 if (err < 0)
19870 return err;
19872 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19873 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19875 if (err < 0)
19876 return err;
19877 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19880 return 0;
19883 /* add playback controls from the parsed DAC table */
19884 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19885 const struct auto_pin_cfg *cfg)
19887 hda_nid_t nid;
19888 int err;
19890 spec->multiout.dac_nids = spec->private_dac_nids;
19892 nid = cfg->line_out_pins[0];
19893 if (nid) {
19894 const char *name;
19895 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19896 name = "Speaker";
19897 else
19898 name = "Front";
19899 err = alc680_new_analog_output(spec, nid, name, 0);
19900 if (err < 0)
19901 return err;
19904 nid = cfg->speaker_pins[0];
19905 if (nid) {
19906 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19907 if (err < 0)
19908 return err;
19910 nid = cfg->hp_pins[0];
19911 if (nid) {
19912 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19913 if (err < 0)
19914 return err;
19917 return 0;
19920 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19921 hda_nid_t nid, int pin_type)
19923 alc_set_pin_output(codec, nid, pin_type);
19926 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19928 struct alc_spec *spec = codec->spec;
19929 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19930 if (nid) {
19931 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19932 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19936 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19938 struct alc_spec *spec = codec->spec;
19939 hda_nid_t pin;
19941 pin = spec->autocfg.hp_pins[0];
19942 if (pin)
19943 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19944 pin = spec->autocfg.speaker_pins[0];
19945 if (pin)
19946 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19949 /* pcm configuration: identical with ALC880 */
19950 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19951 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19952 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19953 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19954 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19957 * BIOS auto configuration
19959 static int alc680_parse_auto_config(struct hda_codec *codec)
19961 struct alc_spec *spec = codec->spec;
19962 int err;
19963 static hda_nid_t alc680_ignore[] = { 0 };
19965 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19966 alc680_ignore);
19967 if (err < 0)
19968 return err;
19970 if (!spec->autocfg.line_outs) {
19971 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19972 spec->multiout.max_channels = 2;
19973 spec->no_analog = 1;
19974 goto dig_only;
19976 return 0; /* can't find valid BIOS pin config */
19978 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19979 if (err < 0)
19980 return err;
19982 spec->multiout.max_channels = 2;
19984 dig_only:
19985 /* digital only support output */
19986 alc_auto_parse_digital(codec);
19987 if (spec->kctls.list)
19988 add_mixer(spec, spec->kctls.list);
19990 add_verb(spec, alc680_init_verbs);
19992 err = alc_auto_add_mic_boost(codec);
19993 if (err < 0)
19994 return err;
19996 return 1;
19999 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
20001 /* init callback for auto-configuration model -- overriding the default init */
20002 static void alc680_auto_init(struct hda_codec *codec)
20004 struct alc_spec *spec = codec->spec;
20005 alc680_auto_init_multi_out(codec);
20006 alc680_auto_init_hp_out(codec);
20007 alc680_auto_init_analog_input(codec);
20008 alc_auto_init_digital(codec);
20009 if (spec->unsol_event)
20010 alc_inithook(codec);
20014 * configuration and preset
20016 static const char * const alc680_models[ALC680_MODEL_LAST] = {
20017 [ALC680_BASE] = "base",
20018 [ALC680_AUTO] = "auto",
20021 static struct snd_pci_quirk alc680_cfg_tbl[] = {
20022 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
20026 static struct alc_config_preset alc680_presets[] = {
20027 [ALC680_BASE] = {
20028 .mixers = { alc680_base_mixer },
20029 .cap_mixer = alc680_master_capture_mixer,
20030 .init_verbs = { alc680_init_verbs },
20031 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
20032 .dac_nids = alc680_dac_nids,
20033 .dig_out_nid = ALC680_DIGOUT_NID,
20034 .num_channel_mode = ARRAY_SIZE(alc680_modes),
20035 .channel_mode = alc680_modes,
20036 .unsol_event = alc680_unsol_event,
20037 .setup = alc680_base_setup,
20038 .init_hook = alc680_inithook,
20043 static int patch_alc680(struct hda_codec *codec)
20045 struct alc_spec *spec;
20046 int board_config;
20047 int err;
20049 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
20050 if (spec == NULL)
20051 return -ENOMEM;
20053 codec->spec = spec;
20055 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
20056 alc680_models,
20057 alc680_cfg_tbl);
20059 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
20060 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
20061 codec->chip_name);
20062 board_config = ALC680_AUTO;
20065 if (board_config == ALC680_AUTO) {
20066 /* automatic parse from the BIOS config */
20067 err = alc680_parse_auto_config(codec);
20068 if (err < 0) {
20069 alc_free(codec);
20070 return err;
20071 } else if (!err) {
20072 printk(KERN_INFO
20073 "hda_codec: Cannot set up configuration "
20074 "from BIOS. Using base mode...\n");
20075 board_config = ALC680_BASE;
20079 if (board_config != ALC680_AUTO)
20080 setup_preset(codec, &alc680_presets[board_config]);
20082 spec->stream_analog_playback = &alc680_pcm_analog_playback;
20083 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
20084 spec->stream_digital_playback = &alc680_pcm_digital_playback;
20085 spec->stream_digital_capture = &alc680_pcm_digital_capture;
20087 if (!spec->adc_nids) {
20088 spec->adc_nids = alc680_adc_nids;
20089 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
20092 if (!spec->cap_mixer)
20093 set_capture_mixer(codec);
20095 spec->vmaster_nid = 0x02;
20097 codec->patch_ops = alc_patch_ops;
20098 if (board_config == ALC680_AUTO)
20099 spec->init_hook = alc680_auto_init;
20101 return 0;
20105 * patch entries
20107 static struct hda_codec_preset snd_hda_preset_realtek[] = {
20108 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
20109 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
20110 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
20111 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
20112 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
20113 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
20114 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
20115 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
20116 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
20117 .patch = patch_alc861 },
20118 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
20119 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
20120 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
20121 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
20122 .patch = patch_alc882 },
20123 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
20124 .patch = patch_alc662 },
20125 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
20126 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
20127 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
20128 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
20129 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
20130 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
20131 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
20132 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
20133 .patch = patch_alc882 },
20134 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
20135 .patch = patch_alc882 },
20136 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
20137 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
20138 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
20139 .patch = patch_alc882 },
20140 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20141 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20142 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20143 {} /* terminator */
20146 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20148 MODULE_LICENSE("GPL");
20149 MODULE_DESCRIPTION("Realtek HD-audio codec");
20151 static struct hda_codec_preset_list realtek_list = {
20152 .preset = snd_hda_preset_realtek,
20153 .owner = THIS_MODULE,
20156 static int __init patch_realtek_init(void)
20158 return snd_hda_add_codec_preset(&realtek_list);
20161 static void __exit patch_realtek_exit(void)
20163 snd_hda_delete_codec_preset(&realtek_list);
20166 module_init(patch_realtek_init)
20167 module_exit(patch_realtek_exit)