ALSA: hda - Fix unused warnings when !SND_HDA_NEEDS_RESUME
[linux-2.6/next.git] / sound / pci / hda / patch_realtek.c
blob30c4409211f2d680a114644999758cceff2c90df
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 accidently 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[id].chained)
1708 break;
1709 if (++depth > 10)
1710 break;
1711 id = fix[id].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(0x8086, 0xd613, "Intel", 1),
5652 static inline int has_cdefine_beep(struct hda_codec *codec)
5654 struct alc_spec *spec = codec->spec;
5655 const struct snd_pci_quirk *q;
5656 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5657 if (q)
5658 return q->value;
5659 return spec->cdefine.enable_pcbeep;
5661 #else
5662 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5663 #define has_cdefine_beep(codec) 0
5664 #endif
5667 * OK, here we have finally the patch for ALC880
5670 static int patch_alc880(struct hda_codec *codec)
5672 struct alc_spec *spec;
5673 int board_config;
5674 int err;
5676 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5677 if (spec == NULL)
5678 return -ENOMEM;
5680 codec->spec = spec;
5682 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5683 alc880_models,
5684 alc880_cfg_tbl);
5685 if (board_config < 0) {
5686 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5687 codec->chip_name);
5688 board_config = ALC880_AUTO;
5691 if (board_config == ALC880_AUTO) {
5692 /* automatic parse from the BIOS config */
5693 err = alc880_parse_auto_config(codec);
5694 if (err < 0) {
5695 alc_free(codec);
5696 return err;
5697 } else if (!err) {
5698 printk(KERN_INFO
5699 "hda_codec: Cannot set up configuration "
5700 "from BIOS. Using 3-stack mode...\n");
5701 board_config = ALC880_3ST;
5705 err = snd_hda_attach_beep_device(codec, 0x1);
5706 if (err < 0) {
5707 alc_free(codec);
5708 return err;
5711 if (board_config != ALC880_AUTO)
5712 setup_preset(codec, &alc880_presets[board_config]);
5714 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5715 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5716 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5718 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5719 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5721 if (!spec->adc_nids && spec->input_mux) {
5722 /* check whether NID 0x07 is valid */
5723 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5724 /* get type */
5725 wcap = get_wcaps_type(wcap);
5726 if (wcap != AC_WID_AUD_IN) {
5727 spec->adc_nids = alc880_adc_nids_alt;
5728 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5729 } else {
5730 spec->adc_nids = alc880_adc_nids;
5731 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5734 set_capture_mixer(codec);
5735 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5737 spec->vmaster_nid = 0x0c;
5739 codec->patch_ops = alc_patch_ops;
5740 if (board_config == ALC880_AUTO)
5741 spec->init_hook = alc880_auto_init;
5742 #ifdef CONFIG_SND_HDA_POWER_SAVE
5743 if (!spec->loopback.amplist)
5744 spec->loopback.amplist = alc880_loopbacks;
5745 #endif
5747 return 0;
5752 * ALC260 support
5755 static hda_nid_t alc260_dac_nids[1] = {
5756 /* front */
5757 0x02,
5760 static hda_nid_t alc260_adc_nids[1] = {
5761 /* ADC0 */
5762 0x04,
5765 static hda_nid_t alc260_adc_nids_alt[1] = {
5766 /* ADC1 */
5767 0x05,
5770 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5771 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5773 static hda_nid_t alc260_dual_adc_nids[2] = {
5774 /* ADC0, ADC1 */
5775 0x04, 0x05
5778 #define ALC260_DIGOUT_NID 0x03
5779 #define ALC260_DIGIN_NID 0x06
5781 static struct hda_input_mux alc260_capture_source = {
5782 .num_items = 4,
5783 .items = {
5784 { "Mic", 0x0 },
5785 { "Front Mic", 0x1 },
5786 { "Line", 0x2 },
5787 { "CD", 0x4 },
5791 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5792 * headphone jack and the internal CD lines since these are the only pins at
5793 * which audio can appear. For flexibility, also allow the option of
5794 * recording the mixer output on the second ADC (ADC0 doesn't have a
5795 * connection to the mixer output).
5797 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5799 .num_items = 3,
5800 .items = {
5801 { "Mic/Line", 0x0 },
5802 { "CD", 0x4 },
5803 { "Headphone", 0x2 },
5807 .num_items = 4,
5808 .items = {
5809 { "Mic/Line", 0x0 },
5810 { "CD", 0x4 },
5811 { "Headphone", 0x2 },
5812 { "Mixer", 0x5 },
5818 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5819 * the Fujitsu S702x, but jacks are marked differently.
5821 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5823 .num_items = 4,
5824 .items = {
5825 { "Mic", 0x0 },
5826 { "Line", 0x2 },
5827 { "CD", 0x4 },
5828 { "Headphone", 0x5 },
5832 .num_items = 5,
5833 .items = {
5834 { "Mic", 0x0 },
5835 { "Line", 0x2 },
5836 { "CD", 0x4 },
5837 { "Headphone", 0x6 },
5838 { "Mixer", 0x5 },
5843 /* Maxdata Favorit 100XS */
5844 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5846 .num_items = 2,
5847 .items = {
5848 { "Line/Mic", 0x0 },
5849 { "CD", 0x4 },
5853 .num_items = 3,
5854 .items = {
5855 { "Line/Mic", 0x0 },
5856 { "CD", 0x4 },
5857 { "Mixer", 0x5 },
5863 * This is just place-holder, so there's something for alc_build_pcms to look
5864 * at when it calculates the maximum number of channels. ALC260 has no mixer
5865 * element which allows changing the channel mode, so the verb list is
5866 * never used.
5868 static struct hda_channel_mode alc260_modes[1] = {
5869 { 2, NULL },
5873 /* Mixer combinations
5875 * basic: base_output + input + pc_beep + capture
5876 * HP: base_output + input + capture_alt
5877 * HP_3013: hp_3013 + input + capture
5878 * fujitsu: fujitsu + capture
5879 * acer: acer + capture
5882 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5883 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5884 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5885 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5886 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5887 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5888 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5889 { } /* end */
5892 static struct snd_kcontrol_new alc260_input_mixer[] = {
5893 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5894 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5895 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5896 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5898 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5899 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5900 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5901 { } /* end */
5904 /* update HP, line and mono out pins according to the master switch */
5905 static void alc260_hp_master_update(struct hda_codec *codec,
5906 hda_nid_t hp, hda_nid_t line,
5907 hda_nid_t mono)
5909 struct alc_spec *spec = codec->spec;
5910 unsigned int val = spec->master_sw ? PIN_HP : 0;
5911 /* change HP and line-out pins */
5912 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5913 val);
5914 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5915 val);
5916 /* mono (speaker) depending on the HP jack sense */
5917 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5918 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5919 val);
5922 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5923 struct snd_ctl_elem_value *ucontrol)
5925 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5926 struct alc_spec *spec = codec->spec;
5927 *ucontrol->value.integer.value = spec->master_sw;
5928 return 0;
5931 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5932 struct snd_ctl_elem_value *ucontrol)
5934 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5935 struct alc_spec *spec = codec->spec;
5936 int val = !!*ucontrol->value.integer.value;
5937 hda_nid_t hp, line, mono;
5939 if (val == spec->master_sw)
5940 return 0;
5941 spec->master_sw = val;
5942 hp = (kcontrol->private_value >> 16) & 0xff;
5943 line = (kcontrol->private_value >> 8) & 0xff;
5944 mono = kcontrol->private_value & 0xff;
5945 alc260_hp_master_update(codec, hp, line, mono);
5946 return 1;
5949 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5951 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5952 .name = "Master Playback Switch",
5953 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5954 .info = snd_ctl_boolean_mono_info,
5955 .get = alc260_hp_master_sw_get,
5956 .put = alc260_hp_master_sw_put,
5957 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5959 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5960 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5961 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5962 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5963 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5964 HDA_OUTPUT),
5965 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5966 { } /* end */
5969 static struct hda_verb alc260_hp_unsol_verbs[] = {
5970 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5974 static void alc260_hp_automute(struct hda_codec *codec)
5976 struct alc_spec *spec = codec->spec;
5978 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5979 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5982 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5984 if ((res >> 26) == ALC880_HP_EVENT)
5985 alc260_hp_automute(codec);
5988 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5990 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5991 .name = "Master Playback Switch",
5992 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5993 .info = snd_ctl_boolean_mono_info,
5994 .get = alc260_hp_master_sw_get,
5995 .put = alc260_hp_master_sw_put,
5996 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5998 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5999 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6000 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
6001 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
6002 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6003 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6004 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6005 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
6006 { } /* end */
6009 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6010 .ops = &snd_hda_bind_vol,
6011 .values = {
6012 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
6013 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
6014 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
6019 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
6020 .ops = &snd_hda_bind_sw,
6021 .values = {
6022 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
6023 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
6028 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6029 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6030 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6031 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
6032 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6033 { } /* end */
6036 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6037 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6041 static void alc260_hp_3013_automute(struct hda_codec *codec)
6043 struct alc_spec *spec = codec->spec;
6045 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
6046 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
6049 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
6050 unsigned int res)
6052 if ((res >> 26) == ALC880_HP_EVENT)
6053 alc260_hp_3013_automute(codec);
6056 static void alc260_hp_3012_automute(struct hda_codec *codec)
6058 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6060 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6061 bits);
6062 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6063 bits);
6064 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6065 bits);
6068 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6069 unsigned int res)
6071 if ((res >> 26) == ALC880_HP_EVENT)
6072 alc260_hp_3012_automute(codec);
6075 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6076 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6078 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6079 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6080 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6081 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6082 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6083 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6084 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6085 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6086 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6087 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6088 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6089 { } /* end */
6092 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6093 * versions of the ALC260 don't act on requests to enable mic bias from NID
6094 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6095 * datasheet doesn't mention this restriction. At this stage it's not clear
6096 * whether this behaviour is intentional or is a hardware bug in chip
6097 * revisions available in early 2006. Therefore for now allow the
6098 * "Headphone Jack Mode" control to span all choices, but if it turns out
6099 * that the lack of mic bias for this NID is intentional we could change the
6100 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6102 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6103 * don't appear to make the mic bias available from the "line" jack, even
6104 * though the NID used for this jack (0x14) can supply it. The theory is
6105 * that perhaps Acer have included blocking capacitors between the ALC260
6106 * and the output jack. If this turns out to be the case for all such
6107 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6108 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6110 * The C20x Tablet series have a mono internal speaker which is controlled
6111 * via the chip's Mono sum widget and pin complex, so include the necessary
6112 * controls for such models. On models without a "mono speaker" the control
6113 * won't do anything.
6115 static struct snd_kcontrol_new alc260_acer_mixer[] = {
6116 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6117 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6118 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6119 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6120 HDA_OUTPUT),
6121 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6122 HDA_INPUT),
6123 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6124 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6125 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6126 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6127 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6128 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6129 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6130 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6131 { } /* end */
6134 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6136 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6137 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6138 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6139 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6140 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6141 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6142 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6143 { } /* end */
6146 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6147 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6149 static struct snd_kcontrol_new alc260_will_mixer[] = {
6150 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6151 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6153 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6154 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6155 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6156 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6157 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6158 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6159 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6160 { } /* end */
6163 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6164 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6166 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6167 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6168 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6170 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6171 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6172 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6173 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6174 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6175 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6176 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6177 { } /* end */
6181 * initialization verbs
6183 static struct hda_verb alc260_init_verbs[] = {
6184 /* Line In pin widget for input */
6185 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6186 /* CD pin widget for input */
6187 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6188 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6189 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6190 /* Mic2 (front panel) pin widget for input and vref at 80% */
6191 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6192 /* LINE-2 is used for line-out in rear */
6193 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6194 /* select line-out */
6195 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6196 /* LINE-OUT pin */
6197 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6198 /* enable HP */
6199 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6200 /* enable Mono */
6201 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6202 /* mute capture amp left and right */
6203 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6204 /* set connection select to line in (default select for this ADC) */
6205 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6206 /* mute capture amp left and right */
6207 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6208 /* set connection select to line in (default select for this ADC) */
6209 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6210 /* set vol=0 Line-Out mixer amp left and right */
6211 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6212 /* unmute pin widget amp left and right (no gain on this amp) */
6213 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6214 /* set vol=0 HP mixer amp left and right */
6215 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6216 /* unmute pin widget amp left and right (no gain on this amp) */
6217 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6218 /* set vol=0 Mono mixer amp left and right */
6219 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6220 /* unmute pin widget amp left and right (no gain on this amp) */
6221 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6222 /* unmute LINE-2 out pin */
6223 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6224 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6225 * Line In 2 = 0x03
6227 /* mute analog inputs */
6228 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6229 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6230 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6231 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6232 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6233 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6234 /* mute Front out path */
6235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6236 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6237 /* mute Headphone out path */
6238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6239 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6240 /* mute Mono out path */
6241 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6242 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6246 #if 0 /* should be identical with alc260_init_verbs? */
6247 static struct hda_verb alc260_hp_init_verbs[] = {
6248 /* Headphone and output */
6249 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6250 /* mono output */
6251 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6252 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6253 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6254 /* Mic2 (front panel) pin widget for input and vref at 80% */
6255 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6256 /* Line In pin widget for input */
6257 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6258 /* Line-2 pin widget for output */
6259 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6260 /* CD pin widget for input */
6261 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6262 /* unmute amp left and right */
6263 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6264 /* set connection select to line in (default select for this ADC) */
6265 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6266 /* unmute Line-Out mixer amp left and right (volume = 0) */
6267 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6268 /* mute pin widget amp left and right (no gain on this amp) */
6269 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6270 /* unmute HP mixer amp left and right (volume = 0) */
6271 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6272 /* mute pin widget amp left and right (no gain on this amp) */
6273 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6274 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6275 * Line In 2 = 0x03
6277 /* mute analog inputs */
6278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6281 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6282 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6283 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6284 /* Unmute Front out path */
6285 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6286 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6287 /* Unmute Headphone out path */
6288 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6289 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6290 /* Unmute Mono out path */
6291 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6292 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6295 #endif
6297 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6298 /* Line out and output */
6299 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6300 /* mono output */
6301 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6302 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6303 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6304 /* Mic2 (front panel) pin widget for input and vref at 80% */
6305 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6306 /* Line In pin widget for input */
6307 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6308 /* Headphone pin widget for output */
6309 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6310 /* CD pin widget for input */
6311 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6312 /* unmute amp left and right */
6313 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6314 /* set connection select to line in (default select for this ADC) */
6315 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6316 /* unmute Line-Out mixer amp left and right (volume = 0) */
6317 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6318 /* mute pin widget amp left and right (no gain on this amp) */
6319 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6320 /* unmute HP mixer amp left and right (volume = 0) */
6321 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6322 /* mute pin widget amp left and right (no gain on this amp) */
6323 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6324 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6325 * Line In 2 = 0x03
6327 /* mute analog inputs */
6328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6333 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6334 /* Unmute Front out path */
6335 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6336 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6337 /* Unmute Headphone out path */
6338 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6339 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6340 /* Unmute Mono out path */
6341 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6342 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6346 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6347 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6348 * audio = 0x16, internal speaker = 0x10.
6350 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6351 /* Disable all GPIOs */
6352 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6353 /* Internal speaker is connected to headphone pin */
6354 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6355 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6356 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6357 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6358 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6359 /* Ensure all other unused pins are disabled and muted. */
6360 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6361 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6362 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6363 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6364 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6365 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6369 /* Disable digital (SPDIF) pins */
6370 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6371 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6373 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6374 * when acting as an output.
6376 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6378 /* Start with output sum widgets muted and their output gains at min */
6379 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6380 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6381 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6382 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6383 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6384 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6385 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6386 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6387 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6389 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6390 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6391 /* Unmute Line1 pin widget output buffer since it starts as an output.
6392 * If the pin mode is changed by the user the pin mode control will
6393 * take care of enabling the pin's input/output buffers as needed.
6394 * Therefore there's no need to enable the input buffer at this
6395 * stage.
6397 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6398 /* Unmute input buffer of pin widget used for Line-in (no equiv
6399 * mixer ctrl)
6401 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6403 /* Mute capture amp left and right */
6404 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6405 /* Set ADC connection select to match default mixer setting - line
6406 * in (on mic1 pin)
6408 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6410 /* Do the same for the second ADC: mute capture input amp and
6411 * set ADC connection to line in (on mic1 pin)
6413 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6414 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6416 /* Mute all inputs to mixer widget (even unconnected ones) */
6417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6420 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6421 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6422 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6423 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6424 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6429 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6430 * similar laptops (adapted from Fujitsu init verbs).
6432 static struct hda_verb alc260_acer_init_verbs[] = {
6433 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6434 * the headphone jack. Turn this on and rely on the standard mute
6435 * methods whenever the user wants to turn these outputs off.
6437 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6438 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6439 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6440 /* Internal speaker/Headphone jack is connected to Line-out pin */
6441 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6442 /* Internal microphone/Mic jack is connected to Mic1 pin */
6443 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6444 /* Line In jack is connected to Line1 pin */
6445 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6446 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6447 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6448 /* Ensure all other unused pins are disabled and muted. */
6449 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6450 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6451 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6452 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6453 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6454 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6455 /* Disable digital (SPDIF) pins */
6456 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6457 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6459 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6460 * bus when acting as outputs.
6462 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6463 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6465 /* Start with output sum widgets muted and their output gains at min */
6466 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6467 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6468 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6469 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6470 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6471 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6472 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6473 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6474 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6476 /* Unmute Line-out pin widget amp left and right
6477 * (no equiv mixer ctrl)
6479 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6480 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6481 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6482 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6483 * inputs. If the pin mode is changed by the user the pin mode control
6484 * will take care of enabling the pin's input/output buffers as needed.
6485 * Therefore there's no need to enable the input buffer at this
6486 * stage.
6488 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6489 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6491 /* Mute capture amp left and right */
6492 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6493 /* Set ADC connection select to match default mixer setting - mic
6494 * (on mic1 pin)
6496 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6498 /* Do similar with the second ADC: mute capture input amp and
6499 * set ADC connection to mic to match ALSA's default state.
6501 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6502 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6504 /* Mute all inputs to mixer widget (even unconnected ones) */
6505 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6506 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6508 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6509 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6510 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6512 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6517 /* Initialisation sequence for Maxdata Favorit 100XS
6518 * (adapted from Acer init verbs).
6520 static struct hda_verb alc260_favorit100_init_verbs[] = {
6521 /* GPIO 0 enables the output jack.
6522 * Turn this on and rely on the standard mute
6523 * methods whenever the user wants to turn these outputs off.
6525 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6526 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6527 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6528 /* Line/Mic input jack is connected to Mic1 pin */
6529 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6530 /* Ensure all other unused pins are disabled and muted. */
6531 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6532 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6533 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6534 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6535 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6536 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6537 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6538 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6539 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6540 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6541 /* Disable digital (SPDIF) pins */
6542 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6543 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6545 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6546 * bus when acting as outputs.
6548 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6549 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6551 /* Start with output sum widgets muted and their output gains at min */
6552 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6553 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6554 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6555 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6556 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6557 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6558 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6559 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6560 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6562 /* Unmute Line-out pin widget amp left and right
6563 * (no equiv mixer ctrl)
6565 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6566 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6567 * inputs. If the pin mode is changed by the user the pin mode control
6568 * will take care of enabling the pin's input/output buffers as needed.
6569 * Therefore there's no need to enable the input buffer at this
6570 * stage.
6572 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6574 /* Mute capture amp left and right */
6575 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6576 /* Set ADC connection select to match default mixer setting - mic
6577 * (on mic1 pin)
6579 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6581 /* Do similar with the second ADC: mute capture input amp and
6582 * set ADC connection to mic to match ALSA's default state.
6584 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6585 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6587 /* Mute all inputs to mixer widget (even unconnected ones) */
6588 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6589 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6590 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6591 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6592 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6593 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6594 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6595 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6600 static struct hda_verb alc260_will_verbs[] = {
6601 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6602 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6603 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6604 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6605 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6606 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6610 static struct hda_verb alc260_replacer_672v_verbs[] = {
6611 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6612 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6613 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6615 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6616 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6617 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6619 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6623 /* toggle speaker-output according to the hp-jack state */
6624 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6626 unsigned int present;
6628 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6629 present = snd_hda_jack_detect(codec, 0x0f);
6630 if (present) {
6631 snd_hda_codec_write_cache(codec, 0x01, 0,
6632 AC_VERB_SET_GPIO_DATA, 1);
6633 snd_hda_codec_write_cache(codec, 0x0f, 0,
6634 AC_VERB_SET_PIN_WIDGET_CONTROL,
6635 PIN_HP);
6636 } else {
6637 snd_hda_codec_write_cache(codec, 0x01, 0,
6638 AC_VERB_SET_GPIO_DATA, 0);
6639 snd_hda_codec_write_cache(codec, 0x0f, 0,
6640 AC_VERB_SET_PIN_WIDGET_CONTROL,
6641 PIN_OUT);
6645 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6646 unsigned int res)
6648 if ((res >> 26) == ALC880_HP_EVENT)
6649 alc260_replacer_672v_automute(codec);
6652 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6653 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6654 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6655 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6656 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6657 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6658 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6659 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6660 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6661 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6662 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6666 /* Test configuration for debugging, modelled after the ALC880 test
6667 * configuration.
6669 #ifdef CONFIG_SND_DEBUG
6670 static hda_nid_t alc260_test_dac_nids[1] = {
6671 0x02,
6673 static hda_nid_t alc260_test_adc_nids[2] = {
6674 0x04, 0x05,
6676 /* For testing the ALC260, each input MUX needs its own definition since
6677 * the signal assignments are different. This assumes that the first ADC
6678 * is NID 0x04.
6680 static struct hda_input_mux alc260_test_capture_sources[2] = {
6682 .num_items = 7,
6683 .items = {
6684 { "MIC1 pin", 0x0 },
6685 { "MIC2 pin", 0x1 },
6686 { "LINE1 pin", 0x2 },
6687 { "LINE2 pin", 0x3 },
6688 { "CD pin", 0x4 },
6689 { "LINE-OUT pin", 0x5 },
6690 { "HP-OUT pin", 0x6 },
6694 .num_items = 8,
6695 .items = {
6696 { "MIC1 pin", 0x0 },
6697 { "MIC2 pin", 0x1 },
6698 { "LINE1 pin", 0x2 },
6699 { "LINE2 pin", 0x3 },
6700 { "CD pin", 0x4 },
6701 { "Mixer", 0x5 },
6702 { "LINE-OUT pin", 0x6 },
6703 { "HP-OUT pin", 0x7 },
6707 static struct snd_kcontrol_new alc260_test_mixer[] = {
6708 /* Output driver widgets */
6709 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6710 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6711 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6712 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6713 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6714 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6716 /* Modes for retasking pin widgets
6717 * Note: the ALC260 doesn't seem to act on requests to enable mic
6718 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6719 * mention this restriction. At this stage it's not clear whether
6720 * this behaviour is intentional or is a hardware bug in chip
6721 * revisions available at least up until early 2006. Therefore for
6722 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6723 * choices, but if it turns out that the lack of mic bias for these
6724 * NIDs is intentional we could change their modes from
6725 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6727 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6728 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6729 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6730 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6731 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6732 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6734 /* Loopback mixer controls */
6735 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6736 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6737 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6738 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6739 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6740 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6741 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6742 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6743 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6744 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6745 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6746 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6747 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6748 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6750 /* Controls for GPIO pins, assuming they are configured as outputs */
6751 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6752 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6753 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6754 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6756 /* Switches to allow the digital IO pins to be enabled. The datasheet
6757 * is ambigious as to which NID is which; testing on laptops which
6758 * make this output available should provide clarification.
6760 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6761 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6763 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6764 * this output to turn on an external amplifier.
6766 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6767 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6769 { } /* end */
6771 static struct hda_verb alc260_test_init_verbs[] = {
6772 /* Enable all GPIOs as outputs with an initial value of 0 */
6773 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6774 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6775 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6777 /* Enable retasking pins as output, initially without power amp */
6778 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6779 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6780 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6781 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6782 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6783 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6785 /* Disable digital (SPDIF) pins initially, but users can enable
6786 * them via a mixer switch. In the case of SPDIF-out, this initverb
6787 * payload also sets the generation to 0, output to be in "consumer"
6788 * PCM format, copyright asserted, no pre-emphasis and no validity
6789 * control.
6791 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6792 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6794 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6795 * OUT1 sum bus when acting as an output.
6797 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6798 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6799 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6800 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6802 /* Start with output sum widgets muted and their output gains at min */
6803 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6804 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6805 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6806 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6807 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6808 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6809 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6810 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6811 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6813 /* Unmute retasking pin widget output buffers since the default
6814 * state appears to be output. As the pin mode is changed by the
6815 * user the pin mode control will take care of enabling the pin's
6816 * input/output buffers as needed.
6818 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6819 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6820 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6821 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6822 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6823 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6824 /* Also unmute the mono-out pin widget */
6825 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6827 /* Mute capture amp left and right */
6828 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6829 /* Set ADC connection select to match default mixer setting (mic1
6830 * pin)
6832 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6834 /* Do the same for the second ADC: mute capture input amp and
6835 * set ADC connection to mic1 pin
6837 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6838 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6840 /* Mute all inputs to mixer widget (even unconnected ones) */
6841 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6843 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6844 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6845 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6846 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6847 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6852 #endif
6854 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6855 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6857 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6858 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6861 * for BIOS auto-configuration
6864 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6865 const char *pfx, int *vol_bits)
6867 hda_nid_t nid_vol;
6868 unsigned long vol_val, sw_val;
6869 int err;
6871 if (nid >= 0x0f && nid < 0x11) {
6872 nid_vol = nid - 0x7;
6873 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6874 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6875 } else if (nid == 0x11) {
6876 nid_vol = nid - 0x7;
6877 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6878 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6879 } else if (nid >= 0x12 && nid <= 0x15) {
6880 nid_vol = 0x08;
6881 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6882 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6883 } else
6884 return 0; /* N/A */
6886 if (!(*vol_bits & (1 << nid_vol))) {
6887 /* first control for the volume widget */
6888 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6889 if (err < 0)
6890 return err;
6891 *vol_bits |= (1 << nid_vol);
6893 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6894 if (err < 0)
6895 return err;
6896 return 1;
6899 /* add playback controls from the parsed DAC table */
6900 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6901 const struct auto_pin_cfg *cfg)
6903 hda_nid_t nid;
6904 int err;
6905 int vols = 0;
6907 spec->multiout.num_dacs = 1;
6908 spec->multiout.dac_nids = spec->private_dac_nids;
6909 spec->multiout.dac_nids[0] = 0x02;
6911 nid = cfg->line_out_pins[0];
6912 if (nid) {
6913 const char *pfx;
6914 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6915 pfx = "Master";
6916 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6917 pfx = "Speaker";
6918 else
6919 pfx = "Front";
6920 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6921 if (err < 0)
6922 return err;
6925 nid = cfg->speaker_pins[0];
6926 if (nid) {
6927 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6928 if (err < 0)
6929 return err;
6932 nid = cfg->hp_pins[0];
6933 if (nid) {
6934 err = alc260_add_playback_controls(spec, nid, "Headphone",
6935 &vols);
6936 if (err < 0)
6937 return err;
6939 return 0;
6942 /* create playback/capture controls for input pins */
6943 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6944 const struct auto_pin_cfg *cfg)
6946 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6949 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6950 hda_nid_t nid, int pin_type,
6951 int sel_idx)
6953 alc_set_pin_output(codec, nid, pin_type);
6954 /* need the manual connection? */
6955 if (nid >= 0x12) {
6956 int idx = nid - 0x12;
6957 snd_hda_codec_write(codec, idx + 0x0b, 0,
6958 AC_VERB_SET_CONNECT_SEL, sel_idx);
6962 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6964 struct alc_spec *spec = codec->spec;
6965 hda_nid_t nid;
6967 nid = spec->autocfg.line_out_pins[0];
6968 if (nid) {
6969 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6970 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6973 nid = spec->autocfg.speaker_pins[0];
6974 if (nid)
6975 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6977 nid = spec->autocfg.hp_pins[0];
6978 if (nid)
6979 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6982 #define ALC260_PIN_CD_NID 0x16
6983 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6985 struct alc_spec *spec = codec->spec;
6986 struct auto_pin_cfg *cfg = &spec->autocfg;
6987 int i;
6989 for (i = 0; i < cfg->num_inputs; i++) {
6990 hda_nid_t nid = cfg->inputs[i].pin;
6991 if (nid >= 0x12) {
6992 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
6993 if (nid != ALC260_PIN_CD_NID &&
6994 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6995 snd_hda_codec_write(codec, nid, 0,
6996 AC_VERB_SET_AMP_GAIN_MUTE,
6997 AMP_OUT_MUTE);
7002 #define alc260_auto_init_input_src alc880_auto_init_input_src
7005 * generic initialization of ADC, input mixers and output mixers
7007 static struct hda_verb alc260_volume_init_verbs[] = {
7009 * Unmute ADC0-1 and set the default input to mic-in
7011 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
7012 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7013 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
7014 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7016 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7017 * mixer widget
7018 * Note: PASD motherboards uses the Line In 2 as the input for
7019 * front panel mic (mic 2)
7021 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7022 /* mute analog inputs */
7023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7024 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7026 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7030 * Set up output mixers (0x08 - 0x0a)
7032 /* set vol=0 to output mixers */
7033 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7034 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7035 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7036 /* set up input amps for analog loopback */
7037 /* Amp Indices: DAC = 0, mixer = 1 */
7038 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7039 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7040 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7041 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7042 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7043 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7048 static int alc260_parse_auto_config(struct hda_codec *codec)
7050 struct alc_spec *spec = codec->spec;
7051 int err;
7052 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
7054 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7055 alc260_ignore);
7056 if (err < 0)
7057 return err;
7058 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7059 if (err < 0)
7060 return err;
7061 if (!spec->kctls.list)
7062 return 0; /* can't find valid BIOS pin config */
7063 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7064 if (err < 0)
7065 return err;
7067 spec->multiout.max_channels = 2;
7069 if (spec->autocfg.dig_outs)
7070 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7071 if (spec->kctls.list)
7072 add_mixer(spec, spec->kctls.list);
7074 add_verb(spec, alc260_volume_init_verbs);
7076 spec->num_mux_defs = 1;
7077 spec->input_mux = &spec->private_imux[0];
7079 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7081 return 1;
7084 /* additional initialization for auto-configuration model */
7085 static void alc260_auto_init(struct hda_codec *codec)
7087 struct alc_spec *spec = codec->spec;
7088 alc260_auto_init_multi_out(codec);
7089 alc260_auto_init_analog_input(codec);
7090 alc260_auto_init_input_src(codec);
7091 alc_auto_init_digital(codec);
7092 if (spec->unsol_event)
7093 alc_inithook(codec);
7096 #ifdef CONFIG_SND_HDA_POWER_SAVE
7097 static struct hda_amp_list alc260_loopbacks[] = {
7098 { 0x07, HDA_INPUT, 0 },
7099 { 0x07, HDA_INPUT, 1 },
7100 { 0x07, HDA_INPUT, 2 },
7101 { 0x07, HDA_INPUT, 3 },
7102 { 0x07, HDA_INPUT, 4 },
7103 { } /* end */
7105 #endif
7108 * Pin config fixes
7110 enum {
7111 PINFIX_HP_DC5750,
7114 static const struct alc_fixup alc260_fixups[] = {
7115 [PINFIX_HP_DC5750] = {
7116 .type = ALC_FIXUP_PINS,
7117 .v.pins = (const struct alc_pincfg[]) {
7118 { 0x11, 0x90130110 }, /* speaker */
7124 static struct snd_pci_quirk alc260_fixup_tbl[] = {
7125 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7130 * ALC260 configurations
7132 static const char * const alc260_models[ALC260_MODEL_LAST] = {
7133 [ALC260_BASIC] = "basic",
7134 [ALC260_HP] = "hp",
7135 [ALC260_HP_3013] = "hp-3013",
7136 [ALC260_HP_DC7600] = "hp-dc7600",
7137 [ALC260_FUJITSU_S702X] = "fujitsu",
7138 [ALC260_ACER] = "acer",
7139 [ALC260_WILL] = "will",
7140 [ALC260_REPLACER_672V] = "replacer",
7141 [ALC260_FAVORIT100] = "favorit100",
7142 #ifdef CONFIG_SND_DEBUG
7143 [ALC260_TEST] = "test",
7144 #endif
7145 [ALC260_AUTO] = "auto",
7148 static struct snd_pci_quirk alc260_cfg_tbl[] = {
7149 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7150 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7151 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7152 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7153 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7154 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7155 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7156 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7157 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7158 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7159 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7160 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7161 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7162 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7163 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7164 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7165 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7166 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7167 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7168 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7172 static struct alc_config_preset alc260_presets[] = {
7173 [ALC260_BASIC] = {
7174 .mixers = { alc260_base_output_mixer,
7175 alc260_input_mixer },
7176 .init_verbs = { alc260_init_verbs },
7177 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7178 .dac_nids = alc260_dac_nids,
7179 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7180 .adc_nids = alc260_dual_adc_nids,
7181 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7182 .channel_mode = alc260_modes,
7183 .input_mux = &alc260_capture_source,
7185 [ALC260_HP] = {
7186 .mixers = { alc260_hp_output_mixer,
7187 alc260_input_mixer },
7188 .init_verbs = { alc260_init_verbs,
7189 alc260_hp_unsol_verbs },
7190 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7191 .dac_nids = alc260_dac_nids,
7192 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7193 .adc_nids = alc260_adc_nids_alt,
7194 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7195 .channel_mode = alc260_modes,
7196 .input_mux = &alc260_capture_source,
7197 .unsol_event = alc260_hp_unsol_event,
7198 .init_hook = alc260_hp_automute,
7200 [ALC260_HP_DC7600] = {
7201 .mixers = { alc260_hp_dc7600_mixer,
7202 alc260_input_mixer },
7203 .init_verbs = { alc260_init_verbs,
7204 alc260_hp_dc7600_verbs },
7205 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7206 .dac_nids = alc260_dac_nids,
7207 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7208 .adc_nids = alc260_adc_nids_alt,
7209 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7210 .channel_mode = alc260_modes,
7211 .input_mux = &alc260_capture_source,
7212 .unsol_event = alc260_hp_3012_unsol_event,
7213 .init_hook = alc260_hp_3012_automute,
7215 [ALC260_HP_3013] = {
7216 .mixers = { alc260_hp_3013_mixer,
7217 alc260_input_mixer },
7218 .init_verbs = { alc260_hp_3013_init_verbs,
7219 alc260_hp_3013_unsol_verbs },
7220 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7221 .dac_nids = alc260_dac_nids,
7222 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7223 .adc_nids = alc260_adc_nids_alt,
7224 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7225 .channel_mode = alc260_modes,
7226 .input_mux = &alc260_capture_source,
7227 .unsol_event = alc260_hp_3013_unsol_event,
7228 .init_hook = alc260_hp_3013_automute,
7230 [ALC260_FUJITSU_S702X] = {
7231 .mixers = { alc260_fujitsu_mixer },
7232 .init_verbs = { alc260_fujitsu_init_verbs },
7233 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7234 .dac_nids = alc260_dac_nids,
7235 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7236 .adc_nids = alc260_dual_adc_nids,
7237 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7238 .channel_mode = alc260_modes,
7239 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7240 .input_mux = alc260_fujitsu_capture_sources,
7242 [ALC260_ACER] = {
7243 .mixers = { alc260_acer_mixer },
7244 .init_verbs = { alc260_acer_init_verbs },
7245 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7246 .dac_nids = alc260_dac_nids,
7247 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7248 .adc_nids = alc260_dual_adc_nids,
7249 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7250 .channel_mode = alc260_modes,
7251 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7252 .input_mux = alc260_acer_capture_sources,
7254 [ALC260_FAVORIT100] = {
7255 .mixers = { alc260_favorit100_mixer },
7256 .init_verbs = { alc260_favorit100_init_verbs },
7257 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7258 .dac_nids = alc260_dac_nids,
7259 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7260 .adc_nids = alc260_dual_adc_nids,
7261 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7262 .channel_mode = alc260_modes,
7263 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7264 .input_mux = alc260_favorit100_capture_sources,
7266 [ALC260_WILL] = {
7267 .mixers = { alc260_will_mixer },
7268 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7269 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7270 .dac_nids = alc260_dac_nids,
7271 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7272 .adc_nids = alc260_adc_nids,
7273 .dig_out_nid = ALC260_DIGOUT_NID,
7274 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7275 .channel_mode = alc260_modes,
7276 .input_mux = &alc260_capture_source,
7278 [ALC260_REPLACER_672V] = {
7279 .mixers = { alc260_replacer_672v_mixer },
7280 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7281 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7282 .dac_nids = alc260_dac_nids,
7283 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7284 .adc_nids = alc260_adc_nids,
7285 .dig_out_nid = ALC260_DIGOUT_NID,
7286 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7287 .channel_mode = alc260_modes,
7288 .input_mux = &alc260_capture_source,
7289 .unsol_event = alc260_replacer_672v_unsol_event,
7290 .init_hook = alc260_replacer_672v_automute,
7292 #ifdef CONFIG_SND_DEBUG
7293 [ALC260_TEST] = {
7294 .mixers = { alc260_test_mixer },
7295 .init_verbs = { alc260_test_init_verbs },
7296 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7297 .dac_nids = alc260_test_dac_nids,
7298 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7299 .adc_nids = alc260_test_adc_nids,
7300 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7301 .channel_mode = alc260_modes,
7302 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7303 .input_mux = alc260_test_capture_sources,
7305 #endif
7308 static int patch_alc260(struct hda_codec *codec)
7310 struct alc_spec *spec;
7311 int err, board_config;
7313 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7314 if (spec == NULL)
7315 return -ENOMEM;
7317 codec->spec = spec;
7319 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7320 alc260_models,
7321 alc260_cfg_tbl);
7322 if (board_config < 0) {
7323 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7324 codec->chip_name);
7325 board_config = ALC260_AUTO;
7328 if (board_config == ALC260_AUTO) {
7329 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7330 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7333 if (board_config == ALC260_AUTO) {
7334 /* automatic parse from the BIOS config */
7335 err = alc260_parse_auto_config(codec);
7336 if (err < 0) {
7337 alc_free(codec);
7338 return err;
7339 } else if (!err) {
7340 printk(KERN_INFO
7341 "hda_codec: Cannot set up configuration "
7342 "from BIOS. Using base mode...\n");
7343 board_config = ALC260_BASIC;
7347 err = snd_hda_attach_beep_device(codec, 0x1);
7348 if (err < 0) {
7349 alc_free(codec);
7350 return err;
7353 if (board_config != ALC260_AUTO)
7354 setup_preset(codec, &alc260_presets[board_config]);
7356 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7357 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7358 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7360 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7361 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7363 if (!spec->adc_nids && spec->input_mux) {
7364 /* check whether NID 0x04 is valid */
7365 unsigned int wcap = get_wcaps(codec, 0x04);
7366 wcap = get_wcaps_type(wcap);
7367 /* get type */
7368 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7369 spec->adc_nids = alc260_adc_nids_alt;
7370 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7371 } else {
7372 spec->adc_nids = alc260_adc_nids;
7373 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7376 set_capture_mixer(codec);
7377 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7379 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7381 spec->vmaster_nid = 0x08;
7383 codec->patch_ops = alc_patch_ops;
7384 if (board_config == ALC260_AUTO)
7385 spec->init_hook = alc260_auto_init;
7386 #ifdef CONFIG_SND_HDA_POWER_SAVE
7387 if (!spec->loopback.amplist)
7388 spec->loopback.amplist = alc260_loopbacks;
7389 #endif
7391 return 0;
7396 * ALC882/883/885/888/889 support
7398 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7399 * configuration. Each pin widget can choose any input DACs and a mixer.
7400 * Each ADC is connected from a mixer of all inputs. This makes possible
7401 * 6-channel independent captures.
7403 * In addition, an independent DAC for the multi-playback (not used in this
7404 * driver yet).
7406 #define ALC882_DIGOUT_NID 0x06
7407 #define ALC882_DIGIN_NID 0x0a
7408 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7409 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7410 #define ALC1200_DIGOUT_NID 0x10
7413 static struct hda_channel_mode alc882_ch_modes[1] = {
7414 { 8, NULL }
7417 /* DACs */
7418 static hda_nid_t alc882_dac_nids[4] = {
7419 /* front, rear, clfe, rear_surr */
7420 0x02, 0x03, 0x04, 0x05
7422 #define alc883_dac_nids alc882_dac_nids
7424 /* ADCs */
7425 #define alc882_adc_nids alc880_adc_nids
7426 #define alc882_adc_nids_alt alc880_adc_nids_alt
7427 #define alc883_adc_nids alc882_adc_nids_alt
7428 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7429 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7430 #define alc889_adc_nids alc880_adc_nids
7432 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7433 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7434 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7435 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7436 #define alc889_capsrc_nids alc882_capsrc_nids
7438 /* input MUX */
7439 /* FIXME: should be a matrix-type input source selection */
7441 static struct hda_input_mux alc882_capture_source = {
7442 .num_items = 4,
7443 .items = {
7444 { "Mic", 0x0 },
7445 { "Front Mic", 0x1 },
7446 { "Line", 0x2 },
7447 { "CD", 0x4 },
7451 #define alc883_capture_source alc882_capture_source
7453 static struct hda_input_mux alc889_capture_source = {
7454 .num_items = 3,
7455 .items = {
7456 { "Front Mic", 0x0 },
7457 { "Mic", 0x3 },
7458 { "Line", 0x2 },
7462 static struct hda_input_mux mb5_capture_source = {
7463 .num_items = 3,
7464 .items = {
7465 { "Mic", 0x1 },
7466 { "Line", 0x7 },
7467 { "CD", 0x4 },
7471 static struct hda_input_mux macmini3_capture_source = {
7472 .num_items = 2,
7473 .items = {
7474 { "Line", 0x2 },
7475 { "CD", 0x4 },
7479 static struct hda_input_mux alc883_3stack_6ch_intel = {
7480 .num_items = 4,
7481 .items = {
7482 { "Mic", 0x1 },
7483 { "Front Mic", 0x0 },
7484 { "Line", 0x2 },
7485 { "CD", 0x4 },
7489 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7490 .num_items = 2,
7491 .items = {
7492 { "Mic", 0x1 },
7493 { "Line", 0x2 },
7497 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7498 .num_items = 4,
7499 .items = {
7500 { "Mic", 0x0 },
7501 { "Internal Mic", 0x1 },
7502 { "Line", 0x2 },
7503 { "CD", 0x4 },
7507 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7508 .num_items = 2,
7509 .items = {
7510 { "Mic", 0x0 },
7511 { "Internal Mic", 0x1 },
7515 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7516 .num_items = 3,
7517 .items = {
7518 { "Mic", 0x0 },
7519 { "Front Mic", 0x1 },
7520 { "Line", 0x4 },
7524 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7525 .num_items = 2,
7526 .items = {
7527 { "Mic", 0x0 },
7528 { "Line", 0x2 },
7532 static struct hda_input_mux alc889A_mb31_capture_source = {
7533 .num_items = 2,
7534 .items = {
7535 { "Mic", 0x0 },
7536 /* Front Mic (0x01) unused */
7537 { "Line", 0x2 },
7538 /* Line 2 (0x03) unused */
7539 /* CD (0x04) unused? */
7543 static struct hda_input_mux alc889A_imac91_capture_source = {
7544 .num_items = 2,
7545 .items = {
7546 { "Mic", 0x01 },
7547 { "Line", 0x2 }, /* Not sure! */
7552 * 2ch mode
7554 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7555 { 2, NULL }
7559 * 2ch mode
7561 static struct hda_verb alc882_3ST_ch2_init[] = {
7562 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7563 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7564 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7565 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7566 { } /* end */
7570 * 4ch mode
7572 static struct hda_verb alc882_3ST_ch4_init[] = {
7573 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7574 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7575 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7576 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7577 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7578 { } /* end */
7582 * 6ch mode
7584 static struct hda_verb alc882_3ST_ch6_init[] = {
7585 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7586 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7587 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7588 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7589 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7590 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7591 { } /* end */
7594 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7595 { 2, alc882_3ST_ch2_init },
7596 { 4, alc882_3ST_ch4_init },
7597 { 6, alc882_3ST_ch6_init },
7600 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7603 * 2ch mode
7605 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7606 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7607 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7608 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7609 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7610 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7611 { } /* end */
7615 * 4ch mode
7617 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7618 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7619 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7620 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7621 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7622 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7623 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7624 { } /* end */
7628 * 6ch mode
7630 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7631 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7632 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7633 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7634 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7635 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7636 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7637 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7638 { } /* end */
7641 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7642 { 2, alc883_3ST_ch2_clevo_init },
7643 { 4, alc883_3ST_ch4_clevo_init },
7644 { 6, alc883_3ST_ch6_clevo_init },
7649 * 6ch mode
7651 static struct hda_verb alc882_sixstack_ch6_init[] = {
7652 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7653 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7654 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7655 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7656 { } /* end */
7660 * 8ch mode
7662 static struct hda_verb alc882_sixstack_ch8_init[] = {
7663 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7664 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7665 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7666 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7667 { } /* end */
7670 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7671 { 6, alc882_sixstack_ch6_init },
7672 { 8, alc882_sixstack_ch8_init },
7676 /* Macbook Air 2,1 */
7678 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7679 { 2, NULL },
7683 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7687 * 2ch mode
7689 static struct hda_verb alc885_mbp_ch2_init[] = {
7690 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7691 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7692 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7693 { } /* end */
7697 * 4ch mode
7699 static struct hda_verb alc885_mbp_ch4_init[] = {
7700 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7701 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7702 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7703 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7704 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7705 { } /* end */
7708 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7709 { 2, alc885_mbp_ch2_init },
7710 { 4, alc885_mbp_ch4_init },
7714 * 2ch
7715 * Speakers/Woofer/HP = Front
7716 * LineIn = Input
7718 static struct hda_verb alc885_mb5_ch2_init[] = {
7719 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7720 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7721 { } /* end */
7725 * 6ch mode
7726 * Speakers/HP = Front
7727 * Woofer = LFE
7728 * LineIn = Surround
7730 static struct hda_verb alc885_mb5_ch6_init[] = {
7731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7733 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7734 { } /* end */
7737 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7738 { 2, alc885_mb5_ch2_init },
7739 { 6, alc885_mb5_ch6_init },
7742 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7745 * 2ch mode
7747 static struct hda_verb alc883_4ST_ch2_init[] = {
7748 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7749 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7750 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7751 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7752 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7753 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7754 { } /* end */
7758 * 4ch mode
7760 static struct hda_verb alc883_4ST_ch4_init[] = {
7761 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7762 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7763 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7764 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7765 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7766 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7767 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7768 { } /* end */
7772 * 6ch mode
7774 static struct hda_verb alc883_4ST_ch6_init[] = {
7775 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7776 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7777 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7778 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7779 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7780 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7781 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7782 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7783 { } /* end */
7787 * 8ch mode
7789 static struct hda_verb alc883_4ST_ch8_init[] = {
7790 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7791 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7792 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7793 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7794 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7795 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7796 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7797 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7798 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7799 { } /* end */
7802 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7803 { 2, alc883_4ST_ch2_init },
7804 { 4, alc883_4ST_ch4_init },
7805 { 6, alc883_4ST_ch6_init },
7806 { 8, alc883_4ST_ch8_init },
7811 * 2ch mode
7813 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7814 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7815 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7816 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7817 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7818 { } /* end */
7822 * 4ch mode
7824 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7825 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7826 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7827 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7828 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7829 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7830 { } /* end */
7834 * 6ch mode
7836 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7837 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7838 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7839 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7840 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7841 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7842 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7843 { } /* end */
7846 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7847 { 2, alc883_3ST_ch2_intel_init },
7848 { 4, alc883_3ST_ch4_intel_init },
7849 { 6, alc883_3ST_ch6_intel_init },
7853 * 2ch mode
7855 static struct hda_verb alc889_ch2_intel_init[] = {
7856 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7857 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7858 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7859 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7860 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7861 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7862 { } /* end */
7866 * 6ch mode
7868 static struct hda_verb alc889_ch6_intel_init[] = {
7869 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7870 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7871 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7872 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7873 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7874 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7875 { } /* end */
7879 * 8ch mode
7881 static struct hda_verb alc889_ch8_intel_init[] = {
7882 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7883 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7884 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7885 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7886 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7887 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7888 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7889 { } /* end */
7892 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7893 { 2, alc889_ch2_intel_init },
7894 { 6, alc889_ch6_intel_init },
7895 { 8, alc889_ch8_intel_init },
7899 * 6ch mode
7901 static struct hda_verb alc883_sixstack_ch6_init[] = {
7902 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7903 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7904 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7905 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7906 { } /* end */
7910 * 8ch mode
7912 static struct hda_verb alc883_sixstack_ch8_init[] = {
7913 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7914 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7915 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7916 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7917 { } /* end */
7920 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7921 { 6, alc883_sixstack_ch6_init },
7922 { 8, alc883_sixstack_ch8_init },
7926 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7927 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7929 static struct snd_kcontrol_new alc882_base_mixer[] = {
7930 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7931 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7932 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7933 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7934 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7935 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7936 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7937 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7938 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7939 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7940 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7941 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7942 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7943 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7944 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7945 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7946 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
7947 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7948 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7949 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
7950 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7951 { } /* end */
7954 /* Macbook Air 2,1 same control for HP and internal Speaker */
7956 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7957 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7958 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7963 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7964 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7965 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7966 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7967 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7968 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7969 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7970 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7972 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7973 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
7974 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
7975 { } /* end */
7978 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7979 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7980 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7981 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7982 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7983 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7984 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7985 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7986 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7987 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7988 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7989 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7990 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7991 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
7993 { } /* end */
7996 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7997 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7998 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7999 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8000 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8001 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8002 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8003 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8004 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8005 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8006 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8007 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8008 { } /* end */
8011 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
8012 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8013 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8014 { } /* end */
8018 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8019 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8020 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8021 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8022 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8023 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8024 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8026 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8027 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8028 { } /* end */
8031 static struct snd_kcontrol_new alc882_targa_mixer[] = {
8032 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8033 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8034 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8035 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8036 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8037 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8038 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8039 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8040 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8041 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8042 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8043 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8044 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8045 { } /* end */
8048 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8049 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8051 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8052 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8053 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8054 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8055 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8056 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8057 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8058 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8059 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8061 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8063 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8064 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8065 { } /* end */
8068 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8069 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8070 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8071 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8072 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8073 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8074 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8075 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8077 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8078 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8079 { } /* end */
8082 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8084 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8085 .name = "Channel Mode",
8086 .info = alc_ch_mode_info,
8087 .get = alc_ch_mode_get,
8088 .put = alc_ch_mode_put,
8090 { } /* end */
8093 static struct hda_verb alc882_base_init_verbs[] = {
8094 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8095 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8096 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8097 /* Rear mixer */
8098 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8099 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8100 /* CLFE mixer */
8101 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8102 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8103 /* Side mixer */
8104 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8105 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8107 /* Front Pin: output 0 (0x0c) */
8108 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8109 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8110 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8111 /* Rear Pin: output 1 (0x0d) */
8112 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8113 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8114 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8115 /* CLFE Pin: output 2 (0x0e) */
8116 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8117 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8118 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8119 /* Side Pin: output 3 (0x0f) */
8120 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8121 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8122 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8123 /* Mic (rear) pin: input vref at 80% */
8124 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8125 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8126 /* Front Mic pin: input vref at 80% */
8127 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8128 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8129 /* Line In pin: input */
8130 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8131 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8132 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8133 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8134 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8135 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8136 /* CD pin widget for input */
8137 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8139 /* FIXME: use matrix-type input source selection */
8140 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8141 /* Input mixer2 */
8142 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8143 /* Input mixer3 */
8144 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8145 /* ADC2: mute amp left and right */
8146 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8147 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8148 /* ADC3: mute amp left and right */
8149 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8150 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8155 static struct hda_verb alc882_adc1_init_verbs[] = {
8156 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8157 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8158 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8159 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8160 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8161 /* ADC1: mute amp left and right */
8162 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8163 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8167 static struct hda_verb alc882_eapd_verbs[] = {
8168 /* change to EAPD mode */
8169 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8170 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8174 static struct hda_verb alc889_eapd_verbs[] = {
8175 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8176 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8180 static struct hda_verb alc_hp15_unsol_verbs[] = {
8181 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8186 static struct hda_verb alc885_init_verbs[] = {
8187 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8190 /* Rear mixer */
8191 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8192 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8193 /* CLFE mixer */
8194 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8195 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8196 /* Side mixer */
8197 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8198 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8200 /* Front HP Pin: output 0 (0x0c) */
8201 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8202 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8203 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8204 /* Front Pin: output 0 (0x0c) */
8205 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8206 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8207 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8208 /* Rear Pin: output 1 (0x0d) */
8209 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8210 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8211 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8212 /* CLFE Pin: output 2 (0x0e) */
8213 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8214 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8215 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8216 /* Side Pin: output 3 (0x0f) */
8217 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8218 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8219 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8220 /* Mic (rear) pin: input vref at 80% */
8221 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8222 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8223 /* Front Mic pin: input vref at 80% */
8224 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8225 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8226 /* Line In pin: input */
8227 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8228 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8230 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8231 /* Input mixer1 */
8232 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8233 /* Input mixer2 */
8234 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8235 /* Input mixer3 */
8236 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8237 /* ADC2: mute amp left and right */
8238 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8239 /* ADC3: mute amp left and right */
8240 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8245 static struct hda_verb alc885_init_input_verbs[] = {
8246 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8247 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8248 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8253 /* Unmute Selector 24h and set the default input to front mic */
8254 static struct hda_verb alc889_init_input_verbs[] = {
8255 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8256 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8261 #define alc883_init_verbs alc882_base_init_verbs
8263 /* Mac Pro test */
8264 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8265 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8266 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8267 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8268 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8269 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8270 /* FIXME: this looks suspicious...
8271 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8272 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8274 { } /* end */
8277 static struct hda_verb alc882_macpro_init_verbs[] = {
8278 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8279 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8280 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8281 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8282 /* Front Pin: output 0 (0x0c) */
8283 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8284 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8285 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8286 /* Front Mic pin: input vref at 80% */
8287 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8288 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8289 /* Speaker: output */
8290 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8291 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8292 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8293 /* Headphone output (output 0 - 0x0c) */
8294 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8295 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8296 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8298 /* FIXME: use matrix-type input source selection */
8299 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8300 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8302 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8304 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8305 /* Input mixer2 */
8306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8310 /* Input mixer3 */
8311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8315 /* ADC1: mute amp left and right */
8316 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8317 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8318 /* ADC2: mute amp left and right */
8319 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8320 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8321 /* ADC3: mute amp left and right */
8322 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8323 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8328 /* Macbook 5,1 */
8329 static struct hda_verb alc885_mb5_init_verbs[] = {
8330 /* DACs */
8331 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8332 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8333 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8334 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8335 /* Front mixer */
8336 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8339 /* Surround mixer */
8340 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8341 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8342 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8343 /* LFE mixer */
8344 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8345 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8347 /* HP mixer */
8348 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8349 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8350 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8351 /* Front Pin (0x0c) */
8352 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8353 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8354 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8355 /* LFE Pin (0x0e) */
8356 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8357 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8358 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8359 /* HP Pin (0x0f) */
8360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8361 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8362 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8363 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8364 /* Front Mic pin: input vref at 80% */
8365 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8366 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8367 /* Line In pin */
8368 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8371 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8377 /* Macmini 3,1 */
8378 static struct hda_verb alc885_macmini3_init_verbs[] = {
8379 /* DACs */
8380 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8381 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8382 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8383 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8384 /* Front mixer */
8385 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8386 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8387 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8388 /* Surround mixer */
8389 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8390 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8391 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8392 /* LFE mixer */
8393 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8395 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8396 /* HP mixer */
8397 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8398 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8399 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8400 /* Front Pin (0x0c) */
8401 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8402 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8403 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8404 /* LFE Pin (0x0e) */
8405 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8406 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8407 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8408 /* HP Pin (0x0f) */
8409 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8410 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8411 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8412 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8413 /* Line In pin */
8414 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8415 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8417 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8418 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8420 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8425 static struct hda_verb alc885_mba21_init_verbs[] = {
8426 /*Internal and HP Speaker Mixer*/
8427 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8430 /*Internal Speaker Pin (0x0c)*/
8431 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8432 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8433 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8434 /* HP Pin: output 0 (0x0e) */
8435 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8436 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8437 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8438 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8439 /* Line in (is hp when jack connected)*/
8440 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8441 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8447 /* Macbook Pro rev3 */
8448 static struct hda_verb alc885_mbp3_init_verbs[] = {
8449 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8450 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8451 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8452 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8453 /* Rear mixer */
8454 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8455 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8456 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8457 /* HP mixer */
8458 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8460 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8461 /* Front Pin: output 0 (0x0c) */
8462 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8463 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8464 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8465 /* HP Pin: output 0 (0x0e) */
8466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8467 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8468 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8469 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8470 /* Mic (rear) pin: input vref at 80% */
8471 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8472 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8473 /* Front Mic pin: input vref at 80% */
8474 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8475 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8476 /* Line In pin: use output 1 when in LineOut mode */
8477 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8478 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8479 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8481 /* FIXME: use matrix-type input source selection */
8482 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8483 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8484 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8485 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8486 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8487 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8488 /* Input mixer2 */
8489 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8490 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8491 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8492 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8493 /* Input mixer3 */
8494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8496 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8497 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8498 /* ADC1: mute amp left and right */
8499 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8500 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8501 /* ADC2: mute amp left and right */
8502 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8503 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8504 /* ADC3: mute amp left and right */
8505 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8506 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8511 /* iMac 9,1 */
8512 static struct hda_verb alc885_imac91_init_verbs[] = {
8513 /* Internal Speaker Pin (0x0c) */
8514 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8515 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8516 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8517 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8518 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8519 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8520 /* HP Pin: Rear */
8521 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8522 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8523 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8524 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8525 /* Line in Rear */
8526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8527 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8528 /* Front Mic pin: input vref at 80% */
8529 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8530 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8531 /* Rear mixer */
8532 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8533 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8534 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8535 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8538 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8539 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8540 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8541 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8542 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8544 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8545 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8547 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8549 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8550 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8554 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8556 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8557 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8558 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8559 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8560 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8561 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8562 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8566 /* iMac 24 mixer. */
8567 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8568 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8569 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8570 { } /* end */
8573 /* iMac 24 init verbs. */
8574 static struct hda_verb alc885_imac24_init_verbs[] = {
8575 /* Internal speakers: output 0 (0x0c) */
8576 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8577 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8578 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8579 /* Internal speakers: output 0 (0x0c) */
8580 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8581 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8582 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8583 /* Headphone: output 0 (0x0c) */
8584 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8585 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8586 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8587 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8588 /* Front Mic: input vref at 80% */
8589 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8590 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8594 /* Toggle speaker-output according to the hp-jack state */
8595 static void alc885_imac24_setup(struct hda_codec *codec)
8597 struct alc_spec *spec = codec->spec;
8599 spec->autocfg.hp_pins[0] = 0x14;
8600 spec->autocfg.speaker_pins[0] = 0x18;
8601 spec->autocfg.speaker_pins[1] = 0x1a;
8604 #define alc885_mb5_setup alc885_imac24_setup
8605 #define alc885_macmini3_setup alc885_imac24_setup
8607 /* Macbook Air 2,1 */
8608 static void alc885_mba21_setup(struct hda_codec *codec)
8610 struct alc_spec *spec = codec->spec;
8612 spec->autocfg.hp_pins[0] = 0x14;
8613 spec->autocfg.speaker_pins[0] = 0x18;
8618 static void alc885_mbp3_setup(struct hda_codec *codec)
8620 struct alc_spec *spec = codec->spec;
8622 spec->autocfg.hp_pins[0] = 0x15;
8623 spec->autocfg.speaker_pins[0] = 0x14;
8626 static void alc885_imac91_setup(struct hda_codec *codec)
8628 struct alc_spec *spec = codec->spec;
8630 spec->autocfg.hp_pins[0] = 0x14;
8631 spec->autocfg.speaker_pins[0] = 0x18;
8632 spec->autocfg.speaker_pins[1] = 0x1a;
8635 static struct hda_verb alc882_targa_verbs[] = {
8636 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8637 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8639 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8640 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8642 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8643 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8644 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8646 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8647 { } /* end */
8650 /* toggle speaker-output according to the hp-jack state */
8651 static void alc882_targa_automute(struct hda_codec *codec)
8653 struct alc_spec *spec = codec->spec;
8654 alc_automute_amp(codec);
8655 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8656 spec->jack_present ? 1 : 3);
8659 static void alc882_targa_setup(struct hda_codec *codec)
8661 struct alc_spec *spec = codec->spec;
8663 spec->autocfg.hp_pins[0] = 0x14;
8664 spec->autocfg.speaker_pins[0] = 0x1b;
8667 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8669 if ((res >> 26) == ALC880_HP_EVENT)
8670 alc882_targa_automute(codec);
8673 static struct hda_verb alc882_asus_a7j_verbs[] = {
8674 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8677 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8678 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8679 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8681 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8682 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8683 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8685 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8686 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8687 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8688 { } /* end */
8691 static struct hda_verb alc882_asus_a7m_verbs[] = {
8692 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8695 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8696 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8697 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8699 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8700 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8701 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8703 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8704 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8705 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8706 { } /* end */
8709 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8711 unsigned int gpiostate, gpiomask, gpiodir;
8713 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8714 AC_VERB_GET_GPIO_DATA, 0);
8716 if (!muted)
8717 gpiostate |= (1 << pin);
8718 else
8719 gpiostate &= ~(1 << pin);
8721 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8722 AC_VERB_GET_GPIO_MASK, 0);
8723 gpiomask |= (1 << pin);
8725 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8726 AC_VERB_GET_GPIO_DIRECTION, 0);
8727 gpiodir |= (1 << pin);
8730 snd_hda_codec_write(codec, codec->afg, 0,
8731 AC_VERB_SET_GPIO_MASK, gpiomask);
8732 snd_hda_codec_write(codec, codec->afg, 0,
8733 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8735 msleep(1);
8737 snd_hda_codec_write(codec, codec->afg, 0,
8738 AC_VERB_SET_GPIO_DATA, gpiostate);
8741 /* set up GPIO at initialization */
8742 static void alc885_macpro_init_hook(struct hda_codec *codec)
8744 alc882_gpio_mute(codec, 0, 0);
8745 alc882_gpio_mute(codec, 1, 0);
8748 /* set up GPIO and update auto-muting at initialization */
8749 static void alc885_imac24_init_hook(struct hda_codec *codec)
8751 alc885_macpro_init_hook(codec);
8752 alc_automute_amp(codec);
8756 * generic initialization of ADC, input mixers and output mixers
8758 static struct hda_verb alc883_auto_init_verbs[] = {
8760 * Unmute ADC0-2 and set the default input to mic-in
8762 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8763 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8764 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8765 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8768 * Set up output mixers (0x0c - 0x0f)
8770 /* set vol=0 to output mixers */
8771 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8772 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8773 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8774 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8775 /* set up input amps for analog loopback */
8776 /* Amp Indices: DAC = 0, mixer = 1 */
8777 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8779 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8780 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8781 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8782 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8783 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8784 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8785 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8786 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8788 /* FIXME: use matrix-type input source selection */
8789 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8790 /* Input mixer2 */
8791 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8792 /* Input mixer3 */
8793 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8797 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8798 static struct hda_verb alc889A_mb31_ch2_init[] = {
8799 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8800 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8801 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8802 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8803 { } /* end */
8806 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8807 static struct hda_verb alc889A_mb31_ch4_init[] = {
8808 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8809 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8810 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8811 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8812 { } /* end */
8815 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8816 static struct hda_verb alc889A_mb31_ch5_init[] = {
8817 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8818 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8819 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8820 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8821 { } /* end */
8824 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8825 static struct hda_verb alc889A_mb31_ch6_init[] = {
8826 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8827 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8829 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8830 { } /* end */
8833 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8834 { 2, alc889A_mb31_ch2_init },
8835 { 4, alc889A_mb31_ch4_init },
8836 { 5, alc889A_mb31_ch5_init },
8837 { 6, alc889A_mb31_ch6_init },
8840 static struct hda_verb alc883_medion_eapd_verbs[] = {
8841 /* eanable EAPD on medion laptop */
8842 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8843 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8847 #define alc883_base_mixer alc882_base_mixer
8849 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8850 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8851 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8852 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8853 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8854 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8855 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8856 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8857 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8858 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8859 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8860 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8861 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8862 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8863 { } /* end */
8866 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8867 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8868 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8869 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8870 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8871 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8872 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8873 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8874 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8875 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8876 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8877 { } /* end */
8880 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8881 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8882 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8883 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8884 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8886 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8887 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8888 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8889 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8890 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8891 { } /* end */
8894 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8895 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8896 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8897 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8898 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8899 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8900 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8901 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8903 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8904 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8905 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8906 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8907 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8908 { } /* end */
8911 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8912 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8913 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8914 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8915 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8916 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8917 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8918 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8919 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8920 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8921 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8922 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8923 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8924 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8925 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8926 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8927 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8928 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8929 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8930 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8931 { } /* end */
8934 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8935 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8936 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8937 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8938 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8939 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8940 HDA_OUTPUT),
8941 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8942 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8943 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8944 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8945 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8946 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8947 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8948 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8949 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8950 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
8951 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8952 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8953 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
8954 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8955 { } /* end */
8958 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8959 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8960 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8961 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8962 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8963 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8964 HDA_OUTPUT),
8965 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8966 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8967 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8968 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8969 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8970 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8971 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8972 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8973 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8974 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
8975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8976 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8977 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
8978 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8979 { } /* end */
8982 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8983 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8984 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8985 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8986 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8987 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8988 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8989 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8990 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8991 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8992 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8993 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8994 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8995 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8996 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8997 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8999 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9000 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9001 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9002 { } /* end */
9005 static struct snd_kcontrol_new alc883_targa_mixer[] = {
9006 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9007 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9008 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9009 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9010 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9011 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9012 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9013 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9014 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9015 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9016 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9017 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9018 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9019 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9021 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9022 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9023 { } /* end */
9026 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9027 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9028 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9029 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9030 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9031 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9032 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9033 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9034 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9035 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9036 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9037 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9038 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9039 { } /* end */
9042 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9043 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9044 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9045 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9046 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9047 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9048 { } /* end */
9051 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9052 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9053 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9054 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9055 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9056 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9057 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9058 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9059 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9060 { } /* end */
9063 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9064 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9065 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9066 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9067 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9068 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9069 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9070 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9071 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9072 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9073 { } /* end */
9076 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9077 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9078 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9079 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9080 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9081 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9082 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9083 { } /* end */
9086 static struct hda_verb alc883_medion_wim2160_verbs[] = {
9087 /* Unmute front mixer */
9088 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9091 /* Set speaker pin to front mixer */
9092 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9094 /* Init headphone pin */
9095 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9096 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9097 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9098 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9100 { } /* end */
9103 /* toggle speaker-output according to the hp-jack state */
9104 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9106 struct alc_spec *spec = codec->spec;
9108 spec->autocfg.hp_pins[0] = 0x1a;
9109 spec->autocfg.speaker_pins[0] = 0x15;
9112 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9113 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9114 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9115 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9116 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9117 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9118 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9119 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9120 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9121 { } /* end */
9124 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9125 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9126 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9129 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9130 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9132 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9134 { } /* end */
9137 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9138 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9139 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9140 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9141 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9142 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9143 0x0d, 1, 0x0, HDA_OUTPUT),
9144 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9145 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9146 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9147 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9148 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9149 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9150 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9151 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9152 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9154 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9155 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9156 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9157 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9158 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9159 { } /* end */
9162 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9163 /* Output mixers */
9164 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9165 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9166 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9167 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9168 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9169 HDA_OUTPUT),
9170 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9171 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9172 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9173 /* Output switches */
9174 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9175 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9176 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9177 /* Boost mixers */
9178 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
9179 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
9180 /* Input mixers */
9181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9183 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9184 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9185 { } /* end */
9188 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9189 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9190 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9191 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9193 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9194 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9195 { } /* end */
9198 static struct hda_bind_ctls alc883_bind_cap_vol = {
9199 .ops = &snd_hda_bind_vol,
9200 .values = {
9201 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9202 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9207 static struct hda_bind_ctls alc883_bind_cap_switch = {
9208 .ops = &snd_hda_bind_sw,
9209 .values = {
9210 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9211 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9216 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9217 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9218 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9219 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9220 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9221 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9222 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9223 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9225 { } /* end */
9228 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9229 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9230 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9232 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9233 /* .name = "Capture Source", */
9234 .name = "Input Source",
9235 .count = 1,
9236 .info = alc_mux_enum_info,
9237 .get = alc_mux_enum_get,
9238 .put = alc_mux_enum_put,
9240 { } /* end */
9243 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9245 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9246 .name = "Channel Mode",
9247 .info = alc_ch_mode_info,
9248 .get = alc_ch_mode_get,
9249 .put = alc_ch_mode_put,
9251 { } /* end */
9254 /* toggle speaker-output according to the hp-jack state */
9255 static void alc883_mitac_setup(struct hda_codec *codec)
9257 struct alc_spec *spec = codec->spec;
9259 spec->autocfg.hp_pins[0] = 0x15;
9260 spec->autocfg.speaker_pins[0] = 0x14;
9261 spec->autocfg.speaker_pins[1] = 0x17;
9264 static struct hda_verb alc883_mitac_verbs[] = {
9265 /* HP */
9266 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9267 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9268 /* Subwoofer */
9269 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9270 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9272 /* enable unsolicited event */
9273 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9274 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9276 { } /* end */
9279 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9280 /* HP */
9281 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9283 /* Int speaker */
9284 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9286 /* enable unsolicited event */
9288 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9289 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9292 { } /* end */
9295 static struct hda_verb alc883_clevo_m720_verbs[] = {
9296 /* HP */
9297 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9298 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9299 /* Int speaker */
9300 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9301 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9303 /* enable unsolicited event */
9304 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9305 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9307 { } /* end */
9310 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9311 /* HP */
9312 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9314 /* Subwoofer */
9315 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9316 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9318 /* enable unsolicited event */
9319 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9321 { } /* end */
9324 static struct hda_verb alc883_targa_verbs[] = {
9325 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9328 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9329 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9331 /* Connect Line-Out side jack (SPDIF) to Side */
9332 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9333 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9334 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9335 /* Connect Mic jack to CLFE */
9336 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9337 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9338 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9339 /* Connect Line-in jack to Surround */
9340 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9341 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9342 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9343 /* Connect HP out jack to Front */
9344 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9345 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9346 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9348 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9350 { } /* end */
9353 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9354 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9355 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9356 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9357 { } /* end */
9360 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9361 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9362 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9363 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9364 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9365 { } /* end */
9368 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9369 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9371 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9372 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9373 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9374 { } /* end */
9377 static struct hda_verb alc883_haier_w66_verbs[] = {
9378 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9379 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9381 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9383 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9384 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9385 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9386 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9387 { } /* end */
9390 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9391 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9392 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9393 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9395 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9396 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9397 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9398 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9399 { } /* end */
9402 static struct hda_verb alc888_6st_dell_verbs[] = {
9403 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9407 static struct hda_verb alc883_vaiott_verbs[] = {
9408 /* HP */
9409 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9410 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9412 /* enable unsolicited event */
9413 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9415 { } /* end */
9418 static void alc888_3st_hp_setup(struct hda_codec *codec)
9420 struct alc_spec *spec = codec->spec;
9422 spec->autocfg.hp_pins[0] = 0x1b;
9423 spec->autocfg.speaker_pins[0] = 0x14;
9424 spec->autocfg.speaker_pins[1] = 0x16;
9425 spec->autocfg.speaker_pins[2] = 0x18;
9428 static struct hda_verb alc888_3st_hp_verbs[] = {
9429 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9430 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9431 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9432 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9433 { } /* end */
9437 * 2ch mode
9439 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9440 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9441 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9442 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9443 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9444 { } /* end */
9448 * 4ch mode
9450 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9451 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9452 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9453 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9454 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9455 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9456 { } /* end */
9460 * 6ch mode
9462 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9463 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9464 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9465 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9466 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9467 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9468 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9469 { } /* end */
9472 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9473 { 2, alc888_3st_hp_2ch_init },
9474 { 4, alc888_3st_hp_4ch_init },
9475 { 6, alc888_3st_hp_6ch_init },
9478 /* toggle front-jack and RCA according to the hp-jack state */
9479 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9481 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9483 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9484 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9485 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9486 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9489 /* toggle RCA according to the front-jack state */
9490 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9492 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9494 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9495 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9498 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9499 unsigned int res)
9501 if ((res >> 26) == ALC880_HP_EVENT)
9502 alc888_lenovo_ms7195_front_automute(codec);
9503 if ((res >> 26) == ALC880_FRONT_EVENT)
9504 alc888_lenovo_ms7195_rca_automute(codec);
9507 /* toggle speaker-output according to the hp-jack state */
9508 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9510 struct alc_spec *spec = codec->spec;
9512 spec->autocfg.hp_pins[0] = 0x14;
9513 spec->autocfg.speaker_pins[0] = 0x15;
9516 /* toggle speaker-output according to the hp-jack state */
9517 #define alc883_targa_init_hook alc882_targa_init_hook
9518 #define alc883_targa_unsol_event alc882_targa_unsol_event
9520 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9522 struct alc_spec *spec = codec->spec;
9524 spec->autocfg.hp_pins[0] = 0x15;
9525 spec->autocfg.speaker_pins[0] = 0x14;
9528 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9530 alc_automute_amp(codec);
9531 alc88x_simple_mic_automute(codec);
9534 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9535 unsigned int res)
9537 switch (res >> 26) {
9538 case ALC880_MIC_EVENT:
9539 alc88x_simple_mic_automute(codec);
9540 break;
9541 default:
9542 alc_automute_amp_unsol_event(codec, res);
9543 break;
9547 /* toggle speaker-output according to the hp-jack state */
9548 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9550 struct alc_spec *spec = codec->spec;
9552 spec->autocfg.hp_pins[0] = 0x14;
9553 spec->autocfg.speaker_pins[0] = 0x15;
9556 static void alc883_haier_w66_setup(struct hda_codec *codec)
9558 struct alc_spec *spec = codec->spec;
9560 spec->autocfg.hp_pins[0] = 0x1b;
9561 spec->autocfg.speaker_pins[0] = 0x14;
9564 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9566 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9568 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9569 HDA_AMP_MUTE, bits);
9572 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9574 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9576 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9577 HDA_AMP_MUTE, bits);
9578 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9579 HDA_AMP_MUTE, bits);
9582 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9583 unsigned int res)
9585 if ((res >> 26) == ALC880_HP_EVENT)
9586 alc883_lenovo_101e_all_automute(codec);
9587 if ((res >> 26) == ALC880_FRONT_EVENT)
9588 alc883_lenovo_101e_ispeaker_automute(codec);
9591 /* toggle speaker-output according to the hp-jack state */
9592 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9594 struct alc_spec *spec = codec->spec;
9596 spec->autocfg.hp_pins[0] = 0x14;
9597 spec->autocfg.speaker_pins[0] = 0x15;
9598 spec->autocfg.speaker_pins[1] = 0x16;
9601 static struct hda_verb alc883_acer_eapd_verbs[] = {
9602 /* HP Pin: output 0 (0x0c) */
9603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9604 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9605 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9606 /* Front Pin: output 0 (0x0c) */
9607 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9608 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9609 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9610 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9611 /* eanable EAPD on medion laptop */
9612 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9613 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9614 /* enable unsolicited event */
9615 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9619 static void alc888_6st_dell_setup(struct hda_codec *codec)
9621 struct alc_spec *spec = codec->spec;
9623 spec->autocfg.hp_pins[0] = 0x1b;
9624 spec->autocfg.speaker_pins[0] = 0x14;
9625 spec->autocfg.speaker_pins[1] = 0x15;
9626 spec->autocfg.speaker_pins[2] = 0x16;
9627 spec->autocfg.speaker_pins[3] = 0x17;
9630 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9632 struct alc_spec *spec = codec->spec;
9634 spec->autocfg.hp_pins[0] = 0x1b;
9635 spec->autocfg.speaker_pins[0] = 0x14;
9636 spec->autocfg.speaker_pins[1] = 0x15;
9637 spec->autocfg.speaker_pins[2] = 0x16;
9638 spec->autocfg.speaker_pins[3] = 0x17;
9639 spec->autocfg.speaker_pins[4] = 0x1a;
9642 static void alc883_vaiott_setup(struct hda_codec *codec)
9644 struct alc_spec *spec = codec->spec;
9646 spec->autocfg.hp_pins[0] = 0x15;
9647 spec->autocfg.speaker_pins[0] = 0x14;
9648 spec->autocfg.speaker_pins[1] = 0x17;
9651 static struct hda_verb alc888_asus_m90v_verbs[] = {
9652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9655 /* enable unsolicited event */
9656 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9657 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9658 { } /* end */
9661 static void alc883_mode2_setup(struct hda_codec *codec)
9663 struct alc_spec *spec = codec->spec;
9665 spec->autocfg.hp_pins[0] = 0x1b;
9666 spec->autocfg.speaker_pins[0] = 0x14;
9667 spec->autocfg.speaker_pins[1] = 0x15;
9668 spec->autocfg.speaker_pins[2] = 0x16;
9669 spec->ext_mic.pin = 0x18;
9670 spec->int_mic.pin = 0x19;
9671 spec->ext_mic.mux_idx = 0;
9672 spec->int_mic.mux_idx = 1;
9673 spec->auto_mic = 1;
9676 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9677 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9678 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9679 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9680 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9681 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9682 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9683 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9684 /* enable unsolicited event */
9685 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9686 { } /* end */
9689 static void alc883_eee1601_inithook(struct hda_codec *codec)
9691 struct alc_spec *spec = codec->spec;
9693 spec->autocfg.hp_pins[0] = 0x14;
9694 spec->autocfg.speaker_pins[0] = 0x1b;
9695 alc_automute_pin(codec);
9698 static struct hda_verb alc889A_mb31_verbs[] = {
9699 /* Init rear pin (used as headphone output) */
9700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9701 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9702 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9703 /* Init line pin (used as output in 4ch and 6ch mode) */
9704 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9705 /* Init line 2 pin (used as headphone out by default) */
9706 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9707 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9708 { } /* end */
9711 /* Mute speakers according to the headphone jack state */
9712 static void alc889A_mb31_automute(struct hda_codec *codec)
9714 unsigned int present;
9716 /* Mute only in 2ch or 4ch mode */
9717 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9718 == 0x00) {
9719 present = snd_hda_jack_detect(codec, 0x15);
9720 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9721 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9722 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9723 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9727 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9729 if ((res >> 26) == ALC880_HP_EVENT)
9730 alc889A_mb31_automute(codec);
9734 #ifdef CONFIG_SND_HDA_POWER_SAVE
9735 #define alc882_loopbacks alc880_loopbacks
9736 #endif
9738 /* pcm configuration: identical with ALC880 */
9739 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9740 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9741 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9742 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9744 static hda_nid_t alc883_slave_dig_outs[] = {
9745 ALC1200_DIGOUT_NID, 0,
9748 static hda_nid_t alc1200_slave_dig_outs[] = {
9749 ALC883_DIGOUT_NID, 0,
9753 * configuration and preset
9755 static const char * const alc882_models[ALC882_MODEL_LAST] = {
9756 [ALC882_3ST_DIG] = "3stack-dig",
9757 [ALC882_6ST_DIG] = "6stack-dig",
9758 [ALC882_ARIMA] = "arima",
9759 [ALC882_W2JC] = "w2jc",
9760 [ALC882_TARGA] = "targa",
9761 [ALC882_ASUS_A7J] = "asus-a7j",
9762 [ALC882_ASUS_A7M] = "asus-a7m",
9763 [ALC885_MACPRO] = "macpro",
9764 [ALC885_MB5] = "mb5",
9765 [ALC885_MACMINI3] = "macmini3",
9766 [ALC885_MBA21] = "mba21",
9767 [ALC885_MBP3] = "mbp3",
9768 [ALC885_IMAC24] = "imac24",
9769 [ALC885_IMAC91] = "imac91",
9770 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9771 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9772 [ALC883_3ST_6ch] = "3stack-6ch",
9773 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9774 [ALC883_TARGA_DIG] = "targa-dig",
9775 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9776 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9777 [ALC883_ACER] = "acer",
9778 [ALC883_ACER_ASPIRE] = "acer-aspire",
9779 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9780 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9781 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9782 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9783 [ALC883_MEDION] = "medion",
9784 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9785 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9786 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9787 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9788 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9789 [ALC888_LENOVO_SKY] = "lenovo-sky",
9790 [ALC883_HAIER_W66] = "haier-w66",
9791 [ALC888_3ST_HP] = "3stack-hp",
9792 [ALC888_6ST_DELL] = "6stack-dell",
9793 [ALC883_MITAC] = "mitac",
9794 [ALC883_CLEVO_M540R] = "clevo-m540r",
9795 [ALC883_CLEVO_M720] = "clevo-m720",
9796 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9797 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9798 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9799 [ALC889A_INTEL] = "intel-alc889a",
9800 [ALC889_INTEL] = "intel-x58",
9801 [ALC1200_ASUS_P5Q] = "asus-p5q",
9802 [ALC889A_MB31] = "mb31",
9803 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9804 [ALC882_AUTO] = "auto",
9807 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9808 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9810 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9811 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9812 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9813 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9814 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9815 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9816 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9817 ALC888_ACER_ASPIRE_4930G),
9818 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9819 ALC888_ACER_ASPIRE_4930G),
9820 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9821 ALC888_ACER_ASPIRE_8930G),
9822 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9823 ALC888_ACER_ASPIRE_8930G),
9824 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9825 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9826 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9827 ALC888_ACER_ASPIRE_6530G),
9828 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9829 ALC888_ACER_ASPIRE_6530G),
9830 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9831 ALC888_ACER_ASPIRE_7730G),
9832 /* default Acer -- disabled as it causes more problems.
9833 * model=auto should work fine now
9835 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9837 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9839 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9840 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9841 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9842 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9843 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9844 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9846 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9847 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9848 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9849 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9850 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9851 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9852 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9853 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9854 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9855 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9856 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9858 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9859 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9860 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9861 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9862 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9863 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9864 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9865 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9867 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9868 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9869 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9870 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9871 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9872 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9873 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9874 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9875 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9876 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9877 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9878 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9879 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9880 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9881 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9882 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9883 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9884 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9885 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9886 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9887 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9888 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9889 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9890 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9891 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9892 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9893 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9894 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9895 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9896 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9897 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9899 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9900 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9901 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9902 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9903 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9904 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9905 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9906 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9907 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9908 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9909 ALC883_FUJITSU_PI2515),
9910 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9911 ALC888_FUJITSU_XA3530),
9912 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9913 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9914 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9915 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9916 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9917 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9918 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9919 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9921 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9922 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9923 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9924 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9925 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9926 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9927 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9932 /* codec SSID table for Intel Mac */
9933 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9934 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9935 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9936 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9937 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9938 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9939 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9940 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9941 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9942 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9943 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9944 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9945 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9946 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9947 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9948 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9949 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9950 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9951 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9952 * so apparently no perfect solution yet
9954 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9955 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9956 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9957 {} /* terminator */
9960 static struct alc_config_preset alc882_presets[] = {
9961 [ALC882_3ST_DIG] = {
9962 .mixers = { alc882_base_mixer },
9963 .init_verbs = { alc882_base_init_verbs,
9964 alc882_adc1_init_verbs },
9965 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9966 .dac_nids = alc882_dac_nids,
9967 .dig_out_nid = ALC882_DIGOUT_NID,
9968 .dig_in_nid = ALC882_DIGIN_NID,
9969 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9970 .channel_mode = alc882_ch_modes,
9971 .need_dac_fix = 1,
9972 .input_mux = &alc882_capture_source,
9974 [ALC882_6ST_DIG] = {
9975 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9976 .init_verbs = { alc882_base_init_verbs,
9977 alc882_adc1_init_verbs },
9978 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9979 .dac_nids = alc882_dac_nids,
9980 .dig_out_nid = ALC882_DIGOUT_NID,
9981 .dig_in_nid = ALC882_DIGIN_NID,
9982 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9983 .channel_mode = alc882_sixstack_modes,
9984 .input_mux = &alc882_capture_source,
9986 [ALC882_ARIMA] = {
9987 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9988 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9989 alc882_eapd_verbs },
9990 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9991 .dac_nids = alc882_dac_nids,
9992 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9993 .channel_mode = alc882_sixstack_modes,
9994 .input_mux = &alc882_capture_source,
9996 [ALC882_W2JC] = {
9997 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9998 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9999 alc882_eapd_verbs, alc880_gpio1_init_verbs },
10000 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10001 .dac_nids = alc882_dac_nids,
10002 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10003 .channel_mode = alc880_threestack_modes,
10004 .need_dac_fix = 1,
10005 .input_mux = &alc882_capture_source,
10006 .dig_out_nid = ALC882_DIGOUT_NID,
10008 [ALC885_MBA21] = {
10009 .mixers = { alc885_mba21_mixer },
10010 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
10011 .num_dacs = 2,
10012 .dac_nids = alc882_dac_nids,
10013 .channel_mode = alc885_mba21_ch_modes,
10014 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10015 .input_mux = &alc882_capture_source,
10016 .unsol_event = alc_automute_amp_unsol_event,
10017 .setup = alc885_mba21_setup,
10018 .init_hook = alc_automute_amp,
10020 [ALC885_MBP3] = {
10021 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
10022 .init_verbs = { alc885_mbp3_init_verbs,
10023 alc880_gpio1_init_verbs },
10024 .num_dacs = 2,
10025 .dac_nids = alc882_dac_nids,
10026 .hp_nid = 0x04,
10027 .channel_mode = alc885_mbp_4ch_modes,
10028 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10029 .input_mux = &alc882_capture_source,
10030 .dig_out_nid = ALC882_DIGOUT_NID,
10031 .dig_in_nid = ALC882_DIGIN_NID,
10032 .unsol_event = alc_automute_amp_unsol_event,
10033 .setup = alc885_mbp3_setup,
10034 .init_hook = alc_automute_amp,
10036 [ALC885_MB5] = {
10037 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10038 .init_verbs = { alc885_mb5_init_verbs,
10039 alc880_gpio1_init_verbs },
10040 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10041 .dac_nids = alc882_dac_nids,
10042 .channel_mode = alc885_mb5_6ch_modes,
10043 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10044 .input_mux = &mb5_capture_source,
10045 .dig_out_nid = ALC882_DIGOUT_NID,
10046 .dig_in_nid = ALC882_DIGIN_NID,
10047 .unsol_event = alc_automute_amp_unsol_event,
10048 .setup = alc885_mb5_setup,
10049 .init_hook = alc_automute_amp,
10051 [ALC885_MACMINI3] = {
10052 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10053 .init_verbs = { alc885_macmini3_init_verbs,
10054 alc880_gpio1_init_verbs },
10055 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10056 .dac_nids = alc882_dac_nids,
10057 .channel_mode = alc885_macmini3_6ch_modes,
10058 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10059 .input_mux = &macmini3_capture_source,
10060 .dig_out_nid = ALC882_DIGOUT_NID,
10061 .dig_in_nid = ALC882_DIGIN_NID,
10062 .unsol_event = alc_automute_amp_unsol_event,
10063 .setup = alc885_macmini3_setup,
10064 .init_hook = alc_automute_amp,
10066 [ALC885_MACPRO] = {
10067 .mixers = { alc882_macpro_mixer },
10068 .init_verbs = { alc882_macpro_init_verbs },
10069 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10070 .dac_nids = alc882_dac_nids,
10071 .dig_out_nid = ALC882_DIGOUT_NID,
10072 .dig_in_nid = ALC882_DIGIN_NID,
10073 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10074 .channel_mode = alc882_ch_modes,
10075 .input_mux = &alc882_capture_source,
10076 .init_hook = alc885_macpro_init_hook,
10078 [ALC885_IMAC24] = {
10079 .mixers = { alc885_imac24_mixer },
10080 .init_verbs = { alc885_imac24_init_verbs },
10081 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10082 .dac_nids = alc882_dac_nids,
10083 .dig_out_nid = ALC882_DIGOUT_NID,
10084 .dig_in_nid = ALC882_DIGIN_NID,
10085 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10086 .channel_mode = alc882_ch_modes,
10087 .input_mux = &alc882_capture_source,
10088 .unsol_event = alc_automute_amp_unsol_event,
10089 .setup = alc885_imac24_setup,
10090 .init_hook = alc885_imac24_init_hook,
10092 [ALC885_IMAC91] = {
10093 .mixers = {alc885_imac91_mixer},
10094 .init_verbs = { alc885_imac91_init_verbs,
10095 alc880_gpio1_init_verbs },
10096 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10097 .dac_nids = alc882_dac_nids,
10098 .channel_mode = alc885_mba21_ch_modes,
10099 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10100 .input_mux = &alc889A_imac91_capture_source,
10101 .dig_out_nid = ALC882_DIGOUT_NID,
10102 .dig_in_nid = ALC882_DIGIN_NID,
10103 .unsol_event = alc_automute_amp_unsol_event,
10104 .setup = alc885_imac91_setup,
10105 .init_hook = alc_automute_amp,
10107 [ALC882_TARGA] = {
10108 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10109 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10110 alc880_gpio3_init_verbs, alc882_targa_verbs},
10111 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10112 .dac_nids = alc882_dac_nids,
10113 .dig_out_nid = ALC882_DIGOUT_NID,
10114 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10115 .adc_nids = alc882_adc_nids,
10116 .capsrc_nids = alc882_capsrc_nids,
10117 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10118 .channel_mode = alc882_3ST_6ch_modes,
10119 .need_dac_fix = 1,
10120 .input_mux = &alc882_capture_source,
10121 .unsol_event = alc882_targa_unsol_event,
10122 .setup = alc882_targa_setup,
10123 .init_hook = alc882_targa_automute,
10125 [ALC882_ASUS_A7J] = {
10126 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10127 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10128 alc882_asus_a7j_verbs},
10129 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10130 .dac_nids = alc882_dac_nids,
10131 .dig_out_nid = ALC882_DIGOUT_NID,
10132 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10133 .adc_nids = alc882_adc_nids,
10134 .capsrc_nids = alc882_capsrc_nids,
10135 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10136 .channel_mode = alc882_3ST_6ch_modes,
10137 .need_dac_fix = 1,
10138 .input_mux = &alc882_capture_source,
10140 [ALC882_ASUS_A7M] = {
10141 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10142 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10143 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10144 alc882_asus_a7m_verbs },
10145 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10146 .dac_nids = alc882_dac_nids,
10147 .dig_out_nid = ALC882_DIGOUT_NID,
10148 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10149 .channel_mode = alc880_threestack_modes,
10150 .need_dac_fix = 1,
10151 .input_mux = &alc882_capture_source,
10153 [ALC883_3ST_2ch_DIG] = {
10154 .mixers = { alc883_3ST_2ch_mixer },
10155 .init_verbs = { alc883_init_verbs },
10156 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10157 .dac_nids = alc883_dac_nids,
10158 .dig_out_nid = ALC883_DIGOUT_NID,
10159 .dig_in_nid = ALC883_DIGIN_NID,
10160 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10161 .channel_mode = alc883_3ST_2ch_modes,
10162 .input_mux = &alc883_capture_source,
10164 [ALC883_3ST_6ch_DIG] = {
10165 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10166 .init_verbs = { alc883_init_verbs },
10167 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10168 .dac_nids = alc883_dac_nids,
10169 .dig_out_nid = ALC883_DIGOUT_NID,
10170 .dig_in_nid = ALC883_DIGIN_NID,
10171 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10172 .channel_mode = alc883_3ST_6ch_modes,
10173 .need_dac_fix = 1,
10174 .input_mux = &alc883_capture_source,
10176 [ALC883_3ST_6ch] = {
10177 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10178 .init_verbs = { alc883_init_verbs },
10179 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10180 .dac_nids = alc883_dac_nids,
10181 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10182 .channel_mode = alc883_3ST_6ch_modes,
10183 .need_dac_fix = 1,
10184 .input_mux = &alc883_capture_source,
10186 [ALC883_3ST_6ch_INTEL] = {
10187 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10188 .init_verbs = { alc883_init_verbs },
10189 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10190 .dac_nids = alc883_dac_nids,
10191 .dig_out_nid = ALC883_DIGOUT_NID,
10192 .dig_in_nid = ALC883_DIGIN_NID,
10193 .slave_dig_outs = alc883_slave_dig_outs,
10194 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10195 .channel_mode = alc883_3ST_6ch_intel_modes,
10196 .need_dac_fix = 1,
10197 .input_mux = &alc883_3stack_6ch_intel,
10199 [ALC889A_INTEL] = {
10200 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10201 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10202 alc_hp15_unsol_verbs },
10203 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10204 .dac_nids = alc883_dac_nids,
10205 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10206 .adc_nids = alc889_adc_nids,
10207 .dig_out_nid = ALC883_DIGOUT_NID,
10208 .dig_in_nid = ALC883_DIGIN_NID,
10209 .slave_dig_outs = alc883_slave_dig_outs,
10210 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10211 .channel_mode = alc889_8ch_intel_modes,
10212 .capsrc_nids = alc889_capsrc_nids,
10213 .input_mux = &alc889_capture_source,
10214 .setup = alc889_automute_setup,
10215 .init_hook = alc_automute_amp,
10216 .unsol_event = alc_automute_amp_unsol_event,
10217 .need_dac_fix = 1,
10219 [ALC889_INTEL] = {
10220 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10221 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10222 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10223 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10224 .dac_nids = alc883_dac_nids,
10225 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10226 .adc_nids = alc889_adc_nids,
10227 .dig_out_nid = ALC883_DIGOUT_NID,
10228 .dig_in_nid = ALC883_DIGIN_NID,
10229 .slave_dig_outs = alc883_slave_dig_outs,
10230 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10231 .channel_mode = alc889_8ch_intel_modes,
10232 .capsrc_nids = alc889_capsrc_nids,
10233 .input_mux = &alc889_capture_source,
10234 .setup = alc889_automute_setup,
10235 .init_hook = alc889_intel_init_hook,
10236 .unsol_event = alc_automute_amp_unsol_event,
10237 .need_dac_fix = 1,
10239 [ALC883_6ST_DIG] = {
10240 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10241 .init_verbs = { alc883_init_verbs },
10242 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10243 .dac_nids = alc883_dac_nids,
10244 .dig_out_nid = ALC883_DIGOUT_NID,
10245 .dig_in_nid = ALC883_DIGIN_NID,
10246 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10247 .channel_mode = alc883_sixstack_modes,
10248 .input_mux = &alc883_capture_source,
10250 [ALC883_TARGA_DIG] = {
10251 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10252 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10253 alc883_targa_verbs},
10254 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10255 .dac_nids = alc883_dac_nids,
10256 .dig_out_nid = ALC883_DIGOUT_NID,
10257 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10258 .channel_mode = alc883_3ST_6ch_modes,
10259 .need_dac_fix = 1,
10260 .input_mux = &alc883_capture_source,
10261 .unsol_event = alc883_targa_unsol_event,
10262 .setup = alc882_targa_setup,
10263 .init_hook = alc882_targa_automute,
10265 [ALC883_TARGA_2ch_DIG] = {
10266 .mixers = { alc883_targa_2ch_mixer},
10267 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10268 alc883_targa_verbs},
10269 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10270 .dac_nids = alc883_dac_nids,
10271 .adc_nids = alc883_adc_nids_alt,
10272 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10273 .capsrc_nids = alc883_capsrc_nids,
10274 .dig_out_nid = ALC883_DIGOUT_NID,
10275 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10276 .channel_mode = alc883_3ST_2ch_modes,
10277 .input_mux = &alc883_capture_source,
10278 .unsol_event = alc883_targa_unsol_event,
10279 .setup = alc882_targa_setup,
10280 .init_hook = alc882_targa_automute,
10282 [ALC883_TARGA_8ch_DIG] = {
10283 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10284 alc883_chmode_mixer },
10285 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10286 alc883_targa_verbs },
10287 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10288 .dac_nids = alc883_dac_nids,
10289 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10290 .adc_nids = alc883_adc_nids_rev,
10291 .capsrc_nids = alc883_capsrc_nids_rev,
10292 .dig_out_nid = ALC883_DIGOUT_NID,
10293 .dig_in_nid = ALC883_DIGIN_NID,
10294 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10295 .channel_mode = alc883_4ST_8ch_modes,
10296 .need_dac_fix = 1,
10297 .input_mux = &alc883_capture_source,
10298 .unsol_event = alc883_targa_unsol_event,
10299 .setup = alc882_targa_setup,
10300 .init_hook = alc882_targa_automute,
10302 [ALC883_ACER] = {
10303 .mixers = { alc883_base_mixer },
10304 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10305 * and the headphone jack. Turn this on and rely on the
10306 * standard mute methods whenever the user wants to turn
10307 * these outputs off.
10309 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10310 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10311 .dac_nids = alc883_dac_nids,
10312 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10313 .channel_mode = alc883_3ST_2ch_modes,
10314 .input_mux = &alc883_capture_source,
10316 [ALC883_ACER_ASPIRE] = {
10317 .mixers = { alc883_acer_aspire_mixer },
10318 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10319 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10320 .dac_nids = alc883_dac_nids,
10321 .dig_out_nid = ALC883_DIGOUT_NID,
10322 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10323 .channel_mode = alc883_3ST_2ch_modes,
10324 .input_mux = &alc883_capture_source,
10325 .unsol_event = alc_automute_amp_unsol_event,
10326 .setup = alc883_acer_aspire_setup,
10327 .init_hook = alc_automute_amp,
10329 [ALC888_ACER_ASPIRE_4930G] = {
10330 .mixers = { alc888_acer_aspire_4930g_mixer,
10331 alc883_chmode_mixer },
10332 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10333 alc888_acer_aspire_4930g_verbs },
10334 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10335 .dac_nids = alc883_dac_nids,
10336 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10337 .adc_nids = alc883_adc_nids_rev,
10338 .capsrc_nids = alc883_capsrc_nids_rev,
10339 .dig_out_nid = ALC883_DIGOUT_NID,
10340 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10341 .channel_mode = alc883_3ST_6ch_modes,
10342 .need_dac_fix = 1,
10343 .const_channel_count = 6,
10344 .num_mux_defs =
10345 ARRAY_SIZE(alc888_2_capture_sources),
10346 .input_mux = alc888_2_capture_sources,
10347 .unsol_event = alc_automute_amp_unsol_event,
10348 .setup = alc888_acer_aspire_4930g_setup,
10349 .init_hook = alc_automute_amp,
10351 [ALC888_ACER_ASPIRE_6530G] = {
10352 .mixers = { alc888_acer_aspire_6530_mixer },
10353 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10354 alc888_acer_aspire_6530g_verbs },
10355 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10356 .dac_nids = alc883_dac_nids,
10357 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10358 .adc_nids = alc883_adc_nids_rev,
10359 .capsrc_nids = alc883_capsrc_nids_rev,
10360 .dig_out_nid = ALC883_DIGOUT_NID,
10361 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10362 .channel_mode = alc883_3ST_2ch_modes,
10363 .num_mux_defs =
10364 ARRAY_SIZE(alc888_2_capture_sources),
10365 .input_mux = alc888_acer_aspire_6530_sources,
10366 .unsol_event = alc_automute_amp_unsol_event,
10367 .setup = alc888_acer_aspire_6530g_setup,
10368 .init_hook = alc_automute_amp,
10370 [ALC888_ACER_ASPIRE_8930G] = {
10371 .mixers = { alc889_acer_aspire_8930g_mixer,
10372 alc883_chmode_mixer },
10373 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10374 alc889_acer_aspire_8930g_verbs,
10375 alc889_eapd_verbs},
10376 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10377 .dac_nids = alc883_dac_nids,
10378 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10379 .adc_nids = alc889_adc_nids,
10380 .capsrc_nids = alc889_capsrc_nids,
10381 .dig_out_nid = ALC883_DIGOUT_NID,
10382 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10383 .channel_mode = alc883_3ST_6ch_modes,
10384 .need_dac_fix = 1,
10385 .const_channel_count = 6,
10386 .num_mux_defs =
10387 ARRAY_SIZE(alc889_capture_sources),
10388 .input_mux = alc889_capture_sources,
10389 .unsol_event = alc_automute_amp_unsol_event,
10390 .setup = alc889_acer_aspire_8930g_setup,
10391 .init_hook = alc_automute_amp,
10392 #ifdef CONFIG_SND_HDA_POWER_SAVE
10393 .power_hook = alc_power_eapd,
10394 #endif
10396 [ALC888_ACER_ASPIRE_7730G] = {
10397 .mixers = { alc883_3ST_6ch_mixer,
10398 alc883_chmode_mixer },
10399 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10400 alc888_acer_aspire_7730G_verbs },
10401 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10402 .dac_nids = alc883_dac_nids,
10403 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10404 .adc_nids = alc883_adc_nids_rev,
10405 .capsrc_nids = alc883_capsrc_nids_rev,
10406 .dig_out_nid = ALC883_DIGOUT_NID,
10407 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10408 .channel_mode = alc883_3ST_6ch_modes,
10409 .need_dac_fix = 1,
10410 .const_channel_count = 6,
10411 .input_mux = &alc883_capture_source,
10412 .unsol_event = alc_automute_amp_unsol_event,
10413 .setup = alc888_acer_aspire_7730g_setup,
10414 .init_hook = alc_automute_amp,
10416 [ALC883_MEDION] = {
10417 .mixers = { alc883_fivestack_mixer,
10418 alc883_chmode_mixer },
10419 .init_verbs = { alc883_init_verbs,
10420 alc883_medion_eapd_verbs },
10421 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10422 .dac_nids = alc883_dac_nids,
10423 .adc_nids = alc883_adc_nids_alt,
10424 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10425 .capsrc_nids = alc883_capsrc_nids,
10426 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10427 .channel_mode = alc883_sixstack_modes,
10428 .input_mux = &alc883_capture_source,
10430 [ALC883_MEDION_WIM2160] = {
10431 .mixers = { alc883_medion_wim2160_mixer },
10432 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10433 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10434 .dac_nids = alc883_dac_nids,
10435 .dig_out_nid = ALC883_DIGOUT_NID,
10436 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10437 .adc_nids = alc883_adc_nids,
10438 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10439 .channel_mode = alc883_3ST_2ch_modes,
10440 .input_mux = &alc883_capture_source,
10441 .unsol_event = alc_automute_amp_unsol_event,
10442 .setup = alc883_medion_wim2160_setup,
10443 .init_hook = alc_automute_amp,
10445 [ALC883_LAPTOP_EAPD] = {
10446 .mixers = { alc883_base_mixer },
10447 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10448 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10449 .dac_nids = alc883_dac_nids,
10450 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10451 .channel_mode = alc883_3ST_2ch_modes,
10452 .input_mux = &alc883_capture_source,
10454 [ALC883_CLEVO_M540R] = {
10455 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10456 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10457 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10458 .dac_nids = alc883_dac_nids,
10459 .dig_out_nid = ALC883_DIGOUT_NID,
10460 .dig_in_nid = ALC883_DIGIN_NID,
10461 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10462 .channel_mode = alc883_3ST_6ch_clevo_modes,
10463 .need_dac_fix = 1,
10464 .input_mux = &alc883_capture_source,
10465 /* This machine has the hardware HP auto-muting, thus
10466 * we need no software mute via unsol event
10469 [ALC883_CLEVO_M720] = {
10470 .mixers = { alc883_clevo_m720_mixer },
10471 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10472 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10473 .dac_nids = alc883_dac_nids,
10474 .dig_out_nid = ALC883_DIGOUT_NID,
10475 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10476 .channel_mode = alc883_3ST_2ch_modes,
10477 .input_mux = &alc883_capture_source,
10478 .unsol_event = alc883_clevo_m720_unsol_event,
10479 .setup = alc883_clevo_m720_setup,
10480 .init_hook = alc883_clevo_m720_init_hook,
10482 [ALC883_LENOVO_101E_2ch] = {
10483 .mixers = { alc883_lenovo_101e_2ch_mixer},
10484 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10485 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10486 .dac_nids = alc883_dac_nids,
10487 .adc_nids = alc883_adc_nids_alt,
10488 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10489 .capsrc_nids = alc883_capsrc_nids,
10490 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10491 .channel_mode = alc883_3ST_2ch_modes,
10492 .input_mux = &alc883_lenovo_101e_capture_source,
10493 .unsol_event = alc883_lenovo_101e_unsol_event,
10494 .init_hook = alc883_lenovo_101e_all_automute,
10496 [ALC883_LENOVO_NB0763] = {
10497 .mixers = { alc883_lenovo_nb0763_mixer },
10498 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10499 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10500 .dac_nids = alc883_dac_nids,
10501 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10502 .channel_mode = alc883_3ST_2ch_modes,
10503 .need_dac_fix = 1,
10504 .input_mux = &alc883_lenovo_nb0763_capture_source,
10505 .unsol_event = alc_automute_amp_unsol_event,
10506 .setup = alc883_lenovo_nb0763_setup,
10507 .init_hook = alc_automute_amp,
10509 [ALC888_LENOVO_MS7195_DIG] = {
10510 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10511 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10512 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10513 .dac_nids = alc883_dac_nids,
10514 .dig_out_nid = ALC883_DIGOUT_NID,
10515 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10516 .channel_mode = alc883_3ST_6ch_modes,
10517 .need_dac_fix = 1,
10518 .input_mux = &alc883_capture_source,
10519 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10520 .init_hook = alc888_lenovo_ms7195_front_automute,
10522 [ALC883_HAIER_W66] = {
10523 .mixers = { alc883_targa_2ch_mixer},
10524 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10525 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10526 .dac_nids = alc883_dac_nids,
10527 .dig_out_nid = ALC883_DIGOUT_NID,
10528 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10529 .channel_mode = alc883_3ST_2ch_modes,
10530 .input_mux = &alc883_capture_source,
10531 .unsol_event = alc_automute_amp_unsol_event,
10532 .setup = alc883_haier_w66_setup,
10533 .init_hook = alc_automute_amp,
10535 [ALC888_3ST_HP] = {
10536 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10537 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10538 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10539 .dac_nids = alc883_dac_nids,
10540 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10541 .channel_mode = alc888_3st_hp_modes,
10542 .need_dac_fix = 1,
10543 .input_mux = &alc883_capture_source,
10544 .unsol_event = alc_automute_amp_unsol_event,
10545 .setup = alc888_3st_hp_setup,
10546 .init_hook = alc_automute_amp,
10548 [ALC888_6ST_DELL] = {
10549 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10550 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10551 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10552 .dac_nids = alc883_dac_nids,
10553 .dig_out_nid = ALC883_DIGOUT_NID,
10554 .dig_in_nid = ALC883_DIGIN_NID,
10555 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10556 .channel_mode = alc883_sixstack_modes,
10557 .input_mux = &alc883_capture_source,
10558 .unsol_event = alc_automute_amp_unsol_event,
10559 .setup = alc888_6st_dell_setup,
10560 .init_hook = alc_automute_amp,
10562 [ALC883_MITAC] = {
10563 .mixers = { alc883_mitac_mixer },
10564 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10565 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10566 .dac_nids = alc883_dac_nids,
10567 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10568 .channel_mode = alc883_3ST_2ch_modes,
10569 .input_mux = &alc883_capture_source,
10570 .unsol_event = alc_automute_amp_unsol_event,
10571 .setup = alc883_mitac_setup,
10572 .init_hook = alc_automute_amp,
10574 [ALC883_FUJITSU_PI2515] = {
10575 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10576 .init_verbs = { alc883_init_verbs,
10577 alc883_2ch_fujitsu_pi2515_verbs},
10578 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10579 .dac_nids = alc883_dac_nids,
10580 .dig_out_nid = ALC883_DIGOUT_NID,
10581 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10582 .channel_mode = alc883_3ST_2ch_modes,
10583 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10584 .unsol_event = alc_automute_amp_unsol_event,
10585 .setup = alc883_2ch_fujitsu_pi2515_setup,
10586 .init_hook = alc_automute_amp,
10588 [ALC888_FUJITSU_XA3530] = {
10589 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10590 .init_verbs = { alc883_init_verbs,
10591 alc888_fujitsu_xa3530_verbs },
10592 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10593 .dac_nids = alc883_dac_nids,
10594 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10595 .adc_nids = alc883_adc_nids_rev,
10596 .capsrc_nids = alc883_capsrc_nids_rev,
10597 .dig_out_nid = ALC883_DIGOUT_NID,
10598 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10599 .channel_mode = alc888_4ST_8ch_intel_modes,
10600 .num_mux_defs =
10601 ARRAY_SIZE(alc888_2_capture_sources),
10602 .input_mux = alc888_2_capture_sources,
10603 .unsol_event = alc_automute_amp_unsol_event,
10604 .setup = alc888_fujitsu_xa3530_setup,
10605 .init_hook = alc_automute_amp,
10607 [ALC888_LENOVO_SKY] = {
10608 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10609 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10610 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10611 .dac_nids = alc883_dac_nids,
10612 .dig_out_nid = ALC883_DIGOUT_NID,
10613 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10614 .channel_mode = alc883_sixstack_modes,
10615 .need_dac_fix = 1,
10616 .input_mux = &alc883_lenovo_sky_capture_source,
10617 .unsol_event = alc_automute_amp_unsol_event,
10618 .setup = alc888_lenovo_sky_setup,
10619 .init_hook = alc_automute_amp,
10621 [ALC888_ASUS_M90V] = {
10622 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10623 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10624 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10625 .dac_nids = alc883_dac_nids,
10626 .dig_out_nid = ALC883_DIGOUT_NID,
10627 .dig_in_nid = ALC883_DIGIN_NID,
10628 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10629 .channel_mode = alc883_3ST_6ch_modes,
10630 .need_dac_fix = 1,
10631 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10632 .unsol_event = alc_sku_unsol_event,
10633 .setup = alc883_mode2_setup,
10634 .init_hook = alc_inithook,
10636 [ALC888_ASUS_EEE1601] = {
10637 .mixers = { alc883_asus_eee1601_mixer },
10638 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10639 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10640 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10641 .dac_nids = alc883_dac_nids,
10642 .dig_out_nid = ALC883_DIGOUT_NID,
10643 .dig_in_nid = ALC883_DIGIN_NID,
10644 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10645 .channel_mode = alc883_3ST_2ch_modes,
10646 .need_dac_fix = 1,
10647 .input_mux = &alc883_asus_eee1601_capture_source,
10648 .unsol_event = alc_sku_unsol_event,
10649 .init_hook = alc883_eee1601_inithook,
10651 [ALC1200_ASUS_P5Q] = {
10652 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10653 .init_verbs = { alc883_init_verbs },
10654 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10655 .dac_nids = alc883_dac_nids,
10656 .dig_out_nid = ALC1200_DIGOUT_NID,
10657 .dig_in_nid = ALC883_DIGIN_NID,
10658 .slave_dig_outs = alc1200_slave_dig_outs,
10659 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10660 .channel_mode = alc883_sixstack_modes,
10661 .input_mux = &alc883_capture_source,
10663 [ALC889A_MB31] = {
10664 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10665 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10666 alc880_gpio1_init_verbs },
10667 .adc_nids = alc883_adc_nids,
10668 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10669 .capsrc_nids = alc883_capsrc_nids,
10670 .dac_nids = alc883_dac_nids,
10671 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10672 .channel_mode = alc889A_mb31_6ch_modes,
10673 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10674 .input_mux = &alc889A_mb31_capture_source,
10675 .dig_out_nid = ALC883_DIGOUT_NID,
10676 .unsol_event = alc889A_mb31_unsol_event,
10677 .init_hook = alc889A_mb31_automute,
10679 [ALC883_SONY_VAIO_TT] = {
10680 .mixers = { alc883_vaiott_mixer },
10681 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10682 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10683 .dac_nids = alc883_dac_nids,
10684 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10685 .channel_mode = alc883_3ST_2ch_modes,
10686 .input_mux = &alc883_capture_source,
10687 .unsol_event = alc_automute_amp_unsol_event,
10688 .setup = alc883_vaiott_setup,
10689 .init_hook = alc_automute_amp,
10695 * Pin config fixes
10697 enum {
10698 PINFIX_ABIT_AW9D_MAX,
10699 PINFIX_LENOVO_Y530,
10700 PINFIX_PB_M5210,
10701 PINFIX_ACER_ASPIRE_7736,
10702 PINFIX_GIGABYTE_880GM,
10705 static const struct alc_fixup alc882_fixups[] = {
10706 [PINFIX_ABIT_AW9D_MAX] = {
10707 .type = ALC_FIXUP_PINS,
10708 .v.pins = (const struct alc_pincfg[]) {
10709 { 0x15, 0x01080104 }, /* side */
10710 { 0x16, 0x01011012 }, /* rear */
10711 { 0x17, 0x01016011 }, /* clfe */
10715 [PINFIX_LENOVO_Y530] = {
10716 .type = ALC_FIXUP_PINS,
10717 .v.pins = (const struct alc_pincfg[]) {
10718 { 0x15, 0x99130112 }, /* rear int speakers */
10719 { 0x16, 0x99130111 }, /* subwoofer */
10723 [PINFIX_PB_M5210] = {
10724 .type = ALC_FIXUP_VERBS,
10725 .v.verbs = (const struct hda_verb[]) {
10726 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10730 [PINFIX_ACER_ASPIRE_7736] = {
10731 .type = ALC_FIXUP_SKU,
10732 .v.sku = ALC_FIXUP_SKU_IGNORE,
10734 [PINFIX_GIGABYTE_880GM] = {
10735 .type = ALC_FIXUP_PINS,
10736 .v.pins = (const struct alc_pincfg[]) {
10737 { 0x14, 0x1114410 }, /* set as speaker */
10743 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10744 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10745 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
10746 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10747 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10748 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", PINFIX_GIGABYTE_880GM),
10753 * BIOS auto configuration
10755 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10756 const struct auto_pin_cfg *cfg)
10758 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10761 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10762 hda_nid_t nid, int pin_type,
10763 hda_nid_t dac)
10765 int idx;
10767 /* set as output */
10768 alc_set_pin_output(codec, nid, pin_type);
10770 if (dac == 0x25)
10771 idx = 4;
10772 else if (dac >= 0x02 && dac <= 0x05)
10773 idx = dac - 2;
10774 else
10775 return;
10776 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10779 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10781 struct alc_spec *spec = codec->spec;
10782 int i;
10784 for (i = 0; i <= HDA_SIDE; i++) {
10785 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10786 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10787 if (nid)
10788 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10789 spec->multiout.dac_nids[i]);
10793 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10795 struct alc_spec *spec = codec->spec;
10796 hda_nid_t pin, dac;
10797 int i;
10799 if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) {
10800 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10801 pin = spec->autocfg.hp_pins[i];
10802 if (!pin)
10803 break;
10804 dac = spec->multiout.hp_nid;
10805 if (!dac)
10806 dac = spec->multiout.dac_nids[0]; /* to front */
10807 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10811 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) {
10812 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10813 pin = spec->autocfg.speaker_pins[i];
10814 if (!pin)
10815 break;
10816 dac = spec->multiout.extra_out_nid[0];
10817 if (!dac)
10818 dac = spec->multiout.dac_nids[0]; /* to front */
10819 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10824 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10826 struct alc_spec *spec = codec->spec;
10827 struct auto_pin_cfg *cfg = &spec->autocfg;
10828 int i;
10830 for (i = 0; i < cfg->num_inputs; i++) {
10831 hda_nid_t nid = cfg->inputs[i].pin;
10832 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10833 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10834 snd_hda_codec_write(codec, nid, 0,
10835 AC_VERB_SET_AMP_GAIN_MUTE,
10836 AMP_OUT_MUTE);
10840 static void alc882_auto_init_input_src(struct hda_codec *codec)
10842 struct alc_spec *spec = codec->spec;
10843 int c;
10845 for (c = 0; c < spec->num_adc_nids; c++) {
10846 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10847 hda_nid_t nid = spec->capsrc_nids[c];
10848 unsigned int mux_idx;
10849 const struct hda_input_mux *imux;
10850 int conns, mute, idx, item;
10852 conns = snd_hda_get_connections(codec, nid, conn_list,
10853 ARRAY_SIZE(conn_list));
10854 if (conns < 0)
10855 continue;
10856 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10857 imux = &spec->input_mux[mux_idx];
10858 if (!imux->num_items && mux_idx > 0)
10859 imux = &spec->input_mux[0];
10860 for (idx = 0; idx < conns; idx++) {
10861 /* if the current connection is the selected one,
10862 * unmute it as default - otherwise mute it
10864 mute = AMP_IN_MUTE(idx);
10865 for (item = 0; item < imux->num_items; item++) {
10866 if (imux->items[item].index == idx) {
10867 if (spec->cur_mux[c] == item)
10868 mute = AMP_IN_UNMUTE(idx);
10869 break;
10872 /* check if we have a selector or mixer
10873 * we could check for the widget type instead, but
10874 * just check for Amp-In presence (in case of mixer
10875 * without amp-in there is something wrong, this
10876 * function shouldn't be used or capsrc nid is wrong)
10878 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10879 snd_hda_codec_write(codec, nid, 0,
10880 AC_VERB_SET_AMP_GAIN_MUTE,
10881 mute);
10882 else if (mute != AMP_IN_MUTE(idx))
10883 snd_hda_codec_write(codec, nid, 0,
10884 AC_VERB_SET_CONNECT_SEL,
10885 idx);
10890 /* add mic boosts if needed */
10891 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10893 struct alc_spec *spec = codec->spec;
10894 struct auto_pin_cfg *cfg = &spec->autocfg;
10895 int i, err;
10896 int type_idx = 0;
10897 hda_nid_t nid;
10898 const char *prev_label = NULL;
10900 for (i = 0; i < cfg->num_inputs; i++) {
10901 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10902 break;
10903 nid = cfg->inputs[i].pin;
10904 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10905 const char *label;
10906 char boost_label[32];
10908 label = hda_get_autocfg_input_label(codec, cfg, i);
10909 if (prev_label && !strcmp(label, prev_label))
10910 type_idx++;
10911 else
10912 type_idx = 0;
10913 prev_label = label;
10915 snprintf(boost_label, sizeof(boost_label),
10916 "%s Boost Volume", label);
10917 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10918 boost_label, type_idx,
10919 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10920 if (err < 0)
10921 return err;
10924 return 0;
10927 /* almost identical with ALC880 parser... */
10928 static int alc882_parse_auto_config(struct hda_codec *codec)
10930 struct alc_spec *spec = codec->spec;
10931 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10932 int err;
10934 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10935 alc882_ignore);
10936 if (err < 0)
10937 return err;
10938 if (!spec->autocfg.line_outs)
10939 return 0; /* can't find valid BIOS pin config */
10941 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10942 if (err < 0)
10943 return err;
10944 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10945 if (err < 0)
10946 return err;
10947 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10948 "Headphone");
10949 if (err < 0)
10950 return err;
10951 err = alc880_auto_create_extra_out(spec,
10952 spec->autocfg.speaker_pins[0],
10953 "Speaker");
10954 if (err < 0)
10955 return err;
10956 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10957 if (err < 0)
10958 return err;
10960 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10962 alc_auto_parse_digital(codec);
10964 if (spec->kctls.list)
10965 add_mixer(spec, spec->kctls.list);
10967 add_verb(spec, alc883_auto_init_verbs);
10968 /* if ADC 0x07 is available, initialize it, too */
10969 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10970 add_verb(spec, alc882_adc1_init_verbs);
10972 spec->num_mux_defs = 1;
10973 spec->input_mux = &spec->private_imux[0];
10975 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10977 err = alc_auto_add_mic_boost(codec);
10978 if (err < 0)
10979 return err;
10981 return 1; /* config found */
10984 /* additional initialization for auto-configuration model */
10985 static void alc882_auto_init(struct hda_codec *codec)
10987 struct alc_spec *spec = codec->spec;
10988 alc882_auto_init_multi_out(codec);
10989 alc882_auto_init_hp_out(codec);
10990 alc882_auto_init_analog_input(codec);
10991 alc882_auto_init_input_src(codec);
10992 alc_auto_init_digital(codec);
10993 if (spec->unsol_event)
10994 alc_inithook(codec);
10997 static int patch_alc882(struct hda_codec *codec)
10999 struct alc_spec *spec;
11000 int err, board_config;
11002 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11003 if (spec == NULL)
11004 return -ENOMEM;
11006 codec->spec = spec;
11008 switch (codec->vendor_id) {
11009 case 0x10ec0882:
11010 case 0x10ec0885:
11011 break;
11012 default:
11013 /* ALC883 and variants */
11014 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11015 break;
11018 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
11019 alc882_models,
11020 alc882_cfg_tbl);
11022 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
11023 board_config = snd_hda_check_board_codec_sid_config(codec,
11024 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
11026 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
11027 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11028 codec->chip_name);
11029 board_config = ALC882_AUTO;
11032 if (board_config == ALC882_AUTO) {
11033 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11034 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11037 alc_auto_parse_customize_define(codec);
11039 if (board_config == ALC882_AUTO) {
11040 /* automatic parse from the BIOS config */
11041 err = alc882_parse_auto_config(codec);
11042 if (err < 0) {
11043 alc_free(codec);
11044 return err;
11045 } else if (!err) {
11046 printk(KERN_INFO
11047 "hda_codec: Cannot set up configuration "
11048 "from BIOS. Using base mode...\n");
11049 board_config = ALC882_3ST_DIG;
11053 if (has_cdefine_beep(codec)) {
11054 err = snd_hda_attach_beep_device(codec, 0x1);
11055 if (err < 0) {
11056 alc_free(codec);
11057 return err;
11061 if (board_config != ALC882_AUTO)
11062 setup_preset(codec, &alc882_presets[board_config]);
11064 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11065 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11066 /* FIXME: setup DAC5 */
11067 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11068 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11070 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11071 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11073 if (!spec->adc_nids && spec->input_mux) {
11074 int i, j;
11075 spec->num_adc_nids = 0;
11076 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11077 const struct hda_input_mux *imux = spec->input_mux;
11078 hda_nid_t cap;
11079 hda_nid_t items[16];
11080 hda_nid_t nid = alc882_adc_nids[i];
11081 unsigned int wcap = get_wcaps(codec, nid);
11082 /* get type */
11083 wcap = get_wcaps_type(wcap);
11084 if (wcap != AC_WID_AUD_IN)
11085 continue;
11086 spec->private_adc_nids[spec->num_adc_nids] = nid;
11087 err = snd_hda_get_connections(codec, nid, &cap, 1);
11088 if (err < 0)
11089 continue;
11090 err = snd_hda_get_connections(codec, cap, items,
11091 ARRAY_SIZE(items));
11092 if (err < 0)
11093 continue;
11094 for (j = 0; j < imux->num_items; j++)
11095 if (imux->items[j].index >= err)
11096 break;
11097 if (j < imux->num_items)
11098 continue;
11099 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11100 spec->num_adc_nids++;
11102 spec->adc_nids = spec->private_adc_nids;
11103 spec->capsrc_nids = spec->private_capsrc_nids;
11106 set_capture_mixer(codec);
11108 if (has_cdefine_beep(codec))
11109 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11111 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11113 spec->vmaster_nid = 0x0c;
11115 codec->patch_ops = alc_patch_ops;
11116 if (board_config == ALC882_AUTO)
11117 spec->init_hook = alc882_auto_init;
11119 alc_init_jacks(codec);
11120 #ifdef CONFIG_SND_HDA_POWER_SAVE
11121 if (!spec->loopback.amplist)
11122 spec->loopback.amplist = alc882_loopbacks;
11123 #endif
11125 return 0;
11130 * ALC262 support
11133 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11134 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11136 #define alc262_dac_nids alc260_dac_nids
11137 #define alc262_adc_nids alc882_adc_nids
11138 #define alc262_adc_nids_alt alc882_adc_nids_alt
11139 #define alc262_capsrc_nids alc882_capsrc_nids
11140 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11142 #define alc262_modes alc260_modes
11143 #define alc262_capture_source alc882_capture_source
11145 static hda_nid_t alc262_dmic_adc_nids[1] = {
11146 /* ADC0 */
11147 0x09
11150 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11152 static struct snd_kcontrol_new alc262_base_mixer[] = {
11153 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11154 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11155 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11156 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11157 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11158 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11159 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11160 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11161 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11162 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11163 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11164 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11165 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11167 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11168 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11169 { } /* end */
11172 /* update HP, line and mono-out pins according to the master switch */
11173 static void alc262_hp_master_update(struct hda_codec *codec)
11175 struct alc_spec *spec = codec->spec;
11176 int val = spec->master_sw;
11178 /* HP & line-out */
11179 snd_hda_codec_write_cache(codec, 0x1b, 0,
11180 AC_VERB_SET_PIN_WIDGET_CONTROL,
11181 val ? PIN_HP : 0);
11182 snd_hda_codec_write_cache(codec, 0x15, 0,
11183 AC_VERB_SET_PIN_WIDGET_CONTROL,
11184 val ? PIN_HP : 0);
11185 /* mono (speaker) depending on the HP jack sense */
11186 val = val && !spec->jack_present;
11187 snd_hda_codec_write_cache(codec, 0x16, 0,
11188 AC_VERB_SET_PIN_WIDGET_CONTROL,
11189 val ? PIN_OUT : 0);
11192 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11194 struct alc_spec *spec = codec->spec;
11196 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11197 alc262_hp_master_update(codec);
11200 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11202 if ((res >> 26) != ALC880_HP_EVENT)
11203 return;
11204 alc262_hp_bpc_automute(codec);
11207 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11209 struct alc_spec *spec = codec->spec;
11211 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11212 alc262_hp_master_update(codec);
11215 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11216 unsigned int res)
11218 if ((res >> 26) != ALC880_HP_EVENT)
11219 return;
11220 alc262_hp_wildwest_automute(codec);
11223 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11225 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11226 struct snd_ctl_elem_value *ucontrol)
11228 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11229 struct alc_spec *spec = codec->spec;
11230 int val = !!*ucontrol->value.integer.value;
11232 if (val == spec->master_sw)
11233 return 0;
11234 spec->master_sw = val;
11235 alc262_hp_master_update(codec);
11236 return 1;
11239 #define ALC262_HP_MASTER_SWITCH \
11241 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11242 .name = "Master Playback Switch", \
11243 .info = snd_ctl_boolean_mono_info, \
11244 .get = alc262_hp_master_sw_get, \
11245 .put = alc262_hp_master_sw_put, \
11246 }, \
11248 .iface = NID_MAPPING, \
11249 .name = "Master Playback Switch", \
11250 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11254 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11255 ALC262_HP_MASTER_SWITCH,
11256 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11257 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11258 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11259 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11260 HDA_OUTPUT),
11261 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11262 HDA_OUTPUT),
11263 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11264 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11265 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11266 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11267 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11268 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11269 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11270 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11271 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11272 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11273 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11274 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11275 { } /* end */
11278 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11279 ALC262_HP_MASTER_SWITCH,
11280 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11281 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11282 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11283 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11284 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11285 HDA_OUTPUT),
11286 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11287 HDA_OUTPUT),
11288 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11289 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11290 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11291 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11292 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11293 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11294 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11295 { } /* end */
11298 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11299 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11300 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11301 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11302 { } /* end */
11305 /* mute/unmute internal speaker according to the hp jack and mute state */
11306 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11308 struct alc_spec *spec = codec->spec;
11310 spec->autocfg.hp_pins[0] = 0x15;
11311 spec->autocfg.speaker_pins[0] = 0x14;
11314 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11315 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11316 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11317 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11318 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11319 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11320 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11321 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11322 { } /* end */
11325 static struct hda_verb alc262_hp_t5735_verbs[] = {
11326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11327 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11329 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11333 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11334 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11335 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11336 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11337 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11338 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11339 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11340 { } /* end */
11343 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11344 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11345 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11346 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11347 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11348 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11349 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11350 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11352 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11357 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11358 .num_items = 1,
11359 .items = {
11360 { "Line", 0x1 },
11364 /* bind hp and internal speaker mute (with plug check) as master switch */
11365 static void alc262_hippo_master_update(struct hda_codec *codec)
11367 struct alc_spec *spec = codec->spec;
11368 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11369 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11370 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11371 unsigned int mute;
11373 /* HP */
11374 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11375 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11376 HDA_AMP_MUTE, mute);
11377 /* mute internal speaker per jack sense */
11378 if (spec->jack_present)
11379 mute = HDA_AMP_MUTE;
11380 if (line_nid)
11381 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11382 HDA_AMP_MUTE, mute);
11383 if (speaker_nid && speaker_nid != line_nid)
11384 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11385 HDA_AMP_MUTE, mute);
11388 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11390 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11391 struct snd_ctl_elem_value *ucontrol)
11393 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11394 struct alc_spec *spec = codec->spec;
11395 int val = !!*ucontrol->value.integer.value;
11397 if (val == spec->master_sw)
11398 return 0;
11399 spec->master_sw = val;
11400 alc262_hippo_master_update(codec);
11401 return 1;
11404 #define ALC262_HIPPO_MASTER_SWITCH \
11406 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11407 .name = "Master Playback Switch", \
11408 .info = snd_ctl_boolean_mono_info, \
11409 .get = alc262_hippo_master_sw_get, \
11410 .put = alc262_hippo_master_sw_put, \
11411 }, \
11413 .iface = NID_MAPPING, \
11414 .name = "Master Playback Switch", \
11415 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11416 (SUBDEV_SPEAKER(0) << 16), \
11419 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11420 ALC262_HIPPO_MASTER_SWITCH,
11421 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11422 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11423 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11424 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11425 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11426 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11427 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11428 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11429 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11430 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11431 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11432 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11433 { } /* end */
11436 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11437 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11438 ALC262_HIPPO_MASTER_SWITCH,
11439 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11440 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11441 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11442 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11443 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11444 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11445 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11446 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11447 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11448 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11449 { } /* end */
11452 /* mute/unmute internal speaker according to the hp jack and mute state */
11453 static void alc262_hippo_automute(struct hda_codec *codec)
11455 struct alc_spec *spec = codec->spec;
11456 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11458 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11459 alc262_hippo_master_update(codec);
11462 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11464 if ((res >> 26) != ALC880_HP_EVENT)
11465 return;
11466 alc262_hippo_automute(codec);
11469 static void alc262_hippo_setup(struct hda_codec *codec)
11471 struct alc_spec *spec = codec->spec;
11473 spec->autocfg.hp_pins[0] = 0x15;
11474 spec->autocfg.speaker_pins[0] = 0x14;
11477 static void alc262_hippo1_setup(struct hda_codec *codec)
11479 struct alc_spec *spec = codec->spec;
11481 spec->autocfg.hp_pins[0] = 0x1b;
11482 spec->autocfg.speaker_pins[0] = 0x14;
11486 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11487 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11488 ALC262_HIPPO_MASTER_SWITCH,
11489 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11490 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11491 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11492 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11493 { } /* end */
11496 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11497 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11498 ALC262_HIPPO_MASTER_SWITCH,
11499 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11500 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11501 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11502 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11503 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11504 { } /* end */
11507 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11508 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11509 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11510 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11511 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11512 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11513 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11515 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11516 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11517 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11518 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11519 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11520 { } /* end */
11523 static struct hda_verb alc262_tyan_verbs[] = {
11524 /* Headphone automute */
11525 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11526 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11527 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11529 /* P11 AUX_IN, white 4-pin connector */
11530 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11531 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11532 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11533 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11538 /* unsolicited event for HP jack sensing */
11539 static void alc262_tyan_setup(struct hda_codec *codec)
11541 struct alc_spec *spec = codec->spec;
11543 spec->autocfg.hp_pins[0] = 0x1b;
11544 spec->autocfg.speaker_pins[0] = 0x15;
11548 #define alc262_capture_mixer alc882_capture_mixer
11549 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11552 * generic initialization of ADC, input mixers and output mixers
11554 static struct hda_verb alc262_init_verbs[] = {
11556 * Unmute ADC0-2 and set the default input to mic-in
11558 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11559 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11560 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11561 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11562 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11563 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11565 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11566 * mixer widget
11567 * Note: PASD motherboards uses the Line In 2 as the input for
11568 * front panel mic (mic 2)
11570 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11572 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11574 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11575 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11578 * Set up output mixers (0x0c - 0x0e)
11580 /* set vol=0 to output mixers */
11581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11582 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11583 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11584 /* set up input amps for analog loopback */
11585 /* Amp Indices: DAC = 0, mixer = 1 */
11586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11588 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11590 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11591 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11593 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11594 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11595 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11596 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11597 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11598 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11601 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11602 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11603 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11604 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11606 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11607 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11609 /* FIXME: use matrix-type input source selection */
11610 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11611 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11614 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11615 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11616 /* Input mixer2 */
11617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11618 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11619 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11620 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11621 /* Input mixer3 */
11622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11630 static struct hda_verb alc262_eapd_verbs[] = {
11631 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11632 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11636 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11637 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11638 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11639 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11641 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11642 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11646 static struct hda_verb alc262_sony_unsol_verbs[] = {
11647 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11648 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11649 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11651 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11656 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11657 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11658 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11659 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11660 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11661 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11662 { } /* end */
11665 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11666 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11667 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11668 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11669 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11670 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11671 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11672 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11673 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11677 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11679 struct alc_spec *spec = codec->spec;
11681 spec->autocfg.hp_pins[0] = 0x15;
11682 spec->autocfg.speaker_pins[0] = 0x14;
11683 spec->ext_mic.pin = 0x18;
11684 spec->ext_mic.mux_idx = 0;
11685 spec->int_mic.pin = 0x12;
11686 spec->int_mic.mux_idx = 9;
11687 spec->auto_mic = 1;
11691 * nec model
11692 * 0x15 = headphone
11693 * 0x16 = internal speaker
11694 * 0x18 = external mic
11697 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11698 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11699 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11701 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11702 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11703 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11705 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11706 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11707 { } /* end */
11710 static struct hda_verb alc262_nec_verbs[] = {
11711 /* Unmute Speaker */
11712 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11714 /* Headphone */
11715 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11716 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11718 /* External mic to headphone */
11719 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11720 /* External mic to speaker */
11721 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11726 * fujitsu model
11727 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11728 * 0x1b = port replicator headphone out
11731 #define ALC_HP_EVENT 0x37
11733 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11734 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11735 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11736 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11737 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11741 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11742 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11743 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11747 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11748 /* Front Mic pin: input vref at 50% */
11749 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11754 static struct hda_input_mux alc262_fujitsu_capture_source = {
11755 .num_items = 3,
11756 .items = {
11757 { "Mic", 0x0 },
11758 { "Internal Mic", 0x1 },
11759 { "CD", 0x4 },
11763 static struct hda_input_mux alc262_HP_capture_source = {
11764 .num_items = 5,
11765 .items = {
11766 { "Mic", 0x0 },
11767 { "Front Mic", 0x1 },
11768 { "Line", 0x2 },
11769 { "CD", 0x4 },
11770 { "AUX IN", 0x6 },
11774 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11775 .num_items = 4,
11776 .items = {
11777 { "Mic", 0x0 },
11778 { "Front Mic", 0x2 },
11779 { "Line", 0x1 },
11780 { "CD", 0x4 },
11784 /* mute/unmute internal speaker according to the hp jacks and mute state */
11785 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11787 struct alc_spec *spec = codec->spec;
11788 unsigned int mute;
11790 if (force || !spec->sense_updated) {
11791 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11792 snd_hda_jack_detect(codec, 0x1b);
11793 spec->sense_updated = 1;
11795 /* unmute internal speaker only if both HPs are unplugged and
11796 * master switch is on
11798 if (spec->jack_present)
11799 mute = HDA_AMP_MUTE;
11800 else
11801 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11802 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11803 HDA_AMP_MUTE, mute);
11806 /* unsolicited event for HP jack sensing */
11807 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11808 unsigned int res)
11810 if ((res >> 26) != ALC_HP_EVENT)
11811 return;
11812 alc262_fujitsu_automute(codec, 1);
11815 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11817 alc262_fujitsu_automute(codec, 1);
11820 /* bind volumes of both NID 0x0c and 0x0d */
11821 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11822 .ops = &snd_hda_bind_vol,
11823 .values = {
11824 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11825 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11830 /* mute/unmute internal speaker according to the hp jack and mute state */
11831 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11833 struct alc_spec *spec = codec->spec;
11834 unsigned int mute;
11836 if (force || !spec->sense_updated) {
11837 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11838 spec->sense_updated = 1;
11840 if (spec->jack_present) {
11841 /* mute internal speaker */
11842 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11843 HDA_AMP_MUTE, HDA_AMP_MUTE);
11844 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11845 HDA_AMP_MUTE, HDA_AMP_MUTE);
11846 } else {
11847 /* unmute internal speaker if necessary */
11848 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11849 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11850 HDA_AMP_MUTE, mute);
11851 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11852 HDA_AMP_MUTE, mute);
11856 /* unsolicited event for HP jack sensing */
11857 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11858 unsigned int res)
11860 if ((res >> 26) != ALC_HP_EVENT)
11861 return;
11862 alc262_lenovo_3000_automute(codec, 1);
11865 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11866 int dir, int idx, long *valp)
11868 int i, change = 0;
11870 for (i = 0; i < 2; i++, valp++)
11871 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11872 HDA_AMP_MUTE,
11873 *valp ? 0 : HDA_AMP_MUTE);
11874 return change;
11877 /* bind hp and internal speaker mute (with plug check) */
11878 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11879 struct snd_ctl_elem_value *ucontrol)
11881 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11882 long *valp = ucontrol->value.integer.value;
11883 int change;
11885 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11886 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11887 if (change)
11888 alc262_fujitsu_automute(codec, 0);
11889 return change;
11892 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11893 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11895 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11896 .name = "Master Playback Switch",
11897 .subdevice = HDA_SUBDEV_AMP_FLAG,
11898 .info = snd_hda_mixer_amp_switch_info,
11899 .get = snd_hda_mixer_amp_switch_get,
11900 .put = alc262_fujitsu_master_sw_put,
11901 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11904 .iface = NID_MAPPING,
11905 .name = "Master Playback Switch",
11906 .private_value = 0x1b,
11908 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11909 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11910 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11911 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11912 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11913 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11914 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11915 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11916 { } /* end */
11919 /* bind hp and internal speaker mute (with plug check) */
11920 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11921 struct snd_ctl_elem_value *ucontrol)
11923 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11924 long *valp = ucontrol->value.integer.value;
11925 int change;
11927 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11928 if (change)
11929 alc262_lenovo_3000_automute(codec, 0);
11930 return change;
11933 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11934 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11936 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11937 .name = "Master Playback Switch",
11938 .subdevice = HDA_SUBDEV_AMP_FLAG,
11939 .info = snd_hda_mixer_amp_switch_info,
11940 .get = snd_hda_mixer_amp_switch_get,
11941 .put = alc262_lenovo_3000_master_sw_put,
11942 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11944 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11945 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11946 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11948 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11949 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11950 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11951 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11952 { } /* end */
11955 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11956 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11957 ALC262_HIPPO_MASTER_SWITCH,
11958 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11959 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11960 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11961 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11962 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11963 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11964 { } /* end */
11967 /* additional init verbs for Benq laptops */
11968 static struct hda_verb alc262_EAPD_verbs[] = {
11969 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11970 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11974 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11975 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11976 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11978 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11979 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11983 /* Samsung Q1 Ultra Vista model setup */
11984 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11985 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11986 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11987 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11988 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11989 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
11990 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
11991 { } /* end */
11994 static struct hda_verb alc262_ultra_verbs[] = {
11995 /* output mixer */
11996 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11997 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11998 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11999 /* speaker */
12000 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12001 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12002 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12003 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12004 /* HP */
12005 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12008 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12009 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12010 /* internal mic */
12011 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12013 /* ADC, choose mic */
12014 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12015 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12016 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12017 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12018 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12019 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12020 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12021 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12022 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12023 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
12027 /* mute/unmute internal speaker according to the hp jack and mute state */
12028 static void alc262_ultra_automute(struct hda_codec *codec)
12030 struct alc_spec *spec = codec->spec;
12031 unsigned int mute;
12033 mute = 0;
12034 /* auto-mute only when HP is used as HP */
12035 if (!spec->cur_mux[0]) {
12036 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
12037 if (spec->jack_present)
12038 mute = HDA_AMP_MUTE;
12040 /* mute/unmute internal speaker */
12041 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12042 HDA_AMP_MUTE, mute);
12043 /* mute/unmute HP */
12044 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12045 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
12048 /* unsolicited event for HP jack sensing */
12049 static void alc262_ultra_unsol_event(struct hda_codec *codec,
12050 unsigned int res)
12052 if ((res >> 26) != ALC880_HP_EVENT)
12053 return;
12054 alc262_ultra_automute(codec);
12057 static struct hda_input_mux alc262_ultra_capture_source = {
12058 .num_items = 2,
12059 .items = {
12060 { "Mic", 0x1 },
12061 { "Headphone", 0x7 },
12065 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12066 struct snd_ctl_elem_value *ucontrol)
12068 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12069 struct alc_spec *spec = codec->spec;
12070 int ret;
12072 ret = alc_mux_enum_put(kcontrol, ucontrol);
12073 if (!ret)
12074 return 0;
12075 /* reprogram the HP pin as mic or HP according to the input source */
12076 snd_hda_codec_write_cache(codec, 0x15, 0,
12077 AC_VERB_SET_PIN_WIDGET_CONTROL,
12078 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12079 alc262_ultra_automute(codec); /* mute/unmute HP */
12080 return ret;
12083 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12084 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12085 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12087 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12088 .name = "Capture Source",
12089 .info = alc_mux_enum_info,
12090 .get = alc_mux_enum_get,
12091 .put = alc262_ultra_mux_enum_put,
12094 .iface = NID_MAPPING,
12095 .name = "Capture Source",
12096 .private_value = 0x15,
12098 { } /* end */
12101 /* We use two mixers depending on the output pin; 0x16 is a mono output
12102 * and thus it's bound with a different mixer.
12103 * This function returns which mixer amp should be used.
12105 static int alc262_check_volbit(hda_nid_t nid)
12107 if (!nid)
12108 return 0;
12109 else if (nid == 0x16)
12110 return 2;
12111 else
12112 return 1;
12115 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12116 const char *pfx, int *vbits, int idx)
12118 unsigned long val;
12119 int vbit;
12121 vbit = alc262_check_volbit(nid);
12122 if (!vbit)
12123 return 0;
12124 if (*vbits & vbit) /* a volume control for this mixer already there */
12125 return 0;
12126 *vbits |= vbit;
12127 if (vbit == 2)
12128 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12129 else
12130 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12131 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12134 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12135 const char *pfx, int idx)
12137 unsigned long val;
12139 if (!nid)
12140 return 0;
12141 if (nid == 0x16)
12142 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12143 else
12144 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12145 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12148 /* add playback controls from the parsed DAC table */
12149 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12150 const struct auto_pin_cfg *cfg)
12152 const char *pfx;
12153 int vbits;
12154 int i, err;
12156 spec->multiout.num_dacs = 1; /* only use one dac */
12157 spec->multiout.dac_nids = spec->private_dac_nids;
12158 spec->multiout.dac_nids[0] = 2;
12160 pfx = alc_get_line_out_pfx(cfg, true);
12161 if (!pfx)
12162 pfx = "Front";
12163 for (i = 0; i < 2; i++) {
12164 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12165 if (err < 0)
12166 return err;
12167 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12168 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12169 "Speaker", i);
12170 if (err < 0)
12171 return err;
12173 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12174 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12175 "Headphone", i);
12176 if (err < 0)
12177 return err;
12181 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12182 alc262_check_volbit(cfg->speaker_pins[0]) |
12183 alc262_check_volbit(cfg->hp_pins[0]);
12184 if (vbits == 1 || vbits == 2)
12185 pfx = "Master"; /* only one mixer is used */
12186 vbits = 0;
12187 for (i = 0; i < 2; i++) {
12188 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12189 &vbits, i);
12190 if (err < 0)
12191 return err;
12192 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12193 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12194 "Speaker", &vbits, i);
12195 if (err < 0)
12196 return err;
12198 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12199 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12200 "Headphone", &vbits, i);
12201 if (err < 0)
12202 return err;
12205 return 0;
12208 #define alc262_auto_create_input_ctls \
12209 alc882_auto_create_input_ctls
12212 * generic initialization of ADC, input mixers and output mixers
12214 static struct hda_verb alc262_volume_init_verbs[] = {
12216 * Unmute ADC0-2 and set the default input to mic-in
12218 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12219 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12220 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12221 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12222 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12223 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12225 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12226 * mixer widget
12227 * Note: PASD motherboards uses the Line In 2 as the input for
12228 * front panel mic (mic 2)
12230 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12233 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12238 * Set up output mixers (0x0c - 0x0f)
12240 /* set vol=0 to output mixers */
12241 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12242 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12243 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12245 /* set up input amps for analog loopback */
12246 /* Amp Indices: DAC = 0, mixer = 1 */
12247 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12248 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12249 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12250 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12251 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12252 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12254 /* FIXME: use matrix-type input source selection */
12255 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12256 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12257 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12258 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12259 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12260 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12261 /* Input mixer2 */
12262 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12263 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12264 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12265 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12266 /* Input mixer3 */
12267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12268 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12269 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12270 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12275 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12277 * Unmute ADC0-2 and set the default input to mic-in
12279 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12281 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12282 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12283 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12284 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12286 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12287 * mixer widget
12288 * Note: PASD motherboards uses the Line In 2 as the input for
12289 * front panel mic (mic 2)
12291 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12292 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12293 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12296 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12297 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12298 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12301 * Set up output mixers (0x0c - 0x0e)
12303 /* set vol=0 to output mixers */
12304 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12305 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12306 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12308 /* set up input amps for analog loopback */
12309 /* Amp Indices: DAC = 0, mixer = 1 */
12310 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12312 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12313 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12314 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12315 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12317 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12318 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12319 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12321 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12322 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12324 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12325 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12327 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12328 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12329 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12330 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12331 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12333 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12334 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12335 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12336 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12337 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12338 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12341 /* FIXME: use matrix-type input source selection */
12342 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12343 /* Input mixer1: only unmute Mic */
12344 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12345 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12346 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12347 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12348 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12349 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12350 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12353 /* Input mixer2 */
12354 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12355 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12356 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12357 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12358 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12359 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12360 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12361 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12362 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12363 /* Input mixer3 */
12364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12366 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12367 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12368 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12374 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12379 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12381 * Unmute ADC0-2 and set the default input to mic-in
12383 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12385 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12386 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12387 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12388 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12390 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12391 * mixer widget
12392 * Note: PASD motherboards uses the Line In 2 as the input for front
12393 * panel mic (mic 2)
12395 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12396 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12397 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12405 * Set up output mixers (0x0c - 0x0e)
12407 /* set vol=0 to output mixers */
12408 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12409 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12410 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12412 /* set up input amps for analog loopback */
12413 /* Amp Indices: DAC = 0, mixer = 1 */
12414 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12415 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12416 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12417 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12418 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12419 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12422 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12423 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12424 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12425 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12426 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12427 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12428 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12430 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12431 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12433 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12434 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12436 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12437 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12438 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12439 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12440 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12441 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12443 /* FIXME: use matrix-type input source selection */
12444 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12445 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12446 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12447 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12448 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12451 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12453 /* Input mixer2 */
12454 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12455 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12456 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12458 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12459 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12461 /* Input mixer3 */
12462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12463 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12464 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12465 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12466 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12467 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12470 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12475 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12477 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12478 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12479 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12481 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12482 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12483 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12484 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12486 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12487 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12488 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12493 * Pin config fixes
12495 enum {
12496 PINFIX_FSC_H270,
12499 static const struct alc_fixup alc262_fixups[] = {
12500 [PINFIX_FSC_H270] = {
12501 .type = ALC_FIXUP_PINS,
12502 .v.pins = (const struct alc_pincfg[]) {
12503 { 0x14, 0x99130110 }, /* speaker */
12504 { 0x15, 0x0221142f }, /* front HP */
12505 { 0x1b, 0x0121141f }, /* rear HP */
12511 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12512 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12517 #ifdef CONFIG_SND_HDA_POWER_SAVE
12518 #define alc262_loopbacks alc880_loopbacks
12519 #endif
12521 /* pcm configuration: identical with ALC880 */
12522 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12523 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12524 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12525 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12528 * BIOS auto configuration
12530 static int alc262_parse_auto_config(struct hda_codec *codec)
12532 struct alc_spec *spec = codec->spec;
12533 int err;
12534 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12536 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12537 alc262_ignore);
12538 if (err < 0)
12539 return err;
12540 if (!spec->autocfg.line_outs) {
12541 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12542 spec->multiout.max_channels = 2;
12543 spec->no_analog = 1;
12544 goto dig_only;
12546 return 0; /* can't find valid BIOS pin config */
12548 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12549 if (err < 0)
12550 return err;
12551 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12552 if (err < 0)
12553 return err;
12555 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12557 dig_only:
12558 alc_auto_parse_digital(codec);
12560 if (spec->kctls.list)
12561 add_mixer(spec, spec->kctls.list);
12563 add_verb(spec, alc262_volume_init_verbs);
12564 spec->num_mux_defs = 1;
12565 spec->input_mux = &spec->private_imux[0];
12567 err = alc_auto_add_mic_boost(codec);
12568 if (err < 0)
12569 return err;
12571 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12573 return 1;
12576 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12577 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12578 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12579 #define alc262_auto_init_input_src alc882_auto_init_input_src
12582 /* init callback for auto-configuration model -- overriding the default init */
12583 static void alc262_auto_init(struct hda_codec *codec)
12585 struct alc_spec *spec = codec->spec;
12586 alc262_auto_init_multi_out(codec);
12587 alc262_auto_init_hp_out(codec);
12588 alc262_auto_init_analog_input(codec);
12589 alc262_auto_init_input_src(codec);
12590 alc_auto_init_digital(codec);
12591 if (spec->unsol_event)
12592 alc_inithook(codec);
12596 * configuration and preset
12598 static const char * const alc262_models[ALC262_MODEL_LAST] = {
12599 [ALC262_BASIC] = "basic",
12600 [ALC262_HIPPO] = "hippo",
12601 [ALC262_HIPPO_1] = "hippo_1",
12602 [ALC262_FUJITSU] = "fujitsu",
12603 [ALC262_HP_BPC] = "hp-bpc",
12604 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12605 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12606 [ALC262_HP_RP5700] = "hp-rp5700",
12607 [ALC262_BENQ_ED8] = "benq",
12608 [ALC262_BENQ_T31] = "benq-t31",
12609 [ALC262_SONY_ASSAMD] = "sony-assamd",
12610 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12611 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12612 [ALC262_ULTRA] = "ultra",
12613 [ALC262_LENOVO_3000] = "lenovo-3000",
12614 [ALC262_NEC] = "nec",
12615 [ALC262_TYAN] = "tyan",
12616 [ALC262_AUTO] = "auto",
12619 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12620 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12621 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12622 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12623 ALC262_HP_BPC),
12624 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12625 ALC262_HP_BPC),
12626 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12627 ALC262_HP_BPC),
12628 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12629 ALC262_HP_BPC),
12630 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12631 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12632 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12633 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12634 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12635 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12636 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12637 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12638 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12639 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12640 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12641 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12642 ALC262_HP_TC_T5735),
12643 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12644 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12645 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12646 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12647 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12648 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12649 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12650 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12651 #if 0 /* disable the quirk since model=auto works better in recent versions */
12652 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12653 ALC262_SONY_ASSAMD),
12654 #endif
12655 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12656 ALC262_TOSHIBA_RX1),
12657 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12658 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12659 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12660 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12661 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12662 ALC262_ULTRA),
12663 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12664 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12665 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12666 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12667 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12671 static struct alc_config_preset alc262_presets[] = {
12672 [ALC262_BASIC] = {
12673 .mixers = { alc262_base_mixer },
12674 .init_verbs = { alc262_init_verbs },
12675 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12676 .dac_nids = alc262_dac_nids,
12677 .hp_nid = 0x03,
12678 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12679 .channel_mode = alc262_modes,
12680 .input_mux = &alc262_capture_source,
12682 [ALC262_HIPPO] = {
12683 .mixers = { alc262_hippo_mixer },
12684 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12685 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12686 .dac_nids = alc262_dac_nids,
12687 .hp_nid = 0x03,
12688 .dig_out_nid = ALC262_DIGOUT_NID,
12689 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12690 .channel_mode = alc262_modes,
12691 .input_mux = &alc262_capture_source,
12692 .unsol_event = alc262_hippo_unsol_event,
12693 .setup = alc262_hippo_setup,
12694 .init_hook = alc262_hippo_automute,
12696 [ALC262_HIPPO_1] = {
12697 .mixers = { alc262_hippo1_mixer },
12698 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12699 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12700 .dac_nids = alc262_dac_nids,
12701 .hp_nid = 0x02,
12702 .dig_out_nid = ALC262_DIGOUT_NID,
12703 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12704 .channel_mode = alc262_modes,
12705 .input_mux = &alc262_capture_source,
12706 .unsol_event = alc262_hippo_unsol_event,
12707 .setup = alc262_hippo1_setup,
12708 .init_hook = alc262_hippo_automute,
12710 [ALC262_FUJITSU] = {
12711 .mixers = { alc262_fujitsu_mixer },
12712 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12713 alc262_fujitsu_unsol_verbs },
12714 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12715 .dac_nids = alc262_dac_nids,
12716 .hp_nid = 0x03,
12717 .dig_out_nid = ALC262_DIGOUT_NID,
12718 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12719 .channel_mode = alc262_modes,
12720 .input_mux = &alc262_fujitsu_capture_source,
12721 .unsol_event = alc262_fujitsu_unsol_event,
12722 .init_hook = alc262_fujitsu_init_hook,
12724 [ALC262_HP_BPC] = {
12725 .mixers = { alc262_HP_BPC_mixer },
12726 .init_verbs = { alc262_HP_BPC_init_verbs },
12727 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12728 .dac_nids = alc262_dac_nids,
12729 .hp_nid = 0x03,
12730 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12731 .channel_mode = alc262_modes,
12732 .input_mux = &alc262_HP_capture_source,
12733 .unsol_event = alc262_hp_bpc_unsol_event,
12734 .init_hook = alc262_hp_bpc_automute,
12736 [ALC262_HP_BPC_D7000_WF] = {
12737 .mixers = { alc262_HP_BPC_WildWest_mixer },
12738 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12739 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12740 .dac_nids = alc262_dac_nids,
12741 .hp_nid = 0x03,
12742 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12743 .channel_mode = alc262_modes,
12744 .input_mux = &alc262_HP_D7000_capture_source,
12745 .unsol_event = alc262_hp_wildwest_unsol_event,
12746 .init_hook = alc262_hp_wildwest_automute,
12748 [ALC262_HP_BPC_D7000_WL] = {
12749 .mixers = { alc262_HP_BPC_WildWest_mixer,
12750 alc262_HP_BPC_WildWest_option_mixer },
12751 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12752 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12753 .dac_nids = alc262_dac_nids,
12754 .hp_nid = 0x03,
12755 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12756 .channel_mode = alc262_modes,
12757 .input_mux = &alc262_HP_D7000_capture_source,
12758 .unsol_event = alc262_hp_wildwest_unsol_event,
12759 .init_hook = alc262_hp_wildwest_automute,
12761 [ALC262_HP_TC_T5735] = {
12762 .mixers = { alc262_hp_t5735_mixer },
12763 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12764 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12765 .dac_nids = alc262_dac_nids,
12766 .hp_nid = 0x03,
12767 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12768 .channel_mode = alc262_modes,
12769 .input_mux = &alc262_capture_source,
12770 .unsol_event = alc_sku_unsol_event,
12771 .setup = alc262_hp_t5735_setup,
12772 .init_hook = alc_inithook,
12774 [ALC262_HP_RP5700] = {
12775 .mixers = { alc262_hp_rp5700_mixer },
12776 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12777 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12778 .dac_nids = alc262_dac_nids,
12779 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12780 .channel_mode = alc262_modes,
12781 .input_mux = &alc262_hp_rp5700_capture_source,
12783 [ALC262_BENQ_ED8] = {
12784 .mixers = { alc262_base_mixer },
12785 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12786 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12787 .dac_nids = alc262_dac_nids,
12788 .hp_nid = 0x03,
12789 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12790 .channel_mode = alc262_modes,
12791 .input_mux = &alc262_capture_source,
12793 [ALC262_SONY_ASSAMD] = {
12794 .mixers = { alc262_sony_mixer },
12795 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12796 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12797 .dac_nids = alc262_dac_nids,
12798 .hp_nid = 0x02,
12799 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12800 .channel_mode = alc262_modes,
12801 .input_mux = &alc262_capture_source,
12802 .unsol_event = alc262_hippo_unsol_event,
12803 .setup = alc262_hippo_setup,
12804 .init_hook = alc262_hippo_automute,
12806 [ALC262_BENQ_T31] = {
12807 .mixers = { alc262_benq_t31_mixer },
12808 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12809 alc_hp15_unsol_verbs },
12810 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12811 .dac_nids = alc262_dac_nids,
12812 .hp_nid = 0x03,
12813 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12814 .channel_mode = alc262_modes,
12815 .input_mux = &alc262_capture_source,
12816 .unsol_event = alc262_hippo_unsol_event,
12817 .setup = alc262_hippo_setup,
12818 .init_hook = alc262_hippo_automute,
12820 [ALC262_ULTRA] = {
12821 .mixers = { alc262_ultra_mixer },
12822 .cap_mixer = alc262_ultra_capture_mixer,
12823 .init_verbs = { alc262_ultra_verbs },
12824 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12825 .dac_nids = alc262_dac_nids,
12826 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12827 .channel_mode = alc262_modes,
12828 .input_mux = &alc262_ultra_capture_source,
12829 .adc_nids = alc262_adc_nids, /* ADC0 */
12830 .capsrc_nids = alc262_capsrc_nids,
12831 .num_adc_nids = 1, /* single ADC */
12832 .unsol_event = alc262_ultra_unsol_event,
12833 .init_hook = alc262_ultra_automute,
12835 [ALC262_LENOVO_3000] = {
12836 .mixers = { alc262_lenovo_3000_mixer },
12837 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12838 alc262_lenovo_3000_unsol_verbs,
12839 alc262_lenovo_3000_init_verbs },
12840 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12841 .dac_nids = alc262_dac_nids,
12842 .hp_nid = 0x03,
12843 .dig_out_nid = ALC262_DIGOUT_NID,
12844 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12845 .channel_mode = alc262_modes,
12846 .input_mux = &alc262_fujitsu_capture_source,
12847 .unsol_event = alc262_lenovo_3000_unsol_event,
12849 [ALC262_NEC] = {
12850 .mixers = { alc262_nec_mixer },
12851 .init_verbs = { alc262_nec_verbs },
12852 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12853 .dac_nids = alc262_dac_nids,
12854 .hp_nid = 0x03,
12855 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12856 .channel_mode = alc262_modes,
12857 .input_mux = &alc262_capture_source,
12859 [ALC262_TOSHIBA_S06] = {
12860 .mixers = { alc262_toshiba_s06_mixer },
12861 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12862 alc262_eapd_verbs },
12863 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12864 .capsrc_nids = alc262_dmic_capsrc_nids,
12865 .dac_nids = alc262_dac_nids,
12866 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12867 .num_adc_nids = 1, /* single ADC */
12868 .dig_out_nid = ALC262_DIGOUT_NID,
12869 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12870 .channel_mode = alc262_modes,
12871 .unsol_event = alc_sku_unsol_event,
12872 .setup = alc262_toshiba_s06_setup,
12873 .init_hook = alc_inithook,
12875 [ALC262_TOSHIBA_RX1] = {
12876 .mixers = { alc262_toshiba_rx1_mixer },
12877 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12878 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12879 .dac_nids = alc262_dac_nids,
12880 .hp_nid = 0x03,
12881 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12882 .channel_mode = alc262_modes,
12883 .input_mux = &alc262_capture_source,
12884 .unsol_event = alc262_hippo_unsol_event,
12885 .setup = alc262_hippo_setup,
12886 .init_hook = alc262_hippo_automute,
12888 [ALC262_TYAN] = {
12889 .mixers = { alc262_tyan_mixer },
12890 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12891 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12892 .dac_nids = alc262_dac_nids,
12893 .hp_nid = 0x02,
12894 .dig_out_nid = ALC262_DIGOUT_NID,
12895 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12896 .channel_mode = alc262_modes,
12897 .input_mux = &alc262_capture_source,
12898 .unsol_event = alc_automute_amp_unsol_event,
12899 .setup = alc262_tyan_setup,
12900 .init_hook = alc_automute_amp,
12904 static int patch_alc262(struct hda_codec *codec)
12906 struct alc_spec *spec;
12907 int board_config;
12908 int err;
12910 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12911 if (spec == NULL)
12912 return -ENOMEM;
12914 codec->spec = spec;
12915 #if 0
12916 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12917 * under-run
12920 int tmp;
12921 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12922 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12923 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12924 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12926 #endif
12927 alc_auto_parse_customize_define(codec);
12929 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12931 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12932 alc262_models,
12933 alc262_cfg_tbl);
12935 if (board_config < 0) {
12936 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12937 codec->chip_name);
12938 board_config = ALC262_AUTO;
12941 if (board_config == ALC262_AUTO) {
12942 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
12943 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
12946 if (board_config == ALC262_AUTO) {
12947 /* automatic parse from the BIOS config */
12948 err = alc262_parse_auto_config(codec);
12949 if (err < 0) {
12950 alc_free(codec);
12951 return err;
12952 } else if (!err) {
12953 printk(KERN_INFO
12954 "hda_codec: Cannot set up configuration "
12955 "from BIOS. Using base mode...\n");
12956 board_config = ALC262_BASIC;
12960 if (!spec->no_analog && has_cdefine_beep(codec)) {
12961 err = snd_hda_attach_beep_device(codec, 0x1);
12962 if (err < 0) {
12963 alc_free(codec);
12964 return err;
12968 if (board_config != ALC262_AUTO)
12969 setup_preset(codec, &alc262_presets[board_config]);
12971 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12972 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12974 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12975 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12977 if (!spec->adc_nids && spec->input_mux) {
12978 int i;
12979 /* check whether the digital-mic has to be supported */
12980 for (i = 0; i < spec->input_mux->num_items; i++) {
12981 if (spec->input_mux->items[i].index >= 9)
12982 break;
12984 if (i < spec->input_mux->num_items) {
12985 /* use only ADC0 */
12986 spec->adc_nids = alc262_dmic_adc_nids;
12987 spec->num_adc_nids = 1;
12988 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12989 } else {
12990 /* all analog inputs */
12991 /* check whether NID 0x07 is valid */
12992 unsigned int wcap = get_wcaps(codec, 0x07);
12994 /* get type */
12995 wcap = get_wcaps_type(wcap);
12996 if (wcap != AC_WID_AUD_IN) {
12997 spec->adc_nids = alc262_adc_nids_alt;
12998 spec->num_adc_nids =
12999 ARRAY_SIZE(alc262_adc_nids_alt);
13000 spec->capsrc_nids = alc262_capsrc_nids_alt;
13001 } else {
13002 spec->adc_nids = alc262_adc_nids;
13003 spec->num_adc_nids =
13004 ARRAY_SIZE(alc262_adc_nids);
13005 spec->capsrc_nids = alc262_capsrc_nids;
13009 if (!spec->cap_mixer && !spec->no_analog)
13010 set_capture_mixer(codec);
13011 if (!spec->no_analog && has_cdefine_beep(codec))
13012 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13014 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
13016 spec->vmaster_nid = 0x0c;
13018 codec->patch_ops = alc_patch_ops;
13019 if (board_config == ALC262_AUTO)
13020 spec->init_hook = alc262_auto_init;
13022 alc_init_jacks(codec);
13023 #ifdef CONFIG_SND_HDA_POWER_SAVE
13024 if (!spec->loopback.amplist)
13025 spec->loopback.amplist = alc262_loopbacks;
13026 #endif
13028 return 0;
13032 * ALC268 channel source setting (2 channel)
13034 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13035 #define alc268_modes alc260_modes
13037 static hda_nid_t alc268_dac_nids[2] = {
13038 /* front, hp */
13039 0x02, 0x03
13042 static hda_nid_t alc268_adc_nids[2] = {
13043 /* ADC0-1 */
13044 0x08, 0x07
13047 static hda_nid_t alc268_adc_nids_alt[1] = {
13048 /* ADC0 */
13049 0x08
13052 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13054 static struct snd_kcontrol_new alc268_base_mixer[] = {
13055 /* output mixer control */
13056 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13057 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13058 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13059 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13060 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13061 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13062 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13066 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13067 /* output mixer control */
13068 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13069 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13070 ALC262_HIPPO_MASTER_SWITCH,
13071 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13072 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13073 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13077 /* bind Beep switches of both NID 0x0f and 0x10 */
13078 static struct hda_bind_ctls alc268_bind_beep_sw = {
13079 .ops = &snd_hda_bind_sw,
13080 .values = {
13081 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13082 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13087 static struct snd_kcontrol_new alc268_beep_mixer[] = {
13088 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13089 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13093 static struct hda_verb alc268_eapd_verbs[] = {
13094 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13095 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13099 /* Toshiba specific */
13100 static struct hda_verb alc268_toshiba_verbs[] = {
13101 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13102 { } /* end */
13105 /* Acer specific */
13106 /* bind volumes of both NID 0x02 and 0x03 */
13107 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13108 .ops = &snd_hda_bind_vol,
13109 .values = {
13110 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13111 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13116 /* mute/unmute internal speaker according to the hp jack and mute state */
13117 static void alc268_acer_automute(struct hda_codec *codec, int force)
13119 struct alc_spec *spec = codec->spec;
13120 unsigned int mute;
13122 if (force || !spec->sense_updated) {
13123 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13124 spec->sense_updated = 1;
13126 if (spec->jack_present)
13127 mute = HDA_AMP_MUTE; /* mute internal speaker */
13128 else /* unmute internal speaker if necessary */
13129 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13130 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13131 HDA_AMP_MUTE, mute);
13135 /* bind hp and internal speaker mute (with plug check) */
13136 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13137 struct snd_ctl_elem_value *ucontrol)
13139 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13140 long *valp = ucontrol->value.integer.value;
13141 int change;
13143 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13144 if (change)
13145 alc268_acer_automute(codec, 0);
13146 return change;
13149 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13150 /* output mixer control */
13151 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13153 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13154 .name = "Master Playback Switch",
13155 .subdevice = HDA_SUBDEV_AMP_FLAG,
13156 .info = snd_hda_mixer_amp_switch_info,
13157 .get = snd_hda_mixer_amp_switch_get,
13158 .put = alc268_acer_master_sw_put,
13159 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13161 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13165 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13166 /* output mixer control */
13167 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13169 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13170 .name = "Master Playback Switch",
13171 .subdevice = HDA_SUBDEV_AMP_FLAG,
13172 .info = snd_hda_mixer_amp_switch_info,
13173 .get = snd_hda_mixer_amp_switch_get,
13174 .put = alc268_acer_master_sw_put,
13175 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13177 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13178 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13179 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13183 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13184 /* output mixer control */
13185 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13187 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13188 .name = "Master Playback Switch",
13189 .subdevice = HDA_SUBDEV_AMP_FLAG,
13190 .info = snd_hda_mixer_amp_switch_info,
13191 .get = snd_hda_mixer_amp_switch_get,
13192 .put = alc268_acer_master_sw_put,
13193 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13195 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13196 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13200 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13201 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13202 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13203 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13204 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13205 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13206 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13210 static struct hda_verb alc268_acer_verbs[] = {
13211 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13212 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13213 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13214 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13215 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13216 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13217 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13221 /* unsolicited event for HP jack sensing */
13222 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13223 #define alc268_toshiba_setup alc262_hippo_setup
13224 #define alc268_toshiba_automute alc262_hippo_automute
13226 static void alc268_acer_unsol_event(struct hda_codec *codec,
13227 unsigned int res)
13229 if ((res >> 26) != ALC880_HP_EVENT)
13230 return;
13231 alc268_acer_automute(codec, 1);
13234 static void alc268_acer_init_hook(struct hda_codec *codec)
13236 alc268_acer_automute(codec, 1);
13239 /* toggle speaker-output according to the hp-jack state */
13240 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13242 unsigned int present;
13243 unsigned char bits;
13245 present = snd_hda_jack_detect(codec, 0x15);
13246 bits = present ? HDA_AMP_MUTE : 0;
13247 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13248 HDA_AMP_MUTE, bits);
13249 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13250 HDA_AMP_MUTE, bits);
13253 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13254 unsigned int res)
13256 switch (res >> 26) {
13257 case ALC880_HP_EVENT:
13258 alc268_aspire_one_speaker_automute(codec);
13259 break;
13260 case ALC880_MIC_EVENT:
13261 alc_mic_automute(codec);
13262 break;
13266 static void alc268_acer_lc_setup(struct hda_codec *codec)
13268 struct alc_spec *spec = codec->spec;
13269 spec->ext_mic.pin = 0x18;
13270 spec->ext_mic.mux_idx = 0;
13271 spec->int_mic.pin = 0x12;
13272 spec->int_mic.mux_idx = 6;
13273 spec->auto_mic = 1;
13276 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13278 alc268_aspire_one_speaker_automute(codec);
13279 alc_mic_automute(codec);
13282 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13283 /* output mixer control */
13284 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13285 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13286 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13287 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13288 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13289 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13293 static struct hda_verb alc268_dell_verbs[] = {
13294 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13295 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13296 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13297 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13301 /* mute/unmute internal speaker according to the hp jack and mute state */
13302 static void alc268_dell_setup(struct hda_codec *codec)
13304 struct alc_spec *spec = codec->spec;
13306 spec->autocfg.hp_pins[0] = 0x15;
13307 spec->autocfg.speaker_pins[0] = 0x14;
13308 spec->ext_mic.pin = 0x18;
13309 spec->ext_mic.mux_idx = 0;
13310 spec->int_mic.pin = 0x19;
13311 spec->int_mic.mux_idx = 1;
13312 spec->auto_mic = 1;
13315 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13316 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13317 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13318 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13319 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13320 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13321 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13322 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13323 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13327 static struct hda_verb alc267_quanta_il1_verbs[] = {
13328 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13329 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13333 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13335 struct alc_spec *spec = codec->spec;
13336 spec->autocfg.hp_pins[0] = 0x15;
13337 spec->autocfg.speaker_pins[0] = 0x14;
13338 spec->ext_mic.pin = 0x18;
13339 spec->ext_mic.mux_idx = 0;
13340 spec->int_mic.pin = 0x19;
13341 spec->int_mic.mux_idx = 1;
13342 spec->auto_mic = 1;
13346 * generic initialization of ADC, input mixers and output mixers
13348 static struct hda_verb alc268_base_init_verbs[] = {
13349 /* Unmute DAC0-1 and set vol = 0 */
13350 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13351 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13354 * Set up output mixers (0x0c - 0x0e)
13356 /* set vol=0 to output mixers */
13357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13358 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13360 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13361 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13363 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13364 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13365 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13366 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13367 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13368 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13369 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13370 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13372 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13373 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13374 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13375 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13376 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13378 /* set PCBEEP vol = 0, mute connections */
13379 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13380 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13381 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13383 /* Unmute Selector 23h,24h and set the default input to mic-in */
13385 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13386 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13387 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13394 * generic initialization of ADC, input mixers and output mixers
13396 static struct hda_verb alc268_volume_init_verbs[] = {
13397 /* set output DAC */
13398 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13399 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13401 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13402 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13403 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13404 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13405 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13408 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13409 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13411 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13412 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13414 /* set PCBEEP vol = 0, mute connections */
13415 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13416 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13417 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13422 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13423 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13424 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13425 { } /* end */
13428 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13429 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13430 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13431 _DEFINE_CAPSRC(1),
13432 { } /* end */
13435 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13436 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13437 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13438 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13439 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13440 _DEFINE_CAPSRC(2),
13441 { } /* end */
13444 static struct hda_input_mux alc268_capture_source = {
13445 .num_items = 4,
13446 .items = {
13447 { "Mic", 0x0 },
13448 { "Front Mic", 0x1 },
13449 { "Line", 0x2 },
13450 { "CD", 0x3 },
13454 static struct hda_input_mux alc268_acer_capture_source = {
13455 .num_items = 3,
13456 .items = {
13457 { "Mic", 0x0 },
13458 { "Internal Mic", 0x1 },
13459 { "Line", 0x2 },
13463 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13464 .num_items = 3,
13465 .items = {
13466 { "Mic", 0x0 },
13467 { "Internal Mic", 0x6 },
13468 { "Line", 0x2 },
13472 #ifdef CONFIG_SND_DEBUG
13473 static struct snd_kcontrol_new alc268_test_mixer[] = {
13474 /* Volume widgets */
13475 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13476 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13477 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13478 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13479 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13480 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13481 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13482 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13483 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13484 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13485 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13486 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13487 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13488 /* The below appears problematic on some hardwares */
13489 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13490 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13491 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13492 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13493 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13495 /* Modes for retasking pin widgets */
13496 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13497 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13498 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13499 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13501 /* Controls for GPIO pins, assuming they are configured as outputs */
13502 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13503 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13504 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13505 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13507 /* Switches to allow the digital SPDIF output pin to be enabled.
13508 * The ALC268 does not have an SPDIF input.
13510 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13512 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13513 * this output to turn on an external amplifier.
13515 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13516 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13518 { } /* end */
13520 #endif
13522 /* create input playback/capture controls for the given pin */
13523 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13524 const char *ctlname, int idx)
13526 hda_nid_t dac;
13527 int err;
13529 switch (nid) {
13530 case 0x14:
13531 case 0x16:
13532 dac = 0x02;
13533 break;
13534 case 0x15:
13535 case 0x1a: /* ALC259/269 only */
13536 case 0x1b: /* ALC259/269 only */
13537 case 0x21: /* ALC269vb has this pin, too */
13538 dac = 0x03;
13539 break;
13540 default:
13541 snd_printd(KERN_WARNING "hda_codec: "
13542 "ignoring pin 0x%x as unknown\n", nid);
13543 return 0;
13545 if (spec->multiout.dac_nids[0] != dac &&
13546 spec->multiout.dac_nids[1] != dac) {
13547 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13548 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13549 HDA_OUTPUT));
13550 if (err < 0)
13551 return err;
13552 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13555 if (nid != 0x16)
13556 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13557 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13558 else /* mono */
13559 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13560 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13561 if (err < 0)
13562 return err;
13563 return 0;
13566 /* add playback controls from the parsed DAC table */
13567 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13568 const struct auto_pin_cfg *cfg)
13570 hda_nid_t nid;
13571 int err;
13573 spec->multiout.dac_nids = spec->private_dac_nids;
13575 nid = cfg->line_out_pins[0];
13576 if (nid) {
13577 const char *name;
13578 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13579 name = "Speaker";
13580 else
13581 name = "Front";
13582 err = alc268_new_analog_output(spec, nid, name, 0);
13583 if (err < 0)
13584 return err;
13587 nid = cfg->speaker_pins[0];
13588 if (nid == 0x1d) {
13589 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13590 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13591 if (err < 0)
13592 return err;
13593 } else if (nid) {
13594 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13595 if (err < 0)
13596 return err;
13598 nid = cfg->hp_pins[0];
13599 if (nid) {
13600 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13601 if (err < 0)
13602 return err;
13605 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13606 if (nid == 0x16) {
13607 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13608 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13609 if (err < 0)
13610 return err;
13612 return 0;
13615 /* create playback/capture controls for input pins */
13616 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13617 const struct auto_pin_cfg *cfg)
13619 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13622 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13623 hda_nid_t nid, int pin_type)
13625 int idx;
13627 alc_set_pin_output(codec, nid, pin_type);
13628 if (nid == 0x14 || nid == 0x16)
13629 idx = 0;
13630 else
13631 idx = 1;
13632 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13635 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13637 struct alc_spec *spec = codec->spec;
13638 int i;
13640 for (i = 0; i < spec->autocfg.line_outs; i++) {
13641 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13642 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13643 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13647 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13649 struct alc_spec *spec = codec->spec;
13650 hda_nid_t pin;
13651 int i;
13653 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13654 pin = spec->autocfg.hp_pins[i];
13655 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13657 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13658 pin = spec->autocfg.speaker_pins[i];
13659 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13661 if (spec->autocfg.mono_out_pin)
13662 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13663 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13666 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13668 struct alc_spec *spec = codec->spec;
13669 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13670 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13671 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13672 unsigned int dac_vol1, dac_vol2;
13674 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13675 snd_hda_codec_write(codec, speaker_nid, 0,
13676 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13677 /* mute mixer inputs from 0x1d */
13678 snd_hda_codec_write(codec, 0x0f, 0,
13679 AC_VERB_SET_AMP_GAIN_MUTE,
13680 AMP_IN_UNMUTE(1));
13681 snd_hda_codec_write(codec, 0x10, 0,
13682 AC_VERB_SET_AMP_GAIN_MUTE,
13683 AMP_IN_UNMUTE(1));
13684 } else {
13685 /* unmute mixer inputs from 0x1d */
13686 snd_hda_codec_write(codec, 0x0f, 0,
13687 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13688 snd_hda_codec_write(codec, 0x10, 0,
13689 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13692 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13693 if (line_nid == 0x14)
13694 dac_vol2 = AMP_OUT_ZERO;
13695 else if (line_nid == 0x15)
13696 dac_vol1 = AMP_OUT_ZERO;
13697 if (hp_nid == 0x14)
13698 dac_vol2 = AMP_OUT_ZERO;
13699 else if (hp_nid == 0x15)
13700 dac_vol1 = AMP_OUT_ZERO;
13701 if (line_nid != 0x16 || hp_nid != 0x16 ||
13702 spec->autocfg.line_out_pins[1] != 0x16 ||
13703 spec->autocfg.line_out_pins[2] != 0x16)
13704 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13706 snd_hda_codec_write(codec, 0x02, 0,
13707 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13708 snd_hda_codec_write(codec, 0x03, 0,
13709 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13712 /* pcm configuration: identical with ALC880 */
13713 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13714 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13715 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13716 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13719 * BIOS auto configuration
13721 static int alc268_parse_auto_config(struct hda_codec *codec)
13723 struct alc_spec *spec = codec->spec;
13724 int err;
13725 static hda_nid_t alc268_ignore[] = { 0 };
13727 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13728 alc268_ignore);
13729 if (err < 0)
13730 return err;
13731 if (!spec->autocfg.line_outs) {
13732 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13733 spec->multiout.max_channels = 2;
13734 spec->no_analog = 1;
13735 goto dig_only;
13737 return 0; /* can't find valid BIOS pin config */
13739 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13740 if (err < 0)
13741 return err;
13742 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13743 if (err < 0)
13744 return err;
13746 spec->multiout.max_channels = 2;
13748 dig_only:
13749 /* digital only support output */
13750 alc_auto_parse_digital(codec);
13751 if (spec->kctls.list)
13752 add_mixer(spec, spec->kctls.list);
13754 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13755 add_mixer(spec, alc268_beep_mixer);
13757 add_verb(spec, alc268_volume_init_verbs);
13758 spec->num_mux_defs = 2;
13759 spec->input_mux = &spec->private_imux[0];
13761 err = alc_auto_add_mic_boost(codec);
13762 if (err < 0)
13763 return err;
13765 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13767 return 1;
13770 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13771 #define alc268_auto_init_input_src alc882_auto_init_input_src
13773 /* init callback for auto-configuration model -- overriding the default init */
13774 static void alc268_auto_init(struct hda_codec *codec)
13776 struct alc_spec *spec = codec->spec;
13777 alc268_auto_init_multi_out(codec);
13778 alc268_auto_init_hp_out(codec);
13779 alc268_auto_init_mono_speaker_out(codec);
13780 alc268_auto_init_analog_input(codec);
13781 alc268_auto_init_input_src(codec);
13782 alc_auto_init_digital(codec);
13783 if (spec->unsol_event)
13784 alc_inithook(codec);
13788 * configuration and preset
13790 static const char * const alc268_models[ALC268_MODEL_LAST] = {
13791 [ALC267_QUANTA_IL1] = "quanta-il1",
13792 [ALC268_3ST] = "3stack",
13793 [ALC268_TOSHIBA] = "toshiba",
13794 [ALC268_ACER] = "acer",
13795 [ALC268_ACER_DMIC] = "acer-dmic",
13796 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13797 [ALC268_DELL] = "dell",
13798 [ALC268_ZEPTO] = "zepto",
13799 #ifdef CONFIG_SND_DEBUG
13800 [ALC268_TEST] = "test",
13801 #endif
13802 [ALC268_AUTO] = "auto",
13805 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13806 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13807 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13808 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13809 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13810 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13811 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13812 ALC268_ACER_ASPIRE_ONE),
13813 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13814 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13815 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13816 /* almost compatible with toshiba but with optional digital outs;
13817 * auto-probing seems working fine
13819 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13820 ALC268_AUTO),
13821 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13822 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13823 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13824 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13825 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13829 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13830 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13831 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13832 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13833 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13834 ALC268_TOSHIBA),
13838 static struct alc_config_preset alc268_presets[] = {
13839 [ALC267_QUANTA_IL1] = {
13840 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13841 alc268_capture_nosrc_mixer },
13842 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13843 alc267_quanta_il1_verbs },
13844 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13845 .dac_nids = alc268_dac_nids,
13846 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13847 .adc_nids = alc268_adc_nids_alt,
13848 .hp_nid = 0x03,
13849 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13850 .channel_mode = alc268_modes,
13851 .unsol_event = alc_sku_unsol_event,
13852 .setup = alc267_quanta_il1_setup,
13853 .init_hook = alc_inithook,
13855 [ALC268_3ST] = {
13856 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13857 alc268_beep_mixer },
13858 .init_verbs = { alc268_base_init_verbs },
13859 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13860 .dac_nids = alc268_dac_nids,
13861 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13862 .adc_nids = alc268_adc_nids_alt,
13863 .capsrc_nids = alc268_capsrc_nids,
13864 .hp_nid = 0x03,
13865 .dig_out_nid = ALC268_DIGOUT_NID,
13866 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13867 .channel_mode = alc268_modes,
13868 .input_mux = &alc268_capture_source,
13870 [ALC268_TOSHIBA] = {
13871 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13872 alc268_beep_mixer },
13873 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13874 alc268_toshiba_verbs },
13875 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13876 .dac_nids = alc268_dac_nids,
13877 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13878 .adc_nids = alc268_adc_nids_alt,
13879 .capsrc_nids = alc268_capsrc_nids,
13880 .hp_nid = 0x03,
13881 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13882 .channel_mode = alc268_modes,
13883 .input_mux = &alc268_capture_source,
13884 .unsol_event = alc268_toshiba_unsol_event,
13885 .setup = alc268_toshiba_setup,
13886 .init_hook = alc268_toshiba_automute,
13888 [ALC268_ACER] = {
13889 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13890 alc268_beep_mixer },
13891 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13892 alc268_acer_verbs },
13893 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13894 .dac_nids = alc268_dac_nids,
13895 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13896 .adc_nids = alc268_adc_nids_alt,
13897 .capsrc_nids = alc268_capsrc_nids,
13898 .hp_nid = 0x02,
13899 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13900 .channel_mode = alc268_modes,
13901 .input_mux = &alc268_acer_capture_source,
13902 .unsol_event = alc268_acer_unsol_event,
13903 .init_hook = alc268_acer_init_hook,
13905 [ALC268_ACER_DMIC] = {
13906 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13907 alc268_beep_mixer },
13908 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13909 alc268_acer_verbs },
13910 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13911 .dac_nids = alc268_dac_nids,
13912 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13913 .adc_nids = alc268_adc_nids_alt,
13914 .capsrc_nids = alc268_capsrc_nids,
13915 .hp_nid = 0x02,
13916 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13917 .channel_mode = alc268_modes,
13918 .input_mux = &alc268_acer_dmic_capture_source,
13919 .unsol_event = alc268_acer_unsol_event,
13920 .init_hook = alc268_acer_init_hook,
13922 [ALC268_ACER_ASPIRE_ONE] = {
13923 .mixers = { alc268_acer_aspire_one_mixer,
13924 alc268_beep_mixer,
13925 alc268_capture_nosrc_mixer },
13926 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13927 alc268_acer_aspire_one_verbs },
13928 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13929 .dac_nids = alc268_dac_nids,
13930 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13931 .adc_nids = alc268_adc_nids_alt,
13932 .capsrc_nids = alc268_capsrc_nids,
13933 .hp_nid = 0x03,
13934 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13935 .channel_mode = alc268_modes,
13936 .unsol_event = alc268_acer_lc_unsol_event,
13937 .setup = alc268_acer_lc_setup,
13938 .init_hook = alc268_acer_lc_init_hook,
13940 [ALC268_DELL] = {
13941 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13942 alc268_capture_nosrc_mixer },
13943 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13944 alc268_dell_verbs },
13945 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13946 .dac_nids = alc268_dac_nids,
13947 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13948 .adc_nids = alc268_adc_nids_alt,
13949 .capsrc_nids = alc268_capsrc_nids,
13950 .hp_nid = 0x02,
13951 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13952 .channel_mode = alc268_modes,
13953 .unsol_event = alc_sku_unsol_event,
13954 .setup = alc268_dell_setup,
13955 .init_hook = alc_inithook,
13957 [ALC268_ZEPTO] = {
13958 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13959 alc268_beep_mixer },
13960 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13961 alc268_toshiba_verbs },
13962 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13963 .dac_nids = alc268_dac_nids,
13964 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13965 .adc_nids = alc268_adc_nids_alt,
13966 .capsrc_nids = alc268_capsrc_nids,
13967 .hp_nid = 0x03,
13968 .dig_out_nid = ALC268_DIGOUT_NID,
13969 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13970 .channel_mode = alc268_modes,
13971 .input_mux = &alc268_capture_source,
13972 .setup = alc268_toshiba_setup,
13973 .init_hook = alc268_toshiba_automute,
13975 #ifdef CONFIG_SND_DEBUG
13976 [ALC268_TEST] = {
13977 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13978 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13979 alc268_volume_init_verbs },
13980 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13981 .dac_nids = alc268_dac_nids,
13982 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13983 .adc_nids = alc268_adc_nids_alt,
13984 .capsrc_nids = alc268_capsrc_nids,
13985 .hp_nid = 0x03,
13986 .dig_out_nid = ALC268_DIGOUT_NID,
13987 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13988 .channel_mode = alc268_modes,
13989 .input_mux = &alc268_capture_source,
13991 #endif
13994 static int patch_alc268(struct hda_codec *codec)
13996 struct alc_spec *spec;
13997 int board_config;
13998 int i, has_beep, err;
14000 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14001 if (spec == NULL)
14002 return -ENOMEM;
14004 codec->spec = spec;
14006 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
14007 alc268_models,
14008 alc268_cfg_tbl);
14010 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
14011 board_config = snd_hda_check_board_codec_sid_config(codec,
14012 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
14014 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
14015 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14016 codec->chip_name);
14017 board_config = ALC268_AUTO;
14020 if (board_config == ALC268_AUTO) {
14021 /* automatic parse from the BIOS config */
14022 err = alc268_parse_auto_config(codec);
14023 if (err < 0) {
14024 alc_free(codec);
14025 return err;
14026 } else if (!err) {
14027 printk(KERN_INFO
14028 "hda_codec: Cannot set up configuration "
14029 "from BIOS. Using base mode...\n");
14030 board_config = ALC268_3ST;
14034 if (board_config != ALC268_AUTO)
14035 setup_preset(codec, &alc268_presets[board_config]);
14037 spec->stream_analog_playback = &alc268_pcm_analog_playback;
14038 spec->stream_analog_capture = &alc268_pcm_analog_capture;
14039 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
14041 spec->stream_digital_playback = &alc268_pcm_digital_playback;
14043 has_beep = 0;
14044 for (i = 0; i < spec->num_mixers; i++) {
14045 if (spec->mixers[i] == alc268_beep_mixer) {
14046 has_beep = 1;
14047 break;
14051 if (has_beep) {
14052 err = snd_hda_attach_beep_device(codec, 0x1);
14053 if (err < 0) {
14054 alc_free(codec);
14055 return err;
14057 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14058 /* override the amp caps for beep generator */
14059 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14060 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14061 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14062 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14063 (0 << AC_AMPCAP_MUTE_SHIFT));
14066 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14067 /* check whether NID 0x07 is valid */
14068 unsigned int wcap = get_wcaps(codec, 0x07);
14070 spec->capsrc_nids = alc268_capsrc_nids;
14071 /* get type */
14072 wcap = get_wcaps_type(wcap);
14073 if (spec->auto_mic ||
14074 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14075 spec->adc_nids = alc268_adc_nids_alt;
14076 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14077 if (spec->auto_mic)
14078 fixup_automic_adc(codec);
14079 if (spec->auto_mic || spec->input_mux->num_items == 1)
14080 add_mixer(spec, alc268_capture_nosrc_mixer);
14081 else
14082 add_mixer(spec, alc268_capture_alt_mixer);
14083 } else {
14084 spec->adc_nids = alc268_adc_nids;
14085 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14086 add_mixer(spec, alc268_capture_mixer);
14090 spec->vmaster_nid = 0x02;
14092 codec->patch_ops = alc_patch_ops;
14093 if (board_config == ALC268_AUTO)
14094 spec->init_hook = alc268_auto_init;
14096 alc_init_jacks(codec);
14098 return 0;
14102 * ALC269 channel source setting (2 channel)
14104 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14106 #define alc269_dac_nids alc260_dac_nids
14108 static hda_nid_t alc269_adc_nids[1] = {
14109 /* ADC1 */
14110 0x08,
14113 static hda_nid_t alc269_capsrc_nids[1] = {
14114 0x23,
14117 static hda_nid_t alc269vb_adc_nids[1] = {
14118 /* ADC1 */
14119 0x09,
14122 static hda_nid_t alc269vb_capsrc_nids[1] = {
14123 0x22,
14126 static hda_nid_t alc269_adc_candidates[] = {
14127 0x08, 0x09, 0x07, 0x11,
14130 #define alc269_modes alc260_modes
14131 #define alc269_capture_source alc880_lg_lw_capture_source
14133 static struct snd_kcontrol_new alc269_base_mixer[] = {
14134 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14135 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14136 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14137 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14138 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14139 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14140 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14141 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14142 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14143 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14144 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14145 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14146 { } /* end */
14149 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14150 /* output mixer control */
14151 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14153 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14154 .name = "Master Playback Switch",
14155 .subdevice = HDA_SUBDEV_AMP_FLAG,
14156 .info = snd_hda_mixer_amp_switch_info,
14157 .get = snd_hda_mixer_amp_switch_get,
14158 .put = alc268_acer_master_sw_put,
14159 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14161 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14162 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14163 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14164 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14165 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14166 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14170 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14171 /* output mixer control */
14172 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14174 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14175 .name = "Master Playback Switch",
14176 .subdevice = HDA_SUBDEV_AMP_FLAG,
14177 .info = snd_hda_mixer_amp_switch_info,
14178 .get = snd_hda_mixer_amp_switch_get,
14179 .put = alc268_acer_master_sw_put,
14180 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14182 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14183 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14184 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14185 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14186 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14187 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14188 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14189 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14190 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14194 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14195 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14196 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14197 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14198 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14199 { } /* end */
14202 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14203 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14204 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14205 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14206 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14207 { } /* end */
14210 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14211 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14212 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14213 { } /* end */
14216 /* capture mixer elements */
14217 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14218 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14219 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14220 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14221 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14222 { } /* end */
14225 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14226 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14227 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14228 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14229 { } /* end */
14232 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14233 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14234 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14235 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14236 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14237 { } /* end */
14240 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14241 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14242 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14243 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14244 { } /* end */
14247 /* FSC amilo */
14248 #define alc269_fujitsu_mixer alc269_laptop_mixer
14250 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14251 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14252 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14253 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14254 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14255 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14256 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14260 static struct hda_verb alc269_lifebook_verbs[] = {
14261 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14262 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14263 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14264 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14265 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14266 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14267 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14268 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14269 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14270 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14274 /* toggle speaker-output according to the hp-jack state */
14275 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14277 unsigned int present;
14278 unsigned char bits;
14280 present = snd_hda_jack_detect(codec, 0x15);
14281 bits = present ? HDA_AMP_MUTE : 0;
14282 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14283 HDA_AMP_MUTE, bits);
14284 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14285 HDA_AMP_MUTE, bits);
14287 snd_hda_codec_write(codec, 0x20, 0,
14288 AC_VERB_SET_COEF_INDEX, 0x0c);
14289 snd_hda_codec_write(codec, 0x20, 0,
14290 AC_VERB_SET_PROC_COEF, 0x680);
14292 snd_hda_codec_write(codec, 0x20, 0,
14293 AC_VERB_SET_COEF_INDEX, 0x0c);
14294 snd_hda_codec_write(codec, 0x20, 0,
14295 AC_VERB_SET_PROC_COEF, 0x480);
14298 /* toggle speaker-output according to the hp-jacks state */
14299 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14301 unsigned int present;
14302 unsigned char bits;
14304 /* Check laptop headphone socket */
14305 present = snd_hda_jack_detect(codec, 0x15);
14307 /* Check port replicator headphone socket */
14308 present |= snd_hda_jack_detect(codec, 0x1a);
14310 bits = present ? HDA_AMP_MUTE : 0;
14311 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14312 HDA_AMP_MUTE, bits);
14313 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14314 HDA_AMP_MUTE, bits);
14316 snd_hda_codec_write(codec, 0x20, 0,
14317 AC_VERB_SET_COEF_INDEX, 0x0c);
14318 snd_hda_codec_write(codec, 0x20, 0,
14319 AC_VERB_SET_PROC_COEF, 0x680);
14321 snd_hda_codec_write(codec, 0x20, 0,
14322 AC_VERB_SET_COEF_INDEX, 0x0c);
14323 snd_hda_codec_write(codec, 0x20, 0,
14324 AC_VERB_SET_PROC_COEF, 0x480);
14327 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14329 unsigned int present_laptop;
14330 unsigned int present_dock;
14332 present_laptop = snd_hda_jack_detect(codec, 0x18);
14333 present_dock = snd_hda_jack_detect(codec, 0x1b);
14335 /* Laptop mic port overrides dock mic port, design decision */
14336 if (present_dock)
14337 snd_hda_codec_write(codec, 0x23, 0,
14338 AC_VERB_SET_CONNECT_SEL, 0x3);
14339 if (present_laptop)
14340 snd_hda_codec_write(codec, 0x23, 0,
14341 AC_VERB_SET_CONNECT_SEL, 0x0);
14342 if (!present_dock && !present_laptop)
14343 snd_hda_codec_write(codec, 0x23, 0,
14344 AC_VERB_SET_CONNECT_SEL, 0x1);
14347 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14348 unsigned int res)
14350 switch (res >> 26) {
14351 case ALC880_HP_EVENT:
14352 alc269_quanta_fl1_speaker_automute(codec);
14353 break;
14354 case ALC880_MIC_EVENT:
14355 alc_mic_automute(codec);
14356 break;
14360 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14361 unsigned int res)
14363 if ((res >> 26) == ALC880_HP_EVENT)
14364 alc269_lifebook_speaker_automute(codec);
14365 if ((res >> 26) == ALC880_MIC_EVENT)
14366 alc269_lifebook_mic_autoswitch(codec);
14369 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14371 struct alc_spec *spec = codec->spec;
14372 spec->autocfg.hp_pins[0] = 0x15;
14373 spec->autocfg.speaker_pins[0] = 0x14;
14374 spec->ext_mic.pin = 0x18;
14375 spec->ext_mic.mux_idx = 0;
14376 spec->int_mic.pin = 0x19;
14377 spec->int_mic.mux_idx = 1;
14378 spec->auto_mic = 1;
14381 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14383 alc269_quanta_fl1_speaker_automute(codec);
14384 alc_mic_automute(codec);
14387 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14389 alc269_lifebook_speaker_automute(codec);
14390 alc269_lifebook_mic_autoswitch(codec);
14393 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14394 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14395 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14396 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14397 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14398 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14399 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14400 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14404 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14405 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14406 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14407 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14408 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14409 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14410 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14414 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14415 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14416 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14417 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14418 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14419 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14420 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14421 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14425 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14426 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14427 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14428 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14429 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14430 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14431 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14432 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14436 static struct hda_verb alc271_acer_dmic_verbs[] = {
14437 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14438 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14439 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14440 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14441 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14442 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14443 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14444 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14445 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14446 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14450 /* toggle speaker-output according to the hp-jack state */
14451 static void alc269_speaker_automute(struct hda_codec *codec)
14453 struct alc_spec *spec = codec->spec;
14454 unsigned int nid = spec->autocfg.hp_pins[0];
14455 unsigned int present;
14456 unsigned char bits;
14458 present = snd_hda_jack_detect(codec, nid);
14459 bits = present ? HDA_AMP_MUTE : 0;
14460 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14461 HDA_AMP_MUTE, bits);
14462 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14463 HDA_AMP_MUTE, bits);
14464 snd_hda_input_jack_report(codec, nid);
14467 /* unsolicited event for HP jack sensing */
14468 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14469 unsigned int res)
14471 switch (res >> 26) {
14472 case ALC880_HP_EVENT:
14473 alc269_speaker_automute(codec);
14474 break;
14475 case ALC880_MIC_EVENT:
14476 alc_mic_automute(codec);
14477 break;
14481 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14483 struct alc_spec *spec = codec->spec;
14484 spec->autocfg.hp_pins[0] = 0x15;
14485 spec->autocfg.speaker_pins[0] = 0x14;
14486 spec->ext_mic.pin = 0x18;
14487 spec->ext_mic.mux_idx = 0;
14488 spec->int_mic.pin = 0x19;
14489 spec->int_mic.mux_idx = 1;
14490 spec->auto_mic = 1;
14493 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14495 struct alc_spec *spec = codec->spec;
14496 spec->autocfg.hp_pins[0] = 0x15;
14497 spec->autocfg.speaker_pins[0] = 0x14;
14498 spec->ext_mic.pin = 0x18;
14499 spec->ext_mic.mux_idx = 0;
14500 spec->int_mic.pin = 0x12;
14501 spec->int_mic.mux_idx = 5;
14502 spec->auto_mic = 1;
14505 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14507 struct alc_spec *spec = codec->spec;
14508 spec->autocfg.hp_pins[0] = 0x21;
14509 spec->autocfg.speaker_pins[0] = 0x14;
14510 spec->ext_mic.pin = 0x18;
14511 spec->ext_mic.mux_idx = 0;
14512 spec->int_mic.pin = 0x19;
14513 spec->int_mic.mux_idx = 1;
14514 spec->auto_mic = 1;
14517 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14519 struct alc_spec *spec = codec->spec;
14520 spec->autocfg.hp_pins[0] = 0x21;
14521 spec->autocfg.speaker_pins[0] = 0x14;
14522 spec->ext_mic.pin = 0x18;
14523 spec->ext_mic.mux_idx = 0;
14524 spec->int_mic.pin = 0x12;
14525 spec->int_mic.mux_idx = 6;
14526 spec->auto_mic = 1;
14529 static void alc269_laptop_inithook(struct hda_codec *codec)
14531 alc269_speaker_automute(codec);
14532 alc_mic_automute(codec);
14536 * generic initialization of ADC, input mixers and output mixers
14538 static struct hda_verb alc269_init_verbs[] = {
14540 * Unmute ADC0 and set the default input to mic-in
14542 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14545 * Set up output mixers (0x02 - 0x03)
14547 /* set vol=0 to output mixers */
14548 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14549 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14551 /* set up input amps for analog loopback */
14552 /* Amp Indices: DAC = 0, mixer = 1 */
14553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14555 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14556 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14557 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14558 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14560 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14561 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14562 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14563 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14564 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14565 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14566 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14568 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14569 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14571 /* FIXME: use Mux-type input source selection */
14572 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14573 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14574 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14576 /* set EAPD */
14577 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14581 static struct hda_verb alc269vb_init_verbs[] = {
14583 * Unmute ADC0 and set the default input to mic-in
14585 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14588 * Set up output mixers (0x02 - 0x03)
14590 /* set vol=0 to output mixers */
14591 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14592 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14594 /* set up input amps for analog loopback */
14595 /* Amp Indices: DAC = 0, mixer = 1 */
14596 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14597 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14598 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14599 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14600 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14601 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14604 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14605 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14606 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14607 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14608 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14609 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14611 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14612 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14614 /* FIXME: use Mux-type input source selection */
14615 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14616 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14617 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14619 /* set EAPD */
14620 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14624 #define alc269_auto_create_multi_out_ctls \
14625 alc268_auto_create_multi_out_ctls
14626 #define alc269_auto_create_input_ctls \
14627 alc268_auto_create_input_ctls
14629 #ifdef CONFIG_SND_HDA_POWER_SAVE
14630 #define alc269_loopbacks alc880_loopbacks
14631 #endif
14633 /* pcm configuration: identical with ALC880 */
14634 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14635 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14636 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14637 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14639 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14640 .substreams = 1,
14641 .channels_min = 2,
14642 .channels_max = 8,
14643 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14644 /* NID is set in alc_build_pcms */
14645 .ops = {
14646 .open = alc880_playback_pcm_open,
14647 .prepare = alc880_playback_pcm_prepare,
14648 .cleanup = alc880_playback_pcm_cleanup
14652 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14653 .substreams = 1,
14654 .channels_min = 2,
14655 .channels_max = 2,
14656 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14657 /* NID is set in alc_build_pcms */
14660 #ifdef CONFIG_SND_HDA_POWER_SAVE
14661 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14663 switch (codec->subsystem_id) {
14664 case 0x103c1586:
14665 return 1;
14667 return 0;
14670 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14672 /* update mute-LED according to the speaker mute state */
14673 if (nid == 0x01 || nid == 0x14) {
14674 int pinval;
14675 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14676 HDA_AMP_MUTE)
14677 pinval = 0x24;
14678 else
14679 pinval = 0x20;
14680 /* mic2 vref pin is used for mute LED control */
14681 snd_hda_codec_update_cache(codec, 0x19, 0,
14682 AC_VERB_SET_PIN_WIDGET_CONTROL,
14683 pinval);
14685 return alc_check_power_status(codec, nid);
14687 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14689 static int alc275_setup_dual_adc(struct hda_codec *codec)
14691 struct alc_spec *spec = codec->spec;
14693 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14694 return 0;
14695 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14696 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14697 if (spec->ext_mic.pin <= 0x12) {
14698 spec->private_adc_nids[0] = 0x08;
14699 spec->private_adc_nids[1] = 0x11;
14700 spec->private_capsrc_nids[0] = 0x23;
14701 spec->private_capsrc_nids[1] = 0x22;
14702 } else {
14703 spec->private_adc_nids[0] = 0x11;
14704 spec->private_adc_nids[1] = 0x08;
14705 spec->private_capsrc_nids[0] = 0x22;
14706 spec->private_capsrc_nids[1] = 0x23;
14708 spec->adc_nids = spec->private_adc_nids;
14709 spec->capsrc_nids = spec->private_capsrc_nids;
14710 spec->num_adc_nids = 2;
14711 spec->dual_adc_switch = 1;
14712 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14713 spec->adc_nids[0], spec->adc_nids[1]);
14714 return 1;
14716 return 0;
14719 /* different alc269-variants */
14720 enum {
14721 ALC269_TYPE_NORMAL,
14722 ALC269_TYPE_ALC258,
14723 ALC269_TYPE_ALC259,
14724 ALC269_TYPE_ALC269VB,
14725 ALC269_TYPE_ALC270,
14726 ALC269_TYPE_ALC271X,
14730 * BIOS auto configuration
14732 static int alc269_parse_auto_config(struct hda_codec *codec)
14734 struct alc_spec *spec = codec->spec;
14735 int err;
14736 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14738 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14739 alc269_ignore);
14740 if (err < 0)
14741 return err;
14743 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14744 if (err < 0)
14745 return err;
14746 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14747 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14748 else
14749 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14750 0x22, 0);
14751 if (err < 0)
14752 return err;
14754 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14756 alc_auto_parse_digital(codec);
14758 if (spec->kctls.list)
14759 add_mixer(spec, spec->kctls.list);
14761 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14762 add_verb(spec, alc269vb_init_verbs);
14763 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14764 } else {
14765 add_verb(spec, alc269_init_verbs);
14766 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14769 spec->num_mux_defs = 1;
14770 spec->input_mux = &spec->private_imux[0];
14772 if (!alc275_setup_dual_adc(codec))
14773 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14774 sizeof(alc269_adc_candidates));
14776 err = alc_auto_add_mic_boost(codec);
14777 if (err < 0)
14778 return err;
14780 if (!spec->cap_mixer && !spec->no_analog)
14781 set_capture_mixer(codec);
14783 return 1;
14786 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14787 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14788 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14789 #define alc269_auto_init_input_src alc882_auto_init_input_src
14792 /* init callback for auto-configuration model -- overriding the default init */
14793 static void alc269_auto_init(struct hda_codec *codec)
14795 struct alc_spec *spec = codec->spec;
14796 alc269_auto_init_multi_out(codec);
14797 alc269_auto_init_hp_out(codec);
14798 alc269_auto_init_analog_input(codec);
14799 if (!spec->dual_adc_switch)
14800 alc269_auto_init_input_src(codec);
14801 alc_auto_init_digital(codec);
14802 if (spec->unsol_event)
14803 alc_inithook(codec);
14806 #ifdef SND_HDA_NEEDS_RESUME
14807 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14809 int val = alc_read_coef_idx(codec, 0x04);
14810 if (power_up)
14811 val |= 1 << 11;
14812 else
14813 val &= ~(1 << 11);
14814 alc_write_coef_idx(codec, 0x04, val);
14817 #ifdef CONFIG_SND_HDA_POWER_SAVE
14818 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14820 struct alc_spec *spec = codec->spec;
14822 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14823 alc269_toggle_power_output(codec, 0);
14824 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14825 alc269_toggle_power_output(codec, 0);
14826 msleep(150);
14829 alc_shutup(codec);
14830 if (spec && spec->power_hook)
14831 spec->power_hook(codec);
14832 return 0;
14834 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14836 static int alc269_resume(struct hda_codec *codec)
14838 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14839 alc269_toggle_power_output(codec, 0);
14840 msleep(150);
14843 codec->patch_ops.init(codec);
14845 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14846 alc269_toggle_power_output(codec, 1);
14847 msleep(200);
14850 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14851 alc269_toggle_power_output(codec, 1);
14853 snd_hda_codec_resume_amp(codec);
14854 snd_hda_codec_resume_cache(codec);
14855 hda_call_check_power_status(codec, 0x01);
14856 return 0;
14858 #endif /* SND_HDA_NEEDS_RESUME */
14860 static void alc269_fixup_hweq(struct hda_codec *codec,
14861 const struct alc_fixup *fix, int action)
14863 int coef;
14865 if (action != ALC_FIXUP_ACT_INIT)
14866 return;
14867 coef = alc_read_coef_idx(codec, 0x1e);
14868 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14871 static void alc271_fixup_dmic(struct hda_codec *codec,
14872 const struct alc_fixup *fix, int action)
14874 static struct hda_verb verbs[] = {
14875 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14876 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14879 unsigned int cfg;
14881 if (strcmp(codec->chip_name, "ALC271X"))
14882 return;
14883 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
14884 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
14885 snd_hda_sequence_write(codec, verbs);
14888 enum {
14889 ALC269_FIXUP_SONY_VAIO,
14890 ALC275_FIXUP_SONY_VAIO_GPIO2,
14891 ALC269_FIXUP_DELL_M101Z,
14892 ALC269_FIXUP_SKU_IGNORE,
14893 ALC269_FIXUP_ASUS_G73JW,
14894 ALC269_FIXUP_LENOVO_EAPD,
14895 ALC275_FIXUP_SONY_HWEQ,
14896 ALC271_FIXUP_DMIC,
14899 static const struct alc_fixup alc269_fixups[] = {
14900 [ALC269_FIXUP_SONY_VAIO] = {
14901 .type = ALC_FIXUP_VERBS,
14902 .v.verbs = (const struct hda_verb[]) {
14903 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14907 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14908 .type = ALC_FIXUP_VERBS,
14909 .v.verbs = (const struct hda_verb[]) {
14910 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14911 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14912 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14915 .chained = true,
14916 .chain_id = ALC269_FIXUP_SONY_VAIO
14918 [ALC269_FIXUP_DELL_M101Z] = {
14919 .type = ALC_FIXUP_VERBS,
14920 .v.verbs = (const struct hda_verb[]) {
14921 /* Enables internal speaker */
14922 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14923 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14927 [ALC269_FIXUP_SKU_IGNORE] = {
14928 .type = ALC_FIXUP_SKU,
14929 .v.sku = ALC_FIXUP_SKU_IGNORE,
14931 [ALC269_FIXUP_ASUS_G73JW] = {
14932 .type = ALC_FIXUP_PINS,
14933 .v.pins = (const struct alc_pincfg[]) {
14934 { 0x17, 0x99130111 }, /* subwoofer */
14938 [ALC269_FIXUP_LENOVO_EAPD] = {
14939 .type = ALC_FIXUP_VERBS,
14940 .v.verbs = (const struct hda_verb[]) {
14941 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14945 [ALC275_FIXUP_SONY_HWEQ] = {
14946 .type = ALC_FIXUP_FUNC,
14947 .v.func = alc269_fixup_hweq,
14948 .chained = true,
14949 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14951 [ALC271_FIXUP_DMIC] = {
14952 .type = ALC_FIXUP_FUNC,
14953 .v.func = alc271_fixup_dmic,
14957 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14958 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14959 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14960 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14961 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14962 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14963 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
14964 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14965 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
14966 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14967 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
14968 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
14969 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14970 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
14976 * configuration and preset
14978 static const char * const alc269_models[ALC269_MODEL_LAST] = {
14979 [ALC269_BASIC] = "basic",
14980 [ALC269_QUANTA_FL1] = "quanta",
14981 [ALC269_AMIC] = "laptop-amic",
14982 [ALC269_DMIC] = "laptop-dmic",
14983 [ALC269_FUJITSU] = "fujitsu",
14984 [ALC269_LIFEBOOK] = "lifebook",
14985 [ALC269_AUTO] = "auto",
14988 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14989 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14990 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14991 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14992 ALC269_AMIC),
14993 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14994 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14995 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14996 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14997 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14998 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14999 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
15000 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
15001 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
15002 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC),
15003 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
15004 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
15005 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
15006 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
15007 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
15008 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
15009 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
15010 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
15011 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
15012 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
15013 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
15014 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
15015 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
15016 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
15017 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
15018 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
15019 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
15020 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
15021 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
15022 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
15023 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
15024 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
15025 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
15026 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
15027 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
15028 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
15029 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
15030 ALC269_DMIC),
15031 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
15032 ALC269_DMIC),
15033 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
15034 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
15035 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
15036 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
15037 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
15038 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
15039 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
15040 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
15041 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
15042 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
15046 static struct alc_config_preset alc269_presets[] = {
15047 [ALC269_BASIC] = {
15048 .mixers = { alc269_base_mixer },
15049 .init_verbs = { alc269_init_verbs },
15050 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15051 .dac_nids = alc269_dac_nids,
15052 .hp_nid = 0x03,
15053 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15054 .channel_mode = alc269_modes,
15055 .input_mux = &alc269_capture_source,
15057 [ALC269_QUANTA_FL1] = {
15058 .mixers = { alc269_quanta_fl1_mixer },
15059 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
15060 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15061 .dac_nids = alc269_dac_nids,
15062 .hp_nid = 0x03,
15063 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15064 .channel_mode = alc269_modes,
15065 .input_mux = &alc269_capture_source,
15066 .unsol_event = alc269_quanta_fl1_unsol_event,
15067 .setup = alc269_quanta_fl1_setup,
15068 .init_hook = alc269_quanta_fl1_init_hook,
15070 [ALC269_AMIC] = {
15071 .mixers = { alc269_laptop_mixer },
15072 .cap_mixer = alc269_laptop_analog_capture_mixer,
15073 .init_verbs = { alc269_init_verbs,
15074 alc269_laptop_amic_init_verbs },
15075 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15076 .dac_nids = alc269_dac_nids,
15077 .hp_nid = 0x03,
15078 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15079 .channel_mode = alc269_modes,
15080 .unsol_event = alc269_laptop_unsol_event,
15081 .setup = alc269_laptop_amic_setup,
15082 .init_hook = alc269_laptop_inithook,
15084 [ALC269_DMIC] = {
15085 .mixers = { alc269_laptop_mixer },
15086 .cap_mixer = alc269_laptop_digital_capture_mixer,
15087 .init_verbs = { alc269_init_verbs,
15088 alc269_laptop_dmic_init_verbs },
15089 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15090 .dac_nids = alc269_dac_nids,
15091 .hp_nid = 0x03,
15092 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15093 .channel_mode = alc269_modes,
15094 .unsol_event = alc269_laptop_unsol_event,
15095 .setup = alc269_laptop_dmic_setup,
15096 .init_hook = alc269_laptop_inithook,
15098 [ALC269VB_AMIC] = {
15099 .mixers = { alc269vb_laptop_mixer },
15100 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
15101 .init_verbs = { alc269vb_init_verbs,
15102 alc269vb_laptop_amic_init_verbs },
15103 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15104 .dac_nids = alc269_dac_nids,
15105 .hp_nid = 0x03,
15106 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15107 .channel_mode = alc269_modes,
15108 .unsol_event = alc269_laptop_unsol_event,
15109 .setup = alc269vb_laptop_amic_setup,
15110 .init_hook = alc269_laptop_inithook,
15112 [ALC269VB_DMIC] = {
15113 .mixers = { alc269vb_laptop_mixer },
15114 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15115 .init_verbs = { alc269vb_init_verbs,
15116 alc269vb_laptop_dmic_init_verbs },
15117 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15118 .dac_nids = alc269_dac_nids,
15119 .hp_nid = 0x03,
15120 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15121 .channel_mode = alc269_modes,
15122 .unsol_event = alc269_laptop_unsol_event,
15123 .setup = alc269vb_laptop_dmic_setup,
15124 .init_hook = alc269_laptop_inithook,
15126 [ALC269_FUJITSU] = {
15127 .mixers = { alc269_fujitsu_mixer },
15128 .cap_mixer = alc269_laptop_digital_capture_mixer,
15129 .init_verbs = { alc269_init_verbs,
15130 alc269_laptop_dmic_init_verbs },
15131 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15132 .dac_nids = alc269_dac_nids,
15133 .hp_nid = 0x03,
15134 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15135 .channel_mode = alc269_modes,
15136 .unsol_event = alc269_laptop_unsol_event,
15137 .setup = alc269_laptop_dmic_setup,
15138 .init_hook = alc269_laptop_inithook,
15140 [ALC269_LIFEBOOK] = {
15141 .mixers = { alc269_lifebook_mixer },
15142 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15143 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15144 .dac_nids = alc269_dac_nids,
15145 .hp_nid = 0x03,
15146 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15147 .channel_mode = alc269_modes,
15148 .input_mux = &alc269_capture_source,
15149 .unsol_event = alc269_lifebook_unsol_event,
15150 .init_hook = alc269_lifebook_init_hook,
15152 [ALC271_ACER] = {
15153 .mixers = { alc269_asus_mixer },
15154 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15155 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15156 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15157 .dac_nids = alc269_dac_nids,
15158 .adc_nids = alc262_dmic_adc_nids,
15159 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15160 .capsrc_nids = alc262_dmic_capsrc_nids,
15161 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15162 .channel_mode = alc269_modes,
15163 .input_mux = &alc269_capture_source,
15164 .dig_out_nid = ALC880_DIGOUT_NID,
15165 .unsol_event = alc_sku_unsol_event,
15166 .setup = alc269vb_laptop_dmic_setup,
15167 .init_hook = alc_inithook,
15171 static int alc269_fill_coef(struct hda_codec *codec)
15173 int val;
15175 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15176 alc_write_coef_idx(codec, 0xf, 0x960b);
15177 alc_write_coef_idx(codec, 0xe, 0x8817);
15180 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15181 alc_write_coef_idx(codec, 0xf, 0x960b);
15182 alc_write_coef_idx(codec, 0xe, 0x8814);
15185 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15186 val = alc_read_coef_idx(codec, 0x04);
15187 /* Power up output pin */
15188 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15191 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15192 val = alc_read_coef_idx(codec, 0xd);
15193 if ((val & 0x0c00) >> 10 != 0x1) {
15194 /* Capless ramp up clock control */
15195 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15197 val = alc_read_coef_idx(codec, 0x17);
15198 if ((val & 0x01c0) >> 6 != 0x4) {
15199 /* Class D power on reset */
15200 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15203 return 0;
15206 static int patch_alc269(struct hda_codec *codec)
15208 struct alc_spec *spec;
15209 int board_config, coef;
15210 int err;
15212 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15213 if (spec == NULL)
15214 return -ENOMEM;
15216 codec->spec = spec;
15218 alc_auto_parse_customize_define(codec);
15220 if (codec->vendor_id == 0x10ec0269) {
15221 coef = alc_read_coef_idx(codec, 0);
15222 if ((coef & 0x00f0) == 0x0010) {
15223 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15224 spec->cdefine.platform_type == 1) {
15225 alc_codec_rename(codec, "ALC271X");
15226 spec->codec_variant = ALC269_TYPE_ALC271X;
15227 } else if ((coef & 0xf000) == 0x1000) {
15228 spec->codec_variant = ALC269_TYPE_ALC270;
15229 } else if ((coef & 0xf000) == 0x2000) {
15230 alc_codec_rename(codec, "ALC259");
15231 spec->codec_variant = ALC269_TYPE_ALC259;
15232 } else if ((coef & 0xf000) == 0x3000) {
15233 alc_codec_rename(codec, "ALC258");
15234 spec->codec_variant = ALC269_TYPE_ALC258;
15235 } else {
15236 alc_codec_rename(codec, "ALC269VB");
15237 spec->codec_variant = ALC269_TYPE_ALC269VB;
15239 } else
15240 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15241 alc269_fill_coef(codec);
15244 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15245 alc269_models,
15246 alc269_cfg_tbl);
15248 if (board_config < 0) {
15249 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15250 codec->chip_name);
15251 board_config = ALC269_AUTO;
15254 if (board_config == ALC269_AUTO) {
15255 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15256 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15259 if (board_config == ALC269_AUTO) {
15260 /* automatic parse from the BIOS config */
15261 err = alc269_parse_auto_config(codec);
15262 if (err < 0) {
15263 alc_free(codec);
15264 return err;
15265 } else if (!err) {
15266 printk(KERN_INFO
15267 "hda_codec: Cannot set up configuration "
15268 "from BIOS. Using base mode...\n");
15269 board_config = ALC269_BASIC;
15273 if (has_cdefine_beep(codec)) {
15274 err = snd_hda_attach_beep_device(codec, 0x1);
15275 if (err < 0) {
15276 alc_free(codec);
15277 return err;
15281 if (board_config != ALC269_AUTO)
15282 setup_preset(codec, &alc269_presets[board_config]);
15284 if (board_config == ALC269_QUANTA_FL1) {
15285 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15286 * fix the sample rate of analog I/O to 44.1kHz
15288 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15289 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15290 } else if (spec->dual_adc_switch) {
15291 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15292 /* switch ADC dynamically */
15293 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15294 } else {
15295 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15296 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15298 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15299 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15301 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15302 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15303 spec->adc_nids = alc269_adc_nids;
15304 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15305 spec->capsrc_nids = alc269_capsrc_nids;
15306 } else {
15307 spec->adc_nids = alc269vb_adc_nids;
15308 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15309 spec->capsrc_nids = alc269vb_capsrc_nids;
15313 if (!spec->cap_mixer)
15314 set_capture_mixer(codec);
15315 if (has_cdefine_beep(codec))
15316 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15318 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15320 spec->vmaster_nid = 0x02;
15322 codec->patch_ops = alc_patch_ops;
15323 #ifdef CONFIG_SND_HDA_POWER_SAVE
15324 codec->patch_ops.suspend = alc269_suspend;
15325 #endif
15326 #ifdef SND_HDA_NEEDS_RESUME
15327 codec->patch_ops.resume = alc269_resume;
15328 #endif
15329 if (board_config == ALC269_AUTO)
15330 spec->init_hook = alc269_auto_init;
15332 alc_init_jacks(codec);
15333 #ifdef CONFIG_SND_HDA_POWER_SAVE
15334 if (!spec->loopback.amplist)
15335 spec->loopback.amplist = alc269_loopbacks;
15336 if (alc269_mic2_for_mute_led(codec))
15337 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15338 #endif
15340 return 0;
15344 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15348 * set the path ways for 2 channel output
15349 * need to set the codec line out and mic 1 pin widgets to inputs
15351 static struct hda_verb alc861_threestack_ch2_init[] = {
15352 /* set pin widget 1Ah (line in) for input */
15353 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15354 /* set pin widget 18h (mic1/2) for input, for mic also enable
15355 * the vref
15357 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15359 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15360 #if 0
15361 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15362 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15363 #endif
15364 { } /* end */
15367 * 6ch mode
15368 * need to set the codec line out and mic 1 pin widgets to outputs
15370 static struct hda_verb alc861_threestack_ch6_init[] = {
15371 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15372 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15373 /* set pin widget 18h (mic1) for output (CLFE)*/
15374 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15376 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15377 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15379 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15380 #if 0
15381 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15382 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15383 #endif
15384 { } /* end */
15387 static struct hda_channel_mode alc861_threestack_modes[2] = {
15388 { 2, alc861_threestack_ch2_init },
15389 { 6, alc861_threestack_ch6_init },
15391 /* Set mic1 as input and unmute the mixer */
15392 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15393 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15394 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15395 { } /* end */
15397 /* Set mic1 as output and mute mixer */
15398 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15399 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15400 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15401 { } /* end */
15404 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15405 { 2, alc861_uniwill_m31_ch2_init },
15406 { 4, alc861_uniwill_m31_ch4_init },
15409 /* Set mic1 and line-in as input and unmute the mixer */
15410 static struct hda_verb alc861_asus_ch2_init[] = {
15411 /* set pin widget 1Ah (line in) for input */
15412 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15413 /* set pin widget 18h (mic1/2) for input, for mic also enable
15414 * the vref
15416 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15418 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15419 #if 0
15420 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15421 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15422 #endif
15423 { } /* end */
15425 /* Set mic1 nad line-in as output and mute mixer */
15426 static struct hda_verb alc861_asus_ch6_init[] = {
15427 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15428 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15429 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15430 /* set pin widget 18h (mic1) for output (CLFE)*/
15431 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15432 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15433 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15434 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15436 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15437 #if 0
15438 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15439 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15440 #endif
15441 { } /* end */
15444 static struct hda_channel_mode alc861_asus_modes[2] = {
15445 { 2, alc861_asus_ch2_init },
15446 { 6, alc861_asus_ch6_init },
15449 /* patch-ALC861 */
15451 static struct snd_kcontrol_new alc861_base_mixer[] = {
15452 /* output mixer control */
15453 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15454 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15455 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15456 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15457 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15459 /*Input mixer control */
15460 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15461 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15462 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15463 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15464 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15465 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15466 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15467 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15468 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15469 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15471 { } /* end */
15474 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15475 /* output mixer control */
15476 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15477 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15478 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15479 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15480 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15482 /* Input mixer control */
15483 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15484 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15485 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15486 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15487 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15488 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15489 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15490 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15491 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15492 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15495 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15496 .name = "Channel Mode",
15497 .info = alc_ch_mode_info,
15498 .get = alc_ch_mode_get,
15499 .put = alc_ch_mode_put,
15500 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15502 { } /* end */
15505 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15506 /* output mixer control */
15507 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15508 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15509 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15511 { } /* end */
15514 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15515 /* output mixer control */
15516 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15517 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15518 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15519 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15520 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15522 /* Input mixer control */
15523 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15524 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15525 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15526 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15527 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15528 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15529 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15530 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15531 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15532 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15535 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15536 .name = "Channel Mode",
15537 .info = alc_ch_mode_info,
15538 .get = alc_ch_mode_get,
15539 .put = alc_ch_mode_put,
15540 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15542 { } /* end */
15545 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15546 /* output mixer control */
15547 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15548 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15549 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15550 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15551 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15553 /* Input mixer control */
15554 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15555 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15556 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15557 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15558 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15559 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15560 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15561 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15562 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15563 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15566 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15567 .name = "Channel Mode",
15568 .info = alc_ch_mode_info,
15569 .get = alc_ch_mode_get,
15570 .put = alc_ch_mode_put,
15571 .private_value = ARRAY_SIZE(alc861_asus_modes),
15576 /* additional mixer */
15577 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15578 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15579 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15584 * generic initialization of ADC, input mixers and output mixers
15586 static struct hda_verb alc861_base_init_verbs[] = {
15588 * Unmute ADC0 and set the default input to mic-in
15590 /* port-A for surround (rear panel) */
15591 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15592 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15593 /* port-B for mic-in (rear panel) with vref */
15594 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15595 /* port-C for line-in (rear panel) */
15596 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15597 /* port-D for Front */
15598 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15599 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15600 /* port-E for HP out (front panel) */
15601 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15602 /* route front PCM to HP */
15603 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15604 /* port-F for mic-in (front panel) with vref */
15605 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15606 /* port-G for CLFE (rear panel) */
15607 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15608 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15609 /* port-H for side (rear panel) */
15610 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15611 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15612 /* CD-in */
15613 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15614 /* route front mic to ADC1*/
15615 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15616 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15618 /* Unmute DAC0~3 & spdif out*/
15619 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15620 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15621 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15622 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15623 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15625 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15626 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15627 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15628 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15629 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15631 /* Unmute Stereo Mixer 15 */
15632 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15633 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15634 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15635 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15637 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15638 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15639 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15640 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15641 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15642 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15643 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15644 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15645 /* hp used DAC 3 (Front) */
15646 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15647 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15652 static struct hda_verb alc861_threestack_init_verbs[] = {
15654 * Unmute ADC0 and set the default input to mic-in
15656 /* port-A for surround (rear panel) */
15657 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15658 /* port-B for mic-in (rear panel) with vref */
15659 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15660 /* port-C for line-in (rear panel) */
15661 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15662 /* port-D for Front */
15663 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15664 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15665 /* port-E for HP out (front panel) */
15666 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15667 /* route front PCM to HP */
15668 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15669 /* port-F for mic-in (front panel) with vref */
15670 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15671 /* port-G for CLFE (rear panel) */
15672 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15673 /* port-H for side (rear panel) */
15674 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15675 /* CD-in */
15676 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15677 /* route front mic to ADC1*/
15678 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15679 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15680 /* Unmute DAC0~3 & spdif out*/
15681 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15682 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15683 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15684 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15685 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15687 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15688 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15689 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15690 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15691 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15693 /* Unmute Stereo Mixer 15 */
15694 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15695 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15696 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15697 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15699 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15700 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15701 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15702 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15703 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15704 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15705 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15706 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15707 /* hp used DAC 3 (Front) */
15708 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15709 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15713 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15715 * Unmute ADC0 and set the default input to mic-in
15717 /* port-A for surround (rear panel) */
15718 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15719 /* port-B for mic-in (rear panel) with vref */
15720 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15721 /* port-C for line-in (rear panel) */
15722 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15723 /* port-D for Front */
15724 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15725 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15726 /* port-E for HP out (front panel) */
15727 /* this has to be set to VREF80 */
15728 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15729 /* route front PCM to HP */
15730 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15731 /* port-F for mic-in (front panel) with vref */
15732 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15733 /* port-G for CLFE (rear panel) */
15734 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15735 /* port-H for side (rear panel) */
15736 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15737 /* CD-in */
15738 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15739 /* route front mic to ADC1*/
15740 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15741 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15742 /* Unmute DAC0~3 & spdif out*/
15743 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15744 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15745 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15746 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15747 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15749 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15750 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15751 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15752 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15753 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15755 /* Unmute Stereo Mixer 15 */
15756 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15757 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15758 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15759 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15761 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15762 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15763 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15764 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15765 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15766 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15767 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15768 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15769 /* hp used DAC 3 (Front) */
15770 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15771 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15775 static struct hda_verb alc861_asus_init_verbs[] = {
15777 * Unmute ADC0 and set the default input to mic-in
15779 /* port-A for surround (rear panel)
15780 * according to codec#0 this is the HP jack
15782 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15783 /* route front PCM to HP */
15784 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15785 /* port-B for mic-in (rear panel) with vref */
15786 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15787 /* port-C for line-in (rear panel) */
15788 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15789 /* port-D for Front */
15790 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15791 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15792 /* port-E for HP out (front panel) */
15793 /* this has to be set to VREF80 */
15794 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15795 /* route front PCM to HP */
15796 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15797 /* port-F for mic-in (front panel) with vref */
15798 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15799 /* port-G for CLFE (rear panel) */
15800 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15801 /* port-H for side (rear panel) */
15802 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15803 /* CD-in */
15804 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15805 /* route front mic to ADC1*/
15806 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15807 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15808 /* Unmute DAC0~3 & spdif out*/
15809 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15810 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15811 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15812 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15813 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15814 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15815 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15816 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15817 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15818 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15820 /* Unmute Stereo Mixer 15 */
15821 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15822 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15823 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15824 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15826 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15827 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15828 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15829 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15830 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15831 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15832 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15833 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15834 /* hp used DAC 3 (Front) */
15835 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15836 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15840 /* additional init verbs for ASUS laptops */
15841 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15842 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15843 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15848 * generic initialization of ADC, input mixers and output mixers
15850 static struct hda_verb alc861_auto_init_verbs[] = {
15852 * Unmute ADC0 and set the default input to mic-in
15854 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15857 /* Unmute DAC0~3 & spdif out*/
15858 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15859 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15860 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15861 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15862 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15864 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15865 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15866 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15867 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15868 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15870 /* Unmute Stereo Mixer 15 */
15871 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15872 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15873 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15874 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15876 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15877 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15878 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15879 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15880 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15881 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15882 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15883 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15885 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15886 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15887 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15888 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15889 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15890 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15891 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15892 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15894 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15899 static struct hda_verb alc861_toshiba_init_verbs[] = {
15900 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15905 /* toggle speaker-output according to the hp-jack state */
15906 static void alc861_toshiba_automute(struct hda_codec *codec)
15908 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15910 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15911 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15912 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15913 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15916 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15917 unsigned int res)
15919 if ((res >> 26) == ALC880_HP_EVENT)
15920 alc861_toshiba_automute(codec);
15923 /* pcm configuration: identical with ALC880 */
15924 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15925 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15926 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15927 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15930 #define ALC861_DIGOUT_NID 0x07
15932 static struct hda_channel_mode alc861_8ch_modes[1] = {
15933 { 8, NULL }
15936 static hda_nid_t alc861_dac_nids[4] = {
15937 /* front, surround, clfe, side */
15938 0x03, 0x06, 0x05, 0x04
15941 static hda_nid_t alc660_dac_nids[3] = {
15942 /* front, clfe, surround */
15943 0x03, 0x05, 0x06
15946 static hda_nid_t alc861_adc_nids[1] = {
15947 /* ADC0-2 */
15948 0x08,
15951 static struct hda_input_mux alc861_capture_source = {
15952 .num_items = 5,
15953 .items = {
15954 { "Mic", 0x0 },
15955 { "Front Mic", 0x3 },
15956 { "Line", 0x1 },
15957 { "CD", 0x4 },
15958 { "Mixer", 0x5 },
15962 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15964 struct alc_spec *spec = codec->spec;
15965 hda_nid_t mix, srcs[5];
15966 int i, j, num;
15968 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15969 return 0;
15970 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15971 if (num < 0)
15972 return 0;
15973 for (i = 0; i < num; i++) {
15974 unsigned int type;
15975 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15976 if (type != AC_WID_AUD_OUT)
15977 continue;
15978 for (j = 0; j < spec->multiout.num_dacs; j++)
15979 if (spec->multiout.dac_nids[j] == srcs[i])
15980 break;
15981 if (j >= spec->multiout.num_dacs)
15982 return srcs[i];
15984 return 0;
15987 /* fill in the dac_nids table from the parsed pin configuration */
15988 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15989 const struct auto_pin_cfg *cfg)
15991 struct alc_spec *spec = codec->spec;
15992 int i;
15993 hda_nid_t nid, dac;
15995 spec->multiout.dac_nids = spec->private_dac_nids;
15996 for (i = 0; i < cfg->line_outs; i++) {
15997 nid = cfg->line_out_pins[i];
15998 dac = alc861_look_for_dac(codec, nid);
15999 if (!dac)
16000 continue;
16001 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
16003 return 0;
16006 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
16007 hda_nid_t nid, int idx, unsigned int chs)
16009 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
16010 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
16013 #define alc861_create_out_sw(codec, pfx, nid, chs) \
16014 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
16016 /* add playback controls from the parsed DAC table */
16017 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
16018 const struct auto_pin_cfg *cfg)
16020 struct alc_spec *spec = codec->spec;
16021 static const char * const chname[4] = {
16022 "Front", "Surround", NULL /*CLFE*/, "Side"
16024 const char *pfx = alc_get_line_out_pfx(cfg, true);
16025 hda_nid_t nid;
16026 int i, err;
16028 for (i = 0; i < cfg->line_outs; i++) {
16029 nid = spec->multiout.dac_nids[i];
16030 if (!nid)
16031 continue;
16032 if (!pfx && i == 2) {
16033 /* Center/LFE */
16034 err = alc861_create_out_sw(codec, "Center", nid, 1);
16035 if (err < 0)
16036 return err;
16037 err = alc861_create_out_sw(codec, "LFE", nid, 2);
16038 if (err < 0)
16039 return err;
16040 } else {
16041 const char *name = pfx;
16042 int index = i;
16043 if (!name) {
16044 name = chname[i];
16045 index = 0;
16047 err = __alc861_create_out_sw(codec, name, nid, index, 3);
16048 if (err < 0)
16049 return err;
16052 return 0;
16055 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
16057 struct alc_spec *spec = codec->spec;
16058 int err;
16059 hda_nid_t nid;
16061 if (!pin)
16062 return 0;
16064 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
16065 nid = alc861_look_for_dac(codec, pin);
16066 if (nid) {
16067 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
16068 if (err < 0)
16069 return err;
16070 spec->multiout.hp_nid = nid;
16073 return 0;
16076 /* create playback/capture controls for input pins */
16077 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
16078 const struct auto_pin_cfg *cfg)
16080 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
16083 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
16084 hda_nid_t nid,
16085 int pin_type, hda_nid_t dac)
16087 hda_nid_t mix, srcs[5];
16088 int i, num;
16090 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
16091 pin_type);
16092 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16093 AMP_OUT_UNMUTE);
16094 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
16095 return;
16096 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16097 if (num < 0)
16098 return;
16099 for (i = 0; i < num; i++) {
16100 unsigned int mute;
16101 if (srcs[i] == dac || srcs[i] == 0x15)
16102 mute = AMP_IN_UNMUTE(i);
16103 else
16104 mute = AMP_IN_MUTE(i);
16105 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16106 mute);
16110 static void alc861_auto_init_multi_out(struct hda_codec *codec)
16112 struct alc_spec *spec = codec->spec;
16113 int i;
16115 for (i = 0; i < spec->autocfg.line_outs; i++) {
16116 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16117 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16118 if (nid)
16119 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
16120 spec->multiout.dac_nids[i]);
16124 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16126 struct alc_spec *spec = codec->spec;
16128 if (spec->autocfg.hp_outs)
16129 alc861_auto_set_output_and_unmute(codec,
16130 spec->autocfg.hp_pins[0],
16131 PIN_HP,
16132 spec->multiout.hp_nid);
16133 if (spec->autocfg.speaker_outs)
16134 alc861_auto_set_output_and_unmute(codec,
16135 spec->autocfg.speaker_pins[0],
16136 PIN_OUT,
16137 spec->multiout.dac_nids[0]);
16140 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16142 struct alc_spec *spec = codec->spec;
16143 struct auto_pin_cfg *cfg = &spec->autocfg;
16144 int i;
16146 for (i = 0; i < cfg->num_inputs; i++) {
16147 hda_nid_t nid = cfg->inputs[i].pin;
16148 if (nid >= 0x0c && nid <= 0x11)
16149 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16153 /* parse the BIOS configuration and set up the alc_spec */
16154 /* return 1 if successful, 0 if the proper config is not found,
16155 * or a negative error code
16157 static int alc861_parse_auto_config(struct hda_codec *codec)
16159 struct alc_spec *spec = codec->spec;
16160 int err;
16161 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16163 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16164 alc861_ignore);
16165 if (err < 0)
16166 return err;
16167 if (!spec->autocfg.line_outs)
16168 return 0; /* can't find valid BIOS pin config */
16170 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16171 if (err < 0)
16172 return err;
16173 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16174 if (err < 0)
16175 return err;
16176 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16177 if (err < 0)
16178 return err;
16179 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16180 if (err < 0)
16181 return err;
16183 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16185 alc_auto_parse_digital(codec);
16187 if (spec->kctls.list)
16188 add_mixer(spec, spec->kctls.list);
16190 add_verb(spec, alc861_auto_init_verbs);
16192 spec->num_mux_defs = 1;
16193 spec->input_mux = &spec->private_imux[0];
16195 spec->adc_nids = alc861_adc_nids;
16196 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16197 set_capture_mixer(codec);
16199 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16201 return 1;
16204 /* additional initialization for auto-configuration model */
16205 static void alc861_auto_init(struct hda_codec *codec)
16207 struct alc_spec *spec = codec->spec;
16208 alc861_auto_init_multi_out(codec);
16209 alc861_auto_init_hp_out(codec);
16210 alc861_auto_init_analog_input(codec);
16211 alc_auto_init_digital(codec);
16212 if (spec->unsol_event)
16213 alc_inithook(codec);
16216 #ifdef CONFIG_SND_HDA_POWER_SAVE
16217 static struct hda_amp_list alc861_loopbacks[] = {
16218 { 0x15, HDA_INPUT, 0 },
16219 { 0x15, HDA_INPUT, 1 },
16220 { 0x15, HDA_INPUT, 2 },
16221 { 0x15, HDA_INPUT, 3 },
16222 { } /* end */
16224 #endif
16228 * configuration and preset
16230 static const char * const alc861_models[ALC861_MODEL_LAST] = {
16231 [ALC861_3ST] = "3stack",
16232 [ALC660_3ST] = "3stack-660",
16233 [ALC861_3ST_DIG] = "3stack-dig",
16234 [ALC861_6ST_DIG] = "6stack-dig",
16235 [ALC861_UNIWILL_M31] = "uniwill-m31",
16236 [ALC861_TOSHIBA] = "toshiba",
16237 [ALC861_ASUS] = "asus",
16238 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16239 [ALC861_AUTO] = "auto",
16242 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16243 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16244 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16245 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16246 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16247 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16248 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16249 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16250 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16251 * Any other models that need this preset?
16253 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16254 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16255 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16256 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16257 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16258 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16259 /* FIXME: the below seems conflict */
16260 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16261 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16262 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16266 static struct alc_config_preset alc861_presets[] = {
16267 [ALC861_3ST] = {
16268 .mixers = { alc861_3ST_mixer },
16269 .init_verbs = { alc861_threestack_init_verbs },
16270 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16271 .dac_nids = alc861_dac_nids,
16272 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16273 .channel_mode = alc861_threestack_modes,
16274 .need_dac_fix = 1,
16275 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16276 .adc_nids = alc861_adc_nids,
16277 .input_mux = &alc861_capture_source,
16279 [ALC861_3ST_DIG] = {
16280 .mixers = { alc861_base_mixer },
16281 .init_verbs = { alc861_threestack_init_verbs },
16282 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16283 .dac_nids = alc861_dac_nids,
16284 .dig_out_nid = ALC861_DIGOUT_NID,
16285 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16286 .channel_mode = alc861_threestack_modes,
16287 .need_dac_fix = 1,
16288 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16289 .adc_nids = alc861_adc_nids,
16290 .input_mux = &alc861_capture_source,
16292 [ALC861_6ST_DIG] = {
16293 .mixers = { alc861_base_mixer },
16294 .init_verbs = { alc861_base_init_verbs },
16295 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16296 .dac_nids = alc861_dac_nids,
16297 .dig_out_nid = ALC861_DIGOUT_NID,
16298 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16299 .channel_mode = alc861_8ch_modes,
16300 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16301 .adc_nids = alc861_adc_nids,
16302 .input_mux = &alc861_capture_source,
16304 [ALC660_3ST] = {
16305 .mixers = { alc861_3ST_mixer },
16306 .init_verbs = { alc861_threestack_init_verbs },
16307 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16308 .dac_nids = alc660_dac_nids,
16309 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16310 .channel_mode = alc861_threestack_modes,
16311 .need_dac_fix = 1,
16312 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16313 .adc_nids = alc861_adc_nids,
16314 .input_mux = &alc861_capture_source,
16316 [ALC861_UNIWILL_M31] = {
16317 .mixers = { alc861_uniwill_m31_mixer },
16318 .init_verbs = { alc861_uniwill_m31_init_verbs },
16319 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16320 .dac_nids = alc861_dac_nids,
16321 .dig_out_nid = ALC861_DIGOUT_NID,
16322 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16323 .channel_mode = alc861_uniwill_m31_modes,
16324 .need_dac_fix = 1,
16325 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16326 .adc_nids = alc861_adc_nids,
16327 .input_mux = &alc861_capture_source,
16329 [ALC861_TOSHIBA] = {
16330 .mixers = { alc861_toshiba_mixer },
16331 .init_verbs = { alc861_base_init_verbs,
16332 alc861_toshiba_init_verbs },
16333 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16334 .dac_nids = alc861_dac_nids,
16335 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16336 .channel_mode = alc883_3ST_2ch_modes,
16337 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16338 .adc_nids = alc861_adc_nids,
16339 .input_mux = &alc861_capture_source,
16340 .unsol_event = alc861_toshiba_unsol_event,
16341 .init_hook = alc861_toshiba_automute,
16343 [ALC861_ASUS] = {
16344 .mixers = { alc861_asus_mixer },
16345 .init_verbs = { alc861_asus_init_verbs },
16346 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16347 .dac_nids = alc861_dac_nids,
16348 .dig_out_nid = ALC861_DIGOUT_NID,
16349 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16350 .channel_mode = alc861_asus_modes,
16351 .need_dac_fix = 1,
16352 .hp_nid = 0x06,
16353 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16354 .adc_nids = alc861_adc_nids,
16355 .input_mux = &alc861_capture_source,
16357 [ALC861_ASUS_LAPTOP] = {
16358 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16359 .init_verbs = { alc861_asus_init_verbs,
16360 alc861_asus_laptop_init_verbs },
16361 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16362 .dac_nids = alc861_dac_nids,
16363 .dig_out_nid = ALC861_DIGOUT_NID,
16364 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16365 .channel_mode = alc883_3ST_2ch_modes,
16366 .need_dac_fix = 1,
16367 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16368 .adc_nids = alc861_adc_nids,
16369 .input_mux = &alc861_capture_source,
16373 /* Pin config fixes */
16374 enum {
16375 PINFIX_FSC_AMILO_PI1505,
16378 static const struct alc_fixup alc861_fixups[] = {
16379 [PINFIX_FSC_AMILO_PI1505] = {
16380 .type = ALC_FIXUP_PINS,
16381 .v.pins = (const struct alc_pincfg[]) {
16382 { 0x0b, 0x0221101f }, /* HP */
16383 { 0x0f, 0x90170310 }, /* speaker */
16389 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16390 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16394 static int patch_alc861(struct hda_codec *codec)
16396 struct alc_spec *spec;
16397 int board_config;
16398 int err;
16400 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16401 if (spec == NULL)
16402 return -ENOMEM;
16404 codec->spec = spec;
16406 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16407 alc861_models,
16408 alc861_cfg_tbl);
16410 if (board_config < 0) {
16411 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16412 codec->chip_name);
16413 board_config = ALC861_AUTO;
16416 if (board_config == ALC861_AUTO) {
16417 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16418 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16421 if (board_config == ALC861_AUTO) {
16422 /* automatic parse from the BIOS config */
16423 err = alc861_parse_auto_config(codec);
16424 if (err < 0) {
16425 alc_free(codec);
16426 return err;
16427 } else if (!err) {
16428 printk(KERN_INFO
16429 "hda_codec: Cannot set up configuration "
16430 "from BIOS. Using base mode...\n");
16431 board_config = ALC861_3ST_DIG;
16435 err = snd_hda_attach_beep_device(codec, 0x23);
16436 if (err < 0) {
16437 alc_free(codec);
16438 return err;
16441 if (board_config != ALC861_AUTO)
16442 setup_preset(codec, &alc861_presets[board_config]);
16444 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16445 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16447 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16448 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16450 if (!spec->cap_mixer)
16451 set_capture_mixer(codec);
16452 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16454 spec->vmaster_nid = 0x03;
16456 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16458 codec->patch_ops = alc_patch_ops;
16459 if (board_config == ALC861_AUTO) {
16460 spec->init_hook = alc861_auto_init;
16461 #ifdef CONFIG_SND_HDA_POWER_SAVE
16462 spec->power_hook = alc_power_eapd;
16463 #endif
16465 #ifdef CONFIG_SND_HDA_POWER_SAVE
16466 if (!spec->loopback.amplist)
16467 spec->loopback.amplist = alc861_loopbacks;
16468 #endif
16470 return 0;
16474 * ALC861-VD support
16476 * Based on ALC882
16478 * In addition, an independent DAC
16480 #define ALC861VD_DIGOUT_NID 0x06
16482 static hda_nid_t alc861vd_dac_nids[4] = {
16483 /* front, surr, clfe, side surr */
16484 0x02, 0x03, 0x04, 0x05
16487 /* dac_nids for ALC660vd are in a different order - according to
16488 * Realtek's driver.
16489 * This should probably result in a different mixer for 6stack models
16490 * of ALC660vd codecs, but for now there is only 3stack mixer
16491 * - and it is the same as in 861vd.
16492 * adc_nids in ALC660vd are (is) the same as in 861vd
16494 static hda_nid_t alc660vd_dac_nids[3] = {
16495 /* front, rear, clfe, rear_surr */
16496 0x02, 0x04, 0x03
16499 static hda_nid_t alc861vd_adc_nids[1] = {
16500 /* ADC0 */
16501 0x09,
16504 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16506 /* input MUX */
16507 /* FIXME: should be a matrix-type input source selection */
16508 static struct hda_input_mux alc861vd_capture_source = {
16509 .num_items = 4,
16510 .items = {
16511 { "Mic", 0x0 },
16512 { "Front Mic", 0x1 },
16513 { "Line", 0x2 },
16514 { "CD", 0x4 },
16518 static struct hda_input_mux alc861vd_dallas_capture_source = {
16519 .num_items = 2,
16520 .items = {
16521 { "Mic", 0x0 },
16522 { "Internal Mic", 0x1 },
16526 static struct hda_input_mux alc861vd_hp_capture_source = {
16527 .num_items = 2,
16528 .items = {
16529 { "Front Mic", 0x0 },
16530 { "ATAPI Mic", 0x1 },
16535 * 2ch mode
16537 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16538 { 2, NULL }
16542 * 6ch mode
16544 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16545 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16546 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16547 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16548 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16549 { } /* end */
16553 * 8ch mode
16555 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16556 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16557 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16558 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16559 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16560 { } /* end */
16563 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16564 { 6, alc861vd_6stack_ch6_init },
16565 { 8, alc861vd_6stack_ch8_init },
16568 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16570 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16571 .name = "Channel Mode",
16572 .info = alc_ch_mode_info,
16573 .get = alc_ch_mode_get,
16574 .put = alc_ch_mode_put,
16576 { } /* end */
16579 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16580 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16582 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16583 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16584 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16586 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16587 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16589 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16590 HDA_OUTPUT),
16591 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16592 HDA_OUTPUT),
16593 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16594 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16596 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16597 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16599 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16601 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16602 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16603 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16605 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16606 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16607 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16609 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16610 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16612 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16613 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16615 { } /* end */
16618 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16619 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16620 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16622 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16624 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16625 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16626 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16628 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16629 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16630 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16632 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16633 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16635 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16636 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16638 { } /* end */
16641 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16642 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16643 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16644 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16646 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16648 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16649 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16650 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16652 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16653 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16654 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16656 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16657 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16659 { } /* end */
16662 /* Pin assignment: Speaker=0x14, HP = 0x15,
16663 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16665 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16666 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16667 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16668 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16669 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16670 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16673 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16674 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16675 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16676 { } /* end */
16679 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16680 * Front Mic=0x18, ATAPI Mic = 0x19,
16682 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16683 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16684 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16685 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16686 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16687 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16688 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16689 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16690 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16692 { } /* end */
16696 * generic initialization of ADC, input mixers and output mixers
16698 static struct hda_verb alc861vd_volume_init_verbs[] = {
16700 * Unmute ADC0 and set the default input to mic-in
16702 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16703 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16705 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16706 * the analog-loopback mixer widget
16708 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16709 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16710 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16715 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16717 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16719 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16722 * Set up output mixers (0x02 - 0x05)
16724 /* set vol=0 to output mixers */
16725 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16726 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16727 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16728 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16730 /* set up input amps for analog loopback */
16731 /* Amp Indices: DAC = 0, mixer = 1 */
16732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16734 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16735 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16736 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16737 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16738 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16739 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16745 * 3-stack pin configuration:
16746 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16748 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16750 * Set pin mode and muting
16752 /* set front pin widgets 0x14 for output */
16753 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16755 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16757 /* Mic (rear) pin: input vref at 80% */
16758 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16759 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16760 /* Front Mic pin: input vref at 80% */
16761 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16762 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16763 /* Line In pin: input */
16764 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16765 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16766 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16767 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16768 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16769 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16770 /* CD pin widget for input */
16771 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16777 * 6-stack pin configuration:
16779 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16781 * Set pin mode and muting
16783 /* set front pin widgets 0x14 for output */
16784 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16785 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16786 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16788 /* Rear Pin: output 1 (0x0d) */
16789 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16790 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16791 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16792 /* CLFE Pin: output 2 (0x0e) */
16793 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16794 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16795 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16796 /* Side Pin: output 3 (0x0f) */
16797 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16798 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16799 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16801 /* Mic (rear) pin: input vref at 80% */
16802 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16803 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16804 /* Front Mic pin: input vref at 80% */
16805 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16806 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16807 /* Line In pin: input */
16808 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16809 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16810 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16811 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16812 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16813 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16814 /* CD pin widget for input */
16815 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16820 static struct hda_verb alc861vd_eapd_verbs[] = {
16821 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16825 static struct hda_verb alc660vd_eapd_verbs[] = {
16826 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16827 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16831 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16832 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16833 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16835 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16836 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16840 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16842 struct alc_spec *spec = codec->spec;
16843 spec->autocfg.hp_pins[0] = 0x1b;
16844 spec->autocfg.speaker_pins[0] = 0x14;
16847 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16849 alc_automute_amp(codec);
16850 alc88x_simple_mic_automute(codec);
16853 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16854 unsigned int res)
16856 switch (res >> 26) {
16857 case ALC880_MIC_EVENT:
16858 alc88x_simple_mic_automute(codec);
16859 break;
16860 default:
16861 alc_automute_amp_unsol_event(codec, res);
16862 break;
16866 static struct hda_verb alc861vd_dallas_verbs[] = {
16867 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16868 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16869 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16870 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16872 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16873 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16874 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16875 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16876 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16877 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16878 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16879 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16881 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16882 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16883 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16884 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16885 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16886 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16887 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16888 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16890 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16891 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16892 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16893 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16894 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16895 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16896 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16897 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16899 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16900 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16901 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16902 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16904 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16905 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16906 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16908 { } /* end */
16911 /* toggle speaker-output according to the hp-jack state */
16912 static void alc861vd_dallas_setup(struct hda_codec *codec)
16914 struct alc_spec *spec = codec->spec;
16916 spec->autocfg.hp_pins[0] = 0x15;
16917 spec->autocfg.speaker_pins[0] = 0x14;
16920 #ifdef CONFIG_SND_HDA_POWER_SAVE
16921 #define alc861vd_loopbacks alc880_loopbacks
16922 #endif
16924 /* pcm configuration: identical with ALC880 */
16925 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16926 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16927 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16928 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16931 * configuration and preset
16933 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16934 [ALC660VD_3ST] = "3stack-660",
16935 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16936 [ALC660VD_ASUS_V1S] = "asus-v1s",
16937 [ALC861VD_3ST] = "3stack",
16938 [ALC861VD_3ST_DIG] = "3stack-digout",
16939 [ALC861VD_6ST_DIG] = "6stack-digout",
16940 [ALC861VD_LENOVO] = "lenovo",
16941 [ALC861VD_DALLAS] = "dallas",
16942 [ALC861VD_HP] = "hp",
16943 [ALC861VD_AUTO] = "auto",
16946 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16947 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16948 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16949 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16950 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16951 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16952 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16953 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16954 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16955 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16956 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16957 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16958 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16959 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16960 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16961 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16965 static struct alc_config_preset alc861vd_presets[] = {
16966 [ALC660VD_3ST] = {
16967 .mixers = { alc861vd_3st_mixer },
16968 .init_verbs = { alc861vd_volume_init_verbs,
16969 alc861vd_3stack_init_verbs },
16970 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16971 .dac_nids = alc660vd_dac_nids,
16972 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16973 .channel_mode = alc861vd_3stack_2ch_modes,
16974 .input_mux = &alc861vd_capture_source,
16976 [ALC660VD_3ST_DIG] = {
16977 .mixers = { alc861vd_3st_mixer },
16978 .init_verbs = { alc861vd_volume_init_verbs,
16979 alc861vd_3stack_init_verbs },
16980 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16981 .dac_nids = alc660vd_dac_nids,
16982 .dig_out_nid = ALC861VD_DIGOUT_NID,
16983 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16984 .channel_mode = alc861vd_3stack_2ch_modes,
16985 .input_mux = &alc861vd_capture_source,
16987 [ALC861VD_3ST] = {
16988 .mixers = { alc861vd_3st_mixer },
16989 .init_verbs = { alc861vd_volume_init_verbs,
16990 alc861vd_3stack_init_verbs },
16991 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16992 .dac_nids = alc861vd_dac_nids,
16993 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16994 .channel_mode = alc861vd_3stack_2ch_modes,
16995 .input_mux = &alc861vd_capture_source,
16997 [ALC861VD_3ST_DIG] = {
16998 .mixers = { alc861vd_3st_mixer },
16999 .init_verbs = { alc861vd_volume_init_verbs,
17000 alc861vd_3stack_init_verbs },
17001 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17002 .dac_nids = alc861vd_dac_nids,
17003 .dig_out_nid = ALC861VD_DIGOUT_NID,
17004 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17005 .channel_mode = alc861vd_3stack_2ch_modes,
17006 .input_mux = &alc861vd_capture_source,
17008 [ALC861VD_6ST_DIG] = {
17009 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
17010 .init_verbs = { alc861vd_volume_init_verbs,
17011 alc861vd_6stack_init_verbs },
17012 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17013 .dac_nids = alc861vd_dac_nids,
17014 .dig_out_nid = ALC861VD_DIGOUT_NID,
17015 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
17016 .channel_mode = alc861vd_6stack_modes,
17017 .input_mux = &alc861vd_capture_source,
17019 [ALC861VD_LENOVO] = {
17020 .mixers = { alc861vd_lenovo_mixer },
17021 .init_verbs = { alc861vd_volume_init_verbs,
17022 alc861vd_3stack_init_verbs,
17023 alc861vd_eapd_verbs,
17024 alc861vd_lenovo_unsol_verbs },
17025 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17026 .dac_nids = alc660vd_dac_nids,
17027 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17028 .channel_mode = alc861vd_3stack_2ch_modes,
17029 .input_mux = &alc861vd_capture_source,
17030 .unsol_event = alc861vd_lenovo_unsol_event,
17031 .setup = alc861vd_lenovo_setup,
17032 .init_hook = alc861vd_lenovo_init_hook,
17034 [ALC861VD_DALLAS] = {
17035 .mixers = { alc861vd_dallas_mixer },
17036 .init_verbs = { alc861vd_dallas_verbs },
17037 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17038 .dac_nids = alc861vd_dac_nids,
17039 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17040 .channel_mode = alc861vd_3stack_2ch_modes,
17041 .input_mux = &alc861vd_dallas_capture_source,
17042 .unsol_event = alc_automute_amp_unsol_event,
17043 .setup = alc861vd_dallas_setup,
17044 .init_hook = alc_automute_amp,
17046 [ALC861VD_HP] = {
17047 .mixers = { alc861vd_hp_mixer },
17048 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
17049 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17050 .dac_nids = alc861vd_dac_nids,
17051 .dig_out_nid = ALC861VD_DIGOUT_NID,
17052 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17053 .channel_mode = alc861vd_3stack_2ch_modes,
17054 .input_mux = &alc861vd_hp_capture_source,
17055 .unsol_event = alc_automute_amp_unsol_event,
17056 .setup = alc861vd_dallas_setup,
17057 .init_hook = alc_automute_amp,
17059 [ALC660VD_ASUS_V1S] = {
17060 .mixers = { alc861vd_lenovo_mixer },
17061 .init_verbs = { alc861vd_volume_init_verbs,
17062 alc861vd_3stack_init_verbs,
17063 alc861vd_eapd_verbs,
17064 alc861vd_lenovo_unsol_verbs },
17065 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17066 .dac_nids = alc660vd_dac_nids,
17067 .dig_out_nid = ALC861VD_DIGOUT_NID,
17068 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17069 .channel_mode = alc861vd_3stack_2ch_modes,
17070 .input_mux = &alc861vd_capture_source,
17071 .unsol_event = alc861vd_lenovo_unsol_event,
17072 .setup = alc861vd_lenovo_setup,
17073 .init_hook = alc861vd_lenovo_init_hook,
17078 * BIOS auto configuration
17080 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
17081 const struct auto_pin_cfg *cfg)
17083 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
17087 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
17088 hda_nid_t nid, int pin_type, int dac_idx)
17090 alc_set_pin_output(codec, nid, pin_type);
17093 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
17095 struct alc_spec *spec = codec->spec;
17096 int i;
17098 for (i = 0; i <= HDA_SIDE; i++) {
17099 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17100 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17101 if (nid)
17102 alc861vd_auto_set_output_and_unmute(codec, nid,
17103 pin_type, i);
17108 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
17110 struct alc_spec *spec = codec->spec;
17111 hda_nid_t pin;
17113 pin = spec->autocfg.hp_pins[0];
17114 if (pin) /* connect to front and use dac 0 */
17115 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17116 pin = spec->autocfg.speaker_pins[0];
17117 if (pin)
17118 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17121 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17123 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17125 struct alc_spec *spec = codec->spec;
17126 struct auto_pin_cfg *cfg = &spec->autocfg;
17127 int i;
17129 for (i = 0; i < cfg->num_inputs; i++) {
17130 hda_nid_t nid = cfg->inputs[i].pin;
17131 if (alc_is_input_pin(codec, nid)) {
17132 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17133 if (nid != ALC861VD_PIN_CD_NID &&
17134 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17135 snd_hda_codec_write(codec, nid, 0,
17136 AC_VERB_SET_AMP_GAIN_MUTE,
17137 AMP_OUT_MUTE);
17142 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17144 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17145 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17147 /* add playback controls from the parsed DAC table */
17148 /* Based on ALC880 version. But ALC861VD has separate,
17149 * different NIDs for mute/unmute switch and volume control */
17150 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17151 const struct auto_pin_cfg *cfg)
17153 static const char * const chname[4] = {
17154 "Front", "Surround", "CLFE", "Side"
17156 const char *pfx = alc_get_line_out_pfx(cfg, true);
17157 hda_nid_t nid_v, nid_s;
17158 int i, err;
17160 for (i = 0; i < cfg->line_outs; i++) {
17161 if (!spec->multiout.dac_nids[i])
17162 continue;
17163 nid_v = alc861vd_idx_to_mixer_vol(
17164 alc880_dac_to_idx(
17165 spec->multiout.dac_nids[i]));
17166 nid_s = alc861vd_idx_to_mixer_switch(
17167 alc880_dac_to_idx(
17168 spec->multiout.dac_nids[i]));
17170 if (!pfx && i == 2) {
17171 /* Center/LFE */
17172 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17173 "Center",
17174 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17175 HDA_OUTPUT));
17176 if (err < 0)
17177 return err;
17178 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17179 "LFE",
17180 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17181 HDA_OUTPUT));
17182 if (err < 0)
17183 return err;
17184 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17185 "Center",
17186 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17187 HDA_INPUT));
17188 if (err < 0)
17189 return err;
17190 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17191 "LFE",
17192 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17193 HDA_INPUT));
17194 if (err < 0)
17195 return err;
17196 } else {
17197 const char *name = pfx;
17198 int index = i;
17199 if (!name) {
17200 name = chname[i];
17201 index = 0;
17203 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17204 name, index,
17205 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17206 HDA_OUTPUT));
17207 if (err < 0)
17208 return err;
17209 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17210 name, index,
17211 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17212 HDA_INPUT));
17213 if (err < 0)
17214 return err;
17217 return 0;
17220 /* add playback controls for speaker and HP outputs */
17221 /* Based on ALC880 version. But ALC861VD has separate,
17222 * different NIDs for mute/unmute switch and volume control */
17223 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17224 hda_nid_t pin, const char *pfx)
17226 hda_nid_t nid_v, nid_s;
17227 int err;
17229 if (!pin)
17230 return 0;
17232 if (alc880_is_fixed_pin(pin)) {
17233 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17234 /* specify the DAC as the extra output */
17235 if (!spec->multiout.hp_nid)
17236 spec->multiout.hp_nid = nid_v;
17237 else
17238 spec->multiout.extra_out_nid[0] = nid_v;
17239 /* control HP volume/switch on the output mixer amp */
17240 nid_v = alc861vd_idx_to_mixer_vol(
17241 alc880_fixed_pin_idx(pin));
17242 nid_s = alc861vd_idx_to_mixer_switch(
17243 alc880_fixed_pin_idx(pin));
17245 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17246 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17247 if (err < 0)
17248 return err;
17249 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17250 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17251 if (err < 0)
17252 return err;
17253 } else if (alc880_is_multi_pin(pin)) {
17254 /* set manual connection */
17255 /* we have only a switch on HP-out PIN */
17256 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17257 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17258 if (err < 0)
17259 return err;
17261 return 0;
17264 /* parse the BIOS configuration and set up the alc_spec
17265 * return 1 if successful, 0 if the proper config is not found,
17266 * or a negative error code
17267 * Based on ALC880 version - had to change it to override
17268 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17269 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17271 struct alc_spec *spec = codec->spec;
17272 int err;
17273 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17275 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17276 alc861vd_ignore);
17277 if (err < 0)
17278 return err;
17279 if (!spec->autocfg.line_outs)
17280 return 0; /* can't find valid BIOS pin config */
17282 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17283 if (err < 0)
17284 return err;
17285 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17286 if (err < 0)
17287 return err;
17288 err = alc861vd_auto_create_extra_out(spec,
17289 spec->autocfg.speaker_pins[0],
17290 "Speaker");
17291 if (err < 0)
17292 return err;
17293 err = alc861vd_auto_create_extra_out(spec,
17294 spec->autocfg.hp_pins[0],
17295 "Headphone");
17296 if (err < 0)
17297 return err;
17298 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17299 if (err < 0)
17300 return err;
17302 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17304 alc_auto_parse_digital(codec);
17306 if (spec->kctls.list)
17307 add_mixer(spec, spec->kctls.list);
17309 add_verb(spec, alc861vd_volume_init_verbs);
17311 spec->num_mux_defs = 1;
17312 spec->input_mux = &spec->private_imux[0];
17314 err = alc_auto_add_mic_boost(codec);
17315 if (err < 0)
17316 return err;
17318 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17320 return 1;
17323 /* additional initialization for auto-configuration model */
17324 static void alc861vd_auto_init(struct hda_codec *codec)
17326 struct alc_spec *spec = codec->spec;
17327 alc861vd_auto_init_multi_out(codec);
17328 alc861vd_auto_init_hp_out(codec);
17329 alc861vd_auto_init_analog_input(codec);
17330 alc861vd_auto_init_input_src(codec);
17331 alc_auto_init_digital(codec);
17332 if (spec->unsol_event)
17333 alc_inithook(codec);
17336 enum {
17337 ALC660VD_FIX_ASUS_GPIO1
17340 /* reset GPIO1 */
17341 static const struct alc_fixup alc861vd_fixups[] = {
17342 [ALC660VD_FIX_ASUS_GPIO1] = {
17343 .type = ALC_FIXUP_VERBS,
17344 .v.verbs = (const struct hda_verb[]) {
17345 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17346 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17347 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17353 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17354 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17358 static int patch_alc861vd(struct hda_codec *codec)
17360 struct alc_spec *spec;
17361 int err, board_config;
17363 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17364 if (spec == NULL)
17365 return -ENOMEM;
17367 codec->spec = spec;
17369 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17370 alc861vd_models,
17371 alc861vd_cfg_tbl);
17373 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17374 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17375 codec->chip_name);
17376 board_config = ALC861VD_AUTO;
17379 if (board_config == ALC861VD_AUTO) {
17380 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17381 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17384 if (board_config == ALC861VD_AUTO) {
17385 /* automatic parse from the BIOS config */
17386 err = alc861vd_parse_auto_config(codec);
17387 if (err < 0) {
17388 alc_free(codec);
17389 return err;
17390 } else if (!err) {
17391 printk(KERN_INFO
17392 "hda_codec: Cannot set up configuration "
17393 "from BIOS. Using base mode...\n");
17394 board_config = ALC861VD_3ST;
17398 err = snd_hda_attach_beep_device(codec, 0x23);
17399 if (err < 0) {
17400 alc_free(codec);
17401 return err;
17404 if (board_config != ALC861VD_AUTO)
17405 setup_preset(codec, &alc861vd_presets[board_config]);
17407 if (codec->vendor_id == 0x10ec0660) {
17408 /* always turn on EAPD */
17409 add_verb(spec, alc660vd_eapd_verbs);
17412 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17413 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17415 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17416 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17418 if (!spec->adc_nids) {
17419 spec->adc_nids = alc861vd_adc_nids;
17420 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17422 if (!spec->capsrc_nids)
17423 spec->capsrc_nids = alc861vd_capsrc_nids;
17425 set_capture_mixer(codec);
17426 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17428 spec->vmaster_nid = 0x02;
17430 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17432 codec->patch_ops = alc_patch_ops;
17434 if (board_config == ALC861VD_AUTO)
17435 spec->init_hook = alc861vd_auto_init;
17436 #ifdef CONFIG_SND_HDA_POWER_SAVE
17437 if (!spec->loopback.amplist)
17438 spec->loopback.amplist = alc861vd_loopbacks;
17439 #endif
17441 return 0;
17445 * ALC662 support
17447 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17448 * configuration. Each pin widget can choose any input DACs and a mixer.
17449 * Each ADC is connected from a mixer of all inputs. This makes possible
17450 * 6-channel independent captures.
17452 * In addition, an independent DAC for the multi-playback (not used in this
17453 * driver yet).
17455 #define ALC662_DIGOUT_NID 0x06
17456 #define ALC662_DIGIN_NID 0x0a
17458 static hda_nid_t alc662_dac_nids[4] = {
17459 /* front, rear, clfe, rear_surr */
17460 0x02, 0x03, 0x04
17463 static hda_nid_t alc272_dac_nids[2] = {
17464 0x02, 0x03
17467 static hda_nid_t alc662_adc_nids[2] = {
17468 /* ADC1-2 */
17469 0x09, 0x08
17472 static hda_nid_t alc272_adc_nids[1] = {
17473 /* ADC1-2 */
17474 0x08,
17477 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17478 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17481 /* input MUX */
17482 /* FIXME: should be a matrix-type input source selection */
17483 static struct hda_input_mux alc662_capture_source = {
17484 .num_items = 4,
17485 .items = {
17486 { "Mic", 0x0 },
17487 { "Front Mic", 0x1 },
17488 { "Line", 0x2 },
17489 { "CD", 0x4 },
17493 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17494 .num_items = 2,
17495 .items = {
17496 { "Mic", 0x1 },
17497 { "Line", 0x2 },
17501 static struct hda_input_mux alc663_capture_source = {
17502 .num_items = 3,
17503 .items = {
17504 { "Mic", 0x0 },
17505 { "Front Mic", 0x1 },
17506 { "Line", 0x2 },
17510 #if 0 /* set to 1 for testing other input sources below */
17511 static struct hda_input_mux alc272_nc10_capture_source = {
17512 .num_items = 16,
17513 .items = {
17514 { "Autoselect Mic", 0x0 },
17515 { "Internal Mic", 0x1 },
17516 { "In-0x02", 0x2 },
17517 { "In-0x03", 0x3 },
17518 { "In-0x04", 0x4 },
17519 { "In-0x05", 0x5 },
17520 { "In-0x06", 0x6 },
17521 { "In-0x07", 0x7 },
17522 { "In-0x08", 0x8 },
17523 { "In-0x09", 0x9 },
17524 { "In-0x0a", 0x0a },
17525 { "In-0x0b", 0x0b },
17526 { "In-0x0c", 0x0c },
17527 { "In-0x0d", 0x0d },
17528 { "In-0x0e", 0x0e },
17529 { "In-0x0f", 0x0f },
17532 #endif
17535 * 2ch mode
17537 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17538 { 2, NULL }
17542 * 2ch mode
17544 static struct hda_verb alc662_3ST_ch2_init[] = {
17545 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17546 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17547 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17548 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17549 { } /* end */
17553 * 6ch mode
17555 static struct hda_verb alc662_3ST_ch6_init[] = {
17556 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17557 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17558 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17559 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17560 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17561 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17562 { } /* end */
17565 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17566 { 2, alc662_3ST_ch2_init },
17567 { 6, alc662_3ST_ch6_init },
17571 * 2ch mode
17573 static struct hda_verb alc662_sixstack_ch6_init[] = {
17574 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17575 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17576 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17577 { } /* end */
17581 * 6ch mode
17583 static struct hda_verb alc662_sixstack_ch8_init[] = {
17584 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17585 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17586 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17587 { } /* end */
17590 static struct hda_channel_mode alc662_5stack_modes[2] = {
17591 { 2, alc662_sixstack_ch6_init },
17592 { 6, alc662_sixstack_ch8_init },
17595 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17596 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17599 static struct snd_kcontrol_new alc662_base_mixer[] = {
17600 /* output mixer control */
17601 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17602 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17603 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17604 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17605 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17606 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17607 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17608 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17609 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17611 /*Input mixer control */
17612 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17613 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17614 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17615 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17616 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17617 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17618 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17619 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17620 { } /* end */
17623 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17624 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17625 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17626 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17627 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17628 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17629 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17630 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17632 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17633 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17634 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17635 { } /* end */
17638 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17639 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17640 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17641 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17642 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17643 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17644 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17645 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17646 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17647 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17648 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17649 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17650 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17651 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17652 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17653 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17654 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17655 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17656 { } /* end */
17659 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17660 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17661 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17662 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17663 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17665 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17666 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17668 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17669 { } /* end */
17672 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17673 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17674 ALC262_HIPPO_MASTER_SWITCH,
17676 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17677 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17678 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17680 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17681 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17682 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17683 { } /* end */
17686 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17687 ALC262_HIPPO_MASTER_SWITCH,
17688 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17689 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17690 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17691 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17692 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17693 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17694 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17697 { } /* end */
17700 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17701 .ops = &snd_hda_bind_vol,
17702 .values = {
17703 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17704 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17709 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17710 .ops = &snd_hda_bind_sw,
17711 .values = {
17712 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17713 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17718 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17719 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17720 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17721 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17722 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17723 { } /* end */
17726 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17727 .ops = &snd_hda_bind_sw,
17728 .values = {
17729 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17730 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17731 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17736 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17737 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17738 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17739 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17740 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17741 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17742 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17744 { } /* end */
17747 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17748 .ops = &snd_hda_bind_sw,
17749 .values = {
17750 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17751 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17752 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17757 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17758 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17759 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17762 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17763 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17764 { } /* end */
17767 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17768 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17769 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17770 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17772 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17773 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17774 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17775 { } /* end */
17778 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17779 .ops = &snd_hda_bind_vol,
17780 .values = {
17781 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17782 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17787 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17788 .ops = &snd_hda_bind_sw,
17789 .values = {
17790 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17791 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17796 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17797 HDA_BIND_VOL("Master Playback Volume",
17798 &alc663_asus_two_bind_master_vol),
17799 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17800 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17801 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17802 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17804 { } /* end */
17807 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17808 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17809 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17810 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17811 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17812 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17813 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17814 { } /* end */
17817 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17818 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17819 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17820 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17821 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17822 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17826 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17827 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17828 { } /* end */
17831 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17832 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17833 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17834 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17836 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17837 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17838 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17839 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17840 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17841 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17842 { } /* end */
17845 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17846 .ops = &snd_hda_bind_sw,
17847 .values = {
17848 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17849 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17850 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17851 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17852 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17857 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17858 .ops = &snd_hda_bind_sw,
17859 .values = {
17860 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17861 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17866 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17867 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17868 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17869 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17870 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17871 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17872 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17873 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17874 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17876 { } /* end */
17879 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17880 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17881 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17882 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17883 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17884 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17886 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17887 { } /* end */
17891 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17893 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17894 .name = "Channel Mode",
17895 .info = alc_ch_mode_info,
17896 .get = alc_ch_mode_get,
17897 .put = alc_ch_mode_put,
17899 { } /* end */
17902 static struct hda_verb alc662_init_verbs[] = {
17903 /* ADC: mute amp left and right */
17904 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17905 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17908 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17909 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17911 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17912 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17914 /* Front Pin: output 0 (0x0c) */
17915 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17916 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17918 /* Rear Pin: output 1 (0x0d) */
17919 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17920 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17922 /* CLFE Pin: output 2 (0x0e) */
17923 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17924 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17926 /* Mic (rear) pin: input vref at 80% */
17927 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17928 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17929 /* Front Mic pin: input vref at 80% */
17930 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17931 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17932 /* Line In pin: input */
17933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17934 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17935 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17936 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17937 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17938 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17939 /* CD pin widget for input */
17940 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17942 /* FIXME: use matrix-type input source selection */
17943 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17944 /* Input mixer */
17945 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17946 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17948 /* always trun on EAPD */
17949 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17950 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17955 static struct hda_verb alc663_init_verbs[] = {
17956 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17957 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17958 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17959 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17960 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17961 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17965 static struct hda_verb alc272_init_verbs[] = {
17966 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17967 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17968 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17969 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17970 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17971 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17972 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17973 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17977 static struct hda_verb alc662_sue_init_verbs[] = {
17978 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17979 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17983 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17984 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17985 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17989 /* Set Unsolicited Event*/
17990 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17991 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17992 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17996 static struct hda_verb alc663_m51va_init_verbs[] = {
17997 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17998 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17999 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18000 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18001 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18002 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18003 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18004 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18005 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18009 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
18010 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18011 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18012 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18013 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18014 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18015 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18016 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18020 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
18021 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18022 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18023 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18024 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18025 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18026 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18027 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18028 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18032 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
18033 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18034 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18035 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18038 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18039 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18043 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
18044 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18045 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18046 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18047 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18048 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18049 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18050 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18051 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18053 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18054 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18055 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18059 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
18060 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18061 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18062 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18063 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18064 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18066 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18069 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18070 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18071 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18075 static struct hda_verb alc663_g71v_init_verbs[] = {
18076 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18077 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18078 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
18080 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18081 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18082 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18084 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18085 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
18086 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18090 static struct hda_verb alc663_g50v_init_verbs[] = {
18091 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18092 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18093 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18095 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18096 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18100 static struct hda_verb alc662_ecs_init_verbs[] = {
18101 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
18102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18103 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18104 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18108 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
18109 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18110 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18111 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18112 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18113 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18114 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18115 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18118 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18119 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18123 static struct hda_verb alc272_dell_init_verbs[] = {
18124 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18125 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18126 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18127 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18128 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18129 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18130 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18131 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18132 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18133 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18134 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18138 static struct hda_verb alc663_mode7_init_verbs[] = {
18139 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18140 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18141 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18142 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18143 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18144 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18145 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18146 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18147 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18148 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18149 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18150 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18151 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18152 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18153 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18157 static struct hda_verb alc663_mode8_init_verbs[] = {
18158 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18159 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18160 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18161 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18162 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18163 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18164 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18165 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18166 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18167 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18168 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18169 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18170 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18171 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18172 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18173 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18177 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18178 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18179 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18180 { } /* end */
18183 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18184 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18185 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18186 { } /* end */
18189 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18191 unsigned int present;
18192 unsigned char bits;
18194 present = snd_hda_jack_detect(codec, 0x14);
18195 bits = present ? HDA_AMP_MUTE : 0;
18197 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18198 HDA_AMP_MUTE, bits);
18201 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18203 unsigned int present;
18204 unsigned char bits;
18206 present = snd_hda_jack_detect(codec, 0x1b);
18207 bits = present ? HDA_AMP_MUTE : 0;
18209 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18210 HDA_AMP_MUTE, bits);
18211 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18212 HDA_AMP_MUTE, bits);
18215 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18216 unsigned int res)
18218 if ((res >> 26) == ALC880_HP_EVENT)
18219 alc662_lenovo_101e_all_automute(codec);
18220 if ((res >> 26) == ALC880_FRONT_EVENT)
18221 alc662_lenovo_101e_ispeaker_automute(codec);
18224 /* unsolicited event for HP jack sensing */
18225 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18226 unsigned int res)
18228 if ((res >> 26) == ALC880_MIC_EVENT)
18229 alc_mic_automute(codec);
18230 else
18231 alc262_hippo_unsol_event(codec, res);
18234 static void alc662_eeepc_setup(struct hda_codec *codec)
18236 struct alc_spec *spec = codec->spec;
18238 alc262_hippo1_setup(codec);
18239 spec->ext_mic.pin = 0x18;
18240 spec->ext_mic.mux_idx = 0;
18241 spec->int_mic.pin = 0x19;
18242 spec->int_mic.mux_idx = 1;
18243 spec->auto_mic = 1;
18246 static void alc662_eeepc_inithook(struct hda_codec *codec)
18248 alc262_hippo_automute(codec);
18249 alc_mic_automute(codec);
18252 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18254 struct alc_spec *spec = codec->spec;
18256 spec->autocfg.hp_pins[0] = 0x14;
18257 spec->autocfg.speaker_pins[0] = 0x1b;
18260 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18262 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18264 unsigned int present;
18265 unsigned char bits;
18267 present = snd_hda_jack_detect(codec, 0x21);
18268 bits = present ? HDA_AMP_MUTE : 0;
18269 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18270 HDA_AMP_MUTE, bits);
18271 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18272 HDA_AMP_MUTE, bits);
18275 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18277 unsigned int present;
18278 unsigned char bits;
18280 present = snd_hda_jack_detect(codec, 0x21);
18281 bits = present ? HDA_AMP_MUTE : 0;
18282 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18283 HDA_AMP_MUTE, bits);
18284 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18285 HDA_AMP_MUTE, bits);
18286 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18287 HDA_AMP_MUTE, bits);
18288 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18289 HDA_AMP_MUTE, bits);
18292 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18294 unsigned int present;
18295 unsigned char bits;
18297 present = snd_hda_jack_detect(codec, 0x15);
18298 bits = present ? HDA_AMP_MUTE : 0;
18299 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18300 HDA_AMP_MUTE, bits);
18301 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18302 HDA_AMP_MUTE, bits);
18303 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18304 HDA_AMP_MUTE, bits);
18305 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18306 HDA_AMP_MUTE, bits);
18309 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18311 unsigned int present;
18312 unsigned char bits;
18314 present = snd_hda_jack_detect(codec, 0x1b);
18315 bits = present ? 0 : PIN_OUT;
18316 snd_hda_codec_write(codec, 0x14, 0,
18317 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18320 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18322 unsigned int present1, present2;
18324 present1 = snd_hda_jack_detect(codec, 0x21);
18325 present2 = snd_hda_jack_detect(codec, 0x15);
18327 if (present1 || present2) {
18328 snd_hda_codec_write_cache(codec, 0x14, 0,
18329 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18330 } else {
18331 snd_hda_codec_write_cache(codec, 0x14, 0,
18332 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18336 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18338 unsigned int present1, present2;
18340 present1 = snd_hda_jack_detect(codec, 0x1b);
18341 present2 = snd_hda_jack_detect(codec, 0x15);
18343 if (present1 || present2) {
18344 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18345 HDA_AMP_MUTE, HDA_AMP_MUTE);
18346 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18347 HDA_AMP_MUTE, HDA_AMP_MUTE);
18348 } else {
18349 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18350 HDA_AMP_MUTE, 0);
18351 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18352 HDA_AMP_MUTE, 0);
18356 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18358 unsigned int present1, present2;
18360 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18361 AC_VERB_GET_PIN_SENSE, 0)
18362 & AC_PINSENSE_PRESENCE;
18363 present2 = snd_hda_codec_read(codec, 0x21, 0,
18364 AC_VERB_GET_PIN_SENSE, 0)
18365 & AC_PINSENSE_PRESENCE;
18367 if (present1 || present2) {
18368 snd_hda_codec_write_cache(codec, 0x14, 0,
18369 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18370 snd_hda_codec_write_cache(codec, 0x17, 0,
18371 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18372 } else {
18373 snd_hda_codec_write_cache(codec, 0x14, 0,
18374 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18375 snd_hda_codec_write_cache(codec, 0x17, 0,
18376 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18380 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18382 unsigned int present1, present2;
18384 present1 = snd_hda_codec_read(codec, 0x21, 0,
18385 AC_VERB_GET_PIN_SENSE, 0)
18386 & AC_PINSENSE_PRESENCE;
18387 present2 = snd_hda_codec_read(codec, 0x15, 0,
18388 AC_VERB_GET_PIN_SENSE, 0)
18389 & AC_PINSENSE_PRESENCE;
18391 if (present1 || present2) {
18392 snd_hda_codec_write_cache(codec, 0x14, 0,
18393 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18394 snd_hda_codec_write_cache(codec, 0x17, 0,
18395 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18396 } else {
18397 snd_hda_codec_write_cache(codec, 0x14, 0,
18398 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18399 snd_hda_codec_write_cache(codec, 0x17, 0,
18400 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18404 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18405 unsigned int res)
18407 switch (res >> 26) {
18408 case ALC880_HP_EVENT:
18409 alc663_m51va_speaker_automute(codec);
18410 break;
18411 case ALC880_MIC_EVENT:
18412 alc_mic_automute(codec);
18413 break;
18417 static void alc663_m51va_setup(struct hda_codec *codec)
18419 struct alc_spec *spec = codec->spec;
18420 spec->ext_mic.pin = 0x18;
18421 spec->ext_mic.mux_idx = 0;
18422 spec->int_mic.pin = 0x12;
18423 spec->int_mic.mux_idx = 9;
18424 spec->auto_mic = 1;
18427 static void alc663_m51va_inithook(struct hda_codec *codec)
18429 alc663_m51va_speaker_automute(codec);
18430 alc_mic_automute(codec);
18433 /* ***************** Mode1 ******************************/
18434 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18436 static void alc663_mode1_setup(struct hda_codec *codec)
18438 struct alc_spec *spec = codec->spec;
18439 spec->ext_mic.pin = 0x18;
18440 spec->ext_mic.mux_idx = 0;
18441 spec->int_mic.pin = 0x19;
18442 spec->int_mic.mux_idx = 1;
18443 spec->auto_mic = 1;
18446 #define alc663_mode1_inithook alc663_m51va_inithook
18448 /* ***************** Mode2 ******************************/
18449 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18450 unsigned int res)
18452 switch (res >> 26) {
18453 case ALC880_HP_EVENT:
18454 alc662_f5z_speaker_automute(codec);
18455 break;
18456 case ALC880_MIC_EVENT:
18457 alc_mic_automute(codec);
18458 break;
18462 #define alc662_mode2_setup alc663_mode1_setup
18464 static void alc662_mode2_inithook(struct hda_codec *codec)
18466 alc662_f5z_speaker_automute(codec);
18467 alc_mic_automute(codec);
18469 /* ***************** Mode3 ******************************/
18470 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18471 unsigned int res)
18473 switch (res >> 26) {
18474 case ALC880_HP_EVENT:
18475 alc663_two_hp_m1_speaker_automute(codec);
18476 break;
18477 case ALC880_MIC_EVENT:
18478 alc_mic_automute(codec);
18479 break;
18483 #define alc663_mode3_setup alc663_mode1_setup
18485 static void alc663_mode3_inithook(struct hda_codec *codec)
18487 alc663_two_hp_m1_speaker_automute(codec);
18488 alc_mic_automute(codec);
18490 /* ***************** Mode4 ******************************/
18491 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18492 unsigned int res)
18494 switch (res >> 26) {
18495 case ALC880_HP_EVENT:
18496 alc663_21jd_two_speaker_automute(codec);
18497 break;
18498 case ALC880_MIC_EVENT:
18499 alc_mic_automute(codec);
18500 break;
18504 #define alc663_mode4_setup alc663_mode1_setup
18506 static void alc663_mode4_inithook(struct hda_codec *codec)
18508 alc663_21jd_two_speaker_automute(codec);
18509 alc_mic_automute(codec);
18511 /* ***************** Mode5 ******************************/
18512 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18513 unsigned int res)
18515 switch (res >> 26) {
18516 case ALC880_HP_EVENT:
18517 alc663_15jd_two_speaker_automute(codec);
18518 break;
18519 case ALC880_MIC_EVENT:
18520 alc_mic_automute(codec);
18521 break;
18525 #define alc663_mode5_setup alc663_mode1_setup
18527 static void alc663_mode5_inithook(struct hda_codec *codec)
18529 alc663_15jd_two_speaker_automute(codec);
18530 alc_mic_automute(codec);
18532 /* ***************** Mode6 ******************************/
18533 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18534 unsigned int res)
18536 switch (res >> 26) {
18537 case ALC880_HP_EVENT:
18538 alc663_two_hp_m2_speaker_automute(codec);
18539 break;
18540 case ALC880_MIC_EVENT:
18541 alc_mic_automute(codec);
18542 break;
18546 #define alc663_mode6_setup alc663_mode1_setup
18548 static void alc663_mode6_inithook(struct hda_codec *codec)
18550 alc663_two_hp_m2_speaker_automute(codec);
18551 alc_mic_automute(codec);
18554 /* ***************** Mode7 ******************************/
18555 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18556 unsigned int res)
18558 switch (res >> 26) {
18559 case ALC880_HP_EVENT:
18560 alc663_two_hp_m7_speaker_automute(codec);
18561 break;
18562 case ALC880_MIC_EVENT:
18563 alc_mic_automute(codec);
18564 break;
18568 #define alc663_mode7_setup alc663_mode1_setup
18570 static void alc663_mode7_inithook(struct hda_codec *codec)
18572 alc663_two_hp_m7_speaker_automute(codec);
18573 alc_mic_automute(codec);
18576 /* ***************** Mode8 ******************************/
18577 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18578 unsigned int res)
18580 switch (res >> 26) {
18581 case ALC880_HP_EVENT:
18582 alc663_two_hp_m8_speaker_automute(codec);
18583 break;
18584 case ALC880_MIC_EVENT:
18585 alc_mic_automute(codec);
18586 break;
18590 #define alc663_mode8_setup alc663_m51va_setup
18592 static void alc663_mode8_inithook(struct hda_codec *codec)
18594 alc663_two_hp_m8_speaker_automute(codec);
18595 alc_mic_automute(codec);
18598 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18600 unsigned int present;
18601 unsigned char bits;
18603 present = snd_hda_jack_detect(codec, 0x21);
18604 bits = present ? HDA_AMP_MUTE : 0;
18605 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18606 HDA_AMP_MUTE, bits);
18607 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18608 HDA_AMP_MUTE, bits);
18611 static void alc663_g71v_front_automute(struct hda_codec *codec)
18613 unsigned int present;
18614 unsigned char bits;
18616 present = snd_hda_jack_detect(codec, 0x15);
18617 bits = present ? HDA_AMP_MUTE : 0;
18618 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18619 HDA_AMP_MUTE, bits);
18622 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18623 unsigned int res)
18625 switch (res >> 26) {
18626 case ALC880_HP_EVENT:
18627 alc663_g71v_hp_automute(codec);
18628 break;
18629 case ALC880_FRONT_EVENT:
18630 alc663_g71v_front_automute(codec);
18631 break;
18632 case ALC880_MIC_EVENT:
18633 alc_mic_automute(codec);
18634 break;
18638 #define alc663_g71v_setup alc663_m51va_setup
18640 static void alc663_g71v_inithook(struct hda_codec *codec)
18642 alc663_g71v_front_automute(codec);
18643 alc663_g71v_hp_automute(codec);
18644 alc_mic_automute(codec);
18647 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18648 unsigned int res)
18650 switch (res >> 26) {
18651 case ALC880_HP_EVENT:
18652 alc663_m51va_speaker_automute(codec);
18653 break;
18654 case ALC880_MIC_EVENT:
18655 alc_mic_automute(codec);
18656 break;
18660 #define alc663_g50v_setup alc663_m51va_setup
18662 static void alc663_g50v_inithook(struct hda_codec *codec)
18664 alc663_m51va_speaker_automute(codec);
18665 alc_mic_automute(codec);
18668 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18669 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18670 ALC262_HIPPO_MASTER_SWITCH,
18672 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18673 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18674 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18676 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18677 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18678 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18679 { } /* end */
18682 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18683 /* Master Playback automatically created from Speaker and Headphone */
18684 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18685 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18686 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18687 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18689 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18690 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18691 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18693 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18694 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18695 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18696 { } /* end */
18699 #ifdef CONFIG_SND_HDA_POWER_SAVE
18700 #define alc662_loopbacks alc880_loopbacks
18701 #endif
18704 /* pcm configuration: identical with ALC880 */
18705 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18706 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18707 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18708 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18711 * configuration and preset
18713 static const char * const alc662_models[ALC662_MODEL_LAST] = {
18714 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18715 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18716 [ALC662_3ST_6ch] = "3stack-6ch",
18717 [ALC662_5ST_DIG] = "6stack-dig",
18718 [ALC662_LENOVO_101E] = "lenovo-101e",
18719 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18720 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18721 [ALC662_ECS] = "ecs",
18722 [ALC663_ASUS_M51VA] = "m51va",
18723 [ALC663_ASUS_G71V] = "g71v",
18724 [ALC663_ASUS_H13] = "h13",
18725 [ALC663_ASUS_G50V] = "g50v",
18726 [ALC663_ASUS_MODE1] = "asus-mode1",
18727 [ALC662_ASUS_MODE2] = "asus-mode2",
18728 [ALC663_ASUS_MODE3] = "asus-mode3",
18729 [ALC663_ASUS_MODE4] = "asus-mode4",
18730 [ALC663_ASUS_MODE5] = "asus-mode5",
18731 [ALC663_ASUS_MODE6] = "asus-mode6",
18732 [ALC663_ASUS_MODE7] = "asus-mode7",
18733 [ALC663_ASUS_MODE8] = "asus-mode8",
18734 [ALC272_DELL] = "dell",
18735 [ALC272_DELL_ZM1] = "dell-zm1",
18736 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18737 [ALC662_AUTO] = "auto",
18740 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18741 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18742 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18743 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18744 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18745 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18746 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18747 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18748 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18749 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18750 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18751 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18752 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18753 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18754 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18755 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18756 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18757 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18758 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18759 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18760 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18761 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18762 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18763 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18764 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18765 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18766 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18767 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18768 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18769 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18770 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18771 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18772 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18773 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18774 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18775 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18776 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18777 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18778 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18779 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18780 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18781 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18782 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18783 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18784 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18785 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18786 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18787 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18788 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18789 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18790 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18791 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18792 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18793 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18794 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18795 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18796 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18797 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18798 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18799 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18800 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18801 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18802 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18803 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18804 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18805 ALC662_3ST_6ch_DIG),
18806 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18807 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18808 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18809 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18810 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18811 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18812 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18813 ALC662_3ST_6ch_DIG),
18814 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18815 ALC663_ASUS_H13),
18816 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E),
18820 static struct alc_config_preset alc662_presets[] = {
18821 [ALC662_3ST_2ch_DIG] = {
18822 .mixers = { alc662_3ST_2ch_mixer },
18823 .init_verbs = { alc662_init_verbs },
18824 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18825 .dac_nids = alc662_dac_nids,
18826 .dig_out_nid = ALC662_DIGOUT_NID,
18827 .dig_in_nid = ALC662_DIGIN_NID,
18828 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18829 .channel_mode = alc662_3ST_2ch_modes,
18830 .input_mux = &alc662_capture_source,
18832 [ALC662_3ST_6ch_DIG] = {
18833 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18834 .init_verbs = { alc662_init_verbs },
18835 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18836 .dac_nids = alc662_dac_nids,
18837 .dig_out_nid = ALC662_DIGOUT_NID,
18838 .dig_in_nid = ALC662_DIGIN_NID,
18839 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18840 .channel_mode = alc662_3ST_6ch_modes,
18841 .need_dac_fix = 1,
18842 .input_mux = &alc662_capture_source,
18844 [ALC662_3ST_6ch] = {
18845 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18846 .init_verbs = { alc662_init_verbs },
18847 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18848 .dac_nids = alc662_dac_nids,
18849 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18850 .channel_mode = alc662_3ST_6ch_modes,
18851 .need_dac_fix = 1,
18852 .input_mux = &alc662_capture_source,
18854 [ALC662_5ST_DIG] = {
18855 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18856 .init_verbs = { alc662_init_verbs },
18857 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18858 .dac_nids = alc662_dac_nids,
18859 .dig_out_nid = ALC662_DIGOUT_NID,
18860 .dig_in_nid = ALC662_DIGIN_NID,
18861 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18862 .channel_mode = alc662_5stack_modes,
18863 .input_mux = &alc662_capture_source,
18865 [ALC662_LENOVO_101E] = {
18866 .mixers = { alc662_lenovo_101e_mixer },
18867 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18868 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18869 .dac_nids = alc662_dac_nids,
18870 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18871 .channel_mode = alc662_3ST_2ch_modes,
18872 .input_mux = &alc662_lenovo_101e_capture_source,
18873 .unsol_event = alc662_lenovo_101e_unsol_event,
18874 .init_hook = alc662_lenovo_101e_all_automute,
18876 [ALC662_ASUS_EEEPC_P701] = {
18877 .mixers = { alc662_eeepc_p701_mixer },
18878 .init_verbs = { alc662_init_verbs,
18879 alc662_eeepc_sue_init_verbs },
18880 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18881 .dac_nids = alc662_dac_nids,
18882 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18883 .channel_mode = alc662_3ST_2ch_modes,
18884 .unsol_event = alc662_eeepc_unsol_event,
18885 .setup = alc662_eeepc_setup,
18886 .init_hook = alc662_eeepc_inithook,
18888 [ALC662_ASUS_EEEPC_EP20] = {
18889 .mixers = { alc662_eeepc_ep20_mixer,
18890 alc662_chmode_mixer },
18891 .init_verbs = { alc662_init_verbs,
18892 alc662_eeepc_ep20_sue_init_verbs },
18893 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18894 .dac_nids = alc662_dac_nids,
18895 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18896 .channel_mode = alc662_3ST_6ch_modes,
18897 .input_mux = &alc662_lenovo_101e_capture_source,
18898 .unsol_event = alc662_eeepc_unsol_event,
18899 .setup = alc662_eeepc_ep20_setup,
18900 .init_hook = alc662_eeepc_ep20_inithook,
18902 [ALC662_ECS] = {
18903 .mixers = { alc662_ecs_mixer },
18904 .init_verbs = { alc662_init_verbs,
18905 alc662_ecs_init_verbs },
18906 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18907 .dac_nids = alc662_dac_nids,
18908 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18909 .channel_mode = alc662_3ST_2ch_modes,
18910 .unsol_event = alc662_eeepc_unsol_event,
18911 .setup = alc662_eeepc_setup,
18912 .init_hook = alc662_eeepc_inithook,
18914 [ALC663_ASUS_M51VA] = {
18915 .mixers = { alc663_m51va_mixer },
18916 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18917 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18918 .dac_nids = alc662_dac_nids,
18919 .dig_out_nid = ALC662_DIGOUT_NID,
18920 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18921 .channel_mode = alc662_3ST_2ch_modes,
18922 .unsol_event = alc663_m51va_unsol_event,
18923 .setup = alc663_m51va_setup,
18924 .init_hook = alc663_m51va_inithook,
18926 [ALC663_ASUS_G71V] = {
18927 .mixers = { alc663_g71v_mixer },
18928 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18929 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18930 .dac_nids = alc662_dac_nids,
18931 .dig_out_nid = ALC662_DIGOUT_NID,
18932 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18933 .channel_mode = alc662_3ST_2ch_modes,
18934 .unsol_event = alc663_g71v_unsol_event,
18935 .setup = alc663_g71v_setup,
18936 .init_hook = alc663_g71v_inithook,
18938 [ALC663_ASUS_H13] = {
18939 .mixers = { alc663_m51va_mixer },
18940 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18941 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18942 .dac_nids = alc662_dac_nids,
18943 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18944 .channel_mode = alc662_3ST_2ch_modes,
18945 .unsol_event = alc663_m51va_unsol_event,
18946 .init_hook = alc663_m51va_inithook,
18948 [ALC663_ASUS_G50V] = {
18949 .mixers = { alc663_g50v_mixer },
18950 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18951 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18952 .dac_nids = alc662_dac_nids,
18953 .dig_out_nid = ALC662_DIGOUT_NID,
18954 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18955 .channel_mode = alc662_3ST_6ch_modes,
18956 .input_mux = &alc663_capture_source,
18957 .unsol_event = alc663_g50v_unsol_event,
18958 .setup = alc663_g50v_setup,
18959 .init_hook = alc663_g50v_inithook,
18961 [ALC663_ASUS_MODE1] = {
18962 .mixers = { alc663_m51va_mixer },
18963 .cap_mixer = alc662_auto_capture_mixer,
18964 .init_verbs = { alc662_init_verbs,
18965 alc663_21jd_amic_init_verbs },
18966 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18967 .hp_nid = 0x03,
18968 .dac_nids = alc662_dac_nids,
18969 .dig_out_nid = ALC662_DIGOUT_NID,
18970 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18971 .channel_mode = alc662_3ST_2ch_modes,
18972 .unsol_event = alc663_mode1_unsol_event,
18973 .setup = alc663_mode1_setup,
18974 .init_hook = alc663_mode1_inithook,
18976 [ALC662_ASUS_MODE2] = {
18977 .mixers = { alc662_1bjd_mixer },
18978 .cap_mixer = alc662_auto_capture_mixer,
18979 .init_verbs = { alc662_init_verbs,
18980 alc662_1bjd_amic_init_verbs },
18981 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18982 .dac_nids = alc662_dac_nids,
18983 .dig_out_nid = ALC662_DIGOUT_NID,
18984 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18985 .channel_mode = alc662_3ST_2ch_modes,
18986 .unsol_event = alc662_mode2_unsol_event,
18987 .setup = alc662_mode2_setup,
18988 .init_hook = alc662_mode2_inithook,
18990 [ALC663_ASUS_MODE3] = {
18991 .mixers = { alc663_two_hp_m1_mixer },
18992 .cap_mixer = alc662_auto_capture_mixer,
18993 .init_verbs = { alc662_init_verbs,
18994 alc663_two_hp_amic_m1_init_verbs },
18995 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18996 .hp_nid = 0x03,
18997 .dac_nids = alc662_dac_nids,
18998 .dig_out_nid = ALC662_DIGOUT_NID,
18999 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19000 .channel_mode = alc662_3ST_2ch_modes,
19001 .unsol_event = alc663_mode3_unsol_event,
19002 .setup = alc663_mode3_setup,
19003 .init_hook = alc663_mode3_inithook,
19005 [ALC663_ASUS_MODE4] = {
19006 .mixers = { alc663_asus_21jd_clfe_mixer },
19007 .cap_mixer = alc662_auto_capture_mixer,
19008 .init_verbs = { alc662_init_verbs,
19009 alc663_21jd_amic_init_verbs},
19010 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19011 .hp_nid = 0x03,
19012 .dac_nids = alc662_dac_nids,
19013 .dig_out_nid = ALC662_DIGOUT_NID,
19014 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19015 .channel_mode = alc662_3ST_2ch_modes,
19016 .unsol_event = alc663_mode4_unsol_event,
19017 .setup = alc663_mode4_setup,
19018 .init_hook = alc663_mode4_inithook,
19020 [ALC663_ASUS_MODE5] = {
19021 .mixers = { alc663_asus_15jd_clfe_mixer },
19022 .cap_mixer = alc662_auto_capture_mixer,
19023 .init_verbs = { alc662_init_verbs,
19024 alc663_15jd_amic_init_verbs },
19025 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19026 .hp_nid = 0x03,
19027 .dac_nids = alc662_dac_nids,
19028 .dig_out_nid = ALC662_DIGOUT_NID,
19029 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19030 .channel_mode = alc662_3ST_2ch_modes,
19031 .unsol_event = alc663_mode5_unsol_event,
19032 .setup = alc663_mode5_setup,
19033 .init_hook = alc663_mode5_inithook,
19035 [ALC663_ASUS_MODE6] = {
19036 .mixers = { alc663_two_hp_m2_mixer },
19037 .cap_mixer = alc662_auto_capture_mixer,
19038 .init_verbs = { alc662_init_verbs,
19039 alc663_two_hp_amic_m2_init_verbs },
19040 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19041 .hp_nid = 0x03,
19042 .dac_nids = alc662_dac_nids,
19043 .dig_out_nid = ALC662_DIGOUT_NID,
19044 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19045 .channel_mode = alc662_3ST_2ch_modes,
19046 .unsol_event = alc663_mode6_unsol_event,
19047 .setup = alc663_mode6_setup,
19048 .init_hook = alc663_mode6_inithook,
19050 [ALC663_ASUS_MODE7] = {
19051 .mixers = { alc663_mode7_mixer },
19052 .cap_mixer = alc662_auto_capture_mixer,
19053 .init_verbs = { alc662_init_verbs,
19054 alc663_mode7_init_verbs },
19055 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19056 .hp_nid = 0x03,
19057 .dac_nids = alc662_dac_nids,
19058 .dig_out_nid = ALC662_DIGOUT_NID,
19059 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19060 .channel_mode = alc662_3ST_2ch_modes,
19061 .unsol_event = alc663_mode7_unsol_event,
19062 .setup = alc663_mode7_setup,
19063 .init_hook = alc663_mode7_inithook,
19065 [ALC663_ASUS_MODE8] = {
19066 .mixers = { alc663_mode8_mixer },
19067 .cap_mixer = alc662_auto_capture_mixer,
19068 .init_verbs = { alc662_init_verbs,
19069 alc663_mode8_init_verbs },
19070 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19071 .hp_nid = 0x03,
19072 .dac_nids = alc662_dac_nids,
19073 .dig_out_nid = ALC662_DIGOUT_NID,
19074 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19075 .channel_mode = alc662_3ST_2ch_modes,
19076 .unsol_event = alc663_mode8_unsol_event,
19077 .setup = alc663_mode8_setup,
19078 .init_hook = alc663_mode8_inithook,
19080 [ALC272_DELL] = {
19081 .mixers = { alc663_m51va_mixer },
19082 .cap_mixer = alc272_auto_capture_mixer,
19083 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
19084 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19085 .dac_nids = alc662_dac_nids,
19086 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19087 .adc_nids = alc272_adc_nids,
19088 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
19089 .capsrc_nids = alc272_capsrc_nids,
19090 .channel_mode = alc662_3ST_2ch_modes,
19091 .unsol_event = alc663_m51va_unsol_event,
19092 .setup = alc663_m51va_setup,
19093 .init_hook = alc663_m51va_inithook,
19095 [ALC272_DELL_ZM1] = {
19096 .mixers = { alc663_m51va_mixer },
19097 .cap_mixer = alc662_auto_capture_mixer,
19098 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
19099 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19100 .dac_nids = alc662_dac_nids,
19101 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19102 .adc_nids = alc662_adc_nids,
19103 .num_adc_nids = 1,
19104 .capsrc_nids = alc662_capsrc_nids,
19105 .channel_mode = alc662_3ST_2ch_modes,
19106 .unsol_event = alc663_m51va_unsol_event,
19107 .setup = alc663_m51va_setup,
19108 .init_hook = alc663_m51va_inithook,
19110 [ALC272_SAMSUNG_NC10] = {
19111 .mixers = { alc272_nc10_mixer },
19112 .init_verbs = { alc662_init_verbs,
19113 alc663_21jd_amic_init_verbs },
19114 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19115 .dac_nids = alc272_dac_nids,
19116 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19117 .channel_mode = alc662_3ST_2ch_modes,
19118 /*.input_mux = &alc272_nc10_capture_source,*/
19119 .unsol_event = alc663_mode4_unsol_event,
19120 .setup = alc663_mode4_setup,
19121 .init_hook = alc663_mode4_inithook,
19127 * BIOS auto configuration
19130 /* convert from MIX nid to DAC */
19131 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19133 if (nid == 0x0f)
19134 return 0x02;
19135 else if (nid >= 0x0c && nid <= 0x0e)
19136 return nid - 0x0c + 0x02;
19137 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19138 return 0x25;
19139 else
19140 return 0;
19143 /* get MIX nid connected to the given pin targeted to DAC */
19144 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19145 hda_nid_t dac)
19147 hda_nid_t mix[5];
19148 int i, num;
19150 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19151 for (i = 0; i < num; i++) {
19152 if (alc662_mix_to_dac(mix[i]) == dac)
19153 return mix[i];
19155 return 0;
19158 /* look for an empty DAC slot */
19159 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19161 struct alc_spec *spec = codec->spec;
19162 hda_nid_t srcs[5];
19163 int i, j, num;
19165 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19166 if (num < 0)
19167 return 0;
19168 for (i = 0; i < num; i++) {
19169 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19170 if (!nid)
19171 continue;
19172 for (j = 0; j < spec->multiout.num_dacs; j++)
19173 if (spec->multiout.dac_nids[j] == nid)
19174 break;
19175 if (j >= spec->multiout.num_dacs)
19176 return nid;
19178 return 0;
19181 /* fill in the dac_nids table from the parsed pin configuration */
19182 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19183 const struct auto_pin_cfg *cfg)
19185 struct alc_spec *spec = codec->spec;
19186 int i;
19187 hda_nid_t dac;
19189 spec->multiout.dac_nids = spec->private_dac_nids;
19190 for (i = 0; i < cfg->line_outs; i++) {
19191 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19192 if (!dac)
19193 continue;
19194 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19196 return 0;
19199 static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19200 hda_nid_t nid, int idx, unsigned int chs)
19202 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx,
19203 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19206 static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19207 hda_nid_t nid, int idx, unsigned int chs)
19209 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
19210 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19213 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19214 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19215 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19216 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19217 #define alc662_add_stereo_vol(spec, pfx, nid) \
19218 alc662_add_vol_ctl(spec, pfx, nid, 3)
19219 #define alc662_add_stereo_sw(spec, pfx, nid) \
19220 alc662_add_sw_ctl(spec, pfx, nid, 3)
19222 /* add playback controls from the parsed DAC table */
19223 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19224 const struct auto_pin_cfg *cfg)
19226 struct alc_spec *spec = codec->spec;
19227 static const char * const chname[4] = {
19228 "Front", "Surround", NULL /*CLFE*/, "Side"
19230 const char *pfx = alc_get_line_out_pfx(cfg, true);
19231 hda_nid_t nid, mix;
19232 int i, err;
19234 for (i = 0; i < cfg->line_outs; i++) {
19235 nid = spec->multiout.dac_nids[i];
19236 if (!nid)
19237 continue;
19238 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19239 if (!mix)
19240 continue;
19241 if (!pfx && i == 2) {
19242 /* Center/LFE */
19243 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19244 if (err < 0)
19245 return err;
19246 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19247 if (err < 0)
19248 return err;
19249 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19250 if (err < 0)
19251 return err;
19252 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19253 if (err < 0)
19254 return err;
19255 } else {
19256 const char *name = pfx;
19257 int index = i;
19258 if (!name) {
19259 name = chname[i];
19260 index = 0;
19262 err = __alc662_add_vol_ctl(spec, name, nid, index, 3);
19263 if (err < 0)
19264 return err;
19265 err = __alc662_add_sw_ctl(spec, name, mix, index, 3);
19266 if (err < 0)
19267 return err;
19270 return 0;
19273 /* add playback controls for speaker and HP outputs */
19274 /* return DAC nid if any new DAC is assigned */
19275 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19276 const char *pfx)
19278 struct alc_spec *spec = codec->spec;
19279 hda_nid_t nid, mix;
19280 int err;
19282 if (!pin)
19283 return 0;
19284 nid = alc662_look_for_dac(codec, pin);
19285 if (!nid) {
19286 /* the corresponding DAC is already occupied */
19287 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19288 return 0; /* no way */
19289 /* create a switch only */
19290 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19291 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19294 mix = alc662_dac_to_mix(codec, pin, nid);
19295 if (!mix)
19296 return 0;
19297 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19298 if (err < 0)
19299 return err;
19300 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19301 if (err < 0)
19302 return err;
19303 return nid;
19306 /* create playback/capture controls for input pins */
19307 #define alc662_auto_create_input_ctls \
19308 alc882_auto_create_input_ctls
19310 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19311 hda_nid_t nid, int pin_type,
19312 hda_nid_t dac)
19314 int i, num;
19315 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19317 alc_set_pin_output(codec, nid, pin_type);
19318 /* need the manual connection? */
19319 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19320 if (num <= 1)
19321 return;
19322 for (i = 0; i < num; i++) {
19323 if (alc662_mix_to_dac(srcs[i]) != dac)
19324 continue;
19325 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19326 return;
19330 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19332 struct alc_spec *spec = codec->spec;
19333 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19334 int i;
19336 for (i = 0; i <= HDA_SIDE; i++) {
19337 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19338 if (nid)
19339 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19340 spec->multiout.dac_nids[i]);
19344 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19346 struct alc_spec *spec = codec->spec;
19347 hda_nid_t pin;
19349 pin = spec->autocfg.hp_pins[0];
19350 if (pin)
19351 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19352 spec->multiout.hp_nid);
19353 pin = spec->autocfg.speaker_pins[0];
19354 if (pin)
19355 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19356 spec->multiout.extra_out_nid[0]);
19359 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19361 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19363 struct alc_spec *spec = codec->spec;
19364 struct auto_pin_cfg *cfg = &spec->autocfg;
19365 int i;
19367 for (i = 0; i < cfg->num_inputs; i++) {
19368 hda_nid_t nid = cfg->inputs[i].pin;
19369 if (alc_is_input_pin(codec, nid)) {
19370 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19371 if (nid != ALC662_PIN_CD_NID &&
19372 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19373 snd_hda_codec_write(codec, nid, 0,
19374 AC_VERB_SET_AMP_GAIN_MUTE,
19375 AMP_OUT_MUTE);
19380 #define alc662_auto_init_input_src alc882_auto_init_input_src
19382 static int alc662_parse_auto_config(struct hda_codec *codec)
19384 struct alc_spec *spec = codec->spec;
19385 int err;
19386 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19388 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19389 alc662_ignore);
19390 if (err < 0)
19391 return err;
19392 if (!spec->autocfg.line_outs)
19393 return 0; /* can't find valid BIOS pin config */
19395 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19396 if (err < 0)
19397 return err;
19398 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19399 if (err < 0)
19400 return err;
19401 err = alc662_auto_create_extra_out(codec,
19402 spec->autocfg.speaker_pins[0],
19403 "Speaker");
19404 if (err < 0)
19405 return err;
19406 if (err)
19407 spec->multiout.extra_out_nid[0] = err;
19408 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19409 "Headphone");
19410 if (err < 0)
19411 return err;
19412 if (err)
19413 spec->multiout.hp_nid = err;
19414 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19415 if (err < 0)
19416 return err;
19418 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19420 alc_auto_parse_digital(codec);
19422 if (spec->kctls.list)
19423 add_mixer(spec, spec->kctls.list);
19425 spec->num_mux_defs = 1;
19426 spec->input_mux = &spec->private_imux[0];
19428 add_verb(spec, alc662_init_verbs);
19429 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19430 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19431 add_verb(spec, alc663_init_verbs);
19433 if (codec->vendor_id == 0x10ec0272)
19434 add_verb(spec, alc272_init_verbs);
19436 err = alc_auto_add_mic_boost(codec);
19437 if (err < 0)
19438 return err;
19440 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19441 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19442 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19443 else
19444 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19446 return 1;
19449 /* additional initialization for auto-configuration model */
19450 static void alc662_auto_init(struct hda_codec *codec)
19452 struct alc_spec *spec = codec->spec;
19453 alc662_auto_init_multi_out(codec);
19454 alc662_auto_init_hp_out(codec);
19455 alc662_auto_init_analog_input(codec);
19456 alc662_auto_init_input_src(codec);
19457 alc_auto_init_digital(codec);
19458 if (spec->unsol_event)
19459 alc_inithook(codec);
19462 static void alc272_fixup_mario(struct hda_codec *codec,
19463 const struct alc_fixup *fix, int action)
19465 if (action != ALC_FIXUP_ACT_PROBE)
19466 return;
19467 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19468 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19469 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19470 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19471 (0 << AC_AMPCAP_MUTE_SHIFT)))
19472 printk(KERN_WARNING
19473 "hda_codec: failed to override amp caps for NID 0x2\n");
19476 enum {
19477 ALC662_FIXUP_ASPIRE,
19478 ALC662_FIXUP_IDEAPAD,
19479 ALC272_FIXUP_MARIO,
19480 ALC662_FIXUP_CZC_P10T,
19481 ALC662_FIXUP_GIGABYTE,
19484 static const struct alc_fixup alc662_fixups[] = {
19485 [ALC662_FIXUP_ASPIRE] = {
19486 .type = ALC_FIXUP_PINS,
19487 .v.pins = (const struct alc_pincfg[]) {
19488 { 0x15, 0x99130112 }, /* subwoofer */
19492 [ALC662_FIXUP_IDEAPAD] = {
19493 .type = ALC_FIXUP_PINS,
19494 .v.pins = (const struct alc_pincfg[]) {
19495 { 0x17, 0x99130112 }, /* subwoofer */
19499 [ALC272_FIXUP_MARIO] = {
19500 .type = ALC_FIXUP_FUNC,
19501 .v.func = alc272_fixup_mario,
19503 [ALC662_FIXUP_CZC_P10T] = {
19504 .type = ALC_FIXUP_VERBS,
19505 .v.verbs = (const struct hda_verb[]) {
19506 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19510 [ALC662_FIXUP_GIGABYTE] = {
19511 .type = ALC_FIXUP_PINS,
19512 .v.pins = (const struct alc_pincfg[]) {
19513 { 0x14, 0x1114410 }, /* set as speaker */
19519 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19520 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19521 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19522 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19523 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", ALC662_FIXUP_GIGABYTE),
19524 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19525 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19526 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19530 static const struct alc_model_fixup alc662_fixup_models[] = {
19531 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19536 static int patch_alc662(struct hda_codec *codec)
19538 struct alc_spec *spec;
19539 int err, board_config;
19540 int coef;
19542 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19543 if (!spec)
19544 return -ENOMEM;
19546 codec->spec = spec;
19548 alc_auto_parse_customize_define(codec);
19550 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19552 coef = alc_read_coef_idx(codec, 0);
19553 if (coef == 0x8020 || coef == 0x8011)
19554 alc_codec_rename(codec, "ALC661");
19555 else if (coef & (1 << 14) &&
19556 codec->bus->pci->subsystem_vendor == 0x1025 &&
19557 spec->cdefine.platform_type == 1)
19558 alc_codec_rename(codec, "ALC272X");
19559 else if (coef == 0x4011)
19560 alc_codec_rename(codec, "ALC656");
19562 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19563 alc662_models,
19564 alc662_cfg_tbl);
19565 if (board_config < 0) {
19566 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19567 codec->chip_name);
19568 board_config = ALC662_AUTO;
19571 if (board_config == ALC662_AUTO) {
19572 alc_pick_fixup(codec, alc662_fixup_models,
19573 alc662_fixup_tbl, alc662_fixups);
19574 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19575 /* automatic parse from the BIOS config */
19576 err = alc662_parse_auto_config(codec);
19577 if (err < 0) {
19578 alc_free(codec);
19579 return err;
19580 } else if (!err) {
19581 printk(KERN_INFO
19582 "hda_codec: Cannot set up configuration "
19583 "from BIOS. Using base mode...\n");
19584 board_config = ALC662_3ST_2ch_DIG;
19588 if (has_cdefine_beep(codec)) {
19589 err = snd_hda_attach_beep_device(codec, 0x1);
19590 if (err < 0) {
19591 alc_free(codec);
19592 return err;
19596 if (board_config != ALC662_AUTO)
19597 setup_preset(codec, &alc662_presets[board_config]);
19599 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19600 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19602 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19603 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19605 if (!spec->adc_nids) {
19606 spec->adc_nids = alc662_adc_nids;
19607 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19609 if (!spec->capsrc_nids)
19610 spec->capsrc_nids = alc662_capsrc_nids;
19612 if (!spec->cap_mixer)
19613 set_capture_mixer(codec);
19615 if (has_cdefine_beep(codec)) {
19616 switch (codec->vendor_id) {
19617 case 0x10ec0662:
19618 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19619 break;
19620 case 0x10ec0272:
19621 case 0x10ec0663:
19622 case 0x10ec0665:
19623 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19624 break;
19625 case 0x10ec0273:
19626 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19627 break;
19630 spec->vmaster_nid = 0x02;
19632 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19634 codec->patch_ops = alc_patch_ops;
19635 if (board_config == ALC662_AUTO)
19636 spec->init_hook = alc662_auto_init;
19638 alc_init_jacks(codec);
19640 #ifdef CONFIG_SND_HDA_POWER_SAVE
19641 if (!spec->loopback.amplist)
19642 spec->loopback.amplist = alc662_loopbacks;
19643 #endif
19645 return 0;
19648 static int patch_alc888(struct hda_codec *codec)
19650 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19651 kfree(codec->chip_name);
19652 if (codec->vendor_id == 0x10ec0887)
19653 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19654 else
19655 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19656 if (!codec->chip_name) {
19657 alc_free(codec);
19658 return -ENOMEM;
19660 return patch_alc662(codec);
19662 return patch_alc882(codec);
19666 * ALC680 support
19668 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19669 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19670 #define alc680_modes alc260_modes
19672 static hda_nid_t alc680_dac_nids[3] = {
19673 /* Lout1, Lout2, hp */
19674 0x02, 0x03, 0x04
19677 static hda_nid_t alc680_adc_nids[3] = {
19678 /* ADC0-2 */
19679 /* DMIC, MIC, Line-in*/
19680 0x07, 0x08, 0x09
19684 * Analog capture ADC cgange
19686 static void alc680_rec_autoswitch(struct hda_codec *codec)
19688 struct alc_spec *spec = codec->spec;
19689 struct auto_pin_cfg *cfg = &spec->autocfg;
19690 int pin_found = 0;
19691 int type_found = AUTO_PIN_LAST;
19692 hda_nid_t nid;
19693 int i;
19695 for (i = 0; i < cfg->num_inputs; i++) {
19696 nid = cfg->inputs[i].pin;
19697 if (!(snd_hda_query_pin_caps(codec, nid) &
19698 AC_PINCAP_PRES_DETECT))
19699 continue;
19700 if (snd_hda_jack_detect(codec, nid)) {
19701 if (cfg->inputs[i].type < type_found) {
19702 type_found = cfg->inputs[i].type;
19703 pin_found = nid;
19708 nid = 0x07;
19709 if (pin_found)
19710 snd_hda_get_connections(codec, pin_found, &nid, 1);
19712 if (nid != spec->cur_adc)
19713 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19714 spec->cur_adc = nid;
19715 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19716 spec->cur_adc_format);
19719 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19720 struct hda_codec *codec,
19721 unsigned int stream_tag,
19722 unsigned int format,
19723 struct snd_pcm_substream *substream)
19725 struct alc_spec *spec = codec->spec;
19727 spec->cur_adc = 0x07;
19728 spec->cur_adc_stream_tag = stream_tag;
19729 spec->cur_adc_format = format;
19731 alc680_rec_autoswitch(codec);
19732 return 0;
19735 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19736 struct hda_codec *codec,
19737 struct snd_pcm_substream *substream)
19739 snd_hda_codec_cleanup_stream(codec, 0x07);
19740 snd_hda_codec_cleanup_stream(codec, 0x08);
19741 snd_hda_codec_cleanup_stream(codec, 0x09);
19742 return 0;
19745 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19746 .substreams = 1, /* can be overridden */
19747 .channels_min = 2,
19748 .channels_max = 2,
19749 /* NID is set in alc_build_pcms */
19750 .ops = {
19751 .prepare = alc680_capture_pcm_prepare,
19752 .cleanup = alc680_capture_pcm_cleanup
19756 static struct snd_kcontrol_new alc680_base_mixer[] = {
19757 /* output mixer control */
19758 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19759 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19760 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19761 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19762 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19763 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19764 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19768 static struct hda_bind_ctls alc680_bind_cap_vol = {
19769 .ops = &snd_hda_bind_vol,
19770 .values = {
19771 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19772 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19773 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19778 static struct hda_bind_ctls alc680_bind_cap_switch = {
19779 .ops = &snd_hda_bind_sw,
19780 .values = {
19781 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19782 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19783 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19788 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19789 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19790 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19791 { } /* end */
19795 * generic initialization of ADC, input mixers and output mixers
19797 static struct hda_verb alc680_init_verbs[] = {
19798 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19799 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19800 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19802 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19803 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19805 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19806 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19807 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19809 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19811 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19812 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19813 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19815 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19816 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19817 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19822 /* toggle speaker-output according to the hp-jack state */
19823 static void alc680_base_setup(struct hda_codec *codec)
19825 struct alc_spec *spec = codec->spec;
19827 spec->autocfg.hp_pins[0] = 0x16;
19828 spec->autocfg.speaker_pins[0] = 0x14;
19829 spec->autocfg.speaker_pins[1] = 0x15;
19830 spec->autocfg.num_inputs = 2;
19831 spec->autocfg.inputs[0].pin = 0x18;
19832 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19833 spec->autocfg.inputs[1].pin = 0x19;
19834 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19837 static void alc680_unsol_event(struct hda_codec *codec,
19838 unsigned int res)
19840 if ((res >> 26) == ALC880_HP_EVENT)
19841 alc_automute_amp(codec);
19842 if ((res >> 26) == ALC880_MIC_EVENT)
19843 alc680_rec_autoswitch(codec);
19846 static void alc680_inithook(struct hda_codec *codec)
19848 alc_automute_amp(codec);
19849 alc680_rec_autoswitch(codec);
19852 /* create input playback/capture controls for the given pin */
19853 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19854 const char *ctlname, int idx)
19856 hda_nid_t dac;
19857 int err;
19859 switch (nid) {
19860 case 0x14:
19861 dac = 0x02;
19862 break;
19863 case 0x15:
19864 dac = 0x03;
19865 break;
19866 case 0x16:
19867 dac = 0x04;
19868 break;
19869 default:
19870 return 0;
19872 if (spec->multiout.dac_nids[0] != dac &&
19873 spec->multiout.dac_nids[1] != dac) {
19874 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19875 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19876 HDA_OUTPUT));
19877 if (err < 0)
19878 return err;
19880 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19881 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19883 if (err < 0)
19884 return err;
19885 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19888 return 0;
19891 /* add playback controls from the parsed DAC table */
19892 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19893 const struct auto_pin_cfg *cfg)
19895 hda_nid_t nid;
19896 int err;
19898 spec->multiout.dac_nids = spec->private_dac_nids;
19900 nid = cfg->line_out_pins[0];
19901 if (nid) {
19902 const char *name;
19903 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19904 name = "Speaker";
19905 else
19906 name = "Front";
19907 err = alc680_new_analog_output(spec, nid, name, 0);
19908 if (err < 0)
19909 return err;
19912 nid = cfg->speaker_pins[0];
19913 if (nid) {
19914 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19915 if (err < 0)
19916 return err;
19918 nid = cfg->hp_pins[0];
19919 if (nid) {
19920 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19921 if (err < 0)
19922 return err;
19925 return 0;
19928 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19929 hda_nid_t nid, int pin_type)
19931 alc_set_pin_output(codec, nid, pin_type);
19934 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19936 struct alc_spec *spec = codec->spec;
19937 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19938 if (nid) {
19939 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19940 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19944 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19946 struct alc_spec *spec = codec->spec;
19947 hda_nid_t pin;
19949 pin = spec->autocfg.hp_pins[0];
19950 if (pin)
19951 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19952 pin = spec->autocfg.speaker_pins[0];
19953 if (pin)
19954 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19957 /* pcm configuration: identical with ALC880 */
19958 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19959 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19960 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19961 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19962 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19965 * BIOS auto configuration
19967 static int alc680_parse_auto_config(struct hda_codec *codec)
19969 struct alc_spec *spec = codec->spec;
19970 int err;
19971 static hda_nid_t alc680_ignore[] = { 0 };
19973 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19974 alc680_ignore);
19975 if (err < 0)
19976 return err;
19978 if (!spec->autocfg.line_outs) {
19979 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19980 spec->multiout.max_channels = 2;
19981 spec->no_analog = 1;
19982 goto dig_only;
19984 return 0; /* can't find valid BIOS pin config */
19986 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19987 if (err < 0)
19988 return err;
19990 spec->multiout.max_channels = 2;
19992 dig_only:
19993 /* digital only support output */
19994 alc_auto_parse_digital(codec);
19995 if (spec->kctls.list)
19996 add_mixer(spec, spec->kctls.list);
19998 add_verb(spec, alc680_init_verbs);
20000 err = alc_auto_add_mic_boost(codec);
20001 if (err < 0)
20002 return err;
20004 return 1;
20007 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
20009 /* init callback for auto-configuration model -- overriding the default init */
20010 static void alc680_auto_init(struct hda_codec *codec)
20012 struct alc_spec *spec = codec->spec;
20013 alc680_auto_init_multi_out(codec);
20014 alc680_auto_init_hp_out(codec);
20015 alc680_auto_init_analog_input(codec);
20016 alc_auto_init_digital(codec);
20017 if (spec->unsol_event)
20018 alc_inithook(codec);
20022 * configuration and preset
20024 static const char * const alc680_models[ALC680_MODEL_LAST] = {
20025 [ALC680_BASE] = "base",
20026 [ALC680_AUTO] = "auto",
20029 static struct snd_pci_quirk alc680_cfg_tbl[] = {
20030 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
20034 static struct alc_config_preset alc680_presets[] = {
20035 [ALC680_BASE] = {
20036 .mixers = { alc680_base_mixer },
20037 .cap_mixer = alc680_master_capture_mixer,
20038 .init_verbs = { alc680_init_verbs },
20039 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
20040 .dac_nids = alc680_dac_nids,
20041 .dig_out_nid = ALC680_DIGOUT_NID,
20042 .num_channel_mode = ARRAY_SIZE(alc680_modes),
20043 .channel_mode = alc680_modes,
20044 .unsol_event = alc680_unsol_event,
20045 .setup = alc680_base_setup,
20046 .init_hook = alc680_inithook,
20051 static int patch_alc680(struct hda_codec *codec)
20053 struct alc_spec *spec;
20054 int board_config;
20055 int err;
20057 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
20058 if (spec == NULL)
20059 return -ENOMEM;
20061 codec->spec = spec;
20063 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
20064 alc680_models,
20065 alc680_cfg_tbl);
20067 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
20068 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
20069 codec->chip_name);
20070 board_config = ALC680_AUTO;
20073 if (board_config == ALC680_AUTO) {
20074 /* automatic parse from the BIOS config */
20075 err = alc680_parse_auto_config(codec);
20076 if (err < 0) {
20077 alc_free(codec);
20078 return err;
20079 } else if (!err) {
20080 printk(KERN_INFO
20081 "hda_codec: Cannot set up configuration "
20082 "from BIOS. Using base mode...\n");
20083 board_config = ALC680_BASE;
20087 if (board_config != ALC680_AUTO)
20088 setup_preset(codec, &alc680_presets[board_config]);
20090 spec->stream_analog_playback = &alc680_pcm_analog_playback;
20091 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
20092 spec->stream_digital_playback = &alc680_pcm_digital_playback;
20093 spec->stream_digital_capture = &alc680_pcm_digital_capture;
20095 if (!spec->adc_nids) {
20096 spec->adc_nids = alc680_adc_nids;
20097 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
20100 if (!spec->cap_mixer)
20101 set_capture_mixer(codec);
20103 spec->vmaster_nid = 0x02;
20105 codec->patch_ops = alc_patch_ops;
20106 if (board_config == ALC680_AUTO)
20107 spec->init_hook = alc680_auto_init;
20109 return 0;
20113 * patch entries
20115 static struct hda_codec_preset snd_hda_preset_realtek[] = {
20116 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
20117 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
20118 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
20119 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
20120 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
20121 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
20122 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
20123 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
20124 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
20125 .patch = patch_alc861 },
20126 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
20127 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
20128 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
20129 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
20130 .patch = patch_alc882 },
20131 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
20132 .patch = patch_alc662 },
20133 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
20134 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
20135 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
20136 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
20137 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
20138 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
20139 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
20140 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
20141 .patch = patch_alc882 },
20142 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
20143 .patch = patch_alc882 },
20144 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
20145 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
20146 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
20147 .patch = patch_alc882 },
20148 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20149 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20150 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20151 {} /* terminator */
20154 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20156 MODULE_LICENSE("GPL");
20157 MODULE_DESCRIPTION("Realtek HD-audio codec");
20159 static struct hda_codec_preset_list realtek_list = {
20160 .preset = snd_hda_preset_realtek,
20161 .owner = THIS_MODULE,
20164 static int __init patch_realtek_init(void)
20166 return snd_hda_add_codec_preset(&realtek_list);
20169 static void __exit patch_realtek_exit(void)
20171 snd_hda_delete_codec_preset(&realtek_list);
20174 module_init(patch_realtek_init)
20175 module_exit(patch_realtek_exit)