2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include <sound/jack.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
36 #define ALC880_FRONT_EVENT 0x01
37 #define ALC880_DCVOL_EVENT 0x02
38 #define ALC880_HP_EVENT 0x04
39 #define ALC880_MIC_EVENT 0x08
41 /* ALC880 board config type */
65 #ifdef CONFIG_SND_DEBUG
69 ALC880_MODEL_LAST /* last tag */
83 #ifdef CONFIG_SND_DEBUG
87 ALC260_MODEL_LAST /* last tag */
97 ALC262_HP_BPC_D7000_WL,
98 ALC262_HP_BPC_D7000_WF,
111 ALC262_MODEL_LAST /* last tag */
121 ALC268_ACER_ASPIRE_ONE,
124 #ifdef CONFIG_SND_DEBUG
128 ALC268_MODEL_LAST /* last tag */
143 ALC269_MODEL_LAST /* last tag */
160 /* ALC861-VD models */
182 ALC662_ASUS_EEEPC_P701,
183 ALC662_ASUS_EEEPC_EP20,
225 ALC883_TARGA_2ch_DIG,
226 ALC883_TARGA_8ch_DIG,
229 ALC888_ACER_ASPIRE_4930G,
230 ALC888_ACER_ASPIRE_6530G,
231 ALC888_ACER_ASPIRE_8930G,
232 ALC888_ACER_ASPIRE_7730G,
234 ALC883_MEDION_WIM2160,
236 ALC883_LENOVO_101E_2ch,
237 ALC883_LENOVO_NB0763,
238 ALC888_LENOVO_MS7195_DIG,
246 ALC883_FUJITSU_PI2515,
247 ALC888_FUJITSU_XA3530,
248 ALC883_3ST_6ch_INTEL,
268 #define GPIO_MASK 0x03
270 /* extra amp-initialization sequence types */
279 struct alc_mic_route {
281 unsigned char mux_idx;
282 unsigned char amix_idx;
288 struct snd_jack *jack;
291 #define MUX_IDX_UNDEF ((unsigned char)-1)
293 struct alc_customize_define {
294 unsigned int sku_cfg;
295 unsigned char port_connectivity;
296 unsigned char check_sum;
297 unsigned char customization;
298 unsigned char external_amp;
299 unsigned int enable_pcbeep:1;
300 unsigned int platform_type:1;
302 unsigned int override:1;
303 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
307 /* codec parameterization */
308 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
309 unsigned int num_mixers;
310 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
311 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
313 const struct hda_verb *init_verbs[10]; /* initialization verbs
317 unsigned int num_init_verbs;
319 char stream_name_analog[32]; /* analog PCM stream */
320 struct hda_pcm_stream *stream_analog_playback;
321 struct hda_pcm_stream *stream_analog_capture;
322 struct hda_pcm_stream *stream_analog_alt_playback;
323 struct hda_pcm_stream *stream_analog_alt_capture;
325 char stream_name_digital[32]; /* digital PCM stream */
326 struct hda_pcm_stream *stream_digital_playback;
327 struct hda_pcm_stream *stream_digital_capture;
330 struct hda_multi_out multiout; /* playback set-up
331 * max_channels, dacs must be set
332 * dig_out_nid and hp_nid are optional
334 hda_nid_t alt_dac_nid;
335 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
339 unsigned int num_adc_nids;
341 hda_nid_t *capsrc_nids;
342 hda_nid_t dig_in_nid; /* digital-in NID; optional */
344 /* capture setup for dynamic dual-adc switch */
345 unsigned int cur_adc_idx;
347 unsigned int cur_adc_stream_tag;
348 unsigned int cur_adc_format;
351 unsigned int num_mux_defs;
352 const struct hda_input_mux *input_mux;
353 unsigned int cur_mux[3];
354 struct alc_mic_route ext_mic;
355 struct alc_mic_route int_mic;
358 const struct hda_channel_mode *channel_mode;
359 int num_channel_mode;
361 int const_channel_count;
362 int ext_channel_count;
364 /* PCM information */
365 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
368 struct snd_array jacks;
370 /* dynamic controls, init_verbs and input_mux */
371 struct auto_pin_cfg autocfg;
372 struct alc_customize_define cdefine;
373 struct snd_array kctls;
374 struct hda_input_mux private_imux[3];
375 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
376 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
377 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
380 void (*init_hook)(struct hda_codec *codec);
381 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
382 #ifdef CONFIG_SND_HDA_POWER_SAVE
383 void (*power_hook)(struct hda_codec *codec);
386 /* for pin sensing */
387 unsigned int sense_updated: 1;
388 unsigned int jack_present: 1;
389 unsigned int master_sw: 1;
390 unsigned int auto_mic:1;
393 unsigned int no_analog :1; /* digital I/O only */
394 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
396 int codec_variant; /* flag for other variants */
398 /* for virtual master */
399 hda_nid_t vmaster_nid;
400 #ifdef CONFIG_SND_HDA_POWER_SAVE
401 struct hda_loopback_check loopback;
406 unsigned int pll_coef_idx, pll_coef_bit;
410 * configuration template - to be copied to the spec instance
412 struct alc_config_preset {
413 struct snd_kcontrol_new *mixers[5]; /* should be identical size
416 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
417 const struct hda_verb *init_verbs[5];
418 unsigned int num_dacs;
420 hda_nid_t dig_out_nid; /* optional */
421 hda_nid_t hp_nid; /* optional */
422 hda_nid_t *slave_dig_outs;
423 unsigned int num_adc_nids;
425 hda_nid_t *capsrc_nids;
426 hda_nid_t dig_in_nid;
427 unsigned int num_channel_mode;
428 const struct hda_channel_mode *channel_mode;
430 int const_channel_count;
431 unsigned int num_mux_defs;
432 const struct hda_input_mux *input_mux;
433 void (*unsol_event)(struct hda_codec *, unsigned int);
434 void (*setup)(struct hda_codec *);
435 void (*init_hook)(struct hda_codec *);
436 #ifdef CONFIG_SND_HDA_POWER_SAVE
437 struct hda_amp_list *loopbacks;
438 void (*power_hook)(struct hda_codec *codec);
446 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
447 struct snd_ctl_elem_info *uinfo)
449 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
450 struct alc_spec *spec = codec->spec;
451 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
452 if (mux_idx >= spec->num_mux_defs)
454 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
456 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
459 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
460 struct snd_ctl_elem_value *ucontrol)
462 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
463 struct alc_spec *spec = codec->spec;
464 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
466 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
470 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
471 struct snd_ctl_elem_value *ucontrol)
473 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
474 struct alc_spec *spec = codec->spec;
475 const struct hda_input_mux *imux;
476 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
477 unsigned int mux_idx;
478 hda_nid_t nid = spec->capsrc_nids ?
479 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
482 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
483 imux = &spec->input_mux[mux_idx];
484 if (!imux->num_items && mux_idx > 0)
485 imux = &spec->input_mux[0];
487 type = get_wcaps_type(get_wcaps(codec, nid));
488 if (type == AC_WID_AUD_MIX) {
489 /* Matrix-mixer style (e.g. ALC882) */
490 unsigned int *cur_val = &spec->cur_mux[adc_idx];
493 idx = ucontrol->value.enumerated.item[0];
494 if (idx >= imux->num_items)
495 idx = imux->num_items - 1;
498 for (i = 0; i < imux->num_items; i++) {
499 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
500 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
501 imux->items[i].index,
507 /* MUX style (e.g. ALC880) */
508 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
509 &spec->cur_mux[adc_idx]);
514 * channel mode setting
516 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
517 struct snd_ctl_elem_info *uinfo)
519 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
520 struct alc_spec *spec = codec->spec;
521 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
522 spec->num_channel_mode);
525 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
526 struct snd_ctl_elem_value *ucontrol)
528 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
529 struct alc_spec *spec = codec->spec;
530 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
531 spec->num_channel_mode,
532 spec->ext_channel_count);
535 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
536 struct snd_ctl_elem_value *ucontrol)
538 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
539 struct alc_spec *spec = codec->spec;
540 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
541 spec->num_channel_mode,
542 &spec->ext_channel_count);
543 if (err >= 0 && !spec->const_channel_count) {
544 spec->multiout.max_channels = spec->ext_channel_count;
545 if (spec->need_dac_fix)
546 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
552 * Control the mode of pin widget settings via the mixer. "pc" is used
553 * instead of "%" to avoid consequences of accidently treating the % as
554 * being part of a format specifier. Maximum allowed length of a value is
555 * 63 characters plus NULL terminator.
557 * Note: some retasking pin complexes seem to ignore requests for input
558 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
559 * are requested. Therefore order this list so that this behaviour will not
560 * cause problems when mixer clients move through the enum sequentially.
561 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
564 static char *alc_pin_mode_names[] = {
565 "Mic 50pc bias", "Mic 80pc bias",
566 "Line in", "Line out", "Headphone out",
568 static unsigned char alc_pin_mode_values[] = {
569 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
571 /* The control can present all 5 options, or it can limit the options based
572 * in the pin being assumed to be exclusively an input or an output pin. In
573 * addition, "input" pins may or may not process the mic bias option
574 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
575 * accept requests for bias as of chip versions up to March 2006) and/or
576 * wiring in the computer.
578 #define ALC_PIN_DIR_IN 0x00
579 #define ALC_PIN_DIR_OUT 0x01
580 #define ALC_PIN_DIR_INOUT 0x02
581 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
582 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
584 /* Info about the pin modes supported by the different pin direction modes.
585 * For each direction the minimum and maximum values are given.
587 static signed char alc_pin_mode_dir_info[5][2] = {
588 { 0, 2 }, /* ALC_PIN_DIR_IN */
589 { 3, 4 }, /* ALC_PIN_DIR_OUT */
590 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
591 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
592 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
594 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
595 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
596 #define alc_pin_mode_n_items(_dir) \
597 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
599 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
600 struct snd_ctl_elem_info *uinfo)
602 unsigned int item_num = uinfo->value.enumerated.item;
603 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
605 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
607 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
609 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
610 item_num = alc_pin_mode_min(dir);
611 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
615 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
616 struct snd_ctl_elem_value *ucontrol)
619 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
620 hda_nid_t nid = kcontrol->private_value & 0xffff;
621 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
622 long *valp = ucontrol->value.integer.value;
623 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
624 AC_VERB_GET_PIN_WIDGET_CONTROL,
627 /* Find enumerated value for current pinctl setting */
628 i = alc_pin_mode_min(dir);
629 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
631 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
635 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
636 struct snd_ctl_elem_value *ucontrol)
639 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
640 hda_nid_t nid = kcontrol->private_value & 0xffff;
641 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
642 long val = *ucontrol->value.integer.value;
643 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
644 AC_VERB_GET_PIN_WIDGET_CONTROL,
647 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
648 val = alc_pin_mode_min(dir);
650 change = pinctl != alc_pin_mode_values[val];
652 /* Set pin mode to that requested */
653 snd_hda_codec_write_cache(codec, nid, 0,
654 AC_VERB_SET_PIN_WIDGET_CONTROL,
655 alc_pin_mode_values[val]);
657 /* Also enable the retasking pin's input/output as required
658 * for the requested pin mode. Enum values of 2 or less are
661 * Dynamically switching the input/output buffers probably
662 * reduces noise slightly (particularly on input) so we'll
663 * do it. However, having both input and output buffers
664 * enabled simultaneously doesn't seem to be problematic if
665 * this turns out to be necessary in the future.
668 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
669 HDA_AMP_MUTE, HDA_AMP_MUTE);
670 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
673 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
674 HDA_AMP_MUTE, HDA_AMP_MUTE);
675 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
682 #define ALC_PIN_MODE(xname, nid, dir) \
683 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
684 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
685 .info = alc_pin_mode_info, \
686 .get = alc_pin_mode_get, \
687 .put = alc_pin_mode_put, \
688 .private_value = nid | (dir<<16) }
690 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
691 * together using a mask with more than one bit set. This control is
692 * currently used only by the ALC260 test model. At this stage they are not
693 * needed for any "production" models.
695 #ifdef CONFIG_SND_DEBUG
696 #define alc_gpio_data_info snd_ctl_boolean_mono_info
698 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
699 struct snd_ctl_elem_value *ucontrol)
701 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
702 hda_nid_t nid = kcontrol->private_value & 0xffff;
703 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
704 long *valp = ucontrol->value.integer.value;
705 unsigned int val = snd_hda_codec_read(codec, nid, 0,
706 AC_VERB_GET_GPIO_DATA, 0x00);
708 *valp = (val & mask) != 0;
711 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
712 struct snd_ctl_elem_value *ucontrol)
715 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
716 hda_nid_t nid = kcontrol->private_value & 0xffff;
717 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
718 long val = *ucontrol->value.integer.value;
719 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
720 AC_VERB_GET_GPIO_DATA,
723 /* Set/unset the masked GPIO bit(s) as needed */
724 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
729 snd_hda_codec_write_cache(codec, nid, 0,
730 AC_VERB_SET_GPIO_DATA, gpio_data);
734 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
735 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
736 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
737 .info = alc_gpio_data_info, \
738 .get = alc_gpio_data_get, \
739 .put = alc_gpio_data_put, \
740 .private_value = nid | (mask<<16) }
741 #endif /* CONFIG_SND_DEBUG */
743 /* A switch control to allow the enabling of the digital IO pins on the
744 * ALC260. This is incredibly simplistic; the intention of this control is
745 * to provide something in the test model allowing digital outputs to be
746 * identified if present. If models are found which can utilise these
747 * outputs a more complete mixer control can be devised for those models if
750 #ifdef CONFIG_SND_DEBUG
751 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
753 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
754 struct snd_ctl_elem_value *ucontrol)
756 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
757 hda_nid_t nid = kcontrol->private_value & 0xffff;
758 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
759 long *valp = ucontrol->value.integer.value;
760 unsigned int val = snd_hda_codec_read(codec, nid, 0,
761 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
763 *valp = (val & mask) != 0;
766 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
767 struct snd_ctl_elem_value *ucontrol)
770 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
771 hda_nid_t nid = kcontrol->private_value & 0xffff;
772 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
773 long val = *ucontrol->value.integer.value;
774 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
775 AC_VERB_GET_DIGI_CONVERT_1,
778 /* Set/unset the masked control bit(s) as needed */
779 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
784 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
789 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
790 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
791 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
792 .info = alc_spdif_ctrl_info, \
793 .get = alc_spdif_ctrl_get, \
794 .put = alc_spdif_ctrl_put, \
795 .private_value = nid | (mask<<16) }
796 #endif /* CONFIG_SND_DEBUG */
798 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
799 * Again, this is only used in the ALC26x test models to help identify when
800 * the EAPD line must be asserted for features to work.
802 #ifdef CONFIG_SND_DEBUG
803 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
805 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
806 struct snd_ctl_elem_value *ucontrol)
808 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
809 hda_nid_t nid = kcontrol->private_value & 0xffff;
810 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
811 long *valp = ucontrol->value.integer.value;
812 unsigned int val = snd_hda_codec_read(codec, nid, 0,
813 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
815 *valp = (val & mask) != 0;
819 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
820 struct snd_ctl_elem_value *ucontrol)
823 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
824 hda_nid_t nid = kcontrol->private_value & 0xffff;
825 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
826 long val = *ucontrol->value.integer.value;
827 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
828 AC_VERB_GET_EAPD_BTLENABLE,
831 /* Set/unset the masked control bit(s) as needed */
832 change = (!val ? 0 : mask) != (ctrl_data & mask);
837 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
843 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
844 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
845 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
846 .info = alc_eapd_ctrl_info, \
847 .get = alc_eapd_ctrl_get, \
848 .put = alc_eapd_ctrl_put, \
849 .private_value = nid | (mask<<16) }
850 #endif /* CONFIG_SND_DEBUG */
853 * set up the input pin config (depending on the given auto-pin type)
855 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
858 unsigned int val = PIN_IN;
860 if (auto_pin_type == AUTO_PIN_MIC) {
863 oldval = snd_hda_codec_read(codec, nid, 0,
864 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
865 pincap = snd_hda_query_pin_caps(codec, nid);
866 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
867 /* if the default pin setup is vref50, we give it priority */
868 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
870 else if (pincap & AC_PINCAP_VREF_50)
872 else if (pincap & AC_PINCAP_VREF_100)
874 else if (pincap & AC_PINCAP_VREF_GRD)
877 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
880 static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
882 struct alc_spec *spec = codec->spec;
883 struct auto_pin_cfg *cfg = &spec->autocfg;
885 if (!cfg->line_outs) {
886 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
887 cfg->line_out_pins[cfg->line_outs])
890 if (!cfg->speaker_outs) {
891 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
892 cfg->speaker_pins[cfg->speaker_outs])
896 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
897 cfg->hp_pins[cfg->hp_outs])
904 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
906 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
908 spec->mixers[spec->num_mixers++] = mix;
911 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
913 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
915 spec->init_verbs[spec->num_init_verbs++] = verb;
919 * set up from the preset table
921 static void setup_preset(struct hda_codec *codec,
922 const struct alc_config_preset *preset)
924 struct alc_spec *spec = codec->spec;
927 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
928 add_mixer(spec, preset->mixers[i]);
929 spec->cap_mixer = preset->cap_mixer;
930 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
932 add_verb(spec, preset->init_verbs[i]);
934 spec->channel_mode = preset->channel_mode;
935 spec->num_channel_mode = preset->num_channel_mode;
936 spec->need_dac_fix = preset->need_dac_fix;
937 spec->const_channel_count = preset->const_channel_count;
939 if (preset->const_channel_count)
940 spec->multiout.max_channels = preset->const_channel_count;
942 spec->multiout.max_channels = spec->channel_mode[0].channels;
943 spec->ext_channel_count = spec->channel_mode[0].channels;
945 spec->multiout.num_dacs = preset->num_dacs;
946 spec->multiout.dac_nids = preset->dac_nids;
947 spec->multiout.dig_out_nid = preset->dig_out_nid;
948 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
949 spec->multiout.hp_nid = preset->hp_nid;
951 spec->num_mux_defs = preset->num_mux_defs;
952 if (!spec->num_mux_defs)
953 spec->num_mux_defs = 1;
954 spec->input_mux = preset->input_mux;
956 spec->num_adc_nids = preset->num_adc_nids;
957 spec->adc_nids = preset->adc_nids;
958 spec->capsrc_nids = preset->capsrc_nids;
959 spec->dig_in_nid = preset->dig_in_nid;
961 spec->unsol_event = preset->unsol_event;
962 spec->init_hook = preset->init_hook;
963 #ifdef CONFIG_SND_HDA_POWER_SAVE
964 spec->power_hook = preset->power_hook;
965 spec->loopback.amplist = preset->loopbacks;
969 preset->setup(codec);
971 alc_fixup_autocfg_pin_nums(codec);
974 /* Enable GPIO mask and set output */
975 static struct hda_verb alc_gpio1_init_verbs[] = {
976 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
977 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
978 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
982 static struct hda_verb alc_gpio2_init_verbs[] = {
983 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
984 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
985 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
989 static struct hda_verb alc_gpio3_init_verbs[] = {
990 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
991 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
992 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
997 * Fix hardware PLL issue
998 * On some codecs, the analog PLL gating control must be off while
999 * the default value is 1.
1001 static void alc_fix_pll(struct hda_codec *codec)
1003 struct alc_spec *spec = codec->spec;
1008 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1009 spec->pll_coef_idx);
1010 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1011 AC_VERB_GET_PROC_COEF, 0);
1012 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1013 spec->pll_coef_idx);
1014 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1015 val & ~(1 << spec->pll_coef_bit));
1018 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
1019 unsigned int coef_idx, unsigned int coef_bit)
1021 struct alc_spec *spec = codec->spec;
1022 spec->pll_nid = nid;
1023 spec->pll_coef_idx = coef_idx;
1024 spec->pll_coef_bit = coef_bit;
1028 #ifdef CONFIG_SND_HDA_INPUT_JACK
1029 static void alc_free_jack_priv(struct snd_jack *jack)
1031 struct alc_jack *jacks = jack->private_data;
1036 static int alc_add_jack(struct hda_codec *codec,
1037 hda_nid_t nid, int type)
1039 struct alc_spec *spec;
1040 struct alc_jack *jack;
1045 snd_array_init(&spec->jacks, sizeof(*jack), 32);
1046 jack = snd_array_new(&spec->jacks);
1052 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;
1054 err = snd_jack_new(codec->bus->card, name, type, &jack->jack);
1057 jack->jack->private_data = jack;
1058 jack->jack->private_free = alc_free_jack_priv;
1062 static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1064 struct alc_spec *spec = codec->spec;
1065 struct alc_jack *jacks = spec->jacks.list;
1069 for (i = 0; i < spec->jacks.used; i++) {
1070 if (jacks->nid == nid) {
1071 unsigned int present;
1072 present = snd_hda_jack_detect(codec, nid);
1074 present = (present) ? jacks->type : 0;
1076 snd_jack_report(jacks->jack, present);
1083 static int alc_init_jacks(struct hda_codec *codec)
1085 struct alc_spec *spec = codec->spec;
1087 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1088 unsigned int mic_nid = spec->ext_mic.pin;
1091 err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE);
1094 alc_report_jack(codec, hp_nid);
1098 err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE);
1101 alc_report_jack(codec, mic_nid);
1107 static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1111 static inline int alc_init_jacks(struct hda_codec *codec)
1117 static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1119 struct alc_spec *spec = codec->spec;
1124 spec->jack_present = 0;
1125 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1126 nid = spec->autocfg.hp_pins[i];
1129 if (snd_hda_jack_detect(codec, nid)) {
1130 spec->jack_present = 1;
1133 alc_report_jack(codec, spec->autocfg.hp_pins[i]);
1136 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1137 /* Toggle internal speakers muting */
1138 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1139 nid = spec->autocfg.speaker_pins[i];
1143 snd_hda_codec_write(codec, nid, 0,
1144 AC_VERB_SET_PIN_WIDGET_CONTROL,
1145 spec->jack_present ? 0 : PIN_OUT);
1147 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1148 HDA_AMP_MUTE, mute);
1153 static void alc_automute_pin(struct hda_codec *codec)
1155 alc_automute_speaker(codec, 1);
1158 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1161 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1164 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1165 for (i = 0; i < nums; i++)
1171 /* switch the current ADC according to the jack state */
1172 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1174 struct alc_spec *spec = codec->spec;
1175 unsigned int present;
1178 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1180 spec->cur_adc_idx = 1;
1182 spec->cur_adc_idx = 0;
1183 new_adc = spec->adc_nids[spec->cur_adc_idx];
1184 if (spec->cur_adc && spec->cur_adc != new_adc) {
1185 /* stream is running, let's swap the current ADC */
1186 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1187 spec->cur_adc = new_adc;
1188 snd_hda_codec_setup_stream(codec, new_adc,
1189 spec->cur_adc_stream_tag, 0,
1190 spec->cur_adc_format);
1194 static void alc_mic_automute(struct hda_codec *codec)
1196 struct alc_spec *spec = codec->spec;
1197 struct alc_mic_route *dead, *alive;
1198 unsigned int present, type;
1201 if (!spec->auto_mic)
1203 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1205 if (snd_BUG_ON(!spec->adc_nids))
1208 if (spec->dual_adc_switch) {
1209 alc_dual_mic_adc_auto_switch(codec);
1213 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1215 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1217 alive = &spec->ext_mic;
1218 dead = &spec->int_mic;
1220 alive = &spec->int_mic;
1221 dead = &spec->ext_mic;
1224 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1225 if (type == AC_WID_AUD_MIX) {
1226 /* Matrix-mixer style (e.g. ALC882) */
1227 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1230 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1232 HDA_AMP_MUTE, HDA_AMP_MUTE);
1234 /* MUX style (e.g. ALC880) */
1235 snd_hda_codec_write_cache(codec, cap_nid, 0,
1236 AC_VERB_SET_CONNECT_SEL,
1239 alc_report_jack(codec, spec->ext_mic.pin);
1241 /* FIXME: analog mixer */
1244 /* unsolicited event for HP jack sensing */
1245 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1247 if (codec->vendor_id == 0x10ec0880)
1252 case ALC880_HP_EVENT:
1253 alc_automute_pin(codec);
1255 case ALC880_MIC_EVENT:
1256 alc_mic_automute(codec);
1261 static void alc_inithook(struct hda_codec *codec)
1263 alc_automute_pin(codec);
1264 alc_mic_automute(codec);
1267 /* additional initialization for ALC888 variants */
1268 static void alc888_coef_init(struct hda_codec *codec)
1272 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1273 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1274 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1275 if ((tmp & 0xf0) == 0x20)
1277 snd_hda_codec_read(codec, 0x20, 0,
1278 AC_VERB_SET_PROC_COEF, 0x830);
1281 snd_hda_codec_read(codec, 0x20, 0,
1282 AC_VERB_SET_PROC_COEF, 0x3030);
1285 static void alc889_coef_init(struct hda_codec *codec)
1289 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1290 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1291 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1292 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1295 /* turn on/off EAPD control (only if available) */
1296 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1298 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1300 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1301 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1305 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1310 case ALC_INIT_GPIO1:
1311 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1313 case ALC_INIT_GPIO2:
1314 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1316 case ALC_INIT_GPIO3:
1317 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1319 case ALC_INIT_DEFAULT:
1320 switch (codec->vendor_id) {
1322 set_eapd(codec, 0x0f, 1);
1323 set_eapd(codec, 0x10, 1);
1336 set_eapd(codec, 0x14, 1);
1337 set_eapd(codec, 0x15, 1);
1340 switch (codec->vendor_id) {
1342 snd_hda_codec_write(codec, 0x1a, 0,
1343 AC_VERB_SET_COEF_INDEX, 7);
1344 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1345 AC_VERB_GET_PROC_COEF, 0);
1346 snd_hda_codec_write(codec, 0x1a, 0,
1347 AC_VERB_SET_COEF_INDEX, 7);
1348 snd_hda_codec_write(codec, 0x1a, 0,
1349 AC_VERB_SET_PROC_COEF,
1359 alc889_coef_init(codec);
1362 alc888_coef_init(codec);
1364 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1367 snd_hda_codec_write(codec, 0x20, 0,
1368 AC_VERB_SET_COEF_INDEX, 7);
1369 tmp = snd_hda_codec_read(codec, 0x20, 0,
1370 AC_VERB_GET_PROC_COEF, 0);
1371 snd_hda_codec_write(codec, 0x20, 0,
1372 AC_VERB_SET_COEF_INDEX, 7);
1373 snd_hda_codec_write(codec, 0x20, 0,
1374 AC_VERB_SET_PROC_COEF,
1383 static void alc_init_auto_hp(struct hda_codec *codec)
1385 struct alc_spec *spec = codec->spec;
1386 struct auto_pin_cfg *cfg = &spec->autocfg;
1389 if (!cfg->hp_pins[0]) {
1390 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1394 if (!cfg->speaker_pins[0]) {
1395 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1397 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1398 sizeof(cfg->speaker_pins));
1399 cfg->speaker_outs = cfg->line_outs;
1402 if (!cfg->hp_pins[0]) {
1403 memcpy(cfg->hp_pins, cfg->line_out_pins,
1404 sizeof(cfg->hp_pins));
1405 cfg->hp_outs = cfg->line_outs;
1408 for (i = 0; i < cfg->hp_outs; i++) {
1409 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1411 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1412 AC_VERB_SET_UNSOLICITED_ENABLE,
1413 AC_USRSP_EN | ALC880_HP_EVENT);
1415 spec->unsol_event = alc_sku_unsol_event;
1418 static void alc_init_auto_mic(struct hda_codec *codec)
1420 struct alc_spec *spec = codec->spec;
1421 struct auto_pin_cfg *cfg = &spec->autocfg;
1422 hda_nid_t fixed, ext;
1425 /* there must be only two mic inputs exclusively */
1426 for (i = 0; i < cfg->num_inputs; i++)
1427 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1431 for (i = 0; i < cfg->num_inputs; i++) {
1432 hda_nid_t nid = cfg->inputs[i].pin;
1433 unsigned int defcfg;
1434 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1435 switch (snd_hda_get_input_pin_attr(defcfg)) {
1436 case INPUT_PIN_ATTR_INT:
1438 return; /* already occupied */
1441 case INPUT_PIN_ATTR_UNUSED:
1442 return; /* invalid entry */
1445 return; /* already occupied */
1452 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1453 return; /* no unsol support */
1454 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1456 spec->ext_mic.pin = ext;
1457 spec->int_mic.pin = fixed;
1458 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1459 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1461 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1462 AC_VERB_SET_UNSOLICITED_ENABLE,
1463 AC_USRSP_EN | ALC880_MIC_EVENT);
1464 spec->unsol_event = alc_sku_unsol_event;
1467 /* Could be any non-zero and even value. When used as fixup, tells
1468 * the driver to ignore any present sku defines.
1470 #define ALC_FIXUP_SKU_IGNORE (2)
1472 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1474 unsigned int ass, tmp, i;
1476 struct alc_spec *spec = codec->spec;
1478 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1480 if (spec->cdefine.fixup) {
1481 ass = spec->cdefine.sku_cfg;
1482 if (ass == ALC_FIXUP_SKU_IGNORE)
1487 ass = codec->subsystem_id & 0xffff;
1488 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1492 if (codec->vendor_id == 0x10ec0260)
1494 ass = snd_hda_codec_get_pincfg(codec, nid);
1497 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1498 codec->chip_name, ass);
1504 for (i = 1; i < 16; i++) {
1508 if (((ass >> 16) & 0xf) != tmp)
1511 spec->cdefine.port_connectivity = ass >> 30;
1512 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1513 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1514 spec->cdefine.customization = ass >> 8;
1516 spec->cdefine.sku_cfg = ass;
1517 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1518 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1519 spec->cdefine.swap = (ass & 0x2) >> 1;
1520 spec->cdefine.override = ass & 0x1;
1522 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1523 nid, spec->cdefine.sku_cfg);
1524 snd_printd("SKU: port_connectivity=0x%x\n",
1525 spec->cdefine.port_connectivity);
1526 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1527 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1528 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1529 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1530 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1531 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1532 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1537 /* check subsystem ID and set up device-specific initialization;
1538 * return 1 if initialized, 0 if invalid SSID
1540 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1541 * 31 ~ 16 : Manufacture ID
1543 * 7 ~ 0 : Assembly ID
1544 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1546 static int alc_subsystem_id(struct hda_codec *codec,
1547 hda_nid_t porta, hda_nid_t porte,
1548 hda_nid_t portd, hda_nid_t porti)
1550 unsigned int ass, tmp, i;
1552 struct alc_spec *spec = codec->spec;
1554 if (spec->cdefine.fixup) {
1555 ass = spec->cdefine.sku_cfg;
1556 if (ass == ALC_FIXUP_SKU_IGNORE)
1561 ass = codec->subsystem_id & 0xffff;
1562 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1565 /* invalid SSID, check the special NID pin defcfg instead */
1567 * 31~30 : port connectivity
1570 * 19~16 : Check sum (15:1)
1575 if (codec->vendor_id == 0x10ec0260)
1577 ass = snd_hda_codec_get_pincfg(codec, nid);
1578 snd_printd("realtek: No valid SSID, "
1579 "checking pincfg 0x%08x for NID 0x%x\n",
1583 if ((ass >> 30) != 1) /* no physical connection */
1588 for (i = 1; i < 16; i++) {
1592 if (((ass >> 16) & 0xf) != tmp)
1595 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1596 ass & 0xffff, codec->vendor_id);
1600 * 2 : 0 --> Desktop, 1 --> Laptop
1601 * 3~5 : External Amplifier control
1604 tmp = (ass & 0x38) >> 3; /* external Amp control */
1607 spec->init_amp = ALC_INIT_GPIO1;
1610 spec->init_amp = ALC_INIT_GPIO2;
1613 spec->init_amp = ALC_INIT_GPIO3;
1617 spec->init_amp = ALC_INIT_DEFAULT;
1621 /* is laptop or Desktop and enable the function "Mute internal speaker
1622 * when the external headphone out jack is plugged"
1624 if (!(ass & 0x8000))
1627 * 10~8 : Jack location
1628 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1630 * 15 : 1 --> enable the function "Mute internal speaker
1631 * when the external headphone out jack is plugged"
1633 if (!spec->autocfg.hp_pins[0]) {
1635 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1646 for (i = 0; i < spec->autocfg.line_outs; i++)
1647 if (spec->autocfg.line_out_pins[i] == nid)
1649 spec->autocfg.hp_pins[0] = nid;
1652 alc_init_auto_hp(codec);
1653 alc_init_auto_mic(codec);
1657 static void alc_ssid_check(struct hda_codec *codec,
1658 hda_nid_t porta, hda_nid_t porte,
1659 hda_nid_t portd, hda_nid_t porti)
1661 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1662 struct alc_spec *spec = codec->spec;
1663 snd_printd("realtek: "
1664 "Enable default setup for auto mode as fallback\n");
1665 spec->init_amp = ALC_INIT_DEFAULT;
1666 alc_init_auto_hp(codec);
1667 alc_init_auto_mic(codec);
1672 * Fix-up pin default configurations and add default verbs
1680 struct alc_model_fixup {
1687 const struct alc_pincfg *pins;
1688 const struct hda_verb *verbs;
1689 void (*func)(struct hda_codec *codec, const struct alc_fixup *fix,
1693 static void __alc_pick_fixup(struct hda_codec *codec,
1694 const struct alc_fixup *fix,
1695 const char *modelname,
1698 const struct alc_pincfg *cfg;
1699 struct alc_spec *spec;
1702 if (pre_init && fix->sku) {
1703 #ifdef CONFIG_SND_DEBUG_VERBOSE
1704 snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n",
1705 codec->chip_name, modelname);
1708 spec->cdefine.sku_cfg = fix->sku;
1709 spec->cdefine.fixup = 1;
1711 if (pre_init && cfg) {
1712 #ifdef CONFIG_SND_DEBUG_VERBOSE
1713 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1714 codec->chip_name, modelname);
1716 for (; cfg->nid; cfg++)
1717 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1719 if (!pre_init && fix->verbs) {
1720 #ifdef CONFIG_SND_DEBUG_VERBOSE
1721 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1722 codec->chip_name, modelname);
1724 add_verb(codec->spec, fix->verbs);
1727 #ifdef CONFIG_SND_DEBUG_VERBOSE
1728 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-func for %s\n",
1729 codec->chip_name, modelname);
1731 fix->func(codec, fix, pre_init);
1735 static void alc_pick_fixup(struct hda_codec *codec,
1736 const struct snd_pci_quirk *quirk,
1737 const struct alc_fixup *fix,
1740 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1742 fix += quirk->value;
1743 #ifdef CONFIG_SND_DEBUG_VERBOSE
1744 __alc_pick_fixup(codec, fix, quirk->name, pre_init);
1746 __alc_pick_fixup(codec, fix, NULL, pre_init);
1751 static void alc_pick_fixup_model(struct hda_codec *codec,
1752 const struct alc_model_fixup *models,
1753 const struct snd_pci_quirk *quirk,
1754 const struct alc_fixup *fix,
1757 if (codec->modelname && models) {
1758 while (models->name) {
1759 if (!strcmp(codec->modelname, models->name)) {
1765 __alc_pick_fixup(codec, fix, codec->modelname, pre_init);
1767 alc_pick_fixup(codec, quirk, fix, pre_init);
1771 static int alc_read_coef_idx(struct hda_codec *codec,
1772 unsigned int coef_idx)
1775 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1777 val = snd_hda_codec_read(codec, 0x20, 0,
1778 AC_VERB_GET_PROC_COEF, 0);
1782 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
1783 unsigned int coef_val)
1785 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1787 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
1791 /* set right pin controls for digital I/O */
1792 static void alc_auto_init_digital(struct hda_codec *codec)
1794 struct alc_spec *spec = codec->spec;
1798 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1799 pin = spec->autocfg.dig_out_pins[i];
1801 snd_hda_codec_write(codec, pin, 0,
1802 AC_VERB_SET_PIN_WIDGET_CONTROL,
1806 pin = spec->autocfg.dig_in_pin;
1808 snd_hda_codec_write(codec, pin, 0,
1809 AC_VERB_SET_PIN_WIDGET_CONTROL,
1813 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1814 static void alc_auto_parse_digital(struct hda_codec *codec)
1816 struct alc_spec *spec = codec->spec;
1820 /* support multiple SPDIFs; the secondary is set up as a slave */
1821 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1822 err = snd_hda_get_connections(codec,
1823 spec->autocfg.dig_out_pins[i],
1828 spec->multiout.dig_out_nid = dig_nid;
1829 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1831 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1832 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1834 spec->slave_dig_outs[i - 1] = dig_nid;
1838 if (spec->autocfg.dig_in_pin) {
1839 dig_nid = codec->start_nid;
1840 for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
1841 unsigned int wcaps = get_wcaps(codec, dig_nid);
1842 if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
1844 if (!(wcaps & AC_WCAP_DIGITAL))
1846 if (!(wcaps & AC_WCAP_CONN_LIST))
1848 err = get_connection_index(codec, dig_nid,
1849 spec->autocfg.dig_in_pin);
1851 spec->dig_in_nid = dig_nid;
1865 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1866 /* Mic-in jack as mic in */
1867 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1868 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1869 /* Line-in jack as Line in */
1870 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1871 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1872 /* Line-Out as Front */
1873 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1880 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1881 /* Mic-in jack as mic in */
1882 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1883 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1884 /* Line-in jack as Surround */
1885 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1886 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1887 /* Line-Out as Front */
1888 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1895 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1896 /* Mic-in jack as CLFE */
1897 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1898 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1899 /* Line-in jack as Surround */
1900 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1901 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1902 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1903 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1910 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1911 /* Mic-in jack as CLFE */
1912 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1913 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1914 /* Line-in jack as Surround */
1915 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1916 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1917 /* Line-Out as Side */
1918 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1922 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1923 { 2, alc888_4ST_ch2_intel_init },
1924 { 4, alc888_4ST_ch4_intel_init },
1925 { 6, alc888_4ST_ch6_intel_init },
1926 { 8, alc888_4ST_ch8_intel_init },
1930 * ALC888 Fujitsu Siemens Amillo xa3530
1933 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1934 /* Front Mic: set to PIN_IN (empty by default) */
1935 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1936 /* Connect Internal HP to Front */
1937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1938 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1939 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1940 /* Connect Bass HP to Front */
1941 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1942 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1943 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1944 /* Connect Line-Out side jack (SPDIF) to Side */
1945 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1946 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1947 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1948 /* Connect Mic jack to CLFE */
1949 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1950 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1951 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1952 /* Connect Line-in jack to Surround */
1953 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1954 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1955 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1956 /* Connect HP out jack to Front */
1957 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1958 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1959 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1960 /* Enable unsolicited event for HP jack and Line-out jack */
1961 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1962 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1966 static void alc_automute_amp(struct hda_codec *codec)
1968 alc_automute_speaker(codec, 0);
1971 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1974 if (codec->vendor_id == 0x10ec0880)
1978 if (res == ALC880_HP_EVENT)
1979 alc_automute_amp(codec);
1982 static void alc889_automute_setup(struct hda_codec *codec)
1984 struct alc_spec *spec = codec->spec;
1986 spec->autocfg.hp_pins[0] = 0x15;
1987 spec->autocfg.speaker_pins[0] = 0x14;
1988 spec->autocfg.speaker_pins[1] = 0x16;
1989 spec->autocfg.speaker_pins[2] = 0x17;
1990 spec->autocfg.speaker_pins[3] = 0x19;
1991 spec->autocfg.speaker_pins[4] = 0x1a;
1994 static void alc889_intel_init_hook(struct hda_codec *codec)
1996 alc889_coef_init(codec);
1997 alc_automute_amp(codec);
2000 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
2002 struct alc_spec *spec = codec->spec;
2004 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
2005 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
2006 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
2007 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
2011 * ALC888 Acer Aspire 4930G model
2014 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
2015 /* Front Mic: set to PIN_IN (empty by default) */
2016 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2017 /* Unselect Front Mic by default in input mixer 3 */
2018 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2019 /* Enable unsolicited event for HP jack */
2020 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2021 /* Connect Internal HP to front */
2022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2024 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2025 /* Connect HP out to front */
2026 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2027 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2028 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2029 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2034 * ALC888 Acer Aspire 6530G model
2037 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2038 /* Route to built-in subwoofer as well as speakers */
2039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2040 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2041 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2042 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2043 /* Bias voltage on for external mic port */
2044 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2045 /* Front Mic: set to PIN_IN (empty by default) */
2046 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2047 /* Unselect Front Mic by default in input mixer 3 */
2048 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2049 /* Enable unsolicited event for HP jack */
2050 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2051 /* Enable speaker output */
2052 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2053 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2054 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2055 /* Enable headphone output */
2056 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2058 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2059 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2064 *ALC888 Acer Aspire 7730G model
2067 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2068 /* Bias voltage on for external mic port */
2069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2070 /* Front Mic: set to PIN_IN (empty by default) */
2071 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2072 /* Unselect Front Mic by default in input mixer 3 */
2073 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2074 /* Enable unsolicited event for HP jack */
2075 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2076 /* Enable speaker output */
2077 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2078 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2079 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2080 /* Enable headphone output */
2081 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2082 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2083 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2084 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2085 /*Enable internal subwoofer */
2086 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2087 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2088 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2089 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
2094 * ALC889 Acer Aspire 8930G model
2097 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2098 /* Front Mic: set to PIN_IN (empty by default) */
2099 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2100 /* Unselect Front Mic by default in input mixer 3 */
2101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2102 /* Enable unsolicited event for HP jack */
2103 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2104 /* Connect Internal Front to Front */
2105 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2106 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2107 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2108 /* Connect Internal Rear to Rear */
2109 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2110 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2111 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
2112 /* Connect Internal CLFE to CLFE */
2113 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2114 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2115 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
2116 /* Connect HP out to Front */
2117 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2118 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2119 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2120 /* Enable all DACs */
2121 /* DAC DISABLE/MUTE 1? */
2122 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2123 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2124 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2125 /* DAC DISABLE/MUTE 2? */
2126 /* some bit here disables the other DACs. Init=0x4900 */
2127 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2128 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2130 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2131 * which makes the stereo useless. However, either the mic or the ALC889
2132 * makes the signal become a difference/sum signal instead of standard
2133 * stereo, which is annoying. So instead we flip this bit which makes the
2134 * codec replicate the sum signal to both channels, turning it into a
2137 /* DMIC_CONTROL? Init value = 0x0001 */
2138 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2139 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2143 static struct hda_input_mux alc888_2_capture_sources[2] = {
2144 /* Front mic only available on one ADC */
2151 { "Front Mic", 0xb },
2164 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2165 /* Interal mic only available on one ADC */
2172 { "Input Mix", 0xa },
2173 { "Internal Mic", 0xb },
2182 { "Input Mix", 0xa },
2187 static struct hda_input_mux alc889_capture_sources[3] = {
2188 /* Digital mic only available on first "ADC" */
2195 { "Front Mic", 0xb },
2196 { "Input Mix", 0xa },
2205 { "Input Mix", 0xa },
2214 { "Input Mix", 0xa },
2219 static struct snd_kcontrol_new alc888_base_mixer[] = {
2220 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2221 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2222 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2223 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2224 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2226 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2227 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2228 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2229 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2230 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2231 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2232 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2236 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2241 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2243 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2244 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2245 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2246 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2248 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2249 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2250 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2251 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2252 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2254 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2255 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2260 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2262 struct alc_spec *spec = codec->spec;
2264 spec->autocfg.hp_pins[0] = 0x15;
2265 spec->autocfg.speaker_pins[0] = 0x14;
2266 spec->autocfg.speaker_pins[1] = 0x16;
2267 spec->autocfg.speaker_pins[2] = 0x17;
2270 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2272 struct alc_spec *spec = codec->spec;
2274 spec->autocfg.hp_pins[0] = 0x15;
2275 spec->autocfg.speaker_pins[0] = 0x14;
2276 spec->autocfg.speaker_pins[1] = 0x16;
2277 spec->autocfg.speaker_pins[2] = 0x17;
2280 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2282 struct alc_spec *spec = codec->spec;
2284 spec->autocfg.hp_pins[0] = 0x15;
2285 spec->autocfg.speaker_pins[0] = 0x14;
2286 spec->autocfg.speaker_pins[1] = 0x16;
2287 spec->autocfg.speaker_pins[2] = 0x17;
2290 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2292 struct alc_spec *spec = codec->spec;
2294 spec->autocfg.hp_pins[0] = 0x15;
2295 spec->autocfg.speaker_pins[0] = 0x14;
2296 spec->autocfg.speaker_pins[1] = 0x16;
2297 spec->autocfg.speaker_pins[2] = 0x1b;
2301 * ALC880 3-stack model
2303 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2304 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2305 * F-Mic = 0x1b, HP = 0x19
2308 static hda_nid_t alc880_dac_nids[4] = {
2309 /* front, rear, clfe, rear_surr */
2310 0x02, 0x05, 0x04, 0x03
2313 static hda_nid_t alc880_adc_nids[3] = {
2318 /* The datasheet says the node 0x07 is connected from inputs,
2319 * but it shows zero connection in the real implementation on some devices.
2320 * Note: this is a 915GAV bug, fixed on 915GLV
2322 static hda_nid_t alc880_adc_nids_alt[2] = {
2327 #define ALC880_DIGOUT_NID 0x06
2328 #define ALC880_DIGIN_NID 0x0a
2330 static struct hda_input_mux alc880_capture_source = {
2334 { "Front Mic", 0x3 },
2340 /* channel source setting (2/6 channel selection for 3-stack) */
2342 static struct hda_verb alc880_threestack_ch2_init[] = {
2343 /* set line-in to input, mute it */
2344 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2345 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2346 /* set mic-in to input vref 80%, mute it */
2347 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2348 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2353 static struct hda_verb alc880_threestack_ch6_init[] = {
2354 /* set line-in to output, unmute it */
2355 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2356 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2357 /* set mic-in to output, unmute it */
2358 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2359 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2363 static struct hda_channel_mode alc880_threestack_modes[2] = {
2364 { 2, alc880_threestack_ch2_init },
2365 { 6, alc880_threestack_ch6_init },
2368 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2369 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2370 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2371 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2372 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2373 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2374 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2375 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2376 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2377 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2378 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2379 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2380 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2382 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2383 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2384 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2385 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2387 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2388 .name = "Channel Mode",
2389 .info = alc_ch_mode_info,
2390 .get = alc_ch_mode_get,
2391 .put = alc_ch_mode_put,
2396 /* capture mixer elements */
2397 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2398 struct snd_ctl_elem_info *uinfo)
2400 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2401 struct alc_spec *spec = codec->spec;
2404 mutex_lock(&codec->control_mutex);
2405 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2407 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2408 mutex_unlock(&codec->control_mutex);
2412 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2413 unsigned int size, unsigned int __user *tlv)
2415 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2416 struct alc_spec *spec = codec->spec;
2419 mutex_lock(&codec->control_mutex);
2420 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2422 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2423 mutex_unlock(&codec->control_mutex);
2427 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2428 struct snd_ctl_elem_value *ucontrol);
2430 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2431 struct snd_ctl_elem_value *ucontrol,
2434 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2435 struct alc_spec *spec = codec->spec;
2436 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2439 mutex_lock(&codec->control_mutex);
2440 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2442 err = func(kcontrol, ucontrol);
2443 mutex_unlock(&codec->control_mutex);
2447 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2448 struct snd_ctl_elem_value *ucontrol)
2450 return alc_cap_getput_caller(kcontrol, ucontrol,
2451 snd_hda_mixer_amp_volume_get);
2454 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2455 struct snd_ctl_elem_value *ucontrol)
2457 return alc_cap_getput_caller(kcontrol, ucontrol,
2458 snd_hda_mixer_amp_volume_put);
2461 /* capture mixer elements */
2462 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2464 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2465 struct snd_ctl_elem_value *ucontrol)
2467 return alc_cap_getput_caller(kcontrol, ucontrol,
2468 snd_hda_mixer_amp_switch_get);
2471 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2472 struct snd_ctl_elem_value *ucontrol)
2474 return alc_cap_getput_caller(kcontrol, ucontrol,
2475 snd_hda_mixer_amp_switch_put);
2478 #define _DEFINE_CAPMIX(num) \
2480 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2481 .name = "Capture Switch", \
2482 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2484 .info = alc_cap_sw_info, \
2485 .get = alc_cap_sw_get, \
2486 .put = alc_cap_sw_put, \
2489 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2490 .name = "Capture Volume", \
2491 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2492 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2493 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2495 .info = alc_cap_vol_info, \
2496 .get = alc_cap_vol_get, \
2497 .put = alc_cap_vol_put, \
2498 .tlv = { .c = alc_cap_vol_tlv }, \
2501 #define _DEFINE_CAPSRC(num) \
2503 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2504 /* .name = "Capture Source", */ \
2505 .name = "Input Source", \
2507 .info = alc_mux_enum_info, \
2508 .get = alc_mux_enum_get, \
2509 .put = alc_mux_enum_put, \
2512 #define DEFINE_CAPMIX(num) \
2513 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2514 _DEFINE_CAPMIX(num), \
2515 _DEFINE_CAPSRC(num), \
2519 #define DEFINE_CAPMIX_NOSRC(num) \
2520 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2521 _DEFINE_CAPMIX(num), \
2525 /* up to three ADCs */
2529 DEFINE_CAPMIX_NOSRC(1);
2530 DEFINE_CAPMIX_NOSRC(2);
2531 DEFINE_CAPMIX_NOSRC(3);
2534 * ALC880 5-stack model
2536 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2538 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2539 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2542 /* additional mixers to alc880_three_stack_mixer */
2543 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2544 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2545 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2549 /* channel source setting (6/8 channel selection for 5-stack) */
2551 static struct hda_verb alc880_fivestack_ch6_init[] = {
2552 /* set line-in to input, mute it */
2553 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2554 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2559 static struct hda_verb alc880_fivestack_ch8_init[] = {
2560 /* set line-in to output, unmute it */
2561 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2562 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2566 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2567 { 6, alc880_fivestack_ch6_init },
2568 { 8, alc880_fivestack_ch8_init },
2573 * ALC880 6-stack model
2575 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2576 * Side = 0x05 (0x0f)
2577 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2578 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2581 static hda_nid_t alc880_6st_dac_nids[4] = {
2582 /* front, rear, clfe, rear_surr */
2583 0x02, 0x03, 0x04, 0x05
2586 static struct hda_input_mux alc880_6stack_capture_source = {
2590 { "Front Mic", 0x1 },
2596 /* fixed 8-channels */
2597 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2601 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2602 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2603 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2604 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2605 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2606 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2607 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2608 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2609 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2610 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2611 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2612 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2613 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2614 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2615 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2618 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2619 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2621 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2622 .name = "Channel Mode",
2623 .info = alc_ch_mode_info,
2624 .get = alc_ch_mode_get,
2625 .put = alc_ch_mode_put,
2634 * W810 has rear IO for:
2637 * Center/LFE (DAC 04)
2640 * The system also has a pair of internal speakers, and a headphone jack.
2641 * These are both connected to Line2 on the codec, hence to DAC 02.
2643 * There is a variable resistor to control the speaker or headphone
2644 * volume. This is a hardware-only device without a software API.
2646 * Plugging headphones in will disable the internal speakers. This is
2647 * implemented in hardware, not via the driver using jack sense. In
2648 * a similar fashion, plugging into the rear socket marked "front" will
2649 * disable both the speakers and headphones.
2651 * For input, there's a microphone jack, and an "audio in" jack.
2652 * These may not do anything useful with this driver yet, because I
2653 * haven't setup any initialization verbs for these yet...
2656 static hda_nid_t alc880_w810_dac_nids[3] = {
2657 /* front, rear/surround, clfe */
2661 /* fixed 6 channels */
2662 static struct hda_channel_mode alc880_w810_modes[1] = {
2666 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2667 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2668 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2669 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2670 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2671 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2672 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2673 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2674 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2675 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2684 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2685 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2689 static hda_nid_t alc880_z71v_dac_nids[1] = {
2692 #define ALC880_Z71V_HP_DAC 0x03
2694 /* fixed 2 channels */
2695 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2699 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2700 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2701 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2702 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2703 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2704 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2705 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2706 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2707 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2713 * ALC880 F1734 model
2715 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2716 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2719 static hda_nid_t alc880_f1734_dac_nids[1] = {
2722 #define ALC880_F1734_HP_DAC 0x02
2724 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2725 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2726 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2727 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2728 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2729 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2730 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2731 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2732 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2736 static struct hda_input_mux alc880_f1734_capture_source = {
2748 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2749 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2750 * Mic = 0x18, Line = 0x1a
2753 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2754 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2756 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2757 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2758 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2759 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2760 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2761 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2762 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2763 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2764 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2765 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2766 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2767 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2768 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2772 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2773 .name = "Channel Mode",
2774 .info = alc_ch_mode_info,
2775 .get = alc_ch_mode_get,
2776 .put = alc_ch_mode_put,
2782 * ALC880 ASUS W1V model
2784 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2785 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2786 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2789 /* additional mixers to alc880_asus_mixer */
2790 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2791 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2792 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2797 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2798 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2799 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2800 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2801 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2802 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2805 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2806 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2811 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2812 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2813 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2814 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2815 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2816 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2817 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2818 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2819 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2820 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2821 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2822 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2823 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2826 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2827 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2829 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2830 .name = "Channel Mode",
2831 .info = alc_ch_mode_info,
2832 .get = alc_ch_mode_get,
2833 .put = alc_ch_mode_put,
2838 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2839 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2840 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2841 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2842 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2843 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2844 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2845 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2846 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2847 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2848 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2852 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2853 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2854 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2855 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2856 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2857 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2858 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2863 * virtual master controls
2867 * slave controls for virtual master
2869 static const char *alc_slave_vols[] = {
2870 "Front Playback Volume",
2871 "Surround Playback Volume",
2872 "Center Playback Volume",
2873 "LFE Playback Volume",
2874 "Side Playback Volume",
2875 "Headphone Playback Volume",
2876 "Speaker Playback Volume",
2877 "Mono Playback Volume",
2878 "Line-Out Playback Volume",
2879 "PCM Playback Volume",
2883 static const char *alc_slave_sws[] = {
2884 "Front Playback Switch",
2885 "Surround Playback Switch",
2886 "Center Playback Switch",
2887 "LFE Playback Switch",
2888 "Side Playback Switch",
2889 "Headphone Playback Switch",
2890 "Speaker Playback Switch",
2891 "Mono Playback Switch",
2892 "IEC958 Playback Switch",
2893 "Line-Out Playback Switch",
2894 "PCM Playback Switch",
2899 * build control elements
2902 #define NID_MAPPING (-1)
2904 #define SUBDEV_SPEAKER_ (0 << 6)
2905 #define SUBDEV_HP_ (1 << 6)
2906 #define SUBDEV_LINE_ (2 << 6)
2907 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2908 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2909 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2911 static void alc_free_kctls(struct hda_codec *codec);
2913 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2914 /* additional beep mixers; the actual parameters are overwritten at build */
2915 static struct snd_kcontrol_new alc_beep_mixer[] = {
2916 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2917 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2922 static int alc_build_controls(struct hda_codec *codec)
2924 struct alc_spec *spec = codec->spec;
2925 struct snd_kcontrol *kctl = NULL;
2926 struct snd_kcontrol_new *knew;
2931 for (i = 0; i < spec->num_mixers; i++) {
2932 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2936 if (spec->cap_mixer) {
2937 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2941 if (spec->multiout.dig_out_nid) {
2942 err = snd_hda_create_spdif_out_ctls(codec,
2943 spec->multiout.dig_out_nid);
2946 if (!spec->no_analog) {
2947 err = snd_hda_create_spdif_share_sw(codec,
2951 spec->multiout.share_spdif = 1;
2954 if (spec->dig_in_nid) {
2955 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2960 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2961 /* create beep controls if needed */
2962 if (spec->beep_amp) {
2963 struct snd_kcontrol_new *knew;
2964 for (knew = alc_beep_mixer; knew->name; knew++) {
2965 struct snd_kcontrol *kctl;
2966 kctl = snd_ctl_new1(knew, codec);
2969 kctl->private_value = spec->beep_amp;
2970 err = snd_hda_ctl_add(codec, 0, kctl);
2977 /* if we have no master control, let's create it */
2978 if (!spec->no_analog &&
2979 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2980 unsigned int vmaster_tlv[4];
2981 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2982 HDA_OUTPUT, vmaster_tlv);
2983 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2984 vmaster_tlv, alc_slave_vols);
2988 if (!spec->no_analog &&
2989 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2990 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2991 NULL, alc_slave_sws);
2996 /* assign Capture Source enums to NID */
2997 if (spec->capsrc_nids || spec->adc_nids) {
2998 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
3000 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3001 for (i = 0; kctl && i < kctl->count; i++) {
3002 hda_nid_t *nids = spec->capsrc_nids;
3004 nids = spec->adc_nids;
3005 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
3010 if (spec->cap_mixer) {
3011 const char *kname = kctl ? kctl->id.name : NULL;
3012 for (knew = spec->cap_mixer; knew->name; knew++) {
3013 if (kname && strcmp(knew->name, kname) == 0)
3015 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3016 for (i = 0; kctl && i < kctl->count; i++) {
3017 err = snd_hda_add_nid(codec, kctl, i,
3025 /* other nid->control mapping */
3026 for (i = 0; i < spec->num_mixers; i++) {
3027 for (knew = spec->mixers[i]; knew->name; knew++) {
3028 if (knew->iface != NID_MAPPING)
3030 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3033 u = knew->subdevice;
3034 for (j = 0; j < 4; j++, u >>= 8) {
3039 case SUBDEV_SPEAKER_:
3040 nid = spec->autocfg.speaker_pins[nid];
3043 nid = spec->autocfg.line_out_pins[nid];
3046 nid = spec->autocfg.hp_pins[nid];
3051 err = snd_hda_add_nid(codec, kctl, 0, nid);
3055 u = knew->private_value;
3056 for (j = 0; j < 4; j++, u >>= 8) {
3060 err = snd_hda_add_nid(codec, kctl, 0, nid);
3067 alc_free_kctls(codec); /* no longer needed */
3074 * initialize the codec volumes, etc
3078 * generic initialization of ADC, input mixers and output mixers
3080 static struct hda_verb alc880_volume_init_verbs[] = {
3082 * Unmute ADC0-2 and set the default input to mic-in
3084 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3085 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3086 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3087 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3088 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3089 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3091 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3093 * Note: PASD motherboards uses the Line In 2 as the input for front
3096 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3097 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3098 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3099 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3103 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3106 * Set up output mixers (0x0c - 0x0f)
3108 /* set vol=0 to output mixers */
3109 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3110 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3111 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3112 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3113 /* set up input amps for analog loopback */
3114 /* Amp Indices: DAC = 0, mixer = 1 */
3115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3117 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3118 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3119 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3120 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3121 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3122 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3128 * 3-stack pin configuration:
3129 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3131 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3133 * preset connection lists of input pins
3134 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3136 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3137 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3138 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3141 * Set pin mode and muting
3143 /* set front pin widgets 0x14 for output */
3144 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3145 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3146 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3147 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3148 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3149 /* Mic2 (as headphone out) for HP output */
3150 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3151 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3152 /* Line In pin widget for input */
3153 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3154 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3155 /* Line2 (as front mic) pin widget for input and vref at 80% */
3156 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3157 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3158 /* CD pin widget for input */
3159 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3165 * 5-stack pin configuration:
3166 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3167 * line-in/side = 0x1a, f-mic = 0x1b
3169 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3171 * preset connection lists of input pins
3172 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3174 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3175 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3178 * Set pin mode and muting
3180 /* set pin widgets 0x14-0x17 for output */
3181 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3183 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3184 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3185 /* unmute pins for output (no gain on this amp) */
3186 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3187 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3188 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3189 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3191 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3192 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3193 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3194 /* Mic2 (as headphone out) for HP output */
3195 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3196 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3197 /* Line In pin widget for input */
3198 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3199 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3200 /* Line2 (as front mic) pin widget for input and vref at 80% */
3201 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3202 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3203 /* CD pin widget for input */
3204 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3210 * W810 pin configuration:
3211 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3213 static struct hda_verb alc880_pin_w810_init_verbs[] = {
3214 /* hphone/speaker input selector: front DAC */
3215 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3218 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3219 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3220 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3221 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3222 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3224 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3225 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3231 * Z71V pin configuration:
3232 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3234 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3236 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3237 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3238 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3240 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3241 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3242 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3243 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3249 * 6-stack pin configuration:
3250 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3251 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3253 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3254 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3256 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3257 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3260 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3261 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3262 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3263 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3265 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3266 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3269 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3270 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3271 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3272 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3273 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3279 * Uniwill pin configuration:
3280 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3283 static struct hda_verb alc880_uniwill_init_verbs[] = {
3284 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3286 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3287 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3288 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3289 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3290 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3291 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3292 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3293 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3294 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3296 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3301 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3302 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3303 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3304 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3305 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3306 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3307 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3308 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3309 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3311 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3312 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3319 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3321 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3322 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3325 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3327 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3328 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3329 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3333 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3335 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3337 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3338 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3339 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3340 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3341 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3342 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3344 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3345 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3350 static struct hda_verb alc880_beep_init_verbs[] = {
3351 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3355 /* auto-toggle front mic */
3356 static void alc88x_simple_mic_automute(struct hda_codec *codec)
3358 unsigned int present;
3361 present = snd_hda_jack_detect(codec, 0x18);
3362 bits = present ? HDA_AMP_MUTE : 0;
3363 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3366 static void alc880_uniwill_setup(struct hda_codec *codec)
3368 struct alc_spec *spec = codec->spec;
3370 spec->autocfg.hp_pins[0] = 0x14;
3371 spec->autocfg.speaker_pins[0] = 0x15;
3372 spec->autocfg.speaker_pins[0] = 0x16;
3375 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3377 alc_automute_amp(codec);
3378 alc88x_simple_mic_automute(codec);
3381 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3384 /* Looks like the unsol event is incompatible with the standard
3385 * definition. 4bit tag is placed at 28 bit!
3387 switch (res >> 28) {
3388 case ALC880_MIC_EVENT:
3389 alc88x_simple_mic_automute(codec);
3392 alc_automute_amp_unsol_event(codec, res);
3397 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3399 struct alc_spec *spec = codec->spec;
3401 spec->autocfg.hp_pins[0] = 0x14;
3402 spec->autocfg.speaker_pins[0] = 0x15;
3405 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3407 unsigned int present;
3409 present = snd_hda_codec_read(codec, 0x21, 0,
3410 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3411 present &= HDA_AMP_VOLMASK;
3412 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3413 HDA_AMP_VOLMASK, present);
3414 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3415 HDA_AMP_VOLMASK, present);
3418 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3421 /* Looks like the unsol event is incompatible with the standard
3422 * definition. 4bit tag is placed at 28 bit!
3424 if ((res >> 28) == ALC880_DCVOL_EVENT)
3425 alc880_uniwill_p53_dcvol_automute(codec);
3427 alc_automute_amp_unsol_event(codec, res);
3431 * F1734 pin configuration:
3432 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3434 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3435 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3436 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3437 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3438 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3439 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3441 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3442 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3444 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3446 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3447 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3448 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3449 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3450 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3451 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3452 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3453 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3454 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3456 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3457 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3463 * ASUS pin configuration:
3464 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3466 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3467 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3468 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3469 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3470 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3475 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3476 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3477 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3478 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3479 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3481 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3482 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3483 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3484 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3485 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3486 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3487 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3488 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3489 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3494 /* Enable GPIO mask and set output */
3495 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3496 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3497 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3499 /* Clevo m520g init */
3500 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3501 /* headphone output */
3502 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3507 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3508 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3510 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3511 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3512 /* Mic1 (rear panel) */
3513 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3514 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3515 /* Mic2 (front panel) */
3516 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3517 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3519 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3520 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3521 /* change to EAPD mode */
3522 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3523 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3528 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3529 /* change to EAPD mode */
3530 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3531 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3533 /* Headphone output */
3534 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3536 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3537 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3539 /* Line In pin widget for input */
3540 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3541 /* CD pin widget for input */
3542 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3543 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3544 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3546 /* change to EAPD mode */
3547 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3548 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3554 * LG m1 express dual
3557 * Rear Line-In/Out (blue): 0x14
3558 * Build-in Mic-In: 0x15
3560 * HP-Out (green): 0x1b
3561 * Mic-In/Out (red): 0x19
3565 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3566 static hda_nid_t alc880_lg_dac_nids[3] = {
3570 /* seems analog CD is not working */
3571 static struct hda_input_mux alc880_lg_capture_source = {
3576 { "Internal Mic", 0x6 },
3580 /* 2,4,6 channel modes */
3581 static struct hda_verb alc880_lg_ch2_init[] = {
3582 /* set line-in and mic-in to input */
3583 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3584 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3588 static struct hda_verb alc880_lg_ch4_init[] = {
3589 /* set line-in to out and mic-in to input */
3590 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3591 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3595 static struct hda_verb alc880_lg_ch6_init[] = {
3596 /* set line-in and mic-in to output */
3597 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3598 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3602 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3603 { 2, alc880_lg_ch2_init },
3604 { 4, alc880_lg_ch4_init },
3605 { 6, alc880_lg_ch6_init },
3608 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3609 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3610 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3611 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3612 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3613 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3614 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3615 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3616 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3618 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3619 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3620 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3621 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3622 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3624 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3625 .name = "Channel Mode",
3626 .info = alc_ch_mode_info,
3627 .get = alc_ch_mode_get,
3628 .put = alc_ch_mode_put,
3633 static struct hda_verb alc880_lg_init_verbs[] = {
3634 /* set capture source to mic-in */
3635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3636 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3637 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3638 /* mute all amp mixer inputs */
3639 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3642 /* line-in to input */
3643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3644 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3646 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3647 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3649 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3650 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3651 /* mic-in to input */
3652 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3653 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3654 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3656 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3657 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3658 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3660 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3664 /* toggle speaker-output according to the hp-jack state */
3665 static void alc880_lg_setup(struct hda_codec *codec)
3667 struct alc_spec *spec = codec->spec;
3669 spec->autocfg.hp_pins[0] = 0x1b;
3670 spec->autocfg.speaker_pins[0] = 0x17;
3679 * Built-in Mic-In: 0x19
3685 static struct hda_input_mux alc880_lg_lw_capture_source = {
3689 { "Internal Mic", 0x1 },
3694 #define alc880_lg_lw_modes alc880_threestack_modes
3696 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3697 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3698 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3699 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3700 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3701 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3702 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3703 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3704 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3705 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3706 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3709 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3710 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3712 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3713 .name = "Channel Mode",
3714 .info = alc_ch_mode_info,
3715 .get = alc_ch_mode_get,
3716 .put = alc_ch_mode_put,
3721 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3722 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3723 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3724 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3726 /* set capture source to mic-in */
3727 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3728 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3729 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3732 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3733 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3735 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3736 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3737 /* mic-in to input */
3738 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3739 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3744 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3748 /* toggle speaker-output according to the hp-jack state */
3749 static void alc880_lg_lw_setup(struct hda_codec *codec)
3751 struct alc_spec *spec = codec->spec;
3753 spec->autocfg.hp_pins[0] = 0x1b;
3754 spec->autocfg.speaker_pins[0] = 0x14;
3757 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3758 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3759 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3762 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3763 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3767 static struct hda_input_mux alc880_medion_rim_capture_source = {
3771 { "Internal Mic", 0x1 },
3775 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3776 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3778 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3779 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3781 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3782 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3783 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3784 /* Mic2 (as headphone out) for HP output */
3785 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3786 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3787 /* Internal Speaker */
3788 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3789 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3791 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3792 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3794 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3798 /* toggle speaker-output according to the hp-jack state */
3799 static void alc880_medion_rim_automute(struct hda_codec *codec)
3801 struct alc_spec *spec = codec->spec;
3802 alc_automute_amp(codec);
3804 if (spec->jack_present)
3805 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3807 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3810 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3813 /* Looks like the unsol event is incompatible with the standard
3814 * definition. 4bit tag is placed at 28 bit!
3816 if ((res >> 28) == ALC880_HP_EVENT)
3817 alc880_medion_rim_automute(codec);
3820 static void alc880_medion_rim_setup(struct hda_codec *codec)
3822 struct alc_spec *spec = codec->spec;
3824 spec->autocfg.hp_pins[0] = 0x14;
3825 spec->autocfg.speaker_pins[0] = 0x1b;
3828 #ifdef CONFIG_SND_HDA_POWER_SAVE
3829 static struct hda_amp_list alc880_loopbacks[] = {
3830 { 0x0b, HDA_INPUT, 0 },
3831 { 0x0b, HDA_INPUT, 1 },
3832 { 0x0b, HDA_INPUT, 2 },
3833 { 0x0b, HDA_INPUT, 3 },
3834 { 0x0b, HDA_INPUT, 4 },
3838 static struct hda_amp_list alc880_lg_loopbacks[] = {
3839 { 0x0b, HDA_INPUT, 1 },
3840 { 0x0b, HDA_INPUT, 6 },
3841 { 0x0b, HDA_INPUT, 7 },
3850 static int alc_init(struct hda_codec *codec)
3852 struct alc_spec *spec = codec->spec;
3856 alc_auto_init_amp(codec, spec->init_amp);
3858 for (i = 0; i < spec->num_init_verbs; i++)
3859 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3861 if (spec->init_hook)
3862 spec->init_hook(codec);
3864 hda_call_check_power_status(codec, 0x01);
3868 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3870 struct alc_spec *spec = codec->spec;
3872 if (spec->unsol_event)
3873 spec->unsol_event(codec, res);
3876 #ifdef CONFIG_SND_HDA_POWER_SAVE
3877 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3879 struct alc_spec *spec = codec->spec;
3880 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3885 * Analog playback callbacks
3887 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3888 struct hda_codec *codec,
3889 struct snd_pcm_substream *substream)
3891 struct alc_spec *spec = codec->spec;
3892 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3896 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3897 struct hda_codec *codec,
3898 unsigned int stream_tag,
3899 unsigned int format,
3900 struct snd_pcm_substream *substream)
3902 struct alc_spec *spec = codec->spec;
3903 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3904 stream_tag, format, substream);
3907 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3908 struct hda_codec *codec,
3909 struct snd_pcm_substream *substream)
3911 struct alc_spec *spec = codec->spec;
3912 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3918 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3919 struct hda_codec *codec,
3920 struct snd_pcm_substream *substream)
3922 struct alc_spec *spec = codec->spec;
3923 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3926 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3927 struct hda_codec *codec,
3928 unsigned int stream_tag,
3929 unsigned int format,
3930 struct snd_pcm_substream *substream)
3932 struct alc_spec *spec = codec->spec;
3933 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3934 stream_tag, format, substream);
3937 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3938 struct hda_codec *codec,
3939 struct snd_pcm_substream *substream)
3941 struct alc_spec *spec = codec->spec;
3942 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3945 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3946 struct hda_codec *codec,
3947 struct snd_pcm_substream *substream)
3949 struct alc_spec *spec = codec->spec;
3950 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3956 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3957 struct hda_codec *codec,
3958 unsigned int stream_tag,
3959 unsigned int format,
3960 struct snd_pcm_substream *substream)
3962 struct alc_spec *spec = codec->spec;
3964 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3965 stream_tag, 0, format);
3969 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3970 struct hda_codec *codec,
3971 struct snd_pcm_substream *substream)
3973 struct alc_spec *spec = codec->spec;
3975 snd_hda_codec_cleanup_stream(codec,
3976 spec->adc_nids[substream->number + 1]);
3980 /* analog capture with dynamic dual-adc changes */
3981 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3982 struct hda_codec *codec,
3983 unsigned int stream_tag,
3984 unsigned int format,
3985 struct snd_pcm_substream *substream)
3987 struct alc_spec *spec = codec->spec;
3988 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
3989 spec->cur_adc_stream_tag = stream_tag;
3990 spec->cur_adc_format = format;
3991 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
3995 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3996 struct hda_codec *codec,
3997 struct snd_pcm_substream *substream)
3999 struct alc_spec *spec = codec->spec;
4000 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
4005 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
4009 .nid = 0, /* fill later */
4011 .prepare = dualmic_capture_pcm_prepare,
4012 .cleanup = dualmic_capture_pcm_cleanup
4018 static struct hda_pcm_stream alc880_pcm_analog_playback = {
4022 /* NID is set in alc_build_pcms */
4024 .open = alc880_playback_pcm_open,
4025 .prepare = alc880_playback_pcm_prepare,
4026 .cleanup = alc880_playback_pcm_cleanup
4030 static struct hda_pcm_stream alc880_pcm_analog_capture = {
4034 /* NID is set in alc_build_pcms */
4037 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4041 /* NID is set in alc_build_pcms */
4044 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4045 .substreams = 2, /* can be overridden */
4048 /* NID is set in alc_build_pcms */
4050 .prepare = alc880_alt_capture_pcm_prepare,
4051 .cleanup = alc880_alt_capture_pcm_cleanup
4055 static struct hda_pcm_stream alc880_pcm_digital_playback = {
4059 /* NID is set in alc_build_pcms */
4061 .open = alc880_dig_playback_pcm_open,
4062 .close = alc880_dig_playback_pcm_close,
4063 .prepare = alc880_dig_playback_pcm_prepare,
4064 .cleanup = alc880_dig_playback_pcm_cleanup
4068 static struct hda_pcm_stream alc880_pcm_digital_capture = {
4072 /* NID is set in alc_build_pcms */
4075 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4076 static struct hda_pcm_stream alc_pcm_null_stream = {
4082 static int alc_build_pcms(struct hda_codec *codec)
4084 struct alc_spec *spec = codec->spec;
4085 struct hda_pcm *info = spec->pcm_rec;
4088 codec->num_pcms = 1;
4089 codec->pcm_info = info;
4091 if (spec->no_analog)
4094 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4095 "%s Analog", codec->chip_name);
4096 info->name = spec->stream_name_analog;
4098 if (spec->stream_analog_playback) {
4099 if (snd_BUG_ON(!spec->multiout.dac_nids))
4101 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4102 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4104 if (spec->stream_analog_capture) {
4105 if (snd_BUG_ON(!spec->adc_nids))
4107 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4108 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4111 if (spec->channel_mode) {
4112 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4113 for (i = 0; i < spec->num_channel_mode; i++) {
4114 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4115 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4121 /* SPDIF for stream index #1 */
4122 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4123 snprintf(spec->stream_name_digital,
4124 sizeof(spec->stream_name_digital),
4125 "%s Digital", codec->chip_name);
4126 codec->num_pcms = 2;
4127 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4128 info = spec->pcm_rec + 1;
4129 info->name = spec->stream_name_digital;
4130 if (spec->dig_out_type)
4131 info->pcm_type = spec->dig_out_type;
4133 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4134 if (spec->multiout.dig_out_nid &&
4135 spec->stream_digital_playback) {
4136 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4137 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4139 if (spec->dig_in_nid &&
4140 spec->stream_digital_capture) {
4141 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4142 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4144 /* FIXME: do we need this for all Realtek codec models? */
4145 codec->spdif_status_reset = 1;
4148 if (spec->no_analog)
4151 /* If the use of more than one ADC is requested for the current
4152 * model, configure a second analog capture-only PCM.
4154 /* Additional Analaog capture for index #2 */
4155 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4156 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4157 codec->num_pcms = 3;
4158 info = spec->pcm_rec + 2;
4159 info->name = spec->stream_name_analog;
4160 if (spec->alt_dac_nid) {
4161 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4162 *spec->stream_analog_alt_playback;
4163 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4166 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4167 alc_pcm_null_stream;
4168 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4170 if (spec->num_adc_nids > 1) {
4171 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4172 *spec->stream_analog_alt_capture;
4173 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4175 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4176 spec->num_adc_nids - 1;
4178 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4179 alc_pcm_null_stream;
4180 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4187 static inline void alc_shutup(struct hda_codec *codec)
4189 snd_hda_shutup_pins(codec);
4192 static void alc_free_kctls(struct hda_codec *codec)
4194 struct alc_spec *spec = codec->spec;
4196 if (spec->kctls.list) {
4197 struct snd_kcontrol_new *kctl = spec->kctls.list;
4199 for (i = 0; i < spec->kctls.used; i++)
4200 kfree(kctl[i].name);
4202 snd_array_free(&spec->kctls);
4205 static void alc_free(struct hda_codec *codec)
4207 struct alc_spec *spec = codec->spec;
4213 alc_free_kctls(codec);
4215 snd_hda_detach_beep_device(codec);
4218 #ifdef CONFIG_SND_HDA_POWER_SAVE
4219 static void alc_power_eapd(struct hda_codec *codec)
4221 /* We currently only handle front, HP */
4222 switch (codec->vendor_id) {
4224 set_eapd(codec, 0x0f, 0);
4225 set_eapd(codec, 0x10, 0);
4238 set_eapd(codec, 0x14, 0);
4239 set_eapd(codec, 0x15, 0);
4244 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4246 struct alc_spec *spec = codec->spec;
4248 if (spec && spec->power_hook)
4249 spec->power_hook(codec);
4254 #ifdef SND_HDA_NEEDS_RESUME
4255 static int alc_resume(struct hda_codec *codec)
4257 codec->patch_ops.init(codec);
4258 snd_hda_codec_resume_amp(codec);
4259 snd_hda_codec_resume_cache(codec);
4260 hda_call_check_power_status(codec, 0x01);
4267 static struct hda_codec_ops alc_patch_ops = {
4268 .build_controls = alc_build_controls,
4269 .build_pcms = alc_build_pcms,
4272 .unsol_event = alc_unsol_event,
4273 #ifdef SND_HDA_NEEDS_RESUME
4274 .resume = alc_resume,
4276 #ifdef CONFIG_SND_HDA_POWER_SAVE
4277 .suspend = alc_suspend,
4278 .check_power_status = alc_check_power_status,
4280 .reboot_notify = alc_shutup,
4283 /* replace the codec chip_name with the given string */
4284 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4286 kfree(codec->chip_name);
4287 codec->chip_name = kstrdup(name, GFP_KERNEL);
4288 if (!codec->chip_name) {
4296 * Test configuration for debugging
4298 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4301 #ifdef CONFIG_SND_DEBUG
4302 static hda_nid_t alc880_test_dac_nids[4] = {
4303 0x02, 0x03, 0x04, 0x05
4306 static struct hda_input_mux alc880_test_capture_source = {
4315 { "Surround", 0x6 },
4319 static struct hda_channel_mode alc880_test_modes[4] = {
4326 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4327 struct snd_ctl_elem_info *uinfo)
4329 static char *texts[] = {
4330 "N/A", "Line Out", "HP Out",
4331 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4333 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4335 uinfo->value.enumerated.items = 8;
4336 if (uinfo->value.enumerated.item >= 8)
4337 uinfo->value.enumerated.item = 7;
4338 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4342 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4343 struct snd_ctl_elem_value *ucontrol)
4345 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4346 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4347 unsigned int pin_ctl, item = 0;
4349 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4350 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4351 if (pin_ctl & AC_PINCTL_OUT_EN) {
4352 if (pin_ctl & AC_PINCTL_HP_EN)
4356 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4357 switch (pin_ctl & AC_PINCTL_VREFEN) {
4358 case AC_PINCTL_VREF_HIZ: item = 3; break;
4359 case AC_PINCTL_VREF_50: item = 4; break;
4360 case AC_PINCTL_VREF_GRD: item = 5; break;
4361 case AC_PINCTL_VREF_80: item = 6; break;
4362 case AC_PINCTL_VREF_100: item = 7; break;
4365 ucontrol->value.enumerated.item[0] = item;
4369 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4370 struct snd_ctl_elem_value *ucontrol)
4372 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4373 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4374 static unsigned int ctls[] = {
4375 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4376 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4377 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4378 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4379 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4380 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4382 unsigned int old_ctl, new_ctl;
4384 old_ctl = snd_hda_codec_read(codec, nid, 0,
4385 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4386 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4387 if (old_ctl != new_ctl) {
4389 snd_hda_codec_write_cache(codec, nid, 0,
4390 AC_VERB_SET_PIN_WIDGET_CONTROL,
4392 val = ucontrol->value.enumerated.item[0] >= 3 ?
4394 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4401 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4402 struct snd_ctl_elem_info *uinfo)
4404 static char *texts[] = {
4405 "Front", "Surround", "CLFE", "Side"
4407 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4409 uinfo->value.enumerated.items = 4;
4410 if (uinfo->value.enumerated.item >= 4)
4411 uinfo->value.enumerated.item = 3;
4412 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4416 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4417 struct snd_ctl_elem_value *ucontrol)
4419 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4420 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4423 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4424 ucontrol->value.enumerated.item[0] = sel & 3;
4428 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4429 struct snd_ctl_elem_value *ucontrol)
4431 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4432 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4435 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4436 if (ucontrol->value.enumerated.item[0] != sel) {
4437 sel = ucontrol->value.enumerated.item[0] & 3;
4438 snd_hda_codec_write_cache(codec, nid, 0,
4439 AC_VERB_SET_CONNECT_SEL, sel);
4445 #define PIN_CTL_TEST(xname,nid) { \
4446 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4448 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4449 .info = alc_test_pin_ctl_info, \
4450 .get = alc_test_pin_ctl_get, \
4451 .put = alc_test_pin_ctl_put, \
4452 .private_value = nid \
4455 #define PIN_SRC_TEST(xname,nid) { \
4456 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4458 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4459 .info = alc_test_pin_src_info, \
4460 .get = alc_test_pin_src_get, \
4461 .put = alc_test_pin_src_put, \
4462 .private_value = nid \
4465 static struct snd_kcontrol_new alc880_test_mixer[] = {
4466 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4467 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4468 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4469 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4470 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4471 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4472 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4473 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4474 PIN_CTL_TEST("Front Pin Mode", 0x14),
4475 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4476 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4477 PIN_CTL_TEST("Side Pin Mode", 0x17),
4478 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4479 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4480 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4481 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4482 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4483 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4484 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4485 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4486 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4487 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4488 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4489 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4490 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4491 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4492 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4493 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4494 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4495 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4497 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4498 .name = "Channel Mode",
4499 .info = alc_ch_mode_info,
4500 .get = alc_ch_mode_get,
4501 .put = alc_ch_mode_put,
4506 static struct hda_verb alc880_test_init_verbs[] = {
4507 /* Unmute inputs of 0x0c - 0x0f */
4508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4509 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4510 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4511 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4512 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4513 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4514 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4515 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4516 /* Vol output for 0x0c-0x0f */
4517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4518 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4519 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4520 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4521 /* Set output pins 0x14-0x17 */
4522 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4523 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4524 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4525 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4526 /* Unmute output pins 0x14-0x17 */
4527 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4528 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4529 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4530 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4531 /* Set input pins 0x18-0x1c */
4532 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4533 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4534 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4535 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4536 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4537 /* Mute input pins 0x18-0x1b */
4538 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4539 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4540 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4541 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4544 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4545 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4546 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4547 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4548 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4549 /* Analog input/passthru */
4550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4551 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4552 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4553 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4554 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4562 static const char *alc880_models[ALC880_MODEL_LAST] = {
4563 [ALC880_3ST] = "3stack",
4564 [ALC880_TCL_S700] = "tcl",
4565 [ALC880_3ST_DIG] = "3stack-digout",
4566 [ALC880_CLEVO] = "clevo",
4567 [ALC880_5ST] = "5stack",
4568 [ALC880_5ST_DIG] = "5stack-digout",
4569 [ALC880_W810] = "w810",
4570 [ALC880_Z71V] = "z71v",
4571 [ALC880_6ST] = "6stack",
4572 [ALC880_6ST_DIG] = "6stack-digout",
4573 [ALC880_ASUS] = "asus",
4574 [ALC880_ASUS_W1V] = "asus-w1v",
4575 [ALC880_ASUS_DIG] = "asus-dig",
4576 [ALC880_ASUS_DIG2] = "asus-dig2",
4577 [ALC880_UNIWILL_DIG] = "uniwill",
4578 [ALC880_UNIWILL_P53] = "uniwill-p53",
4579 [ALC880_FUJITSU] = "fujitsu",
4580 [ALC880_F1734] = "F1734",
4582 [ALC880_LG_LW] = "lg-lw",
4583 [ALC880_MEDION_RIM] = "medion",
4584 #ifdef CONFIG_SND_DEBUG
4585 [ALC880_TEST] = "test",
4587 [ALC880_AUTO] = "auto",
4590 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4591 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4592 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4593 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4594 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4595 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4596 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4597 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4598 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4599 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4600 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4601 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4602 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4603 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4604 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4605 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4606 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4607 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4608 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4609 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4610 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4611 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4612 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4613 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4614 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4615 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4616 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4617 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4618 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4619 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4620 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4621 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4622 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4623 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4624 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4625 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4626 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4627 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4628 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4629 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4630 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4631 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4632 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4633 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4634 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4635 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4636 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4637 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4638 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4639 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4640 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4641 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4642 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4643 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4644 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
4645 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4646 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4647 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4648 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4649 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4650 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4651 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4652 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4653 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4654 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4655 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4656 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4657 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4658 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4659 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4661 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4662 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4663 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4668 * ALC880 codec presets
4670 static struct alc_config_preset alc880_presets[] = {
4672 .mixers = { alc880_three_stack_mixer },
4673 .init_verbs = { alc880_volume_init_verbs,
4674 alc880_pin_3stack_init_verbs },
4675 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4676 .dac_nids = alc880_dac_nids,
4677 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4678 .channel_mode = alc880_threestack_modes,
4680 .input_mux = &alc880_capture_source,
4682 [ALC880_3ST_DIG] = {
4683 .mixers = { alc880_three_stack_mixer },
4684 .init_verbs = { alc880_volume_init_verbs,
4685 alc880_pin_3stack_init_verbs },
4686 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4687 .dac_nids = alc880_dac_nids,
4688 .dig_out_nid = ALC880_DIGOUT_NID,
4689 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4690 .channel_mode = alc880_threestack_modes,
4692 .input_mux = &alc880_capture_source,
4694 [ALC880_TCL_S700] = {
4695 .mixers = { alc880_tcl_s700_mixer },
4696 .init_verbs = { alc880_volume_init_verbs,
4697 alc880_pin_tcl_S700_init_verbs,
4698 alc880_gpio2_init_verbs },
4699 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4700 .dac_nids = alc880_dac_nids,
4701 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4702 .num_adc_nids = 1, /* single ADC */
4704 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4705 .channel_mode = alc880_2_jack_modes,
4706 .input_mux = &alc880_capture_source,
4709 .mixers = { alc880_three_stack_mixer,
4710 alc880_five_stack_mixer},
4711 .init_verbs = { alc880_volume_init_verbs,
4712 alc880_pin_5stack_init_verbs },
4713 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4714 .dac_nids = alc880_dac_nids,
4715 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4716 .channel_mode = alc880_fivestack_modes,
4717 .input_mux = &alc880_capture_source,
4719 [ALC880_5ST_DIG] = {
4720 .mixers = { alc880_three_stack_mixer,
4721 alc880_five_stack_mixer },
4722 .init_verbs = { alc880_volume_init_verbs,
4723 alc880_pin_5stack_init_verbs },
4724 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4725 .dac_nids = alc880_dac_nids,
4726 .dig_out_nid = ALC880_DIGOUT_NID,
4727 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4728 .channel_mode = alc880_fivestack_modes,
4729 .input_mux = &alc880_capture_source,
4732 .mixers = { alc880_six_stack_mixer },
4733 .init_verbs = { alc880_volume_init_verbs,
4734 alc880_pin_6stack_init_verbs },
4735 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4736 .dac_nids = alc880_6st_dac_nids,
4737 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4738 .channel_mode = alc880_sixstack_modes,
4739 .input_mux = &alc880_6stack_capture_source,
4741 [ALC880_6ST_DIG] = {
4742 .mixers = { alc880_six_stack_mixer },
4743 .init_verbs = { alc880_volume_init_verbs,
4744 alc880_pin_6stack_init_verbs },
4745 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4746 .dac_nids = alc880_6st_dac_nids,
4747 .dig_out_nid = ALC880_DIGOUT_NID,
4748 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4749 .channel_mode = alc880_sixstack_modes,
4750 .input_mux = &alc880_6stack_capture_source,
4753 .mixers = { alc880_w810_base_mixer },
4754 .init_verbs = { alc880_volume_init_verbs,
4755 alc880_pin_w810_init_verbs,
4756 alc880_gpio2_init_verbs },
4757 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4758 .dac_nids = alc880_w810_dac_nids,
4759 .dig_out_nid = ALC880_DIGOUT_NID,
4760 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4761 .channel_mode = alc880_w810_modes,
4762 .input_mux = &alc880_capture_source,
4765 .mixers = { alc880_z71v_mixer },
4766 .init_verbs = { alc880_volume_init_verbs,
4767 alc880_pin_z71v_init_verbs },
4768 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4769 .dac_nids = alc880_z71v_dac_nids,
4770 .dig_out_nid = ALC880_DIGOUT_NID,
4772 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4773 .channel_mode = alc880_2_jack_modes,
4774 .input_mux = &alc880_capture_source,
4777 .mixers = { alc880_f1734_mixer },
4778 .init_verbs = { alc880_volume_init_verbs,
4779 alc880_pin_f1734_init_verbs },
4780 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4781 .dac_nids = alc880_f1734_dac_nids,
4783 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4784 .channel_mode = alc880_2_jack_modes,
4785 .input_mux = &alc880_f1734_capture_source,
4786 .unsol_event = alc880_uniwill_p53_unsol_event,
4787 .setup = alc880_uniwill_p53_setup,
4788 .init_hook = alc_automute_amp,
4791 .mixers = { alc880_asus_mixer },
4792 .init_verbs = { alc880_volume_init_verbs,
4793 alc880_pin_asus_init_verbs,
4794 alc880_gpio1_init_verbs },
4795 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4796 .dac_nids = alc880_asus_dac_nids,
4797 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4798 .channel_mode = alc880_asus_modes,
4800 .input_mux = &alc880_capture_source,
4802 [ALC880_ASUS_DIG] = {
4803 .mixers = { alc880_asus_mixer },
4804 .init_verbs = { alc880_volume_init_verbs,
4805 alc880_pin_asus_init_verbs,
4806 alc880_gpio1_init_verbs },
4807 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4808 .dac_nids = alc880_asus_dac_nids,
4809 .dig_out_nid = ALC880_DIGOUT_NID,
4810 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4811 .channel_mode = alc880_asus_modes,
4813 .input_mux = &alc880_capture_source,
4815 [ALC880_ASUS_DIG2] = {
4816 .mixers = { alc880_asus_mixer },
4817 .init_verbs = { alc880_volume_init_verbs,
4818 alc880_pin_asus_init_verbs,
4819 alc880_gpio2_init_verbs }, /* use GPIO2 */
4820 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4821 .dac_nids = alc880_asus_dac_nids,
4822 .dig_out_nid = ALC880_DIGOUT_NID,
4823 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4824 .channel_mode = alc880_asus_modes,
4826 .input_mux = &alc880_capture_source,
4828 [ALC880_ASUS_W1V] = {
4829 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4830 .init_verbs = { alc880_volume_init_verbs,
4831 alc880_pin_asus_init_verbs,
4832 alc880_gpio1_init_verbs },
4833 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4834 .dac_nids = alc880_asus_dac_nids,
4835 .dig_out_nid = ALC880_DIGOUT_NID,
4836 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4837 .channel_mode = alc880_asus_modes,
4839 .input_mux = &alc880_capture_source,
4841 [ALC880_UNIWILL_DIG] = {
4842 .mixers = { alc880_asus_mixer },
4843 .init_verbs = { alc880_volume_init_verbs,
4844 alc880_pin_asus_init_verbs },
4845 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4846 .dac_nids = alc880_asus_dac_nids,
4847 .dig_out_nid = ALC880_DIGOUT_NID,
4848 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4849 .channel_mode = alc880_asus_modes,
4851 .input_mux = &alc880_capture_source,
4853 [ALC880_UNIWILL] = {
4854 .mixers = { alc880_uniwill_mixer },
4855 .init_verbs = { alc880_volume_init_verbs,
4856 alc880_uniwill_init_verbs },
4857 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4858 .dac_nids = alc880_asus_dac_nids,
4859 .dig_out_nid = ALC880_DIGOUT_NID,
4860 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4861 .channel_mode = alc880_threestack_modes,
4863 .input_mux = &alc880_capture_source,
4864 .unsol_event = alc880_uniwill_unsol_event,
4865 .setup = alc880_uniwill_setup,
4866 .init_hook = alc880_uniwill_init_hook,
4868 [ALC880_UNIWILL_P53] = {
4869 .mixers = { alc880_uniwill_p53_mixer },
4870 .init_verbs = { alc880_volume_init_verbs,
4871 alc880_uniwill_p53_init_verbs },
4872 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4873 .dac_nids = alc880_asus_dac_nids,
4874 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4875 .channel_mode = alc880_threestack_modes,
4876 .input_mux = &alc880_capture_source,
4877 .unsol_event = alc880_uniwill_p53_unsol_event,
4878 .setup = alc880_uniwill_p53_setup,
4879 .init_hook = alc_automute_amp,
4881 [ALC880_FUJITSU] = {
4882 .mixers = { alc880_fujitsu_mixer },
4883 .init_verbs = { alc880_volume_init_verbs,
4884 alc880_uniwill_p53_init_verbs,
4885 alc880_beep_init_verbs },
4886 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4887 .dac_nids = alc880_dac_nids,
4888 .dig_out_nid = ALC880_DIGOUT_NID,
4889 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4890 .channel_mode = alc880_2_jack_modes,
4891 .input_mux = &alc880_capture_source,
4892 .unsol_event = alc880_uniwill_p53_unsol_event,
4893 .setup = alc880_uniwill_p53_setup,
4894 .init_hook = alc_automute_amp,
4897 .mixers = { alc880_three_stack_mixer },
4898 .init_verbs = { alc880_volume_init_verbs,
4899 alc880_pin_clevo_init_verbs },
4900 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4901 .dac_nids = alc880_dac_nids,
4903 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4904 .channel_mode = alc880_threestack_modes,
4906 .input_mux = &alc880_capture_source,
4909 .mixers = { alc880_lg_mixer },
4910 .init_verbs = { alc880_volume_init_verbs,
4911 alc880_lg_init_verbs },
4912 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4913 .dac_nids = alc880_lg_dac_nids,
4914 .dig_out_nid = ALC880_DIGOUT_NID,
4915 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4916 .channel_mode = alc880_lg_ch_modes,
4918 .input_mux = &alc880_lg_capture_source,
4919 .unsol_event = alc_automute_amp_unsol_event,
4920 .setup = alc880_lg_setup,
4921 .init_hook = alc_automute_amp,
4922 #ifdef CONFIG_SND_HDA_POWER_SAVE
4923 .loopbacks = alc880_lg_loopbacks,
4927 .mixers = { alc880_lg_lw_mixer },
4928 .init_verbs = { alc880_volume_init_verbs,
4929 alc880_lg_lw_init_verbs },
4930 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4931 .dac_nids = alc880_dac_nids,
4932 .dig_out_nid = ALC880_DIGOUT_NID,
4933 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4934 .channel_mode = alc880_lg_lw_modes,
4935 .input_mux = &alc880_lg_lw_capture_source,
4936 .unsol_event = alc_automute_amp_unsol_event,
4937 .setup = alc880_lg_lw_setup,
4938 .init_hook = alc_automute_amp,
4940 [ALC880_MEDION_RIM] = {
4941 .mixers = { alc880_medion_rim_mixer },
4942 .init_verbs = { alc880_volume_init_verbs,
4943 alc880_medion_rim_init_verbs,
4944 alc_gpio2_init_verbs },
4945 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4946 .dac_nids = alc880_dac_nids,
4947 .dig_out_nid = ALC880_DIGOUT_NID,
4948 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4949 .channel_mode = alc880_2_jack_modes,
4950 .input_mux = &alc880_medion_rim_capture_source,
4951 .unsol_event = alc880_medion_rim_unsol_event,
4952 .setup = alc880_medion_rim_setup,
4953 .init_hook = alc880_medion_rim_automute,
4955 #ifdef CONFIG_SND_DEBUG
4957 .mixers = { alc880_test_mixer },
4958 .init_verbs = { alc880_test_init_verbs },
4959 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4960 .dac_nids = alc880_test_dac_nids,
4961 .dig_out_nid = ALC880_DIGOUT_NID,
4962 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4963 .channel_mode = alc880_test_modes,
4964 .input_mux = &alc880_test_capture_source,
4970 * Automatic parse of I/O pins from the BIOS configuration
4975 ALC_CTL_WIDGET_MUTE,
4978 static struct snd_kcontrol_new alc880_control_templates[] = {
4979 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4980 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4981 HDA_BIND_MUTE(NULL, 0, 0, 0),
4984 /* add dynamic controls */
4985 static int add_control(struct alc_spec *spec, int type, const char *name,
4986 int cidx, unsigned long val)
4988 struct snd_kcontrol_new *knew;
4990 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4991 knew = snd_array_new(&spec->kctls);
4994 *knew = alc880_control_templates[type];
4995 knew->name = kstrdup(name, GFP_KERNEL);
4999 if (get_amp_nid_(val))
5000 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
5001 knew->private_value = val;
5005 static int add_control_with_pfx(struct alc_spec *spec, int type,
5006 const char *pfx, const char *dir,
5007 const char *sfx, int cidx, unsigned long val)
5010 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
5011 return add_control(spec, type, name, cidx, val);
5014 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5015 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5016 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5017 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5018 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5019 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5020 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5021 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5023 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5024 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5025 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5026 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5027 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5028 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5029 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5030 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5031 #define ALC880_PIN_CD_NID 0x1c
5033 /* fill in the dac_nids table from the parsed pin configuration */
5034 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
5035 const struct auto_pin_cfg *cfg)
5041 memset(assigned, 0, sizeof(assigned));
5042 spec->multiout.dac_nids = spec->private_dac_nids;
5044 /* check the pins hardwired to audio widget */
5045 for (i = 0; i < cfg->line_outs; i++) {
5046 nid = cfg->line_out_pins[i];
5047 if (alc880_is_fixed_pin(nid)) {
5048 int idx = alc880_fixed_pin_idx(nid);
5049 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
5053 /* left pins can be connect to any audio widget */
5054 for (i = 0; i < cfg->line_outs; i++) {
5055 nid = cfg->line_out_pins[i];
5056 if (alc880_is_fixed_pin(nid))
5058 /* search for an empty channel */
5059 for (j = 0; j < cfg->line_outs; j++) {
5061 spec->multiout.dac_nids[i] =
5062 alc880_idx_to_dac(j);
5068 spec->multiout.num_dacs = cfg->line_outs;
5072 static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5075 if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5078 switch (cfg->line_out_type) {
5079 case AUTO_PIN_SPEAKER_OUT:
5081 case AUTO_PIN_HP_OUT:
5084 if (cfg->line_outs == 1)
5091 /* add playback controls from the parsed DAC table */
5092 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5093 const struct auto_pin_cfg *cfg)
5095 static const char *chname[4] = {
5096 "Front", "Surround", NULL /*CLFE*/, "Side"
5098 const char *pfx = alc_get_line_out_pfx(cfg, false);
5102 for (i = 0; i < cfg->line_outs; i++) {
5103 if (!spec->multiout.dac_nids[i])
5105 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5106 if (!pfx && i == 2) {
5108 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5110 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5114 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5116 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5120 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5122 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5126 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5128 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5133 const char *name = pfx;
5136 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5138 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5142 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5144 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5153 /* add playback controls for speaker and HP outputs */
5154 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5163 if (alc880_is_fixed_pin(pin)) {
5164 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5165 /* specify the DAC as the extra output */
5166 if (!spec->multiout.hp_nid)
5167 spec->multiout.hp_nid = nid;
5169 spec->multiout.extra_out_nid[0] = nid;
5170 /* control HP volume/switch on the output mixer amp */
5171 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5172 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5173 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5176 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5177 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5180 } else if (alc880_is_multi_pin(pin)) {
5181 /* set manual connection */
5182 /* we have only a switch on HP-out PIN */
5183 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5184 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5191 /* create input playback/capture controls for the given pin */
5192 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5193 const char *ctlname, int ctlidx,
5194 int idx, hda_nid_t mix_nid)
5198 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5199 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5202 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5203 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5209 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5211 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5212 return (pincap & AC_PINCAP_IN) != 0;
5215 /* create playback/capture controls for input pins */
5216 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5217 const struct auto_pin_cfg *cfg,
5219 hda_nid_t cap1, hda_nid_t cap2)
5221 struct alc_spec *spec = codec->spec;
5222 struct hda_input_mux *imux = &spec->private_imux[0];
5223 int i, err, idx, type_idx = 0;
5224 const char *prev_label = NULL;
5226 for (i = 0; i < cfg->num_inputs; i++) {
5230 pin = cfg->inputs[i].pin;
5231 if (!alc_is_input_pin(codec, pin))
5234 label = hda_get_autocfg_input_label(codec, cfg, i);
5235 if (prev_label && !strcmp(label, prev_label))
5242 idx = get_connection_index(codec, mixer, pin);
5244 err = new_analog_input(spec, pin,
5254 idx = get_connection_index(codec, cap1, pin);
5255 if (idx < 0 && cap2)
5256 idx = get_connection_index(codec, cap2, pin);
5258 snd_hda_add_imux_item(imux, label, idx, NULL);
5263 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5264 const struct auto_pin_cfg *cfg)
5266 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5269 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5270 unsigned int pin_type)
5272 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5275 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5279 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5280 hda_nid_t nid, int pin_type,
5283 alc_set_pin_output(codec, nid, pin_type);
5284 /* need the manual connection? */
5285 if (alc880_is_multi_pin(nid)) {
5286 struct alc_spec *spec = codec->spec;
5287 int idx = alc880_multi_pin_idx(nid);
5288 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5289 AC_VERB_SET_CONNECT_SEL,
5290 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5294 static int get_pin_type(int line_out_type)
5296 if (line_out_type == AUTO_PIN_HP_OUT)
5302 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5304 struct alc_spec *spec = codec->spec;
5307 for (i = 0; i < spec->autocfg.line_outs; i++) {
5308 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5309 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5310 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5314 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5316 struct alc_spec *spec = codec->spec;
5319 pin = spec->autocfg.speaker_pins[0];
5320 if (pin) /* connect to front */
5321 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5322 pin = spec->autocfg.hp_pins[0];
5323 if (pin) /* connect to front */
5324 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5327 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5329 struct alc_spec *spec = codec->spec;
5330 struct auto_pin_cfg *cfg = &spec->autocfg;
5333 for (i = 0; i < cfg->num_inputs; i++) {
5334 hda_nid_t nid = cfg->inputs[i].pin;
5335 if (alc_is_input_pin(codec, nid)) {
5336 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5337 if (nid != ALC880_PIN_CD_NID &&
5338 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5339 snd_hda_codec_write(codec, nid, 0,
5340 AC_VERB_SET_AMP_GAIN_MUTE,
5346 static void alc880_auto_init_input_src(struct hda_codec *codec)
5348 struct alc_spec *spec = codec->spec;
5351 for (c = 0; c < spec->num_adc_nids; c++) {
5352 unsigned int mux_idx;
5353 const struct hda_input_mux *imux;
5354 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5355 imux = &spec->input_mux[mux_idx];
5356 if (!imux->num_items && mux_idx > 0)
5357 imux = &spec->input_mux[0];
5359 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5360 AC_VERB_SET_CONNECT_SEL,
5361 imux->items[0].index);
5365 /* parse the BIOS configuration and set up the alc_spec */
5366 /* return 1 if successful, 0 if the proper config is not found,
5367 * or a negative error code
5369 static int alc880_parse_auto_config(struct hda_codec *codec)
5371 struct alc_spec *spec = codec->spec;
5373 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5375 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5379 if (!spec->autocfg.line_outs)
5380 return 0; /* can't find valid BIOS pin config */
5382 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5385 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5388 err = alc880_auto_create_extra_out(spec,
5389 spec->autocfg.speaker_pins[0],
5393 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5397 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5401 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5403 alc_auto_parse_digital(codec);
5405 if (spec->kctls.list)
5406 add_mixer(spec, spec->kctls.list);
5408 add_verb(spec, alc880_volume_init_verbs);
5410 spec->num_mux_defs = 1;
5411 spec->input_mux = &spec->private_imux[0];
5413 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5418 /* additional initialization for auto-configuration model */
5419 static void alc880_auto_init(struct hda_codec *codec)
5421 struct alc_spec *spec = codec->spec;
5422 alc880_auto_init_multi_out(codec);
5423 alc880_auto_init_extra_out(codec);
5424 alc880_auto_init_analog_input(codec);
5425 alc880_auto_init_input_src(codec);
5426 alc_auto_init_digital(codec);
5427 if (spec->unsol_event)
5428 alc_inithook(codec);
5431 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5432 * one of two digital mic pins, e.g. on ALC272
5434 static void fixup_automic_adc(struct hda_codec *codec)
5436 struct alc_spec *spec = codec->spec;
5439 for (i = 0; i < spec->num_adc_nids; i++) {
5440 hda_nid_t cap = spec->capsrc_nids ?
5441 spec->capsrc_nids[i] : spec->adc_nids[i];
5444 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5447 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5450 spec->int_mic.mux_idx = iidx;
5451 spec->ext_mic.mux_idx = eidx;
5452 if (spec->capsrc_nids)
5453 spec->capsrc_nids += i;
5454 spec->adc_nids += i;
5455 spec->num_adc_nids = 1;
5458 snd_printd(KERN_INFO "hda_codec: %s: "
5459 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5460 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5461 spec->auto_mic = 0; /* disable auto-mic to be sure */
5464 /* select or unmute the given capsrc route */
5465 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5468 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5469 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5472 snd_hda_codec_write_cache(codec, cap, 0,
5473 AC_VERB_SET_CONNECT_SEL, idx);
5477 /* set the default connection to that pin */
5478 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5480 struct alc_spec *spec = codec->spec;
5483 for (i = 0; i < spec->num_adc_nids; i++) {
5484 hda_nid_t cap = spec->capsrc_nids ?
5485 spec->capsrc_nids[i] : spec->adc_nids[i];
5488 idx = get_connection_index(codec, cap, pin);
5491 select_or_unmute_capsrc(codec, cap, idx);
5492 return i; /* return the found index */
5494 return -1; /* not found */
5497 /* choose the ADC/MUX containing the input pin and initialize the setup */
5498 static void fixup_single_adc(struct hda_codec *codec)
5500 struct alc_spec *spec = codec->spec;
5501 struct auto_pin_cfg *cfg = &spec->autocfg;
5504 /* search for the input pin; there must be only one */
5505 if (cfg->num_inputs != 1)
5507 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5509 /* use only this ADC */
5510 if (spec->capsrc_nids)
5511 spec->capsrc_nids += i;
5512 spec->adc_nids += i;
5513 spec->num_adc_nids = 1;
5517 /* initialize dual adcs */
5518 static void fixup_dual_adc_switch(struct hda_codec *codec)
5520 struct alc_spec *spec = codec->spec;
5521 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5522 init_capsrc_for_pin(codec, spec->int_mic.pin);
5525 static void set_capture_mixer(struct hda_codec *codec)
5527 struct alc_spec *spec = codec->spec;
5528 static struct snd_kcontrol_new *caps[2][3] = {
5529 { alc_capture_mixer_nosrc1,
5530 alc_capture_mixer_nosrc2,
5531 alc_capture_mixer_nosrc3 },
5532 { alc_capture_mixer1,
5534 alc_capture_mixer3 },
5536 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5538 int num_adcs = spec->num_adc_nids;
5539 if (spec->dual_adc_switch)
5540 fixup_dual_adc_switch(codec);
5541 else if (spec->auto_mic)
5542 fixup_automic_adc(codec);
5543 else if (spec->input_mux) {
5544 if (spec->input_mux->num_items > 1)
5546 else if (spec->input_mux->num_items == 1)
5547 fixup_single_adc(codec);
5549 if (spec->dual_adc_switch)
5551 spec->cap_mixer = caps[mux][num_adcs - 1];
5555 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5556 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5559 struct alc_spec *spec = codec->spec;
5560 struct auto_pin_cfg *cfg = &spec->autocfg;
5562 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5564 for (n = 0; n < num_nids; n++) {
5566 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5570 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5573 nconns = snd_hda_get_connections(codec, cap, conn,
5577 nconns = snd_hda_get_connections(codec, cap, conn,
5582 if (!fallback_adc) {
5586 for (i = 0; i < cfg->num_inputs; i++) {
5587 hda_nid_t nid = cfg->inputs[i].pin;
5588 for (j = 0; j < nconns; j++) {
5595 if (i >= cfg->num_inputs) {
5596 int num_adcs = spec->num_adc_nids;
5597 spec->private_adc_nids[num_adcs] = adc;
5598 spec->private_capsrc_nids[num_adcs] = cap;
5599 spec->num_adc_nids++;
5600 spec->adc_nids = spec->private_adc_nids;
5602 spec->capsrc_nids = spec->private_capsrc_nids;
5605 if (!spec->num_adc_nids) {
5606 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5607 " using fallback 0x%x\n",
5608 codec->chip_name, fallback_adc);
5609 spec->private_adc_nids[0] = fallback_adc;
5610 spec->adc_nids = spec->private_adc_nids;
5611 if (fallback_adc != fallback_cap) {
5612 spec->private_capsrc_nids[0] = fallback_cap;
5613 spec->capsrc_nids = spec->private_adc_nids;
5618 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5619 #define set_beep_amp(spec, nid, idx, dir) \
5620 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5622 static struct snd_pci_quirk beep_white_list[] = {
5623 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5624 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5625 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5629 static inline int has_cdefine_beep(struct hda_codec *codec)
5631 struct alc_spec *spec = codec->spec;
5632 const struct snd_pci_quirk *q;
5633 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5636 return spec->cdefine.enable_pcbeep;
5639 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5640 #define has_cdefine_beep(codec) 0
5644 * OK, here we have finally the patch for ALC880
5647 static int patch_alc880(struct hda_codec *codec)
5649 struct alc_spec *spec;
5653 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5659 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5662 if (board_config < 0) {
5663 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5665 board_config = ALC880_AUTO;
5668 if (board_config == ALC880_AUTO) {
5669 /* automatic parse from the BIOS config */
5670 err = alc880_parse_auto_config(codec);
5676 "hda_codec: Cannot set up configuration "
5677 "from BIOS. Using 3-stack mode...\n");
5678 board_config = ALC880_3ST;
5682 err = snd_hda_attach_beep_device(codec, 0x1);
5688 if (board_config != ALC880_AUTO)
5689 setup_preset(codec, &alc880_presets[board_config]);
5691 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5692 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5693 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5695 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5696 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5698 if (!spec->adc_nids && spec->input_mux) {
5699 /* check whether NID 0x07 is valid */
5700 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5702 wcap = get_wcaps_type(wcap);
5703 if (wcap != AC_WID_AUD_IN) {
5704 spec->adc_nids = alc880_adc_nids_alt;
5705 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5707 spec->adc_nids = alc880_adc_nids;
5708 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5711 set_capture_mixer(codec);
5712 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5714 spec->vmaster_nid = 0x0c;
5716 codec->patch_ops = alc_patch_ops;
5717 if (board_config == ALC880_AUTO)
5718 spec->init_hook = alc880_auto_init;
5719 #ifdef CONFIG_SND_HDA_POWER_SAVE
5720 if (!spec->loopback.amplist)
5721 spec->loopback.amplist = alc880_loopbacks;
5732 static hda_nid_t alc260_dac_nids[1] = {
5737 static hda_nid_t alc260_adc_nids[1] = {
5742 static hda_nid_t alc260_adc_nids_alt[1] = {
5747 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5748 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5750 static hda_nid_t alc260_dual_adc_nids[2] = {
5755 #define ALC260_DIGOUT_NID 0x03
5756 #define ALC260_DIGIN_NID 0x06
5758 static struct hda_input_mux alc260_capture_source = {
5762 { "Front Mic", 0x1 },
5768 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5769 * headphone jack and the internal CD lines since these are the only pins at
5770 * which audio can appear. For flexibility, also allow the option of
5771 * recording the mixer output on the second ADC (ADC0 doesn't have a
5772 * connection to the mixer output).
5774 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5778 { "Mic/Line", 0x0 },
5780 { "Headphone", 0x2 },
5786 { "Mic/Line", 0x0 },
5788 { "Headphone", 0x2 },
5795 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5796 * the Fujitsu S702x, but jacks are marked differently.
5798 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5805 { "Headphone", 0x5 },
5814 { "Headphone", 0x6 },
5820 /* Maxdata Favorit 100XS */
5821 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5825 { "Line/Mic", 0x0 },
5832 { "Line/Mic", 0x0 },
5840 * This is just place-holder, so there's something for alc_build_pcms to look
5841 * at when it calculates the maximum number of channels. ALC260 has no mixer
5842 * element which allows changing the channel mode, so the verb list is
5845 static struct hda_channel_mode alc260_modes[1] = {
5850 /* Mixer combinations
5852 * basic: base_output + input + pc_beep + capture
5853 * HP: base_output + input + capture_alt
5854 * HP_3013: hp_3013 + input + capture
5855 * fujitsu: fujitsu + capture
5856 * acer: acer + capture
5859 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5860 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5861 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5862 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5863 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5864 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5865 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5869 static struct snd_kcontrol_new alc260_input_mixer[] = {
5870 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5871 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5872 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5873 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5874 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5875 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5876 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5877 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5881 /* update HP, line and mono out pins according to the master switch */
5882 static void alc260_hp_master_update(struct hda_codec *codec,
5883 hda_nid_t hp, hda_nid_t line,
5886 struct alc_spec *spec = codec->spec;
5887 unsigned int val = spec->master_sw ? PIN_HP : 0;
5888 /* change HP and line-out pins */
5889 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5891 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5893 /* mono (speaker) depending on the HP jack sense */
5894 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5895 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5899 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5900 struct snd_ctl_elem_value *ucontrol)
5902 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5903 struct alc_spec *spec = codec->spec;
5904 *ucontrol->value.integer.value = spec->master_sw;
5908 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5909 struct snd_ctl_elem_value *ucontrol)
5911 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5912 struct alc_spec *spec = codec->spec;
5913 int val = !!*ucontrol->value.integer.value;
5914 hda_nid_t hp, line, mono;
5916 if (val == spec->master_sw)
5918 spec->master_sw = val;
5919 hp = (kcontrol->private_value >> 16) & 0xff;
5920 line = (kcontrol->private_value >> 8) & 0xff;
5921 mono = kcontrol->private_value & 0xff;
5922 alc260_hp_master_update(codec, hp, line, mono);
5926 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5928 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5929 .name = "Master Playback Switch",
5930 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5931 .info = snd_ctl_boolean_mono_info,
5932 .get = alc260_hp_master_sw_get,
5933 .put = alc260_hp_master_sw_put,
5934 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5936 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5937 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5938 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5939 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5940 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5942 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5946 static struct hda_verb alc260_hp_unsol_verbs[] = {
5947 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5951 static void alc260_hp_automute(struct hda_codec *codec)
5953 struct alc_spec *spec = codec->spec;
5955 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5956 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5959 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5961 if ((res >> 26) == ALC880_HP_EVENT)
5962 alc260_hp_automute(codec);
5965 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5967 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5968 .name = "Master Playback Switch",
5969 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5970 .info = snd_ctl_boolean_mono_info,
5971 .get = alc260_hp_master_sw_get,
5972 .put = alc260_hp_master_sw_put,
5973 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5975 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5976 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5977 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5978 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5979 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5980 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5981 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5982 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5986 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5987 .ops = &snd_hda_bind_vol,
5989 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5990 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5991 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5996 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5997 .ops = &snd_hda_bind_sw,
5999 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
6000 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
6005 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6006 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6007 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6008 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
6009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6013 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6014 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6018 static void alc260_hp_3013_automute(struct hda_codec *codec)
6020 struct alc_spec *spec = codec->spec;
6022 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
6023 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
6026 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
6029 if ((res >> 26) == ALC880_HP_EVENT)
6030 alc260_hp_3013_automute(codec);
6033 static void alc260_hp_3012_automute(struct hda_codec *codec)
6035 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6037 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6039 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6041 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6045 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6048 if ((res >> 26) == ALC880_HP_EVENT)
6049 alc260_hp_3012_automute(codec);
6052 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6053 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6055 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6056 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6057 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6058 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6059 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6060 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6061 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6062 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6063 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6064 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6065 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6069 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6070 * versions of the ALC260 don't act on requests to enable mic bias from NID
6071 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6072 * datasheet doesn't mention this restriction. At this stage it's not clear
6073 * whether this behaviour is intentional or is a hardware bug in chip
6074 * revisions available in early 2006. Therefore for now allow the
6075 * "Headphone Jack Mode" control to span all choices, but if it turns out
6076 * that the lack of mic bias for this NID is intentional we could change the
6077 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6079 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6080 * don't appear to make the mic bias available from the "line" jack, even
6081 * though the NID used for this jack (0x14) can supply it. The theory is
6082 * that perhaps Acer have included blocking capacitors between the ALC260
6083 * and the output jack. If this turns out to be the case for all such
6084 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6085 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6087 * The C20x Tablet series have a mono internal speaker which is controlled
6088 * via the chip's Mono sum widget and pin complex, so include the necessary
6089 * controls for such models. On models without a "mono speaker" the control
6090 * won't do anything.
6092 static struct snd_kcontrol_new alc260_acer_mixer[] = {
6093 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6094 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6095 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6096 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6098 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6100 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6101 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6103 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6104 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6105 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6106 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6107 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6111 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6113 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6114 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6115 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6116 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6117 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6118 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6119 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6123 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6124 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6126 static struct snd_kcontrol_new alc260_will_mixer[] = {
6127 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6128 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6130 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6131 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6132 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6133 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6134 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6135 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6136 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6140 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6141 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6143 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6144 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6145 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6147 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6148 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6149 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6150 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6151 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6152 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6153 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6158 * initialization verbs
6160 static struct hda_verb alc260_init_verbs[] = {
6161 /* Line In pin widget for input */
6162 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6163 /* CD pin widget for input */
6164 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6165 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6166 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6167 /* Mic2 (front panel) pin widget for input and vref at 80% */
6168 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6169 /* LINE-2 is used for line-out in rear */
6170 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6171 /* select line-out */
6172 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6174 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6176 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6178 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6179 /* mute capture amp left and right */
6180 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6181 /* set connection select to line in (default select for this ADC) */
6182 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6183 /* mute capture amp left and right */
6184 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6185 /* set connection select to line in (default select for this ADC) */
6186 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6187 /* set vol=0 Line-Out mixer amp left and right */
6188 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6189 /* unmute pin widget amp left and right (no gain on this amp) */
6190 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6191 /* set vol=0 HP mixer amp left and right */
6192 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6193 /* unmute pin widget amp left and right (no gain on this amp) */
6194 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6195 /* set vol=0 Mono mixer amp left and right */
6196 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6197 /* unmute pin widget amp left and right (no gain on this amp) */
6198 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6199 /* unmute LINE-2 out pin */
6200 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6201 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6204 /* mute analog inputs */
6205 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6206 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6207 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6208 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6209 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6210 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6211 /* mute Front out path */
6212 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6213 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6214 /* mute Headphone out path */
6215 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6216 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6217 /* mute Mono out path */
6218 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6219 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6223 #if 0 /* should be identical with alc260_init_verbs? */
6224 static struct hda_verb alc260_hp_init_verbs[] = {
6225 /* Headphone and output */
6226 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6228 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6229 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6230 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6231 /* Mic2 (front panel) pin widget for input and vref at 80% */
6232 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6233 /* Line In pin widget for input */
6234 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6235 /* Line-2 pin widget for output */
6236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6237 /* CD pin widget for input */
6238 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6239 /* unmute amp left and right */
6240 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6241 /* set connection select to line in (default select for this ADC) */
6242 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6243 /* unmute Line-Out mixer amp left and right (volume = 0) */
6244 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6245 /* mute pin widget amp left and right (no gain on this amp) */
6246 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6247 /* unmute HP mixer amp left and right (volume = 0) */
6248 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6249 /* mute pin widget amp left and right (no gain on this amp) */
6250 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6251 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6254 /* mute analog inputs */
6255 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6256 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6257 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6258 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6259 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6260 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6261 /* Unmute Front out path */
6262 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6263 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6264 /* Unmute Headphone out path */
6265 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6266 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6267 /* Unmute Mono out path */
6268 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6269 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6274 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6275 /* Line out and output */
6276 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6278 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6279 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6280 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6281 /* Mic2 (front panel) pin widget for input and vref at 80% */
6282 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6283 /* Line In pin widget for input */
6284 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6285 /* Headphone pin widget for output */
6286 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6287 /* CD pin widget for input */
6288 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6289 /* unmute amp left and right */
6290 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6291 /* set connection select to line in (default select for this ADC) */
6292 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6293 /* unmute Line-Out mixer amp left and right (volume = 0) */
6294 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6295 /* mute pin widget amp left and right (no gain on this amp) */
6296 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6297 /* unmute HP mixer amp left and right (volume = 0) */
6298 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6299 /* mute pin widget amp left and right (no gain on this amp) */
6300 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6301 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6304 /* mute analog inputs */
6305 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6306 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6307 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6308 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6309 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6310 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6311 /* Unmute Front out path */
6312 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6313 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6314 /* Unmute Headphone out path */
6315 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6316 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6317 /* Unmute Mono out path */
6318 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6319 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6323 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6324 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6325 * audio = 0x16, internal speaker = 0x10.
6327 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6328 /* Disable all GPIOs */
6329 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6330 /* Internal speaker is connected to headphone pin */
6331 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6332 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6333 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6334 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6335 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6336 /* Ensure all other unused pins are disabled and muted. */
6337 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6338 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6339 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6340 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6341 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6342 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6343 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6344 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6346 /* Disable digital (SPDIF) pins */
6347 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6348 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6350 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6351 * when acting as an output.
6353 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6355 /* Start with output sum widgets muted and their output gains at min */
6356 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6357 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6358 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6359 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6360 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6361 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6362 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6363 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6364 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6366 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6367 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6368 /* Unmute Line1 pin widget output buffer since it starts as an output.
6369 * If the pin mode is changed by the user the pin mode control will
6370 * take care of enabling the pin's input/output buffers as needed.
6371 * Therefore there's no need to enable the input buffer at this
6374 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6375 /* Unmute input buffer of pin widget used for Line-in (no equiv
6378 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6380 /* Mute capture amp left and right */
6381 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6382 /* Set ADC connection select to match default mixer setting - line
6385 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6387 /* Do the same for the second ADC: mute capture input amp and
6388 * set ADC connection to line in (on mic1 pin)
6390 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6391 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6393 /* Mute all inputs to mixer widget (even unconnected ones) */
6394 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6395 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6396 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6401 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6406 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6407 * similar laptops (adapted from Fujitsu init verbs).
6409 static struct hda_verb alc260_acer_init_verbs[] = {
6410 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6411 * the headphone jack. Turn this on and rely on the standard mute
6412 * methods whenever the user wants to turn these outputs off.
6414 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6415 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6416 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6417 /* Internal speaker/Headphone jack is connected to Line-out pin */
6418 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6419 /* Internal microphone/Mic jack is connected to Mic1 pin */
6420 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6421 /* Line In jack is connected to Line1 pin */
6422 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6423 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6424 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6425 /* Ensure all other unused pins are disabled and muted. */
6426 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6427 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6428 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6429 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6430 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6431 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6432 /* Disable digital (SPDIF) pins */
6433 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6434 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6436 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6437 * bus when acting as outputs.
6439 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6440 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6442 /* Start with output sum widgets muted and their output gains at min */
6443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6444 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6446 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6447 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6448 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6449 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6450 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6451 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6453 /* Unmute Line-out pin widget amp left and right
6454 * (no equiv mixer ctrl)
6456 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6457 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6458 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6459 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6460 * inputs. If the pin mode is changed by the user the pin mode control
6461 * will take care of enabling the pin's input/output buffers as needed.
6462 * Therefore there's no need to enable the input buffer at this
6465 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6466 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6468 /* Mute capture amp left and right */
6469 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6470 /* Set ADC connection select to match default mixer setting - mic
6473 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6475 /* Do similar with the second ADC: mute capture input amp and
6476 * set ADC connection to mic to match ALSA's default state.
6478 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6479 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6481 /* Mute all inputs to mixer widget (even unconnected ones) */
6482 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6483 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6484 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6485 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6494 /* Initialisation sequence for Maxdata Favorit 100XS
6495 * (adapted from Acer init verbs).
6497 static struct hda_verb alc260_favorit100_init_verbs[] = {
6498 /* GPIO 0 enables the output jack.
6499 * Turn this on and rely on the standard mute
6500 * methods whenever the user wants to turn these outputs off.
6502 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6503 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6504 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6505 /* Line/Mic input jack is connected to Mic1 pin */
6506 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6507 /* Ensure all other unused pins are disabled and muted. */
6508 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6509 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6510 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6511 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6512 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6513 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6514 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6515 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6516 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6517 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6518 /* Disable digital (SPDIF) pins */
6519 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6520 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6522 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6523 * bus when acting as outputs.
6525 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6526 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6528 /* Start with output sum widgets muted and their output gains at min */
6529 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6530 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6531 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6532 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6533 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6534 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6535 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6536 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6537 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6539 /* Unmute Line-out pin widget amp left and right
6540 * (no equiv mixer ctrl)
6542 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6543 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6544 * inputs. If the pin mode is changed by the user the pin mode control
6545 * will take care of enabling the pin's input/output buffers as needed.
6546 * Therefore there's no need to enable the input buffer at this
6549 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6551 /* Mute capture amp left and right */
6552 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6553 /* Set ADC connection select to match default mixer setting - mic
6556 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6558 /* Do similar with the second ADC: mute capture input amp and
6559 * set ADC connection to mic to match ALSA's default state.
6561 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6562 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6564 /* Mute all inputs to mixer widget (even unconnected ones) */
6565 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6566 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6567 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6569 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6570 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6571 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6572 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6577 static struct hda_verb alc260_will_verbs[] = {
6578 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6579 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6580 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6581 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6582 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6583 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6587 static struct hda_verb alc260_replacer_672v_verbs[] = {
6588 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6589 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6590 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6592 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6593 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6594 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6596 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6600 /* toggle speaker-output according to the hp-jack state */
6601 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6603 unsigned int present;
6605 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6606 present = snd_hda_jack_detect(codec, 0x0f);
6608 snd_hda_codec_write_cache(codec, 0x01, 0,
6609 AC_VERB_SET_GPIO_DATA, 1);
6610 snd_hda_codec_write_cache(codec, 0x0f, 0,
6611 AC_VERB_SET_PIN_WIDGET_CONTROL,
6614 snd_hda_codec_write_cache(codec, 0x01, 0,
6615 AC_VERB_SET_GPIO_DATA, 0);
6616 snd_hda_codec_write_cache(codec, 0x0f, 0,
6617 AC_VERB_SET_PIN_WIDGET_CONTROL,
6622 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6625 if ((res >> 26) == ALC880_HP_EVENT)
6626 alc260_replacer_672v_automute(codec);
6629 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6630 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6631 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6632 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6633 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6634 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6635 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6636 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6637 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6638 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6639 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6643 /* Test configuration for debugging, modelled after the ALC880 test
6646 #ifdef CONFIG_SND_DEBUG
6647 static hda_nid_t alc260_test_dac_nids[1] = {
6650 static hda_nid_t alc260_test_adc_nids[2] = {
6653 /* For testing the ALC260, each input MUX needs its own definition since
6654 * the signal assignments are different. This assumes that the first ADC
6657 static struct hda_input_mux alc260_test_capture_sources[2] = {
6661 { "MIC1 pin", 0x0 },
6662 { "MIC2 pin", 0x1 },
6663 { "LINE1 pin", 0x2 },
6664 { "LINE2 pin", 0x3 },
6666 { "LINE-OUT pin", 0x5 },
6667 { "HP-OUT pin", 0x6 },
6673 { "MIC1 pin", 0x0 },
6674 { "MIC2 pin", 0x1 },
6675 { "LINE1 pin", 0x2 },
6676 { "LINE2 pin", 0x3 },
6679 { "LINE-OUT pin", 0x6 },
6680 { "HP-OUT pin", 0x7 },
6684 static struct snd_kcontrol_new alc260_test_mixer[] = {
6685 /* Output driver widgets */
6686 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6687 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6688 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6689 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6690 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6691 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6693 /* Modes for retasking pin widgets
6694 * Note: the ALC260 doesn't seem to act on requests to enable mic
6695 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6696 * mention this restriction. At this stage it's not clear whether
6697 * this behaviour is intentional or is a hardware bug in chip
6698 * revisions available at least up until early 2006. Therefore for
6699 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6700 * choices, but if it turns out that the lack of mic bias for these
6701 * NIDs is intentional we could change their modes from
6702 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6704 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6705 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6706 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6707 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6708 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6709 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6711 /* Loopback mixer controls */
6712 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6713 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6714 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6715 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6716 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6717 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6718 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6719 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6720 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6721 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6722 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6723 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6724 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6725 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6727 /* Controls for GPIO pins, assuming they are configured as outputs */
6728 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6729 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6730 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6731 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6733 /* Switches to allow the digital IO pins to be enabled. The datasheet
6734 * is ambigious as to which NID is which; testing on laptops which
6735 * make this output available should provide clarification.
6737 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6738 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6740 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6741 * this output to turn on an external amplifier.
6743 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6744 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6748 static struct hda_verb alc260_test_init_verbs[] = {
6749 /* Enable all GPIOs as outputs with an initial value of 0 */
6750 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6751 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6752 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6754 /* Enable retasking pins as output, initially without power amp */
6755 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6756 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6757 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6758 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6759 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6760 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6762 /* Disable digital (SPDIF) pins initially, but users can enable
6763 * them via a mixer switch. In the case of SPDIF-out, this initverb
6764 * payload also sets the generation to 0, output to be in "consumer"
6765 * PCM format, copyright asserted, no pre-emphasis and no validity
6768 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6769 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6771 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6772 * OUT1 sum bus when acting as an output.
6774 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6775 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6776 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6777 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6779 /* Start with output sum widgets muted and their output gains at min */
6780 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6781 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6782 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6783 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6784 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6785 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6786 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6787 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6788 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6790 /* Unmute retasking pin widget output buffers since the default
6791 * state appears to be output. As the pin mode is changed by the
6792 * user the pin mode control will take care of enabling the pin's
6793 * input/output buffers as needed.
6795 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6796 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6797 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6798 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6799 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6800 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6801 /* Also unmute the mono-out pin widget */
6802 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6804 /* Mute capture amp left and right */
6805 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6806 /* Set ADC connection select to match default mixer setting (mic1
6809 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6811 /* Do the same for the second ADC: mute capture input amp and
6812 * set ADC connection to mic1 pin
6814 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6815 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6817 /* Mute all inputs to mixer widget (even unconnected ones) */
6818 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6819 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6820 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6821 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6822 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6823 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6831 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6832 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6834 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6835 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6838 * for BIOS auto-configuration
6841 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6842 const char *pfx, int *vol_bits)
6845 unsigned long vol_val, sw_val;
6848 if (nid >= 0x0f && nid < 0x11) {
6849 nid_vol = nid - 0x7;
6850 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6851 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6852 } else if (nid == 0x11) {
6853 nid_vol = nid - 0x7;
6854 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6855 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6856 } else if (nid >= 0x12 && nid <= 0x15) {
6858 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6859 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6863 if (!(*vol_bits & (1 << nid_vol))) {
6864 /* first control for the volume widget */
6865 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6868 *vol_bits |= (1 << nid_vol);
6870 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6876 /* add playback controls from the parsed DAC table */
6877 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6878 const struct auto_pin_cfg *cfg)
6884 spec->multiout.num_dacs = 1;
6885 spec->multiout.dac_nids = spec->private_dac_nids;
6886 spec->multiout.dac_nids[0] = 0x02;
6888 nid = cfg->line_out_pins[0];
6891 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6893 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6897 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6902 nid = cfg->speaker_pins[0];
6904 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6909 nid = cfg->hp_pins[0];
6911 err = alc260_add_playback_controls(spec, nid, "Headphone",
6919 /* create playback/capture controls for input pins */
6920 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6921 const struct auto_pin_cfg *cfg)
6923 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6926 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6927 hda_nid_t nid, int pin_type,
6930 alc_set_pin_output(codec, nid, pin_type);
6931 /* need the manual connection? */
6933 int idx = nid - 0x12;
6934 snd_hda_codec_write(codec, idx + 0x0b, 0,
6935 AC_VERB_SET_CONNECT_SEL, sel_idx);
6939 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6941 struct alc_spec *spec = codec->spec;
6944 nid = spec->autocfg.line_out_pins[0];
6946 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6947 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6950 nid = spec->autocfg.speaker_pins[0];
6952 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6954 nid = spec->autocfg.hp_pins[0];
6956 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6959 #define ALC260_PIN_CD_NID 0x16
6960 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6962 struct alc_spec *spec = codec->spec;
6963 struct auto_pin_cfg *cfg = &spec->autocfg;
6966 for (i = 0; i < cfg->num_inputs; i++) {
6967 hda_nid_t nid = cfg->inputs[i].pin;
6969 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
6970 if (nid != ALC260_PIN_CD_NID &&
6971 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6972 snd_hda_codec_write(codec, nid, 0,
6973 AC_VERB_SET_AMP_GAIN_MUTE,
6979 #define alc260_auto_init_input_src alc880_auto_init_input_src
6982 * generic initialization of ADC, input mixers and output mixers
6984 static struct hda_verb alc260_volume_init_verbs[] = {
6986 * Unmute ADC0-1 and set the default input to mic-in
6988 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6989 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6990 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6991 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6993 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6995 * Note: PASD motherboards uses the Line In 2 as the input for
6996 * front panel mic (mic 2)
6998 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6999 /* mute analog inputs */
7000 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7001 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7002 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7003 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7004 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7007 * Set up output mixers (0x08 - 0x0a)
7009 /* set vol=0 to output mixers */
7010 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7011 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7012 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7013 /* set up input amps for analog loopback */
7014 /* Amp Indices: DAC = 0, mixer = 1 */
7015 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7016 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7017 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7018 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7019 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7020 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7025 static int alc260_parse_auto_config(struct hda_codec *codec)
7027 struct alc_spec *spec = codec->spec;
7029 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
7031 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7035 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7038 if (!spec->kctls.list)
7039 return 0; /* can't find valid BIOS pin config */
7040 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7044 spec->multiout.max_channels = 2;
7046 if (spec->autocfg.dig_outs)
7047 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7048 if (spec->kctls.list)
7049 add_mixer(spec, spec->kctls.list);
7051 add_verb(spec, alc260_volume_init_verbs);
7053 spec->num_mux_defs = 1;
7054 spec->input_mux = &spec->private_imux[0];
7056 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7061 /* additional initialization for auto-configuration model */
7062 static void alc260_auto_init(struct hda_codec *codec)
7064 struct alc_spec *spec = codec->spec;
7065 alc260_auto_init_multi_out(codec);
7066 alc260_auto_init_analog_input(codec);
7067 alc260_auto_init_input_src(codec);
7068 alc_auto_init_digital(codec);
7069 if (spec->unsol_event)
7070 alc_inithook(codec);
7073 #ifdef CONFIG_SND_HDA_POWER_SAVE
7074 static struct hda_amp_list alc260_loopbacks[] = {
7075 { 0x07, HDA_INPUT, 0 },
7076 { 0x07, HDA_INPUT, 1 },
7077 { 0x07, HDA_INPUT, 2 },
7078 { 0x07, HDA_INPUT, 3 },
7079 { 0x07, HDA_INPUT, 4 },
7091 static const struct alc_fixup alc260_fixups[] = {
7092 [PINFIX_HP_DC5750] = {
7093 .pins = (const struct alc_pincfg[]) {
7094 { 0x11, 0x90130110 }, /* speaker */
7100 static struct snd_pci_quirk alc260_fixup_tbl[] = {
7101 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7106 * ALC260 configurations
7108 static const char *alc260_models[ALC260_MODEL_LAST] = {
7109 [ALC260_BASIC] = "basic",
7111 [ALC260_HP_3013] = "hp-3013",
7112 [ALC260_HP_DC7600] = "hp-dc7600",
7113 [ALC260_FUJITSU_S702X] = "fujitsu",
7114 [ALC260_ACER] = "acer",
7115 [ALC260_WILL] = "will",
7116 [ALC260_REPLACER_672V] = "replacer",
7117 [ALC260_FAVORIT100] = "favorit100",
7118 #ifdef CONFIG_SND_DEBUG
7119 [ALC260_TEST] = "test",
7121 [ALC260_AUTO] = "auto",
7124 static struct snd_pci_quirk alc260_cfg_tbl[] = {
7125 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7126 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7127 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7128 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7129 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7130 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7131 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7132 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7133 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7134 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7135 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7136 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7137 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7138 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7139 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7140 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7141 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7142 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7143 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7144 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7148 static struct alc_config_preset alc260_presets[] = {
7150 .mixers = { alc260_base_output_mixer,
7151 alc260_input_mixer },
7152 .init_verbs = { alc260_init_verbs },
7153 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7154 .dac_nids = alc260_dac_nids,
7155 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7156 .adc_nids = alc260_dual_adc_nids,
7157 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7158 .channel_mode = alc260_modes,
7159 .input_mux = &alc260_capture_source,
7162 .mixers = { alc260_hp_output_mixer,
7163 alc260_input_mixer },
7164 .init_verbs = { alc260_init_verbs,
7165 alc260_hp_unsol_verbs },
7166 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7167 .dac_nids = alc260_dac_nids,
7168 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7169 .adc_nids = alc260_adc_nids_alt,
7170 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7171 .channel_mode = alc260_modes,
7172 .input_mux = &alc260_capture_source,
7173 .unsol_event = alc260_hp_unsol_event,
7174 .init_hook = alc260_hp_automute,
7176 [ALC260_HP_DC7600] = {
7177 .mixers = { alc260_hp_dc7600_mixer,
7178 alc260_input_mixer },
7179 .init_verbs = { alc260_init_verbs,
7180 alc260_hp_dc7600_verbs },
7181 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7182 .dac_nids = alc260_dac_nids,
7183 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7184 .adc_nids = alc260_adc_nids_alt,
7185 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7186 .channel_mode = alc260_modes,
7187 .input_mux = &alc260_capture_source,
7188 .unsol_event = alc260_hp_3012_unsol_event,
7189 .init_hook = alc260_hp_3012_automute,
7191 [ALC260_HP_3013] = {
7192 .mixers = { alc260_hp_3013_mixer,
7193 alc260_input_mixer },
7194 .init_verbs = { alc260_hp_3013_init_verbs,
7195 alc260_hp_3013_unsol_verbs },
7196 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7197 .dac_nids = alc260_dac_nids,
7198 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7199 .adc_nids = alc260_adc_nids_alt,
7200 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7201 .channel_mode = alc260_modes,
7202 .input_mux = &alc260_capture_source,
7203 .unsol_event = alc260_hp_3013_unsol_event,
7204 .init_hook = alc260_hp_3013_automute,
7206 [ALC260_FUJITSU_S702X] = {
7207 .mixers = { alc260_fujitsu_mixer },
7208 .init_verbs = { alc260_fujitsu_init_verbs },
7209 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7210 .dac_nids = alc260_dac_nids,
7211 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7212 .adc_nids = alc260_dual_adc_nids,
7213 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7214 .channel_mode = alc260_modes,
7215 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7216 .input_mux = alc260_fujitsu_capture_sources,
7219 .mixers = { alc260_acer_mixer },
7220 .init_verbs = { alc260_acer_init_verbs },
7221 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7222 .dac_nids = alc260_dac_nids,
7223 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7224 .adc_nids = alc260_dual_adc_nids,
7225 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7226 .channel_mode = alc260_modes,
7227 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7228 .input_mux = alc260_acer_capture_sources,
7230 [ALC260_FAVORIT100] = {
7231 .mixers = { alc260_favorit100_mixer },
7232 .init_verbs = { alc260_favorit100_init_verbs },
7233 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7234 .dac_nids = alc260_dac_nids,
7235 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7236 .adc_nids = alc260_dual_adc_nids,
7237 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7238 .channel_mode = alc260_modes,
7239 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7240 .input_mux = alc260_favorit100_capture_sources,
7243 .mixers = { alc260_will_mixer },
7244 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7245 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7246 .dac_nids = alc260_dac_nids,
7247 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7248 .adc_nids = alc260_adc_nids,
7249 .dig_out_nid = ALC260_DIGOUT_NID,
7250 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7251 .channel_mode = alc260_modes,
7252 .input_mux = &alc260_capture_source,
7254 [ALC260_REPLACER_672V] = {
7255 .mixers = { alc260_replacer_672v_mixer },
7256 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7257 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7258 .dac_nids = alc260_dac_nids,
7259 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7260 .adc_nids = alc260_adc_nids,
7261 .dig_out_nid = ALC260_DIGOUT_NID,
7262 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7263 .channel_mode = alc260_modes,
7264 .input_mux = &alc260_capture_source,
7265 .unsol_event = alc260_replacer_672v_unsol_event,
7266 .init_hook = alc260_replacer_672v_automute,
7268 #ifdef CONFIG_SND_DEBUG
7270 .mixers = { alc260_test_mixer },
7271 .init_verbs = { alc260_test_init_verbs },
7272 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7273 .dac_nids = alc260_test_dac_nids,
7274 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7275 .adc_nids = alc260_test_adc_nids,
7276 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7277 .channel_mode = alc260_modes,
7278 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7279 .input_mux = alc260_test_capture_sources,
7284 static int patch_alc260(struct hda_codec *codec)
7286 struct alc_spec *spec;
7287 int err, board_config;
7289 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7295 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7298 if (board_config < 0) {
7299 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7301 board_config = ALC260_AUTO;
7304 if (board_config == ALC260_AUTO)
7305 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1);
7307 if (board_config == ALC260_AUTO) {
7308 /* automatic parse from the BIOS config */
7309 err = alc260_parse_auto_config(codec);
7315 "hda_codec: Cannot set up configuration "
7316 "from BIOS. Using base mode...\n");
7317 board_config = ALC260_BASIC;
7321 err = snd_hda_attach_beep_device(codec, 0x1);
7327 if (board_config != ALC260_AUTO)
7328 setup_preset(codec, &alc260_presets[board_config]);
7330 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7331 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7332 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7334 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7335 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7337 if (!spec->adc_nids && spec->input_mux) {
7338 /* check whether NID 0x04 is valid */
7339 unsigned int wcap = get_wcaps(codec, 0x04);
7340 wcap = get_wcaps_type(wcap);
7342 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7343 spec->adc_nids = alc260_adc_nids_alt;
7344 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7346 spec->adc_nids = alc260_adc_nids;
7347 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7350 set_capture_mixer(codec);
7351 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7353 if (board_config == ALC260_AUTO)
7354 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7356 spec->vmaster_nid = 0x08;
7358 codec->patch_ops = alc_patch_ops;
7359 if (board_config == ALC260_AUTO)
7360 spec->init_hook = alc260_auto_init;
7361 #ifdef CONFIG_SND_HDA_POWER_SAVE
7362 if (!spec->loopback.amplist)
7363 spec->loopback.amplist = alc260_loopbacks;
7371 * ALC882/883/885/888/889 support
7373 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7374 * configuration. Each pin widget can choose any input DACs and a mixer.
7375 * Each ADC is connected from a mixer of all inputs. This makes possible
7376 * 6-channel independent captures.
7378 * In addition, an independent DAC for the multi-playback (not used in this
7381 #define ALC882_DIGOUT_NID 0x06
7382 #define ALC882_DIGIN_NID 0x0a
7383 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7384 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7385 #define ALC1200_DIGOUT_NID 0x10
7388 static struct hda_channel_mode alc882_ch_modes[1] = {
7393 static hda_nid_t alc882_dac_nids[4] = {
7394 /* front, rear, clfe, rear_surr */
7395 0x02, 0x03, 0x04, 0x05
7397 #define alc883_dac_nids alc882_dac_nids
7400 #define alc882_adc_nids alc880_adc_nids
7401 #define alc882_adc_nids_alt alc880_adc_nids_alt
7402 #define alc883_adc_nids alc882_adc_nids_alt
7403 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7404 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7405 #define alc889_adc_nids alc880_adc_nids
7407 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7408 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7409 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7410 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7411 #define alc889_capsrc_nids alc882_capsrc_nids
7414 /* FIXME: should be a matrix-type input source selection */
7416 static struct hda_input_mux alc882_capture_source = {
7420 { "Front Mic", 0x1 },
7426 #define alc883_capture_source alc882_capture_source
7428 static struct hda_input_mux alc889_capture_source = {
7431 { "Front Mic", 0x0 },
7437 static struct hda_input_mux mb5_capture_source = {
7446 static struct hda_input_mux macmini3_capture_source = {
7454 static struct hda_input_mux alc883_3stack_6ch_intel = {
7458 { "Front Mic", 0x0 },
7464 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7472 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7476 { "Internal Mic", 0x1 },
7482 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7486 { "Internal Mic", 0x1 },
7490 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7494 { "Front Mic", 0x1 },
7499 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7507 static struct hda_input_mux alc889A_mb31_capture_source = {
7511 /* Front Mic (0x01) unused */
7513 /* Line 2 (0x03) unused */
7514 /* CD (0x04) unused? */
7518 static struct hda_input_mux alc889A_imac91_capture_source = {
7522 { "Line", 0x2 }, /* Not sure! */
7529 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7536 static struct hda_verb alc882_3ST_ch2_init[] = {
7537 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7538 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7539 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7540 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7547 static struct hda_verb alc882_3ST_ch4_init[] = {
7548 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7549 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7550 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7551 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7552 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7559 static struct hda_verb alc882_3ST_ch6_init[] = {
7560 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7561 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7562 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7563 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7564 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7565 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7569 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7570 { 2, alc882_3ST_ch2_init },
7571 { 4, alc882_3ST_ch4_init },
7572 { 6, alc882_3ST_ch6_init },
7575 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7580 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7581 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7582 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7583 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7584 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7585 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7592 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7593 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7594 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7595 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7596 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7597 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7598 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7605 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7606 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7607 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7608 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7609 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7610 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7611 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7612 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7616 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7617 { 2, alc883_3ST_ch2_clevo_init },
7618 { 4, alc883_3ST_ch4_clevo_init },
7619 { 6, alc883_3ST_ch6_clevo_init },
7626 static struct hda_verb alc882_sixstack_ch6_init[] = {
7627 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7628 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7629 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7630 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7637 static struct hda_verb alc882_sixstack_ch8_init[] = {
7638 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7639 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7640 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7641 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7645 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7646 { 6, alc882_sixstack_ch6_init },
7647 { 8, alc882_sixstack_ch8_init },
7651 /* Macbook Air 2,1 */
7653 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7658 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7664 static struct hda_verb alc885_mbp_ch2_init[] = {
7665 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7666 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7667 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7674 static struct hda_verb alc885_mbp_ch4_init[] = {
7675 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7676 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7677 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7678 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7679 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7683 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7684 { 2, alc885_mbp_ch2_init },
7685 { 4, alc885_mbp_ch4_init },
7690 * Speakers/Woofer/HP = Front
7693 static struct hda_verb alc885_mb5_ch2_init[] = {
7694 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7695 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7701 * Speakers/HP = Front
7705 static struct hda_verb alc885_mb5_ch6_init[] = {
7706 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7707 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7708 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7712 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7713 { 2, alc885_mb5_ch2_init },
7714 { 6, alc885_mb5_ch6_init },
7717 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7722 static struct hda_verb alc883_4ST_ch2_init[] = {
7723 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7724 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7725 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7726 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7727 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7728 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7735 static struct hda_verb alc883_4ST_ch4_init[] = {
7736 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7737 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7738 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7739 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7740 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7741 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7742 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7749 static struct hda_verb alc883_4ST_ch6_init[] = {
7750 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7751 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7752 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7753 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7754 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7755 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7756 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7757 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7764 static struct hda_verb alc883_4ST_ch8_init[] = {
7765 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7766 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7767 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7768 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7769 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7770 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7771 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7772 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7773 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7777 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7778 { 2, alc883_4ST_ch2_init },
7779 { 4, alc883_4ST_ch4_init },
7780 { 6, alc883_4ST_ch6_init },
7781 { 8, alc883_4ST_ch8_init },
7788 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7789 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7790 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7791 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7792 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7799 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7800 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7801 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7802 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7803 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7804 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7811 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7812 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7813 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7814 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7815 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7816 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7817 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7821 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7822 { 2, alc883_3ST_ch2_intel_init },
7823 { 4, alc883_3ST_ch4_intel_init },
7824 { 6, alc883_3ST_ch6_intel_init },
7830 static struct hda_verb alc889_ch2_intel_init[] = {
7831 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7832 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7833 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7834 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7835 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7836 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7843 static struct hda_verb alc889_ch6_intel_init[] = {
7844 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7845 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7846 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7847 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7848 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7849 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7856 static struct hda_verb alc889_ch8_intel_init[] = {
7857 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7858 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7859 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7860 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7861 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7862 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7863 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7867 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7868 { 2, alc889_ch2_intel_init },
7869 { 6, alc889_ch6_intel_init },
7870 { 8, alc889_ch8_intel_init },
7876 static struct hda_verb alc883_sixstack_ch6_init[] = {
7877 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7878 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7879 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7880 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7887 static struct hda_verb alc883_sixstack_ch8_init[] = {
7888 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7889 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7890 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7891 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7895 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7896 { 6, alc883_sixstack_ch6_init },
7897 { 8, alc883_sixstack_ch8_init },
7901 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7902 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7904 static struct snd_kcontrol_new alc882_base_mixer[] = {
7905 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7906 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7907 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7908 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7909 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7910 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7911 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7912 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7913 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7914 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7915 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7916 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7917 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7918 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7919 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7921 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
7922 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7923 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7924 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
7925 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7929 /* Macbook Air 2,1 same control for HP and internal Speaker */
7931 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7932 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7933 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7938 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7939 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7940 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7941 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7942 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7943 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7944 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7945 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7946 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7947 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7948 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
7949 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
7953 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7954 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7955 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7956 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7957 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7958 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7959 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7960 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7961 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7962 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7963 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7964 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7965 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7966 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
7967 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
7971 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7972 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7973 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7974 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7975 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7976 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7977 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7979 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7981 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7982 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
7986 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7987 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7988 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7993 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7994 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7995 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7996 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7997 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7998 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7999 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8001 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8006 static struct snd_kcontrol_new alc882_targa_mixer[] = {
8007 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8008 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8010 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8011 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8012 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8013 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8015 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8016 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8017 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8018 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8019 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8023 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8024 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8026 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8027 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8028 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8029 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8030 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8031 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8032 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8033 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8034 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8035 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8036 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8037 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8038 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8039 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8043 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8044 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8045 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8046 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8047 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8048 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8049 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8050 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8051 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8052 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8057 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8059 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8060 .name = "Channel Mode",
8061 .info = alc_ch_mode_info,
8062 .get = alc_ch_mode_get,
8063 .put = alc_ch_mode_put,
8068 static struct hda_verb alc882_base_init_verbs[] = {
8069 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8070 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8071 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8073 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8074 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8076 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8077 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8079 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8080 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8082 /* Front Pin: output 0 (0x0c) */
8083 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8084 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8085 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8086 /* Rear Pin: output 1 (0x0d) */
8087 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8088 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8089 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8090 /* CLFE Pin: output 2 (0x0e) */
8091 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8092 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8093 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8094 /* Side Pin: output 3 (0x0f) */
8095 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8096 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8097 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8098 /* Mic (rear) pin: input vref at 80% */
8099 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8100 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8101 /* Front Mic pin: input vref at 80% */
8102 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8103 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8104 /* Line In pin: input */
8105 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8106 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8107 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8108 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8109 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8110 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8111 /* CD pin widget for input */
8112 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8114 /* FIXME: use matrix-type input source selection */
8115 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8117 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8120 /* ADC2: mute amp left and right */
8121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8122 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8123 /* ADC3: mute amp left and right */
8124 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8125 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8130 static struct hda_verb alc882_adc1_init_verbs[] = {
8131 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8132 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8133 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8134 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8135 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8136 /* ADC1: mute amp left and right */
8137 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8138 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8142 static struct hda_verb alc882_eapd_verbs[] = {
8143 /* change to EAPD mode */
8144 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8145 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8149 static struct hda_verb alc889_eapd_verbs[] = {
8150 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8151 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8155 static struct hda_verb alc_hp15_unsol_verbs[] = {
8156 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8161 static struct hda_verb alc885_init_verbs[] = {
8162 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8166 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8167 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8169 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8170 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8172 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8173 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8175 /* Front HP Pin: output 0 (0x0c) */
8176 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8178 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8179 /* Front Pin: output 0 (0x0c) */
8180 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8181 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8182 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8183 /* Rear Pin: output 1 (0x0d) */
8184 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8185 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8186 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8187 /* CLFE Pin: output 2 (0x0e) */
8188 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8189 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8190 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8191 /* Side Pin: output 3 (0x0f) */
8192 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8193 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8194 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8195 /* Mic (rear) pin: input vref at 80% */
8196 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8197 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8198 /* Front Mic pin: input vref at 80% */
8199 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8200 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8201 /* Line In pin: input */
8202 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8203 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8205 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8209 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8211 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8212 /* ADC2: mute amp left and right */
8213 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8214 /* ADC3: mute amp left and right */
8215 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8220 static struct hda_verb alc885_init_input_verbs[] = {
8221 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8222 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8223 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8228 /* Unmute Selector 24h and set the default input to front mic */
8229 static struct hda_verb alc889_init_input_verbs[] = {
8230 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8231 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8236 #define alc883_init_verbs alc882_base_init_verbs
8239 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8240 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8241 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8242 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8243 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8244 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8245 /* FIXME: this looks suspicious...
8246 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8247 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8252 static struct hda_verb alc882_macpro_init_verbs[] = {
8253 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8256 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8257 /* Front Pin: output 0 (0x0c) */
8258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8260 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8261 /* Front Mic pin: input vref at 80% */
8262 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8263 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8264 /* Speaker: output */
8265 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8266 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8267 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8268 /* Headphone output (output 0 - 0x0c) */
8269 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8270 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8271 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8273 /* FIXME: use matrix-type input source selection */
8274 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8275 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8290 /* ADC1: mute amp left and right */
8291 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8292 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8293 /* ADC2: mute amp left and right */
8294 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8295 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8296 /* ADC3: mute amp left and right */
8297 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8298 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8304 static struct hda_verb alc885_mb5_init_verbs[] = {
8306 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8307 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8308 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8309 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8313 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8314 /* Surround mixer */
8315 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8316 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8317 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8320 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8321 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8323 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8325 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8326 /* Front Pin (0x0c) */
8327 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8328 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8329 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8330 /* LFE Pin (0x0e) */
8331 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8332 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8333 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8335 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8336 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8337 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8338 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8339 /* Front Mic pin: input vref at 80% */
8340 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8341 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8343 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8344 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8346 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8347 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8348 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8353 static struct hda_verb alc885_macmini3_init_verbs[] = {
8355 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8356 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8357 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8358 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8360 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8361 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8363 /* Surround mixer */
8364 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8365 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8366 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8368 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8370 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8372 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8373 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8374 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8375 /* Front Pin (0x0c) */
8376 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8377 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8378 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8379 /* LFE Pin (0x0e) */
8380 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8381 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8382 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8384 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8385 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8386 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8387 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8389 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8390 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8392 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8393 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8395 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8400 static struct hda_verb alc885_mba21_init_verbs[] = {
8401 /*Internal and HP Speaker Mixer*/
8402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8404 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8405 /*Internal Speaker Pin (0x0c)*/
8406 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8407 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8408 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8409 /* HP Pin: output 0 (0x0e) */
8410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8411 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8412 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8413 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8414 /* Line in (is hp when jack connected)*/
8415 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8416 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8422 /* Macbook Pro rev3 */
8423 static struct hda_verb alc885_mbp3_init_verbs[] = {
8424 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8427 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8429 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8430 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8431 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8433 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8434 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8436 /* Front Pin: output 0 (0x0c) */
8437 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8438 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8439 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8440 /* HP Pin: output 0 (0x0e) */
8441 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8442 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8443 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8444 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8445 /* Mic (rear) pin: input vref at 80% */
8446 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8447 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8448 /* Front Mic pin: input vref at 80% */
8449 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8450 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8451 /* Line In pin: use output 1 when in LineOut mode */
8452 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8453 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8454 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8456 /* FIXME: use matrix-type input source selection */
8457 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8458 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8461 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8462 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8467 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8472 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8473 /* ADC1: mute amp left and right */
8474 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8475 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8476 /* ADC2: mute amp left and right */
8477 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8478 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8479 /* ADC3: mute amp left and right */
8480 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8481 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8487 static struct hda_verb alc885_imac91_init_verbs[] = {
8488 /* Internal Speaker Pin (0x0c) */
8489 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8490 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8491 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8492 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8493 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8494 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8498 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8499 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8501 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8502 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8503 /* Front Mic pin: input vref at 80% */
8504 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8505 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8507 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8508 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8509 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8510 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8514 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8515 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8516 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8519 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8520 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8522 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8524 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8525 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8529 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8531 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8532 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8533 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8534 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8535 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8536 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8537 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8541 /* iMac 24 mixer. */
8542 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8543 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8544 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8548 /* iMac 24 init verbs. */
8549 static struct hda_verb alc885_imac24_init_verbs[] = {
8550 /* Internal speakers: output 0 (0x0c) */
8551 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8552 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8553 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8554 /* Internal speakers: output 0 (0x0c) */
8555 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8556 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8557 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8558 /* Headphone: output 0 (0x0c) */
8559 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8560 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8561 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8562 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8563 /* Front Mic: input vref at 80% */
8564 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8565 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8569 /* Toggle speaker-output according to the hp-jack state */
8570 static void alc885_imac24_setup(struct hda_codec *codec)
8572 struct alc_spec *spec = codec->spec;
8574 spec->autocfg.hp_pins[0] = 0x14;
8575 spec->autocfg.speaker_pins[0] = 0x18;
8576 spec->autocfg.speaker_pins[1] = 0x1a;
8579 #define alc885_mb5_setup alc885_imac24_setup
8580 #define alc885_macmini3_setup alc885_imac24_setup
8582 /* Macbook Air 2,1 */
8583 static void alc885_mba21_setup(struct hda_codec *codec)
8585 struct alc_spec *spec = codec->spec;
8587 spec->autocfg.hp_pins[0] = 0x14;
8588 spec->autocfg.speaker_pins[0] = 0x18;
8593 static void alc885_mbp3_setup(struct hda_codec *codec)
8595 struct alc_spec *spec = codec->spec;
8597 spec->autocfg.hp_pins[0] = 0x15;
8598 spec->autocfg.speaker_pins[0] = 0x14;
8601 static void alc885_imac91_setup(struct hda_codec *codec)
8603 struct alc_spec *spec = codec->spec;
8605 spec->autocfg.hp_pins[0] = 0x14;
8606 spec->autocfg.speaker_pins[0] = 0x18;
8607 spec->autocfg.speaker_pins[1] = 0x1a;
8610 static struct hda_verb alc882_targa_verbs[] = {
8611 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8612 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8614 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8615 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8617 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8618 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8619 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8621 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8625 /* toggle speaker-output according to the hp-jack state */
8626 static void alc882_targa_automute(struct hda_codec *codec)
8628 struct alc_spec *spec = codec->spec;
8629 alc_automute_amp(codec);
8630 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8631 spec->jack_present ? 1 : 3);
8634 static void alc882_targa_setup(struct hda_codec *codec)
8636 struct alc_spec *spec = codec->spec;
8638 spec->autocfg.hp_pins[0] = 0x14;
8639 spec->autocfg.speaker_pins[0] = 0x1b;
8642 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8644 if ((res >> 26) == ALC880_HP_EVENT)
8645 alc882_targa_automute(codec);
8648 static struct hda_verb alc882_asus_a7j_verbs[] = {
8649 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8650 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8654 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8656 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8657 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8658 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8660 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8661 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8662 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8666 static struct hda_verb alc882_asus_a7m_verbs[] = {
8667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8668 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8670 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8671 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8672 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8674 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8675 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8676 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8678 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8679 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8680 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8684 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8686 unsigned int gpiostate, gpiomask, gpiodir;
8688 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8689 AC_VERB_GET_GPIO_DATA, 0);
8692 gpiostate |= (1 << pin);
8694 gpiostate &= ~(1 << pin);
8696 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8697 AC_VERB_GET_GPIO_MASK, 0);
8698 gpiomask |= (1 << pin);
8700 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8701 AC_VERB_GET_GPIO_DIRECTION, 0);
8702 gpiodir |= (1 << pin);
8705 snd_hda_codec_write(codec, codec->afg, 0,
8706 AC_VERB_SET_GPIO_MASK, gpiomask);
8707 snd_hda_codec_write(codec, codec->afg, 0,
8708 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8712 snd_hda_codec_write(codec, codec->afg, 0,
8713 AC_VERB_SET_GPIO_DATA, gpiostate);
8716 /* set up GPIO at initialization */
8717 static void alc885_macpro_init_hook(struct hda_codec *codec)
8719 alc882_gpio_mute(codec, 0, 0);
8720 alc882_gpio_mute(codec, 1, 0);
8723 /* set up GPIO and update auto-muting at initialization */
8724 static void alc885_imac24_init_hook(struct hda_codec *codec)
8726 alc885_macpro_init_hook(codec);
8727 alc_automute_amp(codec);
8731 * generic initialization of ADC, input mixers and output mixers
8733 static struct hda_verb alc883_auto_init_verbs[] = {
8735 * Unmute ADC0-2 and set the default input to mic-in
8737 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8738 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8739 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8740 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8743 * Set up output mixers (0x0c - 0x0f)
8745 /* set vol=0 to output mixers */
8746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8749 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8750 /* set up input amps for analog loopback */
8751 /* Amp Indices: DAC = 0, mixer = 1 */
8752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8754 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8755 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8756 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8757 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8758 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8759 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8760 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8761 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8763 /* FIXME: use matrix-type input source selection */
8764 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8768 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8772 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8773 static struct hda_verb alc889A_mb31_ch2_init[] = {
8774 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8775 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8776 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8777 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8781 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8782 static struct hda_verb alc889A_mb31_ch4_init[] = {
8783 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8784 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8785 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8786 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8790 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8791 static struct hda_verb alc889A_mb31_ch5_init[] = {
8792 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8793 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8794 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8799 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8800 static struct hda_verb alc889A_mb31_ch6_init[] = {
8801 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8802 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8803 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8804 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8808 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8809 { 2, alc889A_mb31_ch2_init },
8810 { 4, alc889A_mb31_ch4_init },
8811 { 5, alc889A_mb31_ch5_init },
8812 { 6, alc889A_mb31_ch6_init },
8815 static struct hda_verb alc883_medion_eapd_verbs[] = {
8816 /* eanable EAPD on medion laptop */
8817 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8818 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8822 #define alc883_base_mixer alc882_base_mixer
8824 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8825 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8826 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8827 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8828 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8829 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8830 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8831 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8832 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8833 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8835 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8836 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8837 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8841 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8842 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8843 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8844 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8845 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8847 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8849 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8850 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8851 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8855 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8856 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8857 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8858 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8859 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8860 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8861 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8862 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8863 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8864 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8865 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8869 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8870 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8871 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8872 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8873 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8874 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8875 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8876 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8878 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8880 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8881 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8882 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8886 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8887 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8888 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8889 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8890 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8891 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8892 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8893 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8894 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8895 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8896 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8897 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8898 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8899 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8901 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8902 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8903 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8904 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8905 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8909 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8910 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8911 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8912 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8913 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8914 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8916 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8917 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8918 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8919 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8920 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8921 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8922 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8923 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8925 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
8926 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8927 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8928 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
8929 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8933 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8934 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8935 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8936 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8937 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8938 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8940 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8941 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8942 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8943 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8944 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8945 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8946 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8947 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8948 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8949 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
8950 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8951 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8952 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
8953 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8957 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8958 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8959 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8960 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8961 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8962 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8963 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8964 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8965 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8966 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8967 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8968 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8969 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8970 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8972 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8974 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8975 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8976 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8980 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8981 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8982 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8983 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8984 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8985 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8986 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8987 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8988 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8989 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8990 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8991 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8992 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8993 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8994 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8996 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8997 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9001 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9002 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9003 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9004 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9005 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9006 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9007 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9008 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9009 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9010 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9011 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9012 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9013 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9017 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9018 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9019 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9020 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9021 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9022 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9026 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9027 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9028 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9029 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9030 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9031 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9033 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9038 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9039 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9040 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9041 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9042 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9043 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9044 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9045 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9046 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9047 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9051 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9052 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9053 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9054 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9055 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9056 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9057 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9061 static struct hda_verb alc883_medion_wim2160_verbs[] = {
9062 /* Unmute front mixer */
9063 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9064 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9066 /* Set speaker pin to front mixer */
9067 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9069 /* Init headphone pin */
9070 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9071 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9072 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9073 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9078 /* toggle speaker-output according to the hp-jack state */
9079 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9081 struct alc_spec *spec = codec->spec;
9083 spec->autocfg.hp_pins[0] = 0x1a;
9084 spec->autocfg.speaker_pins[0] = 0x15;
9087 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9089 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9091 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9092 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9093 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9094 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9099 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9100 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9101 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9102 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9103 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9104 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9105 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9106 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9107 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9112 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9113 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9114 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9115 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9116 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9117 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9118 0x0d, 1, 0x0, HDA_OUTPUT),
9119 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9120 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9121 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9122 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9123 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9124 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9125 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9126 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9127 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9129 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9131 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9132 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9133 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9137 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9139 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9140 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9141 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9142 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9143 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9145 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9146 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9147 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9148 /* Output switches */
9149 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9150 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9151 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9153 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
9154 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
9156 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9157 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9158 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9159 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9163 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9164 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9165 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9168 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9169 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9173 static struct hda_bind_ctls alc883_bind_cap_vol = {
9174 .ops = &snd_hda_bind_vol,
9176 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9177 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9182 static struct hda_bind_ctls alc883_bind_cap_switch = {
9183 .ops = &snd_hda_bind_sw,
9185 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9186 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9191 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9192 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9193 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9194 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9198 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9203 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9204 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9205 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9207 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9208 /* .name = "Capture Source", */
9209 .name = "Input Source",
9211 .info = alc_mux_enum_info,
9212 .get = alc_mux_enum_get,
9213 .put = alc_mux_enum_put,
9218 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9220 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9221 .name = "Channel Mode",
9222 .info = alc_ch_mode_info,
9223 .get = alc_ch_mode_get,
9224 .put = alc_ch_mode_put,
9229 /* toggle speaker-output according to the hp-jack state */
9230 static void alc883_mitac_setup(struct hda_codec *codec)
9232 struct alc_spec *spec = codec->spec;
9234 spec->autocfg.hp_pins[0] = 0x15;
9235 spec->autocfg.speaker_pins[0] = 0x14;
9236 spec->autocfg.speaker_pins[1] = 0x17;
9239 static struct hda_verb alc883_mitac_verbs[] = {
9241 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9242 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9244 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9245 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9247 /* enable unsolicited event */
9248 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9249 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9254 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9256 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9259 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9261 /* enable unsolicited event */
9263 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9264 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9270 static struct hda_verb alc883_clevo_m720_verbs[] = {
9272 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9273 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9275 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9276 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9278 /* enable unsolicited event */
9279 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9280 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9285 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9287 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9290 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9291 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9293 /* enable unsolicited event */
9294 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9299 static struct hda_verb alc883_targa_verbs[] = {
9300 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9304 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9306 /* Connect Line-Out side jack (SPDIF) to Side */
9307 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9308 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9309 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9310 /* Connect Mic jack to CLFE */
9311 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9312 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9313 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9314 /* Connect Line-in jack to Surround */
9315 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9316 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9317 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9318 /* Connect HP out jack to Front */
9319 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9320 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9321 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9323 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9328 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9329 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9330 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9331 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9335 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9336 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9337 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9338 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9339 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9343 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9346 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9347 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9348 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9352 static struct hda_verb alc883_haier_w66_verbs[] = {
9353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9356 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9358 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9359 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9360 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9361 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9365 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9367 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9368 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9370 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9371 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9372 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9373 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9377 static struct hda_verb alc888_6st_dell_verbs[] = {
9378 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9382 static struct hda_verb alc883_vaiott_verbs[] = {
9384 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9385 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9387 /* enable unsolicited event */
9388 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9393 static void alc888_3st_hp_setup(struct hda_codec *codec)
9395 struct alc_spec *spec = codec->spec;
9397 spec->autocfg.hp_pins[0] = 0x1b;
9398 spec->autocfg.speaker_pins[0] = 0x14;
9399 spec->autocfg.speaker_pins[1] = 0x16;
9400 spec->autocfg.speaker_pins[2] = 0x18;
9403 static struct hda_verb alc888_3st_hp_verbs[] = {
9404 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9405 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9406 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9407 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9414 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9415 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9416 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9417 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9418 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9425 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9426 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9427 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9428 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9429 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9430 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9437 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9438 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9439 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9440 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9441 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9442 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9443 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9447 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9448 { 2, alc888_3st_hp_2ch_init },
9449 { 4, alc888_3st_hp_4ch_init },
9450 { 6, alc888_3st_hp_6ch_init },
9453 /* toggle front-jack and RCA according to the hp-jack state */
9454 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9456 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9458 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9459 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9460 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9461 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9464 /* toggle RCA according to the front-jack state */
9465 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9467 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9469 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9470 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9473 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9476 if ((res >> 26) == ALC880_HP_EVENT)
9477 alc888_lenovo_ms7195_front_automute(codec);
9478 if ((res >> 26) == ALC880_FRONT_EVENT)
9479 alc888_lenovo_ms7195_rca_automute(codec);
9482 /* toggle speaker-output according to the hp-jack state */
9483 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9485 struct alc_spec *spec = codec->spec;
9487 spec->autocfg.hp_pins[0] = 0x14;
9488 spec->autocfg.speaker_pins[0] = 0x15;
9491 /* toggle speaker-output according to the hp-jack state */
9492 #define alc883_targa_init_hook alc882_targa_init_hook
9493 #define alc883_targa_unsol_event alc882_targa_unsol_event
9495 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9497 struct alc_spec *spec = codec->spec;
9499 spec->autocfg.hp_pins[0] = 0x15;
9500 spec->autocfg.speaker_pins[0] = 0x14;
9503 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9505 alc_automute_amp(codec);
9506 alc88x_simple_mic_automute(codec);
9509 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9512 switch (res >> 26) {
9513 case ALC880_MIC_EVENT:
9514 alc88x_simple_mic_automute(codec);
9517 alc_automute_amp_unsol_event(codec, res);
9522 /* toggle speaker-output according to the hp-jack state */
9523 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9525 struct alc_spec *spec = codec->spec;
9527 spec->autocfg.hp_pins[0] = 0x14;
9528 spec->autocfg.speaker_pins[0] = 0x15;
9531 static void alc883_haier_w66_setup(struct hda_codec *codec)
9533 struct alc_spec *spec = codec->spec;
9535 spec->autocfg.hp_pins[0] = 0x1b;
9536 spec->autocfg.speaker_pins[0] = 0x14;
9539 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9541 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9543 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9544 HDA_AMP_MUTE, bits);
9547 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9549 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9551 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9552 HDA_AMP_MUTE, bits);
9553 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9554 HDA_AMP_MUTE, bits);
9557 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9560 if ((res >> 26) == ALC880_HP_EVENT)
9561 alc883_lenovo_101e_all_automute(codec);
9562 if ((res >> 26) == ALC880_FRONT_EVENT)
9563 alc883_lenovo_101e_ispeaker_automute(codec);
9566 /* toggle speaker-output according to the hp-jack state */
9567 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9569 struct alc_spec *spec = codec->spec;
9571 spec->autocfg.hp_pins[0] = 0x14;
9572 spec->autocfg.speaker_pins[0] = 0x15;
9573 spec->autocfg.speaker_pins[1] = 0x16;
9576 static struct hda_verb alc883_acer_eapd_verbs[] = {
9577 /* HP Pin: output 0 (0x0c) */
9578 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9579 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9580 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9581 /* Front Pin: output 0 (0x0c) */
9582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9583 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9584 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9585 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9586 /* eanable EAPD on medion laptop */
9587 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9588 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9589 /* enable unsolicited event */
9590 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9594 static void alc888_6st_dell_setup(struct hda_codec *codec)
9596 struct alc_spec *spec = codec->spec;
9598 spec->autocfg.hp_pins[0] = 0x1b;
9599 spec->autocfg.speaker_pins[0] = 0x14;
9600 spec->autocfg.speaker_pins[1] = 0x15;
9601 spec->autocfg.speaker_pins[2] = 0x16;
9602 spec->autocfg.speaker_pins[3] = 0x17;
9605 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9607 struct alc_spec *spec = codec->spec;
9609 spec->autocfg.hp_pins[0] = 0x1b;
9610 spec->autocfg.speaker_pins[0] = 0x14;
9611 spec->autocfg.speaker_pins[1] = 0x15;
9612 spec->autocfg.speaker_pins[2] = 0x16;
9613 spec->autocfg.speaker_pins[3] = 0x17;
9614 spec->autocfg.speaker_pins[4] = 0x1a;
9617 static void alc883_vaiott_setup(struct hda_codec *codec)
9619 struct alc_spec *spec = codec->spec;
9621 spec->autocfg.hp_pins[0] = 0x15;
9622 spec->autocfg.speaker_pins[0] = 0x14;
9623 spec->autocfg.speaker_pins[1] = 0x17;
9626 static struct hda_verb alc888_asus_m90v_verbs[] = {
9627 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9628 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9629 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9630 /* enable unsolicited event */
9631 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9632 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9636 static void alc883_mode2_setup(struct hda_codec *codec)
9638 struct alc_spec *spec = codec->spec;
9640 spec->autocfg.hp_pins[0] = 0x1b;
9641 spec->autocfg.speaker_pins[0] = 0x14;
9642 spec->autocfg.speaker_pins[1] = 0x15;
9643 spec->autocfg.speaker_pins[2] = 0x16;
9644 spec->ext_mic.pin = 0x18;
9645 spec->int_mic.pin = 0x19;
9646 spec->ext_mic.mux_idx = 0;
9647 spec->int_mic.mux_idx = 1;
9651 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9652 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9653 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9656 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9657 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9658 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9659 /* enable unsolicited event */
9660 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9664 static void alc883_eee1601_inithook(struct hda_codec *codec)
9666 struct alc_spec *spec = codec->spec;
9668 spec->autocfg.hp_pins[0] = 0x14;
9669 spec->autocfg.speaker_pins[0] = 0x1b;
9670 alc_automute_pin(codec);
9673 static struct hda_verb alc889A_mb31_verbs[] = {
9674 /* Init rear pin (used as headphone output) */
9675 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9676 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9677 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9678 /* Init line pin (used as output in 4ch and 6ch mode) */
9679 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9680 /* Init line 2 pin (used as headphone out by default) */
9681 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9682 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9686 /* Mute speakers according to the headphone jack state */
9687 static void alc889A_mb31_automute(struct hda_codec *codec)
9689 unsigned int present;
9691 /* Mute only in 2ch or 4ch mode */
9692 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9694 present = snd_hda_jack_detect(codec, 0x15);
9695 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9696 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9697 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9698 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9702 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9704 if ((res >> 26) == ALC880_HP_EVENT)
9705 alc889A_mb31_automute(codec);
9709 #ifdef CONFIG_SND_HDA_POWER_SAVE
9710 #define alc882_loopbacks alc880_loopbacks
9713 /* pcm configuration: identical with ALC880 */
9714 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9715 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9716 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9717 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9719 static hda_nid_t alc883_slave_dig_outs[] = {
9720 ALC1200_DIGOUT_NID, 0,
9723 static hda_nid_t alc1200_slave_dig_outs[] = {
9724 ALC883_DIGOUT_NID, 0,
9728 * configuration and preset
9730 static const char *alc882_models[ALC882_MODEL_LAST] = {
9731 [ALC882_3ST_DIG] = "3stack-dig",
9732 [ALC882_6ST_DIG] = "6stack-dig",
9733 [ALC882_ARIMA] = "arima",
9734 [ALC882_W2JC] = "w2jc",
9735 [ALC882_TARGA] = "targa",
9736 [ALC882_ASUS_A7J] = "asus-a7j",
9737 [ALC882_ASUS_A7M] = "asus-a7m",
9738 [ALC885_MACPRO] = "macpro",
9739 [ALC885_MB5] = "mb5",
9740 [ALC885_MACMINI3] = "macmini3",
9741 [ALC885_MBA21] = "mba21",
9742 [ALC885_MBP3] = "mbp3",
9743 [ALC885_IMAC24] = "imac24",
9744 [ALC885_IMAC91] = "imac91",
9745 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9746 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9747 [ALC883_3ST_6ch] = "3stack-6ch",
9748 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9749 [ALC883_TARGA_DIG] = "targa-dig",
9750 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9751 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9752 [ALC883_ACER] = "acer",
9753 [ALC883_ACER_ASPIRE] = "acer-aspire",
9754 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9755 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9756 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9757 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9758 [ALC883_MEDION] = "medion",
9759 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9760 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9761 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9762 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9763 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9764 [ALC888_LENOVO_SKY] = "lenovo-sky",
9765 [ALC883_HAIER_W66] = "haier-w66",
9766 [ALC888_3ST_HP] = "3stack-hp",
9767 [ALC888_6ST_DELL] = "6stack-dell",
9768 [ALC883_MITAC] = "mitac",
9769 [ALC883_CLEVO_M540R] = "clevo-m540r",
9770 [ALC883_CLEVO_M720] = "clevo-m720",
9771 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9772 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9773 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9774 [ALC889A_INTEL] = "intel-alc889a",
9775 [ALC889_INTEL] = "intel-x58",
9776 [ALC1200_ASUS_P5Q] = "asus-p5q",
9777 [ALC889A_MB31] = "mb31",
9778 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9779 [ALC882_AUTO] = "auto",
9782 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9783 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9785 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9786 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9787 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9788 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9789 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9790 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9791 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9792 ALC888_ACER_ASPIRE_4930G),
9793 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9794 ALC888_ACER_ASPIRE_4930G),
9795 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9796 ALC888_ACER_ASPIRE_8930G),
9797 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9798 ALC888_ACER_ASPIRE_8930G),
9799 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9800 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9801 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9802 ALC888_ACER_ASPIRE_6530G),
9803 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9804 ALC888_ACER_ASPIRE_6530G),
9805 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9806 ALC888_ACER_ASPIRE_7730G),
9807 /* default Acer -- disabled as it causes more problems.
9808 * model=auto should work fine now
9810 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9812 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9814 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9815 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9816 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9817 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9818 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9819 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9821 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9822 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9823 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9824 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9825 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9826 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9827 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9828 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9829 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9830 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9831 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9833 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9834 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9835 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9836 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9837 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9838 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9839 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9840 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9841 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9843 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9844 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9845 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9846 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9847 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9848 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9849 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9850 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9851 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9852 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9853 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9854 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9855 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9856 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9857 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9858 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9859 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9860 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9861 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9862 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9863 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9864 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9865 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9866 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9867 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9868 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9869 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9870 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9871 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9872 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9873 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9875 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9876 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9877 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9878 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9879 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9880 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9881 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9882 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9883 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9884 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9885 ALC883_FUJITSU_PI2515),
9886 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9887 ALC888_FUJITSU_XA3530),
9888 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9889 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9890 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9891 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9892 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9893 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9894 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9895 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9897 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9898 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9899 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9900 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9901 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9902 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9903 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9908 /* codec SSID table for Intel Mac */
9909 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9910 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9911 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9912 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9913 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9914 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9915 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9916 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9917 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9918 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9919 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9920 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9921 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9922 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9923 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9924 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9925 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9926 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9927 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9928 * so apparently no perfect solution yet
9930 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9931 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9932 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9936 static struct alc_config_preset alc882_presets[] = {
9937 [ALC882_3ST_DIG] = {
9938 .mixers = { alc882_base_mixer },
9939 .init_verbs = { alc882_base_init_verbs,
9940 alc882_adc1_init_verbs },
9941 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9942 .dac_nids = alc882_dac_nids,
9943 .dig_out_nid = ALC882_DIGOUT_NID,
9944 .dig_in_nid = ALC882_DIGIN_NID,
9945 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9946 .channel_mode = alc882_ch_modes,
9948 .input_mux = &alc882_capture_source,
9950 [ALC882_6ST_DIG] = {
9951 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9952 .init_verbs = { alc882_base_init_verbs,
9953 alc882_adc1_init_verbs },
9954 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9955 .dac_nids = alc882_dac_nids,
9956 .dig_out_nid = ALC882_DIGOUT_NID,
9957 .dig_in_nid = ALC882_DIGIN_NID,
9958 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9959 .channel_mode = alc882_sixstack_modes,
9960 .input_mux = &alc882_capture_source,
9963 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9964 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9965 alc882_eapd_verbs },
9966 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9967 .dac_nids = alc882_dac_nids,
9968 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9969 .channel_mode = alc882_sixstack_modes,
9970 .input_mux = &alc882_capture_source,
9973 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9974 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9975 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9976 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9977 .dac_nids = alc882_dac_nids,
9978 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9979 .channel_mode = alc880_threestack_modes,
9981 .input_mux = &alc882_capture_source,
9982 .dig_out_nid = ALC882_DIGOUT_NID,
9985 .mixers = { alc885_mba21_mixer },
9986 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9988 .dac_nids = alc882_dac_nids,
9989 .channel_mode = alc885_mba21_ch_modes,
9990 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9991 .input_mux = &alc882_capture_source,
9992 .unsol_event = alc_automute_amp_unsol_event,
9993 .setup = alc885_mba21_setup,
9994 .init_hook = alc_automute_amp,
9997 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9998 .init_verbs = { alc885_mbp3_init_verbs,
9999 alc880_gpio1_init_verbs },
10001 .dac_nids = alc882_dac_nids,
10003 .channel_mode = alc885_mbp_4ch_modes,
10004 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10005 .input_mux = &alc882_capture_source,
10006 .dig_out_nid = ALC882_DIGOUT_NID,
10007 .dig_in_nid = ALC882_DIGIN_NID,
10008 .unsol_event = alc_automute_amp_unsol_event,
10009 .setup = alc885_mbp3_setup,
10010 .init_hook = alc_automute_amp,
10013 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10014 .init_verbs = { alc885_mb5_init_verbs,
10015 alc880_gpio1_init_verbs },
10016 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10017 .dac_nids = alc882_dac_nids,
10018 .channel_mode = alc885_mb5_6ch_modes,
10019 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10020 .input_mux = &mb5_capture_source,
10021 .dig_out_nid = ALC882_DIGOUT_NID,
10022 .dig_in_nid = ALC882_DIGIN_NID,
10023 .unsol_event = alc_automute_amp_unsol_event,
10024 .setup = alc885_mb5_setup,
10025 .init_hook = alc_automute_amp,
10027 [ALC885_MACMINI3] = {
10028 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10029 .init_verbs = { alc885_macmini3_init_verbs,
10030 alc880_gpio1_init_verbs },
10031 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10032 .dac_nids = alc882_dac_nids,
10033 .channel_mode = alc885_macmini3_6ch_modes,
10034 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10035 .input_mux = &macmini3_capture_source,
10036 .dig_out_nid = ALC882_DIGOUT_NID,
10037 .dig_in_nid = ALC882_DIGIN_NID,
10038 .unsol_event = alc_automute_amp_unsol_event,
10039 .setup = alc885_macmini3_setup,
10040 .init_hook = alc_automute_amp,
10042 [ALC885_MACPRO] = {
10043 .mixers = { alc882_macpro_mixer },
10044 .init_verbs = { alc882_macpro_init_verbs },
10045 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10046 .dac_nids = alc882_dac_nids,
10047 .dig_out_nid = ALC882_DIGOUT_NID,
10048 .dig_in_nid = ALC882_DIGIN_NID,
10049 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10050 .channel_mode = alc882_ch_modes,
10051 .input_mux = &alc882_capture_source,
10052 .init_hook = alc885_macpro_init_hook,
10054 [ALC885_IMAC24] = {
10055 .mixers = { alc885_imac24_mixer },
10056 .init_verbs = { alc885_imac24_init_verbs },
10057 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10058 .dac_nids = alc882_dac_nids,
10059 .dig_out_nid = ALC882_DIGOUT_NID,
10060 .dig_in_nid = ALC882_DIGIN_NID,
10061 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10062 .channel_mode = alc882_ch_modes,
10063 .input_mux = &alc882_capture_source,
10064 .unsol_event = alc_automute_amp_unsol_event,
10065 .setup = alc885_imac24_setup,
10066 .init_hook = alc885_imac24_init_hook,
10068 [ALC885_IMAC91] = {
10069 .mixers = {alc885_imac91_mixer},
10070 .init_verbs = { alc885_imac91_init_verbs,
10071 alc880_gpio1_init_verbs },
10072 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10073 .dac_nids = alc882_dac_nids,
10074 .channel_mode = alc885_mba21_ch_modes,
10075 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10076 .input_mux = &alc889A_imac91_capture_source,
10077 .dig_out_nid = ALC882_DIGOUT_NID,
10078 .dig_in_nid = ALC882_DIGIN_NID,
10079 .unsol_event = alc_automute_amp_unsol_event,
10080 .setup = alc885_imac91_setup,
10081 .init_hook = alc_automute_amp,
10084 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10085 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10086 alc880_gpio3_init_verbs, alc882_targa_verbs},
10087 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10088 .dac_nids = alc882_dac_nids,
10089 .dig_out_nid = ALC882_DIGOUT_NID,
10090 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10091 .adc_nids = alc882_adc_nids,
10092 .capsrc_nids = alc882_capsrc_nids,
10093 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10094 .channel_mode = alc882_3ST_6ch_modes,
10096 .input_mux = &alc882_capture_source,
10097 .unsol_event = alc882_targa_unsol_event,
10098 .setup = alc882_targa_setup,
10099 .init_hook = alc882_targa_automute,
10101 [ALC882_ASUS_A7J] = {
10102 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10103 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10104 alc882_asus_a7j_verbs},
10105 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10106 .dac_nids = alc882_dac_nids,
10107 .dig_out_nid = ALC882_DIGOUT_NID,
10108 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10109 .adc_nids = alc882_adc_nids,
10110 .capsrc_nids = alc882_capsrc_nids,
10111 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10112 .channel_mode = alc882_3ST_6ch_modes,
10114 .input_mux = &alc882_capture_source,
10116 [ALC882_ASUS_A7M] = {
10117 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10118 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10119 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10120 alc882_asus_a7m_verbs },
10121 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10122 .dac_nids = alc882_dac_nids,
10123 .dig_out_nid = ALC882_DIGOUT_NID,
10124 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10125 .channel_mode = alc880_threestack_modes,
10127 .input_mux = &alc882_capture_source,
10129 [ALC883_3ST_2ch_DIG] = {
10130 .mixers = { alc883_3ST_2ch_mixer },
10131 .init_verbs = { alc883_init_verbs },
10132 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10133 .dac_nids = alc883_dac_nids,
10134 .dig_out_nid = ALC883_DIGOUT_NID,
10135 .dig_in_nid = ALC883_DIGIN_NID,
10136 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10137 .channel_mode = alc883_3ST_2ch_modes,
10138 .input_mux = &alc883_capture_source,
10140 [ALC883_3ST_6ch_DIG] = {
10141 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10142 .init_verbs = { alc883_init_verbs },
10143 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10144 .dac_nids = alc883_dac_nids,
10145 .dig_out_nid = ALC883_DIGOUT_NID,
10146 .dig_in_nid = ALC883_DIGIN_NID,
10147 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10148 .channel_mode = alc883_3ST_6ch_modes,
10150 .input_mux = &alc883_capture_source,
10152 [ALC883_3ST_6ch] = {
10153 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10154 .init_verbs = { alc883_init_verbs },
10155 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10156 .dac_nids = alc883_dac_nids,
10157 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10158 .channel_mode = alc883_3ST_6ch_modes,
10160 .input_mux = &alc883_capture_source,
10162 [ALC883_3ST_6ch_INTEL] = {
10163 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10164 .init_verbs = { alc883_init_verbs },
10165 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10166 .dac_nids = alc883_dac_nids,
10167 .dig_out_nid = ALC883_DIGOUT_NID,
10168 .dig_in_nid = ALC883_DIGIN_NID,
10169 .slave_dig_outs = alc883_slave_dig_outs,
10170 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10171 .channel_mode = alc883_3ST_6ch_intel_modes,
10173 .input_mux = &alc883_3stack_6ch_intel,
10175 [ALC889A_INTEL] = {
10176 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10177 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10178 alc_hp15_unsol_verbs },
10179 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10180 .dac_nids = alc883_dac_nids,
10181 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10182 .adc_nids = alc889_adc_nids,
10183 .dig_out_nid = ALC883_DIGOUT_NID,
10184 .dig_in_nid = ALC883_DIGIN_NID,
10185 .slave_dig_outs = alc883_slave_dig_outs,
10186 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10187 .channel_mode = alc889_8ch_intel_modes,
10188 .capsrc_nids = alc889_capsrc_nids,
10189 .input_mux = &alc889_capture_source,
10190 .setup = alc889_automute_setup,
10191 .init_hook = alc_automute_amp,
10192 .unsol_event = alc_automute_amp_unsol_event,
10196 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10197 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10198 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10199 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10200 .dac_nids = alc883_dac_nids,
10201 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10202 .adc_nids = alc889_adc_nids,
10203 .dig_out_nid = ALC883_DIGOUT_NID,
10204 .dig_in_nid = ALC883_DIGIN_NID,
10205 .slave_dig_outs = alc883_slave_dig_outs,
10206 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10207 .channel_mode = alc889_8ch_intel_modes,
10208 .capsrc_nids = alc889_capsrc_nids,
10209 .input_mux = &alc889_capture_source,
10210 .setup = alc889_automute_setup,
10211 .init_hook = alc889_intel_init_hook,
10212 .unsol_event = alc_automute_amp_unsol_event,
10215 [ALC883_6ST_DIG] = {
10216 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10217 .init_verbs = { alc883_init_verbs },
10218 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10219 .dac_nids = alc883_dac_nids,
10220 .dig_out_nid = ALC883_DIGOUT_NID,
10221 .dig_in_nid = ALC883_DIGIN_NID,
10222 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10223 .channel_mode = alc883_sixstack_modes,
10224 .input_mux = &alc883_capture_source,
10226 [ALC883_TARGA_DIG] = {
10227 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10228 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10229 alc883_targa_verbs},
10230 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10231 .dac_nids = alc883_dac_nids,
10232 .dig_out_nid = ALC883_DIGOUT_NID,
10233 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10234 .channel_mode = alc883_3ST_6ch_modes,
10236 .input_mux = &alc883_capture_source,
10237 .unsol_event = alc883_targa_unsol_event,
10238 .setup = alc882_targa_setup,
10239 .init_hook = alc882_targa_automute,
10241 [ALC883_TARGA_2ch_DIG] = {
10242 .mixers = { alc883_targa_2ch_mixer},
10243 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10244 alc883_targa_verbs},
10245 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10246 .dac_nids = alc883_dac_nids,
10247 .adc_nids = alc883_adc_nids_alt,
10248 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10249 .capsrc_nids = alc883_capsrc_nids,
10250 .dig_out_nid = ALC883_DIGOUT_NID,
10251 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10252 .channel_mode = alc883_3ST_2ch_modes,
10253 .input_mux = &alc883_capture_source,
10254 .unsol_event = alc883_targa_unsol_event,
10255 .setup = alc882_targa_setup,
10256 .init_hook = alc882_targa_automute,
10258 [ALC883_TARGA_8ch_DIG] = {
10259 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10260 alc883_chmode_mixer },
10261 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10262 alc883_targa_verbs },
10263 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10264 .dac_nids = alc883_dac_nids,
10265 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10266 .adc_nids = alc883_adc_nids_rev,
10267 .capsrc_nids = alc883_capsrc_nids_rev,
10268 .dig_out_nid = ALC883_DIGOUT_NID,
10269 .dig_in_nid = ALC883_DIGIN_NID,
10270 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10271 .channel_mode = alc883_4ST_8ch_modes,
10273 .input_mux = &alc883_capture_source,
10274 .unsol_event = alc883_targa_unsol_event,
10275 .setup = alc882_targa_setup,
10276 .init_hook = alc882_targa_automute,
10279 .mixers = { alc883_base_mixer },
10280 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10281 * and the headphone jack. Turn this on and rely on the
10282 * standard mute methods whenever the user wants to turn
10283 * these outputs off.
10285 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10286 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10287 .dac_nids = alc883_dac_nids,
10288 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10289 .channel_mode = alc883_3ST_2ch_modes,
10290 .input_mux = &alc883_capture_source,
10292 [ALC883_ACER_ASPIRE] = {
10293 .mixers = { alc883_acer_aspire_mixer },
10294 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10295 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10296 .dac_nids = alc883_dac_nids,
10297 .dig_out_nid = ALC883_DIGOUT_NID,
10298 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10299 .channel_mode = alc883_3ST_2ch_modes,
10300 .input_mux = &alc883_capture_source,
10301 .unsol_event = alc_automute_amp_unsol_event,
10302 .setup = alc883_acer_aspire_setup,
10303 .init_hook = alc_automute_amp,
10305 [ALC888_ACER_ASPIRE_4930G] = {
10306 .mixers = { alc888_base_mixer,
10307 alc883_chmode_mixer },
10308 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10309 alc888_acer_aspire_4930g_verbs },
10310 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10311 .dac_nids = alc883_dac_nids,
10312 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10313 .adc_nids = alc883_adc_nids_rev,
10314 .capsrc_nids = alc883_capsrc_nids_rev,
10315 .dig_out_nid = ALC883_DIGOUT_NID,
10316 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10317 .channel_mode = alc883_3ST_6ch_modes,
10319 .const_channel_count = 6,
10321 ARRAY_SIZE(alc888_2_capture_sources),
10322 .input_mux = alc888_2_capture_sources,
10323 .unsol_event = alc_automute_amp_unsol_event,
10324 .setup = alc888_acer_aspire_4930g_setup,
10325 .init_hook = alc_automute_amp,
10327 [ALC888_ACER_ASPIRE_6530G] = {
10328 .mixers = { alc888_acer_aspire_6530_mixer },
10329 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10330 alc888_acer_aspire_6530g_verbs },
10331 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10332 .dac_nids = alc883_dac_nids,
10333 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10334 .adc_nids = alc883_adc_nids_rev,
10335 .capsrc_nids = alc883_capsrc_nids_rev,
10336 .dig_out_nid = ALC883_DIGOUT_NID,
10337 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10338 .channel_mode = alc883_3ST_2ch_modes,
10340 ARRAY_SIZE(alc888_2_capture_sources),
10341 .input_mux = alc888_acer_aspire_6530_sources,
10342 .unsol_event = alc_automute_amp_unsol_event,
10343 .setup = alc888_acer_aspire_6530g_setup,
10344 .init_hook = alc_automute_amp,
10346 [ALC888_ACER_ASPIRE_8930G] = {
10347 .mixers = { alc889_acer_aspire_8930g_mixer,
10348 alc883_chmode_mixer },
10349 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10350 alc889_acer_aspire_8930g_verbs,
10351 alc889_eapd_verbs},
10352 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10353 .dac_nids = alc883_dac_nids,
10354 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10355 .adc_nids = alc889_adc_nids,
10356 .capsrc_nids = alc889_capsrc_nids,
10357 .dig_out_nid = ALC883_DIGOUT_NID,
10358 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10359 .channel_mode = alc883_3ST_6ch_modes,
10361 .const_channel_count = 6,
10363 ARRAY_SIZE(alc889_capture_sources),
10364 .input_mux = alc889_capture_sources,
10365 .unsol_event = alc_automute_amp_unsol_event,
10366 .setup = alc889_acer_aspire_8930g_setup,
10367 .init_hook = alc_automute_amp,
10368 #ifdef CONFIG_SND_HDA_POWER_SAVE
10369 .power_hook = alc_power_eapd,
10372 [ALC888_ACER_ASPIRE_7730G] = {
10373 .mixers = { alc883_3ST_6ch_mixer,
10374 alc883_chmode_mixer },
10375 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10376 alc888_acer_aspire_7730G_verbs },
10377 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10378 .dac_nids = alc883_dac_nids,
10379 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10380 .adc_nids = alc883_adc_nids_rev,
10381 .capsrc_nids = alc883_capsrc_nids_rev,
10382 .dig_out_nid = ALC883_DIGOUT_NID,
10383 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10384 .channel_mode = alc883_3ST_6ch_modes,
10386 .const_channel_count = 6,
10387 .input_mux = &alc883_capture_source,
10388 .unsol_event = alc_automute_amp_unsol_event,
10389 .setup = alc888_acer_aspire_7730g_setup,
10390 .init_hook = alc_automute_amp,
10392 [ALC883_MEDION] = {
10393 .mixers = { alc883_fivestack_mixer,
10394 alc883_chmode_mixer },
10395 .init_verbs = { alc883_init_verbs,
10396 alc883_medion_eapd_verbs },
10397 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10398 .dac_nids = alc883_dac_nids,
10399 .adc_nids = alc883_adc_nids_alt,
10400 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10401 .capsrc_nids = alc883_capsrc_nids,
10402 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10403 .channel_mode = alc883_sixstack_modes,
10404 .input_mux = &alc883_capture_source,
10406 [ALC883_MEDION_WIM2160] = {
10407 .mixers = { alc883_medion_wim2160_mixer },
10408 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10409 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10410 .dac_nids = alc883_dac_nids,
10411 .dig_out_nid = ALC883_DIGOUT_NID,
10412 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10413 .adc_nids = alc883_adc_nids,
10414 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10415 .channel_mode = alc883_3ST_2ch_modes,
10416 .input_mux = &alc883_capture_source,
10417 .unsol_event = alc_automute_amp_unsol_event,
10418 .setup = alc883_medion_wim2160_setup,
10419 .init_hook = alc_automute_amp,
10421 [ALC883_LAPTOP_EAPD] = {
10422 .mixers = { alc883_base_mixer },
10423 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10424 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10425 .dac_nids = alc883_dac_nids,
10426 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10427 .channel_mode = alc883_3ST_2ch_modes,
10428 .input_mux = &alc883_capture_source,
10430 [ALC883_CLEVO_M540R] = {
10431 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10432 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10433 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10434 .dac_nids = alc883_dac_nids,
10435 .dig_out_nid = ALC883_DIGOUT_NID,
10436 .dig_in_nid = ALC883_DIGIN_NID,
10437 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10438 .channel_mode = alc883_3ST_6ch_clevo_modes,
10440 .input_mux = &alc883_capture_source,
10441 /* This machine has the hardware HP auto-muting, thus
10442 * we need no software mute via unsol event
10445 [ALC883_CLEVO_M720] = {
10446 .mixers = { alc883_clevo_m720_mixer },
10447 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10448 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10449 .dac_nids = alc883_dac_nids,
10450 .dig_out_nid = ALC883_DIGOUT_NID,
10451 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10452 .channel_mode = alc883_3ST_2ch_modes,
10453 .input_mux = &alc883_capture_source,
10454 .unsol_event = alc883_clevo_m720_unsol_event,
10455 .setup = alc883_clevo_m720_setup,
10456 .init_hook = alc883_clevo_m720_init_hook,
10458 [ALC883_LENOVO_101E_2ch] = {
10459 .mixers = { alc883_lenovo_101e_2ch_mixer},
10460 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10461 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10462 .dac_nids = alc883_dac_nids,
10463 .adc_nids = alc883_adc_nids_alt,
10464 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10465 .capsrc_nids = alc883_capsrc_nids,
10466 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10467 .channel_mode = alc883_3ST_2ch_modes,
10468 .input_mux = &alc883_lenovo_101e_capture_source,
10469 .unsol_event = alc883_lenovo_101e_unsol_event,
10470 .init_hook = alc883_lenovo_101e_all_automute,
10472 [ALC883_LENOVO_NB0763] = {
10473 .mixers = { alc883_lenovo_nb0763_mixer },
10474 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10475 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10476 .dac_nids = alc883_dac_nids,
10477 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10478 .channel_mode = alc883_3ST_2ch_modes,
10480 .input_mux = &alc883_lenovo_nb0763_capture_source,
10481 .unsol_event = alc_automute_amp_unsol_event,
10482 .setup = alc883_lenovo_nb0763_setup,
10483 .init_hook = alc_automute_amp,
10485 [ALC888_LENOVO_MS7195_DIG] = {
10486 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10487 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10488 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10489 .dac_nids = alc883_dac_nids,
10490 .dig_out_nid = ALC883_DIGOUT_NID,
10491 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10492 .channel_mode = alc883_3ST_6ch_modes,
10494 .input_mux = &alc883_capture_source,
10495 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10496 .init_hook = alc888_lenovo_ms7195_front_automute,
10498 [ALC883_HAIER_W66] = {
10499 .mixers = { alc883_targa_2ch_mixer},
10500 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10501 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10502 .dac_nids = alc883_dac_nids,
10503 .dig_out_nid = ALC883_DIGOUT_NID,
10504 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10505 .channel_mode = alc883_3ST_2ch_modes,
10506 .input_mux = &alc883_capture_source,
10507 .unsol_event = alc_automute_amp_unsol_event,
10508 .setup = alc883_haier_w66_setup,
10509 .init_hook = alc_automute_amp,
10511 [ALC888_3ST_HP] = {
10512 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10513 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10514 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10515 .dac_nids = alc883_dac_nids,
10516 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10517 .channel_mode = alc888_3st_hp_modes,
10519 .input_mux = &alc883_capture_source,
10520 .unsol_event = alc_automute_amp_unsol_event,
10521 .setup = alc888_3st_hp_setup,
10522 .init_hook = alc_automute_amp,
10524 [ALC888_6ST_DELL] = {
10525 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10526 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10527 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10528 .dac_nids = alc883_dac_nids,
10529 .dig_out_nid = ALC883_DIGOUT_NID,
10530 .dig_in_nid = ALC883_DIGIN_NID,
10531 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10532 .channel_mode = alc883_sixstack_modes,
10533 .input_mux = &alc883_capture_source,
10534 .unsol_event = alc_automute_amp_unsol_event,
10535 .setup = alc888_6st_dell_setup,
10536 .init_hook = alc_automute_amp,
10539 .mixers = { alc883_mitac_mixer },
10540 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10541 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10542 .dac_nids = alc883_dac_nids,
10543 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10544 .channel_mode = alc883_3ST_2ch_modes,
10545 .input_mux = &alc883_capture_source,
10546 .unsol_event = alc_automute_amp_unsol_event,
10547 .setup = alc883_mitac_setup,
10548 .init_hook = alc_automute_amp,
10550 [ALC883_FUJITSU_PI2515] = {
10551 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10552 .init_verbs = { alc883_init_verbs,
10553 alc883_2ch_fujitsu_pi2515_verbs},
10554 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10555 .dac_nids = alc883_dac_nids,
10556 .dig_out_nid = ALC883_DIGOUT_NID,
10557 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10558 .channel_mode = alc883_3ST_2ch_modes,
10559 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10560 .unsol_event = alc_automute_amp_unsol_event,
10561 .setup = alc883_2ch_fujitsu_pi2515_setup,
10562 .init_hook = alc_automute_amp,
10564 [ALC888_FUJITSU_XA3530] = {
10565 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10566 .init_verbs = { alc883_init_verbs,
10567 alc888_fujitsu_xa3530_verbs },
10568 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10569 .dac_nids = alc883_dac_nids,
10570 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10571 .adc_nids = alc883_adc_nids_rev,
10572 .capsrc_nids = alc883_capsrc_nids_rev,
10573 .dig_out_nid = ALC883_DIGOUT_NID,
10574 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10575 .channel_mode = alc888_4ST_8ch_intel_modes,
10577 ARRAY_SIZE(alc888_2_capture_sources),
10578 .input_mux = alc888_2_capture_sources,
10579 .unsol_event = alc_automute_amp_unsol_event,
10580 .setup = alc888_fujitsu_xa3530_setup,
10581 .init_hook = alc_automute_amp,
10583 [ALC888_LENOVO_SKY] = {
10584 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10585 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10586 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10587 .dac_nids = alc883_dac_nids,
10588 .dig_out_nid = ALC883_DIGOUT_NID,
10589 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10590 .channel_mode = alc883_sixstack_modes,
10592 .input_mux = &alc883_lenovo_sky_capture_source,
10593 .unsol_event = alc_automute_amp_unsol_event,
10594 .setup = alc888_lenovo_sky_setup,
10595 .init_hook = alc_automute_amp,
10597 [ALC888_ASUS_M90V] = {
10598 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10599 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10600 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10601 .dac_nids = alc883_dac_nids,
10602 .dig_out_nid = ALC883_DIGOUT_NID,
10603 .dig_in_nid = ALC883_DIGIN_NID,
10604 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10605 .channel_mode = alc883_3ST_6ch_modes,
10607 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10608 .unsol_event = alc_sku_unsol_event,
10609 .setup = alc883_mode2_setup,
10610 .init_hook = alc_inithook,
10612 [ALC888_ASUS_EEE1601] = {
10613 .mixers = { alc883_asus_eee1601_mixer },
10614 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10615 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10616 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10617 .dac_nids = alc883_dac_nids,
10618 .dig_out_nid = ALC883_DIGOUT_NID,
10619 .dig_in_nid = ALC883_DIGIN_NID,
10620 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10621 .channel_mode = alc883_3ST_2ch_modes,
10623 .input_mux = &alc883_asus_eee1601_capture_source,
10624 .unsol_event = alc_sku_unsol_event,
10625 .init_hook = alc883_eee1601_inithook,
10627 [ALC1200_ASUS_P5Q] = {
10628 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10629 .init_verbs = { alc883_init_verbs },
10630 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10631 .dac_nids = alc883_dac_nids,
10632 .dig_out_nid = ALC1200_DIGOUT_NID,
10633 .dig_in_nid = ALC883_DIGIN_NID,
10634 .slave_dig_outs = alc1200_slave_dig_outs,
10635 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10636 .channel_mode = alc883_sixstack_modes,
10637 .input_mux = &alc883_capture_source,
10640 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10641 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10642 alc880_gpio1_init_verbs },
10643 .adc_nids = alc883_adc_nids,
10644 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10645 .capsrc_nids = alc883_capsrc_nids,
10646 .dac_nids = alc883_dac_nids,
10647 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10648 .channel_mode = alc889A_mb31_6ch_modes,
10649 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10650 .input_mux = &alc889A_mb31_capture_source,
10651 .dig_out_nid = ALC883_DIGOUT_NID,
10652 .unsol_event = alc889A_mb31_unsol_event,
10653 .init_hook = alc889A_mb31_automute,
10655 [ALC883_SONY_VAIO_TT] = {
10656 .mixers = { alc883_vaiott_mixer },
10657 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10658 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10659 .dac_nids = alc883_dac_nids,
10660 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10661 .channel_mode = alc883_3ST_2ch_modes,
10662 .input_mux = &alc883_capture_source,
10663 .unsol_event = alc_automute_amp_unsol_event,
10664 .setup = alc883_vaiott_setup,
10665 .init_hook = alc_automute_amp,
10674 PINFIX_ABIT_AW9D_MAX,
10676 PINFIX_ACER_ASPIRE_7736,
10679 static const struct alc_fixup alc882_fixups[] = {
10680 [PINFIX_ABIT_AW9D_MAX] = {
10681 .pins = (const struct alc_pincfg[]) {
10682 { 0x15, 0x01080104 }, /* side */
10683 { 0x16, 0x01011012 }, /* rear */
10684 { 0x17, 0x01016011 }, /* clfe */
10688 [PINFIX_PB_M5210] = {
10689 .verbs = (const struct hda_verb[]) {
10690 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10694 [PINFIX_ACER_ASPIRE_7736] = {
10695 .sku = ALC_FIXUP_SKU_IGNORE,
10699 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10700 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10701 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10702 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10707 * BIOS auto configuration
10709 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10710 const struct auto_pin_cfg *cfg)
10712 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10715 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10716 hda_nid_t nid, int pin_type,
10721 /* set as output */
10722 alc_set_pin_output(codec, nid, pin_type);
10726 else if (dac >= 0x02 && dac <= 0x05)
10730 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10733 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10735 struct alc_spec *spec = codec->spec;
10738 for (i = 0; i <= HDA_SIDE; i++) {
10739 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10740 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10742 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10743 spec->multiout.dac_nids[i]);
10747 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10749 struct alc_spec *spec = codec->spec;
10750 hda_nid_t pin, dac;
10753 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10754 pin = spec->autocfg.hp_pins[i];
10757 dac = spec->multiout.hp_nid;
10759 dac = spec->multiout.dac_nids[0]; /* to front */
10760 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10762 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10763 pin = spec->autocfg.speaker_pins[i];
10766 dac = spec->multiout.extra_out_nid[0];
10768 dac = spec->multiout.dac_nids[0]; /* to front */
10769 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10773 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10775 struct alc_spec *spec = codec->spec;
10776 struct auto_pin_cfg *cfg = &spec->autocfg;
10779 for (i = 0; i < cfg->num_inputs; i++) {
10780 hda_nid_t nid = cfg->inputs[i].pin;
10781 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10782 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10783 snd_hda_codec_write(codec, nid, 0,
10784 AC_VERB_SET_AMP_GAIN_MUTE,
10789 static void alc882_auto_init_input_src(struct hda_codec *codec)
10791 struct alc_spec *spec = codec->spec;
10794 for (c = 0; c < spec->num_adc_nids; c++) {
10795 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10796 hda_nid_t nid = spec->capsrc_nids[c];
10797 unsigned int mux_idx;
10798 const struct hda_input_mux *imux;
10799 int conns, mute, idx, item;
10801 conns = snd_hda_get_connections(codec, nid, conn_list,
10802 ARRAY_SIZE(conn_list));
10805 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10806 imux = &spec->input_mux[mux_idx];
10807 if (!imux->num_items && mux_idx > 0)
10808 imux = &spec->input_mux[0];
10809 for (idx = 0; idx < conns; idx++) {
10810 /* if the current connection is the selected one,
10811 * unmute it as default - otherwise mute it
10813 mute = AMP_IN_MUTE(idx);
10814 for (item = 0; item < imux->num_items; item++) {
10815 if (imux->items[item].index == idx) {
10816 if (spec->cur_mux[c] == item)
10817 mute = AMP_IN_UNMUTE(idx);
10821 /* check if we have a selector or mixer
10822 * we could check for the widget type instead, but
10823 * just check for Amp-In presence (in case of mixer
10824 * without amp-in there is something wrong, this
10825 * function shouldn't be used or capsrc nid is wrong)
10827 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10828 snd_hda_codec_write(codec, nid, 0,
10829 AC_VERB_SET_AMP_GAIN_MUTE,
10831 else if (mute != AMP_IN_MUTE(idx))
10832 snd_hda_codec_write(codec, nid, 0,
10833 AC_VERB_SET_CONNECT_SEL,
10839 /* add mic boosts if needed */
10840 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10842 struct alc_spec *spec = codec->spec;
10843 struct auto_pin_cfg *cfg = &spec->autocfg;
10847 const char *prev_label = NULL;
10849 for (i = 0; i < cfg->num_inputs; i++) {
10850 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10852 nid = cfg->inputs[i].pin;
10853 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10855 char boost_label[32];
10857 label = hda_get_autocfg_input_label(codec, cfg, i);
10858 if (prev_label && !strcmp(label, prev_label))
10862 prev_label = label;
10864 snprintf(boost_label, sizeof(boost_label),
10865 "%s Boost Volume", label);
10866 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10867 boost_label, type_idx,
10868 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10876 /* almost identical with ALC880 parser... */
10877 static int alc882_parse_auto_config(struct hda_codec *codec)
10879 struct alc_spec *spec = codec->spec;
10880 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10883 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10887 if (!spec->autocfg.line_outs)
10888 return 0; /* can't find valid BIOS pin config */
10890 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10893 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10896 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10900 err = alc880_auto_create_extra_out(spec,
10901 spec->autocfg.speaker_pins[0],
10905 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10909 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10911 alc_auto_parse_digital(codec);
10913 if (spec->kctls.list)
10914 add_mixer(spec, spec->kctls.list);
10916 add_verb(spec, alc883_auto_init_verbs);
10917 /* if ADC 0x07 is available, initialize it, too */
10918 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10919 add_verb(spec, alc882_adc1_init_verbs);
10921 spec->num_mux_defs = 1;
10922 spec->input_mux = &spec->private_imux[0];
10924 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10926 err = alc_auto_add_mic_boost(codec);
10930 return 1; /* config found */
10933 /* additional initialization for auto-configuration model */
10934 static void alc882_auto_init(struct hda_codec *codec)
10936 struct alc_spec *spec = codec->spec;
10937 alc882_auto_init_multi_out(codec);
10938 alc882_auto_init_hp_out(codec);
10939 alc882_auto_init_analog_input(codec);
10940 alc882_auto_init_input_src(codec);
10941 alc_auto_init_digital(codec);
10942 if (spec->unsol_event)
10943 alc_inithook(codec);
10946 static int patch_alc882(struct hda_codec *codec)
10948 struct alc_spec *spec;
10949 int err, board_config;
10951 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10955 codec->spec = spec;
10957 switch (codec->vendor_id) {
10962 /* ALC883 and variants */
10963 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10967 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10971 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10972 board_config = snd_hda_check_board_codec_sid_config(codec,
10973 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10975 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10976 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10978 board_config = ALC882_AUTO;
10981 if (board_config == ALC882_AUTO)
10982 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10984 alc_auto_parse_customize_define(codec);
10986 if (board_config == ALC882_AUTO) {
10987 /* automatic parse from the BIOS config */
10988 err = alc882_parse_auto_config(codec);
10994 "hda_codec: Cannot set up configuration "
10995 "from BIOS. Using base mode...\n");
10996 board_config = ALC882_3ST_DIG;
11000 if (has_cdefine_beep(codec)) {
11001 err = snd_hda_attach_beep_device(codec, 0x1);
11008 if (board_config != ALC882_AUTO)
11009 setup_preset(codec, &alc882_presets[board_config]);
11011 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11012 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11013 /* FIXME: setup DAC5 */
11014 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11015 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11017 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11018 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11020 if (!spec->adc_nids && spec->input_mux) {
11022 spec->num_adc_nids = 0;
11023 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11024 const struct hda_input_mux *imux = spec->input_mux;
11026 hda_nid_t items[16];
11027 hda_nid_t nid = alc882_adc_nids[i];
11028 unsigned int wcap = get_wcaps(codec, nid);
11030 wcap = get_wcaps_type(wcap);
11031 if (wcap != AC_WID_AUD_IN)
11033 spec->private_adc_nids[spec->num_adc_nids] = nid;
11034 err = snd_hda_get_connections(codec, nid, &cap, 1);
11037 err = snd_hda_get_connections(codec, cap, items,
11038 ARRAY_SIZE(items));
11041 for (j = 0; j < imux->num_items; j++)
11042 if (imux->items[j].index >= err)
11044 if (j < imux->num_items)
11046 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11047 spec->num_adc_nids++;
11049 spec->adc_nids = spec->private_adc_nids;
11050 spec->capsrc_nids = spec->private_capsrc_nids;
11053 set_capture_mixer(codec);
11055 if (has_cdefine_beep(codec))
11056 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11058 if (board_config == ALC882_AUTO)
11059 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
11061 spec->vmaster_nid = 0x0c;
11063 codec->patch_ops = alc_patch_ops;
11064 if (board_config == ALC882_AUTO)
11065 spec->init_hook = alc882_auto_init;
11067 alc_init_jacks(codec);
11068 #ifdef CONFIG_SND_HDA_POWER_SAVE
11069 if (!spec->loopback.amplist)
11070 spec->loopback.amplist = alc882_loopbacks;
11081 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11082 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11084 #define alc262_dac_nids alc260_dac_nids
11085 #define alc262_adc_nids alc882_adc_nids
11086 #define alc262_adc_nids_alt alc882_adc_nids_alt
11087 #define alc262_capsrc_nids alc882_capsrc_nids
11088 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11090 #define alc262_modes alc260_modes
11091 #define alc262_capture_source alc882_capture_source
11093 static hda_nid_t alc262_dmic_adc_nids[1] = {
11098 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11100 static struct snd_kcontrol_new alc262_base_mixer[] = {
11101 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11102 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11103 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11104 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11105 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11106 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11109 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11110 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11112 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11113 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11114 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11115 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11116 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11120 /* update HP, line and mono-out pins according to the master switch */
11121 static void alc262_hp_master_update(struct hda_codec *codec)
11123 struct alc_spec *spec = codec->spec;
11124 int val = spec->master_sw;
11126 /* HP & line-out */
11127 snd_hda_codec_write_cache(codec, 0x1b, 0,
11128 AC_VERB_SET_PIN_WIDGET_CONTROL,
11130 snd_hda_codec_write_cache(codec, 0x15, 0,
11131 AC_VERB_SET_PIN_WIDGET_CONTROL,
11133 /* mono (speaker) depending on the HP jack sense */
11134 val = val && !spec->jack_present;
11135 snd_hda_codec_write_cache(codec, 0x16, 0,
11136 AC_VERB_SET_PIN_WIDGET_CONTROL,
11137 val ? PIN_OUT : 0);
11140 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11142 struct alc_spec *spec = codec->spec;
11144 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11145 alc262_hp_master_update(codec);
11148 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11150 if ((res >> 26) != ALC880_HP_EVENT)
11152 alc262_hp_bpc_automute(codec);
11155 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11157 struct alc_spec *spec = codec->spec;
11159 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11160 alc262_hp_master_update(codec);
11163 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11166 if ((res >> 26) != ALC880_HP_EVENT)
11168 alc262_hp_wildwest_automute(codec);
11171 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11173 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11174 struct snd_ctl_elem_value *ucontrol)
11176 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11177 struct alc_spec *spec = codec->spec;
11178 int val = !!*ucontrol->value.integer.value;
11180 if (val == spec->master_sw)
11182 spec->master_sw = val;
11183 alc262_hp_master_update(codec);
11187 #define ALC262_HP_MASTER_SWITCH \
11189 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11190 .name = "Master Playback Switch", \
11191 .info = snd_ctl_boolean_mono_info, \
11192 .get = alc262_hp_master_sw_get, \
11193 .put = alc262_hp_master_sw_put, \
11196 .iface = NID_MAPPING, \
11197 .name = "Master Playback Switch", \
11198 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11202 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11203 ALC262_HP_MASTER_SWITCH,
11204 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11205 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11207 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11209 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11213 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11214 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11215 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11216 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11221 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11222 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11226 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11227 ALC262_HP_MASTER_SWITCH,
11228 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11229 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11230 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11231 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11232 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11234 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11236 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11237 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11238 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11239 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11240 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11241 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11242 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11246 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11247 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11248 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11249 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11253 /* mute/unmute internal speaker according to the hp jack and mute state */
11254 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11256 struct alc_spec *spec = codec->spec;
11258 spec->autocfg.hp_pins[0] = 0x15;
11259 spec->autocfg.speaker_pins[0] = 0x14;
11262 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11263 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11264 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11265 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11266 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11267 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11268 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11269 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11273 static struct hda_verb alc262_hp_t5735_verbs[] = {
11274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11277 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11281 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11282 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11283 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11284 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11285 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11286 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11287 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11291 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11292 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11293 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11294 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11295 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11296 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11297 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11300 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11305 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11312 /* bind hp and internal speaker mute (with plug check) as master switch */
11313 static void alc262_hippo_master_update(struct hda_codec *codec)
11315 struct alc_spec *spec = codec->spec;
11316 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11317 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11318 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11322 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11323 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11324 HDA_AMP_MUTE, mute);
11325 /* mute internal speaker per jack sense */
11326 if (spec->jack_present)
11327 mute = HDA_AMP_MUTE;
11329 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11330 HDA_AMP_MUTE, mute);
11331 if (speaker_nid && speaker_nid != line_nid)
11332 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11333 HDA_AMP_MUTE, mute);
11336 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11338 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11339 struct snd_ctl_elem_value *ucontrol)
11341 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11342 struct alc_spec *spec = codec->spec;
11343 int val = !!*ucontrol->value.integer.value;
11345 if (val == spec->master_sw)
11347 spec->master_sw = val;
11348 alc262_hippo_master_update(codec);
11352 #define ALC262_HIPPO_MASTER_SWITCH \
11354 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11355 .name = "Master Playback Switch", \
11356 .info = snd_ctl_boolean_mono_info, \
11357 .get = alc262_hippo_master_sw_get, \
11358 .put = alc262_hippo_master_sw_put, \
11361 .iface = NID_MAPPING, \
11362 .name = "Master Playback Switch", \
11363 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11364 (SUBDEV_SPEAKER(0) << 16), \
11367 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11368 ALC262_HIPPO_MASTER_SWITCH,
11369 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11370 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11371 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11372 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11373 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11376 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11377 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11378 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11379 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11380 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11384 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11385 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11386 ALC262_HIPPO_MASTER_SWITCH,
11387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11389 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11390 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11391 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11392 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11393 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11394 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11395 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11396 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11400 /* mute/unmute internal speaker according to the hp jack and mute state */
11401 static void alc262_hippo_automute(struct hda_codec *codec)
11403 struct alc_spec *spec = codec->spec;
11404 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11406 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11407 alc262_hippo_master_update(codec);
11410 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11412 if ((res >> 26) != ALC880_HP_EVENT)
11414 alc262_hippo_automute(codec);
11417 static void alc262_hippo_setup(struct hda_codec *codec)
11419 struct alc_spec *spec = codec->spec;
11421 spec->autocfg.hp_pins[0] = 0x15;
11422 spec->autocfg.speaker_pins[0] = 0x14;
11425 static void alc262_hippo1_setup(struct hda_codec *codec)
11427 struct alc_spec *spec = codec->spec;
11429 spec->autocfg.hp_pins[0] = 0x1b;
11430 spec->autocfg.speaker_pins[0] = 0x14;
11434 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11435 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11436 ALC262_HIPPO_MASTER_SWITCH,
11437 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11438 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11439 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11440 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11444 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11445 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11446 ALC262_HIPPO_MASTER_SWITCH,
11447 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11448 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11449 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11450 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11451 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11455 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11456 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11457 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11458 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11459 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11460 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11461 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11463 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11464 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11465 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11466 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11467 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11471 static struct hda_verb alc262_tyan_verbs[] = {
11472 /* Headphone automute */
11473 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11474 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11475 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11477 /* P11 AUX_IN, white 4-pin connector */
11478 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11479 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11480 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11481 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11486 /* unsolicited event for HP jack sensing */
11487 static void alc262_tyan_setup(struct hda_codec *codec)
11489 struct alc_spec *spec = codec->spec;
11491 spec->autocfg.hp_pins[0] = 0x1b;
11492 spec->autocfg.speaker_pins[0] = 0x15;
11496 #define alc262_capture_mixer alc882_capture_mixer
11497 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11500 * generic initialization of ADC, input mixers and output mixers
11502 static struct hda_verb alc262_init_verbs[] = {
11504 * Unmute ADC0-2 and set the default input to mic-in
11506 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11508 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11509 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11510 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11511 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11513 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11515 * Note: PASD motherboards uses the Line In 2 as the input for
11516 * front panel mic (mic 2)
11518 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11526 * Set up output mixers (0x0c - 0x0e)
11528 /* set vol=0 to output mixers */
11529 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11530 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11531 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11532 /* set up input amps for analog loopback */
11533 /* Amp Indices: DAC = 0, mixer = 1 */
11534 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11535 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11536 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11538 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11541 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11542 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11543 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11544 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11545 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11546 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11548 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11549 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11550 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11551 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11552 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11554 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11555 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11557 /* FIXME: use matrix-type input source selection */
11558 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11559 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11560 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11561 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11562 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11563 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11567 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11568 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11573 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11578 static struct hda_verb alc262_eapd_verbs[] = {
11579 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11580 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11584 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11585 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11586 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11587 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11589 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11590 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11594 static struct hda_verb alc262_sony_unsol_verbs[] = {
11595 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11596 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11597 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11600 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11604 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11605 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11606 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11607 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11608 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11609 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11613 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11614 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11615 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11616 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11617 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11618 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11619 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11620 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11621 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11625 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11627 struct alc_spec *spec = codec->spec;
11629 spec->autocfg.hp_pins[0] = 0x15;
11630 spec->autocfg.speaker_pins[0] = 0x14;
11631 spec->ext_mic.pin = 0x18;
11632 spec->ext_mic.mux_idx = 0;
11633 spec->int_mic.pin = 0x12;
11634 spec->int_mic.mux_idx = 9;
11635 spec->auto_mic = 1;
11641 * 0x16 = internal speaker
11642 * 0x18 = external mic
11645 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11646 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11647 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11649 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11650 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11651 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11653 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11654 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11658 static struct hda_verb alc262_nec_verbs[] = {
11659 /* Unmute Speaker */
11660 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11663 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11664 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11666 /* External mic to headphone */
11667 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11668 /* External mic to speaker */
11669 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11675 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11676 * 0x1b = port replicator headphone out
11679 #define ALC_HP_EVENT 0x37
11681 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11682 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11683 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11684 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11685 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11689 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11690 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11691 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11695 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11696 /* Front Mic pin: input vref at 50% */
11697 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11698 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11702 static struct hda_input_mux alc262_fujitsu_capture_source = {
11706 { "Internal Mic", 0x1 },
11711 static struct hda_input_mux alc262_HP_capture_source = {
11715 { "Front Mic", 0x1 },
11722 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11726 { "Front Mic", 0x2 },
11732 /* mute/unmute internal speaker according to the hp jacks and mute state */
11733 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11735 struct alc_spec *spec = codec->spec;
11738 if (force || !spec->sense_updated) {
11739 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11740 snd_hda_jack_detect(codec, 0x1b);
11741 spec->sense_updated = 1;
11743 /* unmute internal speaker only if both HPs are unplugged and
11744 * master switch is on
11746 if (spec->jack_present)
11747 mute = HDA_AMP_MUTE;
11749 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11750 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11751 HDA_AMP_MUTE, mute);
11754 /* unsolicited event for HP jack sensing */
11755 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11758 if ((res >> 26) != ALC_HP_EVENT)
11760 alc262_fujitsu_automute(codec, 1);
11763 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11765 alc262_fujitsu_automute(codec, 1);
11768 /* bind volumes of both NID 0x0c and 0x0d */
11769 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11770 .ops = &snd_hda_bind_vol,
11772 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11773 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11778 /* mute/unmute internal speaker according to the hp jack and mute state */
11779 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11781 struct alc_spec *spec = codec->spec;
11784 if (force || !spec->sense_updated) {
11785 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11786 spec->sense_updated = 1;
11788 if (spec->jack_present) {
11789 /* mute internal speaker */
11790 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11791 HDA_AMP_MUTE, HDA_AMP_MUTE);
11792 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11793 HDA_AMP_MUTE, HDA_AMP_MUTE);
11795 /* unmute internal speaker if necessary */
11796 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11797 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11798 HDA_AMP_MUTE, mute);
11799 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11800 HDA_AMP_MUTE, mute);
11804 /* unsolicited event for HP jack sensing */
11805 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11808 if ((res >> 26) != ALC_HP_EVENT)
11810 alc262_lenovo_3000_automute(codec, 1);
11813 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11814 int dir, int idx, long *valp)
11818 for (i = 0; i < 2; i++, valp++)
11819 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11821 *valp ? 0 : HDA_AMP_MUTE);
11825 /* bind hp and internal speaker mute (with plug check) */
11826 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11827 struct snd_ctl_elem_value *ucontrol)
11829 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11830 long *valp = ucontrol->value.integer.value;
11833 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11834 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11836 alc262_fujitsu_automute(codec, 0);
11840 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11841 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11843 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11844 .name = "Master Playback Switch",
11845 .subdevice = HDA_SUBDEV_AMP_FLAG,
11846 .info = snd_hda_mixer_amp_switch_info,
11847 .get = snd_hda_mixer_amp_switch_get,
11848 .put = alc262_fujitsu_master_sw_put,
11849 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11852 .iface = NID_MAPPING,
11853 .name = "Master Playback Switch",
11854 .private_value = 0x1b,
11856 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11857 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11858 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11861 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11862 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11863 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11867 /* bind hp and internal speaker mute (with plug check) */
11868 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11869 struct snd_ctl_elem_value *ucontrol)
11871 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11872 long *valp = ucontrol->value.integer.value;
11875 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11877 alc262_lenovo_3000_automute(codec, 0);
11881 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11882 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11884 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11885 .name = "Master Playback Switch",
11886 .subdevice = HDA_SUBDEV_AMP_FLAG,
11887 .info = snd_hda_mixer_amp_switch_info,
11888 .get = snd_hda_mixer_amp_switch_get,
11889 .put = alc262_lenovo_3000_master_sw_put,
11890 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11892 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11893 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11894 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11897 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11898 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11899 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11903 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11904 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11905 ALC262_HIPPO_MASTER_SWITCH,
11906 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11907 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11908 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11909 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11910 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11911 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11915 /* additional init verbs for Benq laptops */
11916 static struct hda_verb alc262_EAPD_verbs[] = {
11917 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11918 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11922 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11923 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11924 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11926 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11927 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11931 /* Samsung Q1 Ultra Vista model setup */
11932 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11933 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11934 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11937 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
11938 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
11942 static struct hda_verb alc262_ultra_verbs[] = {
11944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11946 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11948 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11949 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11950 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11951 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11953 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11954 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11955 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11956 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11957 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11959 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11960 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11961 /* ADC, choose mic */
11962 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11963 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11964 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11965 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11966 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11967 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11968 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11969 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11970 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11971 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11975 /* mute/unmute internal speaker according to the hp jack and mute state */
11976 static void alc262_ultra_automute(struct hda_codec *codec)
11978 struct alc_spec *spec = codec->spec;
11982 /* auto-mute only when HP is used as HP */
11983 if (!spec->cur_mux[0]) {
11984 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11985 if (spec->jack_present)
11986 mute = HDA_AMP_MUTE;
11988 /* mute/unmute internal speaker */
11989 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11990 HDA_AMP_MUTE, mute);
11991 /* mute/unmute HP */
11992 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11993 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11996 /* unsolicited event for HP jack sensing */
11997 static void alc262_ultra_unsol_event(struct hda_codec *codec,
12000 if ((res >> 26) != ALC880_HP_EVENT)
12002 alc262_ultra_automute(codec);
12005 static struct hda_input_mux alc262_ultra_capture_source = {
12009 { "Headphone", 0x7 },
12013 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12014 struct snd_ctl_elem_value *ucontrol)
12016 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12017 struct alc_spec *spec = codec->spec;
12020 ret = alc_mux_enum_put(kcontrol, ucontrol);
12023 /* reprogram the HP pin as mic or HP according to the input source */
12024 snd_hda_codec_write_cache(codec, 0x15, 0,
12025 AC_VERB_SET_PIN_WIDGET_CONTROL,
12026 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12027 alc262_ultra_automute(codec); /* mute/unmute HP */
12031 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12032 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12033 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12035 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12036 .name = "Capture Source",
12037 .info = alc_mux_enum_info,
12038 .get = alc_mux_enum_get,
12039 .put = alc262_ultra_mux_enum_put,
12042 .iface = NID_MAPPING,
12043 .name = "Capture Source",
12044 .private_value = 0x15,
12049 /* We use two mixers depending on the output pin; 0x16 is a mono output
12050 * and thus it's bound with a different mixer.
12051 * This function returns which mixer amp should be used.
12053 static int alc262_check_volbit(hda_nid_t nid)
12057 else if (nid == 0x16)
12063 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12064 const char *pfx, int *vbits, int idx)
12069 vbit = alc262_check_volbit(nid);
12072 if (*vbits & vbit) /* a volume control for this mixer already there */
12076 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12078 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12079 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12082 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12083 const char *pfx, int idx)
12090 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12092 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12093 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12096 /* add playback controls from the parsed DAC table */
12097 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12098 const struct auto_pin_cfg *cfg)
12104 spec->multiout.num_dacs = 1; /* only use one dac */
12105 spec->multiout.dac_nids = spec->private_dac_nids;
12106 spec->multiout.dac_nids[0] = 2;
12108 pfx = alc_get_line_out_pfx(cfg, true);
12111 for (i = 0; i < 2; i++) {
12112 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12115 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12116 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12121 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12122 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12129 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12130 alc262_check_volbit(cfg->speaker_pins[0]) |
12131 alc262_check_volbit(cfg->hp_pins[0]);
12132 if (vbits == 1 || vbits == 2)
12133 pfx = "Master"; /* only one mixer is used */
12135 for (i = 0; i < 2; i++) {
12136 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12140 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12141 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12142 "Speaker", &vbits, i);
12146 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12147 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12148 "Headphone", &vbits, i);
12156 #define alc262_auto_create_input_ctls \
12157 alc882_auto_create_input_ctls
12160 * generic initialization of ADC, input mixers and output mixers
12162 static struct hda_verb alc262_volume_init_verbs[] = {
12164 * Unmute ADC0-2 and set the default input to mic-in
12166 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12168 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12169 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12170 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12171 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12173 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12175 * Note: PASD motherboards uses the Line In 2 as the input for
12176 * front panel mic (mic 2)
12178 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12179 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12180 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12181 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12183 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12186 * Set up output mixers (0x0c - 0x0f)
12188 /* set vol=0 to output mixers */
12189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12191 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12193 /* set up input amps for analog loopback */
12194 /* Amp Indices: DAC = 0, mixer = 1 */
12195 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12196 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12197 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12198 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12199 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12200 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12202 /* FIXME: use matrix-type input source selection */
12203 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12204 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12205 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12206 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12208 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12210 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12212 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12213 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12223 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12225 * Unmute ADC0-2 and set the default input to mic-in
12227 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12228 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12229 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12230 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12231 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12232 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12234 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12236 * Note: PASD motherboards uses the Line In 2 as the input for
12237 * front panel mic (mic 2)
12239 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12240 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12241 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12242 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12243 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12244 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12249 * Set up output mixers (0x0c - 0x0e)
12251 /* set vol=0 to output mixers */
12252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12253 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12254 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12256 /* set up input amps for analog loopback */
12257 /* Amp Indices: DAC = 0, mixer = 1 */
12258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12259 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12260 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12262 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12263 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12265 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12266 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12267 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12269 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12270 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12272 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12273 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12275 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12276 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12277 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12278 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12279 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12281 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12282 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12283 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12284 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12285 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12286 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12289 /* FIXME: use matrix-type input source selection */
12290 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12291 /* Input mixer1: only unmute Mic */
12292 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12293 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12294 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12295 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12296 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12297 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12298 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12302 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12318 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12319 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12320 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12322 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12327 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12329 * Unmute ADC0-2 and set the default input to mic-in
12331 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12333 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12334 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12335 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12336 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12338 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12340 * Note: PASD motherboards uses the Line In 2 as the input for front
12341 * panel mic (mic 2)
12343 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12344 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12345 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12346 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12347 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12348 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12349 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12350 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12351 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12353 * Set up output mixers (0x0c - 0x0e)
12355 /* set vol=0 to output mixers */
12356 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12357 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12358 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12360 /* set up input amps for analog loopback */
12361 /* Amp Indices: DAC = 0, mixer = 1 */
12362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12363 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12364 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12365 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12366 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12367 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12370 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12371 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12372 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12373 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12374 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12375 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12376 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12378 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12379 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12381 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12382 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12384 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12385 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12386 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12387 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12388 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12389 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12391 /* FIXME: use matrix-type input source selection */
12392 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12393 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12395 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12396 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12399 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12402 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12403 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12404 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12407 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12408 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12413 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12415 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12418 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12423 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12425 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12426 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12427 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12429 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12430 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12431 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12432 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12434 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12435 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12436 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12447 static const struct alc_fixup alc262_fixups[] = {
12448 [PINFIX_FSC_H270] = {
12449 .pins = (const struct alc_pincfg[]) {
12450 { 0x14, 0x99130110 }, /* speaker */
12451 { 0x15, 0x0221142f }, /* front HP */
12452 { 0x1b, 0x0121141f }, /* rear HP */
12458 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12459 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12464 #ifdef CONFIG_SND_HDA_POWER_SAVE
12465 #define alc262_loopbacks alc880_loopbacks
12468 /* pcm configuration: identical with ALC880 */
12469 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12470 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12471 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12472 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12475 * BIOS auto configuration
12477 static int alc262_parse_auto_config(struct hda_codec *codec)
12479 struct alc_spec *spec = codec->spec;
12481 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12483 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12487 if (!spec->autocfg.line_outs) {
12488 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12489 spec->multiout.max_channels = 2;
12490 spec->no_analog = 1;
12493 return 0; /* can't find valid BIOS pin config */
12495 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12498 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12502 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12505 alc_auto_parse_digital(codec);
12507 if (spec->kctls.list)
12508 add_mixer(spec, spec->kctls.list);
12510 add_verb(spec, alc262_volume_init_verbs);
12511 spec->num_mux_defs = 1;
12512 spec->input_mux = &spec->private_imux[0];
12514 err = alc_auto_add_mic_boost(codec);
12518 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12523 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12524 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12525 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12526 #define alc262_auto_init_input_src alc882_auto_init_input_src
12529 /* init callback for auto-configuration model -- overriding the default init */
12530 static void alc262_auto_init(struct hda_codec *codec)
12532 struct alc_spec *spec = codec->spec;
12533 alc262_auto_init_multi_out(codec);
12534 alc262_auto_init_hp_out(codec);
12535 alc262_auto_init_analog_input(codec);
12536 alc262_auto_init_input_src(codec);
12537 alc_auto_init_digital(codec);
12538 if (spec->unsol_event)
12539 alc_inithook(codec);
12543 * configuration and preset
12545 static const char *alc262_models[ALC262_MODEL_LAST] = {
12546 [ALC262_BASIC] = "basic",
12547 [ALC262_HIPPO] = "hippo",
12548 [ALC262_HIPPO_1] = "hippo_1",
12549 [ALC262_FUJITSU] = "fujitsu",
12550 [ALC262_HP_BPC] = "hp-bpc",
12551 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12552 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12553 [ALC262_HP_RP5700] = "hp-rp5700",
12554 [ALC262_BENQ_ED8] = "benq",
12555 [ALC262_BENQ_T31] = "benq-t31",
12556 [ALC262_SONY_ASSAMD] = "sony-assamd",
12557 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12558 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12559 [ALC262_ULTRA] = "ultra",
12560 [ALC262_LENOVO_3000] = "lenovo-3000",
12561 [ALC262_NEC] = "nec",
12562 [ALC262_TYAN] = "tyan",
12563 [ALC262_AUTO] = "auto",
12566 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12567 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12568 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12569 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12571 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12573 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12575 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12576 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12577 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12578 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12579 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12580 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12581 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12582 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12583 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12584 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12585 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12586 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12587 ALC262_HP_TC_T5735),
12588 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12589 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12590 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12591 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12592 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12593 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12594 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12595 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12596 #if 0 /* disable the quirk since model=auto works better in recent versions */
12597 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12598 ALC262_SONY_ASSAMD),
12600 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12601 ALC262_TOSHIBA_RX1),
12602 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12603 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12604 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12605 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12606 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12608 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12609 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12610 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12611 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12612 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12616 static struct alc_config_preset alc262_presets[] = {
12618 .mixers = { alc262_base_mixer },
12619 .init_verbs = { alc262_init_verbs },
12620 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12621 .dac_nids = alc262_dac_nids,
12623 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12624 .channel_mode = alc262_modes,
12625 .input_mux = &alc262_capture_source,
12628 .mixers = { alc262_hippo_mixer },
12629 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12630 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12631 .dac_nids = alc262_dac_nids,
12633 .dig_out_nid = ALC262_DIGOUT_NID,
12634 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12635 .channel_mode = alc262_modes,
12636 .input_mux = &alc262_capture_source,
12637 .unsol_event = alc262_hippo_unsol_event,
12638 .setup = alc262_hippo_setup,
12639 .init_hook = alc262_hippo_automute,
12641 [ALC262_HIPPO_1] = {
12642 .mixers = { alc262_hippo1_mixer },
12643 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12644 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12645 .dac_nids = alc262_dac_nids,
12647 .dig_out_nid = ALC262_DIGOUT_NID,
12648 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12649 .channel_mode = alc262_modes,
12650 .input_mux = &alc262_capture_source,
12651 .unsol_event = alc262_hippo_unsol_event,
12652 .setup = alc262_hippo1_setup,
12653 .init_hook = alc262_hippo_automute,
12655 [ALC262_FUJITSU] = {
12656 .mixers = { alc262_fujitsu_mixer },
12657 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12658 alc262_fujitsu_unsol_verbs },
12659 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12660 .dac_nids = alc262_dac_nids,
12662 .dig_out_nid = ALC262_DIGOUT_NID,
12663 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12664 .channel_mode = alc262_modes,
12665 .input_mux = &alc262_fujitsu_capture_source,
12666 .unsol_event = alc262_fujitsu_unsol_event,
12667 .init_hook = alc262_fujitsu_init_hook,
12669 [ALC262_HP_BPC] = {
12670 .mixers = { alc262_HP_BPC_mixer },
12671 .init_verbs = { alc262_HP_BPC_init_verbs },
12672 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12673 .dac_nids = alc262_dac_nids,
12675 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12676 .channel_mode = alc262_modes,
12677 .input_mux = &alc262_HP_capture_source,
12678 .unsol_event = alc262_hp_bpc_unsol_event,
12679 .init_hook = alc262_hp_bpc_automute,
12681 [ALC262_HP_BPC_D7000_WF] = {
12682 .mixers = { alc262_HP_BPC_WildWest_mixer },
12683 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12684 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12685 .dac_nids = alc262_dac_nids,
12687 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12688 .channel_mode = alc262_modes,
12689 .input_mux = &alc262_HP_D7000_capture_source,
12690 .unsol_event = alc262_hp_wildwest_unsol_event,
12691 .init_hook = alc262_hp_wildwest_automute,
12693 [ALC262_HP_BPC_D7000_WL] = {
12694 .mixers = { alc262_HP_BPC_WildWest_mixer,
12695 alc262_HP_BPC_WildWest_option_mixer },
12696 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12697 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12698 .dac_nids = alc262_dac_nids,
12700 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12701 .channel_mode = alc262_modes,
12702 .input_mux = &alc262_HP_D7000_capture_source,
12703 .unsol_event = alc262_hp_wildwest_unsol_event,
12704 .init_hook = alc262_hp_wildwest_automute,
12706 [ALC262_HP_TC_T5735] = {
12707 .mixers = { alc262_hp_t5735_mixer },
12708 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12709 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12710 .dac_nids = alc262_dac_nids,
12712 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12713 .channel_mode = alc262_modes,
12714 .input_mux = &alc262_capture_source,
12715 .unsol_event = alc_sku_unsol_event,
12716 .setup = alc262_hp_t5735_setup,
12717 .init_hook = alc_inithook,
12719 [ALC262_HP_RP5700] = {
12720 .mixers = { alc262_hp_rp5700_mixer },
12721 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12722 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12723 .dac_nids = alc262_dac_nids,
12724 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12725 .channel_mode = alc262_modes,
12726 .input_mux = &alc262_hp_rp5700_capture_source,
12728 [ALC262_BENQ_ED8] = {
12729 .mixers = { alc262_base_mixer },
12730 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12731 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12732 .dac_nids = alc262_dac_nids,
12734 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12735 .channel_mode = alc262_modes,
12736 .input_mux = &alc262_capture_source,
12738 [ALC262_SONY_ASSAMD] = {
12739 .mixers = { alc262_sony_mixer },
12740 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12741 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12742 .dac_nids = alc262_dac_nids,
12744 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12745 .channel_mode = alc262_modes,
12746 .input_mux = &alc262_capture_source,
12747 .unsol_event = alc262_hippo_unsol_event,
12748 .setup = alc262_hippo_setup,
12749 .init_hook = alc262_hippo_automute,
12751 [ALC262_BENQ_T31] = {
12752 .mixers = { alc262_benq_t31_mixer },
12753 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12754 alc_hp15_unsol_verbs },
12755 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12756 .dac_nids = alc262_dac_nids,
12758 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12759 .channel_mode = alc262_modes,
12760 .input_mux = &alc262_capture_source,
12761 .unsol_event = alc262_hippo_unsol_event,
12762 .setup = alc262_hippo_setup,
12763 .init_hook = alc262_hippo_automute,
12766 .mixers = { alc262_ultra_mixer },
12767 .cap_mixer = alc262_ultra_capture_mixer,
12768 .init_verbs = { alc262_ultra_verbs },
12769 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12770 .dac_nids = alc262_dac_nids,
12771 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12772 .channel_mode = alc262_modes,
12773 .input_mux = &alc262_ultra_capture_source,
12774 .adc_nids = alc262_adc_nids, /* ADC0 */
12775 .capsrc_nids = alc262_capsrc_nids,
12776 .num_adc_nids = 1, /* single ADC */
12777 .unsol_event = alc262_ultra_unsol_event,
12778 .init_hook = alc262_ultra_automute,
12780 [ALC262_LENOVO_3000] = {
12781 .mixers = { alc262_lenovo_3000_mixer },
12782 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12783 alc262_lenovo_3000_unsol_verbs,
12784 alc262_lenovo_3000_init_verbs },
12785 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12786 .dac_nids = alc262_dac_nids,
12788 .dig_out_nid = ALC262_DIGOUT_NID,
12789 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12790 .channel_mode = alc262_modes,
12791 .input_mux = &alc262_fujitsu_capture_source,
12792 .unsol_event = alc262_lenovo_3000_unsol_event,
12795 .mixers = { alc262_nec_mixer },
12796 .init_verbs = { alc262_nec_verbs },
12797 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12798 .dac_nids = alc262_dac_nids,
12800 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12801 .channel_mode = alc262_modes,
12802 .input_mux = &alc262_capture_source,
12804 [ALC262_TOSHIBA_S06] = {
12805 .mixers = { alc262_toshiba_s06_mixer },
12806 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12807 alc262_eapd_verbs },
12808 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12809 .capsrc_nids = alc262_dmic_capsrc_nids,
12810 .dac_nids = alc262_dac_nids,
12811 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12812 .num_adc_nids = 1, /* single ADC */
12813 .dig_out_nid = ALC262_DIGOUT_NID,
12814 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12815 .channel_mode = alc262_modes,
12816 .unsol_event = alc_sku_unsol_event,
12817 .setup = alc262_toshiba_s06_setup,
12818 .init_hook = alc_inithook,
12820 [ALC262_TOSHIBA_RX1] = {
12821 .mixers = { alc262_toshiba_rx1_mixer },
12822 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12823 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12824 .dac_nids = alc262_dac_nids,
12826 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12827 .channel_mode = alc262_modes,
12828 .input_mux = &alc262_capture_source,
12829 .unsol_event = alc262_hippo_unsol_event,
12830 .setup = alc262_hippo_setup,
12831 .init_hook = alc262_hippo_automute,
12834 .mixers = { alc262_tyan_mixer },
12835 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12836 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12837 .dac_nids = alc262_dac_nids,
12839 .dig_out_nid = ALC262_DIGOUT_NID,
12840 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12841 .channel_mode = alc262_modes,
12842 .input_mux = &alc262_capture_source,
12843 .unsol_event = alc_automute_amp_unsol_event,
12844 .setup = alc262_tyan_setup,
12845 .init_hook = alc_automute_amp,
12849 static int patch_alc262(struct hda_codec *codec)
12851 struct alc_spec *spec;
12855 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12859 codec->spec = spec;
12861 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12866 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12867 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12868 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12869 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12872 alc_auto_parse_customize_define(codec);
12874 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12876 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12880 if (board_config < 0) {
12881 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12883 board_config = ALC262_AUTO;
12886 if (board_config == ALC262_AUTO)
12887 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1);
12889 if (board_config == ALC262_AUTO) {
12890 /* automatic parse from the BIOS config */
12891 err = alc262_parse_auto_config(codec);
12897 "hda_codec: Cannot set up configuration "
12898 "from BIOS. Using base mode...\n");
12899 board_config = ALC262_BASIC;
12903 if (!spec->no_analog && has_cdefine_beep(codec)) {
12904 err = snd_hda_attach_beep_device(codec, 0x1);
12911 if (board_config != ALC262_AUTO)
12912 setup_preset(codec, &alc262_presets[board_config]);
12914 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12915 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12917 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12918 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12920 if (!spec->adc_nids && spec->input_mux) {
12922 /* check whether the digital-mic has to be supported */
12923 for (i = 0; i < spec->input_mux->num_items; i++) {
12924 if (spec->input_mux->items[i].index >= 9)
12927 if (i < spec->input_mux->num_items) {
12928 /* use only ADC0 */
12929 spec->adc_nids = alc262_dmic_adc_nids;
12930 spec->num_adc_nids = 1;
12931 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12933 /* all analog inputs */
12934 /* check whether NID 0x07 is valid */
12935 unsigned int wcap = get_wcaps(codec, 0x07);
12938 wcap = get_wcaps_type(wcap);
12939 if (wcap != AC_WID_AUD_IN) {
12940 spec->adc_nids = alc262_adc_nids_alt;
12941 spec->num_adc_nids =
12942 ARRAY_SIZE(alc262_adc_nids_alt);
12943 spec->capsrc_nids = alc262_capsrc_nids_alt;
12945 spec->adc_nids = alc262_adc_nids;
12946 spec->num_adc_nids =
12947 ARRAY_SIZE(alc262_adc_nids);
12948 spec->capsrc_nids = alc262_capsrc_nids;
12952 if (!spec->cap_mixer && !spec->no_analog)
12953 set_capture_mixer(codec);
12954 if (!spec->no_analog && has_cdefine_beep(codec))
12955 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12957 if (board_config == ALC262_AUTO)
12958 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
12960 spec->vmaster_nid = 0x0c;
12962 codec->patch_ops = alc_patch_ops;
12963 if (board_config == ALC262_AUTO)
12964 spec->init_hook = alc262_auto_init;
12966 alc_init_jacks(codec);
12967 #ifdef CONFIG_SND_HDA_POWER_SAVE
12968 if (!spec->loopback.amplist)
12969 spec->loopback.amplist = alc262_loopbacks;
12976 * ALC268 channel source setting (2 channel)
12978 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12979 #define alc268_modes alc260_modes
12981 static hda_nid_t alc268_dac_nids[2] = {
12986 static hda_nid_t alc268_adc_nids[2] = {
12991 static hda_nid_t alc268_adc_nids_alt[1] = {
12996 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12998 static struct snd_kcontrol_new alc268_base_mixer[] = {
12999 /* output mixer control */
13000 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13001 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13002 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13003 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13004 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13005 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13006 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13010 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13011 /* output mixer control */
13012 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13013 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13014 ALC262_HIPPO_MASTER_SWITCH,
13015 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13016 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13017 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13021 /* bind Beep switches of both NID 0x0f and 0x10 */
13022 static struct hda_bind_ctls alc268_bind_beep_sw = {
13023 .ops = &snd_hda_bind_sw,
13025 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13026 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13031 static struct snd_kcontrol_new alc268_beep_mixer[] = {
13032 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13033 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13037 static struct hda_verb alc268_eapd_verbs[] = {
13038 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13039 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13043 /* Toshiba specific */
13044 static struct hda_verb alc268_toshiba_verbs[] = {
13045 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13049 /* Acer specific */
13050 /* bind volumes of both NID 0x02 and 0x03 */
13051 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13052 .ops = &snd_hda_bind_vol,
13054 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13055 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13060 /* mute/unmute internal speaker according to the hp jack and mute state */
13061 static void alc268_acer_automute(struct hda_codec *codec, int force)
13063 struct alc_spec *spec = codec->spec;
13066 if (force || !spec->sense_updated) {
13067 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13068 spec->sense_updated = 1;
13070 if (spec->jack_present)
13071 mute = HDA_AMP_MUTE; /* mute internal speaker */
13072 else /* unmute internal speaker if necessary */
13073 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13074 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13075 HDA_AMP_MUTE, mute);
13079 /* bind hp and internal speaker mute (with plug check) */
13080 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13081 struct snd_ctl_elem_value *ucontrol)
13083 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13084 long *valp = ucontrol->value.integer.value;
13087 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13089 alc268_acer_automute(codec, 0);
13093 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13094 /* output mixer control */
13095 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13097 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13098 .name = "Master Playback Switch",
13099 .subdevice = HDA_SUBDEV_AMP_FLAG,
13100 .info = snd_hda_mixer_amp_switch_info,
13101 .get = snd_hda_mixer_amp_switch_get,
13102 .put = alc268_acer_master_sw_put,
13103 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13105 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13109 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13110 /* output mixer control */
13111 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13113 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13114 .name = "Master Playback Switch",
13115 .subdevice = HDA_SUBDEV_AMP_FLAG,
13116 .info = snd_hda_mixer_amp_switch_info,
13117 .get = snd_hda_mixer_amp_switch_get,
13118 .put = alc268_acer_master_sw_put,
13119 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13121 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13122 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13123 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13127 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13128 /* output mixer control */
13129 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13131 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13132 .name = "Master Playback Switch",
13133 .subdevice = HDA_SUBDEV_AMP_FLAG,
13134 .info = snd_hda_mixer_amp_switch_info,
13135 .get = snd_hda_mixer_amp_switch_get,
13136 .put = alc268_acer_master_sw_put,
13137 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13139 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13140 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13144 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13145 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13146 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13147 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13148 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13149 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13150 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13154 static struct hda_verb alc268_acer_verbs[] = {
13155 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13156 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13157 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13158 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13159 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13160 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13161 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13165 /* unsolicited event for HP jack sensing */
13166 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13167 #define alc268_toshiba_setup alc262_hippo_setup
13168 #define alc268_toshiba_automute alc262_hippo_automute
13170 static void alc268_acer_unsol_event(struct hda_codec *codec,
13173 if ((res >> 26) != ALC880_HP_EVENT)
13175 alc268_acer_automute(codec, 1);
13178 static void alc268_acer_init_hook(struct hda_codec *codec)
13180 alc268_acer_automute(codec, 1);
13183 /* toggle speaker-output according to the hp-jack state */
13184 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13186 unsigned int present;
13187 unsigned char bits;
13189 present = snd_hda_jack_detect(codec, 0x15);
13190 bits = present ? HDA_AMP_MUTE : 0;
13191 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13192 HDA_AMP_MUTE, bits);
13193 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13194 HDA_AMP_MUTE, bits);
13197 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13200 switch (res >> 26) {
13201 case ALC880_HP_EVENT:
13202 alc268_aspire_one_speaker_automute(codec);
13204 case ALC880_MIC_EVENT:
13205 alc_mic_automute(codec);
13210 static void alc268_acer_lc_setup(struct hda_codec *codec)
13212 struct alc_spec *spec = codec->spec;
13213 spec->ext_mic.pin = 0x18;
13214 spec->ext_mic.mux_idx = 0;
13215 spec->int_mic.pin = 0x12;
13216 spec->int_mic.mux_idx = 6;
13217 spec->auto_mic = 1;
13220 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13222 alc268_aspire_one_speaker_automute(codec);
13223 alc_mic_automute(codec);
13226 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13227 /* output mixer control */
13228 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13229 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13230 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13231 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13232 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13233 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13237 static struct hda_verb alc268_dell_verbs[] = {
13238 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13239 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13240 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13241 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13245 /* mute/unmute internal speaker according to the hp jack and mute state */
13246 static void alc268_dell_setup(struct hda_codec *codec)
13248 struct alc_spec *spec = codec->spec;
13250 spec->autocfg.hp_pins[0] = 0x15;
13251 spec->autocfg.speaker_pins[0] = 0x14;
13252 spec->ext_mic.pin = 0x18;
13253 spec->ext_mic.mux_idx = 0;
13254 spec->int_mic.pin = 0x19;
13255 spec->int_mic.mux_idx = 1;
13256 spec->auto_mic = 1;
13259 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13260 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13261 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13262 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13263 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13264 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13265 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13266 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13267 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13271 static struct hda_verb alc267_quanta_il1_verbs[] = {
13272 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13273 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13277 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13279 struct alc_spec *spec = codec->spec;
13280 spec->autocfg.hp_pins[0] = 0x15;
13281 spec->autocfg.speaker_pins[0] = 0x14;
13282 spec->ext_mic.pin = 0x18;
13283 spec->ext_mic.mux_idx = 0;
13284 spec->int_mic.pin = 0x19;
13285 spec->int_mic.mux_idx = 1;
13286 spec->auto_mic = 1;
13290 * generic initialization of ADC, input mixers and output mixers
13292 static struct hda_verb alc268_base_init_verbs[] = {
13293 /* Unmute DAC0-1 and set vol = 0 */
13294 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13295 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13298 * Set up output mixers (0x0c - 0x0e)
13300 /* set vol=0 to output mixers */
13301 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13302 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13304 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13305 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13307 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13308 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13309 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13310 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13311 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13312 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13313 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13314 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13316 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13317 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13318 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13319 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13320 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13322 /* set PCBEEP vol = 0, mute connections */
13323 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13325 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13327 /* Unmute Selector 23h,24h and set the default input to mic-in */
13329 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13330 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13331 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13332 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13338 * generic initialization of ADC, input mixers and output mixers
13340 static struct hda_verb alc268_volume_init_verbs[] = {
13341 /* set output DAC */
13342 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13343 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13345 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13346 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13347 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13348 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13349 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13351 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13352 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13353 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13355 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13356 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13358 /* set PCBEEP vol = 0, mute connections */
13359 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13360 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13361 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13366 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13367 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13368 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13372 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13373 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13374 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13379 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13380 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13381 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13382 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13383 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13388 static struct hda_input_mux alc268_capture_source = {
13392 { "Front Mic", 0x1 },
13398 static struct hda_input_mux alc268_acer_capture_source = {
13402 { "Internal Mic", 0x1 },
13407 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13411 { "Internal Mic", 0x6 },
13416 #ifdef CONFIG_SND_DEBUG
13417 static struct snd_kcontrol_new alc268_test_mixer[] = {
13418 /* Volume widgets */
13419 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13420 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13421 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13422 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13423 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13424 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13425 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13426 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13427 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13428 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13429 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13430 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13431 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13432 /* The below appears problematic on some hardwares */
13433 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13434 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13435 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13436 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13437 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13439 /* Modes for retasking pin widgets */
13440 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13441 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13442 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13443 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13445 /* Controls for GPIO pins, assuming they are configured as outputs */
13446 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13447 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13448 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13449 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13451 /* Switches to allow the digital SPDIF output pin to be enabled.
13452 * The ALC268 does not have an SPDIF input.
13454 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13456 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13457 * this output to turn on an external amplifier.
13459 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13460 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13466 /* create input playback/capture controls for the given pin */
13467 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13468 const char *ctlname, int idx)
13479 case 0x1a: /* ALC259/269 only */
13480 case 0x1b: /* ALC259/269 only */
13481 case 0x21: /* ALC269vb has this pin, too */
13485 snd_printd(KERN_WARNING "hda_codec: "
13486 "ignoring pin 0x%x as unknown\n", nid);
13489 if (spec->multiout.dac_nids[0] != dac &&
13490 spec->multiout.dac_nids[1] != dac) {
13491 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13492 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13496 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13500 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13501 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13503 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13504 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13510 /* add playback controls from the parsed DAC table */
13511 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13512 const struct auto_pin_cfg *cfg)
13517 spec->multiout.dac_nids = spec->private_dac_nids;
13519 nid = cfg->line_out_pins[0];
13522 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13526 err = alc268_new_analog_output(spec, nid, name, 0);
13531 nid = cfg->speaker_pins[0];
13533 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13534 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13538 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13542 nid = cfg->hp_pins[0];
13544 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13549 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13551 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13552 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13559 /* create playback/capture controls for input pins */
13560 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13561 const struct auto_pin_cfg *cfg)
13563 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13566 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13567 hda_nid_t nid, int pin_type)
13571 alc_set_pin_output(codec, nid, pin_type);
13572 if (nid == 0x14 || nid == 0x16)
13576 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13579 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13581 struct alc_spec *spec = codec->spec;
13584 for (i = 0; i < spec->autocfg.line_outs; i++) {
13585 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13586 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13587 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13591 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13593 struct alc_spec *spec = codec->spec;
13597 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13598 pin = spec->autocfg.hp_pins[i];
13599 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13601 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13602 pin = spec->autocfg.speaker_pins[i];
13603 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13605 if (spec->autocfg.mono_out_pin)
13606 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13607 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13610 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13612 struct alc_spec *spec = codec->spec;
13613 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13614 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13615 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13616 unsigned int dac_vol1, dac_vol2;
13618 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13619 snd_hda_codec_write(codec, speaker_nid, 0,
13620 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13621 /* mute mixer inputs from 0x1d */
13622 snd_hda_codec_write(codec, 0x0f, 0,
13623 AC_VERB_SET_AMP_GAIN_MUTE,
13625 snd_hda_codec_write(codec, 0x10, 0,
13626 AC_VERB_SET_AMP_GAIN_MUTE,
13629 /* unmute mixer inputs from 0x1d */
13630 snd_hda_codec_write(codec, 0x0f, 0,
13631 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13632 snd_hda_codec_write(codec, 0x10, 0,
13633 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13636 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13637 if (line_nid == 0x14)
13638 dac_vol2 = AMP_OUT_ZERO;
13639 else if (line_nid == 0x15)
13640 dac_vol1 = AMP_OUT_ZERO;
13641 if (hp_nid == 0x14)
13642 dac_vol2 = AMP_OUT_ZERO;
13643 else if (hp_nid == 0x15)
13644 dac_vol1 = AMP_OUT_ZERO;
13645 if (line_nid != 0x16 || hp_nid != 0x16 ||
13646 spec->autocfg.line_out_pins[1] != 0x16 ||
13647 spec->autocfg.line_out_pins[2] != 0x16)
13648 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13650 snd_hda_codec_write(codec, 0x02, 0,
13651 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13652 snd_hda_codec_write(codec, 0x03, 0,
13653 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13656 /* pcm configuration: identical with ALC880 */
13657 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13658 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13659 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13660 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13663 * BIOS auto configuration
13665 static int alc268_parse_auto_config(struct hda_codec *codec)
13667 struct alc_spec *spec = codec->spec;
13669 static hda_nid_t alc268_ignore[] = { 0 };
13671 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13675 if (!spec->autocfg.line_outs) {
13676 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13677 spec->multiout.max_channels = 2;
13678 spec->no_analog = 1;
13681 return 0; /* can't find valid BIOS pin config */
13683 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13686 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13690 spec->multiout.max_channels = 2;
13693 /* digital only support output */
13694 alc_auto_parse_digital(codec);
13695 if (spec->kctls.list)
13696 add_mixer(spec, spec->kctls.list);
13698 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13699 add_mixer(spec, alc268_beep_mixer);
13701 add_verb(spec, alc268_volume_init_verbs);
13702 spec->num_mux_defs = 2;
13703 spec->input_mux = &spec->private_imux[0];
13705 err = alc_auto_add_mic_boost(codec);
13709 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13714 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13716 /* init callback for auto-configuration model -- overriding the default init */
13717 static void alc268_auto_init(struct hda_codec *codec)
13719 struct alc_spec *spec = codec->spec;
13720 alc268_auto_init_multi_out(codec);
13721 alc268_auto_init_hp_out(codec);
13722 alc268_auto_init_mono_speaker_out(codec);
13723 alc268_auto_init_analog_input(codec);
13724 alc_auto_init_digital(codec);
13725 if (spec->unsol_event)
13726 alc_inithook(codec);
13730 * configuration and preset
13732 static const char *alc268_models[ALC268_MODEL_LAST] = {
13733 [ALC267_QUANTA_IL1] = "quanta-il1",
13734 [ALC268_3ST] = "3stack",
13735 [ALC268_TOSHIBA] = "toshiba",
13736 [ALC268_ACER] = "acer",
13737 [ALC268_ACER_DMIC] = "acer-dmic",
13738 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13739 [ALC268_DELL] = "dell",
13740 [ALC268_ZEPTO] = "zepto",
13741 #ifdef CONFIG_SND_DEBUG
13742 [ALC268_TEST] = "test",
13744 [ALC268_AUTO] = "auto",
13747 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13748 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13749 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13750 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13751 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13752 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13753 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13754 ALC268_ACER_ASPIRE_ONE),
13755 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13756 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13757 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13758 /* almost compatible with toshiba but with optional digital outs;
13759 * auto-probing seems working fine
13761 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13763 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13764 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13765 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13766 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13767 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13771 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13772 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13773 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13774 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13775 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13780 static struct alc_config_preset alc268_presets[] = {
13781 [ALC267_QUANTA_IL1] = {
13782 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13783 alc268_capture_nosrc_mixer },
13784 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13785 alc267_quanta_il1_verbs },
13786 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13787 .dac_nids = alc268_dac_nids,
13788 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13789 .adc_nids = alc268_adc_nids_alt,
13791 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13792 .channel_mode = alc268_modes,
13793 .unsol_event = alc_sku_unsol_event,
13794 .setup = alc267_quanta_il1_setup,
13795 .init_hook = alc_inithook,
13798 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13799 alc268_beep_mixer },
13800 .init_verbs = { alc268_base_init_verbs },
13801 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13802 .dac_nids = alc268_dac_nids,
13803 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13804 .adc_nids = alc268_adc_nids_alt,
13805 .capsrc_nids = alc268_capsrc_nids,
13807 .dig_out_nid = ALC268_DIGOUT_NID,
13808 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13809 .channel_mode = alc268_modes,
13810 .input_mux = &alc268_capture_source,
13812 [ALC268_TOSHIBA] = {
13813 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13814 alc268_beep_mixer },
13815 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13816 alc268_toshiba_verbs },
13817 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13818 .dac_nids = alc268_dac_nids,
13819 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13820 .adc_nids = alc268_adc_nids_alt,
13821 .capsrc_nids = alc268_capsrc_nids,
13823 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13824 .channel_mode = alc268_modes,
13825 .input_mux = &alc268_capture_source,
13826 .unsol_event = alc268_toshiba_unsol_event,
13827 .setup = alc268_toshiba_setup,
13828 .init_hook = alc268_toshiba_automute,
13831 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13832 alc268_beep_mixer },
13833 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13834 alc268_acer_verbs },
13835 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13836 .dac_nids = alc268_dac_nids,
13837 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13838 .adc_nids = alc268_adc_nids_alt,
13839 .capsrc_nids = alc268_capsrc_nids,
13841 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13842 .channel_mode = alc268_modes,
13843 .input_mux = &alc268_acer_capture_source,
13844 .unsol_event = alc268_acer_unsol_event,
13845 .init_hook = alc268_acer_init_hook,
13847 [ALC268_ACER_DMIC] = {
13848 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13849 alc268_beep_mixer },
13850 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13851 alc268_acer_verbs },
13852 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13853 .dac_nids = alc268_dac_nids,
13854 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13855 .adc_nids = alc268_adc_nids_alt,
13856 .capsrc_nids = alc268_capsrc_nids,
13858 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13859 .channel_mode = alc268_modes,
13860 .input_mux = &alc268_acer_dmic_capture_source,
13861 .unsol_event = alc268_acer_unsol_event,
13862 .init_hook = alc268_acer_init_hook,
13864 [ALC268_ACER_ASPIRE_ONE] = {
13865 .mixers = { alc268_acer_aspire_one_mixer,
13867 alc268_capture_nosrc_mixer },
13868 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13869 alc268_acer_aspire_one_verbs },
13870 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13871 .dac_nids = alc268_dac_nids,
13872 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13873 .adc_nids = alc268_adc_nids_alt,
13874 .capsrc_nids = alc268_capsrc_nids,
13876 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13877 .channel_mode = alc268_modes,
13878 .unsol_event = alc268_acer_lc_unsol_event,
13879 .setup = alc268_acer_lc_setup,
13880 .init_hook = alc268_acer_lc_init_hook,
13883 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13884 alc268_capture_nosrc_mixer },
13885 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13886 alc268_dell_verbs },
13887 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13888 .dac_nids = alc268_dac_nids,
13889 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13890 .adc_nids = alc268_adc_nids_alt,
13891 .capsrc_nids = alc268_capsrc_nids,
13893 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13894 .channel_mode = alc268_modes,
13895 .unsol_event = alc_sku_unsol_event,
13896 .setup = alc268_dell_setup,
13897 .init_hook = alc_inithook,
13900 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13901 alc268_beep_mixer },
13902 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13903 alc268_toshiba_verbs },
13904 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13905 .dac_nids = alc268_dac_nids,
13906 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13907 .adc_nids = alc268_adc_nids_alt,
13908 .capsrc_nids = alc268_capsrc_nids,
13910 .dig_out_nid = ALC268_DIGOUT_NID,
13911 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13912 .channel_mode = alc268_modes,
13913 .input_mux = &alc268_capture_source,
13914 .setup = alc268_toshiba_setup,
13915 .init_hook = alc268_toshiba_automute,
13917 #ifdef CONFIG_SND_DEBUG
13919 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13920 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13921 alc268_volume_init_verbs },
13922 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13923 .dac_nids = alc268_dac_nids,
13924 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13925 .adc_nids = alc268_adc_nids_alt,
13926 .capsrc_nids = alc268_capsrc_nids,
13928 .dig_out_nid = ALC268_DIGOUT_NID,
13929 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13930 .channel_mode = alc268_modes,
13931 .input_mux = &alc268_capture_source,
13936 static int patch_alc268(struct hda_codec *codec)
13938 struct alc_spec *spec;
13940 int i, has_beep, err;
13942 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13946 codec->spec = spec;
13948 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13952 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13953 board_config = snd_hda_check_board_codec_sid_config(codec,
13954 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13956 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13957 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13959 board_config = ALC268_AUTO;
13962 if (board_config == ALC268_AUTO) {
13963 /* automatic parse from the BIOS config */
13964 err = alc268_parse_auto_config(codec);
13970 "hda_codec: Cannot set up configuration "
13971 "from BIOS. Using base mode...\n");
13972 board_config = ALC268_3ST;
13976 if (board_config != ALC268_AUTO)
13977 setup_preset(codec, &alc268_presets[board_config]);
13979 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13980 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13981 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13983 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13986 for (i = 0; i < spec->num_mixers; i++) {
13987 if (spec->mixers[i] == alc268_beep_mixer) {
13994 err = snd_hda_attach_beep_device(codec, 0x1);
13999 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14000 /* override the amp caps for beep generator */
14001 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14002 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14003 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14004 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14005 (0 << AC_AMPCAP_MUTE_SHIFT));
14008 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14009 /* check whether NID 0x07 is valid */
14010 unsigned int wcap = get_wcaps(codec, 0x07);
14013 spec->capsrc_nids = alc268_capsrc_nids;
14015 wcap = get_wcaps_type(wcap);
14016 if (spec->auto_mic ||
14017 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14018 spec->adc_nids = alc268_adc_nids_alt;
14019 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14020 if (spec->auto_mic)
14021 fixup_automic_adc(codec);
14022 if (spec->auto_mic || spec->input_mux->num_items == 1)
14023 add_mixer(spec, alc268_capture_nosrc_mixer);
14025 add_mixer(spec, alc268_capture_alt_mixer);
14027 spec->adc_nids = alc268_adc_nids;
14028 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14029 add_mixer(spec, alc268_capture_mixer);
14031 /* set default input source */
14032 for (i = 0; i < spec->num_adc_nids; i++)
14033 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
14034 0, AC_VERB_SET_CONNECT_SEL,
14035 i < spec->num_mux_defs ?
14036 spec->input_mux[i].items[0].index :
14037 spec->input_mux->items[0].index);
14040 spec->vmaster_nid = 0x02;
14042 codec->patch_ops = alc_patch_ops;
14043 if (board_config == ALC268_AUTO)
14044 spec->init_hook = alc268_auto_init;
14046 alc_init_jacks(codec);
14052 * ALC269 channel source setting (2 channel)
14054 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14056 #define alc269_dac_nids alc260_dac_nids
14058 static hda_nid_t alc269_adc_nids[1] = {
14063 static hda_nid_t alc269_capsrc_nids[1] = {
14067 static hda_nid_t alc269vb_adc_nids[1] = {
14072 static hda_nid_t alc269vb_capsrc_nids[1] = {
14076 static hda_nid_t alc269_adc_candidates[] = {
14080 #define alc269_modes alc260_modes
14081 #define alc269_capture_source alc880_lg_lw_capture_source
14083 static struct snd_kcontrol_new alc269_base_mixer[] = {
14084 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14085 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14086 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14087 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14088 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14089 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14090 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14091 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14092 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14093 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14094 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14095 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14099 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14100 /* output mixer control */
14101 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14103 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14104 .name = "Master Playback Switch",
14105 .subdevice = HDA_SUBDEV_AMP_FLAG,
14106 .info = snd_hda_mixer_amp_switch_info,
14107 .get = snd_hda_mixer_amp_switch_get,
14108 .put = alc268_acer_master_sw_put,
14109 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14113 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14114 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14115 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14116 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14120 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14121 /* output mixer control */
14122 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14124 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14125 .name = "Master Playback Switch",
14126 .subdevice = HDA_SUBDEV_AMP_FLAG,
14127 .info = snd_hda_mixer_amp_switch_info,
14128 .get = snd_hda_mixer_amp_switch_get,
14129 .put = alc268_acer_master_sw_put,
14130 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14134 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14135 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14136 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14137 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14138 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14139 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14140 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14144 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14145 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14146 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14147 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14148 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14152 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14153 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14154 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14155 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14156 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14160 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14161 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14162 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14166 /* capture mixer elements */
14167 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14168 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14169 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14170 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14171 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14175 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14176 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14177 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14178 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14182 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14183 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14184 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14185 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14186 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14190 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14191 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14192 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14193 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14198 #define alc269_fujitsu_mixer alc269_laptop_mixer
14200 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14201 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14202 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14203 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14204 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14205 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14206 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14210 static struct hda_verb alc269_lifebook_verbs[] = {
14211 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14212 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14213 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14214 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14215 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14216 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14217 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14218 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14219 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14220 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14224 /* toggle speaker-output according to the hp-jack state */
14225 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14227 unsigned int present;
14228 unsigned char bits;
14230 present = snd_hda_jack_detect(codec, 0x15);
14231 bits = present ? HDA_AMP_MUTE : 0;
14232 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14233 HDA_AMP_MUTE, bits);
14234 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14235 HDA_AMP_MUTE, bits);
14237 snd_hda_codec_write(codec, 0x20, 0,
14238 AC_VERB_SET_COEF_INDEX, 0x0c);
14239 snd_hda_codec_write(codec, 0x20, 0,
14240 AC_VERB_SET_PROC_COEF, 0x680);
14242 snd_hda_codec_write(codec, 0x20, 0,
14243 AC_VERB_SET_COEF_INDEX, 0x0c);
14244 snd_hda_codec_write(codec, 0x20, 0,
14245 AC_VERB_SET_PROC_COEF, 0x480);
14248 /* toggle speaker-output according to the hp-jacks state */
14249 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14251 unsigned int present;
14252 unsigned char bits;
14254 /* Check laptop headphone socket */
14255 present = snd_hda_jack_detect(codec, 0x15);
14257 /* Check port replicator headphone socket */
14258 present |= snd_hda_jack_detect(codec, 0x1a);
14260 bits = present ? HDA_AMP_MUTE : 0;
14261 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14262 HDA_AMP_MUTE, bits);
14263 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14264 HDA_AMP_MUTE, bits);
14266 snd_hda_codec_write(codec, 0x20, 0,
14267 AC_VERB_SET_COEF_INDEX, 0x0c);
14268 snd_hda_codec_write(codec, 0x20, 0,
14269 AC_VERB_SET_PROC_COEF, 0x680);
14271 snd_hda_codec_write(codec, 0x20, 0,
14272 AC_VERB_SET_COEF_INDEX, 0x0c);
14273 snd_hda_codec_write(codec, 0x20, 0,
14274 AC_VERB_SET_PROC_COEF, 0x480);
14277 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14279 unsigned int present_laptop;
14280 unsigned int present_dock;
14282 present_laptop = snd_hda_jack_detect(codec, 0x18);
14283 present_dock = snd_hda_jack_detect(codec, 0x1b);
14285 /* Laptop mic port overrides dock mic port, design decision */
14287 snd_hda_codec_write(codec, 0x23, 0,
14288 AC_VERB_SET_CONNECT_SEL, 0x3);
14289 if (present_laptop)
14290 snd_hda_codec_write(codec, 0x23, 0,
14291 AC_VERB_SET_CONNECT_SEL, 0x0);
14292 if (!present_dock && !present_laptop)
14293 snd_hda_codec_write(codec, 0x23, 0,
14294 AC_VERB_SET_CONNECT_SEL, 0x1);
14297 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14300 switch (res >> 26) {
14301 case ALC880_HP_EVENT:
14302 alc269_quanta_fl1_speaker_automute(codec);
14304 case ALC880_MIC_EVENT:
14305 alc_mic_automute(codec);
14310 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14313 if ((res >> 26) == ALC880_HP_EVENT)
14314 alc269_lifebook_speaker_automute(codec);
14315 if ((res >> 26) == ALC880_MIC_EVENT)
14316 alc269_lifebook_mic_autoswitch(codec);
14319 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14321 struct alc_spec *spec = codec->spec;
14322 spec->autocfg.hp_pins[0] = 0x15;
14323 spec->autocfg.speaker_pins[0] = 0x14;
14324 spec->ext_mic.pin = 0x18;
14325 spec->ext_mic.mux_idx = 0;
14326 spec->int_mic.pin = 0x19;
14327 spec->int_mic.mux_idx = 1;
14328 spec->auto_mic = 1;
14331 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14333 alc269_quanta_fl1_speaker_automute(codec);
14334 alc_mic_automute(codec);
14337 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14339 alc269_lifebook_speaker_automute(codec);
14340 alc269_lifebook_mic_autoswitch(codec);
14343 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14344 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14345 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14346 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14347 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14348 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14349 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14350 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14354 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14355 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14356 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14357 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14358 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14359 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14360 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14364 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14365 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14366 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14367 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14368 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14369 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14370 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14371 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14375 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14376 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14377 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14378 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14379 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14380 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14381 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14382 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14386 static struct hda_verb alc271_acer_dmic_verbs[] = {
14387 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14388 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14389 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14390 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14391 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14392 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14393 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14394 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14395 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14396 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14400 /* toggle speaker-output according to the hp-jack state */
14401 static void alc269_speaker_automute(struct hda_codec *codec)
14403 struct alc_spec *spec = codec->spec;
14404 unsigned int nid = spec->autocfg.hp_pins[0];
14405 unsigned int present;
14406 unsigned char bits;
14408 present = snd_hda_jack_detect(codec, nid);
14409 bits = present ? HDA_AMP_MUTE : 0;
14410 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14411 HDA_AMP_MUTE, bits);
14412 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14413 HDA_AMP_MUTE, bits);
14414 alc_report_jack(codec, nid);
14417 /* unsolicited event for HP jack sensing */
14418 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14421 switch (res >> 26) {
14422 case ALC880_HP_EVENT:
14423 alc269_speaker_automute(codec);
14425 case ALC880_MIC_EVENT:
14426 alc_mic_automute(codec);
14431 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14433 struct alc_spec *spec = codec->spec;
14434 spec->autocfg.hp_pins[0] = 0x15;
14435 spec->autocfg.speaker_pins[0] = 0x14;
14436 spec->ext_mic.pin = 0x18;
14437 spec->ext_mic.mux_idx = 0;
14438 spec->int_mic.pin = 0x19;
14439 spec->int_mic.mux_idx = 1;
14440 spec->auto_mic = 1;
14443 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14445 struct alc_spec *spec = codec->spec;
14446 spec->autocfg.hp_pins[0] = 0x15;
14447 spec->autocfg.speaker_pins[0] = 0x14;
14448 spec->ext_mic.pin = 0x18;
14449 spec->ext_mic.mux_idx = 0;
14450 spec->int_mic.pin = 0x12;
14451 spec->int_mic.mux_idx = 5;
14452 spec->auto_mic = 1;
14455 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14457 struct alc_spec *spec = codec->spec;
14458 spec->autocfg.hp_pins[0] = 0x21;
14459 spec->autocfg.speaker_pins[0] = 0x14;
14460 spec->ext_mic.pin = 0x18;
14461 spec->ext_mic.mux_idx = 0;
14462 spec->int_mic.pin = 0x19;
14463 spec->int_mic.mux_idx = 1;
14464 spec->auto_mic = 1;
14467 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14469 struct alc_spec *spec = codec->spec;
14470 spec->autocfg.hp_pins[0] = 0x21;
14471 spec->autocfg.speaker_pins[0] = 0x14;
14472 spec->ext_mic.pin = 0x18;
14473 spec->ext_mic.mux_idx = 0;
14474 spec->int_mic.pin = 0x12;
14475 spec->int_mic.mux_idx = 6;
14476 spec->auto_mic = 1;
14479 static void alc269_laptop_inithook(struct hda_codec *codec)
14481 alc269_speaker_automute(codec);
14482 alc_mic_automute(codec);
14486 * generic initialization of ADC, input mixers and output mixers
14488 static struct hda_verb alc269_init_verbs[] = {
14490 * Unmute ADC0 and set the default input to mic-in
14492 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14495 * Set up output mixers (0x02 - 0x03)
14497 /* set vol=0 to output mixers */
14498 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14499 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14501 /* set up input amps for analog loopback */
14502 /* Amp Indices: DAC = 0, mixer = 1 */
14503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14506 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14507 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14508 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14510 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14511 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14512 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14513 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14514 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14515 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14516 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14518 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14519 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14521 /* FIXME: use Mux-type input source selection */
14522 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14523 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14524 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14527 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14531 static struct hda_verb alc269vb_init_verbs[] = {
14533 * Unmute ADC0 and set the default input to mic-in
14535 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14538 * Set up output mixers (0x02 - 0x03)
14540 /* set vol=0 to output mixers */
14541 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14542 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14544 /* set up input amps for analog loopback */
14545 /* Amp Indices: DAC = 0, mixer = 1 */
14546 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14548 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14549 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14550 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14551 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14553 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14554 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14555 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14556 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14557 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14558 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14559 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14561 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14562 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14564 /* FIXME: use Mux-type input source selection */
14565 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14566 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14567 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14570 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14574 #define alc269_auto_create_multi_out_ctls \
14575 alc268_auto_create_multi_out_ctls
14576 #define alc269_auto_create_input_ctls \
14577 alc268_auto_create_input_ctls
14579 #ifdef CONFIG_SND_HDA_POWER_SAVE
14580 #define alc269_loopbacks alc880_loopbacks
14583 /* pcm configuration: identical with ALC880 */
14584 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14585 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14586 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14587 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14589 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14593 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14594 /* NID is set in alc_build_pcms */
14596 .open = alc880_playback_pcm_open,
14597 .prepare = alc880_playback_pcm_prepare,
14598 .cleanup = alc880_playback_pcm_cleanup
14602 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14606 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14607 /* NID is set in alc_build_pcms */
14610 #ifdef CONFIG_SND_HDA_POWER_SAVE
14611 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14613 switch (codec->subsystem_id) {
14620 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14622 /* update mute-LED according to the speaker mute state */
14623 if (nid == 0x01 || nid == 0x14) {
14625 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14630 /* mic2 vref pin is used for mute LED control */
14631 snd_hda_codec_update_cache(codec, 0x19, 0,
14632 AC_VERB_SET_PIN_WIDGET_CONTROL,
14635 return alc_check_power_status(codec, nid);
14637 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14639 static int alc275_setup_dual_adc(struct hda_codec *codec)
14641 struct alc_spec *spec = codec->spec;
14643 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14645 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14646 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14647 if (spec->ext_mic.pin <= 0x12) {
14648 spec->private_adc_nids[0] = 0x08;
14649 spec->private_adc_nids[1] = 0x11;
14650 spec->private_capsrc_nids[0] = 0x23;
14651 spec->private_capsrc_nids[1] = 0x22;
14653 spec->private_adc_nids[0] = 0x11;
14654 spec->private_adc_nids[1] = 0x08;
14655 spec->private_capsrc_nids[0] = 0x22;
14656 spec->private_capsrc_nids[1] = 0x23;
14658 spec->adc_nids = spec->private_adc_nids;
14659 spec->capsrc_nids = spec->private_capsrc_nids;
14660 spec->num_adc_nids = 2;
14661 spec->dual_adc_switch = 1;
14662 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14663 spec->adc_nids[0], spec->adc_nids[1]);
14669 /* different alc269-variants */
14671 ALC269_TYPE_NORMAL,
14672 ALC269_TYPE_ALC258,
14673 ALC269_TYPE_ALC259,
14674 ALC269_TYPE_ALC269VB,
14675 ALC269_TYPE_ALC270,
14676 ALC269_TYPE_ALC271X,
14680 * BIOS auto configuration
14682 static int alc269_parse_auto_config(struct hda_codec *codec)
14684 struct alc_spec *spec = codec->spec;
14686 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14688 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14693 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14696 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14697 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14699 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14704 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14706 alc_auto_parse_digital(codec);
14708 if (spec->kctls.list)
14709 add_mixer(spec, spec->kctls.list);
14711 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14712 add_verb(spec, alc269vb_init_verbs);
14713 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14715 add_verb(spec, alc269_init_verbs);
14716 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14719 spec->num_mux_defs = 1;
14720 spec->input_mux = &spec->private_imux[0];
14722 if (!alc275_setup_dual_adc(codec))
14723 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14724 sizeof(alc269_adc_candidates));
14726 /* set default input source */
14727 if (!spec->dual_adc_switch)
14728 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14729 spec->input_mux->items[0].index);
14731 err = alc_auto_add_mic_boost(codec);
14735 if (!spec->cap_mixer && !spec->no_analog)
14736 set_capture_mixer(codec);
14741 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14742 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14743 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14746 /* init callback for auto-configuration model -- overriding the default init */
14747 static void alc269_auto_init(struct hda_codec *codec)
14749 struct alc_spec *spec = codec->spec;
14750 alc269_auto_init_multi_out(codec);
14751 alc269_auto_init_hp_out(codec);
14752 alc269_auto_init_analog_input(codec);
14753 alc_auto_init_digital(codec);
14754 if (spec->unsol_event)
14755 alc_inithook(codec);
14758 #ifdef SND_HDA_NEEDS_RESUME
14759 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14761 int val = alc_read_coef_idx(codec, 0x04);
14766 alc_write_coef_idx(codec, 0x04, val);
14769 #ifdef CONFIG_SND_HDA_POWER_SAVE
14770 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14772 struct alc_spec *spec = codec->spec;
14774 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14775 alc269_toggle_power_output(codec, 0);
14776 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14777 alc269_toggle_power_output(codec, 0);
14782 if (spec && spec->power_hook)
14783 spec->power_hook(codec);
14786 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14788 static int alc269_resume(struct hda_codec *codec)
14790 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14791 alc269_toggle_power_output(codec, 0);
14795 codec->patch_ops.init(codec);
14797 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14798 alc269_toggle_power_output(codec, 1);
14802 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14803 alc269_toggle_power_output(codec, 1);
14805 snd_hda_codec_resume_amp(codec);
14806 snd_hda_codec_resume_cache(codec);
14807 hda_call_check_power_status(codec, 0x01);
14810 #endif /* SND_HDA_NEEDS_RESUME */
14812 static void alc269_fixup_hweq(struct hda_codec *codec,
14813 const struct alc_fixup *fix, int pre_init)
14817 coef = alc_read_coef_idx(codec, 0x1e);
14818 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14822 ALC269_FIXUP_SONY_VAIO,
14823 ALC275_FIXUP_SONY_VAIO_GPIO2,
14824 ALC269_FIXUP_DELL_M101Z,
14825 ALC269_FIXUP_SKU_IGNORE,
14826 ALC269_FIXUP_ASUS_G73JW,
14827 ALC269_FIXUP_LENOVO_EAPD,
14828 ALC275_FIXUP_SONY_HWEQ,
14831 static const struct alc_fixup alc269_fixups[] = {
14832 [ALC269_FIXUP_SONY_VAIO] = {
14833 .verbs = (const struct hda_verb[]) {
14834 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14838 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14839 .verbs = (const struct hda_verb[]) {
14840 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14841 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14842 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14843 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14847 [ALC269_FIXUP_DELL_M101Z] = {
14848 .verbs = (const struct hda_verb[]) {
14849 /* Enables internal speaker */
14850 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14851 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14855 [ALC269_FIXUP_SKU_IGNORE] = {
14856 .sku = ALC_FIXUP_SKU_IGNORE,
14858 [ALC269_FIXUP_ASUS_G73JW] = {
14859 .pins = (const struct alc_pincfg[]) {
14860 { 0x17, 0x99130111 }, /* subwoofer */
14864 [ALC269_FIXUP_LENOVO_EAPD] = {
14865 .verbs = (const struct hda_verb[]) {
14866 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14870 [ALC275_FIXUP_SONY_HWEQ] = {
14871 .func = alc269_fixup_hweq,
14872 .verbs = (const struct hda_verb[]) {
14873 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14874 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14875 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14876 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14882 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14883 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14884 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14885 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14886 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14887 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14888 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14889 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14890 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14891 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
14897 * configuration and preset
14899 static const char *alc269_models[ALC269_MODEL_LAST] = {
14900 [ALC269_BASIC] = "basic",
14901 [ALC269_QUANTA_FL1] = "quanta",
14902 [ALC269_AMIC] = "laptop-amic",
14903 [ALC269_DMIC] = "laptop-dmic",
14904 [ALC269_FUJITSU] = "fujitsu",
14905 [ALC269_LIFEBOOK] = "lifebook",
14906 [ALC269_AUTO] = "auto",
14909 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14910 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14911 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14912 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14914 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14915 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14916 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14917 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14918 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14919 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14920 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14921 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14922 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14923 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14924 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14925 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14926 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14927 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14928 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14929 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14930 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14931 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14932 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14933 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14934 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14935 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14936 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14937 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14938 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14939 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14940 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14941 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14942 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14943 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14944 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14945 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14946 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14947 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14948 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14949 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14950 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14952 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14954 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14955 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14956 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14957 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14958 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14959 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14960 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14961 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14962 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14963 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14967 static struct alc_config_preset alc269_presets[] = {
14969 .mixers = { alc269_base_mixer },
14970 .init_verbs = { alc269_init_verbs },
14971 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14972 .dac_nids = alc269_dac_nids,
14974 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14975 .channel_mode = alc269_modes,
14976 .input_mux = &alc269_capture_source,
14978 [ALC269_QUANTA_FL1] = {
14979 .mixers = { alc269_quanta_fl1_mixer },
14980 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14981 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14982 .dac_nids = alc269_dac_nids,
14984 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14985 .channel_mode = alc269_modes,
14986 .input_mux = &alc269_capture_source,
14987 .unsol_event = alc269_quanta_fl1_unsol_event,
14988 .setup = alc269_quanta_fl1_setup,
14989 .init_hook = alc269_quanta_fl1_init_hook,
14992 .mixers = { alc269_laptop_mixer },
14993 .cap_mixer = alc269_laptop_analog_capture_mixer,
14994 .init_verbs = { alc269_init_verbs,
14995 alc269_laptop_amic_init_verbs },
14996 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14997 .dac_nids = alc269_dac_nids,
14999 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15000 .channel_mode = alc269_modes,
15001 .unsol_event = alc269_laptop_unsol_event,
15002 .setup = alc269_laptop_amic_setup,
15003 .init_hook = alc269_laptop_inithook,
15006 .mixers = { alc269_laptop_mixer },
15007 .cap_mixer = alc269_laptop_digital_capture_mixer,
15008 .init_verbs = { alc269_init_verbs,
15009 alc269_laptop_dmic_init_verbs },
15010 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15011 .dac_nids = alc269_dac_nids,
15013 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15014 .channel_mode = alc269_modes,
15015 .unsol_event = alc269_laptop_unsol_event,
15016 .setup = alc269_laptop_dmic_setup,
15017 .init_hook = alc269_laptop_inithook,
15019 [ALC269VB_AMIC] = {
15020 .mixers = { alc269vb_laptop_mixer },
15021 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
15022 .init_verbs = { alc269vb_init_verbs,
15023 alc269vb_laptop_amic_init_verbs },
15024 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15025 .dac_nids = alc269_dac_nids,
15027 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15028 .channel_mode = alc269_modes,
15029 .unsol_event = alc269_laptop_unsol_event,
15030 .setup = alc269vb_laptop_amic_setup,
15031 .init_hook = alc269_laptop_inithook,
15033 [ALC269VB_DMIC] = {
15034 .mixers = { alc269vb_laptop_mixer },
15035 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15036 .init_verbs = { alc269vb_init_verbs,
15037 alc269vb_laptop_dmic_init_verbs },
15038 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15039 .dac_nids = alc269_dac_nids,
15041 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15042 .channel_mode = alc269_modes,
15043 .unsol_event = alc269_laptop_unsol_event,
15044 .setup = alc269vb_laptop_dmic_setup,
15045 .init_hook = alc269_laptop_inithook,
15047 [ALC269_FUJITSU] = {
15048 .mixers = { alc269_fujitsu_mixer },
15049 .cap_mixer = alc269_laptop_digital_capture_mixer,
15050 .init_verbs = { alc269_init_verbs,
15051 alc269_laptop_dmic_init_verbs },
15052 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15053 .dac_nids = alc269_dac_nids,
15055 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15056 .channel_mode = alc269_modes,
15057 .unsol_event = alc269_laptop_unsol_event,
15058 .setup = alc269_laptop_dmic_setup,
15059 .init_hook = alc269_laptop_inithook,
15061 [ALC269_LIFEBOOK] = {
15062 .mixers = { alc269_lifebook_mixer },
15063 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15064 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15065 .dac_nids = alc269_dac_nids,
15067 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15068 .channel_mode = alc269_modes,
15069 .input_mux = &alc269_capture_source,
15070 .unsol_event = alc269_lifebook_unsol_event,
15071 .init_hook = alc269_lifebook_init_hook,
15074 .mixers = { alc269_asus_mixer },
15075 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15076 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15077 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15078 .dac_nids = alc269_dac_nids,
15079 .adc_nids = alc262_dmic_adc_nids,
15080 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15081 .capsrc_nids = alc262_dmic_capsrc_nids,
15082 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15083 .channel_mode = alc269_modes,
15084 .input_mux = &alc269_capture_source,
15085 .dig_out_nid = ALC880_DIGOUT_NID,
15086 .unsol_event = alc_sku_unsol_event,
15087 .setup = alc269vb_laptop_dmic_setup,
15088 .init_hook = alc_inithook,
15092 static int alc269_fill_coef(struct hda_codec *codec)
15096 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15097 alc_write_coef_idx(codec, 0xf, 0x960b);
15098 alc_write_coef_idx(codec, 0xe, 0x8817);
15101 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15102 alc_write_coef_idx(codec, 0xf, 0x960b);
15103 alc_write_coef_idx(codec, 0xe, 0x8814);
15106 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15107 val = alc_read_coef_idx(codec, 0x04);
15108 /* Power up output pin */
15109 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15112 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15113 val = alc_read_coef_idx(codec, 0xd);
15114 if ((val & 0x0c00) >> 10 != 0x1) {
15115 /* Capless ramp up clock control */
15116 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15118 val = alc_read_coef_idx(codec, 0x17);
15119 if ((val & 0x01c0) >> 6 != 0x4) {
15120 /* Class D power on reset */
15121 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15127 static int patch_alc269(struct hda_codec *codec)
15129 struct alc_spec *spec;
15130 int board_config, coef;
15133 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15137 codec->spec = spec;
15139 alc_auto_parse_customize_define(codec);
15141 if (codec->vendor_id == 0x10ec0269) {
15142 coef = alc_read_coef_idx(codec, 0);
15143 if ((coef & 0x00f0) == 0x0010) {
15144 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15145 spec->cdefine.platform_type == 1) {
15146 alc_codec_rename(codec, "ALC271X");
15147 spec->codec_variant = ALC269_TYPE_ALC271X;
15148 } else if ((coef & 0xf000) == 0x1000) {
15149 spec->codec_variant = ALC269_TYPE_ALC270;
15150 } else if ((coef & 0xf000) == 0x2000) {
15151 alc_codec_rename(codec, "ALC259");
15152 spec->codec_variant = ALC269_TYPE_ALC259;
15153 } else if ((coef & 0xf000) == 0x3000) {
15154 alc_codec_rename(codec, "ALC258");
15155 spec->codec_variant = ALC269_TYPE_ALC258;
15157 alc_codec_rename(codec, "ALC269VB");
15158 spec->codec_variant = ALC269_TYPE_ALC269VB;
15161 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15162 alc269_fill_coef(codec);
15165 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15169 if (board_config < 0) {
15170 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15172 board_config = ALC269_AUTO;
15175 if (board_config == ALC269_AUTO)
15176 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
15178 if (board_config == ALC269_AUTO) {
15179 /* automatic parse from the BIOS config */
15180 err = alc269_parse_auto_config(codec);
15186 "hda_codec: Cannot set up configuration "
15187 "from BIOS. Using base mode...\n");
15188 board_config = ALC269_BASIC;
15192 if (has_cdefine_beep(codec)) {
15193 err = snd_hda_attach_beep_device(codec, 0x1);
15200 if (board_config != ALC269_AUTO)
15201 setup_preset(codec, &alc269_presets[board_config]);
15203 if (board_config == ALC269_QUANTA_FL1) {
15204 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15205 * fix the sample rate of analog I/O to 44.1kHz
15207 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15208 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15209 } else if (spec->dual_adc_switch) {
15210 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15211 /* switch ADC dynamically */
15212 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15214 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15215 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15217 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15218 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15220 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15221 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15222 spec->adc_nids = alc269_adc_nids;
15223 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15224 spec->capsrc_nids = alc269_capsrc_nids;
15226 spec->adc_nids = alc269vb_adc_nids;
15227 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15228 spec->capsrc_nids = alc269vb_capsrc_nids;
15232 if (!spec->cap_mixer)
15233 set_capture_mixer(codec);
15234 if (has_cdefine_beep(codec))
15235 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15237 if (board_config == ALC269_AUTO)
15238 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
15240 spec->vmaster_nid = 0x02;
15242 codec->patch_ops = alc_patch_ops;
15243 #ifdef CONFIG_SND_HDA_POWER_SAVE
15244 codec->patch_ops.suspend = alc269_suspend;
15246 #ifdef SND_HDA_NEEDS_RESUME
15247 codec->patch_ops.resume = alc269_resume;
15249 if (board_config == ALC269_AUTO)
15250 spec->init_hook = alc269_auto_init;
15252 alc_init_jacks(codec);
15253 #ifdef CONFIG_SND_HDA_POWER_SAVE
15254 if (!spec->loopback.amplist)
15255 spec->loopback.amplist = alc269_loopbacks;
15256 if (alc269_mic2_for_mute_led(codec))
15257 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15264 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15268 * set the path ways for 2 channel output
15269 * need to set the codec line out and mic 1 pin widgets to inputs
15271 static struct hda_verb alc861_threestack_ch2_init[] = {
15272 /* set pin widget 1Ah (line in) for input */
15273 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15274 /* set pin widget 18h (mic1/2) for input, for mic also enable
15277 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15279 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15281 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15282 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15288 * need to set the codec line out and mic 1 pin widgets to outputs
15290 static struct hda_verb alc861_threestack_ch6_init[] = {
15291 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15292 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15293 /* set pin widget 18h (mic1) for output (CLFE)*/
15294 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15296 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15297 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15299 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15301 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15302 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15307 static struct hda_channel_mode alc861_threestack_modes[2] = {
15308 { 2, alc861_threestack_ch2_init },
15309 { 6, alc861_threestack_ch6_init },
15311 /* Set mic1 as input and unmute the mixer */
15312 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15313 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15314 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15317 /* Set mic1 as output and mute mixer */
15318 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15319 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15320 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15324 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15325 { 2, alc861_uniwill_m31_ch2_init },
15326 { 4, alc861_uniwill_m31_ch4_init },
15329 /* Set mic1 and line-in as input and unmute the mixer */
15330 static struct hda_verb alc861_asus_ch2_init[] = {
15331 /* set pin widget 1Ah (line in) for input */
15332 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15333 /* set pin widget 18h (mic1/2) for input, for mic also enable
15336 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15338 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15340 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15341 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15345 /* Set mic1 nad line-in as output and mute mixer */
15346 static struct hda_verb alc861_asus_ch6_init[] = {
15347 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15348 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15349 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15350 /* set pin widget 18h (mic1) for output (CLFE)*/
15351 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15352 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15353 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15354 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15356 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15358 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15359 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15364 static struct hda_channel_mode alc861_asus_modes[2] = {
15365 { 2, alc861_asus_ch2_init },
15366 { 6, alc861_asus_ch6_init },
15371 static struct snd_kcontrol_new alc861_base_mixer[] = {
15372 /* output mixer control */
15373 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15374 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15375 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15376 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15377 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15379 /*Input mixer control */
15380 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15381 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15382 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15383 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15384 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15385 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15386 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15387 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15388 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15389 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15394 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15395 /* output mixer control */
15396 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15397 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15398 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15399 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15400 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15402 /* Input mixer control */
15403 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15404 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15405 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15406 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15407 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15408 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15409 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15410 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15411 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15412 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15415 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15416 .name = "Channel Mode",
15417 .info = alc_ch_mode_info,
15418 .get = alc_ch_mode_get,
15419 .put = alc_ch_mode_put,
15420 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15425 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15426 /* output mixer control */
15427 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15429 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15434 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15435 /* output mixer control */
15436 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15437 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15438 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15439 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15440 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15442 /* Input mixer control */
15443 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15444 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15445 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15446 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15447 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15448 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15449 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15450 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15451 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15452 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15455 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15456 .name = "Channel Mode",
15457 .info = alc_ch_mode_info,
15458 .get = alc_ch_mode_get,
15459 .put = alc_ch_mode_put,
15460 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15465 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15466 /* output mixer control */
15467 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15468 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15469 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15470 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15471 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15473 /* Input mixer control */
15474 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15475 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15476 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15477 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15478 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15479 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15480 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15481 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15482 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15483 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15486 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15487 .name = "Channel Mode",
15488 .info = alc_ch_mode_info,
15489 .get = alc_ch_mode_get,
15490 .put = alc_ch_mode_put,
15491 .private_value = ARRAY_SIZE(alc861_asus_modes),
15496 /* additional mixer */
15497 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15498 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15499 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15504 * generic initialization of ADC, input mixers and output mixers
15506 static struct hda_verb alc861_base_init_verbs[] = {
15508 * Unmute ADC0 and set the default input to mic-in
15510 /* port-A for surround (rear panel) */
15511 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15512 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15513 /* port-B for mic-in (rear panel) with vref */
15514 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15515 /* port-C for line-in (rear panel) */
15516 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15517 /* port-D for Front */
15518 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15519 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15520 /* port-E for HP out (front panel) */
15521 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15522 /* route front PCM to HP */
15523 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15524 /* port-F for mic-in (front panel) with vref */
15525 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15526 /* port-G for CLFE (rear panel) */
15527 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15528 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15529 /* port-H for side (rear panel) */
15530 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15531 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15533 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15534 /* route front mic to ADC1*/
15535 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15536 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15538 /* Unmute DAC0~3 & spdif out*/
15539 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15540 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15541 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15542 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15545 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15546 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15547 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15548 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15549 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15551 /* Unmute Stereo Mixer 15 */
15552 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15553 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15554 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15555 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15557 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15558 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15559 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15560 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15561 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15562 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15563 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15564 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15565 /* hp used DAC 3 (Front) */
15566 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15567 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15572 static struct hda_verb alc861_threestack_init_verbs[] = {
15574 * Unmute ADC0 and set the default input to mic-in
15576 /* port-A for surround (rear panel) */
15577 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15578 /* port-B for mic-in (rear panel) with vref */
15579 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15580 /* port-C for line-in (rear panel) */
15581 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15582 /* port-D for Front */
15583 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15584 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15585 /* port-E for HP out (front panel) */
15586 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15587 /* route front PCM to HP */
15588 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15589 /* port-F for mic-in (front panel) with vref */
15590 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15591 /* port-G for CLFE (rear panel) */
15592 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15593 /* port-H for side (rear panel) */
15594 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15596 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15597 /* route front mic to ADC1*/
15598 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15599 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15600 /* Unmute DAC0~3 & spdif out*/
15601 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15602 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15603 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15604 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15605 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15607 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15608 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15609 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15610 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15611 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15613 /* Unmute Stereo Mixer 15 */
15614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15615 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15616 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15617 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15619 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15620 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15621 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15622 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15623 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15624 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15625 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15626 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15627 /* hp used DAC 3 (Front) */
15628 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15629 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15633 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15635 * Unmute ADC0 and set the default input to mic-in
15637 /* port-A for surround (rear panel) */
15638 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15639 /* port-B for mic-in (rear panel) with vref */
15640 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15641 /* port-C for line-in (rear panel) */
15642 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15643 /* port-D for Front */
15644 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15645 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15646 /* port-E for HP out (front panel) */
15647 /* this has to be set to VREF80 */
15648 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15649 /* route front PCM to HP */
15650 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15651 /* port-F for mic-in (front panel) with vref */
15652 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15653 /* port-G for CLFE (rear panel) */
15654 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15655 /* port-H for side (rear panel) */
15656 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15658 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15659 /* route front mic to ADC1*/
15660 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15661 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15662 /* Unmute DAC0~3 & spdif out*/
15663 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15664 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15665 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15666 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15667 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15669 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15670 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15671 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15672 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15673 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15675 /* Unmute Stereo Mixer 15 */
15676 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15677 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15678 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15679 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15681 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15682 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15683 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15684 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15685 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15686 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15687 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15688 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15689 /* hp used DAC 3 (Front) */
15690 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15691 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15695 static struct hda_verb alc861_asus_init_verbs[] = {
15697 * Unmute ADC0 and set the default input to mic-in
15699 /* port-A for surround (rear panel)
15700 * according to codec#0 this is the HP jack
15702 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15703 /* route front PCM to HP */
15704 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15705 /* port-B for mic-in (rear panel) with vref */
15706 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15707 /* port-C for line-in (rear panel) */
15708 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15709 /* port-D for Front */
15710 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15711 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15712 /* port-E for HP out (front panel) */
15713 /* this has to be set to VREF80 */
15714 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15715 /* route front PCM to HP */
15716 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15717 /* port-F for mic-in (front panel) with vref */
15718 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15719 /* port-G for CLFE (rear panel) */
15720 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15721 /* port-H for side (rear panel) */
15722 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15724 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15725 /* route front mic to ADC1*/
15726 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15727 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15728 /* Unmute DAC0~3 & spdif out*/
15729 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15730 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15731 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15732 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15733 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15734 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15735 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15736 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15737 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15738 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15740 /* Unmute Stereo Mixer 15 */
15741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15742 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15746 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15747 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15748 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15749 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15750 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15751 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15752 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15753 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15754 /* hp used DAC 3 (Front) */
15755 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15756 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15760 /* additional init verbs for ASUS laptops */
15761 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15762 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15763 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15768 * generic initialization of ADC, input mixers and output mixers
15770 static struct hda_verb alc861_auto_init_verbs[] = {
15772 * Unmute ADC0 and set the default input to mic-in
15774 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15775 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15777 /* Unmute DAC0~3 & spdif out*/
15778 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15779 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15780 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15781 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15784 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15785 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15786 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15787 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15788 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15790 /* Unmute Stereo Mixer 15 */
15791 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15793 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15794 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15796 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15797 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15798 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15799 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15800 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15801 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15802 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15803 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15805 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15806 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15807 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15808 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15809 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15810 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15811 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15812 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15814 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15819 static struct hda_verb alc861_toshiba_init_verbs[] = {
15820 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15825 /* toggle speaker-output according to the hp-jack state */
15826 static void alc861_toshiba_automute(struct hda_codec *codec)
15828 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15830 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15831 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15832 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15833 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15836 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15839 if ((res >> 26) == ALC880_HP_EVENT)
15840 alc861_toshiba_automute(codec);
15843 /* pcm configuration: identical with ALC880 */
15844 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15845 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15846 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15847 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15850 #define ALC861_DIGOUT_NID 0x07
15852 static struct hda_channel_mode alc861_8ch_modes[1] = {
15856 static hda_nid_t alc861_dac_nids[4] = {
15857 /* front, surround, clfe, side */
15858 0x03, 0x06, 0x05, 0x04
15861 static hda_nid_t alc660_dac_nids[3] = {
15862 /* front, clfe, surround */
15866 static hda_nid_t alc861_adc_nids[1] = {
15871 static struct hda_input_mux alc861_capture_source = {
15875 { "Front Mic", 0x3 },
15882 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15884 struct alc_spec *spec = codec->spec;
15885 hda_nid_t mix, srcs[5];
15888 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15890 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15893 for (i = 0; i < num; i++) {
15895 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15896 if (type != AC_WID_AUD_OUT)
15898 for (j = 0; j < spec->multiout.num_dacs; j++)
15899 if (spec->multiout.dac_nids[j] == srcs[i])
15901 if (j >= spec->multiout.num_dacs)
15907 /* fill in the dac_nids table from the parsed pin configuration */
15908 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15909 const struct auto_pin_cfg *cfg)
15911 struct alc_spec *spec = codec->spec;
15913 hda_nid_t nid, dac;
15915 spec->multiout.dac_nids = spec->private_dac_nids;
15916 for (i = 0; i < cfg->line_outs; i++) {
15917 nid = cfg->line_out_pins[i];
15918 dac = alc861_look_for_dac(codec, nid);
15921 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15926 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15927 hda_nid_t nid, int idx, unsigned int chs)
15929 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
15930 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15933 #define alc861_create_out_sw(codec, pfx, nid, chs) \
15934 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
15936 /* add playback controls from the parsed DAC table */
15937 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15938 const struct auto_pin_cfg *cfg)
15940 struct alc_spec *spec = codec->spec;
15941 static const char *chname[4] = {
15942 "Front", "Surround", NULL /*CLFE*/, "Side"
15944 const char *pfx = alc_get_line_out_pfx(cfg, true);
15948 for (i = 0; i < cfg->line_outs; i++) {
15949 nid = spec->multiout.dac_nids[i];
15952 if (!pfx && i == 2) {
15954 err = alc861_create_out_sw(codec, "Center", nid, 1);
15957 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15961 const char *name = pfx;
15964 err = __alc861_create_out_sw(codec, name, nid, i, 3);
15972 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15974 struct alc_spec *spec = codec->spec;
15981 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15982 nid = alc861_look_for_dac(codec, pin);
15984 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15987 spec->multiout.hp_nid = nid;
15993 /* create playback/capture controls for input pins */
15994 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15995 const struct auto_pin_cfg *cfg)
15997 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
16000 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
16002 int pin_type, hda_nid_t dac)
16004 hda_nid_t mix, srcs[5];
16007 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
16009 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16011 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
16013 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16016 for (i = 0; i < num; i++) {
16018 if (srcs[i] == dac || srcs[i] == 0x15)
16019 mute = AMP_IN_UNMUTE(i);
16021 mute = AMP_IN_MUTE(i);
16022 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16027 static void alc861_auto_init_multi_out(struct hda_codec *codec)
16029 struct alc_spec *spec = codec->spec;
16032 for (i = 0; i < spec->autocfg.line_outs; i++) {
16033 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16034 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16036 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
16037 spec->multiout.dac_nids[i]);
16041 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16043 struct alc_spec *spec = codec->spec;
16045 if (spec->autocfg.hp_outs)
16046 alc861_auto_set_output_and_unmute(codec,
16047 spec->autocfg.hp_pins[0],
16049 spec->multiout.hp_nid);
16050 if (spec->autocfg.speaker_outs)
16051 alc861_auto_set_output_and_unmute(codec,
16052 spec->autocfg.speaker_pins[0],
16054 spec->multiout.dac_nids[0]);
16057 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16059 struct alc_spec *spec = codec->spec;
16060 struct auto_pin_cfg *cfg = &spec->autocfg;
16063 for (i = 0; i < cfg->num_inputs; i++) {
16064 hda_nid_t nid = cfg->inputs[i].pin;
16065 if (nid >= 0x0c && nid <= 0x11)
16066 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16070 /* parse the BIOS configuration and set up the alc_spec */
16071 /* return 1 if successful, 0 if the proper config is not found,
16072 * or a negative error code
16074 static int alc861_parse_auto_config(struct hda_codec *codec)
16076 struct alc_spec *spec = codec->spec;
16078 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16080 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16084 if (!spec->autocfg.line_outs)
16085 return 0; /* can't find valid BIOS pin config */
16087 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16090 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16093 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16096 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16100 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16102 alc_auto_parse_digital(codec);
16104 if (spec->kctls.list)
16105 add_mixer(spec, spec->kctls.list);
16107 add_verb(spec, alc861_auto_init_verbs);
16109 spec->num_mux_defs = 1;
16110 spec->input_mux = &spec->private_imux[0];
16112 spec->adc_nids = alc861_adc_nids;
16113 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16114 set_capture_mixer(codec);
16116 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16121 /* additional initialization for auto-configuration model */
16122 static void alc861_auto_init(struct hda_codec *codec)
16124 struct alc_spec *spec = codec->spec;
16125 alc861_auto_init_multi_out(codec);
16126 alc861_auto_init_hp_out(codec);
16127 alc861_auto_init_analog_input(codec);
16128 alc_auto_init_digital(codec);
16129 if (spec->unsol_event)
16130 alc_inithook(codec);
16133 #ifdef CONFIG_SND_HDA_POWER_SAVE
16134 static struct hda_amp_list alc861_loopbacks[] = {
16135 { 0x15, HDA_INPUT, 0 },
16136 { 0x15, HDA_INPUT, 1 },
16137 { 0x15, HDA_INPUT, 2 },
16138 { 0x15, HDA_INPUT, 3 },
16145 * configuration and preset
16147 static const char *alc861_models[ALC861_MODEL_LAST] = {
16148 [ALC861_3ST] = "3stack",
16149 [ALC660_3ST] = "3stack-660",
16150 [ALC861_3ST_DIG] = "3stack-dig",
16151 [ALC861_6ST_DIG] = "6stack-dig",
16152 [ALC861_UNIWILL_M31] = "uniwill-m31",
16153 [ALC861_TOSHIBA] = "toshiba",
16154 [ALC861_ASUS] = "asus",
16155 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16156 [ALC861_AUTO] = "auto",
16159 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16160 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16161 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16162 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16163 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16164 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16165 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16166 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16167 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16168 * Any other models that need this preset?
16170 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16171 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16172 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16173 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16174 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16175 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16176 /* FIXME: the below seems conflict */
16177 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16178 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16179 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16183 static struct alc_config_preset alc861_presets[] = {
16185 .mixers = { alc861_3ST_mixer },
16186 .init_verbs = { alc861_threestack_init_verbs },
16187 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16188 .dac_nids = alc861_dac_nids,
16189 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16190 .channel_mode = alc861_threestack_modes,
16192 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16193 .adc_nids = alc861_adc_nids,
16194 .input_mux = &alc861_capture_source,
16196 [ALC861_3ST_DIG] = {
16197 .mixers = { alc861_base_mixer },
16198 .init_verbs = { alc861_threestack_init_verbs },
16199 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16200 .dac_nids = alc861_dac_nids,
16201 .dig_out_nid = ALC861_DIGOUT_NID,
16202 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16203 .channel_mode = alc861_threestack_modes,
16205 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16206 .adc_nids = alc861_adc_nids,
16207 .input_mux = &alc861_capture_source,
16209 [ALC861_6ST_DIG] = {
16210 .mixers = { alc861_base_mixer },
16211 .init_verbs = { alc861_base_init_verbs },
16212 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16213 .dac_nids = alc861_dac_nids,
16214 .dig_out_nid = ALC861_DIGOUT_NID,
16215 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16216 .channel_mode = alc861_8ch_modes,
16217 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16218 .adc_nids = alc861_adc_nids,
16219 .input_mux = &alc861_capture_source,
16222 .mixers = { alc861_3ST_mixer },
16223 .init_verbs = { alc861_threestack_init_verbs },
16224 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16225 .dac_nids = alc660_dac_nids,
16226 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16227 .channel_mode = alc861_threestack_modes,
16229 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16230 .adc_nids = alc861_adc_nids,
16231 .input_mux = &alc861_capture_source,
16233 [ALC861_UNIWILL_M31] = {
16234 .mixers = { alc861_uniwill_m31_mixer },
16235 .init_verbs = { alc861_uniwill_m31_init_verbs },
16236 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16237 .dac_nids = alc861_dac_nids,
16238 .dig_out_nid = ALC861_DIGOUT_NID,
16239 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16240 .channel_mode = alc861_uniwill_m31_modes,
16242 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16243 .adc_nids = alc861_adc_nids,
16244 .input_mux = &alc861_capture_source,
16246 [ALC861_TOSHIBA] = {
16247 .mixers = { alc861_toshiba_mixer },
16248 .init_verbs = { alc861_base_init_verbs,
16249 alc861_toshiba_init_verbs },
16250 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16251 .dac_nids = alc861_dac_nids,
16252 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16253 .channel_mode = alc883_3ST_2ch_modes,
16254 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16255 .adc_nids = alc861_adc_nids,
16256 .input_mux = &alc861_capture_source,
16257 .unsol_event = alc861_toshiba_unsol_event,
16258 .init_hook = alc861_toshiba_automute,
16261 .mixers = { alc861_asus_mixer },
16262 .init_verbs = { alc861_asus_init_verbs },
16263 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16264 .dac_nids = alc861_dac_nids,
16265 .dig_out_nid = ALC861_DIGOUT_NID,
16266 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16267 .channel_mode = alc861_asus_modes,
16270 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16271 .adc_nids = alc861_adc_nids,
16272 .input_mux = &alc861_capture_source,
16274 [ALC861_ASUS_LAPTOP] = {
16275 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16276 .init_verbs = { alc861_asus_init_verbs,
16277 alc861_asus_laptop_init_verbs },
16278 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16279 .dac_nids = alc861_dac_nids,
16280 .dig_out_nid = ALC861_DIGOUT_NID,
16281 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16282 .channel_mode = alc883_3ST_2ch_modes,
16284 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16285 .adc_nids = alc861_adc_nids,
16286 .input_mux = &alc861_capture_source,
16290 /* Pin config fixes */
16292 PINFIX_FSC_AMILO_PI1505,
16295 static const struct alc_fixup alc861_fixups[] = {
16296 [PINFIX_FSC_AMILO_PI1505] = {
16297 .pins = (const struct alc_pincfg[]) {
16298 { 0x0b, 0x0221101f }, /* HP */
16299 { 0x0f, 0x90170310 }, /* speaker */
16305 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16306 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16310 static int patch_alc861(struct hda_codec *codec)
16312 struct alc_spec *spec;
16316 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16320 codec->spec = spec;
16322 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16326 if (board_config < 0) {
16327 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16329 board_config = ALC861_AUTO;
16332 if (board_config == ALC861_AUTO)
16333 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
16335 if (board_config == ALC861_AUTO) {
16336 /* automatic parse from the BIOS config */
16337 err = alc861_parse_auto_config(codec);
16343 "hda_codec: Cannot set up configuration "
16344 "from BIOS. Using base mode...\n");
16345 board_config = ALC861_3ST_DIG;
16349 err = snd_hda_attach_beep_device(codec, 0x23);
16355 if (board_config != ALC861_AUTO)
16356 setup_preset(codec, &alc861_presets[board_config]);
16358 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16359 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16361 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16362 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16364 if (!spec->cap_mixer)
16365 set_capture_mixer(codec);
16366 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16368 spec->vmaster_nid = 0x03;
16370 if (board_config == ALC861_AUTO)
16371 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
16373 codec->patch_ops = alc_patch_ops;
16374 if (board_config == ALC861_AUTO) {
16375 spec->init_hook = alc861_auto_init;
16376 #ifdef CONFIG_SND_HDA_POWER_SAVE
16377 spec->power_hook = alc_power_eapd;
16380 #ifdef CONFIG_SND_HDA_POWER_SAVE
16381 if (!spec->loopback.amplist)
16382 spec->loopback.amplist = alc861_loopbacks;
16389 * ALC861-VD support
16393 * In addition, an independent DAC
16395 #define ALC861VD_DIGOUT_NID 0x06
16397 static hda_nid_t alc861vd_dac_nids[4] = {
16398 /* front, surr, clfe, side surr */
16399 0x02, 0x03, 0x04, 0x05
16402 /* dac_nids for ALC660vd are in a different order - according to
16403 * Realtek's driver.
16404 * This should probably result in a different mixer for 6stack models
16405 * of ALC660vd codecs, but for now there is only 3stack mixer
16406 * - and it is the same as in 861vd.
16407 * adc_nids in ALC660vd are (is) the same as in 861vd
16409 static hda_nid_t alc660vd_dac_nids[3] = {
16410 /* front, rear, clfe, rear_surr */
16414 static hda_nid_t alc861vd_adc_nids[1] = {
16419 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16422 /* FIXME: should be a matrix-type input source selection */
16423 static struct hda_input_mux alc861vd_capture_source = {
16427 { "Front Mic", 0x1 },
16433 static struct hda_input_mux alc861vd_dallas_capture_source = {
16437 { "Internal Mic", 0x1 },
16441 static struct hda_input_mux alc861vd_hp_capture_source = {
16444 { "Front Mic", 0x0 },
16445 { "ATAPI Mic", 0x1 },
16452 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16459 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16460 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16461 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16462 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16463 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16470 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16471 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16472 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16473 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16474 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16478 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16479 { 6, alc861vd_6stack_ch6_init },
16480 { 8, alc861vd_6stack_ch8_init },
16483 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16485 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16486 .name = "Channel Mode",
16487 .info = alc_ch_mode_info,
16488 .get = alc_ch_mode_get,
16489 .put = alc_ch_mode_put,
16494 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16495 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16497 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16498 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16499 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16501 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16502 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16504 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16506 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16508 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16509 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16511 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16512 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16514 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16516 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16517 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16518 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16520 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16521 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16522 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16524 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16525 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16527 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16528 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16533 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16534 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16535 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16537 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16539 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16540 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16541 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16543 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16544 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16545 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16547 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16548 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16550 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16551 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16556 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16557 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16558 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16559 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16561 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16563 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16564 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16565 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16567 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16568 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16569 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16571 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16572 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16577 /* Pin assignment: Speaker=0x14, HP = 0x15,
16578 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16580 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16581 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16582 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16583 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16584 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16585 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16586 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16587 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16588 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16589 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16590 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16594 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16595 * Front Mic=0x18, ATAPI Mic = 0x19,
16597 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16598 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16599 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16600 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16601 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16602 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16603 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16604 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16605 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16611 * generic initialization of ADC, input mixers and output mixers
16613 static struct hda_verb alc861vd_volume_init_verbs[] = {
16615 * Unmute ADC0 and set the default input to mic-in
16617 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16618 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16620 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16621 * the analog-loopback mixer widget
16623 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16630 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16631 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16632 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16633 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16634 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16637 * Set up output mixers (0x02 - 0x05)
16639 /* set vol=0 to output mixers */
16640 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16641 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16642 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16643 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16645 /* set up input amps for analog loopback */
16646 /* Amp Indices: DAC = 0, mixer = 1 */
16647 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16648 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16649 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16650 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16651 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16652 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16653 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16654 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16660 * 3-stack pin configuration:
16661 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16663 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16665 * Set pin mode and muting
16667 /* set front pin widgets 0x14 for output */
16668 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16669 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16670 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16672 /* Mic (rear) pin: input vref at 80% */
16673 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16674 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16675 /* Front Mic pin: input vref at 80% */
16676 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16677 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16678 /* Line In pin: input */
16679 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16680 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16681 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16682 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16683 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16684 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16685 /* CD pin widget for input */
16686 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16692 * 6-stack pin configuration:
16694 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16696 * Set pin mode and muting
16698 /* set front pin widgets 0x14 for output */
16699 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16700 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16701 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16703 /* Rear Pin: output 1 (0x0d) */
16704 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16705 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16706 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16707 /* CLFE Pin: output 2 (0x0e) */
16708 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16709 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16710 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16711 /* Side Pin: output 3 (0x0f) */
16712 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16713 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16714 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16716 /* Mic (rear) pin: input vref at 80% */
16717 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16718 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16719 /* Front Mic pin: input vref at 80% */
16720 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16721 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16722 /* Line In pin: input */
16723 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16724 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16725 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16726 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16727 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16728 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16729 /* CD pin widget for input */
16730 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16735 static struct hda_verb alc861vd_eapd_verbs[] = {
16736 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16740 static struct hda_verb alc660vd_eapd_verbs[] = {
16741 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16742 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16746 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16748 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16749 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16750 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16751 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16755 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16757 struct alc_spec *spec = codec->spec;
16758 spec->autocfg.hp_pins[0] = 0x1b;
16759 spec->autocfg.speaker_pins[0] = 0x14;
16762 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16764 alc_automute_amp(codec);
16765 alc88x_simple_mic_automute(codec);
16768 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16771 switch (res >> 26) {
16772 case ALC880_MIC_EVENT:
16773 alc88x_simple_mic_automute(codec);
16776 alc_automute_amp_unsol_event(codec, res);
16781 static struct hda_verb alc861vd_dallas_verbs[] = {
16782 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16783 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16784 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16785 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16788 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16789 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16790 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16791 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16792 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16793 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16794 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16797 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16798 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16799 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16800 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16801 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16802 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16803 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16805 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16806 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16807 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16808 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16809 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16810 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16811 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16812 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16814 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16815 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16816 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16817 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16819 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16820 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16821 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16826 /* toggle speaker-output according to the hp-jack state */
16827 static void alc861vd_dallas_setup(struct hda_codec *codec)
16829 struct alc_spec *spec = codec->spec;
16831 spec->autocfg.hp_pins[0] = 0x15;
16832 spec->autocfg.speaker_pins[0] = 0x14;
16835 #ifdef CONFIG_SND_HDA_POWER_SAVE
16836 #define alc861vd_loopbacks alc880_loopbacks
16839 /* pcm configuration: identical with ALC880 */
16840 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16841 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16842 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16843 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16846 * configuration and preset
16848 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16849 [ALC660VD_3ST] = "3stack-660",
16850 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16851 [ALC660VD_ASUS_V1S] = "asus-v1s",
16852 [ALC861VD_3ST] = "3stack",
16853 [ALC861VD_3ST_DIG] = "3stack-digout",
16854 [ALC861VD_6ST_DIG] = "6stack-digout",
16855 [ALC861VD_LENOVO] = "lenovo",
16856 [ALC861VD_DALLAS] = "dallas",
16857 [ALC861VD_HP] = "hp",
16858 [ALC861VD_AUTO] = "auto",
16861 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16862 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16863 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16864 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16865 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16866 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16867 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16868 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16869 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16870 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16871 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16872 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16873 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16874 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16875 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16876 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16880 static struct alc_config_preset alc861vd_presets[] = {
16882 .mixers = { alc861vd_3st_mixer },
16883 .init_verbs = { alc861vd_volume_init_verbs,
16884 alc861vd_3stack_init_verbs },
16885 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16886 .dac_nids = alc660vd_dac_nids,
16887 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16888 .channel_mode = alc861vd_3stack_2ch_modes,
16889 .input_mux = &alc861vd_capture_source,
16891 [ALC660VD_3ST_DIG] = {
16892 .mixers = { alc861vd_3st_mixer },
16893 .init_verbs = { alc861vd_volume_init_verbs,
16894 alc861vd_3stack_init_verbs },
16895 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16896 .dac_nids = alc660vd_dac_nids,
16897 .dig_out_nid = ALC861VD_DIGOUT_NID,
16898 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16899 .channel_mode = alc861vd_3stack_2ch_modes,
16900 .input_mux = &alc861vd_capture_source,
16903 .mixers = { alc861vd_3st_mixer },
16904 .init_verbs = { alc861vd_volume_init_verbs,
16905 alc861vd_3stack_init_verbs },
16906 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16907 .dac_nids = alc861vd_dac_nids,
16908 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16909 .channel_mode = alc861vd_3stack_2ch_modes,
16910 .input_mux = &alc861vd_capture_source,
16912 [ALC861VD_3ST_DIG] = {
16913 .mixers = { alc861vd_3st_mixer },
16914 .init_verbs = { alc861vd_volume_init_verbs,
16915 alc861vd_3stack_init_verbs },
16916 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16917 .dac_nids = alc861vd_dac_nids,
16918 .dig_out_nid = ALC861VD_DIGOUT_NID,
16919 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16920 .channel_mode = alc861vd_3stack_2ch_modes,
16921 .input_mux = &alc861vd_capture_source,
16923 [ALC861VD_6ST_DIG] = {
16924 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16925 .init_verbs = { alc861vd_volume_init_verbs,
16926 alc861vd_6stack_init_verbs },
16927 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16928 .dac_nids = alc861vd_dac_nids,
16929 .dig_out_nid = ALC861VD_DIGOUT_NID,
16930 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16931 .channel_mode = alc861vd_6stack_modes,
16932 .input_mux = &alc861vd_capture_source,
16934 [ALC861VD_LENOVO] = {
16935 .mixers = { alc861vd_lenovo_mixer },
16936 .init_verbs = { alc861vd_volume_init_verbs,
16937 alc861vd_3stack_init_verbs,
16938 alc861vd_eapd_verbs,
16939 alc861vd_lenovo_unsol_verbs },
16940 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16941 .dac_nids = alc660vd_dac_nids,
16942 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16943 .channel_mode = alc861vd_3stack_2ch_modes,
16944 .input_mux = &alc861vd_capture_source,
16945 .unsol_event = alc861vd_lenovo_unsol_event,
16946 .setup = alc861vd_lenovo_setup,
16947 .init_hook = alc861vd_lenovo_init_hook,
16949 [ALC861VD_DALLAS] = {
16950 .mixers = { alc861vd_dallas_mixer },
16951 .init_verbs = { alc861vd_dallas_verbs },
16952 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16953 .dac_nids = alc861vd_dac_nids,
16954 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16955 .channel_mode = alc861vd_3stack_2ch_modes,
16956 .input_mux = &alc861vd_dallas_capture_source,
16957 .unsol_event = alc_automute_amp_unsol_event,
16958 .setup = alc861vd_dallas_setup,
16959 .init_hook = alc_automute_amp,
16962 .mixers = { alc861vd_hp_mixer },
16963 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16964 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16965 .dac_nids = alc861vd_dac_nids,
16966 .dig_out_nid = ALC861VD_DIGOUT_NID,
16967 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16968 .channel_mode = alc861vd_3stack_2ch_modes,
16969 .input_mux = &alc861vd_hp_capture_source,
16970 .unsol_event = alc_automute_amp_unsol_event,
16971 .setup = alc861vd_dallas_setup,
16972 .init_hook = alc_automute_amp,
16974 [ALC660VD_ASUS_V1S] = {
16975 .mixers = { alc861vd_lenovo_mixer },
16976 .init_verbs = { alc861vd_volume_init_verbs,
16977 alc861vd_3stack_init_verbs,
16978 alc861vd_eapd_verbs,
16979 alc861vd_lenovo_unsol_verbs },
16980 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16981 .dac_nids = alc660vd_dac_nids,
16982 .dig_out_nid = ALC861VD_DIGOUT_NID,
16983 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16984 .channel_mode = alc861vd_3stack_2ch_modes,
16985 .input_mux = &alc861vd_capture_source,
16986 .unsol_event = alc861vd_lenovo_unsol_event,
16987 .setup = alc861vd_lenovo_setup,
16988 .init_hook = alc861vd_lenovo_init_hook,
16993 * BIOS auto configuration
16995 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16996 const struct auto_pin_cfg *cfg)
16998 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
17002 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
17003 hda_nid_t nid, int pin_type, int dac_idx)
17005 alc_set_pin_output(codec, nid, pin_type);
17008 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
17010 struct alc_spec *spec = codec->spec;
17013 for (i = 0; i <= HDA_SIDE; i++) {
17014 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17015 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17017 alc861vd_auto_set_output_and_unmute(codec, nid,
17023 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
17025 struct alc_spec *spec = codec->spec;
17028 pin = spec->autocfg.hp_pins[0];
17029 if (pin) /* connect to front and use dac 0 */
17030 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17031 pin = spec->autocfg.speaker_pins[0];
17033 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17036 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17038 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17040 struct alc_spec *spec = codec->spec;
17041 struct auto_pin_cfg *cfg = &spec->autocfg;
17044 for (i = 0; i < cfg->num_inputs; i++) {
17045 hda_nid_t nid = cfg->inputs[i].pin;
17046 if (alc_is_input_pin(codec, nid)) {
17047 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17048 if (nid != ALC861VD_PIN_CD_NID &&
17049 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17050 snd_hda_codec_write(codec, nid, 0,
17051 AC_VERB_SET_AMP_GAIN_MUTE,
17057 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17059 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17060 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17062 /* add playback controls from the parsed DAC table */
17063 /* Based on ALC880 version. But ALC861VD has separate,
17064 * different NIDs for mute/unmute switch and volume control */
17065 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17066 const struct auto_pin_cfg *cfg)
17068 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
17069 const char *pfx = alc_get_line_out_pfx(cfg, true);
17070 hda_nid_t nid_v, nid_s;
17073 for (i = 0; i < cfg->line_outs; i++) {
17074 if (!spec->multiout.dac_nids[i])
17076 nid_v = alc861vd_idx_to_mixer_vol(
17078 spec->multiout.dac_nids[i]));
17079 nid_s = alc861vd_idx_to_mixer_switch(
17081 spec->multiout.dac_nids[i]));
17083 if (!pfx && i == 2) {
17085 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17087 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17091 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17093 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17097 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17099 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17103 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17105 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17110 const char *name = pfx;
17113 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17115 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17119 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17121 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17130 /* add playback controls for speaker and HP outputs */
17131 /* Based on ALC880 version. But ALC861VD has separate,
17132 * different NIDs for mute/unmute switch and volume control */
17133 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17134 hda_nid_t pin, const char *pfx)
17136 hda_nid_t nid_v, nid_s;
17142 if (alc880_is_fixed_pin(pin)) {
17143 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17144 /* specify the DAC as the extra output */
17145 if (!spec->multiout.hp_nid)
17146 spec->multiout.hp_nid = nid_v;
17148 spec->multiout.extra_out_nid[0] = nid_v;
17149 /* control HP volume/switch on the output mixer amp */
17150 nid_v = alc861vd_idx_to_mixer_vol(
17151 alc880_fixed_pin_idx(pin));
17152 nid_s = alc861vd_idx_to_mixer_switch(
17153 alc880_fixed_pin_idx(pin));
17155 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17156 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17159 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17160 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17163 } else if (alc880_is_multi_pin(pin)) {
17164 /* set manual connection */
17165 /* we have only a switch on HP-out PIN */
17166 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17167 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17174 /* parse the BIOS configuration and set up the alc_spec
17175 * return 1 if successful, 0 if the proper config is not found,
17176 * or a negative error code
17177 * Based on ALC880 version - had to change it to override
17178 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17179 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17181 struct alc_spec *spec = codec->spec;
17183 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17185 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17189 if (!spec->autocfg.line_outs)
17190 return 0; /* can't find valid BIOS pin config */
17192 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17195 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17198 err = alc861vd_auto_create_extra_out(spec,
17199 spec->autocfg.speaker_pins[0],
17203 err = alc861vd_auto_create_extra_out(spec,
17204 spec->autocfg.hp_pins[0],
17208 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17212 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17214 alc_auto_parse_digital(codec);
17216 if (spec->kctls.list)
17217 add_mixer(spec, spec->kctls.list);
17219 add_verb(spec, alc861vd_volume_init_verbs);
17221 spec->num_mux_defs = 1;
17222 spec->input_mux = &spec->private_imux[0];
17224 err = alc_auto_add_mic_boost(codec);
17228 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17233 /* additional initialization for auto-configuration model */
17234 static void alc861vd_auto_init(struct hda_codec *codec)
17236 struct alc_spec *spec = codec->spec;
17237 alc861vd_auto_init_multi_out(codec);
17238 alc861vd_auto_init_hp_out(codec);
17239 alc861vd_auto_init_analog_input(codec);
17240 alc861vd_auto_init_input_src(codec);
17241 alc_auto_init_digital(codec);
17242 if (spec->unsol_event)
17243 alc_inithook(codec);
17247 ALC660VD_FIX_ASUS_GPIO1
17251 static const struct alc_fixup alc861vd_fixups[] = {
17252 [ALC660VD_FIX_ASUS_GPIO1] = {
17253 .verbs = (const struct hda_verb[]) {
17254 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17255 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17256 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17262 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17263 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17267 static int patch_alc861vd(struct hda_codec *codec)
17269 struct alc_spec *spec;
17270 int err, board_config;
17272 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17276 codec->spec = spec;
17278 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17282 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17283 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17285 board_config = ALC861VD_AUTO;
17288 if (board_config == ALC861VD_AUTO)
17289 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
17291 if (board_config == ALC861VD_AUTO) {
17292 /* automatic parse from the BIOS config */
17293 err = alc861vd_parse_auto_config(codec);
17299 "hda_codec: Cannot set up configuration "
17300 "from BIOS. Using base mode...\n");
17301 board_config = ALC861VD_3ST;
17305 err = snd_hda_attach_beep_device(codec, 0x23);
17311 if (board_config != ALC861VD_AUTO)
17312 setup_preset(codec, &alc861vd_presets[board_config]);
17314 if (codec->vendor_id == 0x10ec0660) {
17315 /* always turn on EAPD */
17316 add_verb(spec, alc660vd_eapd_verbs);
17319 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17320 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17322 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17323 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17325 if (!spec->adc_nids) {
17326 spec->adc_nids = alc861vd_adc_nids;
17327 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17329 if (!spec->capsrc_nids)
17330 spec->capsrc_nids = alc861vd_capsrc_nids;
17332 set_capture_mixer(codec);
17333 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17335 spec->vmaster_nid = 0x02;
17337 if (board_config == ALC861VD_AUTO)
17338 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
17340 codec->patch_ops = alc_patch_ops;
17342 if (board_config == ALC861VD_AUTO)
17343 spec->init_hook = alc861vd_auto_init;
17344 #ifdef CONFIG_SND_HDA_POWER_SAVE
17345 if (!spec->loopback.amplist)
17346 spec->loopback.amplist = alc861vd_loopbacks;
17355 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17356 * configuration. Each pin widget can choose any input DACs and a mixer.
17357 * Each ADC is connected from a mixer of all inputs. This makes possible
17358 * 6-channel independent captures.
17360 * In addition, an independent DAC for the multi-playback (not used in this
17363 #define ALC662_DIGOUT_NID 0x06
17364 #define ALC662_DIGIN_NID 0x0a
17366 static hda_nid_t alc662_dac_nids[4] = {
17367 /* front, rear, clfe, rear_surr */
17371 static hda_nid_t alc272_dac_nids[2] = {
17375 static hda_nid_t alc662_adc_nids[2] = {
17380 static hda_nid_t alc272_adc_nids[1] = {
17385 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17386 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17390 /* FIXME: should be a matrix-type input source selection */
17391 static struct hda_input_mux alc662_capture_source = {
17395 { "Front Mic", 0x1 },
17401 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17409 static struct hda_input_mux alc663_capture_source = {
17413 { "Front Mic", 0x1 },
17418 #if 0 /* set to 1 for testing other input sources below */
17419 static struct hda_input_mux alc272_nc10_capture_source = {
17422 { "Autoselect Mic", 0x0 },
17423 { "Internal Mic", 0x1 },
17424 { "In-0x02", 0x2 },
17425 { "In-0x03", 0x3 },
17426 { "In-0x04", 0x4 },
17427 { "In-0x05", 0x5 },
17428 { "In-0x06", 0x6 },
17429 { "In-0x07", 0x7 },
17430 { "In-0x08", 0x8 },
17431 { "In-0x09", 0x9 },
17432 { "In-0x0a", 0x0a },
17433 { "In-0x0b", 0x0b },
17434 { "In-0x0c", 0x0c },
17435 { "In-0x0d", 0x0d },
17436 { "In-0x0e", 0x0e },
17437 { "In-0x0f", 0x0f },
17445 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17452 static struct hda_verb alc662_3ST_ch2_init[] = {
17453 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17454 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17455 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17456 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17463 static struct hda_verb alc662_3ST_ch6_init[] = {
17464 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17465 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17466 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17467 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17468 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17469 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17473 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17474 { 2, alc662_3ST_ch2_init },
17475 { 6, alc662_3ST_ch6_init },
17481 static struct hda_verb alc662_sixstack_ch6_init[] = {
17482 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17483 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17484 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17491 static struct hda_verb alc662_sixstack_ch8_init[] = {
17492 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17493 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17494 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17498 static struct hda_channel_mode alc662_5stack_modes[2] = {
17499 { 2, alc662_sixstack_ch6_init },
17500 { 6, alc662_sixstack_ch8_init },
17503 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17504 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17507 static struct snd_kcontrol_new alc662_base_mixer[] = {
17508 /* output mixer control */
17509 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17510 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17511 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17512 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17513 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17514 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17515 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17516 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17517 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17519 /*Input mixer control */
17520 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17521 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17522 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17523 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17524 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17525 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17526 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17527 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17531 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17532 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17533 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17534 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17535 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17536 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17537 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17538 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17539 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17540 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17541 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17542 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17546 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17547 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17548 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17549 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17550 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17551 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17552 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17553 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17554 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17555 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17556 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17557 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17558 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17559 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17560 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17561 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17562 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17563 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17567 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17568 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17569 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17570 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17571 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17572 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17573 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17574 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17576 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17580 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17581 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17582 ALC262_HIPPO_MASTER_SWITCH,
17584 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17585 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17586 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17588 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17589 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17590 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17594 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17595 ALC262_HIPPO_MASTER_SWITCH,
17596 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17597 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17598 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17599 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17600 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17601 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17602 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17604 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17608 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17609 .ops = &snd_hda_bind_vol,
17611 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17612 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17617 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17618 .ops = &snd_hda_bind_sw,
17620 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17621 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17626 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17627 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17628 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17629 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17630 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17634 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17635 .ops = &snd_hda_bind_sw,
17637 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17638 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17639 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17644 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17645 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17646 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17647 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17648 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17649 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17650 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17655 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17656 .ops = &snd_hda_bind_sw,
17658 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17659 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17660 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17665 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17666 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17667 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17668 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17669 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17670 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17671 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17675 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17676 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17677 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17678 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17681 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17682 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17686 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17687 .ops = &snd_hda_bind_vol,
17689 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17690 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17695 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17696 .ops = &snd_hda_bind_sw,
17698 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17699 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17704 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17705 HDA_BIND_VOL("Master Playback Volume",
17706 &alc663_asus_two_bind_master_vol),
17707 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17708 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17709 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17710 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17711 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17715 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17716 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17717 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17718 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17719 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17720 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17721 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17725 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17726 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17727 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17728 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17729 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17730 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17734 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17735 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17739 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17740 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17741 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17742 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17744 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17745 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17746 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17747 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17748 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17749 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17753 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17754 .ops = &snd_hda_bind_sw,
17756 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17757 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17758 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17759 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17760 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17765 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17766 .ops = &snd_hda_bind_sw,
17768 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17769 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17774 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17775 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17776 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17777 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17778 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17779 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17780 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17781 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17782 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17783 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17787 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17788 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17789 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17790 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17791 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17792 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17793 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17794 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17799 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17801 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17802 .name = "Channel Mode",
17803 .info = alc_ch_mode_info,
17804 .get = alc_ch_mode_get,
17805 .put = alc_ch_mode_put,
17810 static struct hda_verb alc662_init_verbs[] = {
17811 /* ADC: mute amp left and right */
17812 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17813 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17815 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17817 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17818 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17819 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17820 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17822 /* Front Pin: output 0 (0x0c) */
17823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17824 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17826 /* Rear Pin: output 1 (0x0d) */
17827 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17828 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17830 /* CLFE Pin: output 2 (0x0e) */
17831 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17832 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17834 /* Mic (rear) pin: input vref at 80% */
17835 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17836 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17837 /* Front Mic pin: input vref at 80% */
17838 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17839 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17840 /* Line In pin: input */
17841 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17842 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17843 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17844 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17845 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17846 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17847 /* CD pin widget for input */
17848 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17850 /* FIXME: use matrix-type input source selection */
17851 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17853 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17854 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17856 /* always trun on EAPD */
17857 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17858 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17863 static struct hda_verb alc663_init_verbs[] = {
17864 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17865 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17866 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17867 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17868 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17869 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17873 static struct hda_verb alc272_init_verbs[] = {
17874 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17875 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17876 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17877 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17878 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17879 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17880 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17881 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17885 static struct hda_verb alc662_sue_init_verbs[] = {
17886 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17887 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17891 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17892 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17893 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17897 /* Set Unsolicited Event*/
17898 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17899 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17900 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17904 static struct hda_verb alc663_m51va_init_verbs[] = {
17905 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17906 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17907 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17908 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17909 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17910 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17912 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17913 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17917 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17918 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17919 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17920 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17921 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17922 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17923 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17924 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17928 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17929 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17930 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17931 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17932 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17934 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17935 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17936 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17940 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17941 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17942 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17943 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17944 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17945 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17946 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17947 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17951 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17952 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17953 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17954 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17955 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17956 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17957 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17958 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17959 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17960 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17961 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17962 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17963 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17967 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17968 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17969 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17970 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17971 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17972 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17973 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17974 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17975 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17976 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17977 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17978 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17979 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17983 static struct hda_verb alc663_g71v_init_verbs[] = {
17984 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17985 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17986 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17988 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17989 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17990 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17992 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17993 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17994 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17998 static struct hda_verb alc663_g50v_init_verbs[] = {
17999 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18000 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18001 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18003 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18004 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18008 static struct hda_verb alc662_ecs_init_verbs[] = {
18009 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
18010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18011 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18012 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18016 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
18017 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18018 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18019 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18020 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18021 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18022 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18023 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18024 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18025 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18026 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18027 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18031 static struct hda_verb alc272_dell_init_verbs[] = {
18032 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18033 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18034 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18035 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18036 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18037 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18038 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18039 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18040 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18041 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18042 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18046 static struct hda_verb alc663_mode7_init_verbs[] = {
18047 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18048 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18049 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18050 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18051 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18052 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18053 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18054 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18055 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18056 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18057 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18059 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18060 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18061 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18065 static struct hda_verb alc663_mode8_init_verbs[] = {
18066 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18067 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18069 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18070 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18071 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18072 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18073 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18074 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18075 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18076 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18079 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18080 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18081 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18085 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18086 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18087 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18091 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18092 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18093 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18097 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18099 unsigned int present;
18100 unsigned char bits;
18102 present = snd_hda_jack_detect(codec, 0x14);
18103 bits = present ? HDA_AMP_MUTE : 0;
18105 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18106 HDA_AMP_MUTE, bits);
18109 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18111 unsigned int present;
18112 unsigned char bits;
18114 present = snd_hda_jack_detect(codec, 0x1b);
18115 bits = present ? HDA_AMP_MUTE : 0;
18117 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18118 HDA_AMP_MUTE, bits);
18119 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18120 HDA_AMP_MUTE, bits);
18123 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18126 if ((res >> 26) == ALC880_HP_EVENT)
18127 alc662_lenovo_101e_all_automute(codec);
18128 if ((res >> 26) == ALC880_FRONT_EVENT)
18129 alc662_lenovo_101e_ispeaker_automute(codec);
18132 /* unsolicited event for HP jack sensing */
18133 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18136 if ((res >> 26) == ALC880_MIC_EVENT)
18137 alc_mic_automute(codec);
18139 alc262_hippo_unsol_event(codec, res);
18142 static void alc662_eeepc_setup(struct hda_codec *codec)
18144 struct alc_spec *spec = codec->spec;
18146 alc262_hippo1_setup(codec);
18147 spec->ext_mic.pin = 0x18;
18148 spec->ext_mic.mux_idx = 0;
18149 spec->int_mic.pin = 0x19;
18150 spec->int_mic.mux_idx = 1;
18151 spec->auto_mic = 1;
18154 static void alc662_eeepc_inithook(struct hda_codec *codec)
18156 alc262_hippo_automute(codec);
18157 alc_mic_automute(codec);
18160 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18162 struct alc_spec *spec = codec->spec;
18164 spec->autocfg.hp_pins[0] = 0x14;
18165 spec->autocfg.speaker_pins[0] = 0x1b;
18168 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18170 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18172 unsigned int present;
18173 unsigned char bits;
18175 present = snd_hda_jack_detect(codec, 0x21);
18176 bits = present ? HDA_AMP_MUTE : 0;
18177 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18178 HDA_AMP_MUTE, bits);
18179 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18180 HDA_AMP_MUTE, bits);
18183 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18185 unsigned int present;
18186 unsigned char bits;
18188 present = snd_hda_jack_detect(codec, 0x21);
18189 bits = present ? HDA_AMP_MUTE : 0;
18190 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18191 HDA_AMP_MUTE, bits);
18192 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18193 HDA_AMP_MUTE, bits);
18194 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18195 HDA_AMP_MUTE, bits);
18196 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18197 HDA_AMP_MUTE, bits);
18200 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18202 unsigned int present;
18203 unsigned char bits;
18205 present = snd_hda_jack_detect(codec, 0x15);
18206 bits = present ? HDA_AMP_MUTE : 0;
18207 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18208 HDA_AMP_MUTE, bits);
18209 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18210 HDA_AMP_MUTE, bits);
18211 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18212 HDA_AMP_MUTE, bits);
18213 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18214 HDA_AMP_MUTE, bits);
18217 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18219 unsigned int present;
18220 unsigned char bits;
18222 present = snd_hda_jack_detect(codec, 0x1b);
18223 bits = present ? 0 : PIN_OUT;
18224 snd_hda_codec_write(codec, 0x14, 0,
18225 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18228 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18230 unsigned int present1, present2;
18232 present1 = snd_hda_jack_detect(codec, 0x21);
18233 present2 = snd_hda_jack_detect(codec, 0x15);
18235 if (present1 || present2) {
18236 snd_hda_codec_write_cache(codec, 0x14, 0,
18237 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18239 snd_hda_codec_write_cache(codec, 0x14, 0,
18240 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18244 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18246 unsigned int present1, present2;
18248 present1 = snd_hda_jack_detect(codec, 0x1b);
18249 present2 = snd_hda_jack_detect(codec, 0x15);
18251 if (present1 || present2) {
18252 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18253 HDA_AMP_MUTE, HDA_AMP_MUTE);
18254 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18255 HDA_AMP_MUTE, HDA_AMP_MUTE);
18257 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18259 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18264 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18266 unsigned int present1, present2;
18268 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18269 AC_VERB_GET_PIN_SENSE, 0)
18270 & AC_PINSENSE_PRESENCE;
18271 present2 = snd_hda_codec_read(codec, 0x21, 0,
18272 AC_VERB_GET_PIN_SENSE, 0)
18273 & AC_PINSENSE_PRESENCE;
18275 if (present1 || present2) {
18276 snd_hda_codec_write_cache(codec, 0x14, 0,
18277 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18278 snd_hda_codec_write_cache(codec, 0x17, 0,
18279 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18281 snd_hda_codec_write_cache(codec, 0x14, 0,
18282 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18283 snd_hda_codec_write_cache(codec, 0x17, 0,
18284 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18288 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18290 unsigned int present1, present2;
18292 present1 = snd_hda_codec_read(codec, 0x21, 0,
18293 AC_VERB_GET_PIN_SENSE, 0)
18294 & AC_PINSENSE_PRESENCE;
18295 present2 = snd_hda_codec_read(codec, 0x15, 0,
18296 AC_VERB_GET_PIN_SENSE, 0)
18297 & AC_PINSENSE_PRESENCE;
18299 if (present1 || present2) {
18300 snd_hda_codec_write_cache(codec, 0x14, 0,
18301 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18302 snd_hda_codec_write_cache(codec, 0x17, 0,
18303 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18305 snd_hda_codec_write_cache(codec, 0x14, 0,
18306 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18307 snd_hda_codec_write_cache(codec, 0x17, 0,
18308 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18312 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18315 switch (res >> 26) {
18316 case ALC880_HP_EVENT:
18317 alc663_m51va_speaker_automute(codec);
18319 case ALC880_MIC_EVENT:
18320 alc_mic_automute(codec);
18325 static void alc663_m51va_setup(struct hda_codec *codec)
18327 struct alc_spec *spec = codec->spec;
18328 spec->ext_mic.pin = 0x18;
18329 spec->ext_mic.mux_idx = 0;
18330 spec->int_mic.pin = 0x12;
18331 spec->int_mic.mux_idx = 9;
18332 spec->auto_mic = 1;
18335 static void alc663_m51va_inithook(struct hda_codec *codec)
18337 alc663_m51va_speaker_automute(codec);
18338 alc_mic_automute(codec);
18341 /* ***************** Mode1 ******************************/
18342 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18344 static void alc663_mode1_setup(struct hda_codec *codec)
18346 struct alc_spec *spec = codec->spec;
18347 spec->ext_mic.pin = 0x18;
18348 spec->ext_mic.mux_idx = 0;
18349 spec->int_mic.pin = 0x19;
18350 spec->int_mic.mux_idx = 1;
18351 spec->auto_mic = 1;
18354 #define alc663_mode1_inithook alc663_m51va_inithook
18356 /* ***************** Mode2 ******************************/
18357 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18360 switch (res >> 26) {
18361 case ALC880_HP_EVENT:
18362 alc662_f5z_speaker_automute(codec);
18364 case ALC880_MIC_EVENT:
18365 alc_mic_automute(codec);
18370 #define alc662_mode2_setup alc663_mode1_setup
18372 static void alc662_mode2_inithook(struct hda_codec *codec)
18374 alc662_f5z_speaker_automute(codec);
18375 alc_mic_automute(codec);
18377 /* ***************** Mode3 ******************************/
18378 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18381 switch (res >> 26) {
18382 case ALC880_HP_EVENT:
18383 alc663_two_hp_m1_speaker_automute(codec);
18385 case ALC880_MIC_EVENT:
18386 alc_mic_automute(codec);
18391 #define alc663_mode3_setup alc663_mode1_setup
18393 static void alc663_mode3_inithook(struct hda_codec *codec)
18395 alc663_two_hp_m1_speaker_automute(codec);
18396 alc_mic_automute(codec);
18398 /* ***************** Mode4 ******************************/
18399 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18402 switch (res >> 26) {
18403 case ALC880_HP_EVENT:
18404 alc663_21jd_two_speaker_automute(codec);
18406 case ALC880_MIC_EVENT:
18407 alc_mic_automute(codec);
18412 #define alc663_mode4_setup alc663_mode1_setup
18414 static void alc663_mode4_inithook(struct hda_codec *codec)
18416 alc663_21jd_two_speaker_automute(codec);
18417 alc_mic_automute(codec);
18419 /* ***************** Mode5 ******************************/
18420 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18423 switch (res >> 26) {
18424 case ALC880_HP_EVENT:
18425 alc663_15jd_two_speaker_automute(codec);
18427 case ALC880_MIC_EVENT:
18428 alc_mic_automute(codec);
18433 #define alc663_mode5_setup alc663_mode1_setup
18435 static void alc663_mode5_inithook(struct hda_codec *codec)
18437 alc663_15jd_two_speaker_automute(codec);
18438 alc_mic_automute(codec);
18440 /* ***************** Mode6 ******************************/
18441 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18444 switch (res >> 26) {
18445 case ALC880_HP_EVENT:
18446 alc663_two_hp_m2_speaker_automute(codec);
18448 case ALC880_MIC_EVENT:
18449 alc_mic_automute(codec);
18454 #define alc663_mode6_setup alc663_mode1_setup
18456 static void alc663_mode6_inithook(struct hda_codec *codec)
18458 alc663_two_hp_m2_speaker_automute(codec);
18459 alc_mic_automute(codec);
18462 /* ***************** Mode7 ******************************/
18463 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18466 switch (res >> 26) {
18467 case ALC880_HP_EVENT:
18468 alc663_two_hp_m7_speaker_automute(codec);
18470 case ALC880_MIC_EVENT:
18471 alc_mic_automute(codec);
18476 #define alc663_mode7_setup alc663_mode1_setup
18478 static void alc663_mode7_inithook(struct hda_codec *codec)
18480 alc663_two_hp_m7_speaker_automute(codec);
18481 alc_mic_automute(codec);
18484 /* ***************** Mode8 ******************************/
18485 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18488 switch (res >> 26) {
18489 case ALC880_HP_EVENT:
18490 alc663_two_hp_m8_speaker_automute(codec);
18492 case ALC880_MIC_EVENT:
18493 alc_mic_automute(codec);
18498 #define alc663_mode8_setup alc663_m51va_setup
18500 static void alc663_mode8_inithook(struct hda_codec *codec)
18502 alc663_two_hp_m8_speaker_automute(codec);
18503 alc_mic_automute(codec);
18506 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18508 unsigned int present;
18509 unsigned char bits;
18511 present = snd_hda_jack_detect(codec, 0x21);
18512 bits = present ? HDA_AMP_MUTE : 0;
18513 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18514 HDA_AMP_MUTE, bits);
18515 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18516 HDA_AMP_MUTE, bits);
18519 static void alc663_g71v_front_automute(struct hda_codec *codec)
18521 unsigned int present;
18522 unsigned char bits;
18524 present = snd_hda_jack_detect(codec, 0x15);
18525 bits = present ? HDA_AMP_MUTE : 0;
18526 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18527 HDA_AMP_MUTE, bits);
18530 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18533 switch (res >> 26) {
18534 case ALC880_HP_EVENT:
18535 alc663_g71v_hp_automute(codec);
18537 case ALC880_FRONT_EVENT:
18538 alc663_g71v_front_automute(codec);
18540 case ALC880_MIC_EVENT:
18541 alc_mic_automute(codec);
18546 #define alc663_g71v_setup alc663_m51va_setup
18548 static void alc663_g71v_inithook(struct hda_codec *codec)
18550 alc663_g71v_front_automute(codec);
18551 alc663_g71v_hp_automute(codec);
18552 alc_mic_automute(codec);
18555 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18558 switch (res >> 26) {
18559 case ALC880_HP_EVENT:
18560 alc663_m51va_speaker_automute(codec);
18562 case ALC880_MIC_EVENT:
18563 alc_mic_automute(codec);
18568 #define alc663_g50v_setup alc663_m51va_setup
18570 static void alc663_g50v_inithook(struct hda_codec *codec)
18572 alc663_m51va_speaker_automute(codec);
18573 alc_mic_automute(codec);
18576 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18577 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18578 ALC262_HIPPO_MASTER_SWITCH,
18580 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18581 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18582 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18584 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18585 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18586 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18590 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18591 /* Master Playback automatically created from Speaker and Headphone */
18592 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18593 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18594 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18595 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18597 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18598 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18599 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18601 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18602 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18603 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18607 #ifdef CONFIG_SND_HDA_POWER_SAVE
18608 #define alc662_loopbacks alc880_loopbacks
18612 /* pcm configuration: identical with ALC880 */
18613 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18614 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18615 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18616 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18619 * configuration and preset
18621 static const char *alc662_models[ALC662_MODEL_LAST] = {
18622 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18623 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18624 [ALC662_3ST_6ch] = "3stack-6ch",
18625 [ALC662_5ST_DIG] = "6stack-dig",
18626 [ALC662_LENOVO_101E] = "lenovo-101e",
18627 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18628 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18629 [ALC662_ECS] = "ecs",
18630 [ALC663_ASUS_M51VA] = "m51va",
18631 [ALC663_ASUS_G71V] = "g71v",
18632 [ALC663_ASUS_H13] = "h13",
18633 [ALC663_ASUS_G50V] = "g50v",
18634 [ALC663_ASUS_MODE1] = "asus-mode1",
18635 [ALC662_ASUS_MODE2] = "asus-mode2",
18636 [ALC663_ASUS_MODE3] = "asus-mode3",
18637 [ALC663_ASUS_MODE4] = "asus-mode4",
18638 [ALC663_ASUS_MODE5] = "asus-mode5",
18639 [ALC663_ASUS_MODE6] = "asus-mode6",
18640 [ALC663_ASUS_MODE7] = "asus-mode7",
18641 [ALC663_ASUS_MODE8] = "asus-mode8",
18642 [ALC272_DELL] = "dell",
18643 [ALC272_DELL_ZM1] = "dell-zm1",
18644 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18645 [ALC662_AUTO] = "auto",
18648 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18649 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18650 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18651 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18652 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18653 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18654 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18655 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18656 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18657 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18658 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18659 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18660 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18661 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18662 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18663 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18664 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18665 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18666 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18667 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18668 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18669 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18670 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18671 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18672 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18673 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18674 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18675 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18676 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18677 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18678 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18679 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18680 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18681 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18682 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18683 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18684 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18685 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18686 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18687 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18688 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18689 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18690 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18691 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18692 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18693 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18694 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18695 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18696 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18697 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18698 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18699 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18700 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18701 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18702 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18703 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18704 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18705 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18706 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18707 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18708 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18709 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18710 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18711 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18712 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18713 ALC662_3ST_6ch_DIG),
18714 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18715 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18716 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18717 ALC662_3ST_6ch_DIG),
18718 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18719 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18720 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18721 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18722 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18723 ALC662_3ST_6ch_DIG),
18724 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18729 static struct alc_config_preset alc662_presets[] = {
18730 [ALC662_3ST_2ch_DIG] = {
18731 .mixers = { alc662_3ST_2ch_mixer },
18732 .init_verbs = { alc662_init_verbs },
18733 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18734 .dac_nids = alc662_dac_nids,
18735 .dig_out_nid = ALC662_DIGOUT_NID,
18736 .dig_in_nid = ALC662_DIGIN_NID,
18737 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18738 .channel_mode = alc662_3ST_2ch_modes,
18739 .input_mux = &alc662_capture_source,
18741 [ALC662_3ST_6ch_DIG] = {
18742 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18743 .init_verbs = { alc662_init_verbs },
18744 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18745 .dac_nids = alc662_dac_nids,
18746 .dig_out_nid = ALC662_DIGOUT_NID,
18747 .dig_in_nid = ALC662_DIGIN_NID,
18748 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18749 .channel_mode = alc662_3ST_6ch_modes,
18751 .input_mux = &alc662_capture_source,
18753 [ALC662_3ST_6ch] = {
18754 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18755 .init_verbs = { alc662_init_verbs },
18756 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18757 .dac_nids = alc662_dac_nids,
18758 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18759 .channel_mode = alc662_3ST_6ch_modes,
18761 .input_mux = &alc662_capture_source,
18763 [ALC662_5ST_DIG] = {
18764 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18765 .init_verbs = { alc662_init_verbs },
18766 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18767 .dac_nids = alc662_dac_nids,
18768 .dig_out_nid = ALC662_DIGOUT_NID,
18769 .dig_in_nid = ALC662_DIGIN_NID,
18770 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18771 .channel_mode = alc662_5stack_modes,
18772 .input_mux = &alc662_capture_source,
18774 [ALC662_LENOVO_101E] = {
18775 .mixers = { alc662_lenovo_101e_mixer },
18776 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18777 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18778 .dac_nids = alc662_dac_nids,
18779 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18780 .channel_mode = alc662_3ST_2ch_modes,
18781 .input_mux = &alc662_lenovo_101e_capture_source,
18782 .unsol_event = alc662_lenovo_101e_unsol_event,
18783 .init_hook = alc662_lenovo_101e_all_automute,
18785 [ALC662_ASUS_EEEPC_P701] = {
18786 .mixers = { alc662_eeepc_p701_mixer },
18787 .init_verbs = { alc662_init_verbs,
18788 alc662_eeepc_sue_init_verbs },
18789 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18790 .dac_nids = alc662_dac_nids,
18791 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18792 .channel_mode = alc662_3ST_2ch_modes,
18793 .unsol_event = alc662_eeepc_unsol_event,
18794 .setup = alc662_eeepc_setup,
18795 .init_hook = alc662_eeepc_inithook,
18797 [ALC662_ASUS_EEEPC_EP20] = {
18798 .mixers = { alc662_eeepc_ep20_mixer,
18799 alc662_chmode_mixer },
18800 .init_verbs = { alc662_init_verbs,
18801 alc662_eeepc_ep20_sue_init_verbs },
18802 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18803 .dac_nids = alc662_dac_nids,
18804 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18805 .channel_mode = alc662_3ST_6ch_modes,
18806 .input_mux = &alc662_lenovo_101e_capture_source,
18807 .unsol_event = alc662_eeepc_unsol_event,
18808 .setup = alc662_eeepc_ep20_setup,
18809 .init_hook = alc662_eeepc_ep20_inithook,
18812 .mixers = { alc662_ecs_mixer },
18813 .init_verbs = { alc662_init_verbs,
18814 alc662_ecs_init_verbs },
18815 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18816 .dac_nids = alc662_dac_nids,
18817 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18818 .channel_mode = alc662_3ST_2ch_modes,
18819 .unsol_event = alc662_eeepc_unsol_event,
18820 .setup = alc662_eeepc_setup,
18821 .init_hook = alc662_eeepc_inithook,
18823 [ALC663_ASUS_M51VA] = {
18824 .mixers = { alc663_m51va_mixer },
18825 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18826 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18827 .dac_nids = alc662_dac_nids,
18828 .dig_out_nid = ALC662_DIGOUT_NID,
18829 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18830 .channel_mode = alc662_3ST_2ch_modes,
18831 .unsol_event = alc663_m51va_unsol_event,
18832 .setup = alc663_m51va_setup,
18833 .init_hook = alc663_m51va_inithook,
18835 [ALC663_ASUS_G71V] = {
18836 .mixers = { alc663_g71v_mixer },
18837 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18838 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18839 .dac_nids = alc662_dac_nids,
18840 .dig_out_nid = ALC662_DIGOUT_NID,
18841 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18842 .channel_mode = alc662_3ST_2ch_modes,
18843 .unsol_event = alc663_g71v_unsol_event,
18844 .setup = alc663_g71v_setup,
18845 .init_hook = alc663_g71v_inithook,
18847 [ALC663_ASUS_H13] = {
18848 .mixers = { alc663_m51va_mixer },
18849 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18850 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18851 .dac_nids = alc662_dac_nids,
18852 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18853 .channel_mode = alc662_3ST_2ch_modes,
18854 .unsol_event = alc663_m51va_unsol_event,
18855 .init_hook = alc663_m51va_inithook,
18857 [ALC663_ASUS_G50V] = {
18858 .mixers = { alc663_g50v_mixer },
18859 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18860 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18861 .dac_nids = alc662_dac_nids,
18862 .dig_out_nid = ALC662_DIGOUT_NID,
18863 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18864 .channel_mode = alc662_3ST_6ch_modes,
18865 .input_mux = &alc663_capture_source,
18866 .unsol_event = alc663_g50v_unsol_event,
18867 .setup = alc663_g50v_setup,
18868 .init_hook = alc663_g50v_inithook,
18870 [ALC663_ASUS_MODE1] = {
18871 .mixers = { alc663_m51va_mixer },
18872 .cap_mixer = alc662_auto_capture_mixer,
18873 .init_verbs = { alc662_init_verbs,
18874 alc663_21jd_amic_init_verbs },
18875 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18877 .dac_nids = alc662_dac_nids,
18878 .dig_out_nid = ALC662_DIGOUT_NID,
18879 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18880 .channel_mode = alc662_3ST_2ch_modes,
18881 .unsol_event = alc663_mode1_unsol_event,
18882 .setup = alc663_mode1_setup,
18883 .init_hook = alc663_mode1_inithook,
18885 [ALC662_ASUS_MODE2] = {
18886 .mixers = { alc662_1bjd_mixer },
18887 .cap_mixer = alc662_auto_capture_mixer,
18888 .init_verbs = { alc662_init_verbs,
18889 alc662_1bjd_amic_init_verbs },
18890 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18891 .dac_nids = alc662_dac_nids,
18892 .dig_out_nid = ALC662_DIGOUT_NID,
18893 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18894 .channel_mode = alc662_3ST_2ch_modes,
18895 .unsol_event = alc662_mode2_unsol_event,
18896 .setup = alc662_mode2_setup,
18897 .init_hook = alc662_mode2_inithook,
18899 [ALC663_ASUS_MODE3] = {
18900 .mixers = { alc663_two_hp_m1_mixer },
18901 .cap_mixer = alc662_auto_capture_mixer,
18902 .init_verbs = { alc662_init_verbs,
18903 alc663_two_hp_amic_m1_init_verbs },
18904 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18906 .dac_nids = alc662_dac_nids,
18907 .dig_out_nid = ALC662_DIGOUT_NID,
18908 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18909 .channel_mode = alc662_3ST_2ch_modes,
18910 .unsol_event = alc663_mode3_unsol_event,
18911 .setup = alc663_mode3_setup,
18912 .init_hook = alc663_mode3_inithook,
18914 [ALC663_ASUS_MODE4] = {
18915 .mixers = { alc663_asus_21jd_clfe_mixer },
18916 .cap_mixer = alc662_auto_capture_mixer,
18917 .init_verbs = { alc662_init_verbs,
18918 alc663_21jd_amic_init_verbs},
18919 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18921 .dac_nids = alc662_dac_nids,
18922 .dig_out_nid = ALC662_DIGOUT_NID,
18923 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18924 .channel_mode = alc662_3ST_2ch_modes,
18925 .unsol_event = alc663_mode4_unsol_event,
18926 .setup = alc663_mode4_setup,
18927 .init_hook = alc663_mode4_inithook,
18929 [ALC663_ASUS_MODE5] = {
18930 .mixers = { alc663_asus_15jd_clfe_mixer },
18931 .cap_mixer = alc662_auto_capture_mixer,
18932 .init_verbs = { alc662_init_verbs,
18933 alc663_15jd_amic_init_verbs },
18934 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18936 .dac_nids = alc662_dac_nids,
18937 .dig_out_nid = ALC662_DIGOUT_NID,
18938 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18939 .channel_mode = alc662_3ST_2ch_modes,
18940 .unsol_event = alc663_mode5_unsol_event,
18941 .setup = alc663_mode5_setup,
18942 .init_hook = alc663_mode5_inithook,
18944 [ALC663_ASUS_MODE6] = {
18945 .mixers = { alc663_two_hp_m2_mixer },
18946 .cap_mixer = alc662_auto_capture_mixer,
18947 .init_verbs = { alc662_init_verbs,
18948 alc663_two_hp_amic_m2_init_verbs },
18949 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18951 .dac_nids = alc662_dac_nids,
18952 .dig_out_nid = ALC662_DIGOUT_NID,
18953 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18954 .channel_mode = alc662_3ST_2ch_modes,
18955 .unsol_event = alc663_mode6_unsol_event,
18956 .setup = alc663_mode6_setup,
18957 .init_hook = alc663_mode6_inithook,
18959 [ALC663_ASUS_MODE7] = {
18960 .mixers = { alc663_mode7_mixer },
18961 .cap_mixer = alc662_auto_capture_mixer,
18962 .init_verbs = { alc662_init_verbs,
18963 alc663_mode7_init_verbs },
18964 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18966 .dac_nids = alc662_dac_nids,
18967 .dig_out_nid = ALC662_DIGOUT_NID,
18968 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18969 .channel_mode = alc662_3ST_2ch_modes,
18970 .unsol_event = alc663_mode7_unsol_event,
18971 .setup = alc663_mode7_setup,
18972 .init_hook = alc663_mode7_inithook,
18974 [ALC663_ASUS_MODE8] = {
18975 .mixers = { alc663_mode8_mixer },
18976 .cap_mixer = alc662_auto_capture_mixer,
18977 .init_verbs = { alc662_init_verbs,
18978 alc663_mode8_init_verbs },
18979 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18981 .dac_nids = alc662_dac_nids,
18982 .dig_out_nid = ALC662_DIGOUT_NID,
18983 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18984 .channel_mode = alc662_3ST_2ch_modes,
18985 .unsol_event = alc663_mode8_unsol_event,
18986 .setup = alc663_mode8_setup,
18987 .init_hook = alc663_mode8_inithook,
18990 .mixers = { alc663_m51va_mixer },
18991 .cap_mixer = alc272_auto_capture_mixer,
18992 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18993 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18994 .dac_nids = alc662_dac_nids,
18995 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18996 .adc_nids = alc272_adc_nids,
18997 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18998 .capsrc_nids = alc272_capsrc_nids,
18999 .channel_mode = alc662_3ST_2ch_modes,
19000 .unsol_event = alc663_m51va_unsol_event,
19001 .setup = alc663_m51va_setup,
19002 .init_hook = alc663_m51va_inithook,
19004 [ALC272_DELL_ZM1] = {
19005 .mixers = { alc663_m51va_mixer },
19006 .cap_mixer = alc662_auto_capture_mixer,
19007 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
19008 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19009 .dac_nids = alc662_dac_nids,
19010 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19011 .adc_nids = alc662_adc_nids,
19013 .capsrc_nids = alc662_capsrc_nids,
19014 .channel_mode = alc662_3ST_2ch_modes,
19015 .unsol_event = alc663_m51va_unsol_event,
19016 .setup = alc663_m51va_setup,
19017 .init_hook = alc663_m51va_inithook,
19019 [ALC272_SAMSUNG_NC10] = {
19020 .mixers = { alc272_nc10_mixer },
19021 .init_verbs = { alc662_init_verbs,
19022 alc663_21jd_amic_init_verbs },
19023 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19024 .dac_nids = alc272_dac_nids,
19025 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19026 .channel_mode = alc662_3ST_2ch_modes,
19027 /*.input_mux = &alc272_nc10_capture_source,*/
19028 .unsol_event = alc663_mode4_unsol_event,
19029 .setup = alc663_mode4_setup,
19030 .init_hook = alc663_mode4_inithook,
19036 * BIOS auto configuration
19039 /* convert from MIX nid to DAC */
19040 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19044 else if (nid >= 0x0c && nid <= 0x0e)
19045 return nid - 0x0c + 0x02;
19046 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19052 /* get MIX nid connected to the given pin targeted to DAC */
19053 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19059 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19060 for (i = 0; i < num; i++) {
19061 if (alc662_mix_to_dac(mix[i]) == dac)
19067 /* look for an empty DAC slot */
19068 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19070 struct alc_spec *spec = codec->spec;
19074 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19077 for (i = 0; i < num; i++) {
19078 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19081 for (j = 0; j < spec->multiout.num_dacs; j++)
19082 if (spec->multiout.dac_nids[j] == nid)
19084 if (j >= spec->multiout.num_dacs)
19090 /* fill in the dac_nids table from the parsed pin configuration */
19091 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19092 const struct auto_pin_cfg *cfg)
19094 struct alc_spec *spec = codec->spec;
19098 spec->multiout.dac_nids = spec->private_dac_nids;
19099 for (i = 0; i < cfg->line_outs; i++) {
19100 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19103 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19108 static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19109 hda_nid_t nid, int idx, unsigned int chs)
19111 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx,
19112 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19115 static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19116 hda_nid_t nid, int idx, unsigned int chs)
19118 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
19119 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19122 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19123 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19124 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19125 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19126 #define alc662_add_stereo_vol(spec, pfx, nid) \
19127 alc662_add_vol_ctl(spec, pfx, nid, 3)
19128 #define alc662_add_stereo_sw(spec, pfx, nid) \
19129 alc662_add_sw_ctl(spec, pfx, nid, 3)
19131 /* add playback controls from the parsed DAC table */
19132 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19133 const struct auto_pin_cfg *cfg)
19135 struct alc_spec *spec = codec->spec;
19136 static const char *chname[4] = {
19137 "Front", "Surround", NULL /*CLFE*/, "Side"
19139 const char *pfx = alc_get_line_out_pfx(cfg, true);
19140 hda_nid_t nid, mix;
19143 for (i = 0; i < cfg->line_outs; i++) {
19144 nid = spec->multiout.dac_nids[i];
19147 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19150 if (!pfx && i == 2) {
19152 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19155 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19158 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19161 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19165 const char *name = pfx;
19168 err = __alc662_add_vol_ctl(spec, name, nid, i, 3);
19171 err = __alc662_add_sw_ctl(spec, name, mix, i, 3);
19179 /* add playback controls for speaker and HP outputs */
19180 /* return DAC nid if any new DAC is assigned */
19181 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19184 struct alc_spec *spec = codec->spec;
19185 hda_nid_t nid, mix;
19190 nid = alc662_look_for_dac(codec, pin);
19192 /* the corresponding DAC is already occupied */
19193 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19194 return 0; /* no way */
19195 /* create a switch only */
19196 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19197 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19200 mix = alc662_dac_to_mix(codec, pin, nid);
19203 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19206 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19212 /* create playback/capture controls for input pins */
19213 #define alc662_auto_create_input_ctls \
19214 alc882_auto_create_input_ctls
19216 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19217 hda_nid_t nid, int pin_type,
19221 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19223 alc_set_pin_output(codec, nid, pin_type);
19224 /* need the manual connection? */
19225 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19228 for (i = 0; i < num; i++) {
19229 if (alc662_mix_to_dac(srcs[i]) != dac)
19231 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19236 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19238 struct alc_spec *spec = codec->spec;
19239 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19242 for (i = 0; i <= HDA_SIDE; i++) {
19243 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19245 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19246 spec->multiout.dac_nids[i]);
19250 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19252 struct alc_spec *spec = codec->spec;
19255 pin = spec->autocfg.hp_pins[0];
19257 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19258 spec->multiout.hp_nid);
19259 pin = spec->autocfg.speaker_pins[0];
19261 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19262 spec->multiout.extra_out_nid[0]);
19265 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19267 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19269 struct alc_spec *spec = codec->spec;
19270 struct auto_pin_cfg *cfg = &spec->autocfg;
19273 for (i = 0; i < cfg->num_inputs; i++) {
19274 hda_nid_t nid = cfg->inputs[i].pin;
19275 if (alc_is_input_pin(codec, nid)) {
19276 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19277 if (nid != ALC662_PIN_CD_NID &&
19278 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19279 snd_hda_codec_write(codec, nid, 0,
19280 AC_VERB_SET_AMP_GAIN_MUTE,
19286 #define alc662_auto_init_input_src alc882_auto_init_input_src
19288 static int alc662_parse_auto_config(struct hda_codec *codec)
19290 struct alc_spec *spec = codec->spec;
19292 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19294 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19298 if (!spec->autocfg.line_outs)
19299 return 0; /* can't find valid BIOS pin config */
19301 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19304 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19307 err = alc662_auto_create_extra_out(codec,
19308 spec->autocfg.speaker_pins[0],
19313 spec->multiout.extra_out_nid[0] = err;
19314 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19319 spec->multiout.hp_nid = err;
19320 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19324 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19326 alc_auto_parse_digital(codec);
19328 if (spec->kctls.list)
19329 add_mixer(spec, spec->kctls.list);
19331 spec->num_mux_defs = 1;
19332 spec->input_mux = &spec->private_imux[0];
19334 add_verb(spec, alc662_init_verbs);
19335 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19336 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19337 add_verb(spec, alc663_init_verbs);
19339 if (codec->vendor_id == 0x10ec0272)
19340 add_verb(spec, alc272_init_verbs);
19342 err = alc_auto_add_mic_boost(codec);
19346 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19347 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19348 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19350 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19355 /* additional initialization for auto-configuration model */
19356 static void alc662_auto_init(struct hda_codec *codec)
19358 struct alc_spec *spec = codec->spec;
19359 alc662_auto_init_multi_out(codec);
19360 alc662_auto_init_hp_out(codec);
19361 alc662_auto_init_analog_input(codec);
19362 alc662_auto_init_input_src(codec);
19363 alc_auto_init_digital(codec);
19364 if (spec->unsol_event)
19365 alc_inithook(codec);
19368 static void alc272_fixup_mario(struct hda_codec *codec,
19369 const struct alc_fixup *fix, int pre_init) {
19370 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19371 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19372 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19373 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19374 (0 << AC_AMPCAP_MUTE_SHIFT)))
19375 printk(KERN_WARNING
19376 "hda_codec: failed to override amp caps for NID 0x2\n");
19380 ALC662_FIXUP_ASPIRE,
19381 ALC662_FIXUP_IDEAPAD,
19382 ALC272_FIXUP_MARIO,
19385 static const struct alc_fixup alc662_fixups[] = {
19386 [ALC662_FIXUP_ASPIRE] = {
19387 .pins = (const struct alc_pincfg[]) {
19388 { 0x15, 0x99130112 }, /* subwoofer */
19392 [ALC662_FIXUP_IDEAPAD] = {
19393 .pins = (const struct alc_pincfg[]) {
19394 { 0x17, 0x99130112 }, /* subwoofer */
19398 [ALC272_FIXUP_MARIO] = {
19399 .func = alc272_fixup_mario,
19403 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19404 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19405 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19406 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19407 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19411 static const struct alc_model_fixup alc662_fixup_models[] = {
19412 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19417 static int patch_alc662(struct hda_codec *codec)
19419 struct alc_spec *spec;
19420 int err, board_config;
19423 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19427 codec->spec = spec;
19429 alc_auto_parse_customize_define(codec);
19431 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19433 coef = alc_read_coef_idx(codec, 0);
19434 if (coef == 0x8020 || coef == 0x8011)
19435 alc_codec_rename(codec, "ALC661");
19436 else if (coef & (1 << 14) &&
19437 codec->bus->pci->subsystem_vendor == 0x1025 &&
19438 spec->cdefine.platform_type == 1)
19439 alc_codec_rename(codec, "ALC272X");
19440 else if (coef == 0x4011)
19441 alc_codec_rename(codec, "ALC656");
19443 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19446 if (board_config < 0) {
19447 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19449 board_config = ALC662_AUTO;
19452 if (board_config == ALC662_AUTO) {
19453 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1);
19454 /* automatic parse from the BIOS config */
19455 err = alc662_parse_auto_config(codec);
19461 "hda_codec: Cannot set up configuration "
19462 "from BIOS. Using base mode...\n");
19463 board_config = ALC662_3ST_2ch_DIG;
19467 if (has_cdefine_beep(codec)) {
19468 err = snd_hda_attach_beep_device(codec, 0x1);
19475 if (board_config != ALC662_AUTO)
19476 setup_preset(codec, &alc662_presets[board_config]);
19478 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19479 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19481 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19482 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19484 if (!spec->adc_nids) {
19485 spec->adc_nids = alc662_adc_nids;
19486 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19488 if (!spec->capsrc_nids)
19489 spec->capsrc_nids = alc662_capsrc_nids;
19491 if (!spec->cap_mixer)
19492 set_capture_mixer(codec);
19494 if (has_cdefine_beep(codec)) {
19495 switch (codec->vendor_id) {
19497 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19502 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19505 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19509 spec->vmaster_nid = 0x02;
19511 codec->patch_ops = alc_patch_ops;
19512 if (board_config == ALC662_AUTO) {
19513 spec->init_hook = alc662_auto_init;
19514 alc_pick_fixup_model(codec, alc662_fixup_models,
19515 alc662_fixup_tbl, alc662_fixups, 0);
19518 alc_init_jacks(codec);
19520 #ifdef CONFIG_SND_HDA_POWER_SAVE
19521 if (!spec->loopback.amplist)
19522 spec->loopback.amplist = alc662_loopbacks;
19528 static int patch_alc888(struct hda_codec *codec)
19530 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19531 kfree(codec->chip_name);
19532 if (codec->vendor_id == 0x10ec0887)
19533 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19535 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19536 if (!codec->chip_name) {
19540 return patch_alc662(codec);
19542 return patch_alc882(codec);
19548 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19549 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19550 #define alc680_modes alc260_modes
19552 static hda_nid_t alc680_dac_nids[3] = {
19553 /* Lout1, Lout2, hp */
19557 static hda_nid_t alc680_adc_nids[3] = {
19559 /* DMIC, MIC, Line-in*/
19564 * Analog capture ADC cgange
19566 static void alc680_rec_autoswitch(struct hda_codec *codec)
19568 struct alc_spec *spec = codec->spec;
19569 struct auto_pin_cfg *cfg = &spec->autocfg;
19571 int type_found = AUTO_PIN_LAST;
19575 for (i = 0; i < cfg->num_inputs; i++) {
19576 nid = cfg->inputs[i].pin;
19577 if (!(snd_hda_query_pin_caps(codec, nid) &
19578 AC_PINCAP_PRES_DETECT))
19580 if (snd_hda_jack_detect(codec, nid)) {
19581 if (cfg->inputs[i].type < type_found) {
19582 type_found = cfg->inputs[i].type;
19590 snd_hda_get_connections(codec, pin_found, &nid, 1);
19592 if (nid != spec->cur_adc)
19593 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19594 spec->cur_adc = nid;
19595 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19596 spec->cur_adc_format);
19599 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19600 struct hda_codec *codec,
19601 unsigned int stream_tag,
19602 unsigned int format,
19603 struct snd_pcm_substream *substream)
19605 struct alc_spec *spec = codec->spec;
19607 spec->cur_adc = 0x07;
19608 spec->cur_adc_stream_tag = stream_tag;
19609 spec->cur_adc_format = format;
19611 alc680_rec_autoswitch(codec);
19615 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19616 struct hda_codec *codec,
19617 struct snd_pcm_substream *substream)
19619 snd_hda_codec_cleanup_stream(codec, 0x07);
19620 snd_hda_codec_cleanup_stream(codec, 0x08);
19621 snd_hda_codec_cleanup_stream(codec, 0x09);
19625 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19626 .substreams = 1, /* can be overridden */
19629 /* NID is set in alc_build_pcms */
19631 .prepare = alc680_capture_pcm_prepare,
19632 .cleanup = alc680_capture_pcm_cleanup
19636 static struct snd_kcontrol_new alc680_base_mixer[] = {
19637 /* output mixer control */
19638 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19639 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19640 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19641 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19642 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19643 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19644 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19648 static struct hda_bind_ctls alc680_bind_cap_vol = {
19649 .ops = &snd_hda_bind_vol,
19651 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19652 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19653 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19658 static struct hda_bind_ctls alc680_bind_cap_switch = {
19659 .ops = &snd_hda_bind_sw,
19661 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19662 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19663 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19668 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19669 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19670 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19675 * generic initialization of ADC, input mixers and output mixers
19677 static struct hda_verb alc680_init_verbs[] = {
19678 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19679 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19680 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19682 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19683 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19684 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19685 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19686 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19687 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19689 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19691 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19692 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19693 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19695 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19696 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19697 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19702 /* toggle speaker-output according to the hp-jack state */
19703 static void alc680_base_setup(struct hda_codec *codec)
19705 struct alc_spec *spec = codec->spec;
19707 spec->autocfg.hp_pins[0] = 0x16;
19708 spec->autocfg.speaker_pins[0] = 0x14;
19709 spec->autocfg.speaker_pins[1] = 0x15;
19710 spec->autocfg.num_inputs = 2;
19711 spec->autocfg.inputs[0].pin = 0x18;
19712 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19713 spec->autocfg.inputs[1].pin = 0x19;
19714 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19717 static void alc680_unsol_event(struct hda_codec *codec,
19720 if ((res >> 26) == ALC880_HP_EVENT)
19721 alc_automute_amp(codec);
19722 if ((res >> 26) == ALC880_MIC_EVENT)
19723 alc680_rec_autoswitch(codec);
19726 static void alc680_inithook(struct hda_codec *codec)
19728 alc_automute_amp(codec);
19729 alc680_rec_autoswitch(codec);
19732 /* create input playback/capture controls for the given pin */
19733 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19734 const char *ctlname, int idx)
19752 if (spec->multiout.dac_nids[0] != dac &&
19753 spec->multiout.dac_nids[1] != dac) {
19754 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19755 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19760 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19761 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19765 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19771 /* add playback controls from the parsed DAC table */
19772 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19773 const struct auto_pin_cfg *cfg)
19778 spec->multiout.dac_nids = spec->private_dac_nids;
19780 nid = cfg->line_out_pins[0];
19783 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19787 err = alc680_new_analog_output(spec, nid, name, 0);
19792 nid = cfg->speaker_pins[0];
19794 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19798 nid = cfg->hp_pins[0];
19800 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19808 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19809 hda_nid_t nid, int pin_type)
19811 alc_set_pin_output(codec, nid, pin_type);
19814 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19816 struct alc_spec *spec = codec->spec;
19817 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19819 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19820 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19824 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19826 struct alc_spec *spec = codec->spec;
19829 pin = spec->autocfg.hp_pins[0];
19831 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19832 pin = spec->autocfg.speaker_pins[0];
19834 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19837 /* pcm configuration: identical with ALC880 */
19838 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19839 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19840 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19841 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19842 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19845 * BIOS auto configuration
19847 static int alc680_parse_auto_config(struct hda_codec *codec)
19849 struct alc_spec *spec = codec->spec;
19851 static hda_nid_t alc680_ignore[] = { 0 };
19853 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19858 if (!spec->autocfg.line_outs) {
19859 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19860 spec->multiout.max_channels = 2;
19861 spec->no_analog = 1;
19864 return 0; /* can't find valid BIOS pin config */
19866 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19870 spec->multiout.max_channels = 2;
19873 /* digital only support output */
19874 alc_auto_parse_digital(codec);
19875 if (spec->kctls.list)
19876 add_mixer(spec, spec->kctls.list);
19878 add_verb(spec, alc680_init_verbs);
19880 err = alc_auto_add_mic_boost(codec);
19887 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19889 /* init callback for auto-configuration model -- overriding the default init */
19890 static void alc680_auto_init(struct hda_codec *codec)
19892 struct alc_spec *spec = codec->spec;
19893 alc680_auto_init_multi_out(codec);
19894 alc680_auto_init_hp_out(codec);
19895 alc680_auto_init_analog_input(codec);
19896 alc_auto_init_digital(codec);
19897 if (spec->unsol_event)
19898 alc_inithook(codec);
19902 * configuration and preset
19904 static const char *alc680_models[ALC680_MODEL_LAST] = {
19905 [ALC680_BASE] = "base",
19906 [ALC680_AUTO] = "auto",
19909 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19910 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19914 static struct alc_config_preset alc680_presets[] = {
19916 .mixers = { alc680_base_mixer },
19917 .cap_mixer = alc680_master_capture_mixer,
19918 .init_verbs = { alc680_init_verbs },
19919 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19920 .dac_nids = alc680_dac_nids,
19921 .dig_out_nid = ALC680_DIGOUT_NID,
19922 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19923 .channel_mode = alc680_modes,
19924 .unsol_event = alc680_unsol_event,
19925 .setup = alc680_base_setup,
19926 .init_hook = alc680_inithook,
19931 static int patch_alc680(struct hda_codec *codec)
19933 struct alc_spec *spec;
19937 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19941 codec->spec = spec;
19943 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19947 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19948 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19950 board_config = ALC680_AUTO;
19953 if (board_config == ALC680_AUTO) {
19954 /* automatic parse from the BIOS config */
19955 err = alc680_parse_auto_config(codec);
19961 "hda_codec: Cannot set up configuration "
19962 "from BIOS. Using base mode...\n");
19963 board_config = ALC680_BASE;
19967 if (board_config != ALC680_AUTO)
19968 setup_preset(codec, &alc680_presets[board_config]);
19970 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19971 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19972 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19973 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19975 if (!spec->adc_nids) {
19976 spec->adc_nids = alc680_adc_nids;
19977 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19980 if (!spec->cap_mixer)
19981 set_capture_mixer(codec);
19983 spec->vmaster_nid = 0x02;
19985 codec->patch_ops = alc_patch_ops;
19986 if (board_config == ALC680_AUTO)
19987 spec->init_hook = alc680_auto_init;
19995 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19996 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19997 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19998 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19999 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
20000 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
20001 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
20002 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
20003 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
20004 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
20005 .patch = patch_alc861 },
20006 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
20007 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
20008 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
20009 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
20010 .patch = patch_alc882 },
20011 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
20012 .patch = patch_alc662 },
20013 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
20014 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
20015 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
20016 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
20017 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
20018 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
20019 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
20020 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
20021 .patch = patch_alc882 },
20022 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
20023 .patch = patch_alc882 },
20024 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
20025 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
20026 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
20027 .patch = patch_alc882 },
20028 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20029 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20030 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20031 {} /* terminator */
20034 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20036 MODULE_LICENSE("GPL");
20037 MODULE_DESCRIPTION("Realtek HD-audio codec");
20039 static struct hda_codec_preset_list realtek_list = {
20040 .preset = snd_hda_preset_realtek,
20041 .owner = THIS_MODULE,
20044 static int __init patch_realtek_init(void)
20046 return snd_hda_add_codec_preset(&realtek_list);
20049 static void __exit patch_realtek_exit(void)
20051 snd_hda_delete_codec_preset(&realtek_list);
20054 module_init(patch_realtek_init)
20055 module_exit(patch_realtek_exit)