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 "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
134 ALC269_ASUS_EEEPC_P703,
135 ALC269_ASUS_EEEPC_P901,
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
216 ALC883_TARGA_2ch_DIG,
217 ALC883_TARGA_8ch_DIG,
220 ALC888_ACER_ASPIRE_4930G,
221 ALC888_ACER_ASPIRE_6530G,
222 ALC888_ACER_ASPIRE_8930G,
226 ALC883_LENOVO_101E_2ch,
227 ALC883_LENOVO_NB0763,
228 ALC888_LENOVO_MS7195_DIG,
235 ALC883_FUJITSU_PI2515,
236 ALC888_FUJITSU_XA3530,
237 ALC883_3ST_6ch_INTEL,
250 #define GPIO_MASK 0x03
252 /* extra amp-initialization sequence types */
261 struct alc_mic_route {
263 unsigned char mux_idx;
264 unsigned char amix_idx;
267 #define MUX_IDX_UNDEF ((unsigned char)-1)
270 /* codec parameterization */
271 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
272 unsigned int num_mixers;
273 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
274 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
276 const struct hda_verb *init_verbs[5]; /* initialization verbs
280 unsigned int num_init_verbs;
282 char stream_name_analog[32]; /* analog PCM stream */
283 struct hda_pcm_stream *stream_analog_playback;
284 struct hda_pcm_stream *stream_analog_capture;
285 struct hda_pcm_stream *stream_analog_alt_playback;
286 struct hda_pcm_stream *stream_analog_alt_capture;
288 char stream_name_digital[32]; /* digital PCM stream */
289 struct hda_pcm_stream *stream_digital_playback;
290 struct hda_pcm_stream *stream_digital_capture;
293 struct hda_multi_out multiout; /* playback set-up
294 * max_channels, dacs must be set
295 * dig_out_nid and hp_nid are optional
297 hda_nid_t alt_dac_nid;
298 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
302 unsigned int num_adc_nids;
304 hda_nid_t *capsrc_nids;
305 hda_nid_t dig_in_nid; /* digital-in NID; optional */
308 unsigned int num_mux_defs;
309 const struct hda_input_mux *input_mux;
310 unsigned int cur_mux[3];
311 struct alc_mic_route ext_mic;
312 struct alc_mic_route int_mic;
315 const struct hda_channel_mode *channel_mode;
316 int num_channel_mode;
318 int const_channel_count;
319 int ext_channel_count;
321 /* PCM information */
322 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
324 /* dynamic controls, init_verbs and input_mux */
325 struct auto_pin_cfg autocfg;
326 struct snd_array kctls;
327 struct hda_input_mux private_imux[3];
328 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
329 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
330 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
333 void (*init_hook)(struct hda_codec *codec);
334 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
336 /* for pin sensing */
337 unsigned int sense_updated: 1;
338 unsigned int jack_present: 1;
339 unsigned int master_sw: 1;
340 unsigned int auto_mic:1;
343 unsigned int no_analog :1; /* digital I/O only */
346 /* for virtual master */
347 hda_nid_t vmaster_nid;
348 #ifdef CONFIG_SND_HDA_POWER_SAVE
349 struct hda_loopback_check loopback;
354 unsigned int pll_coef_idx, pll_coef_bit;
358 * configuration template - to be copied to the spec instance
360 struct alc_config_preset {
361 struct snd_kcontrol_new *mixers[5]; /* should be identical size
364 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
365 const struct hda_verb *init_verbs[5];
366 unsigned int num_dacs;
368 hda_nid_t dig_out_nid; /* optional */
369 hda_nid_t hp_nid; /* optional */
370 hda_nid_t *slave_dig_outs;
371 unsigned int num_adc_nids;
373 hda_nid_t *capsrc_nids;
374 hda_nid_t dig_in_nid;
375 unsigned int num_channel_mode;
376 const struct hda_channel_mode *channel_mode;
378 int const_channel_count;
379 unsigned int num_mux_defs;
380 const struct hda_input_mux *input_mux;
381 void (*unsol_event)(struct hda_codec *, unsigned int);
382 void (*init_hook)(struct hda_codec *);
383 #ifdef CONFIG_SND_HDA_POWER_SAVE
384 struct hda_amp_list *loopbacks;
392 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
393 struct snd_ctl_elem_info *uinfo)
395 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
396 struct alc_spec *spec = codec->spec;
397 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
398 if (mux_idx >= spec->num_mux_defs)
400 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
403 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
404 struct snd_ctl_elem_value *ucontrol)
406 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
407 struct alc_spec *spec = codec->spec;
408 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
410 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
414 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
415 struct snd_ctl_elem_value *ucontrol)
417 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
418 struct alc_spec *spec = codec->spec;
419 const struct hda_input_mux *imux;
420 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
421 unsigned int mux_idx;
422 hda_nid_t nid = spec->capsrc_nids ?
423 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
426 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
427 imux = &spec->input_mux[mux_idx];
429 type = get_wcaps_type(get_wcaps(codec, nid));
430 if (type == AC_WID_AUD_MIX) {
431 /* Matrix-mixer style (e.g. ALC882) */
432 unsigned int *cur_val = &spec->cur_mux[adc_idx];
435 idx = ucontrol->value.enumerated.item[0];
436 if (idx >= imux->num_items)
437 idx = imux->num_items - 1;
440 for (i = 0; i < imux->num_items; i++) {
441 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
442 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
443 imux->items[i].index,
449 /* MUX style (e.g. ALC880) */
450 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
451 &spec->cur_mux[adc_idx]);
456 * channel mode setting
458 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
459 struct snd_ctl_elem_info *uinfo)
461 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
462 struct alc_spec *spec = codec->spec;
463 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
464 spec->num_channel_mode);
467 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
468 struct snd_ctl_elem_value *ucontrol)
470 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
471 struct alc_spec *spec = codec->spec;
472 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
473 spec->num_channel_mode,
474 spec->ext_channel_count);
477 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol)
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct alc_spec *spec = codec->spec;
482 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
483 spec->num_channel_mode,
484 &spec->ext_channel_count);
485 if (err >= 0 && !spec->const_channel_count) {
486 spec->multiout.max_channels = spec->ext_channel_count;
487 if (spec->need_dac_fix)
488 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
494 * Control the mode of pin widget settings via the mixer. "pc" is used
495 * instead of "%" to avoid consequences of accidently treating the % as
496 * being part of a format specifier. Maximum allowed length of a value is
497 * 63 characters plus NULL terminator.
499 * Note: some retasking pin complexes seem to ignore requests for input
500 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
501 * are requested. Therefore order this list so that this behaviour will not
502 * cause problems when mixer clients move through the enum sequentially.
503 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
506 static char *alc_pin_mode_names[] = {
507 "Mic 50pc bias", "Mic 80pc bias",
508 "Line in", "Line out", "Headphone out",
510 static unsigned char alc_pin_mode_values[] = {
511 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
513 /* The control can present all 5 options, or it can limit the options based
514 * in the pin being assumed to be exclusively an input or an output pin. In
515 * addition, "input" pins may or may not process the mic bias option
516 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
517 * accept requests for bias as of chip versions up to March 2006) and/or
518 * wiring in the computer.
520 #define ALC_PIN_DIR_IN 0x00
521 #define ALC_PIN_DIR_OUT 0x01
522 #define ALC_PIN_DIR_INOUT 0x02
523 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
524 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
526 /* Info about the pin modes supported by the different pin direction modes.
527 * For each direction the minimum and maximum values are given.
529 static signed char alc_pin_mode_dir_info[5][2] = {
530 { 0, 2 }, /* ALC_PIN_DIR_IN */
531 { 3, 4 }, /* ALC_PIN_DIR_OUT */
532 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
533 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
534 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
536 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
537 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
538 #define alc_pin_mode_n_items(_dir) \
539 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
541 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
542 struct snd_ctl_elem_info *uinfo)
544 unsigned int item_num = uinfo->value.enumerated.item;
545 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
547 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
549 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
551 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
552 item_num = alc_pin_mode_min(dir);
553 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
557 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
558 struct snd_ctl_elem_value *ucontrol)
561 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
562 hda_nid_t nid = kcontrol->private_value & 0xffff;
563 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
564 long *valp = ucontrol->value.integer.value;
565 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
566 AC_VERB_GET_PIN_WIDGET_CONTROL,
569 /* Find enumerated value for current pinctl setting */
570 i = alc_pin_mode_min(dir);
571 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
573 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
577 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
578 struct snd_ctl_elem_value *ucontrol)
581 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
582 hda_nid_t nid = kcontrol->private_value & 0xffff;
583 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
584 long val = *ucontrol->value.integer.value;
585 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
586 AC_VERB_GET_PIN_WIDGET_CONTROL,
589 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
590 val = alc_pin_mode_min(dir);
592 change = pinctl != alc_pin_mode_values[val];
594 /* Set pin mode to that requested */
595 snd_hda_codec_write_cache(codec, nid, 0,
596 AC_VERB_SET_PIN_WIDGET_CONTROL,
597 alc_pin_mode_values[val]);
599 /* Also enable the retasking pin's input/output as required
600 * for the requested pin mode. Enum values of 2 or less are
603 * Dynamically switching the input/output buffers probably
604 * reduces noise slightly (particularly on input) so we'll
605 * do it. However, having both input and output buffers
606 * enabled simultaneously doesn't seem to be problematic if
607 * this turns out to be necessary in the future.
610 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
611 HDA_AMP_MUTE, HDA_AMP_MUTE);
612 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
615 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
616 HDA_AMP_MUTE, HDA_AMP_MUTE);
617 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
624 #define ALC_PIN_MODE(xname, nid, dir) \
625 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
626 .info = alc_pin_mode_info, \
627 .get = alc_pin_mode_get, \
628 .put = alc_pin_mode_put, \
629 .private_value = nid | (dir<<16) }
631 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
632 * together using a mask with more than one bit set. This control is
633 * currently used only by the ALC260 test model. At this stage they are not
634 * needed for any "production" models.
636 #ifdef CONFIG_SND_DEBUG
637 #define alc_gpio_data_info snd_ctl_boolean_mono_info
639 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
640 struct snd_ctl_elem_value *ucontrol)
642 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
643 hda_nid_t nid = kcontrol->private_value & 0xffff;
644 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
645 long *valp = ucontrol->value.integer.value;
646 unsigned int val = snd_hda_codec_read(codec, nid, 0,
647 AC_VERB_GET_GPIO_DATA, 0x00);
649 *valp = (val & mask) != 0;
652 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
653 struct snd_ctl_elem_value *ucontrol)
656 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
657 hda_nid_t nid = kcontrol->private_value & 0xffff;
658 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
659 long val = *ucontrol->value.integer.value;
660 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
661 AC_VERB_GET_GPIO_DATA,
664 /* Set/unset the masked GPIO bit(s) as needed */
665 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
670 snd_hda_codec_write_cache(codec, nid, 0,
671 AC_VERB_SET_GPIO_DATA, gpio_data);
675 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
676 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
677 .info = alc_gpio_data_info, \
678 .get = alc_gpio_data_get, \
679 .put = alc_gpio_data_put, \
680 .private_value = nid | (mask<<16) }
681 #endif /* CONFIG_SND_DEBUG */
683 /* A switch control to allow the enabling of the digital IO pins on the
684 * ALC260. This is incredibly simplistic; the intention of this control is
685 * to provide something in the test model allowing digital outputs to be
686 * identified if present. If models are found which can utilise these
687 * outputs a more complete mixer control can be devised for those models if
690 #ifdef CONFIG_SND_DEBUG
691 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
693 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
694 struct snd_ctl_elem_value *ucontrol)
696 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
697 hda_nid_t nid = kcontrol->private_value & 0xffff;
698 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
699 long *valp = ucontrol->value.integer.value;
700 unsigned int val = snd_hda_codec_read(codec, nid, 0,
701 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
703 *valp = (val & mask) != 0;
706 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
707 struct snd_ctl_elem_value *ucontrol)
710 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
711 hda_nid_t nid = kcontrol->private_value & 0xffff;
712 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
713 long val = *ucontrol->value.integer.value;
714 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
715 AC_VERB_GET_DIGI_CONVERT_1,
718 /* Set/unset the masked control bit(s) as needed */
719 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
724 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
729 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
730 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
731 .info = alc_spdif_ctrl_info, \
732 .get = alc_spdif_ctrl_get, \
733 .put = alc_spdif_ctrl_put, \
734 .private_value = nid | (mask<<16) }
735 #endif /* CONFIG_SND_DEBUG */
737 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
738 * Again, this is only used in the ALC26x test models to help identify when
739 * the EAPD line must be asserted for features to work.
741 #ifdef CONFIG_SND_DEBUG
742 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
744 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
745 struct snd_ctl_elem_value *ucontrol)
747 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
748 hda_nid_t nid = kcontrol->private_value & 0xffff;
749 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
750 long *valp = ucontrol->value.integer.value;
751 unsigned int val = snd_hda_codec_read(codec, nid, 0,
752 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
754 *valp = (val & mask) != 0;
758 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
759 struct snd_ctl_elem_value *ucontrol)
762 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
763 hda_nid_t nid = kcontrol->private_value & 0xffff;
764 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
765 long val = *ucontrol->value.integer.value;
766 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
767 AC_VERB_GET_EAPD_BTLENABLE,
770 /* Set/unset the masked control bit(s) as needed */
771 change = (!val ? 0 : mask) != (ctrl_data & mask);
776 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
782 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
783 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
784 .info = alc_eapd_ctrl_info, \
785 .get = alc_eapd_ctrl_get, \
786 .put = alc_eapd_ctrl_put, \
787 .private_value = nid | (mask<<16) }
788 #endif /* CONFIG_SND_DEBUG */
791 * set up the input pin config (depending on the given auto-pin type)
793 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
796 unsigned int val = PIN_IN;
798 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
800 pincap = snd_hda_query_pin_caps(codec, nid);
801 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
802 if (pincap & AC_PINCAP_VREF_80)
804 else if (pincap & AC_PINCAP_VREF_50)
806 else if (pincap & AC_PINCAP_VREF_100)
808 else if (pincap & AC_PINCAP_VREF_GRD)
811 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
816 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
818 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
820 spec->mixers[spec->num_mixers++] = mix;
823 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
825 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
827 spec->init_verbs[spec->num_init_verbs++] = verb;
830 #ifdef CONFIG_PROC_FS
834 static void print_realtek_coef(struct snd_info_buffer *buffer,
835 struct hda_codec *codec, hda_nid_t nid)
841 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
842 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
843 coeff = snd_hda_codec_read(codec, nid, 0,
844 AC_VERB_GET_COEF_INDEX, 0);
845 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
848 #define print_realtek_coef NULL
852 * set up from the preset table
854 static void setup_preset(struct alc_spec *spec,
855 const struct alc_config_preset *preset)
859 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
860 add_mixer(spec, preset->mixers[i]);
861 spec->cap_mixer = preset->cap_mixer;
862 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
864 add_verb(spec, preset->init_verbs[i]);
866 spec->channel_mode = preset->channel_mode;
867 spec->num_channel_mode = preset->num_channel_mode;
868 spec->need_dac_fix = preset->need_dac_fix;
869 spec->const_channel_count = preset->const_channel_count;
871 if (preset->const_channel_count)
872 spec->multiout.max_channels = preset->const_channel_count;
874 spec->multiout.max_channels = spec->channel_mode[0].channels;
875 spec->ext_channel_count = spec->channel_mode[0].channels;
877 spec->multiout.num_dacs = preset->num_dacs;
878 spec->multiout.dac_nids = preset->dac_nids;
879 spec->multiout.dig_out_nid = preset->dig_out_nid;
880 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
881 spec->multiout.hp_nid = preset->hp_nid;
883 spec->num_mux_defs = preset->num_mux_defs;
884 if (!spec->num_mux_defs)
885 spec->num_mux_defs = 1;
886 spec->input_mux = preset->input_mux;
888 spec->num_adc_nids = preset->num_adc_nids;
889 spec->adc_nids = preset->adc_nids;
890 spec->capsrc_nids = preset->capsrc_nids;
891 spec->dig_in_nid = preset->dig_in_nid;
893 spec->unsol_event = preset->unsol_event;
894 spec->init_hook = preset->init_hook;
895 #ifdef CONFIG_SND_HDA_POWER_SAVE
896 spec->loopback.amplist = preset->loopbacks;
900 /* Enable GPIO mask and set output */
901 static struct hda_verb alc_gpio1_init_verbs[] = {
902 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
903 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
904 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
908 static struct hda_verb alc_gpio2_init_verbs[] = {
909 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
910 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
911 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
915 static struct hda_verb alc_gpio3_init_verbs[] = {
916 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
917 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
918 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
923 * Fix hardware PLL issue
924 * On some codecs, the analog PLL gating control must be off while
925 * the default value is 1.
927 static void alc_fix_pll(struct hda_codec *codec)
929 struct alc_spec *spec = codec->spec;
934 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
936 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
937 AC_VERB_GET_PROC_COEF, 0);
938 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
940 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
941 val & ~(1 << spec->pll_coef_bit));
944 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
945 unsigned int coef_idx, unsigned int coef_bit)
947 struct alc_spec *spec = codec->spec;
949 spec->pll_coef_idx = coef_idx;
950 spec->pll_coef_bit = coef_bit;
954 static void alc_automute_pin(struct hda_codec *codec)
956 struct alc_spec *spec = codec->spec;
957 unsigned int present, pincap;
958 unsigned int nid = spec->autocfg.hp_pins[0];
961 pincap = snd_hda_query_pin_caps(codec, nid);
962 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
963 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
964 present = snd_hda_codec_read(codec, nid, 0,
965 AC_VERB_GET_PIN_SENSE, 0);
966 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
967 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
968 nid = spec->autocfg.speaker_pins[i];
971 snd_hda_codec_write(codec, nid, 0,
972 AC_VERB_SET_PIN_WIDGET_CONTROL,
973 spec->jack_present ? 0 : PIN_OUT);
977 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
980 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
983 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
984 for (i = 0; i < nums; i++)
990 static void alc_mic_automute(struct hda_codec *codec)
992 struct alc_spec *spec = codec->spec;
993 struct alc_mic_route *dead, *alive;
994 unsigned int present, type;
999 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1001 if (snd_BUG_ON(!spec->adc_nids))
1004 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1006 present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0,
1007 AC_VERB_GET_PIN_SENSE, 0);
1008 present &= AC_PINSENSE_PRESENCE;
1010 alive = &spec->ext_mic;
1011 dead = &spec->int_mic;
1013 alive = &spec->int_mic;
1014 dead = &spec->ext_mic;
1017 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1018 if (type == AC_WID_AUD_MIX) {
1019 /* Matrix-mixer style (e.g. ALC882) */
1020 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1023 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1025 HDA_AMP_MUTE, HDA_AMP_MUTE);
1027 /* MUX style (e.g. ALC880) */
1028 snd_hda_codec_write_cache(codec, cap_nid, 0,
1029 AC_VERB_SET_CONNECT_SEL,
1033 /* FIXME: analog mixer */
1036 /* unsolicited event for HP jack sensing */
1037 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1039 if (codec->vendor_id == 0x10ec0880)
1044 case ALC880_HP_EVENT:
1045 alc_automute_pin(codec);
1047 case ALC880_MIC_EVENT:
1048 alc_mic_automute(codec);
1053 static void alc_inithook(struct hda_codec *codec)
1055 alc_automute_pin(codec);
1056 alc_mic_automute(codec);
1059 /* additional initialization for ALC888 variants */
1060 static void alc888_coef_init(struct hda_codec *codec)
1064 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1065 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1066 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1067 if ((tmp & 0xf0) == 0x20)
1069 snd_hda_codec_read(codec, 0x20, 0,
1070 AC_VERB_SET_PROC_COEF, 0x830);
1073 snd_hda_codec_read(codec, 0x20, 0,
1074 AC_VERB_SET_PROC_COEF, 0x3030);
1077 static void alc889_coef_init(struct hda_codec *codec)
1081 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1082 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1083 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1084 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1087 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1092 case ALC_INIT_GPIO1:
1093 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1095 case ALC_INIT_GPIO2:
1096 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1098 case ALC_INIT_GPIO3:
1099 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1101 case ALC_INIT_DEFAULT:
1102 switch (codec->vendor_id) {
1104 snd_hda_codec_write(codec, 0x0f, 0,
1105 AC_VERB_SET_EAPD_BTLENABLE, 2);
1106 snd_hda_codec_write(codec, 0x10, 0,
1107 AC_VERB_SET_EAPD_BTLENABLE, 2);
1119 snd_hda_codec_write(codec, 0x14, 0,
1120 AC_VERB_SET_EAPD_BTLENABLE, 2);
1121 snd_hda_codec_write(codec, 0x15, 0,
1122 AC_VERB_SET_EAPD_BTLENABLE, 2);
1125 switch (codec->vendor_id) {
1127 snd_hda_codec_write(codec, 0x1a, 0,
1128 AC_VERB_SET_COEF_INDEX, 7);
1129 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1130 AC_VERB_GET_PROC_COEF, 0);
1131 snd_hda_codec_write(codec, 0x1a, 0,
1132 AC_VERB_SET_COEF_INDEX, 7);
1133 snd_hda_codec_write(codec, 0x1a, 0,
1134 AC_VERB_SET_PROC_COEF,
1144 alc889_coef_init(codec);
1147 alc888_coef_init(codec);
1151 snd_hda_codec_write(codec, 0x20, 0,
1152 AC_VERB_SET_COEF_INDEX, 7);
1153 tmp = snd_hda_codec_read(codec, 0x20, 0,
1154 AC_VERB_GET_PROC_COEF, 0);
1155 snd_hda_codec_write(codec, 0x20, 0,
1156 AC_VERB_SET_COEF_INDEX, 7);
1157 snd_hda_codec_write(codec, 0x20, 0,
1158 AC_VERB_SET_PROC_COEF,
1166 static void alc_init_auto_hp(struct hda_codec *codec)
1168 struct alc_spec *spec = codec->spec;
1170 if (!spec->autocfg.hp_pins[0])
1173 if (!spec->autocfg.speaker_pins[0]) {
1174 if (spec->autocfg.line_out_pins[0] &&
1175 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1176 spec->autocfg.speaker_pins[0] =
1177 spec->autocfg.line_out_pins[0];
1182 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1183 spec->autocfg.hp_pins[0]);
1184 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1185 AC_VERB_SET_UNSOLICITED_ENABLE,
1186 AC_USRSP_EN | ALC880_HP_EVENT);
1187 spec->unsol_event = alc_sku_unsol_event;
1190 static void alc_init_auto_mic(struct hda_codec *codec)
1192 struct alc_spec *spec = codec->spec;
1193 struct auto_pin_cfg *cfg = &spec->autocfg;
1194 hda_nid_t fixed, ext;
1197 /* there must be only two mic inputs exclusively */
1198 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1199 if (cfg->input_pins[i])
1203 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1204 hda_nid_t nid = cfg->input_pins[i];
1205 unsigned int defcfg;
1208 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1209 switch (get_defcfg_connect(defcfg)) {
1210 case AC_JACK_PORT_FIXED:
1212 return; /* already occupied */
1215 case AC_JACK_PORT_COMPLEX:
1217 return; /* already occupied */
1221 return; /* invalid entry */
1224 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1225 return; /* no unsol support */
1226 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1228 spec->ext_mic.pin = ext;
1229 spec->int_mic.pin = fixed;
1230 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1231 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1233 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1234 AC_VERB_SET_UNSOLICITED_ENABLE,
1235 AC_USRSP_EN | ALC880_MIC_EVENT);
1236 spec->unsol_event = alc_sku_unsol_event;
1239 /* check subsystem ID and set up device-specific initialization;
1240 * return 1 if initialized, 0 if invalid SSID
1242 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1243 * 31 ~ 16 : Manufacture ID
1245 * 7 ~ 0 : Assembly ID
1246 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1248 static int alc_subsystem_id(struct hda_codec *codec,
1249 hda_nid_t porta, hda_nid_t porte,
1252 unsigned int ass, tmp, i;
1254 struct alc_spec *spec = codec->spec;
1256 ass = codec->subsystem_id & 0xffff;
1257 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1260 /* invalid SSID, check the special NID pin defcfg instead */
1262 * 31~30 : port connectivity
1265 * 19~16 : Check sum (15:1)
1270 if (codec->vendor_id == 0x10ec0260)
1272 ass = snd_hda_codec_get_pincfg(codec, nid);
1273 snd_printd("realtek: No valid SSID, "
1274 "checking pincfg 0x%08x for NID 0x%x\n",
1276 if (!(ass & 1) && !(ass & 0x100000))
1278 if ((ass >> 30) != 1) /* no physical connection */
1283 for (i = 1; i < 16; i++) {
1287 if (((ass >> 16) & 0xf) != tmp)
1290 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1291 ass & 0xffff, codec->vendor_id);
1295 * 2 : 0 --> Desktop, 1 --> Laptop
1296 * 3~5 : External Amplifier control
1299 tmp = (ass & 0x38) >> 3; /* external Amp control */
1302 spec->init_amp = ALC_INIT_GPIO1;
1305 spec->init_amp = ALC_INIT_GPIO2;
1308 spec->init_amp = ALC_INIT_GPIO3;
1311 spec->init_amp = ALC_INIT_DEFAULT;
1315 /* is laptop or Desktop and enable the function "Mute internal speaker
1316 * when the external headphone out jack is plugged"
1318 if (!(ass & 0x8000))
1321 * 10~8 : Jack location
1322 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1324 * 15 : 1 --> enable the function "Mute internal speaker
1325 * when the external headphone out jack is plugged"
1327 if (!spec->autocfg.hp_pins[0]) {
1328 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1330 spec->autocfg.hp_pins[0] = porta;
1332 spec->autocfg.hp_pins[0] = porte;
1334 spec->autocfg.hp_pins[0] = portd;
1339 alc_init_auto_hp(codec);
1340 alc_init_auto_mic(codec);
1344 static void alc_ssid_check(struct hda_codec *codec,
1345 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1347 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1348 struct alc_spec *spec = codec->spec;
1349 snd_printd("realtek: "
1350 "Enable default setup for auto mode as fallback\n");
1351 spec->init_amp = ALC_INIT_DEFAULT;
1352 alc_init_auto_hp(codec);
1353 alc_init_auto_mic(codec);
1358 * Fix-up pin default configurations
1366 static void alc_fix_pincfg(struct hda_codec *codec,
1367 const struct snd_pci_quirk *quirk,
1368 const struct alc_pincfg **pinfix)
1370 const struct alc_pincfg *cfg;
1372 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1376 cfg = pinfix[quirk->value];
1377 for (; cfg->nid; cfg++)
1378 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1388 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1389 /* Mic-in jack as mic in */
1390 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1391 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1392 /* Line-in jack as Line in */
1393 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1394 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1395 /* Line-Out as Front */
1396 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1403 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1404 /* Mic-in jack as mic in */
1405 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1406 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1407 /* Line-in jack as Surround */
1408 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1409 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1410 /* Line-Out as Front */
1411 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1418 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1419 /* Mic-in jack as CLFE */
1420 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1421 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1422 /* Line-in jack as Surround */
1423 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1424 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1425 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1426 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1433 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1434 /* Mic-in jack as CLFE */
1435 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1436 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1437 /* Line-in jack as Surround */
1438 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1439 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1440 /* Line-Out as Side */
1441 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1445 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1446 { 2, alc888_4ST_ch2_intel_init },
1447 { 4, alc888_4ST_ch4_intel_init },
1448 { 6, alc888_4ST_ch6_intel_init },
1449 { 8, alc888_4ST_ch8_intel_init },
1453 * ALC888 Fujitsu Siemens Amillo xa3530
1456 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1457 /* Front Mic: set to PIN_IN (empty by default) */
1458 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1459 /* Connect Internal HP to Front */
1460 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1461 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1462 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1463 /* Connect Bass HP to Front */
1464 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1465 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1466 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1467 /* Connect Line-Out side jack (SPDIF) to Side */
1468 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1469 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1470 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1471 /* Connect Mic jack to CLFE */
1472 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1473 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1474 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1475 /* Connect Line-in jack to Surround */
1476 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1477 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1478 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1479 /* Connect HP out jack to Front */
1480 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1481 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1482 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1483 /* Enable unsolicited event for HP jack and Line-out jack */
1484 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1485 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1489 static void alc_automute_amp(struct hda_codec *codec)
1491 struct alc_spec *spec = codec->spec;
1492 unsigned int val, mute, pincap;
1496 spec->jack_present = 0;
1497 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1498 nid = spec->autocfg.hp_pins[i];
1501 pincap = snd_hda_query_pin_caps(codec, nid);
1502 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1503 snd_hda_codec_read(codec, nid, 0,
1504 AC_VERB_SET_PIN_SENSE, 0);
1505 val = snd_hda_codec_read(codec, nid, 0,
1506 AC_VERB_GET_PIN_SENSE, 0);
1507 if (val & AC_PINSENSE_PRESENCE) {
1508 spec->jack_present = 1;
1513 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1514 /* Toggle internal speakers muting */
1515 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1516 nid = spec->autocfg.speaker_pins[i];
1519 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1520 HDA_AMP_MUTE, mute);
1524 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1527 if (codec->vendor_id == 0x10ec0880)
1531 if (res == ALC880_HP_EVENT)
1532 alc_automute_amp(codec);
1535 static void alc889_automute_init(struct hda_codec *codec)
1537 struct alc_spec *spec = codec->spec;
1539 spec->autocfg.hp_pins[0] = 0x15;
1540 spec->autocfg.speaker_pins[0] = 0x14;
1541 spec->autocfg.speaker_pins[1] = 0x16;
1542 spec->autocfg.speaker_pins[2] = 0x17;
1543 spec->autocfg.speaker_pins[3] = 0x19;
1544 spec->autocfg.speaker_pins[4] = 0x1a;
1545 alc_automute_amp(codec);
1548 static void alc889_intel_init_hook(struct hda_codec *codec)
1550 alc889_coef_init(codec);
1551 alc889_automute_init(codec);
1554 static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec)
1556 struct alc_spec *spec = codec->spec;
1558 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1559 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1560 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1561 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1562 alc_automute_amp(codec);
1566 * ALC888 Acer Aspire 4930G model
1569 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1570 /* Front Mic: set to PIN_IN (empty by default) */
1571 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1572 /* Unselect Front Mic by default in input mixer 3 */
1573 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1574 /* Enable unsolicited event for HP jack */
1575 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1576 /* Connect Internal HP to front */
1577 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1578 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1579 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1580 /* Connect HP out to front */
1581 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1582 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1583 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1588 * ALC888 Acer Aspire 6530G model
1591 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1592 /* Bias voltage on for external mic port */
1593 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1594 /* Front Mic: set to PIN_IN (empty by default) */
1595 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1596 /* Unselect Front Mic by default in input mixer 3 */
1597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1598 /* Enable unsolicited event for HP jack */
1599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1600 /* Enable speaker output */
1601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1602 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1603 /* Enable headphone output */
1604 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1605 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1606 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1611 * ALC889 Acer Aspire 8930G model
1614 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1615 /* Front Mic: set to PIN_IN (empty by default) */
1616 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1617 /* Unselect Front Mic by default in input mixer 3 */
1618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1619 /* Enable unsolicited event for HP jack */
1620 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1621 /* Connect Internal Front to Front */
1622 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1623 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1624 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1625 /* Connect Internal Rear to Rear */
1626 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1627 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1628 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1629 /* Connect Internal CLFE to CLFE */
1630 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1631 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1632 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1633 /* Connect HP out to Front */
1634 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1635 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1636 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1637 /* Enable all DACs */
1638 /* DAC DISABLE/MUTE 1? */
1639 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1640 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1641 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1642 /* DAC DISABLE/MUTE 2? */
1643 /* some bit here disables the other DACs. Init=0x4900 */
1644 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1645 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1646 /* Enable amplifiers */
1647 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1648 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1650 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1651 * which makes the stereo useless. However, either the mic or the ALC889
1652 * makes the signal become a difference/sum signal instead of standard
1653 * stereo, which is annoying. So instead we flip this bit which makes the
1654 * codec replicate the sum signal to both channels, turning it into a
1657 /* DMIC_CONTROL? Init value = 0x0001 */
1658 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1659 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1663 static struct hda_input_mux alc888_2_capture_sources[2] = {
1664 /* Front mic only available on one ADC */
1671 { "Front Mic", 0xb },
1684 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1685 /* Interal mic only available on one ADC */
1692 { "Input Mix", 0xa },
1702 { "Input Mix", 0xa },
1707 static struct hda_input_mux alc889_capture_sources[3] = {
1708 /* Digital mic only available on first "ADC" */
1715 { "Front Mic", 0xb },
1716 { "Input Mix", 0xa },
1725 { "Input Mix", 0xa },
1734 { "Input Mix", 0xa },
1739 static struct snd_kcontrol_new alc888_base_mixer[] = {
1740 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1741 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1742 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1743 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1744 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1746 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1747 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1748 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1749 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1750 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1751 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1752 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1753 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1754 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1755 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1756 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1757 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1761 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec)
1763 struct alc_spec *spec = codec->spec;
1765 spec->autocfg.hp_pins[0] = 0x15;
1766 spec->autocfg.speaker_pins[0] = 0x14;
1767 alc_automute_amp(codec);
1770 static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec)
1772 struct alc_spec *spec = codec->spec;
1774 spec->autocfg.hp_pins[0] = 0x15;
1775 spec->autocfg.speaker_pins[0] = 0x14;
1776 spec->autocfg.speaker_pins[1] = 0x16;
1777 spec->autocfg.speaker_pins[2] = 0x17;
1778 alc_automute_amp(codec);
1781 static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec)
1783 struct alc_spec *spec = codec->spec;
1785 spec->autocfg.hp_pins[0] = 0x15;
1786 spec->autocfg.speaker_pins[0] = 0x14;
1787 spec->autocfg.speaker_pins[1] = 0x16;
1788 spec->autocfg.speaker_pins[2] = 0x1b;
1789 alc_automute_amp(codec);
1793 * ALC880 3-stack model
1795 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1796 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1797 * F-Mic = 0x1b, HP = 0x19
1800 static hda_nid_t alc880_dac_nids[4] = {
1801 /* front, rear, clfe, rear_surr */
1802 0x02, 0x05, 0x04, 0x03
1805 static hda_nid_t alc880_adc_nids[3] = {
1810 /* The datasheet says the node 0x07 is connected from inputs,
1811 * but it shows zero connection in the real implementation on some devices.
1812 * Note: this is a 915GAV bug, fixed on 915GLV
1814 static hda_nid_t alc880_adc_nids_alt[2] = {
1819 #define ALC880_DIGOUT_NID 0x06
1820 #define ALC880_DIGIN_NID 0x0a
1822 static struct hda_input_mux alc880_capture_source = {
1826 { "Front Mic", 0x3 },
1832 /* channel source setting (2/6 channel selection for 3-stack) */
1834 static struct hda_verb alc880_threestack_ch2_init[] = {
1835 /* set line-in to input, mute it */
1836 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1837 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1838 /* set mic-in to input vref 80%, mute it */
1839 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1840 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1845 static struct hda_verb alc880_threestack_ch6_init[] = {
1846 /* set line-in to output, unmute it */
1847 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1848 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1849 /* set mic-in to output, unmute it */
1850 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1851 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1855 static struct hda_channel_mode alc880_threestack_modes[2] = {
1856 { 2, alc880_threestack_ch2_init },
1857 { 6, alc880_threestack_ch6_init },
1860 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1861 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1862 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1863 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1864 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1865 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1866 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1867 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1868 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1869 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1870 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1871 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1872 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1875 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1876 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1877 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1879 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1880 .name = "Channel Mode",
1881 .info = alc_ch_mode_info,
1882 .get = alc_ch_mode_get,
1883 .put = alc_ch_mode_put,
1888 /* capture mixer elements */
1889 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1890 struct snd_ctl_elem_info *uinfo)
1892 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1893 struct alc_spec *spec = codec->spec;
1896 mutex_lock(&codec->control_mutex);
1897 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1899 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1900 mutex_unlock(&codec->control_mutex);
1904 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1905 unsigned int size, unsigned int __user *tlv)
1907 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1908 struct alc_spec *spec = codec->spec;
1911 mutex_lock(&codec->control_mutex);
1912 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1914 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1915 mutex_unlock(&codec->control_mutex);
1919 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1920 struct snd_ctl_elem_value *ucontrol);
1922 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1923 struct snd_ctl_elem_value *ucontrol,
1926 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1927 struct alc_spec *spec = codec->spec;
1928 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1931 mutex_lock(&codec->control_mutex);
1932 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1934 err = func(kcontrol, ucontrol);
1935 mutex_unlock(&codec->control_mutex);
1939 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1940 struct snd_ctl_elem_value *ucontrol)
1942 return alc_cap_getput_caller(kcontrol, ucontrol,
1943 snd_hda_mixer_amp_volume_get);
1946 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1947 struct snd_ctl_elem_value *ucontrol)
1949 return alc_cap_getput_caller(kcontrol, ucontrol,
1950 snd_hda_mixer_amp_volume_put);
1953 /* capture mixer elements */
1954 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1956 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1957 struct snd_ctl_elem_value *ucontrol)
1959 return alc_cap_getput_caller(kcontrol, ucontrol,
1960 snd_hda_mixer_amp_switch_get);
1963 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1964 struct snd_ctl_elem_value *ucontrol)
1966 return alc_cap_getput_caller(kcontrol, ucontrol,
1967 snd_hda_mixer_amp_switch_put);
1970 #define _DEFINE_CAPMIX(num) \
1972 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1973 .name = "Capture Switch", \
1974 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1976 .info = alc_cap_sw_info, \
1977 .get = alc_cap_sw_get, \
1978 .put = alc_cap_sw_put, \
1981 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1982 .name = "Capture Volume", \
1983 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1984 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1985 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1987 .info = alc_cap_vol_info, \
1988 .get = alc_cap_vol_get, \
1989 .put = alc_cap_vol_put, \
1990 .tlv = { .c = alc_cap_vol_tlv }, \
1993 #define _DEFINE_CAPSRC(num) \
1995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1996 /* .name = "Capture Source", */ \
1997 .name = "Input Source", \
1999 .info = alc_mux_enum_info, \
2000 .get = alc_mux_enum_get, \
2001 .put = alc_mux_enum_put, \
2004 #define DEFINE_CAPMIX(num) \
2005 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2006 _DEFINE_CAPMIX(num), \
2007 _DEFINE_CAPSRC(num), \
2011 #define DEFINE_CAPMIX_NOSRC(num) \
2012 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2013 _DEFINE_CAPMIX(num), \
2017 /* up to three ADCs */
2021 DEFINE_CAPMIX_NOSRC(1);
2022 DEFINE_CAPMIX_NOSRC(2);
2023 DEFINE_CAPMIX_NOSRC(3);
2026 * ALC880 5-stack model
2028 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2030 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2031 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2034 /* additional mixers to alc880_three_stack_mixer */
2035 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2036 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2037 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2041 /* channel source setting (6/8 channel selection for 5-stack) */
2043 static struct hda_verb alc880_fivestack_ch6_init[] = {
2044 /* set line-in to input, mute it */
2045 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2046 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2051 static struct hda_verb alc880_fivestack_ch8_init[] = {
2052 /* set line-in to output, unmute it */
2053 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2054 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2058 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2059 { 6, alc880_fivestack_ch6_init },
2060 { 8, alc880_fivestack_ch8_init },
2065 * ALC880 6-stack model
2067 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2068 * Side = 0x05 (0x0f)
2069 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2070 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2073 static hda_nid_t alc880_6st_dac_nids[4] = {
2074 /* front, rear, clfe, rear_surr */
2075 0x02, 0x03, 0x04, 0x05
2078 static struct hda_input_mux alc880_6stack_capture_source = {
2082 { "Front Mic", 0x1 },
2088 /* fixed 8-channels */
2089 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2093 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2094 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2095 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2096 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2097 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2098 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2099 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2100 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2101 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2102 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2103 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2104 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2105 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2106 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2107 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2110 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2113 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2114 .name = "Channel Mode",
2115 .info = alc_ch_mode_info,
2116 .get = alc_ch_mode_get,
2117 .put = alc_ch_mode_put,
2126 * W810 has rear IO for:
2129 * Center/LFE (DAC 04)
2132 * The system also has a pair of internal speakers, and a headphone jack.
2133 * These are both connected to Line2 on the codec, hence to DAC 02.
2135 * There is a variable resistor to control the speaker or headphone
2136 * volume. This is a hardware-only device without a software API.
2138 * Plugging headphones in will disable the internal speakers. This is
2139 * implemented in hardware, not via the driver using jack sense. In
2140 * a similar fashion, plugging into the rear socket marked "front" will
2141 * disable both the speakers and headphones.
2143 * For input, there's a microphone jack, and an "audio in" jack.
2144 * These may not do anything useful with this driver yet, because I
2145 * haven't setup any initialization verbs for these yet...
2148 static hda_nid_t alc880_w810_dac_nids[3] = {
2149 /* front, rear/surround, clfe */
2153 /* fixed 6 channels */
2154 static struct hda_channel_mode alc880_w810_modes[1] = {
2158 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2159 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2160 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2161 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2162 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2163 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2164 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2165 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2166 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2167 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2176 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2177 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2181 static hda_nid_t alc880_z71v_dac_nids[1] = {
2184 #define ALC880_Z71V_HP_DAC 0x03
2186 /* fixed 2 channels */
2187 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2191 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2192 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2193 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2194 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2195 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2196 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2197 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2205 * ALC880 F1734 model
2207 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2208 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2211 static hda_nid_t alc880_f1734_dac_nids[1] = {
2214 #define ALC880_F1734_HP_DAC 0x02
2216 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2217 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2219 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2220 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2221 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2222 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2228 static struct hda_input_mux alc880_f1734_capture_source = {
2240 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2241 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2242 * Mic = 0x18, Line = 0x1a
2245 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2246 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2248 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2249 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2250 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2251 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2252 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2253 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2254 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2255 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2256 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2257 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2258 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2259 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2260 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2262 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2264 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2265 .name = "Channel Mode",
2266 .info = alc_ch_mode_info,
2267 .get = alc_ch_mode_get,
2268 .put = alc_ch_mode_put,
2274 * ALC880 ASUS W1V model
2276 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2277 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2278 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2281 /* additional mixers to alc880_asus_mixer */
2282 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2283 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2284 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2289 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2290 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2291 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2293 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2294 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2297 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2298 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2303 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2304 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2305 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2306 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2307 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2308 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2309 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2310 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2311 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2312 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2313 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2314 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2315 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2317 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2318 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2319 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2321 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2322 .name = "Channel Mode",
2323 .info = alc_ch_mode_info,
2324 .get = alc_ch_mode_get,
2325 .put = alc_ch_mode_put,
2330 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2331 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2332 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2333 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2334 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2335 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2336 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2337 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2338 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2339 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2340 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2344 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2345 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2346 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2347 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2348 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2350 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2355 * virtual master controls
2359 * slave controls for virtual master
2361 static const char *alc_slave_vols[] = {
2362 "Front Playback Volume",
2363 "Surround Playback Volume",
2364 "Center Playback Volume",
2365 "LFE Playback Volume",
2366 "Side Playback Volume",
2367 "Headphone Playback Volume",
2368 "Speaker Playback Volume",
2369 "Mono Playback Volume",
2370 "Line-Out Playback Volume",
2371 "PCM Playback Volume",
2375 static const char *alc_slave_sws[] = {
2376 "Front Playback Switch",
2377 "Surround Playback Switch",
2378 "Center Playback Switch",
2379 "LFE Playback Switch",
2380 "Side Playback Switch",
2381 "Headphone Playback Switch",
2382 "Speaker Playback Switch",
2383 "Mono Playback Switch",
2384 "IEC958 Playback Switch",
2389 * build control elements
2392 static void alc_free_kctls(struct hda_codec *codec);
2394 /* additional beep mixers; the actual parameters are overwritten at build */
2395 static struct snd_kcontrol_new alc_beep_mixer[] = {
2396 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2397 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2401 static int alc_build_controls(struct hda_codec *codec)
2403 struct alc_spec *spec = codec->spec;
2407 for (i = 0; i < spec->num_mixers; i++) {
2408 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2412 if (spec->cap_mixer) {
2413 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2417 if (spec->multiout.dig_out_nid) {
2418 err = snd_hda_create_spdif_out_ctls(codec,
2419 spec->multiout.dig_out_nid);
2422 if (!spec->no_analog) {
2423 err = snd_hda_create_spdif_share_sw(codec,
2427 spec->multiout.share_spdif = 1;
2430 if (spec->dig_in_nid) {
2431 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2436 /* create beep controls if needed */
2437 if (spec->beep_amp) {
2438 struct snd_kcontrol_new *knew;
2439 for (knew = alc_beep_mixer; knew->name; knew++) {
2440 struct snd_kcontrol *kctl;
2441 kctl = snd_ctl_new1(knew, codec);
2444 kctl->private_value = spec->beep_amp;
2445 err = snd_hda_ctl_add(codec, kctl);
2451 /* if we have no master control, let's create it */
2452 if (!spec->no_analog &&
2453 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2454 unsigned int vmaster_tlv[4];
2455 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2456 HDA_OUTPUT, vmaster_tlv);
2457 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2458 vmaster_tlv, alc_slave_vols);
2462 if (!spec->no_analog &&
2463 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2464 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2465 NULL, alc_slave_sws);
2470 alc_free_kctls(codec); /* no longer needed */
2476 * initialize the codec volumes, etc
2480 * generic initialization of ADC, input mixers and output mixers
2482 static struct hda_verb alc880_volume_init_verbs[] = {
2484 * Unmute ADC0-2 and set the default input to mic-in
2486 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2488 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2489 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2490 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2491 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2493 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2495 * Note: PASD motherboards uses the Line In 2 as the input for front
2498 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2499 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2500 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2501 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2508 * Set up output mixers (0x0c - 0x0f)
2510 /* set vol=0 to output mixers */
2511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2513 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2514 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2515 /* set up input amps for analog loopback */
2516 /* Amp Indices: DAC = 0, mixer = 1 */
2517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2519 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2521 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2522 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2523 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2524 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2530 * 3-stack pin configuration:
2531 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2533 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2535 * preset connection lists of input pins
2536 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2538 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2539 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2540 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2543 * Set pin mode and muting
2545 /* set front pin widgets 0x14 for output */
2546 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2548 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2549 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2550 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2551 /* Mic2 (as headphone out) for HP output */
2552 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2553 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2554 /* Line In pin widget for input */
2555 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2556 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2557 /* Line2 (as front mic) pin widget for input and vref at 80% */
2558 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2559 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2560 /* CD pin widget for input */
2561 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2567 * 5-stack pin configuration:
2568 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2569 * line-in/side = 0x1a, f-mic = 0x1b
2571 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2573 * preset connection lists of input pins
2574 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2576 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2577 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2580 * Set pin mode and muting
2582 /* set pin widgets 0x14-0x17 for output */
2583 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2584 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2585 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2586 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2587 /* unmute pins for output (no gain on this amp) */
2588 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2589 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2590 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2591 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2593 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2594 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2595 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2596 /* Mic2 (as headphone out) for HP output */
2597 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2598 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2599 /* Line In pin widget for input */
2600 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2601 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2602 /* Line2 (as front mic) pin widget for input and vref at 80% */
2603 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2604 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2605 /* CD pin widget for input */
2606 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2612 * W810 pin configuration:
2613 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2615 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2616 /* hphone/speaker input selector: front DAC */
2617 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2619 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2620 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2622 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2623 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2624 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2626 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2627 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2633 * Z71V pin configuration:
2634 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2636 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2637 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2638 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2639 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2642 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2643 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2644 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2645 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2651 * 6-stack pin configuration:
2652 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2653 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2655 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2656 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2658 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2659 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2661 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2662 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2663 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2664 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2665 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2667 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2668 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2669 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2670 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2671 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2672 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2673 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2674 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2675 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2681 * Uniwill pin configuration:
2682 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2685 static struct hda_verb alc880_uniwill_init_verbs[] = {
2686 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2689 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2692 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2693 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2694 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2695 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2697 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2698 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2699 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2700 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2701 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2703 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2704 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2705 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2706 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2707 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2708 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2709 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2710 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2711 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2713 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2714 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2721 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2723 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2724 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2726 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2727 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2729 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2730 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2731 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2734 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2735 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2736 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2737 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2739 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2743 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2744 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2746 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2747 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2752 static struct hda_verb alc880_beep_init_verbs[] = {
2753 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2757 /* auto-toggle front mic */
2758 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2760 unsigned int present;
2763 present = snd_hda_codec_read(codec, 0x18, 0,
2764 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2765 bits = present ? HDA_AMP_MUTE : 0;
2766 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2769 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2771 struct alc_spec *spec = codec->spec;
2773 spec->autocfg.hp_pins[0] = 0x14;
2774 spec->autocfg.speaker_pins[0] = 0x15;
2775 spec->autocfg.speaker_pins[0] = 0x16;
2776 alc_automute_amp(codec);
2777 alc880_uniwill_mic_automute(codec);
2780 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2783 /* Looks like the unsol event is incompatible with the standard
2784 * definition. 4bit tag is placed at 28 bit!
2786 switch (res >> 28) {
2787 case ALC880_MIC_EVENT:
2788 alc880_uniwill_mic_automute(codec);
2791 alc_automute_amp_unsol_event(codec, res);
2796 static void alc880_uniwill_p53_init_hook(struct hda_codec *codec)
2798 struct alc_spec *spec = codec->spec;
2800 spec->autocfg.hp_pins[0] = 0x14;
2801 spec->autocfg.speaker_pins[0] = 0x15;
2802 alc_automute_amp(codec);
2805 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2807 unsigned int present;
2809 present = snd_hda_codec_read(codec, 0x21, 0,
2810 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2811 present &= HDA_AMP_VOLMASK;
2812 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2813 HDA_AMP_VOLMASK, present);
2814 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2815 HDA_AMP_VOLMASK, present);
2818 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2821 /* Looks like the unsol event is incompatible with the standard
2822 * definition. 4bit tag is placed at 28 bit!
2824 if ((res >> 28) == ALC880_DCVOL_EVENT)
2825 alc880_uniwill_p53_dcvol_automute(codec);
2827 alc_automute_amp_unsol_event(codec, res);
2831 * F1734 pin configuration:
2832 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2834 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2835 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2836 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2837 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2838 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2839 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2841 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2842 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2843 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2844 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2846 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2847 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2848 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2849 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2850 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2851 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2852 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2853 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2854 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2856 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2857 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2863 * ASUS pin configuration:
2864 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2866 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2867 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2868 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2869 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2870 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2872 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2873 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2874 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2875 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2876 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2877 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2878 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2881 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2882 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2883 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2884 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2885 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2886 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2887 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2888 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2889 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2894 /* Enable GPIO mask and set output */
2895 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2896 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2897 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2899 /* Clevo m520g init */
2900 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2901 /* headphone output */
2902 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2904 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2905 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2907 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2908 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2910 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2911 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2912 /* Mic1 (rear panel) */
2913 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2914 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2915 /* Mic2 (front panel) */
2916 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2917 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2919 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2920 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2921 /* change to EAPD mode */
2922 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2923 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2928 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2929 /* change to EAPD mode */
2930 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2931 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2933 /* Headphone output */
2934 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2936 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2937 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2939 /* Line In pin widget for input */
2940 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2941 /* CD pin widget for input */
2942 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2943 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2944 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2946 /* change to EAPD mode */
2947 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2948 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2954 * LG m1 express dual
2957 * Rear Line-In/Out (blue): 0x14
2958 * Build-in Mic-In: 0x15
2960 * HP-Out (green): 0x1b
2961 * Mic-In/Out (red): 0x19
2965 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2966 static hda_nid_t alc880_lg_dac_nids[3] = {
2970 /* seems analog CD is not working */
2971 static struct hda_input_mux alc880_lg_capture_source = {
2976 { "Internal Mic", 0x6 },
2980 /* 2,4,6 channel modes */
2981 static struct hda_verb alc880_lg_ch2_init[] = {
2982 /* set line-in and mic-in to input */
2983 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2984 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2988 static struct hda_verb alc880_lg_ch4_init[] = {
2989 /* set line-in to out and mic-in to input */
2990 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2991 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2995 static struct hda_verb alc880_lg_ch6_init[] = {
2996 /* set line-in and mic-in to output */
2997 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2998 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3002 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3003 { 2, alc880_lg_ch2_init },
3004 { 4, alc880_lg_ch4_init },
3005 { 6, alc880_lg_ch6_init },
3008 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3009 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3010 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3011 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3012 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3013 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3014 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3015 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3016 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3018 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3019 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3020 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3021 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3022 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3024 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3025 .name = "Channel Mode",
3026 .info = alc_ch_mode_info,
3027 .get = alc_ch_mode_get,
3028 .put = alc_ch_mode_put,
3033 static struct hda_verb alc880_lg_init_verbs[] = {
3034 /* set capture source to mic-in */
3035 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3036 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3037 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3038 /* mute all amp mixer inputs */
3039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3042 /* line-in to input */
3043 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3044 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3046 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3047 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3049 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3050 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3051 /* mic-in to input */
3052 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3053 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3054 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3056 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3057 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3058 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3060 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3064 /* toggle speaker-output according to the hp-jack state */
3065 static void alc880_lg_init_hook(struct hda_codec *codec)
3067 struct alc_spec *spec = codec->spec;
3069 spec->autocfg.hp_pins[0] = 0x1b;
3070 spec->autocfg.speaker_pins[0] = 0x17;
3071 alc_automute_amp(codec);
3080 * Built-in Mic-In: 0x19
3086 static struct hda_input_mux alc880_lg_lw_capture_source = {
3090 { "Internal Mic", 0x1 },
3095 #define alc880_lg_lw_modes alc880_threestack_modes
3097 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3098 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3099 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3100 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3101 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3102 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3103 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3104 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3105 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3106 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3107 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3110 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3111 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3113 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3114 .name = "Channel Mode",
3115 .info = alc_ch_mode_info,
3116 .get = alc_ch_mode_get,
3117 .put = alc_ch_mode_put,
3122 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3123 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3124 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3125 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3127 /* set capture source to mic-in */
3128 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3129 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3130 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3133 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3134 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3136 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3137 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3138 /* mic-in to input */
3139 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3140 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3142 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3143 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3145 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3149 /* toggle speaker-output according to the hp-jack state */
3150 static void alc880_lg_lw_init_hook(struct hda_codec *codec)
3152 struct alc_spec *spec = codec->spec;
3154 spec->autocfg.hp_pins[0] = 0x1b;
3155 spec->autocfg.speaker_pins[0] = 0x14;
3156 alc_automute_amp(codec);
3159 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3160 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3161 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3162 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3163 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3164 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3165 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3169 static struct hda_input_mux alc880_medion_rim_capture_source = {
3173 { "Internal Mic", 0x1 },
3177 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3178 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3180 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3181 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3183 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3184 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3185 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3186 /* Mic2 (as headphone out) for HP output */
3187 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3188 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3189 /* Internal Speaker */
3190 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3191 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3193 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3194 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3196 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3200 /* toggle speaker-output according to the hp-jack state */
3201 static void alc880_medion_rim_automute(struct hda_codec *codec)
3203 struct alc_spec *spec = codec->spec;
3204 alc_automute_amp(codec);
3206 if (spec->jack_present)
3207 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3209 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3212 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3215 /* Looks like the unsol event is incompatible with the standard
3216 * definition. 4bit tag is placed at 28 bit!
3218 if ((res >> 28) == ALC880_HP_EVENT)
3219 alc880_medion_rim_automute(codec);
3222 static void alc880_medion_rim_init_hook(struct hda_codec *codec)
3224 struct alc_spec *spec = codec->spec;
3226 spec->autocfg.hp_pins[0] = 0x14;
3227 spec->autocfg.speaker_pins[0] = 0x1b;
3228 alc880_medion_rim_automute(codec);
3231 #ifdef CONFIG_SND_HDA_POWER_SAVE
3232 static struct hda_amp_list alc880_loopbacks[] = {
3233 { 0x0b, HDA_INPUT, 0 },
3234 { 0x0b, HDA_INPUT, 1 },
3235 { 0x0b, HDA_INPUT, 2 },
3236 { 0x0b, HDA_INPUT, 3 },
3237 { 0x0b, HDA_INPUT, 4 },
3241 static struct hda_amp_list alc880_lg_loopbacks[] = {
3242 { 0x0b, HDA_INPUT, 1 },
3243 { 0x0b, HDA_INPUT, 6 },
3244 { 0x0b, HDA_INPUT, 7 },
3253 static int alc_init(struct hda_codec *codec)
3255 struct alc_spec *spec = codec->spec;
3259 alc_auto_init_amp(codec, spec->init_amp);
3261 for (i = 0; i < spec->num_init_verbs; i++)
3262 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3264 if (spec->init_hook)
3265 spec->init_hook(codec);
3270 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3272 struct alc_spec *spec = codec->spec;
3274 if (spec->unsol_event)
3275 spec->unsol_event(codec, res);
3278 #ifdef CONFIG_SND_HDA_POWER_SAVE
3279 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3281 struct alc_spec *spec = codec->spec;
3282 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3287 * Analog playback callbacks
3289 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3290 struct hda_codec *codec,
3291 struct snd_pcm_substream *substream)
3293 struct alc_spec *spec = codec->spec;
3294 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3298 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3299 struct hda_codec *codec,
3300 unsigned int stream_tag,
3301 unsigned int format,
3302 struct snd_pcm_substream *substream)
3304 struct alc_spec *spec = codec->spec;
3305 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3306 stream_tag, format, substream);
3309 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3310 struct hda_codec *codec,
3311 struct snd_pcm_substream *substream)
3313 struct alc_spec *spec = codec->spec;
3314 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3320 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3321 struct hda_codec *codec,
3322 struct snd_pcm_substream *substream)
3324 struct alc_spec *spec = codec->spec;
3325 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3328 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3329 struct hda_codec *codec,
3330 unsigned int stream_tag,
3331 unsigned int format,
3332 struct snd_pcm_substream *substream)
3334 struct alc_spec *spec = codec->spec;
3335 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3336 stream_tag, format, substream);
3339 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3340 struct hda_codec *codec,
3341 struct snd_pcm_substream *substream)
3343 struct alc_spec *spec = codec->spec;
3344 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3347 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3348 struct hda_codec *codec,
3349 struct snd_pcm_substream *substream)
3351 struct alc_spec *spec = codec->spec;
3352 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3358 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3359 struct hda_codec *codec,
3360 unsigned int stream_tag,
3361 unsigned int format,
3362 struct snd_pcm_substream *substream)
3364 struct alc_spec *spec = codec->spec;
3366 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3367 stream_tag, 0, format);
3371 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3372 struct hda_codec *codec,
3373 struct snd_pcm_substream *substream)
3375 struct alc_spec *spec = codec->spec;
3377 snd_hda_codec_cleanup_stream(codec,
3378 spec->adc_nids[substream->number + 1]);
3385 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3389 /* NID is set in alc_build_pcms */
3391 .open = alc880_playback_pcm_open,
3392 .prepare = alc880_playback_pcm_prepare,
3393 .cleanup = alc880_playback_pcm_cleanup
3397 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3401 /* NID is set in alc_build_pcms */
3404 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3408 /* NID is set in alc_build_pcms */
3411 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3412 .substreams = 2, /* can be overridden */
3415 /* NID is set in alc_build_pcms */
3417 .prepare = alc880_alt_capture_pcm_prepare,
3418 .cleanup = alc880_alt_capture_pcm_cleanup
3422 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3426 /* NID is set in alc_build_pcms */
3428 .open = alc880_dig_playback_pcm_open,
3429 .close = alc880_dig_playback_pcm_close,
3430 .prepare = alc880_dig_playback_pcm_prepare,
3431 .cleanup = alc880_dig_playback_pcm_cleanup
3435 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3439 /* NID is set in alc_build_pcms */
3442 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3443 static struct hda_pcm_stream alc_pcm_null_stream = {
3449 static int alc_build_pcms(struct hda_codec *codec)
3451 struct alc_spec *spec = codec->spec;
3452 struct hda_pcm *info = spec->pcm_rec;
3455 codec->num_pcms = 1;
3456 codec->pcm_info = info;
3458 if (spec->no_analog)
3461 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3462 "%s Analog", codec->chip_name);
3463 info->name = spec->stream_name_analog;
3465 if (spec->stream_analog_playback) {
3466 if (snd_BUG_ON(!spec->multiout.dac_nids))
3468 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3469 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3471 if (spec->stream_analog_capture) {
3472 if (snd_BUG_ON(!spec->adc_nids))
3474 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3475 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3478 if (spec->channel_mode) {
3479 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3480 for (i = 0; i < spec->num_channel_mode; i++) {
3481 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3482 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3488 /* SPDIF for stream index #1 */
3489 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3490 snprintf(spec->stream_name_digital,
3491 sizeof(spec->stream_name_digital),
3492 "%s Digital", codec->chip_name);
3493 codec->num_pcms = 2;
3494 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3495 info = spec->pcm_rec + 1;
3496 info->name = spec->stream_name_digital;
3497 if (spec->dig_out_type)
3498 info->pcm_type = spec->dig_out_type;
3500 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3501 if (spec->multiout.dig_out_nid &&
3502 spec->stream_digital_playback) {
3503 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3504 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3506 if (spec->dig_in_nid &&
3507 spec->stream_digital_capture) {
3508 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3509 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3511 /* FIXME: do we need this for all Realtek codec models? */
3512 codec->spdif_status_reset = 1;
3515 if (spec->no_analog)
3518 /* If the use of more than one ADC is requested for the current
3519 * model, configure a second analog capture-only PCM.
3521 /* Additional Analaog capture for index #2 */
3522 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3523 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3524 codec->num_pcms = 3;
3525 info = spec->pcm_rec + 2;
3526 info->name = spec->stream_name_analog;
3527 if (spec->alt_dac_nid) {
3528 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3529 *spec->stream_analog_alt_playback;
3530 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3533 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3534 alc_pcm_null_stream;
3535 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3537 if (spec->num_adc_nids > 1) {
3538 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3539 *spec->stream_analog_alt_capture;
3540 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3542 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3543 spec->num_adc_nids - 1;
3545 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3546 alc_pcm_null_stream;
3547 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3554 static void alc_free_kctls(struct hda_codec *codec)
3556 struct alc_spec *spec = codec->spec;
3558 if (spec->kctls.list) {
3559 struct snd_kcontrol_new *kctl = spec->kctls.list;
3561 for (i = 0; i < spec->kctls.used; i++)
3562 kfree(kctl[i].name);
3564 snd_array_free(&spec->kctls);
3567 static void alc_free(struct hda_codec *codec)
3569 struct alc_spec *spec = codec->spec;
3574 alc_free_kctls(codec);
3576 snd_hda_detach_beep_device(codec);
3579 #ifdef SND_HDA_NEEDS_RESUME
3580 static int alc_resume(struct hda_codec *codec)
3582 codec->patch_ops.init(codec);
3583 snd_hda_codec_resume_amp(codec);
3584 snd_hda_codec_resume_cache(codec);
3591 static struct hda_codec_ops alc_patch_ops = {
3592 .build_controls = alc_build_controls,
3593 .build_pcms = alc_build_pcms,
3596 .unsol_event = alc_unsol_event,
3597 #ifdef SND_HDA_NEEDS_RESUME
3598 .resume = alc_resume,
3600 #ifdef CONFIG_SND_HDA_POWER_SAVE
3601 .check_power_status = alc_check_power_status,
3607 * Test configuration for debugging
3609 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3612 #ifdef CONFIG_SND_DEBUG
3613 static hda_nid_t alc880_test_dac_nids[4] = {
3614 0x02, 0x03, 0x04, 0x05
3617 static struct hda_input_mux alc880_test_capture_source = {
3626 { "Surround", 0x6 },
3630 static struct hda_channel_mode alc880_test_modes[4] = {
3637 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3638 struct snd_ctl_elem_info *uinfo)
3640 static char *texts[] = {
3641 "N/A", "Line Out", "HP Out",
3642 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3644 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3646 uinfo->value.enumerated.items = 8;
3647 if (uinfo->value.enumerated.item >= 8)
3648 uinfo->value.enumerated.item = 7;
3649 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3653 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3654 struct snd_ctl_elem_value *ucontrol)
3656 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3657 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3658 unsigned int pin_ctl, item = 0;
3660 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3661 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3662 if (pin_ctl & AC_PINCTL_OUT_EN) {
3663 if (pin_ctl & AC_PINCTL_HP_EN)
3667 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3668 switch (pin_ctl & AC_PINCTL_VREFEN) {
3669 case AC_PINCTL_VREF_HIZ: item = 3; break;
3670 case AC_PINCTL_VREF_50: item = 4; break;
3671 case AC_PINCTL_VREF_GRD: item = 5; break;
3672 case AC_PINCTL_VREF_80: item = 6; break;
3673 case AC_PINCTL_VREF_100: item = 7; break;
3676 ucontrol->value.enumerated.item[0] = item;
3680 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3681 struct snd_ctl_elem_value *ucontrol)
3683 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3684 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3685 static unsigned int ctls[] = {
3686 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3687 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3688 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3689 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3690 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3691 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3693 unsigned int old_ctl, new_ctl;
3695 old_ctl = snd_hda_codec_read(codec, nid, 0,
3696 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3697 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3698 if (old_ctl != new_ctl) {
3700 snd_hda_codec_write_cache(codec, nid, 0,
3701 AC_VERB_SET_PIN_WIDGET_CONTROL,
3703 val = ucontrol->value.enumerated.item[0] >= 3 ?
3705 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3712 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3713 struct snd_ctl_elem_info *uinfo)
3715 static char *texts[] = {
3716 "Front", "Surround", "CLFE", "Side"
3718 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3720 uinfo->value.enumerated.items = 4;
3721 if (uinfo->value.enumerated.item >= 4)
3722 uinfo->value.enumerated.item = 3;
3723 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3727 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3728 struct snd_ctl_elem_value *ucontrol)
3730 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3731 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3734 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3735 ucontrol->value.enumerated.item[0] = sel & 3;
3739 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3740 struct snd_ctl_elem_value *ucontrol)
3742 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3743 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3746 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3747 if (ucontrol->value.enumerated.item[0] != sel) {
3748 sel = ucontrol->value.enumerated.item[0] & 3;
3749 snd_hda_codec_write_cache(codec, nid, 0,
3750 AC_VERB_SET_CONNECT_SEL, sel);
3756 #define PIN_CTL_TEST(xname,nid) { \
3757 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3759 .info = alc_test_pin_ctl_info, \
3760 .get = alc_test_pin_ctl_get, \
3761 .put = alc_test_pin_ctl_put, \
3762 .private_value = nid \
3765 #define PIN_SRC_TEST(xname,nid) { \
3766 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3768 .info = alc_test_pin_src_info, \
3769 .get = alc_test_pin_src_get, \
3770 .put = alc_test_pin_src_put, \
3771 .private_value = nid \
3774 static struct snd_kcontrol_new alc880_test_mixer[] = {
3775 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3776 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3777 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3778 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3779 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3780 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3781 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3782 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3783 PIN_CTL_TEST("Front Pin Mode", 0x14),
3784 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3785 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3786 PIN_CTL_TEST("Side Pin Mode", 0x17),
3787 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3788 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3789 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3790 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3791 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3792 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3793 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3794 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3795 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3796 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3797 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3798 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3799 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3800 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3801 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3802 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3803 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3804 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3806 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3807 .name = "Channel Mode",
3808 .info = alc_ch_mode_info,
3809 .get = alc_ch_mode_get,
3810 .put = alc_ch_mode_put,
3815 static struct hda_verb alc880_test_init_verbs[] = {
3816 /* Unmute inputs of 0x0c - 0x0f */
3817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3818 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3819 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3820 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3821 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3822 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3823 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3824 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3825 /* Vol output for 0x0c-0x0f */
3826 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3827 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3828 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3829 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3830 /* Set output pins 0x14-0x17 */
3831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3832 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3833 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3834 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3835 /* Unmute output pins 0x14-0x17 */
3836 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3837 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3838 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3839 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3840 /* Set input pins 0x18-0x1c */
3841 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3842 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3843 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3844 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3845 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3846 /* Mute input pins 0x18-0x1b */
3847 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3848 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3849 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3850 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3853 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3854 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3855 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3856 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3857 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3858 /* Analog input/passthru */
3859 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3860 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3861 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3862 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3863 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3871 static const char *alc880_models[ALC880_MODEL_LAST] = {
3872 [ALC880_3ST] = "3stack",
3873 [ALC880_TCL_S700] = "tcl",
3874 [ALC880_3ST_DIG] = "3stack-digout",
3875 [ALC880_CLEVO] = "clevo",
3876 [ALC880_5ST] = "5stack",
3877 [ALC880_5ST_DIG] = "5stack-digout",
3878 [ALC880_W810] = "w810",
3879 [ALC880_Z71V] = "z71v",
3880 [ALC880_6ST] = "6stack",
3881 [ALC880_6ST_DIG] = "6stack-digout",
3882 [ALC880_ASUS] = "asus",
3883 [ALC880_ASUS_W1V] = "asus-w1v",
3884 [ALC880_ASUS_DIG] = "asus-dig",
3885 [ALC880_ASUS_DIG2] = "asus-dig2",
3886 [ALC880_UNIWILL_DIG] = "uniwill",
3887 [ALC880_UNIWILL_P53] = "uniwill-p53",
3888 [ALC880_FUJITSU] = "fujitsu",
3889 [ALC880_F1734] = "F1734",
3891 [ALC880_LG_LW] = "lg-lw",
3892 [ALC880_MEDION_RIM] = "medion",
3893 #ifdef CONFIG_SND_DEBUG
3894 [ALC880_TEST] = "test",
3896 [ALC880_AUTO] = "auto",
3899 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3900 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3901 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3902 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3903 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3904 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3905 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3906 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3907 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3908 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3909 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3910 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3911 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3912 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3913 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3914 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3915 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3916 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3917 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3918 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3919 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3920 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3921 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3922 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3923 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3924 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3925 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3926 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3927 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3928 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3929 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3930 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3931 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3932 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3933 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3934 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3935 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3936 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3937 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3938 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3939 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3940 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3941 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3942 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3943 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3944 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3945 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3946 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3947 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3948 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3949 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3950 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3951 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3952 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3953 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3954 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3955 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3956 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3957 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3958 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3959 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3960 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3961 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3962 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3963 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3964 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3965 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3966 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3967 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3969 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3970 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3971 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3976 * ALC880 codec presets
3978 static struct alc_config_preset alc880_presets[] = {
3980 .mixers = { alc880_three_stack_mixer },
3981 .init_verbs = { alc880_volume_init_verbs,
3982 alc880_pin_3stack_init_verbs },
3983 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3984 .dac_nids = alc880_dac_nids,
3985 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3986 .channel_mode = alc880_threestack_modes,
3988 .input_mux = &alc880_capture_source,
3990 [ALC880_3ST_DIG] = {
3991 .mixers = { alc880_three_stack_mixer },
3992 .init_verbs = { alc880_volume_init_verbs,
3993 alc880_pin_3stack_init_verbs },
3994 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3995 .dac_nids = alc880_dac_nids,
3996 .dig_out_nid = ALC880_DIGOUT_NID,
3997 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3998 .channel_mode = alc880_threestack_modes,
4000 .input_mux = &alc880_capture_source,
4002 [ALC880_TCL_S700] = {
4003 .mixers = { alc880_tcl_s700_mixer },
4004 .init_verbs = { alc880_volume_init_verbs,
4005 alc880_pin_tcl_S700_init_verbs,
4006 alc880_gpio2_init_verbs },
4007 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4008 .dac_nids = alc880_dac_nids,
4009 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4010 .num_adc_nids = 1, /* single ADC */
4012 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4013 .channel_mode = alc880_2_jack_modes,
4014 .input_mux = &alc880_capture_source,
4017 .mixers = { alc880_three_stack_mixer,
4018 alc880_five_stack_mixer},
4019 .init_verbs = { alc880_volume_init_verbs,
4020 alc880_pin_5stack_init_verbs },
4021 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4022 .dac_nids = alc880_dac_nids,
4023 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4024 .channel_mode = alc880_fivestack_modes,
4025 .input_mux = &alc880_capture_source,
4027 [ALC880_5ST_DIG] = {
4028 .mixers = { alc880_three_stack_mixer,
4029 alc880_five_stack_mixer },
4030 .init_verbs = { alc880_volume_init_verbs,
4031 alc880_pin_5stack_init_verbs },
4032 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4033 .dac_nids = alc880_dac_nids,
4034 .dig_out_nid = ALC880_DIGOUT_NID,
4035 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4036 .channel_mode = alc880_fivestack_modes,
4037 .input_mux = &alc880_capture_source,
4040 .mixers = { alc880_six_stack_mixer },
4041 .init_verbs = { alc880_volume_init_verbs,
4042 alc880_pin_6stack_init_verbs },
4043 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4044 .dac_nids = alc880_6st_dac_nids,
4045 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4046 .channel_mode = alc880_sixstack_modes,
4047 .input_mux = &alc880_6stack_capture_source,
4049 [ALC880_6ST_DIG] = {
4050 .mixers = { alc880_six_stack_mixer },
4051 .init_verbs = { alc880_volume_init_verbs,
4052 alc880_pin_6stack_init_verbs },
4053 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4054 .dac_nids = alc880_6st_dac_nids,
4055 .dig_out_nid = ALC880_DIGOUT_NID,
4056 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4057 .channel_mode = alc880_sixstack_modes,
4058 .input_mux = &alc880_6stack_capture_source,
4061 .mixers = { alc880_w810_base_mixer },
4062 .init_verbs = { alc880_volume_init_verbs,
4063 alc880_pin_w810_init_verbs,
4064 alc880_gpio2_init_verbs },
4065 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4066 .dac_nids = alc880_w810_dac_nids,
4067 .dig_out_nid = ALC880_DIGOUT_NID,
4068 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4069 .channel_mode = alc880_w810_modes,
4070 .input_mux = &alc880_capture_source,
4073 .mixers = { alc880_z71v_mixer },
4074 .init_verbs = { alc880_volume_init_verbs,
4075 alc880_pin_z71v_init_verbs },
4076 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4077 .dac_nids = alc880_z71v_dac_nids,
4078 .dig_out_nid = ALC880_DIGOUT_NID,
4080 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4081 .channel_mode = alc880_2_jack_modes,
4082 .input_mux = &alc880_capture_source,
4085 .mixers = { alc880_f1734_mixer },
4086 .init_verbs = { alc880_volume_init_verbs,
4087 alc880_pin_f1734_init_verbs },
4088 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4089 .dac_nids = alc880_f1734_dac_nids,
4091 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4092 .channel_mode = alc880_2_jack_modes,
4093 .input_mux = &alc880_f1734_capture_source,
4094 .unsol_event = alc880_uniwill_p53_unsol_event,
4095 .init_hook = alc880_uniwill_p53_init_hook,
4098 .mixers = { alc880_asus_mixer },
4099 .init_verbs = { alc880_volume_init_verbs,
4100 alc880_pin_asus_init_verbs,
4101 alc880_gpio1_init_verbs },
4102 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4103 .dac_nids = alc880_asus_dac_nids,
4104 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4105 .channel_mode = alc880_asus_modes,
4107 .input_mux = &alc880_capture_source,
4109 [ALC880_ASUS_DIG] = {
4110 .mixers = { alc880_asus_mixer },
4111 .init_verbs = { alc880_volume_init_verbs,
4112 alc880_pin_asus_init_verbs,
4113 alc880_gpio1_init_verbs },
4114 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4115 .dac_nids = alc880_asus_dac_nids,
4116 .dig_out_nid = ALC880_DIGOUT_NID,
4117 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4118 .channel_mode = alc880_asus_modes,
4120 .input_mux = &alc880_capture_source,
4122 [ALC880_ASUS_DIG2] = {
4123 .mixers = { alc880_asus_mixer },
4124 .init_verbs = { alc880_volume_init_verbs,
4125 alc880_pin_asus_init_verbs,
4126 alc880_gpio2_init_verbs }, /* use GPIO2 */
4127 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4128 .dac_nids = alc880_asus_dac_nids,
4129 .dig_out_nid = ALC880_DIGOUT_NID,
4130 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4131 .channel_mode = alc880_asus_modes,
4133 .input_mux = &alc880_capture_source,
4135 [ALC880_ASUS_W1V] = {
4136 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4137 .init_verbs = { alc880_volume_init_verbs,
4138 alc880_pin_asus_init_verbs,
4139 alc880_gpio1_init_verbs },
4140 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4141 .dac_nids = alc880_asus_dac_nids,
4142 .dig_out_nid = ALC880_DIGOUT_NID,
4143 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4144 .channel_mode = alc880_asus_modes,
4146 .input_mux = &alc880_capture_source,
4148 [ALC880_UNIWILL_DIG] = {
4149 .mixers = { alc880_asus_mixer },
4150 .init_verbs = { alc880_volume_init_verbs,
4151 alc880_pin_asus_init_verbs },
4152 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4153 .dac_nids = alc880_asus_dac_nids,
4154 .dig_out_nid = ALC880_DIGOUT_NID,
4155 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4156 .channel_mode = alc880_asus_modes,
4158 .input_mux = &alc880_capture_source,
4160 [ALC880_UNIWILL] = {
4161 .mixers = { alc880_uniwill_mixer },
4162 .init_verbs = { alc880_volume_init_verbs,
4163 alc880_uniwill_init_verbs },
4164 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4165 .dac_nids = alc880_asus_dac_nids,
4166 .dig_out_nid = ALC880_DIGOUT_NID,
4167 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4168 .channel_mode = alc880_threestack_modes,
4170 .input_mux = &alc880_capture_source,
4171 .unsol_event = alc880_uniwill_unsol_event,
4172 .init_hook = alc880_uniwill_init_hook,
4174 [ALC880_UNIWILL_P53] = {
4175 .mixers = { alc880_uniwill_p53_mixer },
4176 .init_verbs = { alc880_volume_init_verbs,
4177 alc880_uniwill_p53_init_verbs },
4178 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4179 .dac_nids = alc880_asus_dac_nids,
4180 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4181 .channel_mode = alc880_threestack_modes,
4182 .input_mux = &alc880_capture_source,
4183 .unsol_event = alc880_uniwill_p53_unsol_event,
4184 .init_hook = alc880_uniwill_p53_init_hook,
4186 [ALC880_FUJITSU] = {
4187 .mixers = { alc880_fujitsu_mixer },
4188 .init_verbs = { alc880_volume_init_verbs,
4189 alc880_uniwill_p53_init_verbs,
4190 alc880_beep_init_verbs },
4191 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4192 .dac_nids = alc880_dac_nids,
4193 .dig_out_nid = ALC880_DIGOUT_NID,
4194 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4195 .channel_mode = alc880_2_jack_modes,
4196 .input_mux = &alc880_capture_source,
4197 .unsol_event = alc880_uniwill_p53_unsol_event,
4198 .init_hook = alc880_uniwill_p53_init_hook,
4201 .mixers = { alc880_three_stack_mixer },
4202 .init_verbs = { alc880_volume_init_verbs,
4203 alc880_pin_clevo_init_verbs },
4204 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4205 .dac_nids = alc880_dac_nids,
4207 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4208 .channel_mode = alc880_threestack_modes,
4210 .input_mux = &alc880_capture_source,
4213 .mixers = { alc880_lg_mixer },
4214 .init_verbs = { alc880_volume_init_verbs,
4215 alc880_lg_init_verbs },
4216 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4217 .dac_nids = alc880_lg_dac_nids,
4218 .dig_out_nid = ALC880_DIGOUT_NID,
4219 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4220 .channel_mode = alc880_lg_ch_modes,
4222 .input_mux = &alc880_lg_capture_source,
4223 .unsol_event = alc_automute_amp_unsol_event,
4224 .init_hook = alc880_lg_init_hook,
4225 #ifdef CONFIG_SND_HDA_POWER_SAVE
4226 .loopbacks = alc880_lg_loopbacks,
4230 .mixers = { alc880_lg_lw_mixer },
4231 .init_verbs = { alc880_volume_init_verbs,
4232 alc880_lg_lw_init_verbs },
4233 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4234 .dac_nids = alc880_dac_nids,
4235 .dig_out_nid = ALC880_DIGOUT_NID,
4236 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4237 .channel_mode = alc880_lg_lw_modes,
4238 .input_mux = &alc880_lg_lw_capture_source,
4239 .unsol_event = alc_automute_amp_unsol_event,
4240 .init_hook = alc880_lg_lw_init_hook,
4242 [ALC880_MEDION_RIM] = {
4243 .mixers = { alc880_medion_rim_mixer },
4244 .init_verbs = { alc880_volume_init_verbs,
4245 alc880_medion_rim_init_verbs,
4246 alc_gpio2_init_verbs },
4247 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4248 .dac_nids = alc880_dac_nids,
4249 .dig_out_nid = ALC880_DIGOUT_NID,
4250 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4251 .channel_mode = alc880_2_jack_modes,
4252 .input_mux = &alc880_medion_rim_capture_source,
4253 .unsol_event = alc880_medion_rim_unsol_event,
4254 .init_hook = alc880_medion_rim_init_hook,
4256 #ifdef CONFIG_SND_DEBUG
4258 .mixers = { alc880_test_mixer },
4259 .init_verbs = { alc880_test_init_verbs },
4260 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4261 .dac_nids = alc880_test_dac_nids,
4262 .dig_out_nid = ALC880_DIGOUT_NID,
4263 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4264 .channel_mode = alc880_test_modes,
4265 .input_mux = &alc880_test_capture_source,
4271 * Automatic parse of I/O pins from the BIOS configuration
4276 ALC_CTL_WIDGET_MUTE,
4279 static struct snd_kcontrol_new alc880_control_templates[] = {
4280 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4281 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4282 HDA_BIND_MUTE(NULL, 0, 0, 0),
4285 /* add dynamic controls */
4286 static int add_control(struct alc_spec *spec, int type, const char *name,
4289 struct snd_kcontrol_new *knew;
4291 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4292 knew = snd_array_new(&spec->kctls);
4295 *knew = alc880_control_templates[type];
4296 knew->name = kstrdup(name, GFP_KERNEL);
4299 knew->private_value = val;
4303 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4304 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4305 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4306 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4307 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4308 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4309 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4310 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4311 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4312 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4313 #define ALC880_PIN_CD_NID 0x1c
4315 /* fill in the dac_nids table from the parsed pin configuration */
4316 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4317 const struct auto_pin_cfg *cfg)
4323 memset(assigned, 0, sizeof(assigned));
4324 spec->multiout.dac_nids = spec->private_dac_nids;
4326 /* check the pins hardwired to audio widget */
4327 for (i = 0; i < cfg->line_outs; i++) {
4328 nid = cfg->line_out_pins[i];
4329 if (alc880_is_fixed_pin(nid)) {
4330 int idx = alc880_fixed_pin_idx(nid);
4331 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4335 /* left pins can be connect to any audio widget */
4336 for (i = 0; i < cfg->line_outs; i++) {
4337 nid = cfg->line_out_pins[i];
4338 if (alc880_is_fixed_pin(nid))
4340 /* search for an empty channel */
4341 for (j = 0; j < cfg->line_outs; j++) {
4343 spec->multiout.dac_nids[i] =
4344 alc880_idx_to_dac(j);
4350 spec->multiout.num_dacs = cfg->line_outs;
4354 /* add playback controls from the parsed DAC table */
4355 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4356 const struct auto_pin_cfg *cfg)
4359 static const char *chname[4] = {
4360 "Front", "Surround", NULL /*CLFE*/, "Side"
4365 for (i = 0; i < cfg->line_outs; i++) {
4366 if (!spec->multiout.dac_nids[i])
4368 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4371 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4372 "Center Playback Volume",
4373 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4377 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4378 "LFE Playback Volume",
4379 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4383 err = add_control(spec, ALC_CTL_BIND_MUTE,
4384 "Center Playback Switch",
4385 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4389 err = add_control(spec, ALC_CTL_BIND_MUTE,
4390 "LFE Playback Switch",
4391 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4396 sprintf(name, "%s Playback Volume", chname[i]);
4397 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4398 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4402 sprintf(name, "%s Playback Switch", chname[i]);
4403 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4404 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4413 /* add playback controls for speaker and HP outputs */
4414 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4424 if (alc880_is_fixed_pin(pin)) {
4425 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4426 /* specify the DAC as the extra output */
4427 if (!spec->multiout.hp_nid)
4428 spec->multiout.hp_nid = nid;
4430 spec->multiout.extra_out_nid[0] = nid;
4431 /* control HP volume/switch on the output mixer amp */
4432 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4433 sprintf(name, "%s Playback Volume", pfx);
4434 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4435 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4438 sprintf(name, "%s Playback Switch", pfx);
4439 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4440 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4443 } else if (alc880_is_multi_pin(pin)) {
4444 /* set manual connection */
4445 /* we have only a switch on HP-out PIN */
4446 sprintf(name, "%s Playback Switch", pfx);
4447 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4448 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4455 /* create input playback/capture controls for the given pin */
4456 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4457 const char *ctlname,
4458 int idx, hda_nid_t mix_nid)
4463 sprintf(name, "%s Playback Volume", ctlname);
4464 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4465 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4468 sprintf(name, "%s Playback Switch", ctlname);
4469 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4470 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4476 /* create playback/capture controls for input pins */
4477 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4478 const struct auto_pin_cfg *cfg)
4480 struct hda_input_mux *imux = &spec->private_imux[0];
4483 for (i = 0; i < AUTO_PIN_LAST; i++) {
4484 if (alc880_is_input_pin(cfg->input_pins[i])) {
4485 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4486 err = new_analog_input(spec, cfg->input_pins[i],
4487 auto_pin_cfg_labels[i],
4491 imux->items[imux->num_items].label =
4492 auto_pin_cfg_labels[i];
4493 imux->items[imux->num_items].index =
4494 alc880_input_pin_idx(cfg->input_pins[i]);
4501 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4502 unsigned int pin_type)
4504 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4507 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4511 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4512 hda_nid_t nid, int pin_type,
4515 alc_set_pin_output(codec, nid, pin_type);
4516 /* need the manual connection? */
4517 if (alc880_is_multi_pin(nid)) {
4518 struct alc_spec *spec = codec->spec;
4519 int idx = alc880_multi_pin_idx(nid);
4520 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4521 AC_VERB_SET_CONNECT_SEL,
4522 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4526 static int get_pin_type(int line_out_type)
4528 if (line_out_type == AUTO_PIN_HP_OUT)
4534 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4536 struct alc_spec *spec = codec->spec;
4539 for (i = 0; i < spec->autocfg.line_outs; i++) {
4540 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4541 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4542 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4546 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4548 struct alc_spec *spec = codec->spec;
4551 pin = spec->autocfg.speaker_pins[0];
4552 if (pin) /* connect to front */
4553 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4554 pin = spec->autocfg.hp_pins[0];
4555 if (pin) /* connect to front */
4556 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4559 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4561 struct alc_spec *spec = codec->spec;
4564 for (i = 0; i < AUTO_PIN_LAST; i++) {
4565 hda_nid_t nid = spec->autocfg.input_pins[i];
4566 if (alc880_is_input_pin(nid)) {
4567 alc_set_input_pin(codec, nid, i);
4568 if (nid != ALC880_PIN_CD_NID &&
4569 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4570 snd_hda_codec_write(codec, nid, 0,
4571 AC_VERB_SET_AMP_GAIN_MUTE,
4577 /* parse the BIOS configuration and set up the alc_spec */
4578 /* return 1 if successful, 0 if the proper config is not found,
4579 * or a negative error code
4581 static int alc880_parse_auto_config(struct hda_codec *codec)
4583 struct alc_spec *spec = codec->spec;
4585 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4587 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4591 if (!spec->autocfg.line_outs)
4592 return 0; /* can't find valid BIOS pin config */
4594 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4597 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4600 err = alc880_auto_create_extra_out(spec,
4601 spec->autocfg.speaker_pins[0],
4605 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4609 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4613 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4615 /* check multiple SPDIF-out (for recent codecs) */
4616 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4618 err = snd_hda_get_connections(codec,
4619 spec->autocfg.dig_out_pins[i],
4624 spec->multiout.dig_out_nid = dig_nid;
4626 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4627 spec->slave_dig_outs[i - 1] = dig_nid;
4628 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4632 if (spec->autocfg.dig_in_pin)
4633 spec->dig_in_nid = ALC880_DIGIN_NID;
4635 if (spec->kctls.list)
4636 add_mixer(spec, spec->kctls.list);
4638 add_verb(spec, alc880_volume_init_verbs);
4640 spec->num_mux_defs = 1;
4641 spec->input_mux = &spec->private_imux[0];
4643 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4648 /* additional initialization for auto-configuration model */
4649 static void alc880_auto_init(struct hda_codec *codec)
4651 struct alc_spec *spec = codec->spec;
4652 alc880_auto_init_multi_out(codec);
4653 alc880_auto_init_extra_out(codec);
4654 alc880_auto_init_analog_input(codec);
4655 if (spec->unsol_event)
4656 alc_inithook(codec);
4659 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4660 * one of two digital mic pins, e.g. on ALC272
4662 static void fixup_automic_adc(struct hda_codec *codec)
4664 struct alc_spec *spec = codec->spec;
4667 for (i = 0; i < spec->num_adc_nids; i++) {
4668 hda_nid_t cap = spec->capsrc_nids ?
4669 spec->capsrc_nids[i] : spec->adc_nids[i];
4672 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4675 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4678 spec->int_mic.mux_idx = iidx;
4679 spec->ext_mic.mux_idx = eidx;
4680 if (spec->capsrc_nids)
4681 spec->capsrc_nids += i;
4682 spec->adc_nids += i;
4683 spec->num_adc_nids = 1;
4686 snd_printd(KERN_INFO "hda_codec: %s: "
4687 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4688 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4689 spec->auto_mic = 0; /* disable auto-mic to be sure */
4692 static void set_capture_mixer(struct hda_codec *codec)
4694 struct alc_spec *spec = codec->spec;
4695 static struct snd_kcontrol_new *caps[2][3] = {
4696 { alc_capture_mixer_nosrc1,
4697 alc_capture_mixer_nosrc2,
4698 alc_capture_mixer_nosrc3 },
4699 { alc_capture_mixer1,
4701 alc_capture_mixer3 },
4703 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4705 if (spec->auto_mic) {
4707 fixup_automic_adc(codec);
4708 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4712 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4716 #define set_beep_amp(spec, nid, idx, dir) \
4717 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4720 * OK, here we have finally the patch for ALC880
4723 static int patch_alc880(struct hda_codec *codec)
4725 struct alc_spec *spec;
4729 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4735 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4738 if (board_config < 0) {
4739 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4741 board_config = ALC880_AUTO;
4744 if (board_config == ALC880_AUTO) {
4745 /* automatic parse from the BIOS config */
4746 err = alc880_parse_auto_config(codec);
4752 "hda_codec: Cannot set up configuration "
4753 "from BIOS. Using 3-stack mode...\n");
4754 board_config = ALC880_3ST;
4758 err = snd_hda_attach_beep_device(codec, 0x1);
4764 if (board_config != ALC880_AUTO)
4765 setup_preset(spec, &alc880_presets[board_config]);
4767 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4768 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4769 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4771 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4772 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4774 if (!spec->adc_nids && spec->input_mux) {
4775 /* check whether NID 0x07 is valid */
4776 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4778 wcap = get_wcaps_type(wcap);
4779 if (wcap != AC_WID_AUD_IN) {
4780 spec->adc_nids = alc880_adc_nids_alt;
4781 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4783 spec->adc_nids = alc880_adc_nids;
4784 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4787 set_capture_mixer(codec);
4788 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4790 spec->vmaster_nid = 0x0c;
4792 codec->patch_ops = alc_patch_ops;
4793 if (board_config == ALC880_AUTO)
4794 spec->init_hook = alc880_auto_init;
4795 #ifdef CONFIG_SND_HDA_POWER_SAVE
4796 if (!spec->loopback.amplist)
4797 spec->loopback.amplist = alc880_loopbacks;
4799 codec->proc_widget_hook = print_realtek_coef;
4809 static hda_nid_t alc260_dac_nids[1] = {
4814 static hda_nid_t alc260_adc_nids[1] = {
4819 static hda_nid_t alc260_adc_nids_alt[1] = {
4824 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4825 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4827 static hda_nid_t alc260_dual_adc_nids[2] = {
4832 #define ALC260_DIGOUT_NID 0x03
4833 #define ALC260_DIGIN_NID 0x06
4835 static struct hda_input_mux alc260_capture_source = {
4839 { "Front Mic", 0x1 },
4845 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4846 * headphone jack and the internal CD lines since these are the only pins at
4847 * which audio can appear. For flexibility, also allow the option of
4848 * recording the mixer output on the second ADC (ADC0 doesn't have a
4849 * connection to the mixer output).
4851 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4855 { "Mic/Line", 0x0 },
4857 { "Headphone", 0x2 },
4863 { "Mic/Line", 0x0 },
4865 { "Headphone", 0x2 },
4872 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4873 * the Fujitsu S702x, but jacks are marked differently.
4875 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4882 { "Headphone", 0x5 },
4891 { "Headphone", 0x6 },
4897 /* Maxdata Favorit 100XS */
4898 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4902 { "Line/Mic", 0x0 },
4909 { "Line/Mic", 0x0 },
4917 * This is just place-holder, so there's something for alc_build_pcms to look
4918 * at when it calculates the maximum number of channels. ALC260 has no mixer
4919 * element which allows changing the channel mode, so the verb list is
4922 static struct hda_channel_mode alc260_modes[1] = {
4927 /* Mixer combinations
4929 * basic: base_output + input + pc_beep + capture
4930 * HP: base_output + input + capture_alt
4931 * HP_3013: hp_3013 + input + capture
4932 * fujitsu: fujitsu + capture
4933 * acer: acer + capture
4936 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4937 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4938 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4939 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4940 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4941 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4942 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4946 static struct snd_kcontrol_new alc260_input_mixer[] = {
4947 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4948 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4949 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4950 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4952 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4953 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4954 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4958 /* update HP, line and mono out pins according to the master switch */
4959 static void alc260_hp_master_update(struct hda_codec *codec,
4960 hda_nid_t hp, hda_nid_t line,
4963 struct alc_spec *spec = codec->spec;
4964 unsigned int val = spec->master_sw ? PIN_HP : 0;
4965 /* change HP and line-out pins */
4966 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4968 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4970 /* mono (speaker) depending on the HP jack sense */
4971 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4972 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4976 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4977 struct snd_ctl_elem_value *ucontrol)
4979 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4980 struct alc_spec *spec = codec->spec;
4981 *ucontrol->value.integer.value = spec->master_sw;
4985 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4986 struct snd_ctl_elem_value *ucontrol)
4988 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4989 struct alc_spec *spec = codec->spec;
4990 int val = !!*ucontrol->value.integer.value;
4991 hda_nid_t hp, line, mono;
4993 if (val == spec->master_sw)
4995 spec->master_sw = val;
4996 hp = (kcontrol->private_value >> 16) & 0xff;
4997 line = (kcontrol->private_value >> 8) & 0xff;
4998 mono = kcontrol->private_value & 0xff;
4999 alc260_hp_master_update(codec, hp, line, mono);
5003 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5005 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5006 .name = "Master Playback Switch",
5007 .info = snd_ctl_boolean_mono_info,
5008 .get = alc260_hp_master_sw_get,
5009 .put = alc260_hp_master_sw_put,
5010 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5012 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5013 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5014 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5015 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5016 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5018 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5022 static struct hda_verb alc260_hp_unsol_verbs[] = {
5023 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5027 static void alc260_hp_automute(struct hda_codec *codec)
5029 struct alc_spec *spec = codec->spec;
5030 unsigned int present;
5032 present = snd_hda_codec_read(codec, 0x10, 0,
5033 AC_VERB_GET_PIN_SENSE, 0);
5034 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5035 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5038 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5040 if ((res >> 26) == ALC880_HP_EVENT)
5041 alc260_hp_automute(codec);
5044 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5046 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5047 .name = "Master Playback Switch",
5048 .info = snd_ctl_boolean_mono_info,
5049 .get = alc260_hp_master_sw_get,
5050 .put = alc260_hp_master_sw_put,
5051 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5053 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5054 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5055 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5056 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5057 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5058 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5059 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5060 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5064 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5065 .ops = &snd_hda_bind_vol,
5067 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5068 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5069 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5074 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5075 .ops = &snd_hda_bind_sw,
5077 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5078 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5083 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5084 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5085 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5086 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5091 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5092 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5096 static void alc260_hp_3013_automute(struct hda_codec *codec)
5098 struct alc_spec *spec = codec->spec;
5099 unsigned int present;
5101 present = snd_hda_codec_read(codec, 0x15, 0,
5102 AC_VERB_GET_PIN_SENSE, 0);
5103 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5104 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5107 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5110 if ((res >> 26) == ALC880_HP_EVENT)
5111 alc260_hp_3013_automute(codec);
5114 static void alc260_hp_3012_automute(struct hda_codec *codec)
5116 unsigned int present, bits;
5118 present = snd_hda_codec_read(codec, 0x10, 0,
5119 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
5121 bits = present ? 0 : PIN_OUT;
5122 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5124 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5126 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5130 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5133 if ((res >> 26) == ALC880_HP_EVENT)
5134 alc260_hp_3012_automute(codec);
5137 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5138 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5140 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5141 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5142 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5143 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5144 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5145 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5146 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5147 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5148 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5149 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5150 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5154 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5155 * versions of the ALC260 don't act on requests to enable mic bias from NID
5156 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5157 * datasheet doesn't mention this restriction. At this stage it's not clear
5158 * whether this behaviour is intentional or is a hardware bug in chip
5159 * revisions available in early 2006. Therefore for now allow the
5160 * "Headphone Jack Mode" control to span all choices, but if it turns out
5161 * that the lack of mic bias for this NID is intentional we could change the
5162 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5164 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5165 * don't appear to make the mic bias available from the "line" jack, even
5166 * though the NID used for this jack (0x14) can supply it. The theory is
5167 * that perhaps Acer have included blocking capacitors between the ALC260
5168 * and the output jack. If this turns out to be the case for all such
5169 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5170 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5172 * The C20x Tablet series have a mono internal speaker which is controlled
5173 * via the chip's Mono sum widget and pin complex, so include the necessary
5174 * controls for such models. On models without a "mono speaker" the control
5175 * won't do anything.
5177 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5178 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5179 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5180 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5181 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5183 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5185 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5186 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5188 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5189 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5190 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5191 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5192 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5196 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5198 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5199 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5200 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5201 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5202 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5203 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5204 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5208 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5209 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5211 static struct snd_kcontrol_new alc260_will_mixer[] = {
5212 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5213 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5214 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5215 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5216 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5217 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5218 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5219 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5220 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5221 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5225 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5226 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5228 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5229 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5230 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5232 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5233 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5234 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5235 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5236 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5237 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5238 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5243 * initialization verbs
5245 static struct hda_verb alc260_init_verbs[] = {
5246 /* Line In pin widget for input */
5247 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5248 /* CD pin widget for input */
5249 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5250 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5251 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5252 /* Mic2 (front panel) pin widget for input and vref at 80% */
5253 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5254 /* LINE-2 is used for line-out in rear */
5255 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5256 /* select line-out */
5257 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5259 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5261 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5263 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5264 /* mute capture amp left and right */
5265 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5266 /* set connection select to line in (default select for this ADC) */
5267 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5268 /* mute capture amp left and right */
5269 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5270 /* set connection select to line in (default select for this ADC) */
5271 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5272 /* set vol=0 Line-Out mixer amp left and right */
5273 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5274 /* unmute pin widget amp left and right (no gain on this amp) */
5275 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5276 /* set vol=0 HP mixer amp left and right */
5277 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5278 /* unmute pin widget amp left and right (no gain on this amp) */
5279 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5280 /* set vol=0 Mono mixer amp left and right */
5281 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5282 /* unmute pin widget amp left and right (no gain on this amp) */
5283 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5284 /* unmute LINE-2 out pin */
5285 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5286 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5289 /* mute analog inputs */
5290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5291 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5292 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5293 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5294 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5295 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5296 /* mute Front out path */
5297 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5298 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5299 /* mute Headphone out path */
5300 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5301 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5302 /* mute Mono out path */
5303 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5304 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5308 #if 0 /* should be identical with alc260_init_verbs? */
5309 static struct hda_verb alc260_hp_init_verbs[] = {
5310 /* Headphone and output */
5311 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5313 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5314 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5315 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5316 /* Mic2 (front panel) pin widget for input and vref at 80% */
5317 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5318 /* Line In pin widget for input */
5319 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5320 /* Line-2 pin widget for output */
5321 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5322 /* CD pin widget for input */
5323 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5324 /* unmute amp left and right */
5325 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5326 /* set connection select to line in (default select for this ADC) */
5327 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5328 /* unmute Line-Out mixer amp left and right (volume = 0) */
5329 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5330 /* mute pin widget amp left and right (no gain on this amp) */
5331 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5332 /* unmute HP mixer amp left and right (volume = 0) */
5333 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5334 /* mute pin widget amp left and right (no gain on this amp) */
5335 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5336 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5339 /* mute analog inputs */
5340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5342 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5343 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5344 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5345 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5346 /* Unmute Front out path */
5347 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5348 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5349 /* Unmute Headphone out path */
5350 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5351 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5352 /* Unmute Mono out path */
5353 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5354 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5359 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5360 /* Line out and output */
5361 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5363 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5364 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5365 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5366 /* Mic2 (front panel) pin widget for input and vref at 80% */
5367 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5368 /* Line In pin widget for input */
5369 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5370 /* Headphone pin widget for output */
5371 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5372 /* CD pin widget for input */
5373 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5374 /* unmute amp left and right */
5375 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5376 /* set connection select to line in (default select for this ADC) */
5377 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5378 /* unmute Line-Out mixer amp left and right (volume = 0) */
5379 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5380 /* mute pin widget amp left and right (no gain on this amp) */
5381 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5382 /* unmute HP mixer amp left and right (volume = 0) */
5383 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5384 /* mute pin widget amp left and right (no gain on this amp) */
5385 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5386 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5389 /* mute analog inputs */
5390 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5391 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5392 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5393 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5394 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5395 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5396 /* Unmute Front out path */
5397 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5398 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5399 /* Unmute Headphone out path */
5400 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5401 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5402 /* Unmute Mono out path */
5403 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5404 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5408 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5409 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5410 * audio = 0x16, internal speaker = 0x10.
5412 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5413 /* Disable all GPIOs */
5414 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5415 /* Internal speaker is connected to headphone pin */
5416 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5417 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5418 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5419 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5420 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5421 /* Ensure all other unused pins are disabled and muted. */
5422 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5423 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5424 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5425 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5426 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5427 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5428 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5429 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5431 /* Disable digital (SPDIF) pins */
5432 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5433 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5435 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5436 * when acting as an output.
5438 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5440 /* Start with output sum widgets muted and their output gains at min */
5441 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5442 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5444 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5445 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5446 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5447 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5448 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5449 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5451 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5452 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5453 /* Unmute Line1 pin widget output buffer since it starts as an output.
5454 * If the pin mode is changed by the user the pin mode control will
5455 * take care of enabling the pin's input/output buffers as needed.
5456 * Therefore there's no need to enable the input buffer at this
5459 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5460 /* Unmute input buffer of pin widget used for Line-in (no equiv
5463 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5465 /* Mute capture amp left and right */
5466 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5467 /* Set ADC connection select to match default mixer setting - line
5470 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5472 /* Do the same for the second ADC: mute capture input amp and
5473 * set ADC connection to line in (on mic1 pin)
5475 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5476 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5478 /* Mute all inputs to mixer widget (even unconnected ones) */
5479 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5480 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5481 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5482 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5483 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5484 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5485 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5491 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5492 * similar laptops (adapted from Fujitsu init verbs).
5494 static struct hda_verb alc260_acer_init_verbs[] = {
5495 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5496 * the headphone jack. Turn this on and rely on the standard mute
5497 * methods whenever the user wants to turn these outputs off.
5499 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5500 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5501 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5502 /* Internal speaker/Headphone jack is connected to Line-out pin */
5503 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5504 /* Internal microphone/Mic jack is connected to Mic1 pin */
5505 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5506 /* Line In jack is connected to Line1 pin */
5507 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5508 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5509 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5510 /* Ensure all other unused pins are disabled and muted. */
5511 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5512 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5513 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5514 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5515 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5517 /* Disable digital (SPDIF) pins */
5518 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5519 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5521 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5522 * bus when acting as outputs.
5524 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5525 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5527 /* Start with output sum widgets muted and their output gains at min */
5528 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5529 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5530 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5531 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5532 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5533 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5534 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5535 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5536 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5538 /* Unmute Line-out pin widget amp left and right
5539 * (no equiv mixer ctrl)
5541 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5542 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5543 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5544 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5545 * inputs. If the pin mode is changed by the user the pin mode control
5546 * will take care of enabling the pin's input/output buffers as needed.
5547 * Therefore there's no need to enable the input buffer at this
5550 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5551 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5553 /* Mute capture amp left and right */
5554 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5555 /* Set ADC connection select to match default mixer setting - mic
5558 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5560 /* Do similar with the second ADC: mute capture input amp and
5561 * set ADC connection to mic to match ALSA's default state.
5563 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5564 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5566 /* Mute all inputs to mixer widget (even unconnected ones) */
5567 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5569 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5570 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5571 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5572 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5573 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5574 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5579 /* Initialisation sequence for Maxdata Favorit 100XS
5580 * (adapted from Acer init verbs).
5582 static struct hda_verb alc260_favorit100_init_verbs[] = {
5583 /* GPIO 0 enables the output jack.
5584 * Turn this on and rely on the standard mute
5585 * methods whenever the user wants to turn these outputs off.
5587 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5588 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5589 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5590 /* Line/Mic input jack is connected to Mic1 pin */
5591 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5592 /* Ensure all other unused pins are disabled and muted. */
5593 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5594 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5595 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5596 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5597 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5598 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5599 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5602 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5603 /* Disable digital (SPDIF) pins */
5604 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5605 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5607 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5608 * bus when acting as outputs.
5610 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5611 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5613 /* Start with output sum widgets muted and their output gains at min */
5614 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5615 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5616 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5617 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5618 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5619 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5620 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5621 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5622 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5624 /* Unmute Line-out pin widget amp left and right
5625 * (no equiv mixer ctrl)
5627 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5628 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5629 * inputs. If the pin mode is changed by the user the pin mode control
5630 * will take care of enabling the pin's input/output buffers as needed.
5631 * Therefore there's no need to enable the input buffer at this
5634 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5636 /* Mute capture amp left and right */
5637 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5638 /* Set ADC connection select to match default mixer setting - mic
5641 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5643 /* Do similar with the second ADC: mute capture input amp and
5644 * set ADC connection to mic to match ALSA's default state.
5646 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5647 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5649 /* Mute all inputs to mixer widget (even unconnected ones) */
5650 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5651 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5652 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5653 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5654 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5655 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5656 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5657 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5662 static struct hda_verb alc260_will_verbs[] = {
5663 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5664 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5665 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5666 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5667 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5668 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5672 static struct hda_verb alc260_replacer_672v_verbs[] = {
5673 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5674 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5675 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5677 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5678 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5679 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5681 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5685 /* toggle speaker-output according to the hp-jack state */
5686 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5688 unsigned int present;
5690 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5691 present = snd_hda_codec_read(codec, 0x0f, 0,
5692 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5694 snd_hda_codec_write_cache(codec, 0x01, 0,
5695 AC_VERB_SET_GPIO_DATA, 1);
5696 snd_hda_codec_write_cache(codec, 0x0f, 0,
5697 AC_VERB_SET_PIN_WIDGET_CONTROL,
5700 snd_hda_codec_write_cache(codec, 0x01, 0,
5701 AC_VERB_SET_GPIO_DATA, 0);
5702 snd_hda_codec_write_cache(codec, 0x0f, 0,
5703 AC_VERB_SET_PIN_WIDGET_CONTROL,
5708 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5711 if ((res >> 26) == ALC880_HP_EVENT)
5712 alc260_replacer_672v_automute(codec);
5715 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5716 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5717 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5718 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5719 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5720 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5721 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5722 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5723 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5724 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5725 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5729 /* Test configuration for debugging, modelled after the ALC880 test
5732 #ifdef CONFIG_SND_DEBUG
5733 static hda_nid_t alc260_test_dac_nids[1] = {
5736 static hda_nid_t alc260_test_adc_nids[2] = {
5739 /* For testing the ALC260, each input MUX needs its own definition since
5740 * the signal assignments are different. This assumes that the first ADC
5743 static struct hda_input_mux alc260_test_capture_sources[2] = {
5747 { "MIC1 pin", 0x0 },
5748 { "MIC2 pin", 0x1 },
5749 { "LINE1 pin", 0x2 },
5750 { "LINE2 pin", 0x3 },
5752 { "LINE-OUT pin", 0x5 },
5753 { "HP-OUT pin", 0x6 },
5759 { "MIC1 pin", 0x0 },
5760 { "MIC2 pin", 0x1 },
5761 { "LINE1 pin", 0x2 },
5762 { "LINE2 pin", 0x3 },
5765 { "LINE-OUT pin", 0x6 },
5766 { "HP-OUT pin", 0x7 },
5770 static struct snd_kcontrol_new alc260_test_mixer[] = {
5771 /* Output driver widgets */
5772 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5773 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5774 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5775 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5776 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5777 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5779 /* Modes for retasking pin widgets
5780 * Note: the ALC260 doesn't seem to act on requests to enable mic
5781 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5782 * mention this restriction. At this stage it's not clear whether
5783 * this behaviour is intentional or is a hardware bug in chip
5784 * revisions available at least up until early 2006. Therefore for
5785 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5786 * choices, but if it turns out that the lack of mic bias for these
5787 * NIDs is intentional we could change their modes from
5788 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5790 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5791 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5792 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5793 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5794 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5795 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5797 /* Loopback mixer controls */
5798 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5799 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5800 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5801 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5802 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5803 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5804 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5805 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5806 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5807 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5808 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5809 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5810 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5811 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5813 /* Controls for GPIO pins, assuming they are configured as outputs */
5814 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5815 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5816 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5817 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5819 /* Switches to allow the digital IO pins to be enabled. The datasheet
5820 * is ambigious as to which NID is which; testing on laptops which
5821 * make this output available should provide clarification.
5823 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5824 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5826 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5827 * this output to turn on an external amplifier.
5829 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5830 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5834 static struct hda_verb alc260_test_init_verbs[] = {
5835 /* Enable all GPIOs as outputs with an initial value of 0 */
5836 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5837 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5838 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5840 /* Enable retasking pins as output, initially without power amp */
5841 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5842 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5843 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5844 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5845 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5846 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5848 /* Disable digital (SPDIF) pins initially, but users can enable
5849 * them via a mixer switch. In the case of SPDIF-out, this initverb
5850 * payload also sets the generation to 0, output to be in "consumer"
5851 * PCM format, copyright asserted, no pre-emphasis and no validity
5854 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5855 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5857 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5858 * OUT1 sum bus when acting as an output.
5860 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5861 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5862 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5863 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5865 /* Start with output sum widgets muted and their output gains at min */
5866 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5867 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5868 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5869 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5870 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5871 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5872 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5873 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5874 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5876 /* Unmute retasking pin widget output buffers since the default
5877 * state appears to be output. As the pin mode is changed by the
5878 * user the pin mode control will take care of enabling the pin's
5879 * input/output buffers as needed.
5881 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5882 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5883 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5884 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5885 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5886 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5887 /* Also unmute the mono-out pin widget */
5888 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5890 /* Mute capture amp left and right */
5891 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5892 /* Set ADC connection select to match default mixer setting (mic1
5895 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5897 /* Do the same for the second ADC: mute capture input amp and
5898 * set ADC connection to mic1 pin
5900 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5901 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5903 /* Mute all inputs to mixer widget (even unconnected ones) */
5904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5905 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5908 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5909 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5910 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5911 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5917 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5918 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5920 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5921 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5924 * for BIOS auto-configuration
5927 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5928 const char *pfx, int *vol_bits)
5931 unsigned long vol_val, sw_val;
5935 if (nid >= 0x0f && nid < 0x11) {
5936 nid_vol = nid - 0x7;
5937 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5938 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5939 } else if (nid == 0x11) {
5940 nid_vol = nid - 0x7;
5941 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5942 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5943 } else if (nid >= 0x12 && nid <= 0x15) {
5945 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5946 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5950 if (!(*vol_bits & (1 << nid_vol))) {
5951 /* first control for the volume widget */
5952 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5953 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5956 *vol_bits |= (1 << nid_vol);
5958 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5959 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5965 /* add playback controls from the parsed DAC table */
5966 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5967 const struct auto_pin_cfg *cfg)
5973 spec->multiout.num_dacs = 1;
5974 spec->multiout.dac_nids = spec->private_dac_nids;
5975 spec->multiout.dac_nids[0] = 0x02;
5977 nid = cfg->line_out_pins[0];
5979 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5984 nid = cfg->speaker_pins[0];
5986 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5991 nid = cfg->hp_pins[0];
5993 err = alc260_add_playback_controls(spec, nid, "Headphone",
6001 /* create playback/capture controls for input pins */
6002 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
6003 const struct auto_pin_cfg *cfg)
6005 struct hda_input_mux *imux = &spec->private_imux[0];
6008 for (i = 0; i < AUTO_PIN_LAST; i++) {
6009 if (cfg->input_pins[i] >= 0x12) {
6010 idx = cfg->input_pins[i] - 0x12;
6011 err = new_analog_input(spec, cfg->input_pins[i],
6012 auto_pin_cfg_labels[i], idx,
6016 imux->items[imux->num_items].label =
6017 auto_pin_cfg_labels[i];
6018 imux->items[imux->num_items].index = idx;
6021 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
6022 idx = cfg->input_pins[i] - 0x09;
6023 err = new_analog_input(spec, cfg->input_pins[i],
6024 auto_pin_cfg_labels[i], idx,
6028 imux->items[imux->num_items].label =
6029 auto_pin_cfg_labels[i];
6030 imux->items[imux->num_items].index = idx;
6037 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6038 hda_nid_t nid, int pin_type,
6041 alc_set_pin_output(codec, nid, pin_type);
6042 /* need the manual connection? */
6044 int idx = nid - 0x12;
6045 snd_hda_codec_write(codec, idx + 0x0b, 0,
6046 AC_VERB_SET_CONNECT_SEL, sel_idx);
6050 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6052 struct alc_spec *spec = codec->spec;
6055 nid = spec->autocfg.line_out_pins[0];
6057 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6058 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6061 nid = spec->autocfg.speaker_pins[0];
6063 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6065 nid = spec->autocfg.hp_pins[0];
6067 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6070 #define ALC260_PIN_CD_NID 0x16
6071 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6073 struct alc_spec *spec = codec->spec;
6076 for (i = 0; i < AUTO_PIN_LAST; i++) {
6077 hda_nid_t nid = spec->autocfg.input_pins[i];
6079 alc_set_input_pin(codec, nid, i);
6080 if (nid != ALC260_PIN_CD_NID &&
6081 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6082 snd_hda_codec_write(codec, nid, 0,
6083 AC_VERB_SET_AMP_GAIN_MUTE,
6090 * generic initialization of ADC, input mixers and output mixers
6092 static struct hda_verb alc260_volume_init_verbs[] = {
6094 * Unmute ADC0-1 and set the default input to mic-in
6096 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6097 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6098 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6099 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6101 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6103 * Note: PASD motherboards uses the Line In 2 as the input for
6104 * front panel mic (mic 2)
6106 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6107 /* mute analog inputs */
6108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6115 * Set up output mixers (0x08 - 0x0a)
6117 /* set vol=0 to output mixers */
6118 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6119 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6120 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6121 /* set up input amps for analog loopback */
6122 /* Amp Indices: DAC = 0, mixer = 1 */
6123 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6124 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6125 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6126 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6127 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6128 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6133 static int alc260_parse_auto_config(struct hda_codec *codec)
6135 struct alc_spec *spec = codec->spec;
6137 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6139 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6143 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6146 if (!spec->kctls.list)
6147 return 0; /* can't find valid BIOS pin config */
6148 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
6152 spec->multiout.max_channels = 2;
6154 if (spec->autocfg.dig_outs)
6155 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6156 if (spec->kctls.list)
6157 add_mixer(spec, spec->kctls.list);
6159 add_verb(spec, alc260_volume_init_verbs);
6161 spec->num_mux_defs = 1;
6162 spec->input_mux = &spec->private_imux[0];
6164 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6169 /* additional initialization for auto-configuration model */
6170 static void alc260_auto_init(struct hda_codec *codec)
6172 struct alc_spec *spec = codec->spec;
6173 alc260_auto_init_multi_out(codec);
6174 alc260_auto_init_analog_input(codec);
6175 if (spec->unsol_event)
6176 alc_inithook(codec);
6179 #ifdef CONFIG_SND_HDA_POWER_SAVE
6180 static struct hda_amp_list alc260_loopbacks[] = {
6181 { 0x07, HDA_INPUT, 0 },
6182 { 0x07, HDA_INPUT, 1 },
6183 { 0x07, HDA_INPUT, 2 },
6184 { 0x07, HDA_INPUT, 3 },
6185 { 0x07, HDA_INPUT, 4 },
6191 * ALC260 configurations
6193 static const char *alc260_models[ALC260_MODEL_LAST] = {
6194 [ALC260_BASIC] = "basic",
6196 [ALC260_HP_3013] = "hp-3013",
6197 [ALC260_HP_DC7600] = "hp-dc7600",
6198 [ALC260_FUJITSU_S702X] = "fujitsu",
6199 [ALC260_ACER] = "acer",
6200 [ALC260_WILL] = "will",
6201 [ALC260_REPLACER_672V] = "replacer",
6202 [ALC260_FAVORIT100] = "favorit100",
6203 #ifdef CONFIG_SND_DEBUG
6204 [ALC260_TEST] = "test",
6206 [ALC260_AUTO] = "auto",
6209 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6210 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6211 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6212 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6213 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6214 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6215 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6216 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6217 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6218 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6219 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6220 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6221 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6222 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6223 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6224 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6225 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6226 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6227 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6228 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6232 static struct alc_config_preset alc260_presets[] = {
6234 .mixers = { alc260_base_output_mixer,
6235 alc260_input_mixer },
6236 .init_verbs = { alc260_init_verbs },
6237 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6238 .dac_nids = alc260_dac_nids,
6239 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6240 .adc_nids = alc260_adc_nids,
6241 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6242 .channel_mode = alc260_modes,
6243 .input_mux = &alc260_capture_source,
6246 .mixers = { alc260_hp_output_mixer,
6247 alc260_input_mixer },
6248 .init_verbs = { alc260_init_verbs,
6249 alc260_hp_unsol_verbs },
6250 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6251 .dac_nids = alc260_dac_nids,
6252 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6253 .adc_nids = alc260_adc_nids_alt,
6254 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6255 .channel_mode = alc260_modes,
6256 .input_mux = &alc260_capture_source,
6257 .unsol_event = alc260_hp_unsol_event,
6258 .init_hook = alc260_hp_automute,
6260 [ALC260_HP_DC7600] = {
6261 .mixers = { alc260_hp_dc7600_mixer,
6262 alc260_input_mixer },
6263 .init_verbs = { alc260_init_verbs,
6264 alc260_hp_dc7600_verbs },
6265 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6266 .dac_nids = alc260_dac_nids,
6267 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6268 .adc_nids = alc260_adc_nids_alt,
6269 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6270 .channel_mode = alc260_modes,
6271 .input_mux = &alc260_capture_source,
6272 .unsol_event = alc260_hp_3012_unsol_event,
6273 .init_hook = alc260_hp_3012_automute,
6275 [ALC260_HP_3013] = {
6276 .mixers = { alc260_hp_3013_mixer,
6277 alc260_input_mixer },
6278 .init_verbs = { alc260_hp_3013_init_verbs,
6279 alc260_hp_3013_unsol_verbs },
6280 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6281 .dac_nids = alc260_dac_nids,
6282 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6283 .adc_nids = alc260_adc_nids_alt,
6284 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6285 .channel_mode = alc260_modes,
6286 .input_mux = &alc260_capture_source,
6287 .unsol_event = alc260_hp_3013_unsol_event,
6288 .init_hook = alc260_hp_3013_automute,
6290 [ALC260_FUJITSU_S702X] = {
6291 .mixers = { alc260_fujitsu_mixer },
6292 .init_verbs = { alc260_fujitsu_init_verbs },
6293 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6294 .dac_nids = alc260_dac_nids,
6295 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6296 .adc_nids = alc260_dual_adc_nids,
6297 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6298 .channel_mode = alc260_modes,
6299 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6300 .input_mux = alc260_fujitsu_capture_sources,
6303 .mixers = { alc260_acer_mixer },
6304 .init_verbs = { alc260_acer_init_verbs },
6305 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6306 .dac_nids = alc260_dac_nids,
6307 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6308 .adc_nids = alc260_dual_adc_nids,
6309 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6310 .channel_mode = alc260_modes,
6311 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6312 .input_mux = alc260_acer_capture_sources,
6314 [ALC260_FAVORIT100] = {
6315 .mixers = { alc260_favorit100_mixer },
6316 .init_verbs = { alc260_favorit100_init_verbs },
6317 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6318 .dac_nids = alc260_dac_nids,
6319 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6320 .adc_nids = alc260_dual_adc_nids,
6321 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6322 .channel_mode = alc260_modes,
6323 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6324 .input_mux = alc260_favorit100_capture_sources,
6327 .mixers = { alc260_will_mixer },
6328 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6329 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6330 .dac_nids = alc260_dac_nids,
6331 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6332 .adc_nids = alc260_adc_nids,
6333 .dig_out_nid = ALC260_DIGOUT_NID,
6334 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6335 .channel_mode = alc260_modes,
6336 .input_mux = &alc260_capture_source,
6338 [ALC260_REPLACER_672V] = {
6339 .mixers = { alc260_replacer_672v_mixer },
6340 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6341 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6342 .dac_nids = alc260_dac_nids,
6343 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6344 .adc_nids = alc260_adc_nids,
6345 .dig_out_nid = ALC260_DIGOUT_NID,
6346 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6347 .channel_mode = alc260_modes,
6348 .input_mux = &alc260_capture_source,
6349 .unsol_event = alc260_replacer_672v_unsol_event,
6350 .init_hook = alc260_replacer_672v_automute,
6352 #ifdef CONFIG_SND_DEBUG
6354 .mixers = { alc260_test_mixer },
6355 .init_verbs = { alc260_test_init_verbs },
6356 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6357 .dac_nids = alc260_test_dac_nids,
6358 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6359 .adc_nids = alc260_test_adc_nids,
6360 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6361 .channel_mode = alc260_modes,
6362 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6363 .input_mux = alc260_test_capture_sources,
6368 static int patch_alc260(struct hda_codec *codec)
6370 struct alc_spec *spec;
6371 int err, board_config;
6373 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6379 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6382 if (board_config < 0) {
6383 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6385 board_config = ALC260_AUTO;
6388 if (board_config == ALC260_AUTO) {
6389 /* automatic parse from the BIOS config */
6390 err = alc260_parse_auto_config(codec);
6396 "hda_codec: Cannot set up configuration "
6397 "from BIOS. Using base mode...\n");
6398 board_config = ALC260_BASIC;
6402 err = snd_hda_attach_beep_device(codec, 0x1);
6408 if (board_config != ALC260_AUTO)
6409 setup_preset(spec, &alc260_presets[board_config]);
6411 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6412 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6414 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6415 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6417 if (!spec->adc_nids && spec->input_mux) {
6418 /* check whether NID 0x04 is valid */
6419 unsigned int wcap = get_wcaps(codec, 0x04);
6420 wcap = get_wcaps_type(wcap);
6422 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6423 spec->adc_nids = alc260_adc_nids_alt;
6424 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6426 spec->adc_nids = alc260_adc_nids;
6427 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6430 set_capture_mixer(codec);
6431 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6433 spec->vmaster_nid = 0x08;
6435 codec->patch_ops = alc_patch_ops;
6436 if (board_config == ALC260_AUTO)
6437 spec->init_hook = alc260_auto_init;
6438 #ifdef CONFIG_SND_HDA_POWER_SAVE
6439 if (!spec->loopback.amplist)
6440 spec->loopback.amplist = alc260_loopbacks;
6442 codec->proc_widget_hook = print_realtek_coef;
6449 * ALC882/883/885/888/889 support
6451 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6452 * configuration. Each pin widget can choose any input DACs and a mixer.
6453 * Each ADC is connected from a mixer of all inputs. This makes possible
6454 * 6-channel independent captures.
6456 * In addition, an independent DAC for the multi-playback (not used in this
6459 #define ALC882_DIGOUT_NID 0x06
6460 #define ALC882_DIGIN_NID 0x0a
6461 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6462 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6463 #define ALC1200_DIGOUT_NID 0x10
6466 static struct hda_channel_mode alc882_ch_modes[1] = {
6471 static hda_nid_t alc882_dac_nids[4] = {
6472 /* front, rear, clfe, rear_surr */
6473 0x02, 0x03, 0x04, 0x05
6475 #define alc883_dac_nids alc882_dac_nids
6478 #define alc882_adc_nids alc880_adc_nids
6479 #define alc882_adc_nids_alt alc880_adc_nids_alt
6480 #define alc883_adc_nids alc882_adc_nids_alt
6481 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6482 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6483 #define alc889_adc_nids alc880_adc_nids
6485 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6486 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6487 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6488 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6489 #define alc889_capsrc_nids alc882_capsrc_nids
6492 /* FIXME: should be a matrix-type input source selection */
6494 static struct hda_input_mux alc882_capture_source = {
6498 { "Front Mic", 0x1 },
6504 #define alc883_capture_source alc882_capture_source
6506 static struct hda_input_mux alc889_capture_source = {
6509 { "Front Mic", 0x0 },
6515 static struct hda_input_mux mb5_capture_source = {
6524 static struct hda_input_mux alc883_3stack_6ch_intel = {
6528 { "Front Mic", 0x0 },
6534 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6542 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6552 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6560 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6564 { "Front Mic", 0x1 },
6569 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6577 static struct hda_input_mux alc889A_mb31_capture_source = {
6581 /* Front Mic (0x01) unused */
6583 /* Line 2 (0x03) unused */
6584 /* CD (0x04) unsused? */
6591 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6598 static struct hda_verb alc882_3ST_ch2_init[] = {
6599 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6600 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6601 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6602 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6609 static struct hda_verb alc882_3ST_ch4_init[] = {
6610 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6611 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6612 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6613 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6614 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6621 static struct hda_verb alc882_3ST_ch6_init[] = {
6622 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6623 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6624 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6625 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6626 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6627 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6631 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6632 { 2, alc882_3ST_ch2_init },
6633 { 4, alc882_3ST_ch4_init },
6634 { 6, alc882_3ST_ch6_init },
6637 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6642 static struct hda_verb alc882_sixstack_ch6_init[] = {
6643 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6644 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6645 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6646 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6653 static struct hda_verb alc882_sixstack_ch8_init[] = {
6654 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6655 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6656 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6657 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6661 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6662 { 6, alc882_sixstack_ch6_init },
6663 { 8, alc882_sixstack_ch8_init },
6667 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6673 static struct hda_verb alc885_mbp_ch2_init[] = {
6674 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6675 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6676 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6683 static struct hda_verb alc885_mbp_ch6_init[] = {
6684 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6685 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6686 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6687 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6688 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6692 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6693 { 2, alc885_mbp_ch2_init },
6694 { 6, alc885_mbp_ch6_init },
6699 * Speakers/Woofer/HP = Front
6702 static struct hda_verb alc885_mb5_ch2_init[] = {
6703 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6704 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6710 * Speakers/HP = Front
6714 static struct hda_verb alc885_mb5_ch6_init[] = {
6715 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6716 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6717 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6721 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6722 { 2, alc885_mb5_ch2_init },
6723 { 6, alc885_mb5_ch6_init },
6730 static struct hda_verb alc883_4ST_ch2_init[] = {
6731 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6732 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6733 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6734 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6735 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6736 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6743 static struct hda_verb alc883_4ST_ch4_init[] = {
6744 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6745 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6746 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6747 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6748 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6749 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6750 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6757 static struct hda_verb alc883_4ST_ch6_init[] = {
6758 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6759 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6760 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6761 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6762 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6763 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6764 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6765 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6772 static struct hda_verb alc883_4ST_ch8_init[] = {
6773 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6774 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6775 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6776 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6777 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6778 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6779 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6780 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6781 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6785 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6786 { 2, alc883_4ST_ch2_init },
6787 { 4, alc883_4ST_ch4_init },
6788 { 6, alc883_4ST_ch6_init },
6789 { 8, alc883_4ST_ch8_init },
6796 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6797 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6798 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6799 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6800 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6807 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6808 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6809 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6810 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6811 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6812 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6819 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6820 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6821 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6822 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6823 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6824 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6825 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6829 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6830 { 2, alc883_3ST_ch2_intel_init },
6831 { 4, alc883_3ST_ch4_intel_init },
6832 { 6, alc883_3ST_ch6_intel_init },
6838 static struct hda_verb alc889_ch2_intel_init[] = {
6839 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6840 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6841 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6842 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6843 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6844 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6851 static struct hda_verb alc889_ch6_intel_init[] = {
6852 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6853 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6854 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6855 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6856 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6857 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6864 static struct hda_verb alc889_ch8_intel_init[] = {
6865 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6866 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6867 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6868 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6869 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6870 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6871 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6875 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6876 { 2, alc889_ch2_intel_init },
6877 { 6, alc889_ch6_intel_init },
6878 { 8, alc889_ch8_intel_init },
6884 static struct hda_verb alc883_sixstack_ch6_init[] = {
6885 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6886 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6887 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6888 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6895 static struct hda_verb alc883_sixstack_ch8_init[] = {
6896 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6897 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6898 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6899 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6903 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6904 { 6, alc883_sixstack_ch6_init },
6905 { 8, alc883_sixstack_ch8_init },
6909 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6910 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6912 static struct snd_kcontrol_new alc882_base_mixer[] = {
6913 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6914 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6915 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6916 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6917 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6918 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6919 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6920 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6921 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6922 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6923 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6924 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6925 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6926 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6927 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6929 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6930 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6931 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6932 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6933 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6937 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6938 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6939 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6940 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6941 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6942 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6943 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6944 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6945 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6946 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6947 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6951 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6952 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6953 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6954 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6955 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6956 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6957 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6958 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6959 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6960 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6961 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6962 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6963 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6964 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6965 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6969 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6970 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6971 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6972 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6973 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6974 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6975 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6976 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6977 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6978 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6982 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6983 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6984 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6985 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6986 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6987 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6988 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6989 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6990 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6991 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6992 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6993 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6994 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6995 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6999 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7000 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7002 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7003 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7004 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7005 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7006 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7007 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7008 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7009 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7010 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7011 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7012 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7013 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7014 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7015 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7019 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7020 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7021 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7022 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7023 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7024 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7025 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7026 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7027 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7028 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7029 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7033 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7035 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7036 .name = "Channel Mode",
7037 .info = alc_ch_mode_info,
7038 .get = alc_ch_mode_get,
7039 .put = alc_ch_mode_put,
7044 static struct hda_verb alc882_base_init_verbs[] = {
7045 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7046 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7048 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7050 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7051 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7052 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7054 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7055 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7056 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7058 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7059 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7060 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7062 /* mute analog input loopbacks */
7063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7065 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7066 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7067 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7069 /* Front Pin: output 0 (0x0c) */
7070 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7071 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7072 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7073 /* Rear Pin: output 1 (0x0d) */
7074 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7075 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7076 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7077 /* CLFE Pin: output 2 (0x0e) */
7078 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7079 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7080 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7081 /* Side Pin: output 3 (0x0f) */
7082 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7083 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7084 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7085 /* Mic (rear) pin: input vref at 80% */
7086 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7087 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7088 /* Front Mic pin: input vref at 80% */
7089 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7090 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7091 /* Line In pin: input */
7092 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7093 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7094 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7095 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7096 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7097 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7098 /* CD pin widget for input */
7099 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7101 /* FIXME: use matrix-type input source selection */
7102 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7104 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7105 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7106 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7107 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7111 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7112 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7113 /* ADC2: mute amp left and right */
7114 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7115 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7116 /* ADC3: mute amp left and right */
7117 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7118 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7123 static struct hda_verb alc882_adc1_init_verbs[] = {
7124 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7125 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7126 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7127 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7128 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7129 /* ADC1: mute amp left and right */
7130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7131 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7135 static struct hda_verb alc882_eapd_verbs[] = {
7136 /* change to EAPD mode */
7137 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7138 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7142 static struct hda_verb alc889_eapd_verbs[] = {
7143 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7144 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7148 static struct hda_verb alc_hp15_unsol_verbs[] = {
7149 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7150 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7154 static struct hda_verb alc885_init_verbs[] = {
7155 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7156 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7157 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7158 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7160 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7161 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7162 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7164 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7165 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7166 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7168 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7169 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7170 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7172 /* mute analog input loopbacks */
7173 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7174 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7175 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7177 /* Front HP Pin: output 0 (0x0c) */
7178 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7180 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7181 /* Front Pin: output 0 (0x0c) */
7182 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7183 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7184 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7185 /* Rear Pin: output 1 (0x0d) */
7186 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7187 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7188 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7189 /* CLFE Pin: output 2 (0x0e) */
7190 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7191 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7192 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7193 /* Side Pin: output 3 (0x0f) */
7194 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7195 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7196 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7197 /* Mic (rear) pin: input vref at 80% */
7198 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7199 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7200 /* Front Mic pin: input vref at 80% */
7201 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7202 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7203 /* Line In pin: input */
7204 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7205 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7207 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7209 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7210 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7211 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7213 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7214 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7215 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7220 /* ADC2: mute amp left and right */
7221 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7222 /* ADC3: mute amp left and right */
7223 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7228 static struct hda_verb alc885_init_input_verbs[] = {
7229 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7231 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7236 /* Unmute Selector 24h and set the default input to front mic */
7237 static struct hda_verb alc889_init_input_verbs[] = {
7238 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7239 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7244 #define alc883_init_verbs alc882_base_init_verbs
7247 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7248 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7249 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7250 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7251 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7252 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7253 /* FIXME: this looks suspicious...
7254 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7255 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7260 static struct hda_verb alc882_macpro_init_verbs[] = {
7261 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7262 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7263 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7265 /* Front Pin: output 0 (0x0c) */
7266 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7267 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7268 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7269 /* Front Mic pin: input vref at 80% */
7270 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7271 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7272 /* Speaker: output */
7273 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7274 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7275 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7276 /* Headphone output (output 0 - 0x0c) */
7277 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7278 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7279 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7281 /* FIXME: use matrix-type input source selection */
7282 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7283 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7284 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7285 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7286 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7287 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7289 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7290 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7291 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7294 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7295 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7296 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7297 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7298 /* ADC1: mute amp left and right */
7299 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7300 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7301 /* ADC2: mute amp left and right */
7302 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7303 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7304 /* ADC3: mute amp left and right */
7305 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7306 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7312 static struct hda_verb alc885_mb5_init_verbs[] = {
7314 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7315 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7316 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7317 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7319 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7320 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7321 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7322 /* Surround mixer */
7323 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7324 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7325 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7327 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7329 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7331 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7332 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7333 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7334 /* Front Pin (0x0c) */
7335 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7336 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7337 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7338 /* LFE Pin (0x0e) */
7339 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7340 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7341 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7343 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7344 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7345 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7346 /* Front Mic pin: input vref at 80% */
7347 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7348 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7350 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7351 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7354 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7355 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7356 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7360 /* Macbook Pro rev3 */
7361 static struct hda_verb alc885_mbp3_init_verbs[] = {
7362 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7363 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7364 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7367 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7368 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7369 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7370 /* Front Pin: output 0 (0x0c) */
7371 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7372 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7373 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7374 /* HP Pin: output 0 (0x0d) */
7375 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7376 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7377 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7378 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7379 /* Mic (rear) pin: input vref at 80% */
7380 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7381 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7382 /* Front Mic pin: input vref at 80% */
7383 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7384 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7385 /* Line In pin: use output 1 when in LineOut mode */
7386 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7387 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7388 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7390 /* FIXME: use matrix-type input source selection */
7391 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7392 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7393 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7395 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7396 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7399 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7400 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7401 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7405 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7407 /* ADC1: mute amp left and right */
7408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7409 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7410 /* ADC2: mute amp left and right */
7411 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7412 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7413 /* ADC3: mute amp left and right */
7414 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7415 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7420 /* iMac 24 mixer. */
7421 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7422 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7423 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7427 /* iMac 24 init verbs. */
7428 static struct hda_verb alc885_imac24_init_verbs[] = {
7429 /* Internal speakers: output 0 (0x0c) */
7430 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7431 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7432 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7433 /* Internal speakers: output 0 (0x0c) */
7434 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7435 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7436 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7437 /* Headphone: output 0 (0x0c) */
7438 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7439 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7440 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7441 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7442 /* Front Mic: input vref at 80% */
7443 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7444 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7448 /* Toggle speaker-output according to the hp-jack state */
7449 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
7451 struct alc_spec *spec = codec->spec;
7453 spec->autocfg.hp_pins[0] = 0x14;
7454 spec->autocfg.speaker_pins[0] = 0x18;
7455 spec->autocfg.speaker_pins[1] = 0x1a;
7456 alc_automute_amp(codec);
7459 static void alc885_mbp3_init_hook(struct hda_codec *codec)
7461 struct alc_spec *spec = codec->spec;
7463 spec->autocfg.hp_pins[0] = 0x15;
7464 spec->autocfg.speaker_pins[0] = 0x14;
7465 alc_automute_amp(codec);
7469 static struct hda_verb alc882_targa_verbs[] = {
7470 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7471 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7473 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7474 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7476 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7477 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7478 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7480 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7484 /* toggle speaker-output according to the hp-jack state */
7485 static void alc882_targa_automute(struct hda_codec *codec)
7487 struct alc_spec *spec = codec->spec;
7488 alc_automute_amp(codec);
7489 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7490 spec->jack_present ? 1 : 3);
7493 static void alc882_targa_init_hook(struct hda_codec *codec)
7495 struct alc_spec *spec = codec->spec;
7497 spec->autocfg.hp_pins[0] = 0x14;
7498 spec->autocfg.speaker_pins[0] = 0x1b;
7499 alc882_targa_automute(codec);
7502 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7504 if ((res >> 26) == ALC880_HP_EVENT)
7505 alc882_targa_automute(codec);
7508 static struct hda_verb alc882_asus_a7j_verbs[] = {
7509 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7510 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7512 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7513 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7514 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7516 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7517 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7518 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7520 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7521 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7522 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7526 static struct hda_verb alc882_asus_a7m_verbs[] = {
7527 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7530 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7531 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7532 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7534 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7535 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7536 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7538 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7539 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7540 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7544 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7546 unsigned int gpiostate, gpiomask, gpiodir;
7548 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7549 AC_VERB_GET_GPIO_DATA, 0);
7552 gpiostate |= (1 << pin);
7554 gpiostate &= ~(1 << pin);
7556 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7557 AC_VERB_GET_GPIO_MASK, 0);
7558 gpiomask |= (1 << pin);
7560 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7561 AC_VERB_GET_GPIO_DIRECTION, 0);
7562 gpiodir |= (1 << pin);
7565 snd_hda_codec_write(codec, codec->afg, 0,
7566 AC_VERB_SET_GPIO_MASK, gpiomask);
7567 snd_hda_codec_write(codec, codec->afg, 0,
7568 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7572 snd_hda_codec_write(codec, codec->afg, 0,
7573 AC_VERB_SET_GPIO_DATA, gpiostate);
7576 /* set up GPIO at initialization */
7577 static void alc885_macpro_init_hook(struct hda_codec *codec)
7579 alc882_gpio_mute(codec, 0, 0);
7580 alc882_gpio_mute(codec, 1, 0);
7583 /* set up GPIO and update auto-muting at initialization */
7584 static void alc885_imac24_init_hook(struct hda_codec *codec)
7586 alc885_macpro_init_hook(codec);
7587 alc885_imac24_automute_init_hook(codec);
7591 * generic initialization of ADC, input mixers and output mixers
7593 static struct hda_verb alc883_auto_init_verbs[] = {
7595 * Unmute ADC0-2 and set the default input to mic-in
7597 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7598 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7599 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7600 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7602 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7604 * Note: PASD motherboards uses the Line In 2 as the input for
7605 * front panel mic (mic 2)
7607 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7615 * Set up output mixers (0x0c - 0x0f)
7617 /* set vol=0 to output mixers */
7618 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7619 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7620 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7621 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7622 /* set up input amps for analog loopback */
7623 /* Amp Indices: DAC = 0, mixer = 1 */
7624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7626 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7627 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7628 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7629 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7630 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7631 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7632 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7633 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7635 /* FIXME: use matrix-type input source selection */
7636 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7638 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7639 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7640 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7641 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7643 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7644 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7645 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7646 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7651 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7652 static struct hda_verb alc889A_mb31_ch2_init[] = {
7653 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7654 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7655 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7656 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7660 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7661 static struct hda_verb alc889A_mb31_ch4_init[] = {
7662 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7663 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7664 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7665 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7669 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7670 static struct hda_verb alc889A_mb31_ch5_init[] = {
7671 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7672 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7673 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7674 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7678 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7679 static struct hda_verb alc889A_mb31_ch6_init[] = {
7680 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7681 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7682 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7683 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7687 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7688 { 2, alc889A_mb31_ch2_init },
7689 { 4, alc889A_mb31_ch4_init },
7690 { 5, alc889A_mb31_ch5_init },
7691 { 6, alc889A_mb31_ch6_init },
7694 static struct hda_verb alc883_medion_eapd_verbs[] = {
7695 /* eanable EAPD on medion laptop */
7696 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7697 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7701 #define alc883_base_mixer alc882_base_mixer
7703 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7704 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7705 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7706 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7707 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7708 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7709 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7710 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7711 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7712 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7713 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7714 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7715 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7716 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7720 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7721 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7722 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7723 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7724 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7725 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7726 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7727 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7728 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7729 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7730 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7734 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7735 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7736 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7737 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7738 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7739 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7740 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7741 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7742 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7743 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7744 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7748 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7749 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7750 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7751 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7752 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7753 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7754 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7755 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7756 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7757 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7758 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7759 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7760 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7761 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7765 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7766 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7767 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7768 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7769 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7770 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7771 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7772 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7773 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7774 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7775 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7776 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7777 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7778 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7780 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7781 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7782 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7783 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7784 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7788 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7789 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7790 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7791 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7792 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7793 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7795 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7796 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7797 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7798 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7799 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7800 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7801 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7802 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7804 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7805 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7806 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7807 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7808 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7812 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7813 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7814 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7815 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7816 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7817 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7819 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7820 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7821 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7822 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7823 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7824 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7825 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7826 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7827 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7828 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7829 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7830 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7831 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7832 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7836 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7837 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7838 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7839 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7840 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7841 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7842 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7843 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7844 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7845 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7846 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7847 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7848 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7849 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7850 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7851 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7852 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7853 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7854 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7855 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7859 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7860 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7862 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7863 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7864 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7865 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7866 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7867 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7868 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7869 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7870 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7871 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7872 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7874 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7879 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7880 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7881 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7882 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7883 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7884 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7886 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7887 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7888 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7889 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7890 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7894 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7895 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7896 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7897 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7898 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7899 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7901 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7902 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7906 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7907 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7908 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7909 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7910 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7911 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7914 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7915 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7919 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7920 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7921 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7922 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7923 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7924 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7925 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7926 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7927 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7928 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7932 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7933 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7934 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7935 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7936 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7937 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7938 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7939 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7940 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7944 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7945 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7946 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7947 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7948 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7949 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7950 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7951 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7952 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7954 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7955 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7959 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7960 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7961 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7962 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7963 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7964 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7965 0x0d, 1, 0x0, HDA_OUTPUT),
7966 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7967 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7968 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7969 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7970 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7971 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7972 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7973 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7974 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7975 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7976 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7977 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7979 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7980 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7984 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
7986 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7987 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7988 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7989 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7990 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
7992 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
7993 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
7994 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
7995 /* Output switches */
7996 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
7997 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
7998 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8000 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8001 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8003 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8004 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8005 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8006 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8010 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8011 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8012 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8013 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8015 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8016 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8020 static struct hda_bind_ctls alc883_bind_cap_vol = {
8021 .ops = &snd_hda_bind_vol,
8023 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8024 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8029 static struct hda_bind_ctls alc883_bind_cap_switch = {
8030 .ops = &snd_hda_bind_sw,
8032 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8033 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8038 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8039 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8040 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8041 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8042 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8043 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8044 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8045 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8046 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8050 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8051 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8052 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8054 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8055 /* .name = "Capture Source", */
8056 .name = "Input Source",
8058 .info = alc_mux_enum_info,
8059 .get = alc_mux_enum_get,
8060 .put = alc_mux_enum_put,
8065 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8067 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8068 .name = "Channel Mode",
8069 .info = alc_ch_mode_info,
8070 .get = alc_ch_mode_get,
8071 .put = alc_ch_mode_put,
8076 /* toggle speaker-output according to the hp-jack state */
8077 static void alc883_mitac_init_hook(struct hda_codec *codec)
8079 struct alc_spec *spec = codec->spec;
8081 spec->autocfg.hp_pins[0] = 0x15;
8082 spec->autocfg.speaker_pins[0] = 0x14;
8083 spec->autocfg.speaker_pins[1] = 0x17;
8084 alc_automute_amp(codec);
8087 /* auto-toggle front mic */
8089 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8091 unsigned int present;
8094 present = snd_hda_codec_read(codec, 0x18, 0,
8095 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8096 bits = present ? HDA_AMP_MUTE : 0;
8097 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8101 static struct hda_verb alc883_mitac_verbs[] = {
8103 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8104 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8106 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8107 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8109 /* enable unsolicited event */
8110 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8111 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8116 static struct hda_verb alc883_clevo_m720_verbs[] = {
8118 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8121 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8122 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8124 /* enable unsolicited event */
8125 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8126 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8131 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8133 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8134 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8136 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8137 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8139 /* enable unsolicited event */
8140 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8145 static struct hda_verb alc883_targa_verbs[] = {
8146 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8147 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8149 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8150 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8152 /* Connect Line-Out side jack (SPDIF) to Side */
8153 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8154 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8155 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8156 /* Connect Mic jack to CLFE */
8157 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8158 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8159 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8160 /* Connect Line-in jack to Surround */
8161 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8162 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8163 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8164 /* Connect HP out jack to Front */
8165 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8166 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8167 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8169 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8174 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8175 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8176 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8177 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8181 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8182 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8183 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8184 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8185 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8189 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8190 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8191 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8192 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8193 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8194 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8198 static struct hda_verb alc883_haier_w66_verbs[] = {
8199 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8202 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8204 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8205 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8206 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8207 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8211 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8212 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8213 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8214 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8215 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8216 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8217 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8218 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8219 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8223 static struct hda_verb alc888_6st_dell_verbs[] = {
8224 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8228 static struct hda_verb alc883_vaiott_verbs[] = {
8230 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8231 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8233 /* enable unsolicited event */
8234 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8239 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8241 struct alc_spec *spec = codec->spec;
8243 spec->autocfg.hp_pins[0] = 0x1b;
8244 spec->autocfg.speaker_pins[0] = 0x14;
8245 spec->autocfg.speaker_pins[1] = 0x16;
8246 spec->autocfg.speaker_pins[2] = 0x18;
8247 alc_automute_amp(codec);
8250 static struct hda_verb alc888_3st_hp_verbs[] = {
8251 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8252 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8253 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8254 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8261 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8262 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8263 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8264 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8265 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8272 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8273 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8274 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8275 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8276 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8277 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8284 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8285 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8286 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8287 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8288 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8289 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8290 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8294 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8295 { 2, alc888_3st_hp_2ch_init },
8296 { 4, alc888_3st_hp_4ch_init },
8297 { 6, alc888_3st_hp_6ch_init },
8300 /* toggle front-jack and RCA according to the hp-jack state */
8301 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8303 unsigned int present;
8305 present = snd_hda_codec_read(codec, 0x1b, 0,
8306 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8307 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8308 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8309 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8310 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8313 /* toggle RCA according to the front-jack state */
8314 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8316 unsigned int present;
8318 present = snd_hda_codec_read(codec, 0x14, 0,
8319 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8320 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8321 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8324 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8327 if ((res >> 26) == ALC880_HP_EVENT)
8328 alc888_lenovo_ms7195_front_automute(codec);
8329 if ((res >> 26) == ALC880_FRONT_EVENT)
8330 alc888_lenovo_ms7195_rca_automute(codec);
8333 static struct hda_verb alc883_medion_md2_verbs[] = {
8334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8337 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8339 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8343 /* toggle speaker-output according to the hp-jack state */
8344 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8346 struct alc_spec *spec = codec->spec;
8348 spec->autocfg.hp_pins[0] = 0x14;
8349 spec->autocfg.speaker_pins[0] = 0x15;
8350 alc_automute_amp(codec);
8353 /* toggle speaker-output according to the hp-jack state */
8354 #define alc883_targa_init_hook alc882_targa_init_hook
8355 #define alc883_targa_unsol_event alc882_targa_unsol_event
8357 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8359 unsigned int present;
8361 present = snd_hda_codec_read(codec, 0x18, 0,
8362 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8363 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8364 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8367 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8369 struct alc_spec *spec = codec->spec;
8371 spec->autocfg.hp_pins[0] = 0x15;
8372 spec->autocfg.speaker_pins[0] = 0x14;
8373 alc_automute_amp(codec);
8374 alc883_clevo_m720_mic_automute(codec);
8377 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8380 switch (res >> 26) {
8381 case ALC880_MIC_EVENT:
8382 alc883_clevo_m720_mic_automute(codec);
8385 alc_automute_amp_unsol_event(codec, res);
8390 /* toggle speaker-output according to the hp-jack state */
8391 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8393 struct alc_spec *spec = codec->spec;
8395 spec->autocfg.hp_pins[0] = 0x14;
8396 spec->autocfg.speaker_pins[0] = 0x15;
8397 alc_automute_amp(codec);
8400 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8402 struct alc_spec *spec = codec->spec;
8404 spec->autocfg.hp_pins[0] = 0x1b;
8405 spec->autocfg.speaker_pins[0] = 0x14;
8406 alc_automute_amp(codec);
8409 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8411 unsigned int present;
8414 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8415 & AC_PINSENSE_PRESENCE;
8416 bits = present ? HDA_AMP_MUTE : 0;
8417 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8418 HDA_AMP_MUTE, bits);
8421 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8423 unsigned int present;
8426 present = snd_hda_codec_read(codec, 0x1b, 0,
8427 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8428 bits = present ? HDA_AMP_MUTE : 0;
8429 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8430 HDA_AMP_MUTE, bits);
8431 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8432 HDA_AMP_MUTE, bits);
8435 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8438 if ((res >> 26) == ALC880_HP_EVENT)
8439 alc883_lenovo_101e_all_automute(codec);
8440 if ((res >> 26) == ALC880_FRONT_EVENT)
8441 alc883_lenovo_101e_ispeaker_automute(codec);
8444 /* toggle speaker-output according to the hp-jack state */
8445 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8447 struct alc_spec *spec = codec->spec;
8449 spec->autocfg.hp_pins[0] = 0x14;
8450 spec->autocfg.speaker_pins[0] = 0x15;
8451 spec->autocfg.speaker_pins[1] = 0x16;
8452 alc_automute_amp(codec);
8455 static struct hda_verb alc883_acer_eapd_verbs[] = {
8456 /* HP Pin: output 0 (0x0c) */
8457 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8458 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8459 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8460 /* Front Pin: output 0 (0x0c) */
8461 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8462 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8463 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8464 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8465 /* eanable EAPD on medion laptop */
8466 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8467 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8468 /* enable unsolicited event */
8469 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8473 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8475 struct alc_spec *spec = codec->spec;
8477 spec->autocfg.hp_pins[0] = 0x1b;
8478 spec->autocfg.speaker_pins[0] = 0x14;
8479 spec->autocfg.speaker_pins[1] = 0x15;
8480 spec->autocfg.speaker_pins[2] = 0x16;
8481 spec->autocfg.speaker_pins[3] = 0x17;
8482 alc_automute_amp(codec);
8485 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8487 struct alc_spec *spec = codec->spec;
8489 spec->autocfg.hp_pins[0] = 0x1b;
8490 spec->autocfg.speaker_pins[0] = 0x14;
8491 spec->autocfg.speaker_pins[1] = 0x15;
8492 spec->autocfg.speaker_pins[2] = 0x16;
8493 spec->autocfg.speaker_pins[3] = 0x17;
8494 spec->autocfg.speaker_pins[4] = 0x1a;
8495 alc_automute_amp(codec);
8498 static void alc883_vaiott_init_hook(struct hda_codec *codec)
8500 struct alc_spec *spec = codec->spec;
8502 spec->autocfg.hp_pins[0] = 0x15;
8503 spec->autocfg.speaker_pins[0] = 0x14;
8504 spec->autocfg.speaker_pins[1] = 0x17;
8505 alc_automute_amp(codec);
8508 static struct hda_verb alc888_asus_m90v_verbs[] = {
8509 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8511 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8512 /* enable unsolicited event */
8513 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8514 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8518 static void alc883_nb_mic_automute(struct hda_codec *codec)
8520 unsigned int present;
8522 present = snd_hda_codec_read(codec, 0x18, 0,
8523 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8524 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8525 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8526 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8527 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8530 static void alc883_M90V_init_hook(struct hda_codec *codec)
8532 struct alc_spec *spec = codec->spec;
8534 spec->autocfg.hp_pins[0] = 0x1b;
8535 spec->autocfg.speaker_pins[0] = 0x14;
8536 spec->autocfg.speaker_pins[1] = 0x15;
8537 spec->autocfg.speaker_pins[2] = 0x16;
8538 alc_automute_pin(codec);
8541 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8544 switch (res >> 26) {
8545 case ALC880_MIC_EVENT:
8546 alc883_nb_mic_automute(codec);
8549 alc_sku_unsol_event(codec, res);
8554 static void alc883_mode2_inithook(struct hda_codec *codec)
8556 alc883_M90V_init_hook(codec);
8557 alc883_nb_mic_automute(codec);
8560 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8561 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8562 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8563 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8566 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8567 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8568 /* enable unsolicited event */
8569 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8573 static void alc883_eee1601_inithook(struct hda_codec *codec)
8575 struct alc_spec *spec = codec->spec;
8577 spec->autocfg.hp_pins[0] = 0x14;
8578 spec->autocfg.speaker_pins[0] = 0x1b;
8579 alc_automute_pin(codec);
8582 static struct hda_verb alc889A_mb31_verbs[] = {
8583 /* Init rear pin (used as headphone output) */
8584 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8585 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8586 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8587 /* Init line pin (used as output in 4ch and 6ch mode) */
8588 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8589 /* Init line 2 pin (used as headphone out by default) */
8590 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8591 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8595 /* Mute speakers according to the headphone jack state */
8596 static void alc889A_mb31_automute(struct hda_codec *codec)
8598 unsigned int present;
8600 /* Mute only in 2ch or 4ch mode */
8601 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8603 present = snd_hda_codec_read(codec, 0x15, 0,
8604 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8605 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8606 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8607 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8608 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8612 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8614 if ((res >> 26) == ALC880_HP_EVENT)
8615 alc889A_mb31_automute(codec);
8619 #ifdef CONFIG_SND_HDA_POWER_SAVE
8620 #define alc882_loopbacks alc880_loopbacks
8623 /* pcm configuration: identical with ALC880 */
8624 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8625 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8626 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8627 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8629 static hda_nid_t alc883_slave_dig_outs[] = {
8630 ALC1200_DIGOUT_NID, 0,
8633 static hda_nid_t alc1200_slave_dig_outs[] = {
8634 ALC883_DIGOUT_NID, 0,
8638 * configuration and preset
8640 static const char *alc882_models[ALC882_MODEL_LAST] = {
8641 [ALC882_3ST_DIG] = "3stack-dig",
8642 [ALC882_6ST_DIG] = "6stack-dig",
8643 [ALC882_ARIMA] = "arima",
8644 [ALC882_W2JC] = "w2jc",
8645 [ALC882_TARGA] = "targa",
8646 [ALC882_ASUS_A7J] = "asus-a7j",
8647 [ALC882_ASUS_A7M] = "asus-a7m",
8648 [ALC885_MACPRO] = "macpro",
8649 [ALC885_MB5] = "mb5",
8650 [ALC885_MBP3] = "mbp3",
8651 [ALC885_IMAC24] = "imac24",
8652 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8653 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8654 [ALC883_3ST_6ch] = "3stack-6ch",
8655 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8656 [ALC883_TARGA_DIG] = "targa-dig",
8657 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8658 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8659 [ALC883_ACER] = "acer",
8660 [ALC883_ACER_ASPIRE] = "acer-aspire",
8661 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8662 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8663 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8664 [ALC883_MEDION] = "medion",
8665 [ALC883_MEDION_MD2] = "medion-md2",
8666 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8667 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8668 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8669 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8670 [ALC888_LENOVO_SKY] = "lenovo-sky",
8671 [ALC883_HAIER_W66] = "haier-w66",
8672 [ALC888_3ST_HP] = "3stack-hp",
8673 [ALC888_6ST_DELL] = "6stack-dell",
8674 [ALC883_MITAC] = "mitac",
8675 [ALC883_CLEVO_M720] = "clevo-m720",
8676 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8677 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8678 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8679 [ALC889A_INTEL] = "intel-alc889a",
8680 [ALC889_INTEL] = "intel-x58",
8681 [ALC1200_ASUS_P5Q] = "asus-p5q",
8682 [ALC889A_MB31] = "mb31",
8683 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8684 [ALC882_AUTO] = "auto",
8687 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8688 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8690 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8691 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8692 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8693 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8694 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8695 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8696 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8697 ALC888_ACER_ASPIRE_4930G),
8698 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8699 ALC888_ACER_ASPIRE_4930G),
8700 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8701 ALC888_ACER_ASPIRE_8930G),
8702 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8703 ALC888_ACER_ASPIRE_8930G),
8704 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8705 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8706 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8707 ALC888_ACER_ASPIRE_6530G),
8708 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8709 ALC888_ACER_ASPIRE_6530G),
8710 /* default Acer -- disabled as it causes more problems.
8711 * model=auto should work fine now
8713 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8715 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8717 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8718 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8719 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8720 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8721 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8722 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8724 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8725 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8726 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8727 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8728 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8729 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8730 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8731 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8732 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8733 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8734 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8736 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8737 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8738 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8739 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8740 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8741 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8742 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8743 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8744 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8746 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8747 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8748 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8749 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8750 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8751 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8752 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8753 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8754 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8755 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8756 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8757 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8758 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8759 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8760 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8761 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8762 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8763 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8764 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8765 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8766 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8767 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8768 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8769 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8770 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8771 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8772 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8773 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8774 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8776 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8777 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8778 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8779 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8780 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8781 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8782 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8783 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8784 ALC883_FUJITSU_PI2515),
8785 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8786 ALC888_FUJITSU_XA3530),
8787 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8788 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8789 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8790 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8791 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8792 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8793 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8794 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8795 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8797 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8798 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8799 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8800 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8801 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8802 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8803 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8808 /* codec SSID table for Intel Mac */
8809 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8810 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8811 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8812 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8813 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8814 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8815 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8816 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8817 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8818 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8819 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8820 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8821 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8822 * no perfect solution yet
8824 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8828 static struct alc_config_preset alc882_presets[] = {
8829 [ALC882_3ST_DIG] = {
8830 .mixers = { alc882_base_mixer },
8831 .init_verbs = { alc882_base_init_verbs,
8832 alc882_adc1_init_verbs },
8833 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8834 .dac_nids = alc882_dac_nids,
8835 .dig_out_nid = ALC882_DIGOUT_NID,
8836 .dig_in_nid = ALC882_DIGIN_NID,
8837 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8838 .channel_mode = alc882_ch_modes,
8840 .input_mux = &alc882_capture_source,
8842 [ALC882_6ST_DIG] = {
8843 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8844 .init_verbs = { alc882_base_init_verbs,
8845 alc882_adc1_init_verbs },
8846 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8847 .dac_nids = alc882_dac_nids,
8848 .dig_out_nid = ALC882_DIGOUT_NID,
8849 .dig_in_nid = ALC882_DIGIN_NID,
8850 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8851 .channel_mode = alc882_sixstack_modes,
8852 .input_mux = &alc882_capture_source,
8855 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8856 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8857 alc882_eapd_verbs },
8858 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8859 .dac_nids = alc882_dac_nids,
8860 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8861 .channel_mode = alc882_sixstack_modes,
8862 .input_mux = &alc882_capture_source,
8865 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8866 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8867 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8868 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8869 .dac_nids = alc882_dac_nids,
8870 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8871 .channel_mode = alc880_threestack_modes,
8873 .input_mux = &alc882_capture_source,
8874 .dig_out_nid = ALC882_DIGOUT_NID,
8877 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8878 .init_verbs = { alc885_mbp3_init_verbs,
8879 alc880_gpio1_init_verbs },
8880 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8881 .dac_nids = alc882_dac_nids,
8882 .channel_mode = alc885_mbp_6ch_modes,
8883 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8884 .input_mux = &alc882_capture_source,
8885 .dig_out_nid = ALC882_DIGOUT_NID,
8886 .dig_in_nid = ALC882_DIGIN_NID,
8887 .unsol_event = alc_automute_amp_unsol_event,
8888 .init_hook = alc885_mbp3_init_hook,
8891 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8892 .init_verbs = { alc885_mb5_init_verbs,
8893 alc880_gpio1_init_verbs },
8894 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8895 .dac_nids = alc882_dac_nids,
8896 .channel_mode = alc885_mb5_6ch_modes,
8897 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8898 .input_mux = &mb5_capture_source,
8899 .dig_out_nid = ALC882_DIGOUT_NID,
8900 .dig_in_nid = ALC882_DIGIN_NID,
8903 .mixers = { alc882_macpro_mixer },
8904 .init_verbs = { alc882_macpro_init_verbs },
8905 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8906 .dac_nids = alc882_dac_nids,
8907 .dig_out_nid = ALC882_DIGOUT_NID,
8908 .dig_in_nid = ALC882_DIGIN_NID,
8909 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8910 .channel_mode = alc882_ch_modes,
8911 .input_mux = &alc882_capture_source,
8912 .init_hook = alc885_macpro_init_hook,
8915 .mixers = { alc885_imac24_mixer },
8916 .init_verbs = { alc885_imac24_init_verbs },
8917 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8918 .dac_nids = alc882_dac_nids,
8919 .dig_out_nid = ALC882_DIGOUT_NID,
8920 .dig_in_nid = ALC882_DIGIN_NID,
8921 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8922 .channel_mode = alc882_ch_modes,
8923 .input_mux = &alc882_capture_source,
8924 .unsol_event = alc_automute_amp_unsol_event,
8925 .init_hook = alc885_imac24_init_hook,
8928 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8929 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8930 alc880_gpio3_init_verbs, alc882_targa_verbs},
8931 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8932 .dac_nids = alc882_dac_nids,
8933 .dig_out_nid = ALC882_DIGOUT_NID,
8934 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8935 .adc_nids = alc882_adc_nids,
8936 .capsrc_nids = alc882_capsrc_nids,
8937 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8938 .channel_mode = alc882_3ST_6ch_modes,
8940 .input_mux = &alc882_capture_source,
8941 .unsol_event = alc882_targa_unsol_event,
8942 .init_hook = alc882_targa_init_hook,
8944 [ALC882_ASUS_A7J] = {
8945 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8946 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8947 alc882_asus_a7j_verbs},
8948 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8949 .dac_nids = alc882_dac_nids,
8950 .dig_out_nid = ALC882_DIGOUT_NID,
8951 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8952 .adc_nids = alc882_adc_nids,
8953 .capsrc_nids = alc882_capsrc_nids,
8954 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8955 .channel_mode = alc882_3ST_6ch_modes,
8957 .input_mux = &alc882_capture_source,
8959 [ALC882_ASUS_A7M] = {
8960 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8961 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8962 alc882_eapd_verbs, alc880_gpio1_init_verbs,
8963 alc882_asus_a7m_verbs },
8964 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8965 .dac_nids = alc882_dac_nids,
8966 .dig_out_nid = ALC882_DIGOUT_NID,
8967 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8968 .channel_mode = alc880_threestack_modes,
8970 .input_mux = &alc882_capture_source,
8972 [ALC883_3ST_2ch_DIG] = {
8973 .mixers = { alc883_3ST_2ch_mixer },
8974 .init_verbs = { alc883_init_verbs },
8975 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8976 .dac_nids = alc883_dac_nids,
8977 .dig_out_nid = ALC883_DIGOUT_NID,
8978 .dig_in_nid = ALC883_DIGIN_NID,
8979 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8980 .channel_mode = alc883_3ST_2ch_modes,
8981 .input_mux = &alc883_capture_source,
8983 [ALC883_3ST_6ch_DIG] = {
8984 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8985 .init_verbs = { alc883_init_verbs },
8986 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8987 .dac_nids = alc883_dac_nids,
8988 .dig_out_nid = ALC883_DIGOUT_NID,
8989 .dig_in_nid = ALC883_DIGIN_NID,
8990 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8991 .channel_mode = alc883_3ST_6ch_modes,
8993 .input_mux = &alc883_capture_source,
8995 [ALC883_3ST_6ch] = {
8996 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8997 .init_verbs = { alc883_init_verbs },
8998 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8999 .dac_nids = alc883_dac_nids,
9000 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9001 .channel_mode = alc883_3ST_6ch_modes,
9003 .input_mux = &alc883_capture_source,
9005 [ALC883_3ST_6ch_INTEL] = {
9006 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9007 .init_verbs = { alc883_init_verbs },
9008 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9009 .dac_nids = alc883_dac_nids,
9010 .dig_out_nid = ALC883_DIGOUT_NID,
9011 .dig_in_nid = ALC883_DIGIN_NID,
9012 .slave_dig_outs = alc883_slave_dig_outs,
9013 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9014 .channel_mode = alc883_3ST_6ch_intel_modes,
9016 .input_mux = &alc883_3stack_6ch_intel,
9019 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9020 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9021 alc_hp15_unsol_verbs },
9022 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9023 .dac_nids = alc883_dac_nids,
9024 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9025 .adc_nids = alc889_adc_nids,
9026 .dig_out_nid = ALC883_DIGOUT_NID,
9027 .dig_in_nid = ALC883_DIGIN_NID,
9028 .slave_dig_outs = alc883_slave_dig_outs,
9029 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9030 .channel_mode = alc889_8ch_intel_modes,
9031 .capsrc_nids = alc889_capsrc_nids,
9032 .input_mux = &alc889_capture_source,
9033 .init_hook = alc889_automute_init,
9034 .unsol_event = alc_automute_amp_unsol_event,
9038 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9039 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9040 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9041 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9042 .dac_nids = alc883_dac_nids,
9043 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9044 .adc_nids = alc889_adc_nids,
9045 .dig_out_nid = ALC883_DIGOUT_NID,
9046 .dig_in_nid = ALC883_DIGIN_NID,
9047 .slave_dig_outs = alc883_slave_dig_outs,
9048 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9049 .channel_mode = alc889_8ch_intel_modes,
9050 .capsrc_nids = alc889_capsrc_nids,
9051 .input_mux = &alc889_capture_source,
9052 .init_hook = alc889_intel_init_hook,
9053 .unsol_event = alc_automute_amp_unsol_event,
9056 [ALC883_6ST_DIG] = {
9057 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9058 .init_verbs = { alc883_init_verbs },
9059 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9060 .dac_nids = alc883_dac_nids,
9061 .dig_out_nid = ALC883_DIGOUT_NID,
9062 .dig_in_nid = ALC883_DIGIN_NID,
9063 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9064 .channel_mode = alc883_sixstack_modes,
9065 .input_mux = &alc883_capture_source,
9067 [ALC883_TARGA_DIG] = {
9068 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9069 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9070 alc883_targa_verbs},
9071 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9072 .dac_nids = alc883_dac_nids,
9073 .dig_out_nid = ALC883_DIGOUT_NID,
9074 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9075 .channel_mode = alc883_3ST_6ch_modes,
9077 .input_mux = &alc883_capture_source,
9078 .unsol_event = alc883_targa_unsol_event,
9079 .init_hook = alc883_targa_init_hook,
9081 [ALC883_TARGA_2ch_DIG] = {
9082 .mixers = { alc883_targa_2ch_mixer},
9083 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9084 alc883_targa_verbs},
9085 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9086 .dac_nids = alc883_dac_nids,
9087 .adc_nids = alc883_adc_nids_alt,
9088 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9089 .dig_out_nid = ALC883_DIGOUT_NID,
9090 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9091 .channel_mode = alc883_3ST_2ch_modes,
9092 .input_mux = &alc883_capture_source,
9093 .unsol_event = alc883_targa_unsol_event,
9094 .init_hook = alc883_targa_init_hook,
9096 [ALC883_TARGA_8ch_DIG] = {
9097 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9098 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9099 alc883_targa_verbs },
9100 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9101 .dac_nids = alc883_dac_nids,
9102 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9103 .adc_nids = alc883_adc_nids_rev,
9104 .capsrc_nids = alc883_capsrc_nids_rev,
9105 .dig_out_nid = ALC883_DIGOUT_NID,
9106 .dig_in_nid = ALC883_DIGIN_NID,
9107 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9108 .channel_mode = alc883_4ST_8ch_modes,
9110 .input_mux = &alc883_capture_source,
9111 .unsol_event = alc883_targa_unsol_event,
9112 .init_hook = alc883_targa_init_hook,
9115 .mixers = { alc883_base_mixer },
9116 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9117 * and the headphone jack. Turn this on and rely on the
9118 * standard mute methods whenever the user wants to turn
9119 * these outputs off.
9121 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9122 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9123 .dac_nids = alc883_dac_nids,
9124 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9125 .channel_mode = alc883_3ST_2ch_modes,
9126 .input_mux = &alc883_capture_source,
9128 [ALC883_ACER_ASPIRE] = {
9129 .mixers = { alc883_acer_aspire_mixer },
9130 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9131 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9132 .dac_nids = alc883_dac_nids,
9133 .dig_out_nid = ALC883_DIGOUT_NID,
9134 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9135 .channel_mode = alc883_3ST_2ch_modes,
9136 .input_mux = &alc883_capture_source,
9137 .unsol_event = alc_automute_amp_unsol_event,
9138 .init_hook = alc883_acer_aspire_init_hook,
9140 [ALC888_ACER_ASPIRE_4930G] = {
9141 .mixers = { alc888_base_mixer,
9142 alc883_chmode_mixer },
9143 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9144 alc888_acer_aspire_4930g_verbs },
9145 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9146 .dac_nids = alc883_dac_nids,
9147 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9148 .adc_nids = alc883_adc_nids_rev,
9149 .capsrc_nids = alc883_capsrc_nids_rev,
9150 .dig_out_nid = ALC883_DIGOUT_NID,
9151 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9152 .channel_mode = alc883_3ST_6ch_modes,
9155 ARRAY_SIZE(alc888_2_capture_sources),
9156 .input_mux = alc888_2_capture_sources,
9157 .unsol_event = alc_automute_amp_unsol_event,
9158 .init_hook = alc888_acer_aspire_4930g_init_hook,
9160 [ALC888_ACER_ASPIRE_6530G] = {
9161 .mixers = { alc888_acer_aspire_6530_mixer },
9162 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9163 alc888_acer_aspire_6530g_verbs },
9164 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9165 .dac_nids = alc883_dac_nids,
9166 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9167 .adc_nids = alc883_adc_nids_rev,
9168 .capsrc_nids = alc883_capsrc_nids_rev,
9169 .dig_out_nid = ALC883_DIGOUT_NID,
9170 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9171 .channel_mode = alc883_3ST_2ch_modes,
9173 ARRAY_SIZE(alc888_2_capture_sources),
9174 .input_mux = alc888_acer_aspire_6530_sources,
9175 .unsol_event = alc_automute_amp_unsol_event,
9176 .init_hook = alc888_acer_aspire_6530g_init_hook,
9178 [ALC888_ACER_ASPIRE_8930G] = {
9179 .mixers = { alc888_base_mixer,
9180 alc883_chmode_mixer },
9181 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9182 alc889_acer_aspire_8930g_verbs },
9183 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9184 .dac_nids = alc883_dac_nids,
9185 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9186 .adc_nids = alc889_adc_nids,
9187 .capsrc_nids = alc889_capsrc_nids,
9188 .dig_out_nid = ALC883_DIGOUT_NID,
9189 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9190 .channel_mode = alc883_3ST_6ch_modes,
9192 .const_channel_count = 6,
9194 ARRAY_SIZE(alc889_capture_sources),
9195 .input_mux = alc889_capture_sources,
9196 .unsol_event = alc_automute_amp_unsol_event,
9197 .init_hook = alc889_acer_aspire_8930g_init_hook,
9200 .mixers = { alc883_fivestack_mixer,
9201 alc883_chmode_mixer },
9202 .init_verbs = { alc883_init_verbs,
9203 alc883_medion_eapd_verbs },
9204 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9205 .dac_nids = alc883_dac_nids,
9206 .adc_nids = alc883_adc_nids_alt,
9207 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9208 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9209 .channel_mode = alc883_sixstack_modes,
9210 .input_mux = &alc883_capture_source,
9212 [ALC883_MEDION_MD2] = {
9213 .mixers = { alc883_medion_md2_mixer},
9214 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9215 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9216 .dac_nids = alc883_dac_nids,
9217 .dig_out_nid = ALC883_DIGOUT_NID,
9218 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9219 .channel_mode = alc883_3ST_2ch_modes,
9220 .input_mux = &alc883_capture_source,
9221 .unsol_event = alc_automute_amp_unsol_event,
9222 .init_hook = alc883_medion_md2_init_hook,
9224 [ALC883_LAPTOP_EAPD] = {
9225 .mixers = { alc883_base_mixer },
9226 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9227 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9228 .dac_nids = alc883_dac_nids,
9229 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9230 .channel_mode = alc883_3ST_2ch_modes,
9231 .input_mux = &alc883_capture_source,
9233 [ALC883_CLEVO_M720] = {
9234 .mixers = { alc883_clevo_m720_mixer },
9235 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9236 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9237 .dac_nids = alc883_dac_nids,
9238 .dig_out_nid = ALC883_DIGOUT_NID,
9239 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9240 .channel_mode = alc883_3ST_2ch_modes,
9241 .input_mux = &alc883_capture_source,
9242 .unsol_event = alc883_clevo_m720_unsol_event,
9243 .init_hook = alc883_clevo_m720_init_hook,
9245 [ALC883_LENOVO_101E_2ch] = {
9246 .mixers = { alc883_lenovo_101e_2ch_mixer},
9247 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9248 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9249 .dac_nids = alc883_dac_nids,
9250 .adc_nids = alc883_adc_nids_alt,
9251 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9252 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9253 .channel_mode = alc883_3ST_2ch_modes,
9254 .input_mux = &alc883_lenovo_101e_capture_source,
9255 .unsol_event = alc883_lenovo_101e_unsol_event,
9256 .init_hook = alc883_lenovo_101e_all_automute,
9258 [ALC883_LENOVO_NB0763] = {
9259 .mixers = { alc883_lenovo_nb0763_mixer },
9260 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9261 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9262 .dac_nids = alc883_dac_nids,
9263 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9264 .channel_mode = alc883_3ST_2ch_modes,
9266 .input_mux = &alc883_lenovo_nb0763_capture_source,
9267 .unsol_event = alc_automute_amp_unsol_event,
9268 .init_hook = alc883_medion_md2_init_hook,
9270 [ALC888_LENOVO_MS7195_DIG] = {
9271 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9272 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9273 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9274 .dac_nids = alc883_dac_nids,
9275 .dig_out_nid = ALC883_DIGOUT_NID,
9276 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9277 .channel_mode = alc883_3ST_6ch_modes,
9279 .input_mux = &alc883_capture_source,
9280 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9281 .init_hook = alc888_lenovo_ms7195_front_automute,
9283 [ALC883_HAIER_W66] = {
9284 .mixers = { alc883_targa_2ch_mixer},
9285 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9286 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9287 .dac_nids = alc883_dac_nids,
9288 .dig_out_nid = ALC883_DIGOUT_NID,
9289 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9290 .channel_mode = alc883_3ST_2ch_modes,
9291 .input_mux = &alc883_capture_source,
9292 .unsol_event = alc_automute_amp_unsol_event,
9293 .init_hook = alc883_haier_w66_init_hook,
9296 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9297 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9298 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9299 .dac_nids = alc883_dac_nids,
9300 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9301 .channel_mode = alc888_3st_hp_modes,
9303 .input_mux = &alc883_capture_source,
9304 .unsol_event = alc_automute_amp_unsol_event,
9305 .init_hook = alc888_3st_hp_init_hook,
9307 [ALC888_6ST_DELL] = {
9308 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9309 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9310 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9311 .dac_nids = alc883_dac_nids,
9312 .dig_out_nid = ALC883_DIGOUT_NID,
9313 .dig_in_nid = ALC883_DIGIN_NID,
9314 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9315 .channel_mode = alc883_sixstack_modes,
9316 .input_mux = &alc883_capture_source,
9317 .unsol_event = alc_automute_amp_unsol_event,
9318 .init_hook = alc888_6st_dell_init_hook,
9321 .mixers = { alc883_mitac_mixer },
9322 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9323 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9324 .dac_nids = alc883_dac_nids,
9325 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9326 .channel_mode = alc883_3ST_2ch_modes,
9327 .input_mux = &alc883_capture_source,
9328 .unsol_event = alc_automute_amp_unsol_event,
9329 .init_hook = alc883_mitac_init_hook,
9331 [ALC883_FUJITSU_PI2515] = {
9332 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9333 .init_verbs = { alc883_init_verbs,
9334 alc883_2ch_fujitsu_pi2515_verbs},
9335 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9336 .dac_nids = alc883_dac_nids,
9337 .dig_out_nid = ALC883_DIGOUT_NID,
9338 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9339 .channel_mode = alc883_3ST_2ch_modes,
9340 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9341 .unsol_event = alc_automute_amp_unsol_event,
9342 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
9344 [ALC888_FUJITSU_XA3530] = {
9345 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9346 .init_verbs = { alc883_init_verbs,
9347 alc888_fujitsu_xa3530_verbs },
9348 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9349 .dac_nids = alc883_dac_nids,
9350 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9351 .adc_nids = alc883_adc_nids_rev,
9352 .capsrc_nids = alc883_capsrc_nids_rev,
9353 .dig_out_nid = ALC883_DIGOUT_NID,
9354 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9355 .channel_mode = alc888_4ST_8ch_intel_modes,
9357 ARRAY_SIZE(alc888_2_capture_sources),
9358 .input_mux = alc888_2_capture_sources,
9359 .unsol_event = alc_automute_amp_unsol_event,
9360 .init_hook = alc888_fujitsu_xa3530_init_hook,
9362 [ALC888_LENOVO_SKY] = {
9363 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9364 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9365 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9366 .dac_nids = alc883_dac_nids,
9367 .dig_out_nid = ALC883_DIGOUT_NID,
9368 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9369 .channel_mode = alc883_sixstack_modes,
9371 .input_mux = &alc883_lenovo_sky_capture_source,
9372 .unsol_event = alc_automute_amp_unsol_event,
9373 .init_hook = alc888_lenovo_sky_init_hook,
9375 [ALC888_ASUS_M90V] = {
9376 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9377 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9378 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9379 .dac_nids = alc883_dac_nids,
9380 .dig_out_nid = ALC883_DIGOUT_NID,
9381 .dig_in_nid = ALC883_DIGIN_NID,
9382 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9383 .channel_mode = alc883_3ST_6ch_modes,
9385 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9386 .unsol_event = alc883_mode2_unsol_event,
9387 .init_hook = alc883_mode2_inithook,
9389 [ALC888_ASUS_EEE1601] = {
9390 .mixers = { alc883_asus_eee1601_mixer },
9391 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9392 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9393 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9394 .dac_nids = alc883_dac_nids,
9395 .dig_out_nid = ALC883_DIGOUT_NID,
9396 .dig_in_nid = ALC883_DIGIN_NID,
9397 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9398 .channel_mode = alc883_3ST_2ch_modes,
9400 .input_mux = &alc883_asus_eee1601_capture_source,
9401 .unsol_event = alc_sku_unsol_event,
9402 .init_hook = alc883_eee1601_inithook,
9404 [ALC1200_ASUS_P5Q] = {
9405 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9406 .init_verbs = { alc883_init_verbs },
9407 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9408 .dac_nids = alc883_dac_nids,
9409 .dig_out_nid = ALC1200_DIGOUT_NID,
9410 .dig_in_nid = ALC883_DIGIN_NID,
9411 .slave_dig_outs = alc1200_slave_dig_outs,
9412 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9413 .channel_mode = alc883_sixstack_modes,
9414 .input_mux = &alc883_capture_source,
9417 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9418 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9419 alc880_gpio1_init_verbs },
9420 .adc_nids = alc883_adc_nids,
9421 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9422 .dac_nids = alc883_dac_nids,
9423 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9424 .channel_mode = alc889A_mb31_6ch_modes,
9425 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9426 .input_mux = &alc889A_mb31_capture_source,
9427 .dig_out_nid = ALC883_DIGOUT_NID,
9428 .unsol_event = alc889A_mb31_unsol_event,
9429 .init_hook = alc889A_mb31_automute,
9431 [ALC883_SONY_VAIO_TT] = {
9432 .mixers = { alc883_vaiott_mixer },
9433 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9434 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9435 .dac_nids = alc883_dac_nids,
9436 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9437 .channel_mode = alc883_3ST_2ch_modes,
9438 .input_mux = &alc883_capture_source,
9439 .unsol_event = alc_automute_amp_unsol_event,
9440 .init_hook = alc883_vaiott_init_hook,
9449 PINFIX_ABIT_AW9D_MAX
9452 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9453 { 0x15, 0x01080104 }, /* side */
9454 { 0x16, 0x01011012 }, /* rear */
9455 { 0x17, 0x01016011 }, /* clfe */
9459 static const struct alc_pincfg *alc882_pin_fixes[] = {
9460 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9463 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9464 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9469 * BIOS auto configuration
9471 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9472 hda_nid_t nid, int pin_type,
9476 struct alc_spec *spec = codec->spec;
9479 alc_set_pin_output(codec, nid, pin_type);
9480 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9483 idx = spec->multiout.dac_nids[dac_idx] - 2;
9484 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9488 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9490 struct alc_spec *spec = codec->spec;
9493 for (i = 0; i <= HDA_SIDE; i++) {
9494 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9495 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9497 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9502 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9504 struct alc_spec *spec = codec->spec;
9507 pin = spec->autocfg.hp_pins[0];
9508 if (pin) /* connect to front */
9510 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9511 pin = spec->autocfg.speaker_pins[0];
9513 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9516 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9518 struct alc_spec *spec = codec->spec;
9521 for (i = 0; i < AUTO_PIN_LAST; i++) {
9522 hda_nid_t nid = spec->autocfg.input_pins[i];
9525 alc_set_input_pin(codec, nid, i);
9526 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9527 snd_hda_codec_write(codec, nid, 0,
9528 AC_VERB_SET_AMP_GAIN_MUTE,
9533 static void alc882_auto_init_input_src(struct hda_codec *codec)
9535 struct alc_spec *spec = codec->spec;
9538 for (c = 0; c < spec->num_adc_nids; c++) {
9539 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9540 hda_nid_t nid = spec->capsrc_nids[c];
9541 unsigned int mux_idx;
9542 const struct hda_input_mux *imux;
9543 int conns, mute, idx, item;
9545 conns = snd_hda_get_connections(codec, nid, conn_list,
9546 ARRAY_SIZE(conn_list));
9549 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9550 imux = &spec->input_mux[mux_idx];
9551 for (idx = 0; idx < conns; idx++) {
9552 /* if the current connection is the selected one,
9553 * unmute it as default - otherwise mute it
9555 mute = AMP_IN_MUTE(idx);
9556 for (item = 0; item < imux->num_items; item++) {
9557 if (imux->items[item].index == idx) {
9558 if (spec->cur_mux[c] == item)
9559 mute = AMP_IN_UNMUTE(idx);
9563 /* check if we have a selector or mixer
9564 * we could check for the widget type instead, but
9565 * just check for Amp-In presence (in case of mixer
9566 * without amp-in there is something wrong, this
9567 * function shouldn't be used or capsrc nid is wrong)
9569 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9570 snd_hda_codec_write(codec, nid, 0,
9571 AC_VERB_SET_AMP_GAIN_MUTE,
9573 else if (mute != AMP_IN_MUTE(idx))
9574 snd_hda_codec_write(codec, nid, 0,
9575 AC_VERB_SET_CONNECT_SEL,
9581 /* add mic boosts if needed */
9582 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9584 struct alc_spec *spec = codec->spec;
9588 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9589 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9590 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9592 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9596 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9597 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9598 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9600 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9607 /* almost identical with ALC880 parser... */
9608 static int alc882_parse_auto_config(struct hda_codec *codec)
9610 struct alc_spec *spec = codec->spec;
9611 struct auto_pin_cfg *autocfg = &spec->autocfg;
9614 int err = alc880_parse_auto_config(codec);
9619 return 0; /* no config found */
9621 err = alc_auto_add_mic_boost(codec);
9625 /* hack - override the init verbs */
9626 spec->init_verbs[0] = alc883_auto_init_verbs;
9627 /* if ADC 0x07 is available, initialize it, too */
9628 wcap = get_wcaps(codec, 0x07);
9629 wcap = get_wcaps_type(wcap);
9630 if (wcap == AC_WID_AUD_IN)
9631 add_verb(spec, alc882_adc1_init_verbs);
9633 /* digital-mic input pin is excluded in alc880_auto_create..()
9634 * because it's under 0x18
9636 if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9637 autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9638 struct hda_input_mux *imux = &spec->private_imux[0];
9639 for (i = 1; i < 3; i++)
9640 memcpy(&spec->private_imux[i],
9641 &spec->private_imux[0],
9642 sizeof(spec->private_imux[0]));
9643 imux->items[imux->num_items].label = "Int DMic";
9644 imux->items[imux->num_items].index = 0x0b;
9646 spec->num_mux_defs = 3;
9647 spec->input_mux = spec->private_imux;
9650 return 1; /* config found */
9653 /* additional initialization for auto-configuration model */
9654 static void alc882_auto_init(struct hda_codec *codec)
9656 struct alc_spec *spec = codec->spec;
9657 alc882_auto_init_multi_out(codec);
9658 alc882_auto_init_hp_out(codec);
9659 alc882_auto_init_analog_input(codec);
9660 alc882_auto_init_input_src(codec);
9661 if (spec->unsol_event)
9662 alc_inithook(codec);
9665 static int patch_alc882(struct hda_codec *codec)
9667 struct alc_spec *spec;
9668 int err, board_config;
9670 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9676 switch (codec->vendor_id) {
9681 /* ALC883 and variants */
9682 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9686 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9690 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9691 board_config = snd_hda_check_board_codec_sid_config(codec,
9692 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9694 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9695 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9697 board_config = ALC882_AUTO;
9700 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9702 if (board_config == ALC882_AUTO) {
9703 /* automatic parse from the BIOS config */
9704 err = alc882_parse_auto_config(codec);
9710 "hda_codec: Cannot set up configuration "
9711 "from BIOS. Using base mode...\n");
9712 board_config = ALC882_3ST_DIG;
9716 err = snd_hda_attach_beep_device(codec, 0x1);
9722 if (board_config != ALC882_AUTO)
9723 setup_preset(spec, &alc882_presets[board_config]);
9725 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9726 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9727 /* FIXME: setup DAC5 */
9728 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9729 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9731 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9732 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9734 if (codec->vendor_id == 0x10ec0888)
9735 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9737 if (!spec->adc_nids && spec->input_mux) {
9739 spec->num_adc_nids = 0;
9740 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9742 hda_nid_t nid = alc882_adc_nids[i];
9743 unsigned int wcap = get_wcaps(codec, nid);
9745 wcap = get_wcaps_type(wcap);
9746 if (wcap != AC_WID_AUD_IN)
9748 spec->private_adc_nids[spec->num_adc_nids] = nid;
9749 err = snd_hda_get_connections(codec, nid, &cap, 1);
9752 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9753 spec->num_adc_nids++;
9755 spec->adc_nids = spec->private_adc_nids;
9756 spec->capsrc_nids = spec->private_capsrc_nids;
9759 set_capture_mixer(codec);
9760 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9762 spec->vmaster_nid = 0x0c;
9764 codec->patch_ops = alc_patch_ops;
9765 if (board_config == ALC882_AUTO)
9766 spec->init_hook = alc882_auto_init;
9767 #ifdef CONFIG_SND_HDA_POWER_SAVE
9768 if (!spec->loopback.amplist)
9769 spec->loopback.amplist = alc882_loopbacks;
9771 codec->proc_widget_hook = print_realtek_coef;
9781 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9782 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9784 #define alc262_dac_nids alc260_dac_nids
9785 #define alc262_adc_nids alc882_adc_nids
9786 #define alc262_adc_nids_alt alc882_adc_nids_alt
9787 #define alc262_capsrc_nids alc882_capsrc_nids
9788 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9790 #define alc262_modes alc260_modes
9791 #define alc262_capture_source alc882_capture_source
9793 static hda_nid_t alc262_dmic_adc_nids[1] = {
9798 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9800 static struct snd_kcontrol_new alc262_base_mixer[] = {
9801 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9802 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9803 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9804 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9805 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9806 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9807 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9809 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9810 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9811 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9812 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9813 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9814 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9815 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9816 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9820 /* update HP, line and mono-out pins according to the master switch */
9821 static void alc262_hp_master_update(struct hda_codec *codec)
9823 struct alc_spec *spec = codec->spec;
9824 int val = spec->master_sw;
9827 snd_hda_codec_write_cache(codec, 0x1b, 0,
9828 AC_VERB_SET_PIN_WIDGET_CONTROL,
9830 snd_hda_codec_write_cache(codec, 0x15, 0,
9831 AC_VERB_SET_PIN_WIDGET_CONTROL,
9833 /* mono (speaker) depending on the HP jack sense */
9834 val = val && !spec->jack_present;
9835 snd_hda_codec_write_cache(codec, 0x16, 0,
9836 AC_VERB_SET_PIN_WIDGET_CONTROL,
9840 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9842 struct alc_spec *spec = codec->spec;
9843 unsigned int presence;
9844 presence = snd_hda_codec_read(codec, 0x1b, 0,
9845 AC_VERB_GET_PIN_SENSE, 0);
9846 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9847 alc262_hp_master_update(codec);
9850 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9852 if ((res >> 26) != ALC880_HP_EVENT)
9854 alc262_hp_bpc_automute(codec);
9857 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9859 struct alc_spec *spec = codec->spec;
9860 unsigned int presence;
9861 presence = snd_hda_codec_read(codec, 0x15, 0,
9862 AC_VERB_GET_PIN_SENSE, 0);
9863 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9864 alc262_hp_master_update(codec);
9867 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9870 if ((res >> 26) != ALC880_HP_EVENT)
9872 alc262_hp_wildwest_automute(codec);
9875 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9877 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9878 struct snd_ctl_elem_value *ucontrol)
9880 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9881 struct alc_spec *spec = codec->spec;
9882 int val = !!*ucontrol->value.integer.value;
9884 if (val == spec->master_sw)
9886 spec->master_sw = val;
9887 alc262_hp_master_update(codec);
9891 #define ALC262_HP_MASTER_SWITCH \
9893 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9894 .name = "Master Playback Switch", \
9895 .info = snd_ctl_boolean_mono_info, \
9896 .get = alc262_hp_master_sw_get, \
9897 .put = alc262_hp_master_sw_put, \
9900 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9901 ALC262_HP_MASTER_SWITCH,
9902 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9903 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9904 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9905 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9907 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9909 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9910 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9911 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9912 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9913 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9914 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9915 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9916 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9917 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9918 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9919 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9920 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9924 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9925 ALC262_HP_MASTER_SWITCH,
9926 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9927 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9928 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9929 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9930 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9932 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9934 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9935 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9936 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9937 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9938 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9939 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9940 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9944 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9945 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9946 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9947 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9951 /* mute/unmute internal speaker according to the hp jack and mute state */
9952 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9954 struct alc_spec *spec = codec->spec;
9956 spec->autocfg.hp_pins[0] = 0x15;
9957 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9958 alc_automute_amp(codec);
9961 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9962 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9963 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9964 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9965 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9966 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9967 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9968 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9972 static struct hda_verb alc262_hp_t5735_verbs[] = {
9973 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9976 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9980 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9981 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9982 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9983 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9984 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9985 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9986 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9990 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9991 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9992 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9993 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9994 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9995 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9996 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9997 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9998 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9999 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10000 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10004 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10011 /* bind hp and internal speaker mute (with plug check) as master switch */
10012 static void alc262_hippo_master_update(struct hda_codec *codec)
10014 struct alc_spec *spec = codec->spec;
10015 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10016 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10017 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10021 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10022 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10023 HDA_AMP_MUTE, mute);
10024 /* mute internal speaker per jack sense */
10025 if (spec->jack_present)
10026 mute = HDA_AMP_MUTE;
10028 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10029 HDA_AMP_MUTE, mute);
10030 if (speaker_nid && speaker_nid != line_nid)
10031 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10032 HDA_AMP_MUTE, mute);
10035 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10037 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10038 struct snd_ctl_elem_value *ucontrol)
10040 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10041 struct alc_spec *spec = codec->spec;
10042 int val = !!*ucontrol->value.integer.value;
10044 if (val == spec->master_sw)
10046 spec->master_sw = val;
10047 alc262_hippo_master_update(codec);
10051 #define ALC262_HIPPO_MASTER_SWITCH \
10053 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10054 .name = "Master Playback Switch", \
10055 .info = snd_ctl_boolean_mono_info, \
10056 .get = alc262_hippo_master_sw_get, \
10057 .put = alc262_hippo_master_sw_put, \
10060 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10061 ALC262_HIPPO_MASTER_SWITCH,
10062 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10063 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10064 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10065 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10066 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10067 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10069 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10070 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10071 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10072 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10073 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10077 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10078 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10079 ALC262_HIPPO_MASTER_SWITCH,
10080 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10081 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10082 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10083 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10084 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10085 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10086 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10087 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10088 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10089 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10093 /* mute/unmute internal speaker according to the hp jack and mute state */
10094 static void alc262_hippo_automute(struct hda_codec *codec)
10096 struct alc_spec *spec = codec->spec;
10097 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10098 unsigned int present;
10100 /* need to execute and sync at first */
10101 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10102 present = snd_hda_codec_read(codec, hp_nid, 0,
10103 AC_VERB_GET_PIN_SENSE, 0);
10104 spec->jack_present = (present & 0x80000000) != 0;
10105 alc262_hippo_master_update(codec);
10108 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10110 if ((res >> 26) != ALC880_HP_EVENT)
10112 alc262_hippo_automute(codec);
10115 static void alc262_hippo_init_hook(struct hda_codec *codec)
10117 struct alc_spec *spec = codec->spec;
10119 spec->autocfg.hp_pins[0] = 0x15;
10120 spec->autocfg.speaker_pins[0] = 0x14;
10121 alc262_hippo_automute(codec);
10124 static void alc262_hippo1_init_hook(struct hda_codec *codec)
10126 struct alc_spec *spec = codec->spec;
10128 spec->autocfg.hp_pins[0] = 0x1b;
10129 spec->autocfg.speaker_pins[0] = 0x14;
10130 alc262_hippo_automute(codec);
10134 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10135 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10136 ALC262_HIPPO_MASTER_SWITCH,
10137 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10138 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10139 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10140 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10144 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10145 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10146 ALC262_HIPPO_MASTER_SWITCH,
10147 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10148 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10149 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10150 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10151 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10155 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10156 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10157 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10158 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10159 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10160 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10161 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10162 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10163 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10164 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10165 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10166 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10167 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10171 static struct hda_verb alc262_tyan_verbs[] = {
10172 /* Headphone automute */
10173 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10174 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10175 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10177 /* P11 AUX_IN, white 4-pin connector */
10178 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10179 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10180 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10181 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10186 /* unsolicited event for HP jack sensing */
10187 static void alc262_tyan_init_hook(struct hda_codec *codec)
10189 struct alc_spec *spec = codec->spec;
10191 spec->autocfg.hp_pins[0] = 0x1b;
10192 spec->autocfg.speaker_pins[0] = 0x15;
10193 alc_automute_amp(codec);
10197 #define alc262_capture_mixer alc882_capture_mixer
10198 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10201 * generic initialization of ADC, input mixers and output mixers
10203 static struct hda_verb alc262_init_verbs[] = {
10205 * Unmute ADC0-2 and set the default input to mic-in
10207 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10208 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10209 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10210 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10211 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10212 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10214 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10216 * Note: PASD motherboards uses the Line In 2 as the input for
10217 * front panel mic (mic 2)
10219 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10220 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10221 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10222 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10223 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10224 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10227 * Set up output mixers (0x0c - 0x0e)
10229 /* set vol=0 to output mixers */
10230 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10231 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10232 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10233 /* set up input amps for analog loopback */
10234 /* Amp Indices: DAC = 0, mixer = 1 */
10235 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10236 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10237 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10238 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10239 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10240 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10242 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10243 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10244 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10245 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10246 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10247 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10249 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10250 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10251 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10252 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10253 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10255 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10256 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10258 /* FIXME: use matrix-type input source selection */
10259 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10260 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10261 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10262 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10263 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10264 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10266 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10267 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10268 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10269 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10271 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10272 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10273 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10274 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10279 static struct hda_verb alc262_eapd_verbs[] = {
10280 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10281 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10285 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10286 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10287 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10288 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10290 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10291 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10295 static struct hda_verb alc262_sony_unsol_verbs[] = {
10296 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10297 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10298 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10300 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10301 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10305 static struct hda_input_mux alc262_dmic_capture_source = {
10308 { "Int DMic", 0x9 },
10313 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10314 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10315 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10316 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10318 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10322 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10323 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10325 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10326 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10327 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10328 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10329 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10330 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10334 static void alc262_dmic_automute(struct hda_codec *codec)
10336 unsigned int present;
10338 present = snd_hda_codec_read(codec, 0x18, 0,
10339 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10340 snd_hda_codec_write(codec, 0x22, 0,
10341 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
10345 /* unsolicited event for HP jack sensing */
10346 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
10349 if ((res >> 26) == ALC880_MIC_EVENT)
10350 alc262_dmic_automute(codec);
10352 alc_sku_unsol_event(codec, res);
10355 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
10357 struct alc_spec *spec = codec->spec;
10359 spec->autocfg.hp_pins[0] = 0x15;
10360 spec->autocfg.speaker_pins[0] = 0x14;
10361 alc_automute_pin(codec);
10362 alc262_dmic_automute(codec);
10368 * 0x16 = internal speaker
10369 * 0x18 = external mic
10372 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10373 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10374 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10378 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10380 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10381 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10385 static struct hda_verb alc262_nec_verbs[] = {
10386 /* Unmute Speaker */
10387 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10390 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10393 /* External mic to headphone */
10394 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10395 /* External mic to speaker */
10396 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10402 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10403 * 0x1b = port replicator headphone out
10406 #define ALC_HP_EVENT 0x37
10408 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10409 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10411 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10412 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10416 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10417 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10418 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10422 static struct hda_input_mux alc262_fujitsu_capture_source = {
10426 { "Int Mic", 0x1 },
10431 static struct hda_input_mux alc262_HP_capture_source = {
10435 { "Front Mic", 0x1 },
10442 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10446 { "Front Mic", 0x2 },
10452 /* mute/unmute internal speaker according to the hp jacks and mute state */
10453 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10455 struct alc_spec *spec = codec->spec;
10458 if (force || !spec->sense_updated) {
10459 unsigned int present;
10460 /* need to execute and sync at first */
10461 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10462 /* check laptop HP jack */
10463 present = snd_hda_codec_read(codec, 0x14, 0,
10464 AC_VERB_GET_PIN_SENSE, 0);
10465 /* need to execute and sync at first */
10466 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10467 /* check docking HP jack */
10468 present |= snd_hda_codec_read(codec, 0x1b, 0,
10469 AC_VERB_GET_PIN_SENSE, 0);
10470 if (present & AC_PINSENSE_PRESENCE)
10471 spec->jack_present = 1;
10473 spec->jack_present = 0;
10474 spec->sense_updated = 1;
10476 /* unmute internal speaker only if both HPs are unplugged and
10477 * master switch is on
10479 if (spec->jack_present)
10480 mute = HDA_AMP_MUTE;
10482 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10483 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10484 HDA_AMP_MUTE, mute);
10487 /* unsolicited event for HP jack sensing */
10488 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10491 if ((res >> 26) != ALC_HP_EVENT)
10493 alc262_fujitsu_automute(codec, 1);
10496 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10498 alc262_fujitsu_automute(codec, 1);
10501 /* bind volumes of both NID 0x0c and 0x0d */
10502 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10503 .ops = &snd_hda_bind_vol,
10505 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10506 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10511 /* mute/unmute internal speaker according to the hp jack and mute state */
10512 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10514 struct alc_spec *spec = codec->spec;
10517 if (force || !spec->sense_updated) {
10518 unsigned int present_int_hp;
10519 /* need to execute and sync at first */
10520 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10521 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10522 AC_VERB_GET_PIN_SENSE, 0);
10523 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10524 spec->sense_updated = 1;
10526 if (spec->jack_present) {
10527 /* mute internal speaker */
10528 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10529 HDA_AMP_MUTE, HDA_AMP_MUTE);
10530 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10531 HDA_AMP_MUTE, HDA_AMP_MUTE);
10533 /* unmute internal speaker if necessary */
10534 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10535 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10536 HDA_AMP_MUTE, mute);
10537 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10538 HDA_AMP_MUTE, mute);
10542 /* unsolicited event for HP jack sensing */
10543 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10546 if ((res >> 26) != ALC_HP_EVENT)
10548 alc262_lenovo_3000_automute(codec, 1);
10551 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10552 int dir, int idx, long *valp)
10556 for (i = 0; i < 2; i++, valp++)
10557 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10559 *valp ? 0 : HDA_AMP_MUTE);
10563 /* bind hp and internal speaker mute (with plug check) */
10564 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10565 struct snd_ctl_elem_value *ucontrol)
10567 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10568 long *valp = ucontrol->value.integer.value;
10571 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10572 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10574 alc262_fujitsu_automute(codec, 0);
10578 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10579 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10581 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10582 .name = "Master Playback Switch",
10583 .info = snd_hda_mixer_amp_switch_info,
10584 .get = snd_hda_mixer_amp_switch_get,
10585 .put = alc262_fujitsu_master_sw_put,
10586 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10588 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10589 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10590 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10591 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10592 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10593 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10594 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10595 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10599 /* bind hp and internal speaker mute (with plug check) */
10600 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10601 struct snd_ctl_elem_value *ucontrol)
10603 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10604 long *valp = ucontrol->value.integer.value;
10607 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10609 alc262_lenovo_3000_automute(codec, 0);
10613 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10614 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10616 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10617 .name = "Master Playback Switch",
10618 .info = snd_hda_mixer_amp_switch_info,
10619 .get = snd_hda_mixer_amp_switch_get,
10620 .put = alc262_lenovo_3000_master_sw_put,
10621 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10623 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10624 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10625 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10627 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10628 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10629 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10630 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10634 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10635 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10636 ALC262_HIPPO_MASTER_SWITCH,
10637 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10639 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10640 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10641 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10642 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10646 /* additional init verbs for Benq laptops */
10647 static struct hda_verb alc262_EAPD_verbs[] = {
10648 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10649 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10653 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10654 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10655 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10657 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10658 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10662 /* Samsung Q1 Ultra Vista model setup */
10663 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10664 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10665 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10666 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10667 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10668 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10669 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10673 static struct hda_verb alc262_ultra_verbs[] = {
10675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10676 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10677 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10679 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10680 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10681 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10682 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10684 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10685 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10686 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10687 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10688 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10690 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10691 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10692 /* ADC, choose mic */
10693 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10694 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10695 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10696 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10697 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10700 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10701 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10702 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10706 /* mute/unmute internal speaker according to the hp jack and mute state */
10707 static void alc262_ultra_automute(struct hda_codec *codec)
10709 struct alc_spec *spec = codec->spec;
10713 /* auto-mute only when HP is used as HP */
10714 if (!spec->cur_mux[0]) {
10715 unsigned int present;
10716 /* need to execute and sync at first */
10717 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10718 present = snd_hda_codec_read(codec, 0x15, 0,
10719 AC_VERB_GET_PIN_SENSE, 0);
10720 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10721 if (spec->jack_present)
10722 mute = HDA_AMP_MUTE;
10724 /* mute/unmute internal speaker */
10725 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10726 HDA_AMP_MUTE, mute);
10727 /* mute/unmute HP */
10728 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10729 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10732 /* unsolicited event for HP jack sensing */
10733 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10736 if ((res >> 26) != ALC880_HP_EVENT)
10738 alc262_ultra_automute(codec);
10741 static struct hda_input_mux alc262_ultra_capture_source = {
10745 { "Headphone", 0x7 },
10749 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10750 struct snd_ctl_elem_value *ucontrol)
10752 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10753 struct alc_spec *spec = codec->spec;
10756 ret = alc_mux_enum_put(kcontrol, ucontrol);
10759 /* reprogram the HP pin as mic or HP according to the input source */
10760 snd_hda_codec_write_cache(codec, 0x15, 0,
10761 AC_VERB_SET_PIN_WIDGET_CONTROL,
10762 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10763 alc262_ultra_automute(codec); /* mute/unmute HP */
10767 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10768 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10769 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10771 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10772 .name = "Capture Source",
10773 .info = alc_mux_enum_info,
10774 .get = alc_mux_enum_get,
10775 .put = alc262_ultra_mux_enum_put,
10780 /* add playback controls from the parsed DAC table */
10781 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10782 const struct auto_pin_cfg *cfg)
10787 spec->multiout.num_dacs = 1; /* only use one dac */
10788 spec->multiout.dac_nids = spec->private_dac_nids;
10789 spec->multiout.dac_nids[0] = 2;
10791 nid = cfg->line_out_pins[0];
10793 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10794 "Front Playback Volume",
10795 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10798 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10799 "Front Playback Switch",
10800 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10805 nid = cfg->speaker_pins[0];
10808 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10809 "Speaker Playback Volume",
10810 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10814 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10815 "Speaker Playback Switch",
10816 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10821 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10822 "Speaker Playback Switch",
10823 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10829 nid = cfg->hp_pins[0];
10831 /* spec->multiout.hp_nid = 2; */
10833 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10834 "Headphone Playback Volume",
10835 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10839 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10840 "Headphone Playback Switch",
10841 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10846 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10847 "Headphone Playback Switch",
10848 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10857 static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
10858 const struct auto_pin_cfg *cfg)
10862 err = alc880_auto_create_analog_input_ctls(spec, cfg);
10865 /* digital-mic input pin is excluded in alc880_auto_create..()
10866 * because it's under 0x18
10868 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
10869 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
10870 struct hda_input_mux *imux = &spec->private_imux[0];
10871 imux->items[imux->num_items].label = "Int Mic";
10872 imux->items[imux->num_items].index = 0x09;
10880 * generic initialization of ADC, input mixers and output mixers
10882 static struct hda_verb alc262_volume_init_verbs[] = {
10884 * Unmute ADC0-2 and set the default input to mic-in
10886 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10887 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10888 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10889 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10890 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10891 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10893 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10895 * Note: PASD motherboards uses the Line In 2 as the input for
10896 * front panel mic (mic 2)
10898 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10899 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10900 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10901 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10902 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10903 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10906 * Set up output mixers (0x0c - 0x0f)
10908 /* set vol=0 to output mixers */
10909 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10911 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10913 /* set up input amps for analog loopback */
10914 /* Amp Indices: DAC = 0, mixer = 1 */
10915 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10916 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10917 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10918 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10919 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10920 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10922 /* FIXME: use matrix-type input source selection */
10923 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10924 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10925 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10926 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10927 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10928 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10930 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10931 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10932 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10933 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10935 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10936 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10937 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10943 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10945 * Unmute ADC0-2 and set the default input to mic-in
10947 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10948 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10949 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10950 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10951 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10952 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10954 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10956 * Note: PASD motherboards uses the Line In 2 as the input for
10957 * front panel mic (mic 2)
10959 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10960 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10961 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10962 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10963 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10964 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10965 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10966 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10969 * Set up output mixers (0x0c - 0x0e)
10971 /* set vol=0 to output mixers */
10972 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10973 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10974 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10976 /* set up input amps for analog loopback */
10977 /* Amp Indices: DAC = 0, mixer = 1 */
10978 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10979 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10980 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10981 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10982 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10983 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10985 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10987 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10989 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10990 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10992 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10993 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10996 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10997 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10998 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10999 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11001 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11002 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11003 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11005 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11006 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11009 /* FIXME: use matrix-type input source selection */
11010 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11011 /* Input mixer1: only unmute Mic */
11012 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11013 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11014 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11015 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11016 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11017 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11018 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11019 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11020 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11022 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11023 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11024 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11025 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11026 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11027 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11028 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11029 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11030 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11033 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11034 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11035 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11042 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11047 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11049 * Unmute ADC0-2 and set the default input to mic-in
11051 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11052 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11053 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11054 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11055 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11056 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11058 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11060 * Note: PASD motherboards uses the Line In 2 as the input for front
11061 * panel mic (mic 2)
11063 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11065 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11066 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11067 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11068 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11073 * Set up output mixers (0x0c - 0x0e)
11075 /* set vol=0 to output mixers */
11076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11077 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11078 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11080 /* set up input amps for analog loopback */
11081 /* Amp Indices: DAC = 0, mixer = 1 */
11082 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11083 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11084 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11085 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11086 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11087 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11090 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11091 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11092 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11093 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11094 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11095 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11096 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11098 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11099 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11101 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11102 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11104 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11105 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11106 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11107 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11108 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11109 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11111 /* FIXME: use matrix-type input source selection */
11112 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11113 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11114 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11115 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11116 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11117 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11118 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11119 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11120 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11122 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11123 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11124 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11125 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11126 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11127 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11128 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11130 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11131 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11132 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11133 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11134 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11135 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11136 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11138 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11143 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11145 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11146 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11147 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11149 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11150 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11151 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11152 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11154 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11155 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11156 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11161 #ifdef CONFIG_SND_HDA_POWER_SAVE
11162 #define alc262_loopbacks alc880_loopbacks
11165 /* pcm configuration: identical with ALC880 */
11166 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11167 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11168 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11169 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11172 * BIOS auto configuration
11174 static int alc262_parse_auto_config(struct hda_codec *codec)
11176 struct alc_spec *spec = codec->spec;
11178 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11180 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11184 if (!spec->autocfg.line_outs) {
11185 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11186 spec->multiout.max_channels = 2;
11187 spec->no_analog = 1;
11190 return 0; /* can't find valid BIOS pin config */
11192 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11195 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
11199 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11202 if (spec->autocfg.dig_outs) {
11203 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11204 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11206 if (spec->autocfg.dig_in_pin)
11207 spec->dig_in_nid = ALC262_DIGIN_NID;
11209 if (spec->kctls.list)
11210 add_mixer(spec, spec->kctls.list);
11212 add_verb(spec, alc262_volume_init_verbs);
11213 spec->num_mux_defs = 1;
11214 spec->input_mux = &spec->private_imux[0];
11216 err = alc_auto_add_mic_boost(codec);
11220 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11225 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11226 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11227 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11228 #define alc262_auto_init_input_src alc882_auto_init_input_src
11231 /* init callback for auto-configuration model -- overriding the default init */
11232 static void alc262_auto_init(struct hda_codec *codec)
11234 struct alc_spec *spec = codec->spec;
11235 alc262_auto_init_multi_out(codec);
11236 alc262_auto_init_hp_out(codec);
11237 alc262_auto_init_analog_input(codec);
11238 alc262_auto_init_input_src(codec);
11239 if (spec->unsol_event)
11240 alc_inithook(codec);
11244 * configuration and preset
11246 static const char *alc262_models[ALC262_MODEL_LAST] = {
11247 [ALC262_BASIC] = "basic",
11248 [ALC262_HIPPO] = "hippo",
11249 [ALC262_HIPPO_1] = "hippo_1",
11250 [ALC262_FUJITSU] = "fujitsu",
11251 [ALC262_HP_BPC] = "hp-bpc",
11252 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11253 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11254 [ALC262_HP_RP5700] = "hp-rp5700",
11255 [ALC262_BENQ_ED8] = "benq",
11256 [ALC262_BENQ_T31] = "benq-t31",
11257 [ALC262_SONY_ASSAMD] = "sony-assamd",
11258 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11259 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11260 [ALC262_ULTRA] = "ultra",
11261 [ALC262_LENOVO_3000] = "lenovo-3000",
11262 [ALC262_NEC] = "nec",
11263 [ALC262_TYAN] = "tyan",
11264 [ALC262_AUTO] = "auto",
11267 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11268 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11269 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11270 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11272 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11274 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11276 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11277 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11278 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11279 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11280 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11281 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11282 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11283 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11284 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11285 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11286 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11287 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11288 ALC262_HP_TC_T5735),
11289 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11290 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11291 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11292 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11293 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11294 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11295 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11296 ALC262_SONY_ASSAMD),
11297 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11298 ALC262_TOSHIBA_RX1),
11299 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11300 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11301 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11302 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11303 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11305 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11306 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11307 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11308 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11309 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11313 static struct alc_config_preset alc262_presets[] = {
11315 .mixers = { alc262_base_mixer },
11316 .init_verbs = { alc262_init_verbs },
11317 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11318 .dac_nids = alc262_dac_nids,
11320 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11321 .channel_mode = alc262_modes,
11322 .input_mux = &alc262_capture_source,
11325 .mixers = { alc262_hippo_mixer },
11326 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11327 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11328 .dac_nids = alc262_dac_nids,
11330 .dig_out_nid = ALC262_DIGOUT_NID,
11331 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11332 .channel_mode = alc262_modes,
11333 .input_mux = &alc262_capture_source,
11334 .unsol_event = alc262_hippo_unsol_event,
11335 .init_hook = alc262_hippo_init_hook,
11337 [ALC262_HIPPO_1] = {
11338 .mixers = { alc262_hippo1_mixer },
11339 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11340 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11341 .dac_nids = alc262_dac_nids,
11343 .dig_out_nid = ALC262_DIGOUT_NID,
11344 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11345 .channel_mode = alc262_modes,
11346 .input_mux = &alc262_capture_source,
11347 .unsol_event = alc262_hippo_unsol_event,
11348 .init_hook = alc262_hippo1_init_hook,
11350 [ALC262_FUJITSU] = {
11351 .mixers = { alc262_fujitsu_mixer },
11352 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11353 alc262_fujitsu_unsol_verbs },
11354 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11355 .dac_nids = alc262_dac_nids,
11357 .dig_out_nid = ALC262_DIGOUT_NID,
11358 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11359 .channel_mode = alc262_modes,
11360 .input_mux = &alc262_fujitsu_capture_source,
11361 .unsol_event = alc262_fujitsu_unsol_event,
11362 .init_hook = alc262_fujitsu_init_hook,
11364 [ALC262_HP_BPC] = {
11365 .mixers = { alc262_HP_BPC_mixer },
11366 .init_verbs = { alc262_HP_BPC_init_verbs },
11367 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11368 .dac_nids = alc262_dac_nids,
11370 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11371 .channel_mode = alc262_modes,
11372 .input_mux = &alc262_HP_capture_source,
11373 .unsol_event = alc262_hp_bpc_unsol_event,
11374 .init_hook = alc262_hp_bpc_automute,
11376 [ALC262_HP_BPC_D7000_WF] = {
11377 .mixers = { alc262_HP_BPC_WildWest_mixer },
11378 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11379 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11380 .dac_nids = alc262_dac_nids,
11382 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11383 .channel_mode = alc262_modes,
11384 .input_mux = &alc262_HP_D7000_capture_source,
11385 .unsol_event = alc262_hp_wildwest_unsol_event,
11386 .init_hook = alc262_hp_wildwest_automute,
11388 [ALC262_HP_BPC_D7000_WL] = {
11389 .mixers = { alc262_HP_BPC_WildWest_mixer,
11390 alc262_HP_BPC_WildWest_option_mixer },
11391 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11392 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11393 .dac_nids = alc262_dac_nids,
11395 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11396 .channel_mode = alc262_modes,
11397 .input_mux = &alc262_HP_D7000_capture_source,
11398 .unsol_event = alc262_hp_wildwest_unsol_event,
11399 .init_hook = alc262_hp_wildwest_automute,
11401 [ALC262_HP_TC_T5735] = {
11402 .mixers = { alc262_hp_t5735_mixer },
11403 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11404 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11405 .dac_nids = alc262_dac_nids,
11407 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11408 .channel_mode = alc262_modes,
11409 .input_mux = &alc262_capture_source,
11410 .unsol_event = alc_automute_amp_unsol_event,
11411 .init_hook = alc262_hp_t5735_init_hook,
11413 [ALC262_HP_RP5700] = {
11414 .mixers = { alc262_hp_rp5700_mixer },
11415 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11416 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11417 .dac_nids = alc262_dac_nids,
11418 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11419 .channel_mode = alc262_modes,
11420 .input_mux = &alc262_hp_rp5700_capture_source,
11422 [ALC262_BENQ_ED8] = {
11423 .mixers = { alc262_base_mixer },
11424 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11425 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11426 .dac_nids = alc262_dac_nids,
11428 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11429 .channel_mode = alc262_modes,
11430 .input_mux = &alc262_capture_source,
11432 [ALC262_SONY_ASSAMD] = {
11433 .mixers = { alc262_sony_mixer },
11434 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11435 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11436 .dac_nids = alc262_dac_nids,
11438 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11439 .channel_mode = alc262_modes,
11440 .input_mux = &alc262_capture_source,
11441 .unsol_event = alc262_hippo_unsol_event,
11442 .init_hook = alc262_hippo_init_hook,
11444 [ALC262_BENQ_T31] = {
11445 .mixers = { alc262_benq_t31_mixer },
11446 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11447 alc_hp15_unsol_verbs },
11448 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11449 .dac_nids = alc262_dac_nids,
11451 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11452 .channel_mode = alc262_modes,
11453 .input_mux = &alc262_capture_source,
11454 .unsol_event = alc262_hippo_unsol_event,
11455 .init_hook = alc262_hippo_init_hook,
11458 .mixers = { alc262_ultra_mixer },
11459 .cap_mixer = alc262_ultra_capture_mixer,
11460 .init_verbs = { alc262_ultra_verbs },
11461 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11462 .dac_nids = alc262_dac_nids,
11463 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11464 .channel_mode = alc262_modes,
11465 .input_mux = &alc262_ultra_capture_source,
11466 .adc_nids = alc262_adc_nids, /* ADC0 */
11467 .capsrc_nids = alc262_capsrc_nids,
11468 .num_adc_nids = 1, /* single ADC */
11469 .unsol_event = alc262_ultra_unsol_event,
11470 .init_hook = alc262_ultra_automute,
11472 [ALC262_LENOVO_3000] = {
11473 .mixers = { alc262_lenovo_3000_mixer },
11474 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11475 alc262_lenovo_3000_unsol_verbs },
11476 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11477 .dac_nids = alc262_dac_nids,
11479 .dig_out_nid = ALC262_DIGOUT_NID,
11480 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11481 .channel_mode = alc262_modes,
11482 .input_mux = &alc262_fujitsu_capture_source,
11483 .unsol_event = alc262_lenovo_3000_unsol_event,
11486 .mixers = { alc262_nec_mixer },
11487 .init_verbs = { alc262_nec_verbs },
11488 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11489 .dac_nids = alc262_dac_nids,
11491 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11492 .channel_mode = alc262_modes,
11493 .input_mux = &alc262_capture_source,
11495 [ALC262_TOSHIBA_S06] = {
11496 .mixers = { alc262_toshiba_s06_mixer },
11497 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11498 alc262_eapd_verbs },
11499 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11500 .capsrc_nids = alc262_dmic_capsrc_nids,
11501 .dac_nids = alc262_dac_nids,
11502 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11503 .num_adc_nids = 1, /* single ADC */
11504 .dig_out_nid = ALC262_DIGOUT_NID,
11505 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11506 .channel_mode = alc262_modes,
11507 .input_mux = &alc262_dmic_capture_source,
11508 .unsol_event = alc262_toshiba_s06_unsol_event,
11509 .init_hook = alc262_toshiba_s06_init_hook,
11511 [ALC262_TOSHIBA_RX1] = {
11512 .mixers = { alc262_toshiba_rx1_mixer },
11513 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11514 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11515 .dac_nids = alc262_dac_nids,
11517 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11518 .channel_mode = alc262_modes,
11519 .input_mux = &alc262_capture_source,
11520 .unsol_event = alc262_hippo_unsol_event,
11521 .init_hook = alc262_hippo_init_hook,
11524 .mixers = { alc262_tyan_mixer },
11525 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11526 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11527 .dac_nids = alc262_dac_nids,
11529 .dig_out_nid = ALC262_DIGOUT_NID,
11530 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11531 .channel_mode = alc262_modes,
11532 .input_mux = &alc262_capture_source,
11533 .unsol_event = alc_automute_amp_unsol_event,
11534 .init_hook = alc262_tyan_init_hook,
11538 static int patch_alc262(struct hda_codec *codec)
11540 struct alc_spec *spec;
11544 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11548 codec->spec = spec;
11550 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11555 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11556 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11557 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11558 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11562 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11564 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11568 if (board_config < 0) {
11569 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11571 board_config = ALC262_AUTO;
11574 if (board_config == ALC262_AUTO) {
11575 /* automatic parse from the BIOS config */
11576 err = alc262_parse_auto_config(codec);
11582 "hda_codec: Cannot set up configuration "
11583 "from BIOS. Using base mode...\n");
11584 board_config = ALC262_BASIC;
11588 if (!spec->no_analog) {
11589 err = snd_hda_attach_beep_device(codec, 0x1);
11596 if (board_config != ALC262_AUTO)
11597 setup_preset(spec, &alc262_presets[board_config]);
11599 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11600 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11602 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11603 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11605 if (!spec->adc_nids && spec->input_mux) {
11607 /* check whether the digital-mic has to be supported */
11608 for (i = 0; i < spec->input_mux->num_items; i++) {
11609 if (spec->input_mux->items[i].index >= 9)
11612 if (i < spec->input_mux->num_items) {
11613 /* use only ADC0 */
11614 spec->adc_nids = alc262_dmic_adc_nids;
11615 spec->num_adc_nids = 1;
11616 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11618 /* all analog inputs */
11619 /* check whether NID 0x07 is valid */
11620 unsigned int wcap = get_wcaps(codec, 0x07);
11623 wcap = get_wcaps_type(wcap);
11624 if (wcap != AC_WID_AUD_IN) {
11625 spec->adc_nids = alc262_adc_nids_alt;
11626 spec->num_adc_nids =
11627 ARRAY_SIZE(alc262_adc_nids_alt);
11628 spec->capsrc_nids = alc262_capsrc_nids_alt;
11630 spec->adc_nids = alc262_adc_nids;
11631 spec->num_adc_nids =
11632 ARRAY_SIZE(alc262_adc_nids);
11633 spec->capsrc_nids = alc262_capsrc_nids;
11637 if (!spec->cap_mixer && !spec->no_analog)
11638 set_capture_mixer(codec);
11639 if (!spec->no_analog)
11640 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11642 spec->vmaster_nid = 0x0c;
11644 codec->patch_ops = alc_patch_ops;
11645 if (board_config == ALC262_AUTO)
11646 spec->init_hook = alc262_auto_init;
11647 #ifdef CONFIG_SND_HDA_POWER_SAVE
11648 if (!spec->loopback.amplist)
11649 spec->loopback.amplist = alc262_loopbacks;
11651 codec->proc_widget_hook = print_realtek_coef;
11657 * ALC268 channel source setting (2 channel)
11659 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11660 #define alc268_modes alc260_modes
11662 static hda_nid_t alc268_dac_nids[2] = {
11667 static hda_nid_t alc268_adc_nids[2] = {
11672 static hda_nid_t alc268_adc_nids_alt[1] = {
11677 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11679 static struct snd_kcontrol_new alc268_base_mixer[] = {
11680 /* output mixer control */
11681 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11682 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11683 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11684 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11685 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11686 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11687 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11691 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11692 /* output mixer control */
11693 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11694 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11695 ALC262_HIPPO_MASTER_SWITCH,
11696 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11697 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11698 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11702 /* bind Beep switches of both NID 0x0f and 0x10 */
11703 static struct hda_bind_ctls alc268_bind_beep_sw = {
11704 .ops = &snd_hda_bind_sw,
11706 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11707 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11712 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11713 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11714 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11718 static struct hda_verb alc268_eapd_verbs[] = {
11719 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11720 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11724 /* Toshiba specific */
11725 static struct hda_verb alc268_toshiba_verbs[] = {
11726 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11730 static struct hda_input_mux alc268_acer_lc_capture_source = {
11738 /* Acer specific */
11739 /* bind volumes of both NID 0x02 and 0x03 */
11740 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11741 .ops = &snd_hda_bind_vol,
11743 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11744 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11749 /* mute/unmute internal speaker according to the hp jack and mute state */
11750 static void alc268_acer_automute(struct hda_codec *codec, int force)
11752 struct alc_spec *spec = codec->spec;
11755 if (force || !spec->sense_updated) {
11756 unsigned int present;
11757 present = snd_hda_codec_read(codec, 0x14, 0,
11758 AC_VERB_GET_PIN_SENSE, 0);
11759 spec->jack_present = (present & 0x80000000) != 0;
11760 spec->sense_updated = 1;
11762 if (spec->jack_present)
11763 mute = HDA_AMP_MUTE; /* mute internal speaker */
11764 else /* unmute internal speaker if necessary */
11765 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11766 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11767 HDA_AMP_MUTE, mute);
11771 /* bind hp and internal speaker mute (with plug check) */
11772 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11773 struct snd_ctl_elem_value *ucontrol)
11775 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11776 long *valp = ucontrol->value.integer.value;
11779 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11781 alc268_acer_automute(codec, 0);
11785 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11786 /* output mixer control */
11787 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11789 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11790 .name = "Master Playback Switch",
11791 .info = snd_hda_mixer_amp_switch_info,
11792 .get = snd_hda_mixer_amp_switch_get,
11793 .put = alc268_acer_master_sw_put,
11794 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11796 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11800 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11801 /* output mixer control */
11802 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11804 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11805 .name = "Master Playback Switch",
11806 .info = snd_hda_mixer_amp_switch_info,
11807 .get = snd_hda_mixer_amp_switch_get,
11808 .put = alc268_acer_master_sw_put,
11809 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11811 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11812 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11813 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11817 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11818 /* output mixer control */
11819 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11821 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11822 .name = "Master Playback Switch",
11823 .info = snd_hda_mixer_amp_switch_info,
11824 .get = snd_hda_mixer_amp_switch_get,
11825 .put = alc268_acer_master_sw_put,
11826 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11828 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11829 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11833 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11834 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11835 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11836 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11837 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11838 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11839 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11843 static struct hda_verb alc268_acer_verbs[] = {
11844 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11845 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11846 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11847 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11848 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11849 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11850 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11854 /* unsolicited event for HP jack sensing */
11855 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11856 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11858 static void alc268_acer_unsol_event(struct hda_codec *codec,
11861 if ((res >> 26) != ALC880_HP_EVENT)
11863 alc268_acer_automute(codec, 1);
11866 static void alc268_acer_init_hook(struct hda_codec *codec)
11868 alc268_acer_automute(codec, 1);
11871 /* toggle speaker-output according to the hp-jack state */
11872 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11874 unsigned int present;
11875 unsigned char bits;
11877 present = snd_hda_codec_read(codec, 0x15, 0,
11878 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11879 bits = present ? AMP_IN_MUTE(0) : 0;
11880 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11881 AMP_IN_MUTE(0), bits);
11882 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11883 AMP_IN_MUTE(0), bits);
11887 static void alc268_acer_mic_automute(struct hda_codec *codec)
11889 unsigned int present;
11891 present = snd_hda_codec_read(codec, 0x18, 0,
11892 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11893 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11894 present ? 0x0 : 0x6);
11897 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11900 if ((res >> 26) == ALC880_HP_EVENT)
11901 alc268_aspire_one_speaker_automute(codec);
11902 if ((res >> 26) == ALC880_MIC_EVENT)
11903 alc268_acer_mic_automute(codec);
11906 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11908 alc268_aspire_one_speaker_automute(codec);
11909 alc268_acer_mic_automute(codec);
11912 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11913 /* output mixer control */
11914 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11915 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11916 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11917 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11918 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11919 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11923 static struct hda_verb alc268_dell_verbs[] = {
11924 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11925 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11926 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11930 /* mute/unmute internal speaker according to the hp jack and mute state */
11931 static void alc268_dell_init_hook(struct hda_codec *codec)
11933 struct alc_spec *spec = codec->spec;
11935 spec->autocfg.hp_pins[0] = 0x15;
11936 spec->autocfg.speaker_pins[0] = 0x14;
11937 alc_automute_pin(codec);
11940 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11941 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11942 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11943 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11944 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11945 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11946 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11947 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11948 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11952 static struct hda_verb alc267_quanta_il1_verbs[] = {
11953 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11954 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11958 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11960 unsigned int present;
11962 present = snd_hda_codec_read(codec, 0x18, 0,
11963 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11964 snd_hda_codec_write(codec, 0x23, 0,
11965 AC_VERB_SET_CONNECT_SEL,
11966 present ? 0x00 : 0x01);
11969 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11971 struct alc_spec *spec = codec->spec;
11973 spec->autocfg.hp_pins[0] = 0x15;
11974 spec->autocfg.speaker_pins[0] = 0x14;
11975 alc_automute_pin(codec);
11976 alc267_quanta_il1_mic_automute(codec);
11979 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11982 switch (res >> 26) {
11983 case ALC880_MIC_EVENT:
11984 alc267_quanta_il1_mic_automute(codec);
11987 alc_sku_unsol_event(codec, res);
11993 * generic initialization of ADC, input mixers and output mixers
11995 static struct hda_verb alc268_base_init_verbs[] = {
11996 /* Unmute DAC0-1 and set vol = 0 */
11997 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11998 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12001 * Set up output mixers (0x0c - 0x0e)
12003 /* set vol=0 to output mixers */
12004 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12005 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12007 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12008 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12010 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12011 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12012 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12013 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12014 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12015 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12016 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12017 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12019 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12020 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12021 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12022 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12023 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12025 /* set PCBEEP vol = 0, mute connections */
12026 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12027 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12028 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12030 /* Unmute Selector 23h,24h and set the default input to mic-in */
12032 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12034 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12035 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12041 * generic initialization of ADC, input mixers and output mixers
12043 static struct hda_verb alc268_volume_init_verbs[] = {
12044 /* set output DAC */
12045 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12046 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12048 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12049 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12050 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12051 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12052 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12054 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12055 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12056 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12058 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12059 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12061 /* set PCBEEP vol = 0, mute connections */
12062 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12063 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12064 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12069 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12070 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12071 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12073 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12074 /* The multiple "Capture Source" controls confuse alsamixer
12075 * So call somewhat different..
12077 /* .name = "Capture Source", */
12078 .name = "Input Source",
12080 .info = alc_mux_enum_info,
12081 .get = alc_mux_enum_get,
12082 .put = alc_mux_enum_put,
12087 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12088 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12089 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12090 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12091 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12093 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12094 /* The multiple "Capture Source" controls confuse alsamixer
12095 * So call somewhat different..
12097 /* .name = "Capture Source", */
12098 .name = "Input Source",
12100 .info = alc_mux_enum_info,
12101 .get = alc_mux_enum_get,
12102 .put = alc_mux_enum_put,
12107 static struct hda_input_mux alc268_capture_source = {
12111 { "Front Mic", 0x1 },
12117 static struct hda_input_mux alc268_acer_capture_source = {
12121 { "Internal Mic", 0x1 },
12126 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12130 { "Internal Mic", 0x6 },
12135 #ifdef CONFIG_SND_DEBUG
12136 static struct snd_kcontrol_new alc268_test_mixer[] = {
12137 /* Volume widgets */
12138 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12139 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12140 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12141 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12142 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12143 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12144 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12145 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12146 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12147 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12148 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12149 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12150 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12151 /* The below appears problematic on some hardwares */
12152 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12153 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12154 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12155 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12156 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12158 /* Modes for retasking pin widgets */
12159 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12160 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12161 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12162 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12164 /* Controls for GPIO pins, assuming they are configured as outputs */
12165 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12166 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12167 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12168 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12170 /* Switches to allow the digital SPDIF output pin to be enabled.
12171 * The ALC268 does not have an SPDIF input.
12173 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12175 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12176 * this output to turn on an external amplifier.
12178 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12179 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12185 /* create input playback/capture controls for the given pin */
12186 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12187 const char *ctlname, int idx)
12193 sprintf(name, "%s Playback Volume", ctlname);
12205 if (spec->multiout.dac_nids[0] != dac &&
12206 spec->multiout.dac_nids[1] != dac) {
12207 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12208 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12212 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12215 sprintf(name, "%s Playback Switch", ctlname);
12217 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12218 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12220 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12221 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12227 /* add playback controls from the parsed DAC table */
12228 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12229 const struct auto_pin_cfg *cfg)
12234 spec->multiout.dac_nids = spec->private_dac_nids;
12236 nid = cfg->line_out_pins[0];
12239 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12243 err = alc268_new_analog_output(spec, nid, name, 0);
12248 nid = cfg->speaker_pins[0];
12250 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12251 "Speaker Playback Volume",
12252 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12256 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12260 nid = cfg->hp_pins[0];
12262 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12267 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12269 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12270 "Mono Playback Switch",
12271 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12278 /* create playback/capture controls for input pins */
12279 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
12280 const struct auto_pin_cfg *cfg)
12282 struct hda_input_mux *imux = &spec->private_imux[0];
12285 for (i = 0; i < AUTO_PIN_LAST; i++) {
12286 switch(cfg->input_pins[i]) {
12288 idx1 = 0; /* Mic 1 */
12291 idx1 = 1; /* Mic 2 */
12294 idx1 = 2; /* Line In */
12301 idx1 = 6; /* digital mics */
12306 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12307 imux->items[imux->num_items].index = idx1;
12313 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12315 struct alc_spec *spec = codec->spec;
12316 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12317 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12318 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12319 unsigned int dac_vol1, dac_vol2;
12322 snd_hda_codec_write(codec, speaker_nid, 0,
12323 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12324 snd_hda_codec_write(codec, 0x0f, 0,
12325 AC_VERB_SET_AMP_GAIN_MUTE,
12327 snd_hda_codec_write(codec, 0x10, 0,
12328 AC_VERB_SET_AMP_GAIN_MUTE,
12331 snd_hda_codec_write(codec, 0x0f, 0,
12332 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12333 snd_hda_codec_write(codec, 0x10, 0,
12334 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12337 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12338 if (line_nid == 0x14)
12339 dac_vol2 = AMP_OUT_ZERO;
12340 else if (line_nid == 0x15)
12341 dac_vol1 = AMP_OUT_ZERO;
12342 if (hp_nid == 0x14)
12343 dac_vol2 = AMP_OUT_ZERO;
12344 else if (hp_nid == 0x15)
12345 dac_vol1 = AMP_OUT_ZERO;
12346 if (line_nid != 0x16 || hp_nid != 0x16 ||
12347 spec->autocfg.line_out_pins[1] != 0x16 ||
12348 spec->autocfg.line_out_pins[2] != 0x16)
12349 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12351 snd_hda_codec_write(codec, 0x02, 0,
12352 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12353 snd_hda_codec_write(codec, 0x03, 0,
12354 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12357 /* pcm configuration: identical with ALC880 */
12358 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12359 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12360 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12361 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12364 * BIOS auto configuration
12366 static int alc268_parse_auto_config(struct hda_codec *codec)
12368 struct alc_spec *spec = codec->spec;
12370 static hda_nid_t alc268_ignore[] = { 0 };
12372 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12376 if (!spec->autocfg.line_outs) {
12377 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12378 spec->multiout.max_channels = 2;
12379 spec->no_analog = 1;
12382 return 0; /* can't find valid BIOS pin config */
12384 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12387 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12391 spec->multiout.max_channels = 2;
12394 /* digital only support output */
12395 if (spec->autocfg.dig_outs) {
12396 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12397 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12399 if (spec->kctls.list)
12400 add_mixer(spec, spec->kctls.list);
12402 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12403 add_mixer(spec, alc268_beep_mixer);
12405 add_verb(spec, alc268_volume_init_verbs);
12406 spec->num_mux_defs = 1;
12407 spec->input_mux = &spec->private_imux[0];
12409 err = alc_auto_add_mic_boost(codec);
12413 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12418 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12419 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12420 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12422 /* init callback for auto-configuration model -- overriding the default init */
12423 static void alc268_auto_init(struct hda_codec *codec)
12425 struct alc_spec *spec = codec->spec;
12426 alc268_auto_init_multi_out(codec);
12427 alc268_auto_init_hp_out(codec);
12428 alc268_auto_init_mono_speaker_out(codec);
12429 alc268_auto_init_analog_input(codec);
12430 if (spec->unsol_event)
12431 alc_inithook(codec);
12435 * configuration and preset
12437 static const char *alc268_models[ALC268_MODEL_LAST] = {
12438 [ALC267_QUANTA_IL1] = "quanta-il1",
12439 [ALC268_3ST] = "3stack",
12440 [ALC268_TOSHIBA] = "toshiba",
12441 [ALC268_ACER] = "acer",
12442 [ALC268_ACER_DMIC] = "acer-dmic",
12443 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12444 [ALC268_DELL] = "dell",
12445 [ALC268_ZEPTO] = "zepto",
12446 #ifdef CONFIG_SND_DEBUG
12447 [ALC268_TEST] = "test",
12449 [ALC268_AUTO] = "auto",
12452 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12453 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12454 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12455 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12456 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12457 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12458 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12459 ALC268_ACER_ASPIRE_ONE),
12460 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12461 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12462 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12464 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12465 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12466 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12468 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12469 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12470 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12471 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12475 static struct alc_config_preset alc268_presets[] = {
12476 [ALC267_QUANTA_IL1] = {
12477 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12478 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12479 alc267_quanta_il1_verbs },
12480 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12481 .dac_nids = alc268_dac_nids,
12482 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12483 .adc_nids = alc268_adc_nids_alt,
12485 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12486 .channel_mode = alc268_modes,
12487 .input_mux = &alc268_capture_source,
12488 .unsol_event = alc267_quanta_il1_unsol_event,
12489 .init_hook = alc267_quanta_il1_init_hook,
12492 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12493 alc268_beep_mixer },
12494 .init_verbs = { alc268_base_init_verbs },
12495 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12496 .dac_nids = alc268_dac_nids,
12497 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12498 .adc_nids = alc268_adc_nids_alt,
12499 .capsrc_nids = alc268_capsrc_nids,
12501 .dig_out_nid = ALC268_DIGOUT_NID,
12502 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12503 .channel_mode = alc268_modes,
12504 .input_mux = &alc268_capture_source,
12506 [ALC268_TOSHIBA] = {
12507 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12508 alc268_beep_mixer },
12509 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12510 alc268_toshiba_verbs },
12511 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12512 .dac_nids = alc268_dac_nids,
12513 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12514 .adc_nids = alc268_adc_nids_alt,
12515 .capsrc_nids = alc268_capsrc_nids,
12517 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12518 .channel_mode = alc268_modes,
12519 .input_mux = &alc268_capture_source,
12520 .unsol_event = alc268_toshiba_unsol_event,
12521 .init_hook = alc268_toshiba_init_hook,
12524 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12525 alc268_beep_mixer },
12526 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12527 alc268_acer_verbs },
12528 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12529 .dac_nids = alc268_dac_nids,
12530 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12531 .adc_nids = alc268_adc_nids_alt,
12532 .capsrc_nids = alc268_capsrc_nids,
12534 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12535 .channel_mode = alc268_modes,
12536 .input_mux = &alc268_acer_capture_source,
12537 .unsol_event = alc268_acer_unsol_event,
12538 .init_hook = alc268_acer_init_hook,
12540 [ALC268_ACER_DMIC] = {
12541 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12542 alc268_beep_mixer },
12543 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12544 alc268_acer_verbs },
12545 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12546 .dac_nids = alc268_dac_nids,
12547 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12548 .adc_nids = alc268_adc_nids_alt,
12549 .capsrc_nids = alc268_capsrc_nids,
12551 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12552 .channel_mode = alc268_modes,
12553 .input_mux = &alc268_acer_dmic_capture_source,
12554 .unsol_event = alc268_acer_unsol_event,
12555 .init_hook = alc268_acer_init_hook,
12557 [ALC268_ACER_ASPIRE_ONE] = {
12558 .mixers = { alc268_acer_aspire_one_mixer,
12560 alc268_capture_alt_mixer },
12561 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12562 alc268_acer_aspire_one_verbs },
12563 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12564 .dac_nids = alc268_dac_nids,
12565 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12566 .adc_nids = alc268_adc_nids_alt,
12567 .capsrc_nids = alc268_capsrc_nids,
12569 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12570 .channel_mode = alc268_modes,
12571 .input_mux = &alc268_acer_lc_capture_source,
12572 .unsol_event = alc268_acer_lc_unsol_event,
12573 .init_hook = alc268_acer_lc_init_hook,
12576 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12577 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12578 alc268_dell_verbs },
12579 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12580 .dac_nids = alc268_dac_nids,
12582 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12583 .channel_mode = alc268_modes,
12584 .unsol_event = alc_sku_unsol_event,
12585 .init_hook = alc268_dell_init_hook,
12586 .input_mux = &alc268_capture_source,
12589 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12590 alc268_beep_mixer },
12591 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12592 alc268_toshiba_verbs },
12593 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12594 .dac_nids = alc268_dac_nids,
12595 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12596 .adc_nids = alc268_adc_nids_alt,
12597 .capsrc_nids = alc268_capsrc_nids,
12599 .dig_out_nid = ALC268_DIGOUT_NID,
12600 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12601 .channel_mode = alc268_modes,
12602 .input_mux = &alc268_capture_source,
12603 .unsol_event = alc268_toshiba_unsol_event,
12604 .init_hook = alc268_toshiba_init_hook
12606 #ifdef CONFIG_SND_DEBUG
12608 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12609 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12610 alc268_volume_init_verbs },
12611 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12612 .dac_nids = alc268_dac_nids,
12613 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12614 .adc_nids = alc268_adc_nids_alt,
12615 .capsrc_nids = alc268_capsrc_nids,
12617 .dig_out_nid = ALC268_DIGOUT_NID,
12618 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12619 .channel_mode = alc268_modes,
12620 .input_mux = &alc268_capture_source,
12625 static int patch_alc268(struct hda_codec *codec)
12627 struct alc_spec *spec;
12629 int i, has_beep, err;
12631 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12635 codec->spec = spec;
12637 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12641 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12642 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12644 board_config = ALC268_AUTO;
12647 if (board_config == ALC268_AUTO) {
12648 /* automatic parse from the BIOS config */
12649 err = alc268_parse_auto_config(codec);
12655 "hda_codec: Cannot set up configuration "
12656 "from BIOS. Using base mode...\n");
12657 board_config = ALC268_3ST;
12661 if (board_config != ALC268_AUTO)
12662 setup_preset(spec, &alc268_presets[board_config]);
12664 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12665 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12666 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12668 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12671 for (i = 0; i < spec->num_mixers; i++) {
12672 if (spec->mixers[i] == alc268_beep_mixer) {
12679 err = snd_hda_attach_beep_device(codec, 0x1);
12684 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12685 /* override the amp caps for beep generator */
12686 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12687 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12688 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12689 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12690 (0 << AC_AMPCAP_MUTE_SHIFT));
12693 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12694 /* check whether NID 0x07 is valid */
12695 unsigned int wcap = get_wcaps(codec, 0x07);
12699 wcap = get_wcaps_type(wcap);
12700 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12701 spec->adc_nids = alc268_adc_nids_alt;
12702 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12703 add_mixer(spec, alc268_capture_alt_mixer);
12705 spec->adc_nids = alc268_adc_nids;
12706 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12707 add_mixer(spec, alc268_capture_mixer);
12709 spec->capsrc_nids = alc268_capsrc_nids;
12710 /* set default input source */
12711 for (i = 0; i < spec->num_adc_nids; i++)
12712 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12713 0, AC_VERB_SET_CONNECT_SEL,
12714 spec->input_mux->items[0].index);
12717 spec->vmaster_nid = 0x02;
12719 codec->patch_ops = alc_patch_ops;
12720 if (board_config == ALC268_AUTO)
12721 spec->init_hook = alc268_auto_init;
12723 codec->proc_widget_hook = print_realtek_coef;
12729 * ALC269 channel source setting (2 channel)
12731 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12733 #define alc269_dac_nids alc260_dac_nids
12735 static hda_nid_t alc269_adc_nids[1] = {
12740 static hda_nid_t alc269_capsrc_nids[1] = {
12744 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12748 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12756 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12764 #define alc269_modes alc260_modes
12765 #define alc269_capture_source alc880_lg_lw_capture_source
12767 static struct snd_kcontrol_new alc269_base_mixer[] = {
12768 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12769 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12770 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12771 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12772 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12773 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12774 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12775 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12776 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12777 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12778 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12779 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12783 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12784 /* output mixer control */
12785 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12787 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12788 .name = "Master Playback Switch",
12789 .info = snd_hda_mixer_amp_switch_info,
12790 .get = snd_hda_mixer_amp_switch_get,
12791 .put = alc268_acer_master_sw_put,
12792 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12795 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12796 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12797 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12798 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12799 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12803 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12804 /* output mixer control */
12805 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12807 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12808 .name = "Master Playback Switch",
12809 .info = snd_hda_mixer_amp_switch_info,
12810 .get = snd_hda_mixer_amp_switch_get,
12811 .put = alc268_acer_master_sw_put,
12812 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12815 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12816 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12817 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12818 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12819 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12820 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12821 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12822 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12826 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12827 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12828 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12829 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12830 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12834 /* capture mixer elements */
12835 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12836 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12837 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12838 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12843 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12845 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12846 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12847 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12848 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12849 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12850 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12851 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12855 static struct hda_verb alc269_lifebook_verbs[] = {
12856 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12857 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12858 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12859 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12860 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12861 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12862 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12863 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12864 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12865 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12869 /* toggle speaker-output according to the hp-jack state */
12870 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12872 unsigned int present;
12873 unsigned char bits;
12875 present = snd_hda_codec_read(codec, 0x15, 0,
12876 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12877 bits = present ? AMP_IN_MUTE(0) : 0;
12878 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12879 AMP_IN_MUTE(0), bits);
12880 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12881 AMP_IN_MUTE(0), bits);
12883 snd_hda_codec_write(codec, 0x20, 0,
12884 AC_VERB_SET_COEF_INDEX, 0x0c);
12885 snd_hda_codec_write(codec, 0x20, 0,
12886 AC_VERB_SET_PROC_COEF, 0x680);
12888 snd_hda_codec_write(codec, 0x20, 0,
12889 AC_VERB_SET_COEF_INDEX, 0x0c);
12890 snd_hda_codec_write(codec, 0x20, 0,
12891 AC_VERB_SET_PROC_COEF, 0x480);
12894 /* toggle speaker-output according to the hp-jacks state */
12895 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12897 unsigned int present;
12898 unsigned char bits;
12900 /* Check laptop headphone socket */
12901 present = snd_hda_codec_read(codec, 0x15, 0,
12902 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12904 /* Check port replicator headphone socket */
12905 present |= snd_hda_codec_read(codec, 0x1a, 0,
12906 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12908 bits = present ? AMP_IN_MUTE(0) : 0;
12909 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12910 AMP_IN_MUTE(0), bits);
12911 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12912 AMP_IN_MUTE(0), bits);
12914 snd_hda_codec_write(codec, 0x20, 0,
12915 AC_VERB_SET_COEF_INDEX, 0x0c);
12916 snd_hda_codec_write(codec, 0x20, 0,
12917 AC_VERB_SET_PROC_COEF, 0x680);
12919 snd_hda_codec_write(codec, 0x20, 0,
12920 AC_VERB_SET_COEF_INDEX, 0x0c);
12921 snd_hda_codec_write(codec, 0x20, 0,
12922 AC_VERB_SET_PROC_COEF, 0x480);
12925 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12927 unsigned int present;
12929 present = snd_hda_codec_read(codec, 0x18, 0,
12930 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12931 snd_hda_codec_write(codec, 0x23, 0,
12932 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12935 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12937 unsigned int present_laptop;
12938 unsigned int present_dock;
12940 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12941 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12943 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12944 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12946 /* Laptop mic port overrides dock mic port, design decision */
12948 snd_hda_codec_write(codec, 0x23, 0,
12949 AC_VERB_SET_CONNECT_SEL, 0x3);
12950 if (present_laptop)
12951 snd_hda_codec_write(codec, 0x23, 0,
12952 AC_VERB_SET_CONNECT_SEL, 0x0);
12953 if (!present_dock && !present_laptop)
12954 snd_hda_codec_write(codec, 0x23, 0,
12955 AC_VERB_SET_CONNECT_SEL, 0x1);
12958 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12961 if ((res >> 26) == ALC880_HP_EVENT)
12962 alc269_quanta_fl1_speaker_automute(codec);
12963 if ((res >> 26) == ALC880_MIC_EVENT)
12964 alc269_quanta_fl1_mic_automute(codec);
12967 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12970 if ((res >> 26) == ALC880_HP_EVENT)
12971 alc269_lifebook_speaker_automute(codec);
12972 if ((res >> 26) == ALC880_MIC_EVENT)
12973 alc269_lifebook_mic_autoswitch(codec);
12976 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12978 alc269_quanta_fl1_speaker_automute(codec);
12979 alc269_quanta_fl1_mic_automute(codec);
12982 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12984 alc269_lifebook_speaker_automute(codec);
12985 alc269_lifebook_mic_autoswitch(codec);
12988 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12989 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12990 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12991 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12992 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12993 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12994 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12995 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12999 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13000 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13001 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13002 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13003 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13004 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13005 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13009 /* toggle speaker-output according to the hp-jack state */
13010 static void alc269_speaker_automute(struct hda_codec *codec)
13012 unsigned int present;
13013 unsigned char bits;
13015 present = snd_hda_codec_read(codec, 0x15, 0,
13016 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13017 bits = present ? AMP_IN_MUTE(0) : 0;
13018 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13019 AMP_IN_MUTE(0), bits);
13020 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13021 AMP_IN_MUTE(0), bits);
13024 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
13026 unsigned int present;
13028 present = snd_hda_codec_read(codec, 0x18, 0,
13029 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13030 snd_hda_codec_write(codec, 0x23, 0,
13031 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
13034 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
13036 unsigned int present;
13038 present = snd_hda_codec_read(codec, 0x18, 0,
13039 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13040 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13041 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13042 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13043 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13046 /* unsolicited event for HP jack sensing */
13047 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
13050 if ((res >> 26) == ALC880_HP_EVENT)
13051 alc269_speaker_automute(codec);
13053 if ((res >> 26) == ALC880_MIC_EVENT)
13054 alc269_eeepc_dmic_automute(codec);
13057 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
13059 alc269_speaker_automute(codec);
13060 alc269_eeepc_dmic_automute(codec);
13063 /* unsolicited event for HP jack sensing */
13064 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
13067 if ((res >> 26) == ALC880_HP_EVENT)
13068 alc269_speaker_automute(codec);
13070 if ((res >> 26) == ALC880_MIC_EVENT)
13071 alc269_eeepc_amic_automute(codec);
13074 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
13076 alc269_speaker_automute(codec);
13077 alc269_eeepc_amic_automute(codec);
13081 * generic initialization of ADC, input mixers and output mixers
13083 static struct hda_verb alc269_init_verbs[] = {
13085 * Unmute ADC0 and set the default input to mic-in
13087 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13089 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13090 * analog-loopback mixer widget
13091 * Note: PASD motherboards uses the Line In 2 as the input for
13092 * front panel mic (mic 2)
13094 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13095 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13096 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13097 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13098 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13099 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13102 * Set up output mixers (0x0c - 0x0e)
13104 /* set vol=0 to output mixers */
13105 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13106 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13108 /* set up input amps for analog loopback */
13109 /* Amp Indices: DAC = 0, mixer = 1 */
13110 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13111 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13112 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13113 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13114 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13115 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13117 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13118 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13119 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13120 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13121 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13122 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13123 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13125 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13126 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13127 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13128 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13129 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13130 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13131 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13133 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13134 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13136 /* FIXME: use matrix-type input source selection */
13137 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13138 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13139 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13140 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13141 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13142 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13145 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13146 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13150 /* add playback controls from the parsed DAC table */
13151 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
13152 const struct auto_pin_cfg *cfg)
13157 spec->multiout.num_dacs = 1; /* only use one dac */
13158 spec->multiout.dac_nids = spec->private_dac_nids;
13159 spec->multiout.dac_nids[0] = 2;
13161 nid = cfg->line_out_pins[0];
13163 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13164 "Front Playback Volume",
13165 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
13168 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13169 "Front Playback Switch",
13170 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13175 nid = cfg->speaker_pins[0];
13177 if (!cfg->line_out_pins[0]) {
13178 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13179 "Speaker Playback Volume",
13180 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13186 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13187 "Speaker Playback Switch",
13188 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13193 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13194 "Speaker Playback Switch",
13195 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13201 nid = cfg->hp_pins[0];
13203 /* spec->multiout.hp_nid = 2; */
13204 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
13205 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13206 "Headphone Playback Volume",
13207 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13213 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13214 "Headphone Playback Switch",
13215 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13220 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13221 "Headphone Playback Switch",
13222 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13231 #define alc269_auto_create_analog_input_ctls \
13232 alc262_auto_create_analog_input_ctls
13234 #ifdef CONFIG_SND_HDA_POWER_SAVE
13235 #define alc269_loopbacks alc880_loopbacks
13238 /* pcm configuration: identical with ALC880 */
13239 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13240 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13241 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13242 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13244 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13248 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13249 /* NID is set in alc_build_pcms */
13251 .open = alc880_playback_pcm_open,
13252 .prepare = alc880_playback_pcm_prepare,
13253 .cleanup = alc880_playback_pcm_cleanup
13257 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13261 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13262 /* NID is set in alc_build_pcms */
13266 * BIOS auto configuration
13268 static int alc269_parse_auto_config(struct hda_codec *codec)
13270 struct alc_spec *spec = codec->spec;
13272 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13274 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13279 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13282 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
13286 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13288 if (spec->autocfg.dig_outs)
13289 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13291 if (spec->kctls.list)
13292 add_mixer(spec, spec->kctls.list);
13294 add_verb(spec, alc269_init_verbs);
13295 spec->num_mux_defs = 1;
13296 spec->input_mux = &spec->private_imux[0];
13297 /* set default input source */
13298 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13299 0, AC_VERB_SET_CONNECT_SEL,
13300 spec->input_mux->items[0].index);
13302 err = alc_auto_add_mic_boost(codec);
13306 if (!spec->cap_mixer && !spec->no_analog)
13307 set_capture_mixer(codec);
13309 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13314 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13315 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13316 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13319 /* init callback for auto-configuration model -- overriding the default init */
13320 static void alc269_auto_init(struct hda_codec *codec)
13322 struct alc_spec *spec = codec->spec;
13323 alc269_auto_init_multi_out(codec);
13324 alc269_auto_init_hp_out(codec);
13325 alc269_auto_init_analog_input(codec);
13326 if (spec->unsol_event)
13327 alc_inithook(codec);
13331 * configuration and preset
13333 static const char *alc269_models[ALC269_MODEL_LAST] = {
13334 [ALC269_BASIC] = "basic",
13335 [ALC269_QUANTA_FL1] = "quanta",
13336 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13337 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13338 [ALC269_FUJITSU] = "fujitsu",
13339 [ALC269_LIFEBOOK] = "lifebook"
13342 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13343 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13344 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13345 ALC269_ASUS_EEEPC_P703),
13346 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13347 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13348 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13349 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13350 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13351 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13352 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13353 ALC269_ASUS_EEEPC_P901),
13354 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13355 ALC269_ASUS_EEEPC_P901),
13356 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13357 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13358 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13362 static struct alc_config_preset alc269_presets[] = {
13364 .mixers = { alc269_base_mixer },
13365 .init_verbs = { alc269_init_verbs },
13366 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13367 .dac_nids = alc269_dac_nids,
13369 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13370 .channel_mode = alc269_modes,
13371 .input_mux = &alc269_capture_source,
13373 [ALC269_QUANTA_FL1] = {
13374 .mixers = { alc269_quanta_fl1_mixer },
13375 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13376 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13377 .dac_nids = alc269_dac_nids,
13379 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13380 .channel_mode = alc269_modes,
13381 .input_mux = &alc269_capture_source,
13382 .unsol_event = alc269_quanta_fl1_unsol_event,
13383 .init_hook = alc269_quanta_fl1_init_hook,
13385 [ALC269_ASUS_EEEPC_P703] = {
13386 .mixers = { alc269_eeepc_mixer },
13387 .cap_mixer = alc269_epc_capture_mixer,
13388 .init_verbs = { alc269_init_verbs,
13389 alc269_eeepc_amic_init_verbs },
13390 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13391 .dac_nids = alc269_dac_nids,
13393 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13394 .channel_mode = alc269_modes,
13395 .input_mux = &alc269_eeepc_amic_capture_source,
13396 .unsol_event = alc269_eeepc_amic_unsol_event,
13397 .init_hook = alc269_eeepc_amic_inithook,
13399 [ALC269_ASUS_EEEPC_P901] = {
13400 .mixers = { alc269_eeepc_mixer },
13401 .cap_mixer = alc269_epc_capture_mixer,
13402 .init_verbs = { alc269_init_verbs,
13403 alc269_eeepc_dmic_init_verbs },
13404 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13405 .dac_nids = alc269_dac_nids,
13407 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13408 .channel_mode = alc269_modes,
13409 .input_mux = &alc269_eeepc_dmic_capture_source,
13410 .unsol_event = alc269_eeepc_dmic_unsol_event,
13411 .init_hook = alc269_eeepc_dmic_inithook,
13413 [ALC269_FUJITSU] = {
13414 .mixers = { alc269_fujitsu_mixer },
13415 .cap_mixer = alc269_epc_capture_mixer,
13416 .init_verbs = { alc269_init_verbs,
13417 alc269_eeepc_dmic_init_verbs },
13418 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13419 .dac_nids = alc269_dac_nids,
13421 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13422 .channel_mode = alc269_modes,
13423 .input_mux = &alc269_eeepc_dmic_capture_source,
13424 .unsol_event = alc269_eeepc_dmic_unsol_event,
13425 .init_hook = alc269_eeepc_dmic_inithook,
13427 [ALC269_LIFEBOOK] = {
13428 .mixers = { alc269_lifebook_mixer },
13429 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13430 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13431 .dac_nids = alc269_dac_nids,
13433 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13434 .channel_mode = alc269_modes,
13435 .input_mux = &alc269_capture_source,
13436 .unsol_event = alc269_lifebook_unsol_event,
13437 .init_hook = alc269_lifebook_init_hook,
13441 static int patch_alc269(struct hda_codec *codec)
13443 struct alc_spec *spec;
13447 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13451 codec->spec = spec;
13453 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13455 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13459 if (board_config < 0) {
13460 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13462 board_config = ALC269_AUTO;
13465 if (board_config == ALC269_AUTO) {
13466 /* automatic parse from the BIOS config */
13467 err = alc269_parse_auto_config(codec);
13473 "hda_codec: Cannot set up configuration "
13474 "from BIOS. Using base mode...\n");
13475 board_config = ALC269_BASIC;
13479 err = snd_hda_attach_beep_device(codec, 0x1);
13485 if (board_config != ALC269_AUTO)
13486 setup_preset(spec, &alc269_presets[board_config]);
13488 if (codec->subsystem_id == 0x17aa3bf8) {
13489 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13490 * fix the sample rate of analog I/O to 44.1kHz
13492 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13493 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13495 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13496 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13498 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13499 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13501 spec->adc_nids = alc269_adc_nids;
13502 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13503 spec->capsrc_nids = alc269_capsrc_nids;
13504 if (!spec->cap_mixer)
13505 set_capture_mixer(codec);
13506 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13508 spec->vmaster_nid = 0x02;
13510 codec->patch_ops = alc_patch_ops;
13511 if (board_config == ALC269_AUTO)
13512 spec->init_hook = alc269_auto_init;
13513 #ifdef CONFIG_SND_HDA_POWER_SAVE
13514 if (!spec->loopback.amplist)
13515 spec->loopback.amplist = alc269_loopbacks;
13517 codec->proc_widget_hook = print_realtek_coef;
13523 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13527 * set the path ways for 2 channel output
13528 * need to set the codec line out and mic 1 pin widgets to inputs
13530 static struct hda_verb alc861_threestack_ch2_init[] = {
13531 /* set pin widget 1Ah (line in) for input */
13532 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13533 /* set pin widget 18h (mic1/2) for input, for mic also enable
13536 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13538 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13540 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13541 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13547 * need to set the codec line out and mic 1 pin widgets to outputs
13549 static struct hda_verb alc861_threestack_ch6_init[] = {
13550 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13551 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13552 /* set pin widget 18h (mic1) for output (CLFE)*/
13553 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13555 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13556 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13558 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13560 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13561 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13566 static struct hda_channel_mode alc861_threestack_modes[2] = {
13567 { 2, alc861_threestack_ch2_init },
13568 { 6, alc861_threestack_ch6_init },
13570 /* Set mic1 as input and unmute the mixer */
13571 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13572 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13573 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13576 /* Set mic1 as output and mute mixer */
13577 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13578 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13579 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13583 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13584 { 2, alc861_uniwill_m31_ch2_init },
13585 { 4, alc861_uniwill_m31_ch4_init },
13588 /* Set mic1 and line-in as input and unmute the mixer */
13589 static struct hda_verb alc861_asus_ch2_init[] = {
13590 /* set pin widget 1Ah (line in) for input */
13591 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13592 /* set pin widget 18h (mic1/2) for input, for mic also enable
13595 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13597 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13599 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13600 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13604 /* Set mic1 nad line-in as output and mute mixer */
13605 static struct hda_verb alc861_asus_ch6_init[] = {
13606 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13607 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13608 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13609 /* set pin widget 18h (mic1) for output (CLFE)*/
13610 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13611 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13612 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13613 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13615 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13617 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13618 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13623 static struct hda_channel_mode alc861_asus_modes[2] = {
13624 { 2, alc861_asus_ch2_init },
13625 { 6, alc861_asus_ch6_init },
13630 static struct snd_kcontrol_new alc861_base_mixer[] = {
13631 /* output mixer control */
13632 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13633 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13634 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13635 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13636 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13638 /*Input mixer control */
13639 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13640 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13641 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13642 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13643 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13644 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13646 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13647 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13648 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13653 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13654 /* output mixer control */
13655 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13656 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13657 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13658 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13659 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13661 /* Input mixer control */
13662 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13663 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13664 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13665 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13666 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13667 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13668 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13669 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13670 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13671 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13674 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13675 .name = "Channel Mode",
13676 .info = alc_ch_mode_info,
13677 .get = alc_ch_mode_get,
13678 .put = alc_ch_mode_put,
13679 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13684 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13685 /* output mixer control */
13686 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13687 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13688 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13693 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13694 /* output mixer control */
13695 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13696 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13697 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13698 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13699 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13701 /* Input mixer control */
13702 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13703 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13704 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13705 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13706 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13707 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13709 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13710 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13711 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13714 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13715 .name = "Channel Mode",
13716 .info = alc_ch_mode_info,
13717 .get = alc_ch_mode_get,
13718 .put = alc_ch_mode_put,
13719 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13724 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13725 /* output mixer control */
13726 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13727 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13728 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13729 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13730 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13732 /* Input mixer control */
13733 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13734 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13735 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13736 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13737 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13738 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13739 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13740 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13741 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13742 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13745 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13746 .name = "Channel Mode",
13747 .info = alc_ch_mode_info,
13748 .get = alc_ch_mode_get,
13749 .put = alc_ch_mode_put,
13750 .private_value = ARRAY_SIZE(alc861_asus_modes),
13755 /* additional mixer */
13756 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13757 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13758 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13763 * generic initialization of ADC, input mixers and output mixers
13765 static struct hda_verb alc861_base_init_verbs[] = {
13767 * Unmute ADC0 and set the default input to mic-in
13769 /* port-A for surround (rear panel) */
13770 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13771 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13772 /* port-B for mic-in (rear panel) with vref */
13773 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13774 /* port-C for line-in (rear panel) */
13775 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13776 /* port-D for Front */
13777 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13778 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13779 /* port-E for HP out (front panel) */
13780 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13781 /* route front PCM to HP */
13782 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13783 /* port-F for mic-in (front panel) with vref */
13784 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13785 /* port-G for CLFE (rear panel) */
13786 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13787 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13788 /* port-H for side (rear panel) */
13789 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13790 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13792 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13793 /* route front mic to ADC1*/
13794 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13795 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13797 /* Unmute DAC0~3 & spdif out*/
13798 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13799 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13800 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13801 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13802 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13804 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13805 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13806 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13807 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13808 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13810 /* Unmute Stereo Mixer 15 */
13811 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13812 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13814 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13816 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13817 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13818 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13819 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13820 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13821 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13822 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13823 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13824 /* hp used DAC 3 (Front) */
13825 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13826 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13831 static struct hda_verb alc861_threestack_init_verbs[] = {
13833 * Unmute ADC0 and set the default input to mic-in
13835 /* port-A for surround (rear panel) */
13836 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13837 /* port-B for mic-in (rear panel) with vref */
13838 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13839 /* port-C for line-in (rear panel) */
13840 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13841 /* port-D for Front */
13842 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13843 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13844 /* port-E for HP out (front panel) */
13845 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13846 /* route front PCM to HP */
13847 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13848 /* port-F for mic-in (front panel) with vref */
13849 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13850 /* port-G for CLFE (rear panel) */
13851 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13852 /* port-H for side (rear panel) */
13853 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13855 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13856 /* route front mic to ADC1*/
13857 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13858 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13859 /* Unmute DAC0~3 & spdif out*/
13860 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13861 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13862 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13863 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13864 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13866 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13867 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13868 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13869 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13870 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13872 /* Unmute Stereo Mixer 15 */
13873 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13874 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13875 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13876 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13878 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13879 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13880 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13881 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13882 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13883 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13884 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13885 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13886 /* hp used DAC 3 (Front) */
13887 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13888 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13892 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13894 * Unmute ADC0 and set the default input to mic-in
13896 /* port-A for surround (rear panel) */
13897 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13898 /* port-B for mic-in (rear panel) with vref */
13899 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13900 /* port-C for line-in (rear panel) */
13901 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13902 /* port-D for Front */
13903 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13904 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13905 /* port-E for HP out (front panel) */
13906 /* this has to be set to VREF80 */
13907 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13908 /* route front PCM to HP */
13909 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13910 /* port-F for mic-in (front panel) with vref */
13911 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13912 /* port-G for CLFE (rear panel) */
13913 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13914 /* port-H for side (rear panel) */
13915 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13917 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13918 /* route front mic to ADC1*/
13919 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13920 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13921 /* Unmute DAC0~3 & spdif out*/
13922 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13923 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13924 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13925 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13926 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13928 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13929 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13930 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13931 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13932 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13934 /* Unmute Stereo Mixer 15 */
13935 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13937 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13938 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13940 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13941 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13942 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13943 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13944 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13945 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13946 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13947 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13948 /* hp used DAC 3 (Front) */
13949 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13950 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13954 static struct hda_verb alc861_asus_init_verbs[] = {
13956 * Unmute ADC0 and set the default input to mic-in
13958 /* port-A for surround (rear panel)
13959 * according to codec#0 this is the HP jack
13961 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13962 /* route front PCM to HP */
13963 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13964 /* port-B for mic-in (rear panel) with vref */
13965 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13966 /* port-C for line-in (rear panel) */
13967 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13968 /* port-D for Front */
13969 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13970 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13971 /* port-E for HP out (front panel) */
13972 /* this has to be set to VREF80 */
13973 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13974 /* route front PCM to HP */
13975 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13976 /* port-F for mic-in (front panel) with vref */
13977 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13978 /* port-G for CLFE (rear panel) */
13979 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13980 /* port-H for side (rear panel) */
13981 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13983 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13984 /* route front mic to ADC1*/
13985 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13986 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13987 /* Unmute DAC0~3 & spdif out*/
13988 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13989 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13990 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13991 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13992 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13993 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13994 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13995 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13996 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13997 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13999 /* Unmute Stereo Mixer 15 */
14000 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14001 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14002 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14003 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14005 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14006 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14007 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14008 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14009 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14010 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14011 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14012 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14013 /* hp used DAC 3 (Front) */
14014 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14015 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14019 /* additional init verbs for ASUS laptops */
14020 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14021 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14022 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14027 * generic initialization of ADC, input mixers and output mixers
14029 static struct hda_verb alc861_auto_init_verbs[] = {
14031 * Unmute ADC0 and set the default input to mic-in
14033 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14034 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14036 /* Unmute DAC0~3 & spdif out*/
14037 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14038 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14039 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14040 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14041 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14043 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14044 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14045 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14046 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14047 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14049 /* Unmute Stereo Mixer 15 */
14050 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14051 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14052 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14055 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14056 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14057 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14058 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14059 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14060 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14061 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14062 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14064 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14065 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14066 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14067 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14068 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14069 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14070 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14071 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14073 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14078 static struct hda_verb alc861_toshiba_init_verbs[] = {
14079 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14084 /* toggle speaker-output according to the hp-jack state */
14085 static void alc861_toshiba_automute(struct hda_codec *codec)
14087 unsigned int present;
14089 present = snd_hda_codec_read(codec, 0x0f, 0,
14090 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14091 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14092 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14093 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14094 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14097 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14100 if ((res >> 26) == ALC880_HP_EVENT)
14101 alc861_toshiba_automute(codec);
14104 /* pcm configuration: identical with ALC880 */
14105 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14106 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14107 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14108 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14111 #define ALC861_DIGOUT_NID 0x07
14113 static struct hda_channel_mode alc861_8ch_modes[1] = {
14117 static hda_nid_t alc861_dac_nids[4] = {
14118 /* front, surround, clfe, side */
14119 0x03, 0x06, 0x05, 0x04
14122 static hda_nid_t alc660_dac_nids[3] = {
14123 /* front, clfe, surround */
14127 static hda_nid_t alc861_adc_nids[1] = {
14132 static struct hda_input_mux alc861_capture_source = {
14136 { "Front Mic", 0x3 },
14143 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14145 struct alc_spec *spec = codec->spec;
14146 hda_nid_t mix, srcs[5];
14149 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14151 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14154 for (i = 0; i < num; i++) {
14156 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14157 if (type != AC_WID_AUD_OUT)
14159 for (j = 0; j < spec->multiout.num_dacs; j++)
14160 if (spec->multiout.dac_nids[j] == srcs[i])
14162 if (j >= spec->multiout.num_dacs)
14168 /* fill in the dac_nids table from the parsed pin configuration */
14169 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14170 const struct auto_pin_cfg *cfg)
14172 struct alc_spec *spec = codec->spec;
14174 hda_nid_t nid, dac;
14176 spec->multiout.dac_nids = spec->private_dac_nids;
14177 for (i = 0; i < cfg->line_outs; i++) {
14178 nid = cfg->line_out_pins[i];
14179 dac = alc861_look_for_dac(codec, nid);
14182 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14187 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14188 hda_nid_t nid, unsigned int chs)
14191 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14192 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14193 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14196 /* add playback controls from the parsed DAC table */
14197 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14198 const struct auto_pin_cfg *cfg)
14200 struct alc_spec *spec = codec->spec;
14201 static const char *chname[4] = {
14202 "Front", "Surround", NULL /*CLFE*/, "Side"
14207 if (cfg->line_outs == 1) {
14208 const char *pfx = NULL;
14211 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14214 nid = spec->multiout.dac_nids[0];
14215 return alc861_create_out_sw(codec, pfx, nid, 3);
14219 for (i = 0; i < cfg->line_outs; i++) {
14220 nid = spec->multiout.dac_nids[i];
14225 err = alc861_create_out_sw(codec, "Center", nid, 1);
14228 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14232 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14240 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14242 struct alc_spec *spec = codec->spec;
14249 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14250 nid = alc861_look_for_dac(codec, pin);
14252 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14255 spec->multiout.hp_nid = nid;
14261 /* create playback/capture controls for input pins */
14262 static int alc861_auto_create_analog_input_ctls(struct hda_codec *codec,
14263 const struct auto_pin_cfg *cfg)
14265 struct alc_spec *spec = codec->spec;
14266 struct hda_input_mux *imux = &spec->private_imux[0];
14267 int i, err, idx, idx1;
14269 for (i = 0; i < AUTO_PIN_LAST; i++) {
14270 switch (cfg->input_pins[i]) {
14273 idx = 2; /* Line In */
14277 idx = 2; /* Line In */
14281 idx = 1; /* Mic In */
14285 idx = 1; /* Mic In */
14295 err = new_analog_input(spec, cfg->input_pins[i],
14296 auto_pin_cfg_labels[i], idx, 0x15);
14300 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
14301 imux->items[imux->num_items].index = idx1;
14307 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14309 int pin_type, hda_nid_t dac)
14311 hda_nid_t mix, srcs[5];
14314 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14316 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14318 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14320 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14323 for (i = 0; i < num; i++) {
14325 if (srcs[i] == dac || srcs[i] == 0x15)
14326 mute = AMP_IN_UNMUTE(i);
14328 mute = AMP_IN_MUTE(i);
14329 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14334 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14336 struct alc_spec *spec = codec->spec;
14339 for (i = 0; i < spec->autocfg.line_outs; i++) {
14340 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14341 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14343 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14344 spec->multiout.dac_nids[i]);
14348 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14350 struct alc_spec *spec = codec->spec;
14353 pin = spec->autocfg.hp_pins[0];
14355 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14356 spec->multiout.hp_nid);
14357 pin = spec->autocfg.speaker_pins[0];
14359 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT,
14360 spec->multiout.dac_nids[0]);
14363 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14365 struct alc_spec *spec = codec->spec;
14368 for (i = 0; i < AUTO_PIN_LAST; i++) {
14369 hda_nid_t nid = spec->autocfg.input_pins[i];
14370 if (nid >= 0x0c && nid <= 0x11)
14371 alc_set_input_pin(codec, nid, i);
14375 /* parse the BIOS configuration and set up the alc_spec */
14376 /* return 1 if successful, 0 if the proper config is not found,
14377 * or a negative error code
14379 static int alc861_parse_auto_config(struct hda_codec *codec)
14381 struct alc_spec *spec = codec->spec;
14383 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14385 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14389 if (!spec->autocfg.line_outs)
14390 return 0; /* can't find valid BIOS pin config */
14392 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14395 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14398 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14401 err = alc861_auto_create_analog_input_ctls(codec, &spec->autocfg);
14405 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14407 if (spec->autocfg.dig_outs)
14408 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14410 if (spec->kctls.list)
14411 add_mixer(spec, spec->kctls.list);
14413 add_verb(spec, alc861_auto_init_verbs);
14415 spec->num_mux_defs = 1;
14416 spec->input_mux = &spec->private_imux[0];
14418 spec->adc_nids = alc861_adc_nids;
14419 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14420 set_capture_mixer(codec);
14422 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14427 /* additional initialization for auto-configuration model */
14428 static void alc861_auto_init(struct hda_codec *codec)
14430 struct alc_spec *spec = codec->spec;
14431 alc861_auto_init_multi_out(codec);
14432 alc861_auto_init_hp_out(codec);
14433 alc861_auto_init_analog_input(codec);
14434 if (spec->unsol_event)
14435 alc_inithook(codec);
14438 #ifdef CONFIG_SND_HDA_POWER_SAVE
14439 static struct hda_amp_list alc861_loopbacks[] = {
14440 { 0x15, HDA_INPUT, 0 },
14441 { 0x15, HDA_INPUT, 1 },
14442 { 0x15, HDA_INPUT, 2 },
14443 { 0x15, HDA_INPUT, 3 },
14450 * configuration and preset
14452 static const char *alc861_models[ALC861_MODEL_LAST] = {
14453 [ALC861_3ST] = "3stack",
14454 [ALC660_3ST] = "3stack-660",
14455 [ALC861_3ST_DIG] = "3stack-dig",
14456 [ALC861_6ST_DIG] = "6stack-dig",
14457 [ALC861_UNIWILL_M31] = "uniwill-m31",
14458 [ALC861_TOSHIBA] = "toshiba",
14459 [ALC861_ASUS] = "asus",
14460 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14461 [ALC861_AUTO] = "auto",
14464 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14465 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14466 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14467 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14468 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14469 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14470 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14471 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14472 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14473 * Any other models that need this preset?
14475 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14476 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14477 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14478 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14479 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14480 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14481 /* FIXME: the below seems conflict */
14482 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14483 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14484 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14488 static struct alc_config_preset alc861_presets[] = {
14490 .mixers = { alc861_3ST_mixer },
14491 .init_verbs = { alc861_threestack_init_verbs },
14492 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14493 .dac_nids = alc861_dac_nids,
14494 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14495 .channel_mode = alc861_threestack_modes,
14497 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14498 .adc_nids = alc861_adc_nids,
14499 .input_mux = &alc861_capture_source,
14501 [ALC861_3ST_DIG] = {
14502 .mixers = { alc861_base_mixer },
14503 .init_verbs = { alc861_threestack_init_verbs },
14504 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14505 .dac_nids = alc861_dac_nids,
14506 .dig_out_nid = ALC861_DIGOUT_NID,
14507 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14508 .channel_mode = alc861_threestack_modes,
14510 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14511 .adc_nids = alc861_adc_nids,
14512 .input_mux = &alc861_capture_source,
14514 [ALC861_6ST_DIG] = {
14515 .mixers = { alc861_base_mixer },
14516 .init_verbs = { alc861_base_init_verbs },
14517 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14518 .dac_nids = alc861_dac_nids,
14519 .dig_out_nid = ALC861_DIGOUT_NID,
14520 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14521 .channel_mode = alc861_8ch_modes,
14522 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14523 .adc_nids = alc861_adc_nids,
14524 .input_mux = &alc861_capture_source,
14527 .mixers = { alc861_3ST_mixer },
14528 .init_verbs = { alc861_threestack_init_verbs },
14529 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14530 .dac_nids = alc660_dac_nids,
14531 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14532 .channel_mode = alc861_threestack_modes,
14534 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14535 .adc_nids = alc861_adc_nids,
14536 .input_mux = &alc861_capture_source,
14538 [ALC861_UNIWILL_M31] = {
14539 .mixers = { alc861_uniwill_m31_mixer },
14540 .init_verbs = { alc861_uniwill_m31_init_verbs },
14541 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14542 .dac_nids = alc861_dac_nids,
14543 .dig_out_nid = ALC861_DIGOUT_NID,
14544 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14545 .channel_mode = alc861_uniwill_m31_modes,
14547 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14548 .adc_nids = alc861_adc_nids,
14549 .input_mux = &alc861_capture_source,
14551 [ALC861_TOSHIBA] = {
14552 .mixers = { alc861_toshiba_mixer },
14553 .init_verbs = { alc861_base_init_verbs,
14554 alc861_toshiba_init_verbs },
14555 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14556 .dac_nids = alc861_dac_nids,
14557 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14558 .channel_mode = alc883_3ST_2ch_modes,
14559 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14560 .adc_nids = alc861_adc_nids,
14561 .input_mux = &alc861_capture_source,
14562 .unsol_event = alc861_toshiba_unsol_event,
14563 .init_hook = alc861_toshiba_automute,
14566 .mixers = { alc861_asus_mixer },
14567 .init_verbs = { alc861_asus_init_verbs },
14568 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14569 .dac_nids = alc861_dac_nids,
14570 .dig_out_nid = ALC861_DIGOUT_NID,
14571 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14572 .channel_mode = alc861_asus_modes,
14575 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14576 .adc_nids = alc861_adc_nids,
14577 .input_mux = &alc861_capture_source,
14579 [ALC861_ASUS_LAPTOP] = {
14580 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14581 .init_verbs = { alc861_asus_init_verbs,
14582 alc861_asus_laptop_init_verbs },
14583 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14584 .dac_nids = alc861_dac_nids,
14585 .dig_out_nid = ALC861_DIGOUT_NID,
14586 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14587 .channel_mode = alc883_3ST_2ch_modes,
14589 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14590 .adc_nids = alc861_adc_nids,
14591 .input_mux = &alc861_capture_source,
14596 static int patch_alc861(struct hda_codec *codec)
14598 struct alc_spec *spec;
14602 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14606 codec->spec = spec;
14608 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14612 if (board_config < 0) {
14613 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14615 board_config = ALC861_AUTO;
14618 if (board_config == ALC861_AUTO) {
14619 /* automatic parse from the BIOS config */
14620 err = alc861_parse_auto_config(codec);
14626 "hda_codec: Cannot set up configuration "
14627 "from BIOS. Using base mode...\n");
14628 board_config = ALC861_3ST_DIG;
14632 err = snd_hda_attach_beep_device(codec, 0x23);
14638 if (board_config != ALC861_AUTO)
14639 setup_preset(spec, &alc861_presets[board_config]);
14641 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14642 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14644 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14645 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14647 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14649 spec->vmaster_nid = 0x03;
14651 codec->patch_ops = alc_patch_ops;
14652 if (board_config == ALC861_AUTO)
14653 spec->init_hook = alc861_auto_init;
14654 #ifdef CONFIG_SND_HDA_POWER_SAVE
14655 if (!spec->loopback.amplist)
14656 spec->loopback.amplist = alc861_loopbacks;
14658 codec->proc_widget_hook = print_realtek_coef;
14664 * ALC861-VD support
14668 * In addition, an independent DAC
14670 #define ALC861VD_DIGOUT_NID 0x06
14672 static hda_nid_t alc861vd_dac_nids[4] = {
14673 /* front, surr, clfe, side surr */
14674 0x02, 0x03, 0x04, 0x05
14677 /* dac_nids for ALC660vd are in a different order - according to
14678 * Realtek's driver.
14679 * This should probably result in a different mixer for 6stack models
14680 * of ALC660vd codecs, but for now there is only 3stack mixer
14681 * - and it is the same as in 861vd.
14682 * adc_nids in ALC660vd are (is) the same as in 861vd
14684 static hda_nid_t alc660vd_dac_nids[3] = {
14685 /* front, rear, clfe, rear_surr */
14689 static hda_nid_t alc861vd_adc_nids[1] = {
14694 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14697 /* FIXME: should be a matrix-type input source selection */
14698 static struct hda_input_mux alc861vd_capture_source = {
14702 { "Front Mic", 0x1 },
14708 static struct hda_input_mux alc861vd_dallas_capture_source = {
14711 { "Ext Mic", 0x0 },
14712 { "Int Mic", 0x1 },
14716 static struct hda_input_mux alc861vd_hp_capture_source = {
14719 { "Front Mic", 0x0 },
14720 { "ATAPI Mic", 0x1 },
14727 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14734 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14735 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14736 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14737 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14738 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14745 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14746 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14747 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14748 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14749 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14753 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14754 { 6, alc861vd_6stack_ch6_init },
14755 { 8, alc861vd_6stack_ch8_init },
14758 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14760 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14761 .name = "Channel Mode",
14762 .info = alc_ch_mode_info,
14763 .get = alc_ch_mode_get,
14764 .put = alc_ch_mode_put,
14769 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14770 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14772 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14773 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14774 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14776 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14777 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14779 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14781 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14783 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14784 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14786 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14787 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14789 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14791 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14795 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14796 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14797 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14799 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14800 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14802 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14803 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14808 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14809 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14810 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14812 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14814 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14815 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14816 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14818 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14819 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14820 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14822 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14823 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14825 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14826 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14831 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14832 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14833 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14834 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14836 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14838 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14839 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14840 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14842 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14843 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14844 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14846 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14847 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14852 /* Pin assignment: Speaker=0x14, HP = 0x15,
14853 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14855 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14856 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14857 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14858 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14859 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14860 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14861 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14862 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14863 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14864 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14865 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14869 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14870 * Front Mic=0x18, ATAPI Mic = 0x19,
14872 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14873 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14874 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14875 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14876 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14877 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14878 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14879 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14880 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14886 * generic initialization of ADC, input mixers and output mixers
14888 static struct hda_verb alc861vd_volume_init_verbs[] = {
14890 * Unmute ADC0 and set the default input to mic-in
14892 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14893 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14895 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14896 * the analog-loopback mixer widget
14898 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14899 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14900 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14901 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14902 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14903 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14905 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14907 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14908 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14909 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14912 * Set up output mixers (0x02 - 0x05)
14914 /* set vol=0 to output mixers */
14915 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14916 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14917 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14918 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14920 /* set up input amps for analog loopback */
14921 /* Amp Indices: DAC = 0, mixer = 1 */
14922 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14923 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14924 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14925 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14926 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14927 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14928 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14929 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14935 * 3-stack pin configuration:
14936 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14938 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14940 * Set pin mode and muting
14942 /* set front pin widgets 0x14 for output */
14943 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14944 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14945 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14947 /* Mic (rear) pin: input vref at 80% */
14948 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14949 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14950 /* Front Mic pin: input vref at 80% */
14951 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14952 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14953 /* Line In pin: input */
14954 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14955 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14956 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14957 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14958 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14959 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14960 /* CD pin widget for input */
14961 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14967 * 6-stack pin configuration:
14969 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14971 * Set pin mode and muting
14973 /* set front pin widgets 0x14 for output */
14974 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14975 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14976 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14978 /* Rear Pin: output 1 (0x0d) */
14979 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14980 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14981 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14982 /* CLFE Pin: output 2 (0x0e) */
14983 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14984 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14985 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14986 /* Side Pin: output 3 (0x0f) */
14987 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14988 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14989 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14991 /* Mic (rear) pin: input vref at 80% */
14992 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14993 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14994 /* Front Mic pin: input vref at 80% */
14995 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14996 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14997 /* Line In pin: input */
14998 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14999 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15000 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15001 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15002 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15003 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15004 /* CD pin widget for input */
15005 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15010 static struct hda_verb alc861vd_eapd_verbs[] = {
15011 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15015 static struct hda_verb alc660vd_eapd_verbs[] = {
15016 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15017 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15021 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15024 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15025 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15026 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15030 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15032 unsigned int present;
15033 unsigned char bits;
15035 present = snd_hda_codec_read(codec, 0x18, 0,
15036 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15037 bits = present ? HDA_AMP_MUTE : 0;
15038 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15039 HDA_AMP_MUTE, bits);
15042 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15044 struct alc_spec *spec = codec->spec;
15046 spec->autocfg.hp_pins[0] = 0x1b;
15047 spec->autocfg.speaker_pins[0] = 0x14;
15048 alc_automute_amp(codec);
15049 alc861vd_lenovo_mic_automute(codec);
15052 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15055 switch (res >> 26) {
15056 case ALC880_MIC_EVENT:
15057 alc861vd_lenovo_mic_automute(codec);
15060 alc_automute_amp_unsol_event(codec, res);
15065 static struct hda_verb alc861vd_dallas_verbs[] = {
15066 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15067 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15068 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15069 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15071 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15072 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15073 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15074 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15075 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15076 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15077 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15078 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15080 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15081 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15082 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15083 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15084 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15085 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15086 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15087 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15089 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15090 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15091 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15092 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15093 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15094 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15095 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15096 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15099 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15100 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15103 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15104 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15105 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15110 /* toggle speaker-output according to the hp-jack state */
15111 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
15113 struct alc_spec *spec = codec->spec;
15115 spec->autocfg.hp_pins[0] = 0x15;
15116 spec->autocfg.speaker_pins[0] = 0x14;
15117 alc_automute_amp(codec);
15120 #ifdef CONFIG_SND_HDA_POWER_SAVE
15121 #define alc861vd_loopbacks alc880_loopbacks
15124 /* pcm configuration: identical with ALC880 */
15125 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15126 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15127 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15128 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15131 * configuration and preset
15133 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15134 [ALC660VD_3ST] = "3stack-660",
15135 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15136 [ALC660VD_ASUS_V1S] = "asus-v1s",
15137 [ALC861VD_3ST] = "3stack",
15138 [ALC861VD_3ST_DIG] = "3stack-digout",
15139 [ALC861VD_6ST_DIG] = "6stack-digout",
15140 [ALC861VD_LENOVO] = "lenovo",
15141 [ALC861VD_DALLAS] = "dallas",
15142 [ALC861VD_HP] = "hp",
15143 [ALC861VD_AUTO] = "auto",
15146 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15147 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15148 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15149 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15150 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
15151 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15152 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15153 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15154 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15155 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15156 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15157 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15158 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15159 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15160 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15161 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15165 static struct alc_config_preset alc861vd_presets[] = {
15167 .mixers = { alc861vd_3st_mixer },
15168 .init_verbs = { alc861vd_volume_init_verbs,
15169 alc861vd_3stack_init_verbs },
15170 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15171 .dac_nids = alc660vd_dac_nids,
15172 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15173 .channel_mode = alc861vd_3stack_2ch_modes,
15174 .input_mux = &alc861vd_capture_source,
15176 [ALC660VD_3ST_DIG] = {
15177 .mixers = { alc861vd_3st_mixer },
15178 .init_verbs = { alc861vd_volume_init_verbs,
15179 alc861vd_3stack_init_verbs },
15180 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15181 .dac_nids = alc660vd_dac_nids,
15182 .dig_out_nid = ALC861VD_DIGOUT_NID,
15183 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15184 .channel_mode = alc861vd_3stack_2ch_modes,
15185 .input_mux = &alc861vd_capture_source,
15188 .mixers = { alc861vd_3st_mixer },
15189 .init_verbs = { alc861vd_volume_init_verbs,
15190 alc861vd_3stack_init_verbs },
15191 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15192 .dac_nids = alc861vd_dac_nids,
15193 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15194 .channel_mode = alc861vd_3stack_2ch_modes,
15195 .input_mux = &alc861vd_capture_source,
15197 [ALC861VD_3ST_DIG] = {
15198 .mixers = { alc861vd_3st_mixer },
15199 .init_verbs = { alc861vd_volume_init_verbs,
15200 alc861vd_3stack_init_verbs },
15201 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15202 .dac_nids = alc861vd_dac_nids,
15203 .dig_out_nid = ALC861VD_DIGOUT_NID,
15204 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15205 .channel_mode = alc861vd_3stack_2ch_modes,
15206 .input_mux = &alc861vd_capture_source,
15208 [ALC861VD_6ST_DIG] = {
15209 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15210 .init_verbs = { alc861vd_volume_init_verbs,
15211 alc861vd_6stack_init_verbs },
15212 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15213 .dac_nids = alc861vd_dac_nids,
15214 .dig_out_nid = ALC861VD_DIGOUT_NID,
15215 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15216 .channel_mode = alc861vd_6stack_modes,
15217 .input_mux = &alc861vd_capture_source,
15219 [ALC861VD_LENOVO] = {
15220 .mixers = { alc861vd_lenovo_mixer },
15221 .init_verbs = { alc861vd_volume_init_verbs,
15222 alc861vd_3stack_init_verbs,
15223 alc861vd_eapd_verbs,
15224 alc861vd_lenovo_unsol_verbs },
15225 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15226 .dac_nids = alc660vd_dac_nids,
15227 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15228 .channel_mode = alc861vd_3stack_2ch_modes,
15229 .input_mux = &alc861vd_capture_source,
15230 .unsol_event = alc861vd_lenovo_unsol_event,
15231 .init_hook = alc861vd_lenovo_init_hook,
15233 [ALC861VD_DALLAS] = {
15234 .mixers = { alc861vd_dallas_mixer },
15235 .init_verbs = { alc861vd_dallas_verbs },
15236 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15237 .dac_nids = alc861vd_dac_nids,
15238 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15239 .channel_mode = alc861vd_3stack_2ch_modes,
15240 .input_mux = &alc861vd_dallas_capture_source,
15241 .unsol_event = alc_automute_amp_unsol_event,
15242 .init_hook = alc861vd_dallas_init_hook,
15245 .mixers = { alc861vd_hp_mixer },
15246 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15247 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15248 .dac_nids = alc861vd_dac_nids,
15249 .dig_out_nid = ALC861VD_DIGOUT_NID,
15250 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15251 .channel_mode = alc861vd_3stack_2ch_modes,
15252 .input_mux = &alc861vd_hp_capture_source,
15253 .unsol_event = alc_automute_amp_unsol_event,
15254 .init_hook = alc861vd_dallas_init_hook,
15256 [ALC660VD_ASUS_V1S] = {
15257 .mixers = { alc861vd_lenovo_mixer },
15258 .init_verbs = { alc861vd_volume_init_verbs,
15259 alc861vd_3stack_init_verbs,
15260 alc861vd_eapd_verbs,
15261 alc861vd_lenovo_unsol_verbs },
15262 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15263 .dac_nids = alc660vd_dac_nids,
15264 .dig_out_nid = ALC861VD_DIGOUT_NID,
15265 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15266 .channel_mode = alc861vd_3stack_2ch_modes,
15267 .input_mux = &alc861vd_capture_source,
15268 .unsol_event = alc861vd_lenovo_unsol_event,
15269 .init_hook = alc861vd_lenovo_init_hook,
15274 * BIOS auto configuration
15276 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15277 hda_nid_t nid, int pin_type, int dac_idx)
15279 alc_set_pin_output(codec, nid, pin_type);
15282 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15284 struct alc_spec *spec = codec->spec;
15287 for (i = 0; i <= HDA_SIDE; i++) {
15288 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15289 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15291 alc861vd_auto_set_output_and_unmute(codec, nid,
15297 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15299 struct alc_spec *spec = codec->spec;
15302 pin = spec->autocfg.hp_pins[0];
15303 if (pin) /* connect to front and use dac 0 */
15304 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15305 pin = spec->autocfg.speaker_pins[0];
15307 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15310 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15311 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15313 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15315 struct alc_spec *spec = codec->spec;
15318 for (i = 0; i < AUTO_PIN_LAST; i++) {
15319 hda_nid_t nid = spec->autocfg.input_pins[i];
15320 if (alc861vd_is_input_pin(nid)) {
15321 alc_set_input_pin(codec, nid, i);
15322 if (nid != ALC861VD_PIN_CD_NID &&
15323 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15324 snd_hda_codec_write(codec, nid, 0,
15325 AC_VERB_SET_AMP_GAIN_MUTE,
15331 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15333 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15334 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15336 /* add playback controls from the parsed DAC table */
15337 /* Based on ALC880 version. But ALC861VD has separate,
15338 * different NIDs for mute/unmute switch and volume control */
15339 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15340 const struct auto_pin_cfg *cfg)
15343 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15344 hda_nid_t nid_v, nid_s;
15347 for (i = 0; i < cfg->line_outs; i++) {
15348 if (!spec->multiout.dac_nids[i])
15350 nid_v = alc861vd_idx_to_mixer_vol(
15352 spec->multiout.dac_nids[i]));
15353 nid_s = alc861vd_idx_to_mixer_switch(
15355 spec->multiout.dac_nids[i]));
15359 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15360 "Center Playback Volume",
15361 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15365 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15366 "LFE Playback Volume",
15367 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15371 err = add_control(spec, ALC_CTL_BIND_MUTE,
15372 "Center Playback Switch",
15373 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15377 err = add_control(spec, ALC_CTL_BIND_MUTE,
15378 "LFE Playback Switch",
15379 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15384 sprintf(name, "%s Playback Volume", chname[i]);
15385 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15386 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15390 sprintf(name, "%s Playback Switch", chname[i]);
15391 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15392 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15401 /* add playback controls for speaker and HP outputs */
15402 /* Based on ALC880 version. But ALC861VD has separate,
15403 * different NIDs for mute/unmute switch and volume control */
15404 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15405 hda_nid_t pin, const char *pfx)
15407 hda_nid_t nid_v, nid_s;
15414 if (alc880_is_fixed_pin(pin)) {
15415 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15416 /* specify the DAC as the extra output */
15417 if (!spec->multiout.hp_nid)
15418 spec->multiout.hp_nid = nid_v;
15420 spec->multiout.extra_out_nid[0] = nid_v;
15421 /* control HP volume/switch on the output mixer amp */
15422 nid_v = alc861vd_idx_to_mixer_vol(
15423 alc880_fixed_pin_idx(pin));
15424 nid_s = alc861vd_idx_to_mixer_switch(
15425 alc880_fixed_pin_idx(pin));
15427 sprintf(name, "%s Playback Volume", pfx);
15428 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15429 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15432 sprintf(name, "%s Playback Switch", pfx);
15433 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15434 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15437 } else if (alc880_is_multi_pin(pin)) {
15438 /* set manual connection */
15439 /* we have only a switch on HP-out PIN */
15440 sprintf(name, "%s Playback Switch", pfx);
15441 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15442 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15449 /* parse the BIOS configuration and set up the alc_spec
15450 * return 1 if successful, 0 if the proper config is not found,
15451 * or a negative error code
15452 * Based on ALC880 version - had to change it to override
15453 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15454 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15456 struct alc_spec *spec = codec->spec;
15458 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15460 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15464 if (!spec->autocfg.line_outs)
15465 return 0; /* can't find valid BIOS pin config */
15467 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15470 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15473 err = alc861vd_auto_create_extra_out(spec,
15474 spec->autocfg.speaker_pins[0],
15478 err = alc861vd_auto_create_extra_out(spec,
15479 spec->autocfg.hp_pins[0],
15483 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15487 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15489 if (spec->autocfg.dig_outs)
15490 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15492 if (spec->kctls.list)
15493 add_mixer(spec, spec->kctls.list);
15495 add_verb(spec, alc861vd_volume_init_verbs);
15497 spec->num_mux_defs = 1;
15498 spec->input_mux = &spec->private_imux[0];
15500 err = alc_auto_add_mic_boost(codec);
15504 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15509 /* additional initialization for auto-configuration model */
15510 static void alc861vd_auto_init(struct hda_codec *codec)
15512 struct alc_spec *spec = codec->spec;
15513 alc861vd_auto_init_multi_out(codec);
15514 alc861vd_auto_init_hp_out(codec);
15515 alc861vd_auto_init_analog_input(codec);
15516 alc861vd_auto_init_input_src(codec);
15517 if (spec->unsol_event)
15518 alc_inithook(codec);
15521 static int patch_alc861vd(struct hda_codec *codec)
15523 struct alc_spec *spec;
15524 int err, board_config;
15526 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15530 codec->spec = spec;
15532 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15536 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15537 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15539 board_config = ALC861VD_AUTO;
15542 if (board_config == ALC861VD_AUTO) {
15543 /* automatic parse from the BIOS config */
15544 err = alc861vd_parse_auto_config(codec);
15550 "hda_codec: Cannot set up configuration "
15551 "from BIOS. Using base mode...\n");
15552 board_config = ALC861VD_3ST;
15556 err = snd_hda_attach_beep_device(codec, 0x23);
15562 if (board_config != ALC861VD_AUTO)
15563 setup_preset(spec, &alc861vd_presets[board_config]);
15565 if (codec->vendor_id == 0x10ec0660) {
15566 /* always turn on EAPD */
15567 add_verb(spec, alc660vd_eapd_verbs);
15570 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15571 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15573 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15574 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15576 if (!spec->adc_nids) {
15577 spec->adc_nids = alc861vd_adc_nids;
15578 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15580 if (!spec->capsrc_nids)
15581 spec->capsrc_nids = alc861vd_capsrc_nids;
15583 set_capture_mixer(codec);
15584 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15586 spec->vmaster_nid = 0x02;
15588 codec->patch_ops = alc_patch_ops;
15590 if (board_config == ALC861VD_AUTO)
15591 spec->init_hook = alc861vd_auto_init;
15592 #ifdef CONFIG_SND_HDA_POWER_SAVE
15593 if (!spec->loopback.amplist)
15594 spec->loopback.amplist = alc861vd_loopbacks;
15596 codec->proc_widget_hook = print_realtek_coef;
15604 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15605 * configuration. Each pin widget can choose any input DACs and a mixer.
15606 * Each ADC is connected from a mixer of all inputs. This makes possible
15607 * 6-channel independent captures.
15609 * In addition, an independent DAC for the multi-playback (not used in this
15612 #define ALC662_DIGOUT_NID 0x06
15613 #define ALC662_DIGIN_NID 0x0a
15615 static hda_nid_t alc662_dac_nids[4] = {
15616 /* front, rear, clfe, rear_surr */
15620 static hda_nid_t alc272_dac_nids[2] = {
15624 static hda_nid_t alc662_adc_nids[2] = {
15629 static hda_nid_t alc272_adc_nids[1] = {
15634 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15635 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15639 /* FIXME: should be a matrix-type input source selection */
15640 static struct hda_input_mux alc662_capture_source = {
15644 { "Front Mic", 0x1 },
15650 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15658 static struct hda_input_mux alc662_eeepc_capture_source = {
15666 static struct hda_input_mux alc663_capture_source = {
15670 { "Front Mic", 0x1 },
15675 static struct hda_input_mux alc663_m51va_capture_source = {
15678 { "Ext-Mic", 0x0 },
15683 #if 1 /* set to 0 for testing other input sources below */
15684 static struct hda_input_mux alc272_nc10_capture_source = {
15687 { "Autoselect Mic", 0x0 },
15688 { "Internal Mic", 0x1 },
15692 static struct hda_input_mux alc272_nc10_capture_source = {
15695 { "Autoselect Mic", 0x0 },
15696 { "Internal Mic", 0x1 },
15697 { "In-0x02", 0x2 },
15698 { "In-0x03", 0x3 },
15699 { "In-0x04", 0x4 },
15700 { "In-0x05", 0x5 },
15701 { "In-0x06", 0x6 },
15702 { "In-0x07", 0x7 },
15703 { "In-0x08", 0x8 },
15704 { "In-0x09", 0x9 },
15705 { "In-0x0a", 0x0a },
15706 { "In-0x0b", 0x0b },
15707 { "In-0x0c", 0x0c },
15708 { "In-0x0d", 0x0d },
15709 { "In-0x0e", 0x0e },
15710 { "In-0x0f", 0x0f },
15718 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15725 static struct hda_verb alc662_3ST_ch2_init[] = {
15726 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15727 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15728 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15729 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15736 static struct hda_verb alc662_3ST_ch6_init[] = {
15737 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15738 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15739 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15740 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15741 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15742 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15746 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15747 { 2, alc662_3ST_ch2_init },
15748 { 6, alc662_3ST_ch6_init },
15754 static struct hda_verb alc662_sixstack_ch6_init[] = {
15755 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15756 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15757 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15764 static struct hda_verb alc662_sixstack_ch8_init[] = {
15765 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15766 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15767 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15771 static struct hda_channel_mode alc662_5stack_modes[2] = {
15772 { 2, alc662_sixstack_ch6_init },
15773 { 6, alc662_sixstack_ch8_init },
15776 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15777 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15780 static struct snd_kcontrol_new alc662_base_mixer[] = {
15781 /* output mixer control */
15782 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15783 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15784 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15785 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15786 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15787 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15788 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15789 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15790 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15792 /*Input mixer control */
15793 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15794 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15795 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15796 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15797 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15798 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15799 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15800 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15804 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15805 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15806 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15807 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15808 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15809 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15810 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15811 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15812 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15813 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15814 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15815 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15819 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15820 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15821 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15822 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15823 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15824 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15825 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15826 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15827 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15828 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15829 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15830 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15831 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15832 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15835 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15836 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15840 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15841 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15842 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15843 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15844 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15845 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15846 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15847 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15849 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15853 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15854 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15855 ALC262_HIPPO_MASTER_SWITCH,
15857 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15858 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15859 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15861 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15862 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15863 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15867 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15868 ALC262_HIPPO_MASTER_SWITCH,
15869 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15870 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15871 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15872 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15873 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15874 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15875 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15876 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15877 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15881 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15882 .ops = &snd_hda_bind_vol,
15884 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15885 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15890 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15891 .ops = &snd_hda_bind_sw,
15893 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15894 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15899 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15900 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15901 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15907 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15908 .ops = &snd_hda_bind_sw,
15910 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15911 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15912 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15917 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15918 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15919 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15922 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15923 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15928 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15929 .ops = &snd_hda_bind_sw,
15931 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15932 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15933 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15938 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15939 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15940 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15943 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15944 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15948 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15949 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15950 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15951 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15952 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15953 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15954 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15955 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15959 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15960 .ops = &snd_hda_bind_vol,
15962 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15963 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15968 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15969 .ops = &snd_hda_bind_sw,
15971 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15972 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15977 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15978 HDA_BIND_VOL("Master Playback Volume",
15979 &alc663_asus_two_bind_master_vol),
15980 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15981 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15982 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15988 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15989 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15990 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15991 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15992 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15998 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15999 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16000 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16001 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16002 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16003 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16005 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16006 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16007 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16008 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16012 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16013 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16014 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16015 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16018 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16019 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16020 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16021 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16022 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16026 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16028 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16029 .name = "Channel Mode",
16030 .info = alc_ch_mode_info,
16031 .get = alc_ch_mode_get,
16032 .put = alc_ch_mode_put,
16037 static struct hda_verb alc662_init_verbs[] = {
16038 /* ADC: mute amp left and right */
16039 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16040 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16041 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16045 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16046 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16047 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16049 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16050 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16051 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16052 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16053 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16054 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16056 /* Front Pin: output 0 (0x0c) */
16057 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16058 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16060 /* Rear Pin: output 1 (0x0d) */
16061 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16062 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16064 /* CLFE Pin: output 2 (0x0e) */
16065 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16066 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16068 /* Mic (rear) pin: input vref at 80% */
16069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16070 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16071 /* Front Mic pin: input vref at 80% */
16072 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16073 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16074 /* Line In pin: input */
16075 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16076 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16077 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16078 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16079 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16080 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16081 /* CD pin widget for input */
16082 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16084 /* FIXME: use matrix-type input source selection */
16085 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16088 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16090 /* always trun on EAPD */
16091 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16092 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16097 static struct hda_verb alc662_sue_init_verbs[] = {
16098 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16099 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16103 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16104 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16105 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16109 /* Set Unsolicited Event*/
16110 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16111 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16112 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16117 * generic initialization of ADC, input mixers and output mixers
16119 static struct hda_verb alc662_auto_init_verbs[] = {
16121 * Unmute ADC and set the default input to mic-in
16123 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16124 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16126 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16128 * Note: PASD motherboards uses the Line In 2 as the input for front
16129 * panel mic (mic 2)
16131 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16139 * Set up output mixers (0x0c - 0x0f)
16141 /* set vol=0 to output mixers */
16142 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16143 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16144 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16146 /* set up input amps for analog loopback */
16147 /* Amp Indices: DAC = 0, mixer = 1 */
16148 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16150 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16151 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16152 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16153 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16156 /* FIXME: use matrix-type input source selection */
16157 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16159 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16160 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16164 /* additional verbs for ALC663 */
16165 static struct hda_verb alc663_auto_init_verbs[] = {
16166 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16167 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16171 static struct hda_verb alc663_m51va_init_verbs[] = {
16172 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16173 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16174 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16175 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16176 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16179 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16180 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16184 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16185 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16186 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16187 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16188 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16189 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16190 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16191 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16195 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16196 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16197 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16198 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16199 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16202 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16203 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16207 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16208 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16209 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16210 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16211 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16212 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16213 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16214 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16218 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16219 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16220 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16221 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16222 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16223 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16224 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16225 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16226 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16227 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16228 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16229 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16230 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16234 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16235 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16236 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16237 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16238 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16239 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16240 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16241 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16242 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16243 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16244 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16245 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16246 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16250 static struct hda_verb alc663_g71v_init_verbs[] = {
16251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16252 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16253 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16255 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16256 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16257 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16259 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16260 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16261 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16265 static struct hda_verb alc663_g50v_init_verbs[] = {
16266 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16267 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16268 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16270 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16271 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16275 static struct hda_verb alc662_ecs_init_verbs[] = {
16276 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16277 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16278 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16279 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16283 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16284 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16285 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16286 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16287 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16288 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16289 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16290 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16291 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16292 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16293 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16294 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16298 static struct hda_verb alc272_dell_init_verbs[] = {
16299 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16300 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16301 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16302 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16303 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16304 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16305 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16308 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16309 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16313 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16314 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16315 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16319 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16320 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16321 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16325 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16327 unsigned int present;
16328 unsigned char bits;
16330 present = snd_hda_codec_read(codec, 0x14, 0,
16331 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16332 bits = present ? HDA_AMP_MUTE : 0;
16333 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16334 HDA_AMP_MUTE, bits);
16337 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16339 unsigned int present;
16340 unsigned char bits;
16342 present = snd_hda_codec_read(codec, 0x1b, 0,
16343 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16344 bits = present ? HDA_AMP_MUTE : 0;
16345 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16346 HDA_AMP_MUTE, bits);
16347 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16348 HDA_AMP_MUTE, bits);
16351 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16354 if ((res >> 26) == ALC880_HP_EVENT)
16355 alc662_lenovo_101e_all_automute(codec);
16356 if ((res >> 26) == ALC880_FRONT_EVENT)
16357 alc662_lenovo_101e_ispeaker_automute(codec);
16360 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
16362 unsigned int present;
16364 present = snd_hda_codec_read(codec, 0x18, 0,
16365 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16366 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16367 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16368 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16369 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16370 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16371 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16372 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16373 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16376 /* unsolicited event for HP jack sensing */
16377 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16380 if ((res >> 26) == ALC880_MIC_EVENT)
16381 alc662_eeepc_mic_automute(codec);
16383 alc262_hippo_unsol_event(codec, res);
16386 static void alc662_eeepc_inithook(struct hda_codec *codec)
16388 alc262_hippo1_init_hook(codec);
16389 alc662_eeepc_mic_automute(codec);
16392 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16394 struct alc_spec *spec = codec->spec;
16396 spec->autocfg.hp_pins[0] = 0x14;
16397 spec->autocfg.speaker_pins[0] = 0x1b;
16398 alc262_hippo_master_update(codec);
16401 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16403 unsigned int present;
16404 unsigned char bits;
16406 present = snd_hda_codec_read(codec, 0x21, 0,
16407 AC_VERB_GET_PIN_SENSE, 0)
16408 & AC_PINSENSE_PRESENCE;
16409 bits = present ? HDA_AMP_MUTE : 0;
16410 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16411 AMP_IN_MUTE(0), bits);
16412 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16413 AMP_IN_MUTE(0), bits);
16416 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16418 unsigned int present;
16419 unsigned char bits;
16421 present = snd_hda_codec_read(codec, 0x21, 0,
16422 AC_VERB_GET_PIN_SENSE, 0)
16423 & AC_PINSENSE_PRESENCE;
16424 bits = present ? HDA_AMP_MUTE : 0;
16425 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16426 AMP_IN_MUTE(0), bits);
16427 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16428 AMP_IN_MUTE(0), bits);
16429 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16430 AMP_IN_MUTE(0), bits);
16431 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16432 AMP_IN_MUTE(0), bits);
16435 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16437 unsigned int present;
16438 unsigned char bits;
16440 present = snd_hda_codec_read(codec, 0x15, 0,
16441 AC_VERB_GET_PIN_SENSE, 0)
16442 & AC_PINSENSE_PRESENCE;
16443 bits = present ? HDA_AMP_MUTE : 0;
16444 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16445 AMP_IN_MUTE(0), bits);
16446 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16447 AMP_IN_MUTE(0), bits);
16448 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16449 AMP_IN_MUTE(0), bits);
16450 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16451 AMP_IN_MUTE(0), bits);
16454 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16456 unsigned int present;
16457 unsigned char bits;
16459 present = snd_hda_codec_read(codec, 0x1b, 0,
16460 AC_VERB_GET_PIN_SENSE, 0)
16461 & AC_PINSENSE_PRESENCE;
16462 bits = present ? 0 : PIN_OUT;
16463 snd_hda_codec_write(codec, 0x14, 0,
16464 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16467 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16469 unsigned int present1, present2;
16471 present1 = snd_hda_codec_read(codec, 0x21, 0,
16472 AC_VERB_GET_PIN_SENSE, 0)
16473 & AC_PINSENSE_PRESENCE;
16474 present2 = snd_hda_codec_read(codec, 0x15, 0,
16475 AC_VERB_GET_PIN_SENSE, 0)
16476 & AC_PINSENSE_PRESENCE;
16478 if (present1 || present2) {
16479 snd_hda_codec_write_cache(codec, 0x14, 0,
16480 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16482 snd_hda_codec_write_cache(codec, 0x14, 0,
16483 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16487 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16489 unsigned int present1, present2;
16491 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16492 AC_VERB_GET_PIN_SENSE, 0)
16493 & AC_PINSENSE_PRESENCE;
16494 present2 = snd_hda_codec_read(codec, 0x15, 0,
16495 AC_VERB_GET_PIN_SENSE, 0)
16496 & AC_PINSENSE_PRESENCE;
16498 if (present1 || present2) {
16499 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16500 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16501 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16502 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16504 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16505 AMP_IN_MUTE(0), 0);
16506 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16507 AMP_IN_MUTE(0), 0);
16511 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16513 unsigned int present;
16515 present = snd_hda_codec_read(codec, 0x18, 0,
16516 AC_VERB_GET_PIN_SENSE, 0)
16517 & AC_PINSENSE_PRESENCE;
16518 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16519 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16520 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16521 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16522 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16523 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16524 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16525 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16528 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16531 switch (res >> 26) {
16532 case ALC880_HP_EVENT:
16533 alc663_m51va_speaker_automute(codec);
16535 case ALC880_MIC_EVENT:
16536 alc663_m51va_mic_automute(codec);
16541 static void alc663_m51va_inithook(struct hda_codec *codec)
16543 alc663_m51va_speaker_automute(codec);
16544 alc663_m51va_mic_automute(codec);
16547 /* ***************** Mode1 ******************************/
16548 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16551 switch (res >> 26) {
16552 case ALC880_HP_EVENT:
16553 alc663_m51va_speaker_automute(codec);
16555 case ALC880_MIC_EVENT:
16556 alc662_eeepc_mic_automute(codec);
16561 static void alc663_mode1_inithook(struct hda_codec *codec)
16563 alc663_m51va_speaker_automute(codec);
16564 alc662_eeepc_mic_automute(codec);
16566 /* ***************** Mode2 ******************************/
16567 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16570 switch (res >> 26) {
16571 case ALC880_HP_EVENT:
16572 alc662_f5z_speaker_automute(codec);
16574 case ALC880_MIC_EVENT:
16575 alc662_eeepc_mic_automute(codec);
16580 static void alc662_mode2_inithook(struct hda_codec *codec)
16582 alc662_f5z_speaker_automute(codec);
16583 alc662_eeepc_mic_automute(codec);
16585 /* ***************** Mode3 ******************************/
16586 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16589 switch (res >> 26) {
16590 case ALC880_HP_EVENT:
16591 alc663_two_hp_m1_speaker_automute(codec);
16593 case ALC880_MIC_EVENT:
16594 alc662_eeepc_mic_automute(codec);
16599 static void alc663_mode3_inithook(struct hda_codec *codec)
16601 alc663_two_hp_m1_speaker_automute(codec);
16602 alc662_eeepc_mic_automute(codec);
16604 /* ***************** Mode4 ******************************/
16605 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16608 switch (res >> 26) {
16609 case ALC880_HP_EVENT:
16610 alc663_21jd_two_speaker_automute(codec);
16612 case ALC880_MIC_EVENT:
16613 alc662_eeepc_mic_automute(codec);
16618 static void alc663_mode4_inithook(struct hda_codec *codec)
16620 alc663_21jd_two_speaker_automute(codec);
16621 alc662_eeepc_mic_automute(codec);
16623 /* ***************** Mode5 ******************************/
16624 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16627 switch (res >> 26) {
16628 case ALC880_HP_EVENT:
16629 alc663_15jd_two_speaker_automute(codec);
16631 case ALC880_MIC_EVENT:
16632 alc662_eeepc_mic_automute(codec);
16637 static void alc663_mode5_inithook(struct hda_codec *codec)
16639 alc663_15jd_two_speaker_automute(codec);
16640 alc662_eeepc_mic_automute(codec);
16642 /* ***************** Mode6 ******************************/
16643 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16646 switch (res >> 26) {
16647 case ALC880_HP_EVENT:
16648 alc663_two_hp_m2_speaker_automute(codec);
16650 case ALC880_MIC_EVENT:
16651 alc662_eeepc_mic_automute(codec);
16656 static void alc663_mode6_inithook(struct hda_codec *codec)
16658 alc663_two_hp_m2_speaker_automute(codec);
16659 alc662_eeepc_mic_automute(codec);
16662 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16664 unsigned int present;
16665 unsigned char bits;
16667 present = snd_hda_codec_read(codec, 0x21, 0,
16668 AC_VERB_GET_PIN_SENSE, 0)
16669 & AC_PINSENSE_PRESENCE;
16670 bits = present ? HDA_AMP_MUTE : 0;
16671 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16672 HDA_AMP_MUTE, bits);
16673 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16674 HDA_AMP_MUTE, bits);
16677 static void alc663_g71v_front_automute(struct hda_codec *codec)
16679 unsigned int present;
16680 unsigned char bits;
16682 present = snd_hda_codec_read(codec, 0x15, 0,
16683 AC_VERB_GET_PIN_SENSE, 0)
16684 & AC_PINSENSE_PRESENCE;
16685 bits = present ? HDA_AMP_MUTE : 0;
16686 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16687 HDA_AMP_MUTE, bits);
16690 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16693 switch (res >> 26) {
16694 case ALC880_HP_EVENT:
16695 alc663_g71v_hp_automute(codec);
16697 case ALC880_FRONT_EVENT:
16698 alc663_g71v_front_automute(codec);
16700 case ALC880_MIC_EVENT:
16701 alc662_eeepc_mic_automute(codec);
16706 static void alc663_g71v_inithook(struct hda_codec *codec)
16708 alc663_g71v_front_automute(codec);
16709 alc663_g71v_hp_automute(codec);
16710 alc662_eeepc_mic_automute(codec);
16713 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16716 switch (res >> 26) {
16717 case ALC880_HP_EVENT:
16718 alc663_m51va_speaker_automute(codec);
16720 case ALC880_MIC_EVENT:
16721 alc662_eeepc_mic_automute(codec);
16726 static void alc663_g50v_inithook(struct hda_codec *codec)
16728 alc663_m51va_speaker_automute(codec);
16729 alc662_eeepc_mic_automute(codec);
16732 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16733 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16734 ALC262_HIPPO_MASTER_SWITCH,
16736 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16737 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16738 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16740 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16741 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16742 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16746 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16747 /* Master Playback automatically created from Speaker and Headphone */
16748 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16749 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16750 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16751 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16753 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16754 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16755 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16757 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16758 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16759 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16763 #ifdef CONFIG_SND_HDA_POWER_SAVE
16764 #define alc662_loopbacks alc880_loopbacks
16768 /* pcm configuration: identical with ALC880 */
16769 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16770 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16771 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16772 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16775 * configuration and preset
16777 static const char *alc662_models[ALC662_MODEL_LAST] = {
16778 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16779 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16780 [ALC662_3ST_6ch] = "3stack-6ch",
16781 [ALC662_5ST_DIG] = "6stack-dig",
16782 [ALC662_LENOVO_101E] = "lenovo-101e",
16783 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16784 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16785 [ALC662_ECS] = "ecs",
16786 [ALC663_ASUS_M51VA] = "m51va",
16787 [ALC663_ASUS_G71V] = "g71v",
16788 [ALC663_ASUS_H13] = "h13",
16789 [ALC663_ASUS_G50V] = "g50v",
16790 [ALC663_ASUS_MODE1] = "asus-mode1",
16791 [ALC662_ASUS_MODE2] = "asus-mode2",
16792 [ALC663_ASUS_MODE3] = "asus-mode3",
16793 [ALC663_ASUS_MODE4] = "asus-mode4",
16794 [ALC663_ASUS_MODE5] = "asus-mode5",
16795 [ALC663_ASUS_MODE6] = "asus-mode6",
16796 [ALC272_DELL] = "dell",
16797 [ALC272_DELL_ZM1] = "dell-zm1",
16798 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16799 [ALC662_AUTO] = "auto",
16802 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16803 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16804 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16805 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16806 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16807 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16808 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16809 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16810 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16811 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16812 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16813 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16814 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16815 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16816 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16817 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16818 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16819 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16820 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16821 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16822 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16823 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16824 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16825 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16826 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16827 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16828 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16829 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16830 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16831 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16832 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16833 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16834 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16835 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16836 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16837 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16838 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16839 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16840 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16841 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16842 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16843 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16844 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16845 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16846 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16847 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16848 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16849 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16850 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16851 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16852 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16853 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16854 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16855 ALC662_3ST_6ch_DIG),
16856 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16857 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16858 ALC662_3ST_6ch_DIG),
16859 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16860 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16861 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16862 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16863 ALC662_3ST_6ch_DIG),
16864 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16869 static struct alc_config_preset alc662_presets[] = {
16870 [ALC662_3ST_2ch_DIG] = {
16871 .mixers = { alc662_3ST_2ch_mixer },
16872 .init_verbs = { alc662_init_verbs },
16873 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16874 .dac_nids = alc662_dac_nids,
16875 .dig_out_nid = ALC662_DIGOUT_NID,
16876 .dig_in_nid = ALC662_DIGIN_NID,
16877 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16878 .channel_mode = alc662_3ST_2ch_modes,
16879 .input_mux = &alc662_capture_source,
16881 [ALC662_3ST_6ch_DIG] = {
16882 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16883 .init_verbs = { alc662_init_verbs },
16884 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16885 .dac_nids = alc662_dac_nids,
16886 .dig_out_nid = ALC662_DIGOUT_NID,
16887 .dig_in_nid = ALC662_DIGIN_NID,
16888 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16889 .channel_mode = alc662_3ST_6ch_modes,
16891 .input_mux = &alc662_capture_source,
16893 [ALC662_3ST_6ch] = {
16894 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16895 .init_verbs = { alc662_init_verbs },
16896 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16897 .dac_nids = alc662_dac_nids,
16898 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16899 .channel_mode = alc662_3ST_6ch_modes,
16901 .input_mux = &alc662_capture_source,
16903 [ALC662_5ST_DIG] = {
16904 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16905 .init_verbs = { alc662_init_verbs },
16906 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16907 .dac_nids = alc662_dac_nids,
16908 .dig_out_nid = ALC662_DIGOUT_NID,
16909 .dig_in_nid = ALC662_DIGIN_NID,
16910 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16911 .channel_mode = alc662_5stack_modes,
16912 .input_mux = &alc662_capture_source,
16914 [ALC662_LENOVO_101E] = {
16915 .mixers = { alc662_lenovo_101e_mixer },
16916 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16917 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16918 .dac_nids = alc662_dac_nids,
16919 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16920 .channel_mode = alc662_3ST_2ch_modes,
16921 .input_mux = &alc662_lenovo_101e_capture_source,
16922 .unsol_event = alc662_lenovo_101e_unsol_event,
16923 .init_hook = alc662_lenovo_101e_all_automute,
16925 [ALC662_ASUS_EEEPC_P701] = {
16926 .mixers = { alc662_eeepc_p701_mixer },
16927 .init_verbs = { alc662_init_verbs,
16928 alc662_eeepc_sue_init_verbs },
16929 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16930 .dac_nids = alc662_dac_nids,
16931 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16932 .channel_mode = alc662_3ST_2ch_modes,
16933 .input_mux = &alc662_eeepc_capture_source,
16934 .unsol_event = alc662_eeepc_unsol_event,
16935 .init_hook = alc662_eeepc_inithook,
16937 [ALC662_ASUS_EEEPC_EP20] = {
16938 .mixers = { alc662_eeepc_ep20_mixer,
16939 alc662_chmode_mixer },
16940 .init_verbs = { alc662_init_verbs,
16941 alc662_eeepc_ep20_sue_init_verbs },
16942 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16943 .dac_nids = alc662_dac_nids,
16944 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16945 .channel_mode = alc662_3ST_6ch_modes,
16946 .input_mux = &alc662_lenovo_101e_capture_source,
16947 .unsol_event = alc662_eeepc_unsol_event,
16948 .init_hook = alc662_eeepc_ep20_inithook,
16951 .mixers = { alc662_ecs_mixer },
16952 .init_verbs = { alc662_init_verbs,
16953 alc662_ecs_init_verbs },
16954 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16955 .dac_nids = alc662_dac_nids,
16956 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16957 .channel_mode = alc662_3ST_2ch_modes,
16958 .input_mux = &alc662_eeepc_capture_source,
16959 .unsol_event = alc662_eeepc_unsol_event,
16960 .init_hook = alc662_eeepc_inithook,
16962 [ALC663_ASUS_M51VA] = {
16963 .mixers = { alc663_m51va_mixer },
16964 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16965 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16966 .dac_nids = alc662_dac_nids,
16967 .dig_out_nid = ALC662_DIGOUT_NID,
16968 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16969 .channel_mode = alc662_3ST_2ch_modes,
16970 .input_mux = &alc663_m51va_capture_source,
16971 .unsol_event = alc663_m51va_unsol_event,
16972 .init_hook = alc663_m51va_inithook,
16974 [ALC663_ASUS_G71V] = {
16975 .mixers = { alc663_g71v_mixer },
16976 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16977 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16978 .dac_nids = alc662_dac_nids,
16979 .dig_out_nid = ALC662_DIGOUT_NID,
16980 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16981 .channel_mode = alc662_3ST_2ch_modes,
16982 .input_mux = &alc662_eeepc_capture_source,
16983 .unsol_event = alc663_g71v_unsol_event,
16984 .init_hook = alc663_g71v_inithook,
16986 [ALC663_ASUS_H13] = {
16987 .mixers = { alc663_m51va_mixer },
16988 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16989 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16990 .dac_nids = alc662_dac_nids,
16991 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16992 .channel_mode = alc662_3ST_2ch_modes,
16993 .input_mux = &alc663_m51va_capture_source,
16994 .unsol_event = alc663_m51va_unsol_event,
16995 .init_hook = alc663_m51va_inithook,
16997 [ALC663_ASUS_G50V] = {
16998 .mixers = { alc663_g50v_mixer },
16999 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17000 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17001 .dac_nids = alc662_dac_nids,
17002 .dig_out_nid = ALC662_DIGOUT_NID,
17003 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17004 .channel_mode = alc662_3ST_6ch_modes,
17005 .input_mux = &alc663_capture_source,
17006 .unsol_event = alc663_g50v_unsol_event,
17007 .init_hook = alc663_g50v_inithook,
17009 [ALC663_ASUS_MODE1] = {
17010 .mixers = { alc663_m51va_mixer },
17011 .cap_mixer = alc662_auto_capture_mixer,
17012 .init_verbs = { alc662_init_verbs,
17013 alc663_21jd_amic_init_verbs },
17014 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17016 .dac_nids = alc662_dac_nids,
17017 .dig_out_nid = ALC662_DIGOUT_NID,
17018 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17019 .channel_mode = alc662_3ST_2ch_modes,
17020 .input_mux = &alc662_eeepc_capture_source,
17021 .unsol_event = alc663_mode1_unsol_event,
17022 .init_hook = alc663_mode1_inithook,
17024 [ALC662_ASUS_MODE2] = {
17025 .mixers = { alc662_1bjd_mixer },
17026 .cap_mixer = alc662_auto_capture_mixer,
17027 .init_verbs = { alc662_init_verbs,
17028 alc662_1bjd_amic_init_verbs },
17029 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17030 .dac_nids = alc662_dac_nids,
17031 .dig_out_nid = ALC662_DIGOUT_NID,
17032 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17033 .channel_mode = alc662_3ST_2ch_modes,
17034 .input_mux = &alc662_eeepc_capture_source,
17035 .unsol_event = alc662_mode2_unsol_event,
17036 .init_hook = alc662_mode2_inithook,
17038 [ALC663_ASUS_MODE3] = {
17039 .mixers = { alc663_two_hp_m1_mixer },
17040 .cap_mixer = alc662_auto_capture_mixer,
17041 .init_verbs = { alc662_init_verbs,
17042 alc663_two_hp_amic_m1_init_verbs },
17043 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17045 .dac_nids = alc662_dac_nids,
17046 .dig_out_nid = ALC662_DIGOUT_NID,
17047 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17048 .channel_mode = alc662_3ST_2ch_modes,
17049 .input_mux = &alc662_eeepc_capture_source,
17050 .unsol_event = alc663_mode3_unsol_event,
17051 .init_hook = alc663_mode3_inithook,
17053 [ALC663_ASUS_MODE4] = {
17054 .mixers = { alc663_asus_21jd_clfe_mixer },
17055 .cap_mixer = alc662_auto_capture_mixer,
17056 .init_verbs = { alc662_init_verbs,
17057 alc663_21jd_amic_init_verbs},
17058 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17060 .dac_nids = alc662_dac_nids,
17061 .dig_out_nid = ALC662_DIGOUT_NID,
17062 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17063 .channel_mode = alc662_3ST_2ch_modes,
17064 .input_mux = &alc662_eeepc_capture_source,
17065 .unsol_event = alc663_mode4_unsol_event,
17066 .init_hook = alc663_mode4_inithook,
17068 [ALC663_ASUS_MODE5] = {
17069 .mixers = { alc663_asus_15jd_clfe_mixer },
17070 .cap_mixer = alc662_auto_capture_mixer,
17071 .init_verbs = { alc662_init_verbs,
17072 alc663_15jd_amic_init_verbs },
17073 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17075 .dac_nids = alc662_dac_nids,
17076 .dig_out_nid = ALC662_DIGOUT_NID,
17077 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17078 .channel_mode = alc662_3ST_2ch_modes,
17079 .input_mux = &alc662_eeepc_capture_source,
17080 .unsol_event = alc663_mode5_unsol_event,
17081 .init_hook = alc663_mode5_inithook,
17083 [ALC663_ASUS_MODE6] = {
17084 .mixers = { alc663_two_hp_m2_mixer },
17085 .cap_mixer = alc662_auto_capture_mixer,
17086 .init_verbs = { alc662_init_verbs,
17087 alc663_two_hp_amic_m2_init_verbs },
17088 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17090 .dac_nids = alc662_dac_nids,
17091 .dig_out_nid = ALC662_DIGOUT_NID,
17092 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17093 .channel_mode = alc662_3ST_2ch_modes,
17094 .input_mux = &alc662_eeepc_capture_source,
17095 .unsol_event = alc663_mode6_unsol_event,
17096 .init_hook = alc663_mode6_inithook,
17099 .mixers = { alc663_m51va_mixer },
17100 .cap_mixer = alc272_auto_capture_mixer,
17101 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17102 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17103 .dac_nids = alc662_dac_nids,
17104 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17105 .adc_nids = alc272_adc_nids,
17106 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17107 .capsrc_nids = alc272_capsrc_nids,
17108 .channel_mode = alc662_3ST_2ch_modes,
17109 .input_mux = &alc663_m51va_capture_source,
17110 .unsol_event = alc663_m51va_unsol_event,
17111 .init_hook = alc663_m51va_inithook,
17113 [ALC272_DELL_ZM1] = {
17114 .mixers = { alc663_m51va_mixer },
17115 .cap_mixer = alc662_auto_capture_mixer,
17116 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17117 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17118 .dac_nids = alc662_dac_nids,
17119 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17120 .adc_nids = alc662_adc_nids,
17122 .capsrc_nids = alc662_capsrc_nids,
17123 .channel_mode = alc662_3ST_2ch_modes,
17124 .input_mux = &alc663_m51va_capture_source,
17125 .unsol_event = alc663_m51va_unsol_event,
17126 .init_hook = alc663_m51va_inithook,
17128 [ALC272_SAMSUNG_NC10] = {
17129 .mixers = { alc272_nc10_mixer },
17130 .init_verbs = { alc662_init_verbs,
17131 alc663_21jd_amic_init_verbs },
17132 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17133 .dac_nids = alc272_dac_nids,
17134 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17135 .channel_mode = alc662_3ST_2ch_modes,
17136 .input_mux = &alc272_nc10_capture_source,
17137 .unsol_event = alc663_mode4_unsol_event,
17138 .init_hook = alc663_mode4_inithook,
17144 * BIOS auto configuration
17147 /* add playback controls from the parsed DAC table */
17148 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
17149 const struct auto_pin_cfg *cfg)
17152 static const char *chname[4] = {
17153 "Front", "Surround", NULL /*CLFE*/, "Side"
17158 for (i = 0; i < cfg->line_outs; i++) {
17159 if (!spec->multiout.dac_nids[i])
17161 nid = alc880_idx_to_dac(i);
17164 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17165 "Center Playback Volume",
17166 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
17170 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17171 "LFE Playback Volume",
17172 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
17176 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17177 "Center Playback Switch",
17178 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17182 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17183 "LFE Playback Switch",
17184 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17189 sprintf(name, "%s Playback Volume", chname[i]);
17190 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17191 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17195 sprintf(name, "%s Playback Switch", chname[i]);
17196 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17197 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17206 /* add playback controls for speaker and HP outputs */
17207 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17218 /* ALC663 has a mono output pin on 0x17 */
17219 sprintf(name, "%s Playback Switch", pfx);
17220 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17221 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17225 if (alc880_is_fixed_pin(pin)) {
17226 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17227 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17228 /* specify the DAC as the extra output */
17229 if (!spec->multiout.hp_nid)
17230 spec->multiout.hp_nid = nid;
17232 spec->multiout.extra_out_nid[0] = nid;
17233 /* control HP volume/switch on the output mixer amp */
17234 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17235 sprintf(name, "%s Playback Volume", pfx);
17236 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17237 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17240 sprintf(name, "%s Playback Switch", pfx);
17241 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17242 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17245 } else if (alc880_is_multi_pin(pin)) {
17246 /* set manual connection */
17247 /* we have only a switch on HP-out PIN */
17248 sprintf(name, "%s Playback Switch", pfx);
17249 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17250 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17257 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
17259 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
17260 return (pincap & AC_PINCAP_IN) != 0;
17263 /* create playback/capture controls for input pins */
17264 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
17265 const struct auto_pin_cfg *cfg)
17267 struct alc_spec *spec = codec->spec;
17268 struct hda_input_mux *imux = &spec->private_imux[0];
17271 for (i = 0; i < AUTO_PIN_LAST; i++) {
17272 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
17273 idx = get_connection_index(codec, 0x0b,
17274 cfg->input_pins[i]);
17276 err = new_analog_input(spec, cfg->input_pins[i],
17277 auto_pin_cfg_labels[i],
17282 idx = get_connection_index(codec, 0x22,
17283 cfg->input_pins[i]);
17285 imux->items[imux->num_items].label =
17286 auto_pin_cfg_labels[i];
17287 imux->items[imux->num_items].index = idx;
17295 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17296 hda_nid_t nid, int pin_type,
17299 alc_set_pin_output(codec, nid, pin_type);
17300 /* need the manual connection? */
17301 if (alc880_is_multi_pin(nid)) {
17302 struct alc_spec *spec = codec->spec;
17303 int idx = alc880_multi_pin_idx(nid);
17304 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17305 AC_VERB_SET_CONNECT_SEL,
17306 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17310 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17312 struct alc_spec *spec = codec->spec;
17315 for (i = 0; i <= HDA_SIDE; i++) {
17316 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17317 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17319 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17324 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17326 struct alc_spec *spec = codec->spec;
17329 pin = spec->autocfg.hp_pins[0];
17330 if (pin) /* connect to front */
17332 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17333 pin = spec->autocfg.speaker_pins[0];
17335 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17338 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17340 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17342 struct alc_spec *spec = codec->spec;
17345 for (i = 0; i < AUTO_PIN_LAST; i++) {
17346 hda_nid_t nid = spec->autocfg.input_pins[i];
17347 if (alc662_is_input_pin(codec, nid)) {
17348 alc_set_input_pin(codec, nid, i);
17349 if (nid != ALC662_PIN_CD_NID &&
17350 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17351 snd_hda_codec_write(codec, nid, 0,
17352 AC_VERB_SET_AMP_GAIN_MUTE,
17358 #define alc662_auto_init_input_src alc882_auto_init_input_src
17360 static int alc662_parse_auto_config(struct hda_codec *codec)
17362 struct alc_spec *spec = codec->spec;
17364 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17366 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17370 if (!spec->autocfg.line_outs)
17371 return 0; /* can't find valid BIOS pin config */
17373 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17376 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17379 err = alc662_auto_create_extra_out(spec,
17380 spec->autocfg.speaker_pins[0],
17384 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17388 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17392 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17394 if (spec->autocfg.dig_outs)
17395 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17397 if (spec->kctls.list)
17398 add_mixer(spec, spec->kctls.list);
17400 spec->num_mux_defs = 1;
17401 spec->input_mux = &spec->private_imux[0];
17403 add_verb(spec, alc662_auto_init_verbs);
17404 if (codec->vendor_id == 0x10ec0663)
17405 add_verb(spec, alc663_auto_init_verbs);
17407 err = alc_auto_add_mic_boost(codec);
17411 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17416 /* additional initialization for auto-configuration model */
17417 static void alc662_auto_init(struct hda_codec *codec)
17419 struct alc_spec *spec = codec->spec;
17420 alc662_auto_init_multi_out(codec);
17421 alc662_auto_init_hp_out(codec);
17422 alc662_auto_init_analog_input(codec);
17423 alc662_auto_init_input_src(codec);
17424 if (spec->unsol_event)
17425 alc_inithook(codec);
17428 static int patch_alc662(struct hda_codec *codec)
17430 struct alc_spec *spec;
17431 int err, board_config;
17433 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17437 codec->spec = spec;
17439 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17441 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17444 if (board_config < 0) {
17445 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17447 board_config = ALC662_AUTO;
17450 if (board_config == ALC662_AUTO) {
17451 /* automatic parse from the BIOS config */
17452 err = alc662_parse_auto_config(codec);
17458 "hda_codec: Cannot set up configuration "
17459 "from BIOS. Using base mode...\n");
17460 board_config = ALC662_3ST_2ch_DIG;
17464 err = snd_hda_attach_beep_device(codec, 0x1);
17470 if (board_config != ALC662_AUTO)
17471 setup_preset(spec, &alc662_presets[board_config]);
17473 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17474 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17476 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17477 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17479 if (!spec->adc_nids) {
17480 spec->adc_nids = alc662_adc_nids;
17481 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17483 if (!spec->capsrc_nids)
17484 spec->capsrc_nids = alc662_capsrc_nids;
17486 if (!spec->cap_mixer)
17487 set_capture_mixer(codec);
17488 if (codec->vendor_id == 0x10ec0662)
17489 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17491 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17493 spec->vmaster_nid = 0x02;
17495 codec->patch_ops = alc_patch_ops;
17496 if (board_config == ALC662_AUTO)
17497 spec->init_hook = alc662_auto_init;
17498 #ifdef CONFIG_SND_HDA_POWER_SAVE
17499 if (!spec->loopback.amplist)
17500 spec->loopback.amplist = alc662_loopbacks;
17502 codec->proc_widget_hook = print_realtek_coef;
17510 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17511 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17512 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17513 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17514 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17515 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17516 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17517 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17518 .patch = patch_alc861 },
17519 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17520 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17521 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17522 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17523 .patch = patch_alc882 },
17524 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17525 .patch = patch_alc662 },
17526 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17527 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17528 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17529 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17530 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17531 .patch = patch_alc882 },
17532 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17533 .patch = patch_alc882 },
17534 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17535 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17536 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17537 .patch = patch_alc882 },
17538 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17539 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17540 {} /* terminator */
17543 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17545 MODULE_LICENSE("GPL");
17546 MODULE_DESCRIPTION("Realtek HD-audio codec");
17548 static struct hda_codec_preset_list realtek_list = {
17549 .preset = snd_hda_preset_realtek,
17550 .owner = THIS_MODULE,
17553 static int __init patch_realtek_init(void)
17555 return snd_hda_add_codec_preset(&realtek_list);
17558 static void __exit patch_realtek_exit(void)
17560 snd_hda_delete_codec_preset(&realtek_list);
17563 module_init(patch_realtek_init)
17564 module_exit(patch_realtek_exit)