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,
235 ALC883_MEDION_WIM2160,
237 ALC883_LENOVO_101E_2ch,
238 ALC883_LENOVO_NB0763,
239 ALC888_LENOVO_MS7195_DIG,
247 ALC883_FUJITSU_PI2515,
248 ALC888_FUJITSU_XA3530,
249 ALC883_3ST_6ch_INTEL,
269 #define GPIO_MASK 0x03
271 /* extra amp-initialization sequence types */
280 struct alc_mic_route {
282 unsigned char mux_idx;
283 unsigned char amix_idx;
289 struct snd_jack *jack;
292 #define MUX_IDX_UNDEF ((unsigned char)-1)
294 struct alc_customize_define {
295 unsigned int sku_cfg;
296 unsigned char port_connectivity;
297 unsigned char check_sum;
298 unsigned char customization;
299 unsigned char external_amp;
300 unsigned int enable_pcbeep:1;
301 unsigned int platform_type:1;
303 unsigned int override:1;
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;
1090 err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE);
1093 alc_report_jack(codec, hp_nid);
1095 err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE);
1098 alc_report_jack(codec, mic_nid);
1103 static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1107 static inline int alc_init_jacks(struct hda_codec *codec)
1113 static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1115 struct alc_spec *spec = codec->spec;
1120 spec->jack_present = 0;
1121 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1122 nid = spec->autocfg.hp_pins[i];
1125 if (snd_hda_jack_detect(codec, nid)) {
1126 spec->jack_present = 1;
1129 alc_report_jack(codec, spec->autocfg.hp_pins[i]);
1132 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1133 /* Toggle internal speakers muting */
1134 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1135 nid = spec->autocfg.speaker_pins[i];
1139 snd_hda_codec_write(codec, nid, 0,
1140 AC_VERB_SET_PIN_WIDGET_CONTROL,
1141 spec->jack_present ? 0 : PIN_OUT);
1143 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1144 HDA_AMP_MUTE, mute);
1149 static void alc_automute_pin(struct hda_codec *codec)
1151 alc_automute_speaker(codec, 1);
1154 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1157 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1160 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1161 for (i = 0; i < nums; i++)
1167 /* switch the current ADC according to the jack state */
1168 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1170 struct alc_spec *spec = codec->spec;
1171 unsigned int present;
1174 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1176 spec->cur_adc_idx = 1;
1178 spec->cur_adc_idx = 0;
1179 new_adc = spec->adc_nids[spec->cur_adc_idx];
1180 if (spec->cur_adc && spec->cur_adc != new_adc) {
1181 /* stream is running, let's swap the current ADC */
1182 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1183 spec->cur_adc = new_adc;
1184 snd_hda_codec_setup_stream(codec, new_adc,
1185 spec->cur_adc_stream_tag, 0,
1186 spec->cur_adc_format);
1190 static void alc_mic_automute(struct hda_codec *codec)
1192 struct alc_spec *spec = codec->spec;
1193 struct alc_mic_route *dead, *alive;
1194 unsigned int present, type;
1197 if (!spec->auto_mic)
1199 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1201 if (snd_BUG_ON(!spec->adc_nids))
1204 if (spec->dual_adc_switch) {
1205 alc_dual_mic_adc_auto_switch(codec);
1209 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1211 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1213 alive = &spec->ext_mic;
1214 dead = &spec->int_mic;
1216 alive = &spec->int_mic;
1217 dead = &spec->ext_mic;
1220 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1221 if (type == AC_WID_AUD_MIX) {
1222 /* Matrix-mixer style (e.g. ALC882) */
1223 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1226 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1228 HDA_AMP_MUTE, HDA_AMP_MUTE);
1230 /* MUX style (e.g. ALC880) */
1231 snd_hda_codec_write_cache(codec, cap_nid, 0,
1232 AC_VERB_SET_CONNECT_SEL,
1235 alc_report_jack(codec, spec->ext_mic.pin);
1237 /* FIXME: analog mixer */
1240 /* unsolicited event for HP jack sensing */
1241 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1243 if (codec->vendor_id == 0x10ec0880)
1248 case ALC880_HP_EVENT:
1249 alc_automute_pin(codec);
1251 case ALC880_MIC_EVENT:
1252 alc_mic_automute(codec);
1257 static void alc_inithook(struct hda_codec *codec)
1259 alc_automute_pin(codec);
1260 alc_mic_automute(codec);
1263 /* additional initialization for ALC888 variants */
1264 static void alc888_coef_init(struct hda_codec *codec)
1268 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1269 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1270 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1271 if ((tmp & 0xf0) == 0x20)
1273 snd_hda_codec_read(codec, 0x20, 0,
1274 AC_VERB_SET_PROC_COEF, 0x830);
1277 snd_hda_codec_read(codec, 0x20, 0,
1278 AC_VERB_SET_PROC_COEF, 0x3030);
1281 static void alc889_coef_init(struct hda_codec *codec)
1285 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1286 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1287 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1288 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1291 /* turn on/off EAPD control (only if available) */
1292 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1294 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1296 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1297 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1301 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1306 case ALC_INIT_GPIO1:
1307 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1309 case ALC_INIT_GPIO2:
1310 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1312 case ALC_INIT_GPIO3:
1313 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1315 case ALC_INIT_DEFAULT:
1316 switch (codec->vendor_id) {
1318 set_eapd(codec, 0x0f, 1);
1319 set_eapd(codec, 0x10, 1);
1332 set_eapd(codec, 0x14, 1);
1333 set_eapd(codec, 0x15, 1);
1336 switch (codec->vendor_id) {
1338 snd_hda_codec_write(codec, 0x1a, 0,
1339 AC_VERB_SET_COEF_INDEX, 7);
1340 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1341 AC_VERB_GET_PROC_COEF, 0);
1342 snd_hda_codec_write(codec, 0x1a, 0,
1343 AC_VERB_SET_COEF_INDEX, 7);
1344 snd_hda_codec_write(codec, 0x1a, 0,
1345 AC_VERB_SET_PROC_COEF,
1355 alc889_coef_init(codec);
1358 alc888_coef_init(codec);
1360 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1363 snd_hda_codec_write(codec, 0x20, 0,
1364 AC_VERB_SET_COEF_INDEX, 7);
1365 tmp = snd_hda_codec_read(codec, 0x20, 0,
1366 AC_VERB_GET_PROC_COEF, 0);
1367 snd_hda_codec_write(codec, 0x20, 0,
1368 AC_VERB_SET_COEF_INDEX, 7);
1369 snd_hda_codec_write(codec, 0x20, 0,
1370 AC_VERB_SET_PROC_COEF,
1379 static void alc_init_auto_hp(struct hda_codec *codec)
1381 struct alc_spec *spec = codec->spec;
1382 struct auto_pin_cfg *cfg = &spec->autocfg;
1385 if (!cfg->hp_pins[0]) {
1386 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1390 if (!cfg->speaker_pins[0]) {
1391 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1393 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1394 sizeof(cfg->speaker_pins));
1395 cfg->speaker_outs = cfg->line_outs;
1398 if (!cfg->hp_pins[0]) {
1399 memcpy(cfg->hp_pins, cfg->line_out_pins,
1400 sizeof(cfg->hp_pins));
1401 cfg->hp_outs = cfg->line_outs;
1404 for (i = 0; i < cfg->hp_outs; i++) {
1405 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1407 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1408 AC_VERB_SET_UNSOLICITED_ENABLE,
1409 AC_USRSP_EN | ALC880_HP_EVENT);
1411 spec->unsol_event = alc_sku_unsol_event;
1414 static void alc_init_auto_mic(struct hda_codec *codec)
1416 struct alc_spec *spec = codec->spec;
1417 struct auto_pin_cfg *cfg = &spec->autocfg;
1418 hda_nid_t fixed, ext;
1421 /* there must be only two mic inputs exclusively */
1422 for (i = 0; i < cfg->num_inputs; i++)
1423 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1427 for (i = 0; i < cfg->num_inputs; i++) {
1428 hda_nid_t nid = cfg->inputs[i].pin;
1429 unsigned int defcfg;
1430 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1431 switch (snd_hda_get_input_pin_attr(defcfg)) {
1432 case INPUT_PIN_ATTR_INT:
1434 return; /* already occupied */
1437 case INPUT_PIN_ATTR_UNUSED:
1438 return; /* invalid entry */
1441 return; /* already occupied */
1448 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1449 return; /* no unsol support */
1450 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1452 spec->ext_mic.pin = ext;
1453 spec->int_mic.pin = fixed;
1454 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1455 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1457 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1458 AC_VERB_SET_UNSOLICITED_ENABLE,
1459 AC_USRSP_EN | ALC880_MIC_EVENT);
1460 spec->unsol_event = alc_sku_unsol_event;
1463 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1465 unsigned int ass, tmp, i;
1467 struct alc_spec *spec = codec->spec;
1469 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1471 ass = codec->subsystem_id & 0xffff;
1472 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1476 if (codec->vendor_id == 0x10ec0260)
1478 ass = snd_hda_codec_get_pincfg(codec, nid);
1481 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1482 codec->chip_name, ass);
1488 for (i = 1; i < 16; i++) {
1492 if (((ass >> 16) & 0xf) != tmp)
1495 spec->cdefine.port_connectivity = ass >> 30;
1496 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1497 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1498 spec->cdefine.customization = ass >> 8;
1500 spec->cdefine.sku_cfg = ass;
1501 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1502 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1503 spec->cdefine.swap = (ass & 0x2) >> 1;
1504 spec->cdefine.override = ass & 0x1;
1506 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1507 nid, spec->cdefine.sku_cfg);
1508 snd_printd("SKU: port_connectivity=0x%x\n",
1509 spec->cdefine.port_connectivity);
1510 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1511 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1512 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1513 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1514 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1515 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1516 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1521 /* check subsystem ID and set up device-specific initialization;
1522 * return 1 if initialized, 0 if invalid SSID
1524 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1525 * 31 ~ 16 : Manufacture ID
1527 * 7 ~ 0 : Assembly ID
1528 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1530 static int alc_subsystem_id(struct hda_codec *codec,
1531 hda_nid_t porta, hda_nid_t porte,
1532 hda_nid_t portd, hda_nid_t porti)
1534 unsigned int ass, tmp, i;
1536 struct alc_spec *spec = codec->spec;
1538 ass = codec->subsystem_id & 0xffff;
1539 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1542 /* invalid SSID, check the special NID pin defcfg instead */
1544 * 31~30 : port connectivity
1547 * 19~16 : Check sum (15:1)
1552 if (codec->vendor_id == 0x10ec0260)
1554 ass = snd_hda_codec_get_pincfg(codec, nid);
1555 snd_printd("realtek: No valid SSID, "
1556 "checking pincfg 0x%08x for NID 0x%x\n",
1560 if ((ass >> 30) != 1) /* no physical connection */
1565 for (i = 1; i < 16; i++) {
1569 if (((ass >> 16) & 0xf) != tmp)
1572 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1573 ass & 0xffff, codec->vendor_id);
1577 * 2 : 0 --> Desktop, 1 --> Laptop
1578 * 3~5 : External Amplifier control
1581 tmp = (ass & 0x38) >> 3; /* external Amp control */
1584 spec->init_amp = ALC_INIT_GPIO1;
1587 spec->init_amp = ALC_INIT_GPIO2;
1590 spec->init_amp = ALC_INIT_GPIO3;
1593 spec->init_amp = ALC_INIT_DEFAULT;
1597 /* is laptop or Desktop and enable the function "Mute internal speaker
1598 * when the external headphone out jack is plugged"
1600 if (!(ass & 0x8000))
1603 * 10~8 : Jack location
1604 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1606 * 15 : 1 --> enable the function "Mute internal speaker
1607 * when the external headphone out jack is plugged"
1609 if (!spec->autocfg.hp_pins[0]) {
1611 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1622 for (i = 0; i < spec->autocfg.line_outs; i++)
1623 if (spec->autocfg.line_out_pins[i] == nid)
1625 spec->autocfg.hp_pins[0] = nid;
1628 alc_init_auto_hp(codec);
1629 alc_init_auto_mic(codec);
1633 static void alc_ssid_check(struct hda_codec *codec,
1634 hda_nid_t porta, hda_nid_t porte,
1635 hda_nid_t portd, hda_nid_t porti)
1637 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1638 struct alc_spec *spec = codec->spec;
1639 snd_printd("realtek: "
1640 "Enable default setup for auto mode as fallback\n");
1641 spec->init_amp = ALC_INIT_DEFAULT;
1642 alc_init_auto_hp(codec);
1643 alc_init_auto_mic(codec);
1648 * Fix-up pin default configurations and add default verbs
1657 const struct alc_pincfg *pins;
1658 const struct hda_verb *verbs;
1661 static void alc_pick_fixup(struct hda_codec *codec,
1662 const struct snd_pci_quirk *quirk,
1663 const struct alc_fixup *fix,
1666 const struct alc_pincfg *cfg;
1668 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1671 fix += quirk->value;
1673 if (pre_init && cfg) {
1674 #ifdef CONFIG_SND_DEBUG_VERBOSE
1675 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1676 codec->chip_name, quirk->name);
1678 for (; cfg->nid; cfg++)
1679 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1681 if (!pre_init && fix->verbs) {
1682 #ifdef CONFIG_SND_DEBUG_VERBOSE
1683 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1684 codec->chip_name, quirk->name);
1686 add_verb(codec->spec, fix->verbs);
1690 static int alc_read_coef_idx(struct hda_codec *codec,
1691 unsigned int coef_idx)
1694 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1696 val = snd_hda_codec_read(codec, 0x20, 0,
1697 AC_VERB_GET_PROC_COEF, 0);
1701 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
1702 unsigned int coef_val)
1704 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1706 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
1710 /* set right pin controls for digital I/O */
1711 static void alc_auto_init_digital(struct hda_codec *codec)
1713 struct alc_spec *spec = codec->spec;
1717 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1718 pin = spec->autocfg.dig_out_pins[i];
1720 snd_hda_codec_write(codec, pin, 0,
1721 AC_VERB_SET_PIN_WIDGET_CONTROL,
1725 pin = spec->autocfg.dig_in_pin;
1727 snd_hda_codec_write(codec, pin, 0,
1728 AC_VERB_SET_PIN_WIDGET_CONTROL,
1732 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1733 static void alc_auto_parse_digital(struct hda_codec *codec)
1735 struct alc_spec *spec = codec->spec;
1739 /* support multiple SPDIFs; the secondary is set up as a slave */
1740 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1741 err = snd_hda_get_connections(codec,
1742 spec->autocfg.dig_out_pins[i],
1747 spec->multiout.dig_out_nid = dig_nid;
1748 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1750 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1751 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1753 spec->slave_dig_outs[i - 1] = dig_nid;
1757 if (spec->autocfg.dig_in_pin) {
1759 err = snd_hda_get_connections(codec,
1760 spec->autocfg.dig_in_pin,
1763 spec->dig_in_nid = dig_nid;
1774 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1775 /* Mic-in jack as mic in */
1776 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1777 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1778 /* Line-in jack as Line in */
1779 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1780 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1781 /* Line-Out as Front */
1782 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1789 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1790 /* Mic-in jack as mic in */
1791 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1792 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1793 /* Line-in jack as Surround */
1794 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1795 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1796 /* Line-Out as Front */
1797 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1804 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1805 /* Mic-in jack as CLFE */
1806 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1807 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1808 /* Line-in jack as Surround */
1809 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1810 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1811 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1812 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1819 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1820 /* Mic-in jack as CLFE */
1821 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1822 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1823 /* Line-in jack as Surround */
1824 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1825 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1826 /* Line-Out as Side */
1827 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1831 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1832 { 2, alc888_4ST_ch2_intel_init },
1833 { 4, alc888_4ST_ch4_intel_init },
1834 { 6, alc888_4ST_ch6_intel_init },
1835 { 8, alc888_4ST_ch8_intel_init },
1839 * ALC888 Fujitsu Siemens Amillo xa3530
1842 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1843 /* Front Mic: set to PIN_IN (empty by default) */
1844 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1845 /* Connect Internal HP to Front */
1846 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1847 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1848 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1849 /* Connect Bass HP to Front */
1850 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1851 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1852 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1853 /* Connect Line-Out side jack (SPDIF) to Side */
1854 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1855 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1856 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1857 /* Connect Mic jack to CLFE */
1858 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1859 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1860 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1861 /* Connect Line-in jack to Surround */
1862 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1863 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1864 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1865 /* Connect HP out jack to Front */
1866 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1867 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1868 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1869 /* Enable unsolicited event for HP jack and Line-out jack */
1870 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1871 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1875 static void alc_automute_amp(struct hda_codec *codec)
1877 alc_automute_speaker(codec, 0);
1880 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1883 if (codec->vendor_id == 0x10ec0880)
1887 if (res == ALC880_HP_EVENT)
1888 alc_automute_amp(codec);
1891 static void alc889_automute_setup(struct hda_codec *codec)
1893 struct alc_spec *spec = codec->spec;
1895 spec->autocfg.hp_pins[0] = 0x15;
1896 spec->autocfg.speaker_pins[0] = 0x14;
1897 spec->autocfg.speaker_pins[1] = 0x16;
1898 spec->autocfg.speaker_pins[2] = 0x17;
1899 spec->autocfg.speaker_pins[3] = 0x19;
1900 spec->autocfg.speaker_pins[4] = 0x1a;
1903 static void alc889_intel_init_hook(struct hda_codec *codec)
1905 alc889_coef_init(codec);
1906 alc_automute_amp(codec);
1909 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1911 struct alc_spec *spec = codec->spec;
1913 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1914 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1915 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1916 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1920 * ALC888 Acer Aspire 4930G model
1923 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1924 /* Front Mic: set to PIN_IN (empty by default) */
1925 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1926 /* Unselect Front Mic by default in input mixer 3 */
1927 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1928 /* Enable unsolicited event for HP jack */
1929 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1930 /* Connect Internal HP to front */
1931 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1932 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1933 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1934 /* Connect HP out to front */
1935 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1937 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1942 * ALC888 Acer Aspire 6530G model
1945 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1946 /* Route to built-in subwoofer as well as speakers */
1947 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1948 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1949 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1950 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1951 /* Bias voltage on for external mic port */
1952 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1953 /* Front Mic: set to PIN_IN (empty by default) */
1954 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1955 /* Unselect Front Mic by default in input mixer 3 */
1956 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1957 /* Enable unsolicited event for HP jack */
1958 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1959 /* Enable speaker output */
1960 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1961 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1962 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1963 /* Enable headphone output */
1964 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1965 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1966 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1967 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1972 * ALC889 Acer Aspire 8930G model
1975 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1976 /* Front Mic: set to PIN_IN (empty by default) */
1977 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1978 /* Unselect Front Mic by default in input mixer 3 */
1979 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1980 /* Enable unsolicited event for HP jack */
1981 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1982 /* Connect Internal Front to Front */
1983 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1984 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1985 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1986 /* Connect Internal Rear to Rear */
1987 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1988 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1989 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1990 /* Connect Internal CLFE to CLFE */
1991 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1992 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1993 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1994 /* Connect HP out to Front */
1995 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1997 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1998 /* Enable all DACs */
1999 /* DAC DISABLE/MUTE 1? */
2000 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2001 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2002 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2003 /* DAC DISABLE/MUTE 2? */
2004 /* some bit here disables the other DACs. Init=0x4900 */
2005 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2006 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2008 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2009 * which makes the stereo useless. However, either the mic or the ALC889
2010 * makes the signal become a difference/sum signal instead of standard
2011 * stereo, which is annoying. So instead we flip this bit which makes the
2012 * codec replicate the sum signal to both channels, turning it into a
2015 /* DMIC_CONTROL? Init value = 0x0001 */
2016 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2017 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2021 static struct hda_input_mux alc888_2_capture_sources[2] = {
2022 /* Front mic only available on one ADC */
2029 { "Front Mic", 0xb },
2042 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2043 /* Interal mic only available on one ADC */
2050 { "Input Mix", 0xa },
2060 { "Input Mix", 0xa },
2065 static struct hda_input_mux alc889_capture_sources[3] = {
2066 /* Digital mic only available on first "ADC" */
2073 { "Front Mic", 0xb },
2074 { "Input Mix", 0xa },
2083 { "Input Mix", 0xa },
2092 { "Input Mix", 0xa },
2097 static struct snd_kcontrol_new alc888_base_mixer[] = {
2098 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2099 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2100 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2101 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2102 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2104 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2105 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2106 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2107 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2108 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2109 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2110 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2111 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2112 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2114 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
2115 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2119 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2120 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2121 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2122 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2123 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2124 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2126 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2127 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2128 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2132 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
2133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2138 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2140 struct alc_spec *spec = codec->spec;
2142 spec->autocfg.hp_pins[0] = 0x15;
2143 spec->autocfg.speaker_pins[0] = 0x14;
2144 spec->autocfg.speaker_pins[1] = 0x16;
2145 spec->autocfg.speaker_pins[2] = 0x17;
2148 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2150 struct alc_spec *spec = codec->spec;
2152 spec->autocfg.hp_pins[0] = 0x15;
2153 spec->autocfg.speaker_pins[0] = 0x14;
2154 spec->autocfg.speaker_pins[1] = 0x16;
2155 spec->autocfg.speaker_pins[2] = 0x17;
2158 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2160 struct alc_spec *spec = codec->spec;
2162 spec->autocfg.hp_pins[0] = 0x15;
2163 spec->autocfg.speaker_pins[0] = 0x14;
2164 spec->autocfg.speaker_pins[1] = 0x16;
2165 spec->autocfg.speaker_pins[2] = 0x1b;
2169 * ALC880 3-stack model
2171 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2172 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2173 * F-Mic = 0x1b, HP = 0x19
2176 static hda_nid_t alc880_dac_nids[4] = {
2177 /* front, rear, clfe, rear_surr */
2178 0x02, 0x05, 0x04, 0x03
2181 static hda_nid_t alc880_adc_nids[3] = {
2186 /* The datasheet says the node 0x07 is connected from inputs,
2187 * but it shows zero connection in the real implementation on some devices.
2188 * Note: this is a 915GAV bug, fixed on 915GLV
2190 static hda_nid_t alc880_adc_nids_alt[2] = {
2195 #define ALC880_DIGOUT_NID 0x06
2196 #define ALC880_DIGIN_NID 0x0a
2198 static struct hda_input_mux alc880_capture_source = {
2202 { "Front Mic", 0x3 },
2208 /* channel source setting (2/6 channel selection for 3-stack) */
2210 static struct hda_verb alc880_threestack_ch2_init[] = {
2211 /* set line-in to input, mute it */
2212 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2213 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2214 /* set mic-in to input vref 80%, mute it */
2215 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2216 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2221 static struct hda_verb alc880_threestack_ch6_init[] = {
2222 /* set line-in to output, unmute it */
2223 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2224 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2225 /* set mic-in to output, unmute it */
2226 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2227 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2231 static struct hda_channel_mode alc880_threestack_modes[2] = {
2232 { 2, alc880_threestack_ch2_init },
2233 { 6, alc880_threestack_ch6_init },
2236 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2237 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2238 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2239 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2240 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2241 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2242 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2243 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2244 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2245 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2246 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2247 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2248 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2250 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2251 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2252 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2253 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2255 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2256 .name = "Channel Mode",
2257 .info = alc_ch_mode_info,
2258 .get = alc_ch_mode_get,
2259 .put = alc_ch_mode_put,
2264 /* capture mixer elements */
2265 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2266 struct snd_ctl_elem_info *uinfo)
2268 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2269 struct alc_spec *spec = codec->spec;
2272 mutex_lock(&codec->control_mutex);
2273 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2275 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2276 mutex_unlock(&codec->control_mutex);
2280 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2281 unsigned int size, unsigned int __user *tlv)
2283 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2284 struct alc_spec *spec = codec->spec;
2287 mutex_lock(&codec->control_mutex);
2288 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2290 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2291 mutex_unlock(&codec->control_mutex);
2295 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2296 struct snd_ctl_elem_value *ucontrol);
2298 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2299 struct snd_ctl_elem_value *ucontrol,
2302 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2303 struct alc_spec *spec = codec->spec;
2304 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2307 mutex_lock(&codec->control_mutex);
2308 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2310 err = func(kcontrol, ucontrol);
2311 mutex_unlock(&codec->control_mutex);
2315 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2316 struct snd_ctl_elem_value *ucontrol)
2318 return alc_cap_getput_caller(kcontrol, ucontrol,
2319 snd_hda_mixer_amp_volume_get);
2322 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2323 struct snd_ctl_elem_value *ucontrol)
2325 return alc_cap_getput_caller(kcontrol, ucontrol,
2326 snd_hda_mixer_amp_volume_put);
2329 /* capture mixer elements */
2330 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2332 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2333 struct snd_ctl_elem_value *ucontrol)
2335 return alc_cap_getput_caller(kcontrol, ucontrol,
2336 snd_hda_mixer_amp_switch_get);
2339 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2340 struct snd_ctl_elem_value *ucontrol)
2342 return alc_cap_getput_caller(kcontrol, ucontrol,
2343 snd_hda_mixer_amp_switch_put);
2346 #define _DEFINE_CAPMIX(num) \
2348 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2349 .name = "Capture Switch", \
2350 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2352 .info = alc_cap_sw_info, \
2353 .get = alc_cap_sw_get, \
2354 .put = alc_cap_sw_put, \
2357 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2358 .name = "Capture Volume", \
2359 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2360 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2361 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2363 .info = alc_cap_vol_info, \
2364 .get = alc_cap_vol_get, \
2365 .put = alc_cap_vol_put, \
2366 .tlv = { .c = alc_cap_vol_tlv }, \
2369 #define _DEFINE_CAPSRC(num) \
2371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2372 /* .name = "Capture Source", */ \
2373 .name = "Input Source", \
2375 .info = alc_mux_enum_info, \
2376 .get = alc_mux_enum_get, \
2377 .put = alc_mux_enum_put, \
2380 #define DEFINE_CAPMIX(num) \
2381 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2382 _DEFINE_CAPMIX(num), \
2383 _DEFINE_CAPSRC(num), \
2387 #define DEFINE_CAPMIX_NOSRC(num) \
2388 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2389 _DEFINE_CAPMIX(num), \
2393 /* up to three ADCs */
2397 DEFINE_CAPMIX_NOSRC(1);
2398 DEFINE_CAPMIX_NOSRC(2);
2399 DEFINE_CAPMIX_NOSRC(3);
2402 * ALC880 5-stack model
2404 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2406 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2407 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2410 /* additional mixers to alc880_three_stack_mixer */
2411 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2412 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2413 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2417 /* channel source setting (6/8 channel selection for 5-stack) */
2419 static struct hda_verb alc880_fivestack_ch6_init[] = {
2420 /* set line-in to input, mute it */
2421 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2422 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2427 static struct hda_verb alc880_fivestack_ch8_init[] = {
2428 /* set line-in to output, unmute it */
2429 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2430 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2434 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2435 { 6, alc880_fivestack_ch6_init },
2436 { 8, alc880_fivestack_ch8_init },
2441 * ALC880 6-stack model
2443 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2444 * Side = 0x05 (0x0f)
2445 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2446 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2449 static hda_nid_t alc880_6st_dac_nids[4] = {
2450 /* front, rear, clfe, rear_surr */
2451 0x02, 0x03, 0x04, 0x05
2454 static struct hda_input_mux alc880_6stack_capture_source = {
2458 { "Front Mic", 0x1 },
2464 /* fixed 8-channels */
2465 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2469 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2470 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2471 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2472 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2473 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2474 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2475 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2476 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2477 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2478 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2479 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2480 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2481 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2482 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2483 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2485 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2486 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2487 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2489 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2490 .name = "Channel Mode",
2491 .info = alc_ch_mode_info,
2492 .get = alc_ch_mode_get,
2493 .put = alc_ch_mode_put,
2502 * W810 has rear IO for:
2505 * Center/LFE (DAC 04)
2508 * The system also has a pair of internal speakers, and a headphone jack.
2509 * These are both connected to Line2 on the codec, hence to DAC 02.
2511 * There is a variable resistor to control the speaker or headphone
2512 * volume. This is a hardware-only device without a software API.
2514 * Plugging headphones in will disable the internal speakers. This is
2515 * implemented in hardware, not via the driver using jack sense. In
2516 * a similar fashion, plugging into the rear socket marked "front" will
2517 * disable both the speakers and headphones.
2519 * For input, there's a microphone jack, and an "audio in" jack.
2520 * These may not do anything useful with this driver yet, because I
2521 * haven't setup any initialization verbs for these yet...
2524 static hda_nid_t alc880_w810_dac_nids[3] = {
2525 /* front, rear/surround, clfe */
2529 /* fixed 6 channels */
2530 static struct hda_channel_mode alc880_w810_modes[1] = {
2534 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2535 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2536 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2537 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2538 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2539 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2540 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2541 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2542 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2543 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2544 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2552 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2553 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2557 static hda_nid_t alc880_z71v_dac_nids[1] = {
2560 #define ALC880_Z71V_HP_DAC 0x03
2562 /* fixed 2 channels */
2563 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2567 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2568 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2569 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2570 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2571 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2572 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2573 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2574 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2575 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2581 * ALC880 F1734 model
2583 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2584 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2587 static hda_nid_t alc880_f1734_dac_nids[1] = {
2590 #define ALC880_F1734_HP_DAC 0x02
2592 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2593 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2594 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2595 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2596 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2597 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2598 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2599 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2600 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2604 static struct hda_input_mux alc880_f1734_capture_source = {
2616 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2617 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2618 * Mic = 0x18, Line = 0x1a
2621 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2622 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2624 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2625 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2626 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2627 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2628 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2629 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2630 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2631 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2632 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2633 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2634 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2635 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2636 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2637 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2640 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2641 .name = "Channel Mode",
2642 .info = alc_ch_mode_info,
2643 .get = alc_ch_mode_get,
2644 .put = alc_ch_mode_put,
2650 * ALC880 ASUS W1V model
2652 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2653 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2654 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2657 /* additional mixers to alc880_asus_mixer */
2658 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2659 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2660 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2665 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2666 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2667 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2668 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2669 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2670 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2673 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2674 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2679 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2680 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2681 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2682 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2683 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2684 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2685 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2686 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2687 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2688 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2689 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2690 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2691 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2692 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2693 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2694 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2695 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2697 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2698 .name = "Channel Mode",
2699 .info = alc_ch_mode_info,
2700 .get = alc_ch_mode_get,
2701 .put = alc_ch_mode_put,
2706 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2707 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2708 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2709 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2710 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2711 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2712 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2713 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2714 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2715 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2716 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2720 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2721 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2722 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2723 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2724 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2725 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2726 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2731 * virtual master controls
2735 * slave controls for virtual master
2737 static const char *alc_slave_vols[] = {
2738 "Front Playback Volume",
2739 "Surround Playback Volume",
2740 "Center Playback Volume",
2741 "LFE Playback Volume",
2742 "Side Playback Volume",
2743 "Headphone Playback Volume",
2744 "Speaker Playback Volume",
2745 "Mono Playback Volume",
2746 "Line-Out Playback Volume",
2747 "PCM Playback Volume",
2751 static const char *alc_slave_sws[] = {
2752 "Front Playback Switch",
2753 "Surround Playback Switch",
2754 "Center Playback Switch",
2755 "LFE Playback Switch",
2756 "Side Playback Switch",
2757 "Headphone Playback Switch",
2758 "Speaker Playback Switch",
2759 "Mono Playback Switch",
2760 "IEC958 Playback Switch",
2761 "Line-Out Playback Switch",
2762 "PCM Playback Switch",
2767 * build control elements
2770 #define NID_MAPPING (-1)
2772 #define SUBDEV_SPEAKER_ (0 << 6)
2773 #define SUBDEV_HP_ (1 << 6)
2774 #define SUBDEV_LINE_ (2 << 6)
2775 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2776 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2777 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2779 static void alc_free_kctls(struct hda_codec *codec);
2781 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2782 /* additional beep mixers; the actual parameters are overwritten at build */
2783 static struct snd_kcontrol_new alc_beep_mixer[] = {
2784 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2785 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2790 static int alc_build_controls(struct hda_codec *codec)
2792 struct alc_spec *spec = codec->spec;
2793 struct snd_kcontrol *kctl = NULL;
2794 struct snd_kcontrol_new *knew;
2799 for (i = 0; i < spec->num_mixers; i++) {
2800 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2804 if (spec->cap_mixer) {
2805 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2809 if (spec->multiout.dig_out_nid) {
2810 err = snd_hda_create_spdif_out_ctls(codec,
2811 spec->multiout.dig_out_nid);
2814 if (!spec->no_analog) {
2815 err = snd_hda_create_spdif_share_sw(codec,
2819 spec->multiout.share_spdif = 1;
2822 if (spec->dig_in_nid) {
2823 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2828 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2829 /* create beep controls if needed */
2830 if (spec->beep_amp) {
2831 struct snd_kcontrol_new *knew;
2832 for (knew = alc_beep_mixer; knew->name; knew++) {
2833 struct snd_kcontrol *kctl;
2834 kctl = snd_ctl_new1(knew, codec);
2837 kctl->private_value = spec->beep_amp;
2838 err = snd_hda_ctl_add(codec, 0, kctl);
2845 /* if we have no master control, let's create it */
2846 if (!spec->no_analog &&
2847 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2848 unsigned int vmaster_tlv[4];
2849 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2850 HDA_OUTPUT, vmaster_tlv);
2851 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2852 vmaster_tlv, alc_slave_vols);
2856 if (!spec->no_analog &&
2857 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2858 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2859 NULL, alc_slave_sws);
2864 /* assign Capture Source enums to NID */
2865 if (spec->capsrc_nids || spec->adc_nids) {
2866 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2868 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2869 for (i = 0; kctl && i < kctl->count; i++) {
2870 hda_nid_t *nids = spec->capsrc_nids;
2872 nids = spec->adc_nids;
2873 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2878 if (spec->cap_mixer) {
2879 const char *kname = kctl ? kctl->id.name : NULL;
2880 for (knew = spec->cap_mixer; knew->name; knew++) {
2881 if (kname && strcmp(knew->name, kname) == 0)
2883 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2884 for (i = 0; kctl && i < kctl->count; i++) {
2885 err = snd_hda_add_nid(codec, kctl, i,
2893 /* other nid->control mapping */
2894 for (i = 0; i < spec->num_mixers; i++) {
2895 for (knew = spec->mixers[i]; knew->name; knew++) {
2896 if (knew->iface != NID_MAPPING)
2898 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2901 u = knew->subdevice;
2902 for (j = 0; j < 4; j++, u >>= 8) {
2907 case SUBDEV_SPEAKER_:
2908 nid = spec->autocfg.speaker_pins[nid];
2911 nid = spec->autocfg.line_out_pins[nid];
2914 nid = spec->autocfg.hp_pins[nid];
2919 err = snd_hda_add_nid(codec, kctl, 0, nid);
2923 u = knew->private_value;
2924 for (j = 0; j < 4; j++, u >>= 8) {
2928 err = snd_hda_add_nid(codec, kctl, 0, nid);
2935 alc_free_kctls(codec); /* no longer needed */
2942 * initialize the codec volumes, etc
2946 * generic initialization of ADC, input mixers and output mixers
2948 static struct hda_verb alc880_volume_init_verbs[] = {
2950 * Unmute ADC0-2 and set the default input to mic-in
2952 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2953 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2954 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2955 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2956 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2957 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2959 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2961 * Note: PASD motherboards uses the Line In 2 as the input for front
2964 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2965 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2966 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2967 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2968 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2969 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2970 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2971 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2974 * Set up output mixers (0x0c - 0x0f)
2976 /* set vol=0 to output mixers */
2977 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2978 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2979 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2980 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2981 /* set up input amps for analog loopback */
2982 /* Amp Indices: DAC = 0, mixer = 1 */
2983 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2984 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2985 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2986 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2987 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2988 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2989 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2990 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2996 * 3-stack pin configuration:
2997 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2999 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3001 * preset connection lists of input pins
3002 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3004 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3005 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3006 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3009 * Set pin mode and muting
3011 /* set front pin widgets 0x14 for output */
3012 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3013 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3014 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3015 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3016 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3017 /* Mic2 (as headphone out) for HP output */
3018 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3019 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3020 /* Line In pin widget for input */
3021 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3022 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3023 /* Line2 (as front mic) pin widget for input and vref at 80% */
3024 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3025 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3026 /* CD pin widget for input */
3027 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3033 * 5-stack pin configuration:
3034 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3035 * line-in/side = 0x1a, f-mic = 0x1b
3037 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3039 * preset connection lists of input pins
3040 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3042 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3043 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3046 * Set pin mode and muting
3048 /* set pin widgets 0x14-0x17 for output */
3049 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3050 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3051 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3052 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3053 /* unmute pins for output (no gain on this amp) */
3054 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3056 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3057 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3059 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3060 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3061 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3062 /* Mic2 (as headphone out) for HP output */
3063 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3064 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3065 /* Line In pin widget for input */
3066 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3067 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3068 /* Line2 (as front mic) pin widget for input and vref at 80% */
3069 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3070 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3071 /* CD pin widget for input */
3072 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3078 * W810 pin configuration:
3079 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3081 static struct hda_verb alc880_pin_w810_init_verbs[] = {
3082 /* hphone/speaker input selector: front DAC */
3083 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3085 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3086 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3087 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3088 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3089 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3090 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3092 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3093 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3099 * Z71V pin configuration:
3100 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3102 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3103 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3104 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3105 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3106 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3108 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3109 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3110 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3111 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3117 * 6-stack pin configuration:
3118 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3119 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3121 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3122 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3124 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3125 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3126 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3127 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3128 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3129 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3130 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3131 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3133 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3134 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3135 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3136 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3137 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3138 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3139 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3140 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3141 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3147 * Uniwill pin configuration:
3148 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3151 static struct hda_verb alc880_uniwill_init_verbs[] = {
3152 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3154 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3155 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3156 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3157 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3158 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3159 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3160 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3161 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3164 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3165 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3166 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3167 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3169 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3170 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3171 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3172 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3173 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3174 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3175 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3176 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3177 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3179 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3180 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3187 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3189 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3190 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3192 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3193 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3194 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3195 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3196 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3197 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3198 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3199 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3200 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3201 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3202 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3203 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3205 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3206 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3207 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3208 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3209 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3210 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3212 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3213 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3218 static struct hda_verb alc880_beep_init_verbs[] = {
3219 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3223 /* auto-toggle front mic */
3224 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
3226 unsigned int present;
3229 present = snd_hda_jack_detect(codec, 0x18);
3230 bits = present ? HDA_AMP_MUTE : 0;
3231 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3234 static void alc880_uniwill_setup(struct hda_codec *codec)
3236 struct alc_spec *spec = codec->spec;
3238 spec->autocfg.hp_pins[0] = 0x14;
3239 spec->autocfg.speaker_pins[0] = 0x15;
3240 spec->autocfg.speaker_pins[0] = 0x16;
3243 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3245 alc_automute_amp(codec);
3246 alc880_uniwill_mic_automute(codec);
3249 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3252 /* Looks like the unsol event is incompatible with the standard
3253 * definition. 4bit tag is placed at 28 bit!
3255 switch (res >> 28) {
3256 case ALC880_MIC_EVENT:
3257 alc880_uniwill_mic_automute(codec);
3260 alc_automute_amp_unsol_event(codec, res);
3265 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3267 struct alc_spec *spec = codec->spec;
3269 spec->autocfg.hp_pins[0] = 0x14;
3270 spec->autocfg.speaker_pins[0] = 0x15;
3273 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3275 unsigned int present;
3277 present = snd_hda_codec_read(codec, 0x21, 0,
3278 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3279 present &= HDA_AMP_VOLMASK;
3280 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3281 HDA_AMP_VOLMASK, present);
3282 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3283 HDA_AMP_VOLMASK, present);
3286 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3289 /* Looks like the unsol event is incompatible with the standard
3290 * definition. 4bit tag is placed at 28 bit!
3292 if ((res >> 28) == ALC880_DCVOL_EVENT)
3293 alc880_uniwill_p53_dcvol_automute(codec);
3295 alc_automute_amp_unsol_event(codec, res);
3299 * F1734 pin configuration:
3300 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3302 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3303 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3304 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3305 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3306 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3307 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3309 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3310 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3311 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3312 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3314 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3315 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3316 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3317 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3318 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3319 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3320 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3321 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3322 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3324 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3325 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3331 * ASUS pin configuration:
3332 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3334 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3335 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3336 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3337 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3338 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3340 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3341 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3343 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3344 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3345 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3346 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3347 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3349 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3350 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3351 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3352 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3353 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3354 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3355 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3356 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3357 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3362 /* Enable GPIO mask and set output */
3363 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3364 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3365 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3367 /* Clevo m520g init */
3368 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3369 /* headphone output */
3370 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3372 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3373 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3375 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3376 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3378 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3379 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3380 /* Mic1 (rear panel) */
3381 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3382 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3383 /* Mic2 (front panel) */
3384 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3385 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3387 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3388 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3389 /* change to EAPD mode */
3390 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3391 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3396 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3397 /* change to EAPD mode */
3398 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3399 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3401 /* Headphone output */
3402 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3404 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3405 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3407 /* Line In pin widget for input */
3408 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3409 /* CD pin widget for input */
3410 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3411 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3412 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3414 /* change to EAPD mode */
3415 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3416 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3422 * LG m1 express dual
3425 * Rear Line-In/Out (blue): 0x14
3426 * Build-in Mic-In: 0x15
3428 * HP-Out (green): 0x1b
3429 * Mic-In/Out (red): 0x19
3433 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3434 static hda_nid_t alc880_lg_dac_nids[3] = {
3438 /* seems analog CD is not working */
3439 static struct hda_input_mux alc880_lg_capture_source = {
3444 { "Internal Mic", 0x6 },
3448 /* 2,4,6 channel modes */
3449 static struct hda_verb alc880_lg_ch2_init[] = {
3450 /* set line-in and mic-in to input */
3451 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3452 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3456 static struct hda_verb alc880_lg_ch4_init[] = {
3457 /* set line-in to out and mic-in to input */
3458 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3459 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3463 static struct hda_verb alc880_lg_ch6_init[] = {
3464 /* set line-in and mic-in to output */
3465 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3466 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3470 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3471 { 2, alc880_lg_ch2_init },
3472 { 4, alc880_lg_ch4_init },
3473 { 6, alc880_lg_ch6_init },
3476 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3477 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3478 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3479 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3480 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3481 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3482 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3483 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3484 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3486 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3487 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3488 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3489 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3490 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3492 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3493 .name = "Channel Mode",
3494 .info = alc_ch_mode_info,
3495 .get = alc_ch_mode_get,
3496 .put = alc_ch_mode_put,
3501 static struct hda_verb alc880_lg_init_verbs[] = {
3502 /* set capture source to mic-in */
3503 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3504 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3505 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3506 /* mute all amp mixer inputs */
3507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3510 /* line-in to input */
3511 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3512 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3514 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3515 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3517 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3518 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3519 /* mic-in to input */
3520 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3521 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3522 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3524 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3525 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3526 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3528 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3532 /* toggle speaker-output according to the hp-jack state */
3533 static void alc880_lg_setup(struct hda_codec *codec)
3535 struct alc_spec *spec = codec->spec;
3537 spec->autocfg.hp_pins[0] = 0x1b;
3538 spec->autocfg.speaker_pins[0] = 0x17;
3547 * Built-in Mic-In: 0x19
3553 static struct hda_input_mux alc880_lg_lw_capture_source = {
3557 { "Internal Mic", 0x1 },
3562 #define alc880_lg_lw_modes alc880_threestack_modes
3564 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3565 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3566 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3567 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3568 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3569 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3570 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3571 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3572 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3573 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3574 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3576 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3577 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3578 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3580 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3581 .name = "Channel Mode",
3582 .info = alc_ch_mode_info,
3583 .get = alc_ch_mode_get,
3584 .put = alc_ch_mode_put,
3589 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3590 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3591 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3592 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3594 /* set capture source to mic-in */
3595 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3596 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3598 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3601 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3603 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3604 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3605 /* mic-in to input */
3606 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3607 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3609 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3610 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3612 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3616 /* toggle speaker-output according to the hp-jack state */
3617 static void alc880_lg_lw_setup(struct hda_codec *codec)
3619 struct alc_spec *spec = codec->spec;
3621 spec->autocfg.hp_pins[0] = 0x1b;
3622 spec->autocfg.speaker_pins[0] = 0x14;
3625 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3626 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3627 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3629 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3630 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3631 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3635 static struct hda_input_mux alc880_medion_rim_capture_source = {
3639 { "Internal Mic", 0x1 },
3643 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3644 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3646 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3647 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3649 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3650 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3651 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3652 /* Mic2 (as headphone out) for HP output */
3653 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3654 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3655 /* Internal Speaker */
3656 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3657 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3659 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3660 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3662 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3666 /* toggle speaker-output according to the hp-jack state */
3667 static void alc880_medion_rim_automute(struct hda_codec *codec)
3669 struct alc_spec *spec = codec->spec;
3670 alc_automute_amp(codec);
3672 if (spec->jack_present)
3673 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3675 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3678 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3681 /* Looks like the unsol event is incompatible with the standard
3682 * definition. 4bit tag is placed at 28 bit!
3684 if ((res >> 28) == ALC880_HP_EVENT)
3685 alc880_medion_rim_automute(codec);
3688 static void alc880_medion_rim_setup(struct hda_codec *codec)
3690 struct alc_spec *spec = codec->spec;
3692 spec->autocfg.hp_pins[0] = 0x14;
3693 spec->autocfg.speaker_pins[0] = 0x1b;
3696 #ifdef CONFIG_SND_HDA_POWER_SAVE
3697 static struct hda_amp_list alc880_loopbacks[] = {
3698 { 0x0b, HDA_INPUT, 0 },
3699 { 0x0b, HDA_INPUT, 1 },
3700 { 0x0b, HDA_INPUT, 2 },
3701 { 0x0b, HDA_INPUT, 3 },
3702 { 0x0b, HDA_INPUT, 4 },
3706 static struct hda_amp_list alc880_lg_loopbacks[] = {
3707 { 0x0b, HDA_INPUT, 1 },
3708 { 0x0b, HDA_INPUT, 6 },
3709 { 0x0b, HDA_INPUT, 7 },
3718 static int alc_init(struct hda_codec *codec)
3720 struct alc_spec *spec = codec->spec;
3724 alc_auto_init_amp(codec, spec->init_amp);
3726 for (i = 0; i < spec->num_init_verbs; i++)
3727 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3729 if (spec->init_hook)
3730 spec->init_hook(codec);
3732 #ifdef CONFIG_SND_HDA_POWER_SAVE
3733 if (codec->patch_ops.check_power_status)
3734 codec->patch_ops.check_power_status(codec, 0x01);
3739 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3741 struct alc_spec *spec = codec->spec;
3743 if (spec->unsol_event)
3744 spec->unsol_event(codec, res);
3747 #ifdef CONFIG_SND_HDA_POWER_SAVE
3748 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3750 struct alc_spec *spec = codec->spec;
3751 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3756 * Analog playback callbacks
3758 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3759 struct hda_codec *codec,
3760 struct snd_pcm_substream *substream)
3762 struct alc_spec *spec = codec->spec;
3763 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3767 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3768 struct hda_codec *codec,
3769 unsigned int stream_tag,
3770 unsigned int format,
3771 struct snd_pcm_substream *substream)
3773 struct alc_spec *spec = codec->spec;
3774 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3775 stream_tag, format, substream);
3778 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3779 struct hda_codec *codec,
3780 struct snd_pcm_substream *substream)
3782 struct alc_spec *spec = codec->spec;
3783 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3789 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3790 struct hda_codec *codec,
3791 struct snd_pcm_substream *substream)
3793 struct alc_spec *spec = codec->spec;
3794 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3797 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3798 struct hda_codec *codec,
3799 unsigned int stream_tag,
3800 unsigned int format,
3801 struct snd_pcm_substream *substream)
3803 struct alc_spec *spec = codec->spec;
3804 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3805 stream_tag, format, substream);
3808 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3809 struct hda_codec *codec,
3810 struct snd_pcm_substream *substream)
3812 struct alc_spec *spec = codec->spec;
3813 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3816 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3817 struct hda_codec *codec,
3818 struct snd_pcm_substream *substream)
3820 struct alc_spec *spec = codec->spec;
3821 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3827 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3828 struct hda_codec *codec,
3829 unsigned int stream_tag,
3830 unsigned int format,
3831 struct snd_pcm_substream *substream)
3833 struct alc_spec *spec = codec->spec;
3835 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3836 stream_tag, 0, format);
3840 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3841 struct hda_codec *codec,
3842 struct snd_pcm_substream *substream)
3844 struct alc_spec *spec = codec->spec;
3846 snd_hda_codec_cleanup_stream(codec,
3847 spec->adc_nids[substream->number + 1]);
3851 /* analog capture with dynamic dual-adc changes */
3852 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3853 struct hda_codec *codec,
3854 unsigned int stream_tag,
3855 unsigned int format,
3856 struct snd_pcm_substream *substream)
3858 struct alc_spec *spec = codec->spec;
3859 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
3860 spec->cur_adc_stream_tag = stream_tag;
3861 spec->cur_adc_format = format;
3862 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
3866 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3867 struct hda_codec *codec,
3868 struct snd_pcm_substream *substream)
3870 struct alc_spec *spec = codec->spec;
3871 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
3876 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
3880 .nid = 0, /* fill later */
3882 .prepare = dualmic_capture_pcm_prepare,
3883 .cleanup = dualmic_capture_pcm_cleanup
3889 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3893 /* NID is set in alc_build_pcms */
3895 .open = alc880_playback_pcm_open,
3896 .prepare = alc880_playback_pcm_prepare,
3897 .cleanup = alc880_playback_pcm_cleanup
3901 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3905 /* NID is set in alc_build_pcms */
3908 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3912 /* NID is set in alc_build_pcms */
3915 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3916 .substreams = 2, /* can be overridden */
3919 /* NID is set in alc_build_pcms */
3921 .prepare = alc880_alt_capture_pcm_prepare,
3922 .cleanup = alc880_alt_capture_pcm_cleanup
3926 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3930 /* NID is set in alc_build_pcms */
3932 .open = alc880_dig_playback_pcm_open,
3933 .close = alc880_dig_playback_pcm_close,
3934 .prepare = alc880_dig_playback_pcm_prepare,
3935 .cleanup = alc880_dig_playback_pcm_cleanup
3939 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3943 /* NID is set in alc_build_pcms */
3946 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3947 static struct hda_pcm_stream alc_pcm_null_stream = {
3953 static int alc_build_pcms(struct hda_codec *codec)
3955 struct alc_spec *spec = codec->spec;
3956 struct hda_pcm *info = spec->pcm_rec;
3959 codec->num_pcms = 1;
3960 codec->pcm_info = info;
3962 if (spec->no_analog)
3965 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3966 "%s Analog", codec->chip_name);
3967 info->name = spec->stream_name_analog;
3969 if (spec->stream_analog_playback) {
3970 if (snd_BUG_ON(!spec->multiout.dac_nids))
3972 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3973 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3975 if (spec->stream_analog_capture) {
3976 if (snd_BUG_ON(!spec->adc_nids))
3978 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3979 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3982 if (spec->channel_mode) {
3983 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3984 for (i = 0; i < spec->num_channel_mode; i++) {
3985 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3986 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3992 /* SPDIF for stream index #1 */
3993 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3994 snprintf(spec->stream_name_digital,
3995 sizeof(spec->stream_name_digital),
3996 "%s Digital", codec->chip_name);
3997 codec->num_pcms = 2;
3998 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3999 info = spec->pcm_rec + 1;
4000 info->name = spec->stream_name_digital;
4001 if (spec->dig_out_type)
4002 info->pcm_type = spec->dig_out_type;
4004 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4005 if (spec->multiout.dig_out_nid &&
4006 spec->stream_digital_playback) {
4007 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4008 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4010 if (spec->dig_in_nid &&
4011 spec->stream_digital_capture) {
4012 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4013 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4015 /* FIXME: do we need this for all Realtek codec models? */
4016 codec->spdif_status_reset = 1;
4019 if (spec->no_analog)
4022 /* If the use of more than one ADC is requested for the current
4023 * model, configure a second analog capture-only PCM.
4025 /* Additional Analaog capture for index #2 */
4026 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4027 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4028 codec->num_pcms = 3;
4029 info = spec->pcm_rec + 2;
4030 info->name = spec->stream_name_analog;
4031 if (spec->alt_dac_nid) {
4032 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4033 *spec->stream_analog_alt_playback;
4034 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4037 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4038 alc_pcm_null_stream;
4039 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4041 if (spec->num_adc_nids > 1) {
4042 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4043 *spec->stream_analog_alt_capture;
4044 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4046 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4047 spec->num_adc_nids - 1;
4049 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4050 alc_pcm_null_stream;
4051 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4058 static inline void alc_shutup(struct hda_codec *codec)
4060 snd_hda_shutup_pins(codec);
4063 static void alc_free_kctls(struct hda_codec *codec)
4065 struct alc_spec *spec = codec->spec;
4067 if (spec->kctls.list) {
4068 struct snd_kcontrol_new *kctl = spec->kctls.list;
4070 for (i = 0; i < spec->kctls.used; i++)
4071 kfree(kctl[i].name);
4073 snd_array_free(&spec->kctls);
4076 static void alc_free(struct hda_codec *codec)
4078 struct alc_spec *spec = codec->spec;
4084 alc_free_kctls(codec);
4086 snd_hda_detach_beep_device(codec);
4089 #ifdef CONFIG_SND_HDA_POWER_SAVE
4090 static void alc_power_eapd(struct hda_codec *codec)
4092 /* We currently only handle front, HP */
4093 switch (codec->vendor_id) {
4095 set_eapd(codec, 0x0f, 0);
4096 set_eapd(codec, 0x10, 0);
4109 set_eapd(codec, 0x14, 0);
4110 set_eapd(codec, 0x15, 0);
4115 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4117 struct alc_spec *spec = codec->spec;
4119 if (spec && spec->power_hook)
4120 spec->power_hook(codec);
4125 #ifdef SND_HDA_NEEDS_RESUME
4126 static int alc_resume(struct hda_codec *codec)
4128 codec->patch_ops.init(codec);
4129 snd_hda_codec_resume_amp(codec);
4130 snd_hda_codec_resume_cache(codec);
4131 #ifdef CONFIG_SND_HDA_POWER_SAVE
4132 if (codec->patch_ops.check_power_status)
4133 codec->patch_ops.check_power_status(codec, 0x01);
4141 static struct hda_codec_ops alc_patch_ops = {
4142 .build_controls = alc_build_controls,
4143 .build_pcms = alc_build_pcms,
4146 .unsol_event = alc_unsol_event,
4147 #ifdef SND_HDA_NEEDS_RESUME
4148 .resume = alc_resume,
4150 #ifdef CONFIG_SND_HDA_POWER_SAVE
4151 .suspend = alc_suspend,
4152 .check_power_status = alc_check_power_status,
4154 .reboot_notify = alc_shutup,
4157 /* replace the codec chip_name with the given string */
4158 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4160 kfree(codec->chip_name);
4161 codec->chip_name = kstrdup(name, GFP_KERNEL);
4162 if (!codec->chip_name) {
4170 * Test configuration for debugging
4172 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4175 #ifdef CONFIG_SND_DEBUG
4176 static hda_nid_t alc880_test_dac_nids[4] = {
4177 0x02, 0x03, 0x04, 0x05
4180 static struct hda_input_mux alc880_test_capture_source = {
4189 { "Surround", 0x6 },
4193 static struct hda_channel_mode alc880_test_modes[4] = {
4200 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4201 struct snd_ctl_elem_info *uinfo)
4203 static char *texts[] = {
4204 "N/A", "Line Out", "HP Out",
4205 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4207 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4209 uinfo->value.enumerated.items = 8;
4210 if (uinfo->value.enumerated.item >= 8)
4211 uinfo->value.enumerated.item = 7;
4212 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4216 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4217 struct snd_ctl_elem_value *ucontrol)
4219 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4220 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4221 unsigned int pin_ctl, item = 0;
4223 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4224 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4225 if (pin_ctl & AC_PINCTL_OUT_EN) {
4226 if (pin_ctl & AC_PINCTL_HP_EN)
4230 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4231 switch (pin_ctl & AC_PINCTL_VREFEN) {
4232 case AC_PINCTL_VREF_HIZ: item = 3; break;
4233 case AC_PINCTL_VREF_50: item = 4; break;
4234 case AC_PINCTL_VREF_GRD: item = 5; break;
4235 case AC_PINCTL_VREF_80: item = 6; break;
4236 case AC_PINCTL_VREF_100: item = 7; break;
4239 ucontrol->value.enumerated.item[0] = item;
4243 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4244 struct snd_ctl_elem_value *ucontrol)
4246 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4247 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4248 static unsigned int ctls[] = {
4249 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4250 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4251 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4252 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4253 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4254 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4256 unsigned int old_ctl, new_ctl;
4258 old_ctl = snd_hda_codec_read(codec, nid, 0,
4259 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4260 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4261 if (old_ctl != new_ctl) {
4263 snd_hda_codec_write_cache(codec, nid, 0,
4264 AC_VERB_SET_PIN_WIDGET_CONTROL,
4266 val = ucontrol->value.enumerated.item[0] >= 3 ?
4268 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4275 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4276 struct snd_ctl_elem_info *uinfo)
4278 static char *texts[] = {
4279 "Front", "Surround", "CLFE", "Side"
4281 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4283 uinfo->value.enumerated.items = 4;
4284 if (uinfo->value.enumerated.item >= 4)
4285 uinfo->value.enumerated.item = 3;
4286 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4290 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4291 struct snd_ctl_elem_value *ucontrol)
4293 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4294 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4297 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4298 ucontrol->value.enumerated.item[0] = sel & 3;
4302 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4303 struct snd_ctl_elem_value *ucontrol)
4305 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4306 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4309 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4310 if (ucontrol->value.enumerated.item[0] != sel) {
4311 sel = ucontrol->value.enumerated.item[0] & 3;
4312 snd_hda_codec_write_cache(codec, nid, 0,
4313 AC_VERB_SET_CONNECT_SEL, sel);
4319 #define PIN_CTL_TEST(xname,nid) { \
4320 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4322 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4323 .info = alc_test_pin_ctl_info, \
4324 .get = alc_test_pin_ctl_get, \
4325 .put = alc_test_pin_ctl_put, \
4326 .private_value = nid \
4329 #define PIN_SRC_TEST(xname,nid) { \
4330 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4332 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4333 .info = alc_test_pin_src_info, \
4334 .get = alc_test_pin_src_get, \
4335 .put = alc_test_pin_src_put, \
4336 .private_value = nid \
4339 static struct snd_kcontrol_new alc880_test_mixer[] = {
4340 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4341 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4342 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4343 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4344 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4345 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4346 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4347 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4348 PIN_CTL_TEST("Front Pin Mode", 0x14),
4349 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4350 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4351 PIN_CTL_TEST("Side Pin Mode", 0x17),
4352 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4353 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4354 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4355 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4356 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4357 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4358 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4359 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4360 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4361 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4362 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4363 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4364 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4365 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4366 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4367 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4368 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4369 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4372 .name = "Channel Mode",
4373 .info = alc_ch_mode_info,
4374 .get = alc_ch_mode_get,
4375 .put = alc_ch_mode_put,
4380 static struct hda_verb alc880_test_init_verbs[] = {
4381 /* Unmute inputs of 0x0c - 0x0f */
4382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4384 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4385 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4386 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4387 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4388 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4389 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4390 /* Vol output for 0x0c-0x0f */
4391 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4392 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4393 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4394 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4395 /* Set output pins 0x14-0x17 */
4396 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4397 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4398 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4399 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4400 /* Unmute output pins 0x14-0x17 */
4401 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4402 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4403 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4404 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4405 /* Set input pins 0x18-0x1c */
4406 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4407 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4408 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4409 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4410 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4411 /* Mute input pins 0x18-0x1b */
4412 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4413 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4414 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4415 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4418 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4419 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4420 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4421 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4422 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4423 /* Analog input/passthru */
4424 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4425 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4426 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4427 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4428 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4436 static const char *alc880_models[ALC880_MODEL_LAST] = {
4437 [ALC880_3ST] = "3stack",
4438 [ALC880_TCL_S700] = "tcl",
4439 [ALC880_3ST_DIG] = "3stack-digout",
4440 [ALC880_CLEVO] = "clevo",
4441 [ALC880_5ST] = "5stack",
4442 [ALC880_5ST_DIG] = "5stack-digout",
4443 [ALC880_W810] = "w810",
4444 [ALC880_Z71V] = "z71v",
4445 [ALC880_6ST] = "6stack",
4446 [ALC880_6ST_DIG] = "6stack-digout",
4447 [ALC880_ASUS] = "asus",
4448 [ALC880_ASUS_W1V] = "asus-w1v",
4449 [ALC880_ASUS_DIG] = "asus-dig",
4450 [ALC880_ASUS_DIG2] = "asus-dig2",
4451 [ALC880_UNIWILL_DIG] = "uniwill",
4452 [ALC880_UNIWILL_P53] = "uniwill-p53",
4453 [ALC880_FUJITSU] = "fujitsu",
4454 [ALC880_F1734] = "F1734",
4456 [ALC880_LG_LW] = "lg-lw",
4457 [ALC880_MEDION_RIM] = "medion",
4458 #ifdef CONFIG_SND_DEBUG
4459 [ALC880_TEST] = "test",
4461 [ALC880_AUTO] = "auto",
4464 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4465 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4466 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4467 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4468 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4469 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4470 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4471 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4472 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4473 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4474 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4475 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4476 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4477 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4478 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4479 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4480 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4481 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4482 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4483 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4484 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4485 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4486 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4487 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4488 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4489 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4490 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4491 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4492 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4493 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4494 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4495 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4496 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4497 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4498 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4499 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4500 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4501 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4502 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4503 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4504 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4505 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4506 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4507 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4508 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4509 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4510 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4511 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4512 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4513 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4514 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4515 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4516 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4517 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4518 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4519 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4520 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4521 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4522 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4523 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4524 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4525 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4526 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4527 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4528 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4529 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4530 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4531 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4532 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4534 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4535 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4536 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4541 * ALC880 codec presets
4543 static struct alc_config_preset alc880_presets[] = {
4545 .mixers = { alc880_three_stack_mixer },
4546 .init_verbs = { alc880_volume_init_verbs,
4547 alc880_pin_3stack_init_verbs },
4548 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4549 .dac_nids = alc880_dac_nids,
4550 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4551 .channel_mode = alc880_threestack_modes,
4553 .input_mux = &alc880_capture_source,
4555 [ALC880_3ST_DIG] = {
4556 .mixers = { alc880_three_stack_mixer },
4557 .init_verbs = { alc880_volume_init_verbs,
4558 alc880_pin_3stack_init_verbs },
4559 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4560 .dac_nids = alc880_dac_nids,
4561 .dig_out_nid = ALC880_DIGOUT_NID,
4562 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4563 .channel_mode = alc880_threestack_modes,
4565 .input_mux = &alc880_capture_source,
4567 [ALC880_TCL_S700] = {
4568 .mixers = { alc880_tcl_s700_mixer },
4569 .init_verbs = { alc880_volume_init_verbs,
4570 alc880_pin_tcl_S700_init_verbs,
4571 alc880_gpio2_init_verbs },
4572 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4573 .dac_nids = alc880_dac_nids,
4574 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4575 .num_adc_nids = 1, /* single ADC */
4577 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4578 .channel_mode = alc880_2_jack_modes,
4579 .input_mux = &alc880_capture_source,
4582 .mixers = { alc880_three_stack_mixer,
4583 alc880_five_stack_mixer},
4584 .init_verbs = { alc880_volume_init_verbs,
4585 alc880_pin_5stack_init_verbs },
4586 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4587 .dac_nids = alc880_dac_nids,
4588 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4589 .channel_mode = alc880_fivestack_modes,
4590 .input_mux = &alc880_capture_source,
4592 [ALC880_5ST_DIG] = {
4593 .mixers = { alc880_three_stack_mixer,
4594 alc880_five_stack_mixer },
4595 .init_verbs = { alc880_volume_init_verbs,
4596 alc880_pin_5stack_init_verbs },
4597 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4598 .dac_nids = alc880_dac_nids,
4599 .dig_out_nid = ALC880_DIGOUT_NID,
4600 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4601 .channel_mode = alc880_fivestack_modes,
4602 .input_mux = &alc880_capture_source,
4605 .mixers = { alc880_six_stack_mixer },
4606 .init_verbs = { alc880_volume_init_verbs,
4607 alc880_pin_6stack_init_verbs },
4608 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4609 .dac_nids = alc880_6st_dac_nids,
4610 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4611 .channel_mode = alc880_sixstack_modes,
4612 .input_mux = &alc880_6stack_capture_source,
4614 [ALC880_6ST_DIG] = {
4615 .mixers = { alc880_six_stack_mixer },
4616 .init_verbs = { alc880_volume_init_verbs,
4617 alc880_pin_6stack_init_verbs },
4618 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4619 .dac_nids = alc880_6st_dac_nids,
4620 .dig_out_nid = ALC880_DIGOUT_NID,
4621 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4622 .channel_mode = alc880_sixstack_modes,
4623 .input_mux = &alc880_6stack_capture_source,
4626 .mixers = { alc880_w810_base_mixer },
4627 .init_verbs = { alc880_volume_init_verbs,
4628 alc880_pin_w810_init_verbs,
4629 alc880_gpio2_init_verbs },
4630 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4631 .dac_nids = alc880_w810_dac_nids,
4632 .dig_out_nid = ALC880_DIGOUT_NID,
4633 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4634 .channel_mode = alc880_w810_modes,
4635 .input_mux = &alc880_capture_source,
4638 .mixers = { alc880_z71v_mixer },
4639 .init_verbs = { alc880_volume_init_verbs,
4640 alc880_pin_z71v_init_verbs },
4641 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4642 .dac_nids = alc880_z71v_dac_nids,
4643 .dig_out_nid = ALC880_DIGOUT_NID,
4645 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4646 .channel_mode = alc880_2_jack_modes,
4647 .input_mux = &alc880_capture_source,
4650 .mixers = { alc880_f1734_mixer },
4651 .init_verbs = { alc880_volume_init_verbs,
4652 alc880_pin_f1734_init_verbs },
4653 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4654 .dac_nids = alc880_f1734_dac_nids,
4656 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4657 .channel_mode = alc880_2_jack_modes,
4658 .input_mux = &alc880_f1734_capture_source,
4659 .unsol_event = alc880_uniwill_p53_unsol_event,
4660 .setup = alc880_uniwill_p53_setup,
4661 .init_hook = alc_automute_amp,
4664 .mixers = { alc880_asus_mixer },
4665 .init_verbs = { alc880_volume_init_verbs,
4666 alc880_pin_asus_init_verbs,
4667 alc880_gpio1_init_verbs },
4668 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4669 .dac_nids = alc880_asus_dac_nids,
4670 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4671 .channel_mode = alc880_asus_modes,
4673 .input_mux = &alc880_capture_source,
4675 [ALC880_ASUS_DIG] = {
4676 .mixers = { alc880_asus_mixer },
4677 .init_verbs = { alc880_volume_init_verbs,
4678 alc880_pin_asus_init_verbs,
4679 alc880_gpio1_init_verbs },
4680 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4681 .dac_nids = alc880_asus_dac_nids,
4682 .dig_out_nid = ALC880_DIGOUT_NID,
4683 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4684 .channel_mode = alc880_asus_modes,
4686 .input_mux = &alc880_capture_source,
4688 [ALC880_ASUS_DIG2] = {
4689 .mixers = { alc880_asus_mixer },
4690 .init_verbs = { alc880_volume_init_verbs,
4691 alc880_pin_asus_init_verbs,
4692 alc880_gpio2_init_verbs }, /* use GPIO2 */
4693 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4694 .dac_nids = alc880_asus_dac_nids,
4695 .dig_out_nid = ALC880_DIGOUT_NID,
4696 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4697 .channel_mode = alc880_asus_modes,
4699 .input_mux = &alc880_capture_source,
4701 [ALC880_ASUS_W1V] = {
4702 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4703 .init_verbs = { alc880_volume_init_verbs,
4704 alc880_pin_asus_init_verbs,
4705 alc880_gpio1_init_verbs },
4706 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4707 .dac_nids = alc880_asus_dac_nids,
4708 .dig_out_nid = ALC880_DIGOUT_NID,
4709 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4710 .channel_mode = alc880_asus_modes,
4712 .input_mux = &alc880_capture_source,
4714 [ALC880_UNIWILL_DIG] = {
4715 .mixers = { alc880_asus_mixer },
4716 .init_verbs = { alc880_volume_init_verbs,
4717 alc880_pin_asus_init_verbs },
4718 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4719 .dac_nids = alc880_asus_dac_nids,
4720 .dig_out_nid = ALC880_DIGOUT_NID,
4721 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4722 .channel_mode = alc880_asus_modes,
4724 .input_mux = &alc880_capture_source,
4726 [ALC880_UNIWILL] = {
4727 .mixers = { alc880_uniwill_mixer },
4728 .init_verbs = { alc880_volume_init_verbs,
4729 alc880_uniwill_init_verbs },
4730 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4731 .dac_nids = alc880_asus_dac_nids,
4732 .dig_out_nid = ALC880_DIGOUT_NID,
4733 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4734 .channel_mode = alc880_threestack_modes,
4736 .input_mux = &alc880_capture_source,
4737 .unsol_event = alc880_uniwill_unsol_event,
4738 .setup = alc880_uniwill_setup,
4739 .init_hook = alc880_uniwill_init_hook,
4741 [ALC880_UNIWILL_P53] = {
4742 .mixers = { alc880_uniwill_p53_mixer },
4743 .init_verbs = { alc880_volume_init_verbs,
4744 alc880_uniwill_p53_init_verbs },
4745 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4746 .dac_nids = alc880_asus_dac_nids,
4747 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4748 .channel_mode = alc880_threestack_modes,
4749 .input_mux = &alc880_capture_source,
4750 .unsol_event = alc880_uniwill_p53_unsol_event,
4751 .setup = alc880_uniwill_p53_setup,
4752 .init_hook = alc_automute_amp,
4754 [ALC880_FUJITSU] = {
4755 .mixers = { alc880_fujitsu_mixer },
4756 .init_verbs = { alc880_volume_init_verbs,
4757 alc880_uniwill_p53_init_verbs,
4758 alc880_beep_init_verbs },
4759 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4760 .dac_nids = alc880_dac_nids,
4761 .dig_out_nid = ALC880_DIGOUT_NID,
4762 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4763 .channel_mode = alc880_2_jack_modes,
4764 .input_mux = &alc880_capture_source,
4765 .unsol_event = alc880_uniwill_p53_unsol_event,
4766 .setup = alc880_uniwill_p53_setup,
4767 .init_hook = alc_automute_amp,
4770 .mixers = { alc880_three_stack_mixer },
4771 .init_verbs = { alc880_volume_init_verbs,
4772 alc880_pin_clevo_init_verbs },
4773 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4774 .dac_nids = alc880_dac_nids,
4776 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4777 .channel_mode = alc880_threestack_modes,
4779 .input_mux = &alc880_capture_source,
4782 .mixers = { alc880_lg_mixer },
4783 .init_verbs = { alc880_volume_init_verbs,
4784 alc880_lg_init_verbs },
4785 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4786 .dac_nids = alc880_lg_dac_nids,
4787 .dig_out_nid = ALC880_DIGOUT_NID,
4788 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4789 .channel_mode = alc880_lg_ch_modes,
4791 .input_mux = &alc880_lg_capture_source,
4792 .unsol_event = alc_automute_amp_unsol_event,
4793 .setup = alc880_lg_setup,
4794 .init_hook = alc_automute_amp,
4795 #ifdef CONFIG_SND_HDA_POWER_SAVE
4796 .loopbacks = alc880_lg_loopbacks,
4800 .mixers = { alc880_lg_lw_mixer },
4801 .init_verbs = { alc880_volume_init_verbs,
4802 alc880_lg_lw_init_verbs },
4803 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4804 .dac_nids = alc880_dac_nids,
4805 .dig_out_nid = ALC880_DIGOUT_NID,
4806 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4807 .channel_mode = alc880_lg_lw_modes,
4808 .input_mux = &alc880_lg_lw_capture_source,
4809 .unsol_event = alc_automute_amp_unsol_event,
4810 .setup = alc880_lg_lw_setup,
4811 .init_hook = alc_automute_amp,
4813 [ALC880_MEDION_RIM] = {
4814 .mixers = { alc880_medion_rim_mixer },
4815 .init_verbs = { alc880_volume_init_verbs,
4816 alc880_medion_rim_init_verbs,
4817 alc_gpio2_init_verbs },
4818 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4819 .dac_nids = alc880_dac_nids,
4820 .dig_out_nid = ALC880_DIGOUT_NID,
4821 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4822 .channel_mode = alc880_2_jack_modes,
4823 .input_mux = &alc880_medion_rim_capture_source,
4824 .unsol_event = alc880_medion_rim_unsol_event,
4825 .setup = alc880_medion_rim_setup,
4826 .init_hook = alc880_medion_rim_automute,
4828 #ifdef CONFIG_SND_DEBUG
4830 .mixers = { alc880_test_mixer },
4831 .init_verbs = { alc880_test_init_verbs },
4832 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4833 .dac_nids = alc880_test_dac_nids,
4834 .dig_out_nid = ALC880_DIGOUT_NID,
4835 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4836 .channel_mode = alc880_test_modes,
4837 .input_mux = &alc880_test_capture_source,
4843 * Automatic parse of I/O pins from the BIOS configuration
4848 ALC_CTL_WIDGET_MUTE,
4851 static struct snd_kcontrol_new alc880_control_templates[] = {
4852 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4853 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4854 HDA_BIND_MUTE(NULL, 0, 0, 0),
4857 /* add dynamic controls */
4858 static int add_control(struct alc_spec *spec, int type, const char *name,
4859 int cidx, unsigned long val)
4861 struct snd_kcontrol_new *knew;
4863 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4864 knew = snd_array_new(&spec->kctls);
4867 *knew = alc880_control_templates[type];
4868 knew->name = kstrdup(name, GFP_KERNEL);
4872 if (get_amp_nid_(val))
4873 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4874 knew->private_value = val;
4878 static int add_control_with_pfx(struct alc_spec *spec, int type,
4879 const char *pfx, const char *dir,
4880 const char *sfx, int cidx, unsigned long val)
4883 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4884 return add_control(spec, type, name, cidx, val);
4887 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4888 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
4889 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4890 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
4891 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
4892 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
4893 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
4894 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
4896 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4897 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4898 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4899 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4900 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4901 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4902 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4903 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4904 #define ALC880_PIN_CD_NID 0x1c
4906 /* fill in the dac_nids table from the parsed pin configuration */
4907 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4908 const struct auto_pin_cfg *cfg)
4914 memset(assigned, 0, sizeof(assigned));
4915 spec->multiout.dac_nids = spec->private_dac_nids;
4917 /* check the pins hardwired to audio widget */
4918 for (i = 0; i < cfg->line_outs; i++) {
4919 nid = cfg->line_out_pins[i];
4920 if (alc880_is_fixed_pin(nid)) {
4921 int idx = alc880_fixed_pin_idx(nid);
4922 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4926 /* left pins can be connect to any audio widget */
4927 for (i = 0; i < cfg->line_outs; i++) {
4928 nid = cfg->line_out_pins[i];
4929 if (alc880_is_fixed_pin(nid))
4931 /* search for an empty channel */
4932 for (j = 0; j < cfg->line_outs; j++) {
4934 spec->multiout.dac_nids[i] =
4935 alc880_idx_to_dac(j);
4941 spec->multiout.num_dacs = cfg->line_outs;
4945 /* add playback controls from the parsed DAC table */
4946 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4947 const struct auto_pin_cfg *cfg)
4949 static const char *chname[4] = {
4950 "Front", "Surround", NULL /*CLFE*/, "Side"
4955 for (i = 0; i < cfg->line_outs; i++) {
4956 if (!spec->multiout.dac_nids[i])
4958 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4961 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4963 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4967 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4969 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4973 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4975 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4979 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4981 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4987 if (cfg->line_outs == 1 &&
4988 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4992 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4993 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4997 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4998 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5007 /* add playback controls for speaker and HP outputs */
5008 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5017 if (alc880_is_fixed_pin(pin)) {
5018 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5019 /* specify the DAC as the extra output */
5020 if (!spec->multiout.hp_nid)
5021 spec->multiout.hp_nid = nid;
5023 spec->multiout.extra_out_nid[0] = nid;
5024 /* control HP volume/switch on the output mixer amp */
5025 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5026 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5027 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5030 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5031 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5034 } else if (alc880_is_multi_pin(pin)) {
5035 /* set manual connection */
5036 /* we have only a switch on HP-out PIN */
5037 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5038 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5045 /* create input playback/capture controls for the given pin */
5046 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5047 const char *ctlname, int ctlidx,
5048 int idx, hda_nid_t mix_nid)
5052 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5053 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5056 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5057 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5063 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5065 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5066 return (pincap & AC_PINCAP_IN) != 0;
5069 /* create playback/capture controls for input pins */
5070 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5071 const struct auto_pin_cfg *cfg,
5073 hda_nid_t cap1, hda_nid_t cap2)
5075 struct alc_spec *spec = codec->spec;
5076 struct hda_input_mux *imux = &spec->private_imux[0];
5077 int i, err, idx, type, type_idx = 0;
5079 for (i = 0; i < cfg->num_inputs; i++) {
5083 pin = cfg->inputs[i].pin;
5084 if (!alc_is_input_pin(codec, pin))
5087 type = cfg->inputs[i].type;
5088 if (i > 0 && type == cfg->inputs[i - 1].type)
5092 label = hda_get_autocfg_input_label(codec, cfg, i);
5094 idx = get_connection_index(codec, mixer, pin);
5096 err = new_analog_input(spec, pin,
5106 idx = get_connection_index(codec, cap1, pin);
5107 if (idx < 0 && cap2)
5108 idx = get_connection_index(codec, cap2, pin);
5110 snd_hda_add_imux_item(imux, label, idx, NULL);
5115 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5116 const struct auto_pin_cfg *cfg)
5118 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5121 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5122 unsigned int pin_type)
5124 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5127 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5131 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5132 hda_nid_t nid, int pin_type,
5135 alc_set_pin_output(codec, nid, pin_type);
5136 /* need the manual connection? */
5137 if (alc880_is_multi_pin(nid)) {
5138 struct alc_spec *spec = codec->spec;
5139 int idx = alc880_multi_pin_idx(nid);
5140 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5141 AC_VERB_SET_CONNECT_SEL,
5142 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5146 static int get_pin_type(int line_out_type)
5148 if (line_out_type == AUTO_PIN_HP_OUT)
5154 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5156 struct alc_spec *spec = codec->spec;
5159 for (i = 0; i < spec->autocfg.line_outs; i++) {
5160 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5161 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5162 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5166 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5168 struct alc_spec *spec = codec->spec;
5171 pin = spec->autocfg.speaker_pins[0];
5172 if (pin) /* connect to front */
5173 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5174 pin = spec->autocfg.hp_pins[0];
5175 if (pin) /* connect to front */
5176 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5179 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5181 struct alc_spec *spec = codec->spec;
5182 struct auto_pin_cfg *cfg = &spec->autocfg;
5185 for (i = 0; i < cfg->num_inputs; i++) {
5186 hda_nid_t nid = cfg->inputs[i].pin;
5187 if (alc_is_input_pin(codec, nid)) {
5188 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5189 if (nid != ALC880_PIN_CD_NID &&
5190 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5191 snd_hda_codec_write(codec, nid, 0,
5192 AC_VERB_SET_AMP_GAIN_MUTE,
5198 static void alc880_auto_init_input_src(struct hda_codec *codec)
5200 struct alc_spec *spec = codec->spec;
5203 for (c = 0; c < spec->num_adc_nids; c++) {
5204 unsigned int mux_idx;
5205 const struct hda_input_mux *imux;
5206 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5207 imux = &spec->input_mux[mux_idx];
5208 if (!imux->num_items && mux_idx > 0)
5209 imux = &spec->input_mux[0];
5211 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5212 AC_VERB_SET_CONNECT_SEL,
5213 imux->items[0].index);
5217 /* parse the BIOS configuration and set up the alc_spec */
5218 /* return 1 if successful, 0 if the proper config is not found,
5219 * or a negative error code
5221 static int alc880_parse_auto_config(struct hda_codec *codec)
5223 struct alc_spec *spec = codec->spec;
5225 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5227 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5231 if (!spec->autocfg.line_outs)
5232 return 0; /* can't find valid BIOS pin config */
5234 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5237 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5240 err = alc880_auto_create_extra_out(spec,
5241 spec->autocfg.speaker_pins[0],
5245 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5249 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5253 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5255 alc_auto_parse_digital(codec);
5257 if (spec->kctls.list)
5258 add_mixer(spec, spec->kctls.list);
5260 add_verb(spec, alc880_volume_init_verbs);
5262 spec->num_mux_defs = 1;
5263 spec->input_mux = &spec->private_imux[0];
5265 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5270 /* additional initialization for auto-configuration model */
5271 static void alc880_auto_init(struct hda_codec *codec)
5273 struct alc_spec *spec = codec->spec;
5274 alc880_auto_init_multi_out(codec);
5275 alc880_auto_init_extra_out(codec);
5276 alc880_auto_init_analog_input(codec);
5277 alc880_auto_init_input_src(codec);
5278 alc_auto_init_digital(codec);
5279 if (spec->unsol_event)
5280 alc_inithook(codec);
5283 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5284 * one of two digital mic pins, e.g. on ALC272
5286 static void fixup_automic_adc(struct hda_codec *codec)
5288 struct alc_spec *spec = codec->spec;
5291 for (i = 0; i < spec->num_adc_nids; i++) {
5292 hda_nid_t cap = spec->capsrc_nids ?
5293 spec->capsrc_nids[i] : spec->adc_nids[i];
5296 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5299 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5302 spec->int_mic.mux_idx = iidx;
5303 spec->ext_mic.mux_idx = eidx;
5304 if (spec->capsrc_nids)
5305 spec->capsrc_nids += i;
5306 spec->adc_nids += i;
5307 spec->num_adc_nids = 1;
5310 snd_printd(KERN_INFO "hda_codec: %s: "
5311 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5312 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5313 spec->auto_mic = 0; /* disable auto-mic to be sure */
5316 /* select or unmute the given capsrc route */
5317 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5320 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5321 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5324 snd_hda_codec_write_cache(codec, cap, 0,
5325 AC_VERB_SET_CONNECT_SEL, idx);
5329 /* set the default connection to that pin */
5330 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5332 struct alc_spec *spec = codec->spec;
5335 for (i = 0; i < spec->num_adc_nids; i++) {
5336 hda_nid_t cap = spec->capsrc_nids ?
5337 spec->capsrc_nids[i] : spec->adc_nids[i];
5340 idx = get_connection_index(codec, cap, pin);
5343 select_or_unmute_capsrc(codec, cap, idx);
5344 return i; /* return the found index */
5346 return -1; /* not found */
5349 /* choose the ADC/MUX containing the input pin and initialize the setup */
5350 static void fixup_single_adc(struct hda_codec *codec)
5352 struct alc_spec *spec = codec->spec;
5353 struct auto_pin_cfg *cfg = &spec->autocfg;
5356 /* search for the input pin; there must be only one */
5357 if (cfg->num_inputs != 1)
5359 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5361 /* use only this ADC */
5362 if (spec->capsrc_nids)
5363 spec->capsrc_nids += i;
5364 spec->adc_nids += i;
5365 spec->num_adc_nids = 1;
5369 /* initialize dual adcs */
5370 static void fixup_dual_adc_switch(struct hda_codec *codec)
5372 struct alc_spec *spec = codec->spec;
5373 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5374 init_capsrc_for_pin(codec, spec->int_mic.pin);
5377 static void set_capture_mixer(struct hda_codec *codec)
5379 struct alc_spec *spec = codec->spec;
5380 static struct snd_kcontrol_new *caps[2][3] = {
5381 { alc_capture_mixer_nosrc1,
5382 alc_capture_mixer_nosrc2,
5383 alc_capture_mixer_nosrc3 },
5384 { alc_capture_mixer1,
5386 alc_capture_mixer3 },
5388 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5390 int num_adcs = spec->num_adc_nids;
5391 if (spec->dual_adc_switch)
5392 fixup_dual_adc_switch(codec);
5393 else if (spec->auto_mic)
5394 fixup_automic_adc(codec);
5395 else if (spec->input_mux) {
5396 if (spec->input_mux->num_items > 1)
5398 else if (spec->input_mux->num_items == 1)
5399 fixup_single_adc(codec);
5401 if (spec->dual_adc_switch)
5403 spec->cap_mixer = caps[mux][num_adcs - 1];
5407 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5408 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5411 struct alc_spec *spec = codec->spec;
5412 struct auto_pin_cfg *cfg = &spec->autocfg;
5414 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5416 for (n = 0; n < num_nids; n++) {
5418 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5422 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5425 nconns = snd_hda_get_connections(codec, cap, conn,
5429 nconns = snd_hda_get_connections(codec, cap, conn,
5434 if (!fallback_adc) {
5438 for (i = 0; i < cfg->num_inputs; i++) {
5439 hda_nid_t nid = cfg->inputs[i].pin;
5440 for (j = 0; j < nconns; j++) {
5447 if (i >= cfg->num_inputs) {
5448 int num_adcs = spec->num_adc_nids;
5449 spec->private_adc_nids[num_adcs] = adc;
5450 spec->private_capsrc_nids[num_adcs] = cap;
5451 spec->num_adc_nids++;
5452 spec->adc_nids = spec->private_adc_nids;
5454 spec->capsrc_nids = spec->private_capsrc_nids;
5457 if (!spec->num_adc_nids) {
5458 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5459 " using fallback 0x%x\n",
5460 codec->chip_name, fallback_adc);
5461 spec->private_adc_nids[0] = fallback_adc;
5462 spec->adc_nids = spec->private_adc_nids;
5463 if (fallback_adc != fallback_cap) {
5464 spec->private_capsrc_nids[0] = fallback_cap;
5465 spec->capsrc_nids = spec->private_adc_nids;
5470 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5471 #define set_beep_amp(spec, nid, idx, dir) \
5472 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5474 static struct snd_pci_quirk beep_white_list[] = {
5475 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5476 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5477 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5481 static inline int has_cdefine_beep(struct hda_codec *codec)
5483 struct alc_spec *spec = codec->spec;
5484 const struct snd_pci_quirk *q;
5485 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5488 return spec->cdefine.enable_pcbeep;
5491 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5492 #define has_cdefine_beep(codec) 0
5496 * OK, here we have finally the patch for ALC880
5499 static int patch_alc880(struct hda_codec *codec)
5501 struct alc_spec *spec;
5505 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5511 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5514 if (board_config < 0) {
5515 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5517 board_config = ALC880_AUTO;
5520 if (board_config == ALC880_AUTO) {
5521 /* automatic parse from the BIOS config */
5522 err = alc880_parse_auto_config(codec);
5528 "hda_codec: Cannot set up configuration "
5529 "from BIOS. Using 3-stack mode...\n");
5530 board_config = ALC880_3ST;
5534 err = snd_hda_attach_beep_device(codec, 0x1);
5540 if (board_config != ALC880_AUTO)
5541 setup_preset(codec, &alc880_presets[board_config]);
5543 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5544 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5545 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5547 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5548 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5550 if (!spec->adc_nids && spec->input_mux) {
5551 /* check whether NID 0x07 is valid */
5552 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5554 wcap = get_wcaps_type(wcap);
5555 if (wcap != AC_WID_AUD_IN) {
5556 spec->adc_nids = alc880_adc_nids_alt;
5557 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5559 spec->adc_nids = alc880_adc_nids;
5560 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5563 set_capture_mixer(codec);
5564 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5566 spec->vmaster_nid = 0x0c;
5568 codec->patch_ops = alc_patch_ops;
5569 if (board_config == ALC880_AUTO)
5570 spec->init_hook = alc880_auto_init;
5571 #ifdef CONFIG_SND_HDA_POWER_SAVE
5572 if (!spec->loopback.amplist)
5573 spec->loopback.amplist = alc880_loopbacks;
5584 static hda_nid_t alc260_dac_nids[1] = {
5589 static hda_nid_t alc260_adc_nids[1] = {
5594 static hda_nid_t alc260_adc_nids_alt[1] = {
5599 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5600 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5602 static hda_nid_t alc260_dual_adc_nids[2] = {
5607 #define ALC260_DIGOUT_NID 0x03
5608 #define ALC260_DIGIN_NID 0x06
5610 static struct hda_input_mux alc260_capture_source = {
5614 { "Front Mic", 0x1 },
5620 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5621 * headphone jack and the internal CD lines since these are the only pins at
5622 * which audio can appear. For flexibility, also allow the option of
5623 * recording the mixer output on the second ADC (ADC0 doesn't have a
5624 * connection to the mixer output).
5626 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5630 { "Mic/Line", 0x0 },
5632 { "Headphone", 0x2 },
5638 { "Mic/Line", 0x0 },
5640 { "Headphone", 0x2 },
5647 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5648 * the Fujitsu S702x, but jacks are marked differently.
5650 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5657 { "Headphone", 0x5 },
5666 { "Headphone", 0x6 },
5672 /* Maxdata Favorit 100XS */
5673 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5677 { "Line/Mic", 0x0 },
5684 { "Line/Mic", 0x0 },
5692 * This is just place-holder, so there's something for alc_build_pcms to look
5693 * at when it calculates the maximum number of channels. ALC260 has no mixer
5694 * element which allows changing the channel mode, so the verb list is
5697 static struct hda_channel_mode alc260_modes[1] = {
5702 /* Mixer combinations
5704 * basic: base_output + input + pc_beep + capture
5705 * HP: base_output + input + capture_alt
5706 * HP_3013: hp_3013 + input + capture
5707 * fujitsu: fujitsu + capture
5708 * acer: acer + capture
5711 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5712 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5713 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5714 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5715 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5716 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5717 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5721 static struct snd_kcontrol_new alc260_input_mixer[] = {
5722 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5723 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5724 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5725 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5726 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5727 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5728 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5729 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5733 /* update HP, line and mono out pins according to the master switch */
5734 static void alc260_hp_master_update(struct hda_codec *codec,
5735 hda_nid_t hp, hda_nid_t line,
5738 struct alc_spec *spec = codec->spec;
5739 unsigned int val = spec->master_sw ? PIN_HP : 0;
5740 /* change HP and line-out pins */
5741 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5743 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5745 /* mono (speaker) depending on the HP jack sense */
5746 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5747 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5751 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5752 struct snd_ctl_elem_value *ucontrol)
5754 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5755 struct alc_spec *spec = codec->spec;
5756 *ucontrol->value.integer.value = spec->master_sw;
5760 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5761 struct snd_ctl_elem_value *ucontrol)
5763 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5764 struct alc_spec *spec = codec->spec;
5765 int val = !!*ucontrol->value.integer.value;
5766 hda_nid_t hp, line, mono;
5768 if (val == spec->master_sw)
5770 spec->master_sw = val;
5771 hp = (kcontrol->private_value >> 16) & 0xff;
5772 line = (kcontrol->private_value >> 8) & 0xff;
5773 mono = kcontrol->private_value & 0xff;
5774 alc260_hp_master_update(codec, hp, line, mono);
5778 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5780 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5781 .name = "Master Playback Switch",
5782 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5783 .info = snd_ctl_boolean_mono_info,
5784 .get = alc260_hp_master_sw_get,
5785 .put = alc260_hp_master_sw_put,
5786 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5788 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5789 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5790 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5791 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5792 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5794 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5798 static struct hda_verb alc260_hp_unsol_verbs[] = {
5799 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5803 static void alc260_hp_automute(struct hda_codec *codec)
5805 struct alc_spec *spec = codec->spec;
5807 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5808 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5811 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5813 if ((res >> 26) == ALC880_HP_EVENT)
5814 alc260_hp_automute(codec);
5817 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5819 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5820 .name = "Master Playback Switch",
5821 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5822 .info = snd_ctl_boolean_mono_info,
5823 .get = alc260_hp_master_sw_get,
5824 .put = alc260_hp_master_sw_put,
5825 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5827 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5828 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5829 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5830 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5831 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5832 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5833 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5834 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5838 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5839 .ops = &snd_hda_bind_vol,
5841 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5842 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5843 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5848 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5849 .ops = &snd_hda_bind_sw,
5851 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5852 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5857 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5858 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5859 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5860 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5865 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5866 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5870 static void alc260_hp_3013_automute(struct hda_codec *codec)
5872 struct alc_spec *spec = codec->spec;
5874 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5875 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5878 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5881 if ((res >> 26) == ALC880_HP_EVENT)
5882 alc260_hp_3013_automute(codec);
5885 static void alc260_hp_3012_automute(struct hda_codec *codec)
5887 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5889 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5891 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5893 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5897 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5900 if ((res >> 26) == ALC880_HP_EVENT)
5901 alc260_hp_3012_automute(codec);
5904 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5905 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5907 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5908 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5909 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5910 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5911 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5912 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5913 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5914 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5915 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5916 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5917 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5921 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5922 * versions of the ALC260 don't act on requests to enable mic bias from NID
5923 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5924 * datasheet doesn't mention this restriction. At this stage it's not clear
5925 * whether this behaviour is intentional or is a hardware bug in chip
5926 * revisions available in early 2006. Therefore for now allow the
5927 * "Headphone Jack Mode" control to span all choices, but if it turns out
5928 * that the lack of mic bias for this NID is intentional we could change the
5929 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5931 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5932 * don't appear to make the mic bias available from the "line" jack, even
5933 * though the NID used for this jack (0x14) can supply it. The theory is
5934 * that perhaps Acer have included blocking capacitors between the ALC260
5935 * and the output jack. If this turns out to be the case for all such
5936 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5937 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5939 * The C20x Tablet series have a mono internal speaker which is controlled
5940 * via the chip's Mono sum widget and pin complex, so include the necessary
5941 * controls for such models. On models without a "mono speaker" the control
5942 * won't do anything.
5944 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5945 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5946 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5947 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5948 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5950 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5952 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5953 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5954 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5955 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5956 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5957 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5958 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5959 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5963 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5965 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5966 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5967 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5968 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5969 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5970 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5971 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5975 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5976 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5978 static struct snd_kcontrol_new alc260_will_mixer[] = {
5979 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5980 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5981 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5982 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5983 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5984 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5985 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5986 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5987 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5988 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5992 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5993 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5995 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5996 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5997 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5998 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5999 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6000 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6001 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6002 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6003 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6004 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6005 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6010 * initialization verbs
6012 static struct hda_verb alc260_init_verbs[] = {
6013 /* Line In pin widget for input */
6014 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6015 /* CD pin widget for input */
6016 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6017 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6018 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6019 /* Mic2 (front panel) pin widget for input and vref at 80% */
6020 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6021 /* LINE-2 is used for line-out in rear */
6022 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6023 /* select line-out */
6024 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6026 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6028 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6030 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6031 /* mute capture amp left and right */
6032 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6033 /* set connection select to line in (default select for this ADC) */
6034 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6035 /* mute capture amp left and right */
6036 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6037 /* set connection select to line in (default select for this ADC) */
6038 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6039 /* set vol=0 Line-Out mixer amp left and right */
6040 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6041 /* unmute pin widget amp left and right (no gain on this amp) */
6042 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6043 /* set vol=0 HP mixer amp left and right */
6044 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6045 /* unmute pin widget amp left and right (no gain on this amp) */
6046 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6047 /* set vol=0 Mono mixer amp left and right */
6048 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6049 /* unmute pin widget amp left and right (no gain on this amp) */
6050 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6051 /* unmute LINE-2 out pin */
6052 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6053 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6056 /* mute analog inputs */
6057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6058 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6059 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6061 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6062 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6063 /* mute Front out path */
6064 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6065 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6066 /* mute Headphone out path */
6067 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6068 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6069 /* mute Mono out path */
6070 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6071 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6075 #if 0 /* should be identical with alc260_init_verbs? */
6076 static struct hda_verb alc260_hp_init_verbs[] = {
6077 /* Headphone and output */
6078 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6080 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6081 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6082 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6083 /* Mic2 (front panel) pin widget for input and vref at 80% */
6084 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6085 /* Line In pin widget for input */
6086 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6087 /* Line-2 pin widget for output */
6088 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6089 /* CD pin widget for input */
6090 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6091 /* unmute amp left and right */
6092 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6093 /* set connection select to line in (default select for this ADC) */
6094 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6095 /* unmute Line-Out mixer amp left and right (volume = 0) */
6096 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6097 /* mute pin widget amp left and right (no gain on this amp) */
6098 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6099 /* unmute HP mixer amp left and right (volume = 0) */
6100 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6101 /* mute pin widget amp left and right (no gain on this amp) */
6102 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6103 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6106 /* mute analog inputs */
6107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6112 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6113 /* Unmute Front out path */
6114 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6115 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6116 /* Unmute Headphone out path */
6117 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6118 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6119 /* Unmute Mono out path */
6120 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6121 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6126 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6127 /* Line out and output */
6128 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6130 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6131 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6132 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6133 /* Mic2 (front panel) pin widget for input and vref at 80% */
6134 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6135 /* Line In pin widget for input */
6136 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6137 /* Headphone pin widget for output */
6138 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6139 /* CD pin widget for input */
6140 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6141 /* unmute amp left and right */
6142 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6143 /* set connection select to line in (default select for this ADC) */
6144 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6145 /* unmute Line-Out mixer amp left and right (volume = 0) */
6146 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6147 /* mute pin widget amp left and right (no gain on this amp) */
6148 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6149 /* unmute HP mixer amp left and right (volume = 0) */
6150 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6151 /* mute pin widget amp left and right (no gain on this amp) */
6152 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6153 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6156 /* mute analog inputs */
6157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6159 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6161 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6162 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6163 /* Unmute Front out path */
6164 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6165 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6166 /* Unmute Headphone out path */
6167 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6168 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6169 /* Unmute Mono out path */
6170 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6171 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6175 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6176 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6177 * audio = 0x16, internal speaker = 0x10.
6179 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6180 /* Disable all GPIOs */
6181 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6182 /* Internal speaker is connected to headphone pin */
6183 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6184 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6185 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6186 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6187 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6188 /* Ensure all other unused pins are disabled and muted. */
6189 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6190 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6191 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6192 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6193 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6194 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6195 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6196 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6198 /* Disable digital (SPDIF) pins */
6199 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6200 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6202 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6203 * when acting as an output.
6205 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6207 /* Start with output sum widgets muted and their output gains at min */
6208 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6209 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6210 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6211 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6212 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6213 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6214 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6215 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6216 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6218 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6219 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6220 /* Unmute Line1 pin widget output buffer since it starts as an output.
6221 * If the pin mode is changed by the user the pin mode control will
6222 * take care of enabling the pin's input/output buffers as needed.
6223 * Therefore there's no need to enable the input buffer at this
6226 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6227 /* Unmute input buffer of pin widget used for Line-in (no equiv
6230 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6232 /* Mute capture amp left and right */
6233 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6234 /* Set ADC connection select to match default mixer setting - line
6237 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6239 /* Do the same for the second ADC: mute capture input amp and
6240 * set ADC connection to line in (on mic1 pin)
6242 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6243 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6245 /* Mute all inputs to mixer widget (even unconnected ones) */
6246 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6247 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6248 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6249 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6250 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6251 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6252 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6253 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6258 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6259 * similar laptops (adapted from Fujitsu init verbs).
6261 static struct hda_verb alc260_acer_init_verbs[] = {
6262 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6263 * the headphone jack. Turn this on and rely on the standard mute
6264 * methods whenever the user wants to turn these outputs off.
6266 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6267 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6268 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6269 /* Internal speaker/Headphone jack is connected to Line-out pin */
6270 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6271 /* Internal microphone/Mic jack is connected to Mic1 pin */
6272 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6273 /* Line In jack is connected to Line1 pin */
6274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6275 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6276 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6277 /* Ensure all other unused pins are disabled and muted. */
6278 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6279 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6280 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6281 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6284 /* Disable digital (SPDIF) pins */
6285 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6286 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6288 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6289 * bus when acting as outputs.
6291 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6292 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6294 /* Start with output sum widgets muted and their output gains at min */
6295 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6296 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6297 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6298 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6299 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6300 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6301 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6302 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6303 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6305 /* Unmute Line-out pin widget amp left and right
6306 * (no equiv mixer ctrl)
6308 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6309 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6310 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6311 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6312 * inputs. If the pin mode is changed by the user the pin mode control
6313 * will take care of enabling the pin's input/output buffers as needed.
6314 * Therefore there's no need to enable the input buffer at this
6317 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6318 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6320 /* Mute capture amp left and right */
6321 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6322 /* Set ADC connection select to match default mixer setting - mic
6325 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6327 /* Do similar with the second ADC: mute capture input amp and
6328 * set ADC connection to mic to match ALSA's default state.
6330 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6331 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6333 /* Mute all inputs to mixer widget (even unconnected ones) */
6334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6336 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6337 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6346 /* Initialisation sequence for Maxdata Favorit 100XS
6347 * (adapted from Acer init verbs).
6349 static struct hda_verb alc260_favorit100_init_verbs[] = {
6350 /* GPIO 0 enables the output jack.
6351 * Turn this on and rely on the standard mute
6352 * methods whenever the user wants to turn these outputs off.
6354 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6355 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6356 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6357 /* Line/Mic input jack is connected to Mic1 pin */
6358 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6359 /* Ensure all other unused pins are disabled and muted. */
6360 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6361 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6362 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6363 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6364 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6365 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6366 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6367 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6368 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6370 /* Disable digital (SPDIF) pins */
6371 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6372 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6374 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6375 * bus when acting as outputs.
6377 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6378 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6380 /* Start with output sum widgets muted and their output gains at min */
6381 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6382 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6383 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6384 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6385 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6386 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6387 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6388 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6389 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6391 /* Unmute Line-out pin widget amp left and right
6392 * (no equiv mixer ctrl)
6394 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6395 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6396 * inputs. If the pin mode is changed by the user the pin mode control
6397 * will take care of enabling the pin's input/output buffers as needed.
6398 * Therefore there's no need to enable the input buffer at this
6401 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6403 /* Mute capture amp left and right */
6404 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6405 /* Set ADC connection select to match default mixer setting - mic
6408 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6410 /* Do similar with the second ADC: mute capture input amp and
6411 * set ADC connection to mic to match ALSA's default state.
6413 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6414 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6416 /* Mute all inputs to mixer widget (even unconnected ones) */
6417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6420 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6421 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6422 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6423 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6424 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6429 static struct hda_verb alc260_will_verbs[] = {
6430 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6431 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6432 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6433 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6434 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6435 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6439 static struct hda_verb alc260_replacer_672v_verbs[] = {
6440 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6441 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6442 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6444 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6445 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6446 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6448 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6452 /* toggle speaker-output according to the hp-jack state */
6453 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6455 unsigned int present;
6457 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6458 present = snd_hda_jack_detect(codec, 0x0f);
6460 snd_hda_codec_write_cache(codec, 0x01, 0,
6461 AC_VERB_SET_GPIO_DATA, 1);
6462 snd_hda_codec_write_cache(codec, 0x0f, 0,
6463 AC_VERB_SET_PIN_WIDGET_CONTROL,
6466 snd_hda_codec_write_cache(codec, 0x01, 0,
6467 AC_VERB_SET_GPIO_DATA, 0);
6468 snd_hda_codec_write_cache(codec, 0x0f, 0,
6469 AC_VERB_SET_PIN_WIDGET_CONTROL,
6474 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6477 if ((res >> 26) == ALC880_HP_EVENT)
6478 alc260_replacer_672v_automute(codec);
6481 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6482 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6483 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6484 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6485 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6486 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6487 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6488 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6489 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6490 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6491 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6495 /* Test configuration for debugging, modelled after the ALC880 test
6498 #ifdef CONFIG_SND_DEBUG
6499 static hda_nid_t alc260_test_dac_nids[1] = {
6502 static hda_nid_t alc260_test_adc_nids[2] = {
6505 /* For testing the ALC260, each input MUX needs its own definition since
6506 * the signal assignments are different. This assumes that the first ADC
6509 static struct hda_input_mux alc260_test_capture_sources[2] = {
6513 { "MIC1 pin", 0x0 },
6514 { "MIC2 pin", 0x1 },
6515 { "LINE1 pin", 0x2 },
6516 { "LINE2 pin", 0x3 },
6518 { "LINE-OUT pin", 0x5 },
6519 { "HP-OUT pin", 0x6 },
6525 { "MIC1 pin", 0x0 },
6526 { "MIC2 pin", 0x1 },
6527 { "LINE1 pin", 0x2 },
6528 { "LINE2 pin", 0x3 },
6531 { "LINE-OUT pin", 0x6 },
6532 { "HP-OUT pin", 0x7 },
6536 static struct snd_kcontrol_new alc260_test_mixer[] = {
6537 /* Output driver widgets */
6538 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6539 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6540 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6541 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6542 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6543 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6545 /* Modes for retasking pin widgets
6546 * Note: the ALC260 doesn't seem to act on requests to enable mic
6547 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6548 * mention this restriction. At this stage it's not clear whether
6549 * this behaviour is intentional or is a hardware bug in chip
6550 * revisions available at least up until early 2006. Therefore for
6551 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6552 * choices, but if it turns out that the lack of mic bias for these
6553 * NIDs is intentional we could change their modes from
6554 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6556 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6557 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6558 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6559 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6560 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6561 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6563 /* Loopback mixer controls */
6564 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6565 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6566 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6567 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6568 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6569 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6570 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6571 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6572 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6573 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6574 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6575 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6576 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6577 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6579 /* Controls for GPIO pins, assuming they are configured as outputs */
6580 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6581 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6582 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6583 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6585 /* Switches to allow the digital IO pins to be enabled. The datasheet
6586 * is ambigious as to which NID is which; testing on laptops which
6587 * make this output available should provide clarification.
6589 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6590 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6592 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6593 * this output to turn on an external amplifier.
6595 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6596 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6600 static struct hda_verb alc260_test_init_verbs[] = {
6601 /* Enable all GPIOs as outputs with an initial value of 0 */
6602 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6603 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6604 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6606 /* Enable retasking pins as output, initially without power amp */
6607 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6608 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6610 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6611 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6612 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6614 /* Disable digital (SPDIF) pins initially, but users can enable
6615 * them via a mixer switch. In the case of SPDIF-out, this initverb
6616 * payload also sets the generation to 0, output to be in "consumer"
6617 * PCM format, copyright asserted, no pre-emphasis and no validity
6620 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6621 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6623 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6624 * OUT1 sum bus when acting as an output.
6626 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6627 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6628 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6629 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6631 /* Start with output sum widgets muted and their output gains at min */
6632 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6633 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6634 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6635 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6636 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6637 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6638 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6639 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6640 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6642 /* Unmute retasking pin widget output buffers since the default
6643 * state appears to be output. As the pin mode is changed by the
6644 * user the pin mode control will take care of enabling the pin's
6645 * input/output buffers as needed.
6647 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6648 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6649 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6650 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6651 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6652 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6653 /* Also unmute the mono-out pin widget */
6654 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6656 /* Mute capture amp left and right */
6657 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6658 /* Set ADC connection select to match default mixer setting (mic1
6661 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6663 /* Do the same for the second ADC: mute capture input amp and
6664 * set ADC connection to mic1 pin
6666 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6667 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6669 /* Mute all inputs to mixer widget (even unconnected ones) */
6670 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6671 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6673 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6674 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6675 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6676 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6677 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6683 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6684 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6686 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6687 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6690 * for BIOS auto-configuration
6693 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6694 const char *pfx, int *vol_bits)
6697 unsigned long vol_val, sw_val;
6700 if (nid >= 0x0f && nid < 0x11) {
6701 nid_vol = nid - 0x7;
6702 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6703 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6704 } else if (nid == 0x11) {
6705 nid_vol = nid - 0x7;
6706 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6707 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6708 } else if (nid >= 0x12 && nid <= 0x15) {
6710 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6711 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6715 if (!(*vol_bits & (1 << nid_vol))) {
6716 /* first control for the volume widget */
6717 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6720 *vol_bits |= (1 << nid_vol);
6722 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6728 /* add playback controls from the parsed DAC table */
6729 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6730 const struct auto_pin_cfg *cfg)
6736 spec->multiout.num_dacs = 1;
6737 spec->multiout.dac_nids = spec->private_dac_nids;
6738 spec->multiout.dac_nids[0] = 0x02;
6740 nid = cfg->line_out_pins[0];
6743 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6745 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6749 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6754 nid = cfg->speaker_pins[0];
6756 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6761 nid = cfg->hp_pins[0];
6763 err = alc260_add_playback_controls(spec, nid, "Headphone",
6771 /* create playback/capture controls for input pins */
6772 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6773 const struct auto_pin_cfg *cfg)
6775 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6778 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6779 hda_nid_t nid, int pin_type,
6782 alc_set_pin_output(codec, nid, pin_type);
6783 /* need the manual connection? */
6785 int idx = nid - 0x12;
6786 snd_hda_codec_write(codec, idx + 0x0b, 0,
6787 AC_VERB_SET_CONNECT_SEL, sel_idx);
6791 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6793 struct alc_spec *spec = codec->spec;
6796 nid = spec->autocfg.line_out_pins[0];
6798 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6799 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6802 nid = spec->autocfg.speaker_pins[0];
6804 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6806 nid = spec->autocfg.hp_pins[0];
6808 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6811 #define ALC260_PIN_CD_NID 0x16
6812 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6814 struct alc_spec *spec = codec->spec;
6815 struct auto_pin_cfg *cfg = &spec->autocfg;
6818 for (i = 0; i < cfg->num_inputs; i++) {
6819 hda_nid_t nid = cfg->inputs[i].pin;
6821 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
6822 if (nid != ALC260_PIN_CD_NID &&
6823 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6824 snd_hda_codec_write(codec, nid, 0,
6825 AC_VERB_SET_AMP_GAIN_MUTE,
6831 #define alc260_auto_init_input_src alc880_auto_init_input_src
6834 * generic initialization of ADC, input mixers and output mixers
6836 static struct hda_verb alc260_volume_init_verbs[] = {
6838 * Unmute ADC0-1 and set the default input to mic-in
6840 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6841 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6842 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6843 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6845 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6847 * Note: PASD motherboards uses the Line In 2 as the input for
6848 * front panel mic (mic 2)
6850 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6851 /* mute analog inputs */
6852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6854 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6855 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6856 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6859 * Set up output mixers (0x08 - 0x0a)
6861 /* set vol=0 to output mixers */
6862 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6863 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6864 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6865 /* set up input amps for analog loopback */
6866 /* Amp Indices: DAC = 0, mixer = 1 */
6867 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6868 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6869 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6870 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6871 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6872 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6877 static int alc260_parse_auto_config(struct hda_codec *codec)
6879 struct alc_spec *spec = codec->spec;
6881 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6883 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6887 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6890 if (!spec->kctls.list)
6891 return 0; /* can't find valid BIOS pin config */
6892 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6896 spec->multiout.max_channels = 2;
6898 if (spec->autocfg.dig_outs)
6899 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6900 if (spec->kctls.list)
6901 add_mixer(spec, spec->kctls.list);
6903 add_verb(spec, alc260_volume_init_verbs);
6905 spec->num_mux_defs = 1;
6906 spec->input_mux = &spec->private_imux[0];
6908 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6913 /* additional initialization for auto-configuration model */
6914 static void alc260_auto_init(struct hda_codec *codec)
6916 struct alc_spec *spec = codec->spec;
6917 alc260_auto_init_multi_out(codec);
6918 alc260_auto_init_analog_input(codec);
6919 alc260_auto_init_input_src(codec);
6920 alc_auto_init_digital(codec);
6921 if (spec->unsol_event)
6922 alc_inithook(codec);
6925 #ifdef CONFIG_SND_HDA_POWER_SAVE
6926 static struct hda_amp_list alc260_loopbacks[] = {
6927 { 0x07, HDA_INPUT, 0 },
6928 { 0x07, HDA_INPUT, 1 },
6929 { 0x07, HDA_INPUT, 2 },
6930 { 0x07, HDA_INPUT, 3 },
6931 { 0x07, HDA_INPUT, 4 },
6943 static const struct alc_fixup alc260_fixups[] = {
6944 [PINFIX_HP_DC5750] = {
6945 .pins = (const struct alc_pincfg[]) {
6946 { 0x11, 0x90130110 }, /* speaker */
6952 static struct snd_pci_quirk alc260_fixup_tbl[] = {
6953 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
6958 * ALC260 configurations
6960 static const char *alc260_models[ALC260_MODEL_LAST] = {
6961 [ALC260_BASIC] = "basic",
6963 [ALC260_HP_3013] = "hp-3013",
6964 [ALC260_HP_DC7600] = "hp-dc7600",
6965 [ALC260_FUJITSU_S702X] = "fujitsu",
6966 [ALC260_ACER] = "acer",
6967 [ALC260_WILL] = "will",
6968 [ALC260_REPLACER_672V] = "replacer",
6969 [ALC260_FAVORIT100] = "favorit100",
6970 #ifdef CONFIG_SND_DEBUG
6971 [ALC260_TEST] = "test",
6973 [ALC260_AUTO] = "auto",
6976 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6977 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6978 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6979 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6980 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6981 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6982 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6983 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6984 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6985 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6986 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6987 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6988 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6989 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6990 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6991 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6992 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6993 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6994 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6995 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6996 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7000 static struct alc_config_preset alc260_presets[] = {
7002 .mixers = { alc260_base_output_mixer,
7003 alc260_input_mixer },
7004 .init_verbs = { alc260_init_verbs },
7005 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7006 .dac_nids = alc260_dac_nids,
7007 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7008 .adc_nids = alc260_dual_adc_nids,
7009 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7010 .channel_mode = alc260_modes,
7011 .input_mux = &alc260_capture_source,
7014 .mixers = { alc260_hp_output_mixer,
7015 alc260_input_mixer },
7016 .init_verbs = { alc260_init_verbs,
7017 alc260_hp_unsol_verbs },
7018 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7019 .dac_nids = alc260_dac_nids,
7020 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7021 .adc_nids = alc260_adc_nids_alt,
7022 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7023 .channel_mode = alc260_modes,
7024 .input_mux = &alc260_capture_source,
7025 .unsol_event = alc260_hp_unsol_event,
7026 .init_hook = alc260_hp_automute,
7028 [ALC260_HP_DC7600] = {
7029 .mixers = { alc260_hp_dc7600_mixer,
7030 alc260_input_mixer },
7031 .init_verbs = { alc260_init_verbs,
7032 alc260_hp_dc7600_verbs },
7033 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7034 .dac_nids = alc260_dac_nids,
7035 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7036 .adc_nids = alc260_adc_nids_alt,
7037 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7038 .channel_mode = alc260_modes,
7039 .input_mux = &alc260_capture_source,
7040 .unsol_event = alc260_hp_3012_unsol_event,
7041 .init_hook = alc260_hp_3012_automute,
7043 [ALC260_HP_3013] = {
7044 .mixers = { alc260_hp_3013_mixer,
7045 alc260_input_mixer },
7046 .init_verbs = { alc260_hp_3013_init_verbs,
7047 alc260_hp_3013_unsol_verbs },
7048 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7049 .dac_nids = alc260_dac_nids,
7050 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7051 .adc_nids = alc260_adc_nids_alt,
7052 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7053 .channel_mode = alc260_modes,
7054 .input_mux = &alc260_capture_source,
7055 .unsol_event = alc260_hp_3013_unsol_event,
7056 .init_hook = alc260_hp_3013_automute,
7058 [ALC260_FUJITSU_S702X] = {
7059 .mixers = { alc260_fujitsu_mixer },
7060 .init_verbs = { alc260_fujitsu_init_verbs },
7061 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7062 .dac_nids = alc260_dac_nids,
7063 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7064 .adc_nids = alc260_dual_adc_nids,
7065 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7066 .channel_mode = alc260_modes,
7067 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7068 .input_mux = alc260_fujitsu_capture_sources,
7071 .mixers = { alc260_acer_mixer },
7072 .init_verbs = { alc260_acer_init_verbs },
7073 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7074 .dac_nids = alc260_dac_nids,
7075 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7076 .adc_nids = alc260_dual_adc_nids,
7077 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7078 .channel_mode = alc260_modes,
7079 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7080 .input_mux = alc260_acer_capture_sources,
7082 [ALC260_FAVORIT100] = {
7083 .mixers = { alc260_favorit100_mixer },
7084 .init_verbs = { alc260_favorit100_init_verbs },
7085 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7086 .dac_nids = alc260_dac_nids,
7087 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7088 .adc_nids = alc260_dual_adc_nids,
7089 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7090 .channel_mode = alc260_modes,
7091 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7092 .input_mux = alc260_favorit100_capture_sources,
7095 .mixers = { alc260_will_mixer },
7096 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7097 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7098 .dac_nids = alc260_dac_nids,
7099 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7100 .adc_nids = alc260_adc_nids,
7101 .dig_out_nid = ALC260_DIGOUT_NID,
7102 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7103 .channel_mode = alc260_modes,
7104 .input_mux = &alc260_capture_source,
7106 [ALC260_REPLACER_672V] = {
7107 .mixers = { alc260_replacer_672v_mixer },
7108 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7109 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7110 .dac_nids = alc260_dac_nids,
7111 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7112 .adc_nids = alc260_adc_nids,
7113 .dig_out_nid = ALC260_DIGOUT_NID,
7114 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7115 .channel_mode = alc260_modes,
7116 .input_mux = &alc260_capture_source,
7117 .unsol_event = alc260_replacer_672v_unsol_event,
7118 .init_hook = alc260_replacer_672v_automute,
7120 #ifdef CONFIG_SND_DEBUG
7122 .mixers = { alc260_test_mixer },
7123 .init_verbs = { alc260_test_init_verbs },
7124 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7125 .dac_nids = alc260_test_dac_nids,
7126 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7127 .adc_nids = alc260_test_adc_nids,
7128 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7129 .channel_mode = alc260_modes,
7130 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7131 .input_mux = alc260_test_capture_sources,
7136 static int patch_alc260(struct hda_codec *codec)
7138 struct alc_spec *spec;
7139 int err, board_config;
7141 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7147 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7150 if (board_config < 0) {
7151 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7153 board_config = ALC260_AUTO;
7156 if (board_config == ALC260_AUTO)
7157 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1);
7159 if (board_config == ALC260_AUTO) {
7160 /* automatic parse from the BIOS config */
7161 err = alc260_parse_auto_config(codec);
7167 "hda_codec: Cannot set up configuration "
7168 "from BIOS. Using base mode...\n");
7169 board_config = ALC260_BASIC;
7173 err = snd_hda_attach_beep_device(codec, 0x1);
7179 if (board_config != ALC260_AUTO)
7180 setup_preset(codec, &alc260_presets[board_config]);
7182 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7183 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7184 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7186 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7187 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7189 if (!spec->adc_nids && spec->input_mux) {
7190 /* check whether NID 0x04 is valid */
7191 unsigned int wcap = get_wcaps(codec, 0x04);
7192 wcap = get_wcaps_type(wcap);
7194 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7195 spec->adc_nids = alc260_adc_nids_alt;
7196 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7198 spec->adc_nids = alc260_adc_nids;
7199 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7202 set_capture_mixer(codec);
7203 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7205 if (board_config == ALC260_AUTO)
7206 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7208 spec->vmaster_nid = 0x08;
7210 codec->patch_ops = alc_patch_ops;
7211 if (board_config == ALC260_AUTO)
7212 spec->init_hook = alc260_auto_init;
7213 #ifdef CONFIG_SND_HDA_POWER_SAVE
7214 if (!spec->loopback.amplist)
7215 spec->loopback.amplist = alc260_loopbacks;
7223 * ALC882/883/885/888/889 support
7225 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7226 * configuration. Each pin widget can choose any input DACs and a mixer.
7227 * Each ADC is connected from a mixer of all inputs. This makes possible
7228 * 6-channel independent captures.
7230 * In addition, an independent DAC for the multi-playback (not used in this
7233 #define ALC882_DIGOUT_NID 0x06
7234 #define ALC882_DIGIN_NID 0x0a
7235 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7236 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7237 #define ALC1200_DIGOUT_NID 0x10
7240 static struct hda_channel_mode alc882_ch_modes[1] = {
7245 static hda_nid_t alc882_dac_nids[4] = {
7246 /* front, rear, clfe, rear_surr */
7247 0x02, 0x03, 0x04, 0x05
7249 #define alc883_dac_nids alc882_dac_nids
7252 #define alc882_adc_nids alc880_adc_nids
7253 #define alc882_adc_nids_alt alc880_adc_nids_alt
7254 #define alc883_adc_nids alc882_adc_nids_alt
7255 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7256 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7257 #define alc889_adc_nids alc880_adc_nids
7259 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7260 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7261 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7262 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7263 #define alc889_capsrc_nids alc882_capsrc_nids
7266 /* FIXME: should be a matrix-type input source selection */
7268 static struct hda_input_mux alc882_capture_source = {
7272 { "Front Mic", 0x1 },
7278 #define alc883_capture_source alc882_capture_source
7280 static struct hda_input_mux alc889_capture_source = {
7283 { "Front Mic", 0x0 },
7289 static struct hda_input_mux mb5_capture_source = {
7298 static struct hda_input_mux macmini3_capture_source = {
7306 static struct hda_input_mux alc883_3stack_6ch_intel = {
7310 { "Front Mic", 0x0 },
7316 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7324 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7334 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7342 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7346 { "Front Mic", 0x1 },
7351 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7359 static struct hda_input_mux alc889A_mb31_capture_source = {
7363 /* Front Mic (0x01) unused */
7365 /* Line 2 (0x03) unused */
7366 /* CD (0x04) unused? */
7370 static struct hda_input_mux alc889A_imac91_capture_source = {
7374 { "Line", 0x2 }, /* Not sure! */
7381 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7388 static struct hda_verb alc882_3ST_ch2_init[] = {
7389 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7390 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7391 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7392 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7399 static struct hda_verb alc882_3ST_ch4_init[] = {
7400 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7401 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7402 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7403 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7404 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7411 static struct hda_verb alc882_3ST_ch6_init[] = {
7412 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7413 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7414 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7415 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7416 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7417 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7421 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7422 { 2, alc882_3ST_ch2_init },
7423 { 4, alc882_3ST_ch4_init },
7424 { 6, alc882_3ST_ch6_init },
7427 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7432 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7433 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7434 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7435 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7436 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7437 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7444 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7445 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7446 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7447 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7448 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7449 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7450 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7457 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7458 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7459 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7460 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7461 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7462 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7463 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7464 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7468 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7469 { 2, alc883_3ST_ch2_clevo_init },
7470 { 4, alc883_3ST_ch4_clevo_init },
7471 { 6, alc883_3ST_ch6_clevo_init },
7478 static struct hda_verb alc882_sixstack_ch6_init[] = {
7479 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7480 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7481 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7482 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7489 static struct hda_verb alc882_sixstack_ch8_init[] = {
7490 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7491 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7492 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7493 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7497 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7498 { 6, alc882_sixstack_ch6_init },
7499 { 8, alc882_sixstack_ch8_init },
7503 /* Macbook Air 2,1 */
7505 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7510 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7516 static struct hda_verb alc885_mbp_ch2_init[] = {
7517 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7518 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7519 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7526 static struct hda_verb alc885_mbp_ch4_init[] = {
7527 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7528 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7529 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7530 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7531 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7535 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7536 { 2, alc885_mbp_ch2_init },
7537 { 4, alc885_mbp_ch4_init },
7542 * Speakers/Woofer/HP = Front
7545 static struct hda_verb alc885_mb5_ch2_init[] = {
7546 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7547 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7553 * Speakers/HP = Front
7557 static struct hda_verb alc885_mb5_ch6_init[] = {
7558 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7560 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7564 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7565 { 2, alc885_mb5_ch2_init },
7566 { 6, alc885_mb5_ch6_init },
7569 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7574 static struct hda_verb alc883_4ST_ch2_init[] = {
7575 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7576 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7577 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7578 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7579 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7580 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7587 static struct hda_verb alc883_4ST_ch4_init[] = {
7588 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7589 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7590 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7591 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7592 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7593 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7594 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7601 static struct hda_verb alc883_4ST_ch6_init[] = {
7602 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7603 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7604 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7605 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7606 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7607 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7608 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7609 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7616 static struct hda_verb alc883_4ST_ch8_init[] = {
7617 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7618 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7619 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7620 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7621 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7622 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7623 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7624 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7625 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7629 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7630 { 2, alc883_4ST_ch2_init },
7631 { 4, alc883_4ST_ch4_init },
7632 { 6, alc883_4ST_ch6_init },
7633 { 8, alc883_4ST_ch8_init },
7640 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7641 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7642 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7643 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7644 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7651 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7652 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7653 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7654 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7655 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7656 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7663 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7664 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7665 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7666 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7667 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7668 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7669 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7673 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7674 { 2, alc883_3ST_ch2_intel_init },
7675 { 4, alc883_3ST_ch4_intel_init },
7676 { 6, alc883_3ST_ch6_intel_init },
7682 static struct hda_verb alc889_ch2_intel_init[] = {
7683 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7684 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7685 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7686 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7687 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7688 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7695 static struct hda_verb alc889_ch6_intel_init[] = {
7696 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7697 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7698 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7699 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7700 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7701 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7708 static struct hda_verb alc889_ch8_intel_init[] = {
7709 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7710 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7711 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7712 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7713 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7714 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7715 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7719 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7720 { 2, alc889_ch2_intel_init },
7721 { 6, alc889_ch6_intel_init },
7722 { 8, alc889_ch8_intel_init },
7728 static struct hda_verb alc883_sixstack_ch6_init[] = {
7729 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7730 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7731 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7732 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7739 static struct hda_verb alc883_sixstack_ch8_init[] = {
7740 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7741 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7742 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7743 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7747 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7748 { 6, alc883_sixstack_ch6_init },
7749 { 8, alc883_sixstack_ch8_init },
7753 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7754 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7756 static struct snd_kcontrol_new alc882_base_mixer[] = {
7757 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7758 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7759 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7760 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7761 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7762 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7763 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7764 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7765 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7766 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7767 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7768 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7769 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7770 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7771 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7772 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7773 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7774 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7775 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7776 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7777 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7781 /* Macbook Air 2,1 same control for HP and internal Speaker */
7783 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7784 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7785 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7790 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7791 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7792 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7793 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7794 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7795 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7796 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7797 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7798 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7799 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7800 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7801 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7805 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7806 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7807 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7808 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7809 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7810 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7811 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7812 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7813 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7814 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7815 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7816 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7817 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7818 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7819 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7823 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7824 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7825 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7826 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7827 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7828 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7829 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7830 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7831 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7832 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7833 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7834 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7838 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7839 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7840 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7845 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7846 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7847 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7848 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7849 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7850 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7851 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7853 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7854 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7858 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7859 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7860 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7862 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7863 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7864 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7865 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7866 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7867 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7868 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7869 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7870 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7871 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7875 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7876 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7878 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7879 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7880 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7881 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7882 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7883 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7884 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7885 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7886 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7887 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7888 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7889 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7890 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7891 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7895 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7896 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7897 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7898 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7899 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7900 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7901 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7902 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7903 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7904 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7905 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7909 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7911 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7912 .name = "Channel Mode",
7913 .info = alc_ch_mode_info,
7914 .get = alc_ch_mode_get,
7915 .put = alc_ch_mode_put,
7920 static struct hda_verb alc882_base_init_verbs[] = {
7921 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7922 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7923 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7925 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7926 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7928 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7929 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7931 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7932 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7934 /* Front Pin: output 0 (0x0c) */
7935 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7936 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7937 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7938 /* Rear Pin: output 1 (0x0d) */
7939 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7940 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7941 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7942 /* CLFE Pin: output 2 (0x0e) */
7943 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7944 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7945 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7946 /* Side Pin: output 3 (0x0f) */
7947 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7948 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7949 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7950 /* Mic (rear) pin: input vref at 80% */
7951 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7952 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7953 /* Front Mic pin: input vref at 80% */
7954 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7955 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7956 /* Line In pin: input */
7957 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7958 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7959 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7960 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7961 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7962 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7963 /* CD pin widget for input */
7964 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7966 /* FIXME: use matrix-type input source selection */
7967 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7969 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7971 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7972 /* ADC2: mute amp left and right */
7973 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7974 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7975 /* ADC3: mute amp left and right */
7976 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7977 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7982 static struct hda_verb alc882_adc1_init_verbs[] = {
7983 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7984 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7985 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7986 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7987 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7988 /* ADC1: mute amp left and right */
7989 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7990 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7994 static struct hda_verb alc882_eapd_verbs[] = {
7995 /* change to EAPD mode */
7996 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7997 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8001 static struct hda_verb alc889_eapd_verbs[] = {
8002 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8003 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8007 static struct hda_verb alc_hp15_unsol_verbs[] = {
8008 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8009 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8013 static struct hda_verb alc885_init_verbs[] = {
8014 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8015 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8016 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8018 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8019 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8021 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8022 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8024 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8025 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8027 /* Front HP Pin: output 0 (0x0c) */
8028 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8029 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8030 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8031 /* Front Pin: output 0 (0x0c) */
8032 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8033 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8034 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8035 /* Rear Pin: output 1 (0x0d) */
8036 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8037 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8038 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8039 /* CLFE Pin: output 2 (0x0e) */
8040 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8041 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8042 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8043 /* Side Pin: output 3 (0x0f) */
8044 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8045 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8046 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8047 /* Mic (rear) pin: input vref at 80% */
8048 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8049 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8050 /* Front Mic pin: input vref at 80% */
8051 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8052 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8053 /* Line In pin: input */
8054 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8055 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8057 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8059 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8061 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8064 /* ADC2: mute amp left and right */
8065 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8066 /* ADC3: mute amp left and right */
8067 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8072 static struct hda_verb alc885_init_input_verbs[] = {
8073 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8074 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8075 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8080 /* Unmute Selector 24h and set the default input to front mic */
8081 static struct hda_verb alc889_init_input_verbs[] = {
8082 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8088 #define alc883_init_verbs alc882_base_init_verbs
8091 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8092 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8093 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8094 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8095 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8096 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8097 /* FIXME: this looks suspicious...
8098 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8099 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8104 static struct hda_verb alc882_macpro_init_verbs[] = {
8105 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8106 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8107 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8108 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8109 /* Front Pin: output 0 (0x0c) */
8110 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8112 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8113 /* Front Mic pin: input vref at 80% */
8114 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8115 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8116 /* Speaker: output */
8117 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8118 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8119 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8120 /* Headphone output (output 0 - 0x0c) */
8121 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8122 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8123 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8125 /* FIXME: use matrix-type input source selection */
8126 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8127 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8128 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8129 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8130 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8131 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8133 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8134 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8135 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8136 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8138 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8139 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8140 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8141 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8142 /* ADC1: mute amp left and right */
8143 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8144 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8145 /* ADC2: mute amp left and right */
8146 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8147 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8148 /* ADC3: mute amp left and right */
8149 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8150 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8156 static struct hda_verb alc885_mb5_init_verbs[] = {
8158 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8159 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8160 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8161 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8165 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8166 /* Surround mixer */
8167 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8168 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8169 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8172 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8173 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8175 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8176 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8177 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8178 /* Front Pin (0x0c) */
8179 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8180 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8181 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8182 /* LFE Pin (0x0e) */
8183 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8184 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8185 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8187 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8188 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8189 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8190 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8191 /* Front Mic pin: input vref at 80% */
8192 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8193 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8195 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8196 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8200 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8205 static struct hda_verb alc885_macmini3_init_verbs[] = {
8207 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8208 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8209 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8210 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8212 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8213 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8214 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8215 /* Surround mixer */
8216 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8217 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8218 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8220 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8221 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8222 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8224 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8225 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8226 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8227 /* Front Pin (0x0c) */
8228 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8229 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8230 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8231 /* LFE Pin (0x0e) */
8232 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8233 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8234 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8236 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8237 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8238 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8239 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8241 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8242 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8244 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8245 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8246 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8247 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8252 static struct hda_verb alc885_mba21_init_verbs[] = {
8253 /*Internal and HP Speaker Mixer*/
8254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8256 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8257 /*Internal Speaker Pin (0x0c)*/
8258 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8259 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8260 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8261 /* HP Pin: output 0 (0x0e) */
8262 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8263 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8264 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8265 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8266 /* Line in (is hp when jack connected)*/
8267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8274 /* Macbook Pro rev3 */
8275 static struct hda_verb alc885_mbp3_init_verbs[] = {
8276 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8277 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8278 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8279 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8281 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8282 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8283 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8285 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8286 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8287 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8288 /* Front Pin: output 0 (0x0c) */
8289 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8290 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8291 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8292 /* HP Pin: output 0 (0x0e) */
8293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8294 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8295 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8296 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8297 /* Mic (rear) pin: input vref at 80% */
8298 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8299 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8300 /* Front Mic pin: input vref at 80% */
8301 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8302 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8303 /* Line In pin: use output 1 when in LineOut mode */
8304 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8305 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8306 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8308 /* FIXME: use matrix-type input source selection */
8309 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8310 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8311 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8312 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8314 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8319 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8324 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8325 /* ADC1: mute amp left and right */
8326 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8327 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8328 /* ADC2: mute amp left and right */
8329 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8330 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8331 /* ADC3: mute amp left and right */
8332 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8333 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8339 static struct hda_verb alc885_imac91_init_verbs[] = {
8340 /* Internal Speaker Pin (0x0c) */
8341 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8342 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8343 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8344 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8345 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8346 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8349 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8350 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8351 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8353 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8354 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8355 /* Front Mic pin: input vref at 80% */
8356 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8357 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8359 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8360 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8361 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8362 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8363 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8364 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8366 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8371 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8372 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8373 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8374 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8376 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8377 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8378 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8379 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8380 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8381 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8382 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8383 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8384 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8385 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8386 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8387 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8388 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8389 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8393 /* iMac 24 mixer. */
8394 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8395 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8396 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8400 /* iMac 24 init verbs. */
8401 static struct hda_verb alc885_imac24_init_verbs[] = {
8402 /* Internal speakers: output 0 (0x0c) */
8403 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8404 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8405 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8406 /* Internal speakers: output 0 (0x0c) */
8407 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8408 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8409 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8410 /* Headphone: output 0 (0x0c) */
8411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8412 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8413 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8414 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8415 /* Front Mic: input vref at 80% */
8416 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8417 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8421 /* Toggle speaker-output according to the hp-jack state */
8422 static void alc885_imac24_setup(struct hda_codec *codec)
8424 struct alc_spec *spec = codec->spec;
8426 spec->autocfg.hp_pins[0] = 0x14;
8427 spec->autocfg.speaker_pins[0] = 0x18;
8428 spec->autocfg.speaker_pins[1] = 0x1a;
8431 #define alc885_mb5_setup alc885_imac24_setup
8432 #define alc885_macmini3_setup alc885_imac24_setup
8434 /* Macbook Air 2,1 */
8435 static void alc885_mba21_setup(struct hda_codec *codec)
8437 struct alc_spec *spec = codec->spec;
8439 spec->autocfg.hp_pins[0] = 0x14;
8440 spec->autocfg.speaker_pins[0] = 0x18;
8445 static void alc885_mbp3_setup(struct hda_codec *codec)
8447 struct alc_spec *spec = codec->spec;
8449 spec->autocfg.hp_pins[0] = 0x15;
8450 spec->autocfg.speaker_pins[0] = 0x14;
8453 static void alc885_imac91_setup(struct hda_codec *codec)
8455 struct alc_spec *spec = codec->spec;
8457 spec->autocfg.hp_pins[0] = 0x14;
8458 spec->autocfg.speaker_pins[0] = 0x18;
8459 spec->autocfg.speaker_pins[1] = 0x1a;
8462 static struct hda_verb alc882_targa_verbs[] = {
8463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8467 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8469 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8470 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8471 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8473 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8477 /* toggle speaker-output according to the hp-jack state */
8478 static void alc882_targa_automute(struct hda_codec *codec)
8480 struct alc_spec *spec = codec->spec;
8481 alc_automute_amp(codec);
8482 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8483 spec->jack_present ? 1 : 3);
8486 static void alc882_targa_setup(struct hda_codec *codec)
8488 struct alc_spec *spec = codec->spec;
8490 spec->autocfg.hp_pins[0] = 0x14;
8491 spec->autocfg.speaker_pins[0] = 0x1b;
8494 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8496 if ((res >> 26) == ALC880_HP_EVENT)
8497 alc882_targa_automute(codec);
8500 static struct hda_verb alc882_asus_a7j_verbs[] = {
8501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8504 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8505 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8506 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8508 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8509 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8510 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8512 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8513 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8514 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8518 static struct hda_verb alc882_asus_a7m_verbs[] = {
8519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8520 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8523 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8524 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8526 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8527 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8528 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8530 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8531 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8532 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8536 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8538 unsigned int gpiostate, gpiomask, gpiodir;
8540 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8541 AC_VERB_GET_GPIO_DATA, 0);
8544 gpiostate |= (1 << pin);
8546 gpiostate &= ~(1 << pin);
8548 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8549 AC_VERB_GET_GPIO_MASK, 0);
8550 gpiomask |= (1 << pin);
8552 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8553 AC_VERB_GET_GPIO_DIRECTION, 0);
8554 gpiodir |= (1 << pin);
8557 snd_hda_codec_write(codec, codec->afg, 0,
8558 AC_VERB_SET_GPIO_MASK, gpiomask);
8559 snd_hda_codec_write(codec, codec->afg, 0,
8560 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8564 snd_hda_codec_write(codec, codec->afg, 0,
8565 AC_VERB_SET_GPIO_DATA, gpiostate);
8568 /* set up GPIO at initialization */
8569 static void alc885_macpro_init_hook(struct hda_codec *codec)
8571 alc882_gpio_mute(codec, 0, 0);
8572 alc882_gpio_mute(codec, 1, 0);
8575 /* set up GPIO and update auto-muting at initialization */
8576 static void alc885_imac24_init_hook(struct hda_codec *codec)
8578 alc885_macpro_init_hook(codec);
8579 alc_automute_amp(codec);
8583 * generic initialization of ADC, input mixers and output mixers
8585 static struct hda_verb alc883_auto_init_verbs[] = {
8587 * Unmute ADC0-2 and set the default input to mic-in
8589 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8590 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8591 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8592 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8595 * Set up output mixers (0x0c - 0x0f)
8597 /* set vol=0 to output mixers */
8598 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8599 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8600 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8601 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8602 /* set up input amps for analog loopback */
8603 /* Amp Indices: DAC = 0, mixer = 1 */
8604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8605 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8606 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8607 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8608 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8609 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8610 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8611 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8612 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8613 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8615 /* FIXME: use matrix-type input source selection */
8616 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8618 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8624 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8625 static struct hda_verb alc889A_mb31_ch2_init[] = {
8626 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8627 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8628 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8629 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8633 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8634 static struct hda_verb alc889A_mb31_ch4_init[] = {
8635 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8636 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8637 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8638 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8642 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8643 static struct hda_verb alc889A_mb31_ch5_init[] = {
8644 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8645 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8646 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8647 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8651 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8652 static struct hda_verb alc889A_mb31_ch6_init[] = {
8653 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8654 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8655 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8656 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8660 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8661 { 2, alc889A_mb31_ch2_init },
8662 { 4, alc889A_mb31_ch4_init },
8663 { 5, alc889A_mb31_ch5_init },
8664 { 6, alc889A_mb31_ch6_init },
8667 static struct hda_verb alc883_medion_eapd_verbs[] = {
8668 /* eanable EAPD on medion laptop */
8669 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8670 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8674 #define alc883_base_mixer alc882_base_mixer
8676 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8677 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8678 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8679 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8680 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8681 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8682 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8683 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8684 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8685 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8686 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8687 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8688 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8689 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8693 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8694 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8695 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8696 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8697 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8698 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8699 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8700 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8701 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8702 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8703 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8707 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8708 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8709 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8710 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8711 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8712 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8713 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8714 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8715 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8716 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8717 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8721 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8722 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8723 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8724 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8725 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8726 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8727 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8728 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8729 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8730 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8732 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8733 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8734 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8738 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8739 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8740 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8741 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8742 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8743 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8744 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8745 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8746 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8747 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8748 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8749 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8750 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8751 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8752 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8753 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8754 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8755 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8756 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8757 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8761 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8762 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8763 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8764 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8765 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8766 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8768 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8769 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8770 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8771 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8772 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8773 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8774 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8775 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8776 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8777 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8778 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8779 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8780 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8781 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8785 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8786 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8787 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8788 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8789 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8790 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8792 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8793 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8794 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8795 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8796 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8797 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8798 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8799 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8800 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8801 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8802 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8803 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8804 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8805 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8809 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8810 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8811 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8812 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8813 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8814 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8815 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8816 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8817 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8818 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8819 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8820 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8821 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8822 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8823 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8824 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8826 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8827 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8828 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8832 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8833 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8834 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8835 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8836 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8837 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8838 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8839 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8840 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8841 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8842 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8843 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8844 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8845 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8846 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8848 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8849 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8853 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8854 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8855 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8856 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8857 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8858 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8859 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8860 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8861 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8862 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8863 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8864 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8865 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8869 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8870 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8871 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8872 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8873 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8874 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8878 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8879 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8880 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8881 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8882 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8883 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8884 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8885 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8886 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8890 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8891 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8892 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8893 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8894 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8895 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8896 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8897 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8898 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8899 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8903 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8904 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8905 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8906 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8907 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8908 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8909 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8910 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8911 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8912 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8916 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8917 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8918 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8919 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8920 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8921 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8922 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8926 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8927 /* Unmute front mixer */
8928 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8929 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8931 /* Set speaker pin to front mixer */
8932 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8934 /* Init headphone pin */
8935 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8936 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8937 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8938 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8943 /* toggle speaker-output according to the hp-jack state */
8944 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8946 struct alc_spec *spec = codec->spec;
8948 spec->autocfg.hp_pins[0] = 0x1a;
8949 spec->autocfg.speaker_pins[0] = 0x15;
8952 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8953 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8954 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8955 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8956 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8957 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8958 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8959 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8960 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8964 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8965 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8966 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8968 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8969 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8970 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8972 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8977 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8978 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8979 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8980 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8981 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8982 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8983 0x0d, 1, 0x0, HDA_OUTPUT),
8984 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8985 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8986 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8987 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8988 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8989 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8990 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8991 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8992 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8994 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8995 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8996 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8997 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8998 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9002 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9004 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9005 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9006 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9007 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9008 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9010 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9011 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9012 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9013 /* Output switches */
9014 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9015 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9016 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9018 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
9019 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
9021 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9022 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9023 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9024 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9028 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9029 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9030 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9031 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9033 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9038 static struct hda_bind_ctls alc883_bind_cap_vol = {
9039 .ops = &snd_hda_bind_vol,
9041 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9042 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9047 static struct hda_bind_ctls alc883_bind_cap_switch = {
9048 .ops = &snd_hda_bind_sw,
9050 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9051 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9056 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9057 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9058 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9059 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9060 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9061 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9063 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9068 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9069 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9070 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9072 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9073 /* .name = "Capture Source", */
9074 .name = "Input Source",
9076 .info = alc_mux_enum_info,
9077 .get = alc_mux_enum_get,
9078 .put = alc_mux_enum_put,
9083 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9086 .name = "Channel Mode",
9087 .info = alc_ch_mode_info,
9088 .get = alc_ch_mode_get,
9089 .put = alc_ch_mode_put,
9094 /* toggle speaker-output according to the hp-jack state */
9095 static void alc883_mitac_setup(struct hda_codec *codec)
9097 struct alc_spec *spec = codec->spec;
9099 spec->autocfg.hp_pins[0] = 0x15;
9100 spec->autocfg.speaker_pins[0] = 0x14;
9101 spec->autocfg.speaker_pins[1] = 0x17;
9104 /* auto-toggle front mic */
9106 static void alc883_mitac_mic_automute(struct hda_codec *codec)
9108 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
9110 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
9114 static struct hda_verb alc883_mitac_verbs[] = {
9116 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9117 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9119 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9120 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9122 /* enable unsolicited event */
9123 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9124 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9129 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9131 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9132 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9134 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9136 /* enable unsolicited event */
9138 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9139 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9145 static struct hda_verb alc883_clevo_m720_verbs[] = {
9147 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9148 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9150 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9151 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9153 /* enable unsolicited event */
9154 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9155 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9160 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9162 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9163 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9165 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9168 /* enable unsolicited event */
9169 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9174 static struct hda_verb alc883_targa_verbs[] = {
9175 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9176 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9178 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9179 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9181 /* Connect Line-Out side jack (SPDIF) to Side */
9182 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9183 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9184 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9185 /* Connect Mic jack to CLFE */
9186 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9187 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9188 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9189 /* Connect Line-in jack to Surround */
9190 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9191 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9192 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9193 /* Connect HP out jack to Front */
9194 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9195 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9196 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9198 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9203 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9204 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9205 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9206 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9210 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9211 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9212 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9213 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9214 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9218 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9219 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9220 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9221 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9222 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9223 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9227 static struct hda_verb alc883_haier_w66_verbs[] = {
9228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9229 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9231 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9233 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9234 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9235 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9236 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9240 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9241 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9242 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9243 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9245 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9246 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9247 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9248 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9252 static struct hda_verb alc888_6st_dell_verbs[] = {
9253 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9257 static struct hda_verb alc883_vaiott_verbs[] = {
9259 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9260 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9262 /* enable unsolicited event */
9263 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9268 static void alc888_3st_hp_setup(struct hda_codec *codec)
9270 struct alc_spec *spec = codec->spec;
9272 spec->autocfg.hp_pins[0] = 0x1b;
9273 spec->autocfg.speaker_pins[0] = 0x14;
9274 spec->autocfg.speaker_pins[1] = 0x16;
9275 spec->autocfg.speaker_pins[2] = 0x18;
9278 static struct hda_verb alc888_3st_hp_verbs[] = {
9279 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9280 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9281 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9282 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9289 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9290 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9291 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9292 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9293 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9300 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9301 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9302 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9303 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9304 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9305 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9312 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9313 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9314 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9315 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9316 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9317 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9318 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9322 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9323 { 2, alc888_3st_hp_2ch_init },
9324 { 4, alc888_3st_hp_4ch_init },
9325 { 6, alc888_3st_hp_6ch_init },
9328 /* toggle front-jack and RCA according to the hp-jack state */
9329 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9331 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9333 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9334 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9335 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9336 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9339 /* toggle RCA according to the front-jack state */
9340 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9342 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9344 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9345 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9348 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9351 if ((res >> 26) == ALC880_HP_EVENT)
9352 alc888_lenovo_ms7195_front_automute(codec);
9353 if ((res >> 26) == ALC880_FRONT_EVENT)
9354 alc888_lenovo_ms7195_rca_automute(codec);
9357 static struct hda_verb alc883_medion_md2_verbs[] = {
9358 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9359 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9361 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9363 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9367 /* toggle speaker-output according to the hp-jack state */
9368 static void alc883_medion_md2_setup(struct hda_codec *codec)
9370 struct alc_spec *spec = codec->spec;
9372 spec->autocfg.hp_pins[0] = 0x14;
9373 spec->autocfg.speaker_pins[0] = 0x15;
9376 /* toggle speaker-output according to the hp-jack state */
9377 #define alc883_targa_init_hook alc882_targa_init_hook
9378 #define alc883_targa_unsol_event alc882_targa_unsol_event
9380 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9382 unsigned int present;
9384 present = snd_hda_jack_detect(codec, 0x18);
9385 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9386 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9389 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9391 struct alc_spec *spec = codec->spec;
9393 spec->autocfg.hp_pins[0] = 0x15;
9394 spec->autocfg.speaker_pins[0] = 0x14;
9397 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9399 alc_automute_amp(codec);
9400 alc883_clevo_m720_mic_automute(codec);
9403 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9406 switch (res >> 26) {
9407 case ALC880_MIC_EVENT:
9408 alc883_clevo_m720_mic_automute(codec);
9411 alc_automute_amp_unsol_event(codec, res);
9416 /* toggle speaker-output according to the hp-jack state */
9417 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9419 struct alc_spec *spec = codec->spec;
9421 spec->autocfg.hp_pins[0] = 0x14;
9422 spec->autocfg.speaker_pins[0] = 0x15;
9425 static void alc883_haier_w66_setup(struct hda_codec *codec)
9427 struct alc_spec *spec = codec->spec;
9429 spec->autocfg.hp_pins[0] = 0x1b;
9430 spec->autocfg.speaker_pins[0] = 0x14;
9433 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9435 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9437 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9438 HDA_AMP_MUTE, bits);
9441 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9443 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9445 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9446 HDA_AMP_MUTE, bits);
9447 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9448 HDA_AMP_MUTE, bits);
9451 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9454 if ((res >> 26) == ALC880_HP_EVENT)
9455 alc883_lenovo_101e_all_automute(codec);
9456 if ((res >> 26) == ALC880_FRONT_EVENT)
9457 alc883_lenovo_101e_ispeaker_automute(codec);
9460 /* toggle speaker-output according to the hp-jack state */
9461 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9463 struct alc_spec *spec = codec->spec;
9465 spec->autocfg.hp_pins[0] = 0x14;
9466 spec->autocfg.speaker_pins[0] = 0x15;
9467 spec->autocfg.speaker_pins[1] = 0x16;
9470 static struct hda_verb alc883_acer_eapd_verbs[] = {
9471 /* HP Pin: output 0 (0x0c) */
9472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9474 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9475 /* Front Pin: output 0 (0x0c) */
9476 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9477 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9478 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9479 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9480 /* eanable EAPD on medion laptop */
9481 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9482 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9483 /* enable unsolicited event */
9484 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9488 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9489 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9490 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9491 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9495 static void alc888_6st_dell_setup(struct hda_codec *codec)
9497 struct alc_spec *spec = codec->spec;
9499 spec->autocfg.hp_pins[0] = 0x1b;
9500 spec->autocfg.speaker_pins[0] = 0x14;
9501 spec->autocfg.speaker_pins[1] = 0x15;
9502 spec->autocfg.speaker_pins[2] = 0x16;
9503 spec->autocfg.speaker_pins[3] = 0x17;
9506 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9508 struct alc_spec *spec = codec->spec;
9510 spec->autocfg.hp_pins[0] = 0x1b;
9511 spec->autocfg.speaker_pins[0] = 0x14;
9512 spec->autocfg.speaker_pins[1] = 0x15;
9513 spec->autocfg.speaker_pins[2] = 0x16;
9514 spec->autocfg.speaker_pins[3] = 0x17;
9515 spec->autocfg.speaker_pins[4] = 0x1a;
9518 static void alc883_vaiott_setup(struct hda_codec *codec)
9520 struct alc_spec *spec = codec->spec;
9522 spec->autocfg.hp_pins[0] = 0x15;
9523 spec->autocfg.speaker_pins[0] = 0x14;
9524 spec->autocfg.speaker_pins[1] = 0x17;
9527 static struct hda_verb alc888_asus_m90v_verbs[] = {
9528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9529 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9530 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9531 /* enable unsolicited event */
9532 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9533 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9537 static void alc883_mode2_setup(struct hda_codec *codec)
9539 struct alc_spec *spec = codec->spec;
9541 spec->autocfg.hp_pins[0] = 0x1b;
9542 spec->autocfg.speaker_pins[0] = 0x14;
9543 spec->autocfg.speaker_pins[1] = 0x15;
9544 spec->autocfg.speaker_pins[2] = 0x16;
9545 spec->ext_mic.pin = 0x18;
9546 spec->int_mic.pin = 0x19;
9547 spec->ext_mic.mux_idx = 0;
9548 spec->int_mic.mux_idx = 1;
9552 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9553 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9554 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9556 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9557 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9558 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9559 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9560 /* enable unsolicited event */
9561 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9565 static void alc883_eee1601_inithook(struct hda_codec *codec)
9567 struct alc_spec *spec = codec->spec;
9569 spec->autocfg.hp_pins[0] = 0x14;
9570 spec->autocfg.speaker_pins[0] = 0x1b;
9571 alc_automute_pin(codec);
9574 static struct hda_verb alc889A_mb31_verbs[] = {
9575 /* Init rear pin (used as headphone output) */
9576 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9577 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9578 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9579 /* Init line pin (used as output in 4ch and 6ch mode) */
9580 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9581 /* Init line 2 pin (used as headphone out by default) */
9582 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9583 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9587 /* Mute speakers according to the headphone jack state */
9588 static void alc889A_mb31_automute(struct hda_codec *codec)
9590 unsigned int present;
9592 /* Mute only in 2ch or 4ch mode */
9593 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9595 present = snd_hda_jack_detect(codec, 0x15);
9596 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9597 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9598 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9599 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9603 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9605 if ((res >> 26) == ALC880_HP_EVENT)
9606 alc889A_mb31_automute(codec);
9610 #ifdef CONFIG_SND_HDA_POWER_SAVE
9611 #define alc882_loopbacks alc880_loopbacks
9614 /* pcm configuration: identical with ALC880 */
9615 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9616 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9617 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9618 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9620 static hda_nid_t alc883_slave_dig_outs[] = {
9621 ALC1200_DIGOUT_NID, 0,
9624 static hda_nid_t alc1200_slave_dig_outs[] = {
9625 ALC883_DIGOUT_NID, 0,
9629 * configuration and preset
9631 static const char *alc882_models[ALC882_MODEL_LAST] = {
9632 [ALC882_3ST_DIG] = "3stack-dig",
9633 [ALC882_6ST_DIG] = "6stack-dig",
9634 [ALC882_ARIMA] = "arima",
9635 [ALC882_W2JC] = "w2jc",
9636 [ALC882_TARGA] = "targa",
9637 [ALC882_ASUS_A7J] = "asus-a7j",
9638 [ALC882_ASUS_A7M] = "asus-a7m",
9639 [ALC885_MACPRO] = "macpro",
9640 [ALC885_MB5] = "mb5",
9641 [ALC885_MACMINI3] = "macmini3",
9642 [ALC885_MBA21] = "mba21",
9643 [ALC885_MBP3] = "mbp3",
9644 [ALC885_IMAC24] = "imac24",
9645 [ALC885_IMAC91] = "imac91",
9646 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9647 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9648 [ALC883_3ST_6ch] = "3stack-6ch",
9649 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9650 [ALC883_TARGA_DIG] = "targa-dig",
9651 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9652 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9653 [ALC883_ACER] = "acer",
9654 [ALC883_ACER_ASPIRE] = "acer-aspire",
9655 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9656 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9657 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9658 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9659 [ALC883_MEDION] = "medion",
9660 [ALC883_MEDION_MD2] = "medion-md2",
9661 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9662 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9663 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9664 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9665 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9666 [ALC888_LENOVO_SKY] = "lenovo-sky",
9667 [ALC883_HAIER_W66] = "haier-w66",
9668 [ALC888_3ST_HP] = "3stack-hp",
9669 [ALC888_6ST_DELL] = "6stack-dell",
9670 [ALC883_MITAC] = "mitac",
9671 [ALC883_CLEVO_M540R] = "clevo-m540r",
9672 [ALC883_CLEVO_M720] = "clevo-m720",
9673 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9674 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9675 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9676 [ALC889A_INTEL] = "intel-alc889a",
9677 [ALC889_INTEL] = "intel-x58",
9678 [ALC1200_ASUS_P5Q] = "asus-p5q",
9679 [ALC889A_MB31] = "mb31",
9680 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9681 [ALC882_AUTO] = "auto",
9684 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9685 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9687 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9688 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9689 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9690 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9691 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9692 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9693 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9694 ALC888_ACER_ASPIRE_4930G),
9695 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9696 ALC888_ACER_ASPIRE_4930G),
9697 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9698 ALC888_ACER_ASPIRE_8930G),
9699 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9700 ALC888_ACER_ASPIRE_8930G),
9701 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9702 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9703 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9704 ALC888_ACER_ASPIRE_6530G),
9705 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9706 ALC888_ACER_ASPIRE_6530G),
9707 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9708 ALC888_ACER_ASPIRE_7730G),
9709 /* default Acer -- disabled as it causes more problems.
9710 * model=auto should work fine now
9712 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9714 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9716 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9717 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9718 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9719 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9720 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9721 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9723 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9724 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9725 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9726 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9727 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9728 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9729 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9730 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9731 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9732 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9733 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9735 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9736 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9737 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9738 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9739 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9740 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9741 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9742 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9743 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9745 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9746 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9747 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9748 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9749 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9750 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9751 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9752 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9753 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9754 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9755 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9756 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9757 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9758 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9759 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9760 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9761 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9762 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9763 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9764 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9765 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9766 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9767 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9768 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9769 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9770 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9771 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9772 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9773 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9774 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9775 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9777 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9778 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9779 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9780 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9781 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9782 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9783 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9784 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9785 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9786 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9787 ALC883_FUJITSU_PI2515),
9788 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9789 ALC888_FUJITSU_XA3530),
9790 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9791 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9792 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9793 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9794 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9795 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9796 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9797 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9798 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9800 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9801 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9802 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9803 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9804 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9805 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9806 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9811 /* codec SSID table for Intel Mac */
9812 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9813 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9814 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9815 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9816 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9817 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9818 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9819 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9820 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9821 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9822 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9823 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9824 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9825 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9826 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9827 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9828 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9829 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9830 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9831 * so apparently no perfect solution yet
9833 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9834 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9835 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9839 static struct alc_config_preset alc882_presets[] = {
9840 [ALC882_3ST_DIG] = {
9841 .mixers = { alc882_base_mixer },
9842 .init_verbs = { alc882_base_init_verbs,
9843 alc882_adc1_init_verbs },
9844 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9845 .dac_nids = alc882_dac_nids,
9846 .dig_out_nid = ALC882_DIGOUT_NID,
9847 .dig_in_nid = ALC882_DIGIN_NID,
9848 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9849 .channel_mode = alc882_ch_modes,
9851 .input_mux = &alc882_capture_source,
9853 [ALC882_6ST_DIG] = {
9854 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9855 .init_verbs = { alc882_base_init_verbs,
9856 alc882_adc1_init_verbs },
9857 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9858 .dac_nids = alc882_dac_nids,
9859 .dig_out_nid = ALC882_DIGOUT_NID,
9860 .dig_in_nid = ALC882_DIGIN_NID,
9861 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9862 .channel_mode = alc882_sixstack_modes,
9863 .input_mux = &alc882_capture_source,
9866 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9867 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9868 alc882_eapd_verbs },
9869 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9870 .dac_nids = alc882_dac_nids,
9871 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9872 .channel_mode = alc882_sixstack_modes,
9873 .input_mux = &alc882_capture_source,
9876 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9877 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9878 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9879 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9880 .dac_nids = alc882_dac_nids,
9881 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9882 .channel_mode = alc880_threestack_modes,
9884 .input_mux = &alc882_capture_source,
9885 .dig_out_nid = ALC882_DIGOUT_NID,
9888 .mixers = { alc885_mba21_mixer },
9889 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9891 .dac_nids = alc882_dac_nids,
9892 .channel_mode = alc885_mba21_ch_modes,
9893 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9894 .input_mux = &alc882_capture_source,
9895 .unsol_event = alc_automute_amp_unsol_event,
9896 .setup = alc885_mba21_setup,
9897 .init_hook = alc_automute_amp,
9900 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9901 .init_verbs = { alc885_mbp3_init_verbs,
9902 alc880_gpio1_init_verbs },
9904 .dac_nids = alc882_dac_nids,
9906 .channel_mode = alc885_mbp_4ch_modes,
9907 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9908 .input_mux = &alc882_capture_source,
9909 .dig_out_nid = ALC882_DIGOUT_NID,
9910 .dig_in_nid = ALC882_DIGIN_NID,
9911 .unsol_event = alc_automute_amp_unsol_event,
9912 .setup = alc885_mbp3_setup,
9913 .init_hook = alc_automute_amp,
9916 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9917 .init_verbs = { alc885_mb5_init_verbs,
9918 alc880_gpio1_init_verbs },
9919 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9920 .dac_nids = alc882_dac_nids,
9921 .channel_mode = alc885_mb5_6ch_modes,
9922 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9923 .input_mux = &mb5_capture_source,
9924 .dig_out_nid = ALC882_DIGOUT_NID,
9925 .dig_in_nid = ALC882_DIGIN_NID,
9926 .unsol_event = alc_automute_amp_unsol_event,
9927 .setup = alc885_mb5_setup,
9928 .init_hook = alc_automute_amp,
9930 [ALC885_MACMINI3] = {
9931 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9932 .init_verbs = { alc885_macmini3_init_verbs,
9933 alc880_gpio1_init_verbs },
9934 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9935 .dac_nids = alc882_dac_nids,
9936 .channel_mode = alc885_macmini3_6ch_modes,
9937 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9938 .input_mux = &macmini3_capture_source,
9939 .dig_out_nid = ALC882_DIGOUT_NID,
9940 .dig_in_nid = ALC882_DIGIN_NID,
9941 .unsol_event = alc_automute_amp_unsol_event,
9942 .setup = alc885_macmini3_setup,
9943 .init_hook = alc_automute_amp,
9946 .mixers = { alc882_macpro_mixer },
9947 .init_verbs = { alc882_macpro_init_verbs },
9948 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9949 .dac_nids = alc882_dac_nids,
9950 .dig_out_nid = ALC882_DIGOUT_NID,
9951 .dig_in_nid = ALC882_DIGIN_NID,
9952 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9953 .channel_mode = alc882_ch_modes,
9954 .input_mux = &alc882_capture_source,
9955 .init_hook = alc885_macpro_init_hook,
9958 .mixers = { alc885_imac24_mixer },
9959 .init_verbs = { alc885_imac24_init_verbs },
9960 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9961 .dac_nids = alc882_dac_nids,
9962 .dig_out_nid = ALC882_DIGOUT_NID,
9963 .dig_in_nid = ALC882_DIGIN_NID,
9964 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9965 .channel_mode = alc882_ch_modes,
9966 .input_mux = &alc882_capture_source,
9967 .unsol_event = alc_automute_amp_unsol_event,
9968 .setup = alc885_imac24_setup,
9969 .init_hook = alc885_imac24_init_hook,
9972 .mixers = {alc885_imac91_mixer},
9973 .init_verbs = { alc885_imac91_init_verbs,
9974 alc880_gpio1_init_verbs },
9975 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9976 .dac_nids = alc882_dac_nids,
9977 .channel_mode = alc885_mba21_ch_modes,
9978 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9979 .input_mux = &alc889A_imac91_capture_source,
9980 .dig_out_nid = ALC882_DIGOUT_NID,
9981 .dig_in_nid = ALC882_DIGIN_NID,
9982 .unsol_event = alc_automute_amp_unsol_event,
9983 .setup = alc885_imac91_setup,
9984 .init_hook = alc_automute_amp,
9987 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9988 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9989 alc880_gpio3_init_verbs, alc882_targa_verbs},
9990 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9991 .dac_nids = alc882_dac_nids,
9992 .dig_out_nid = ALC882_DIGOUT_NID,
9993 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9994 .adc_nids = alc882_adc_nids,
9995 .capsrc_nids = alc882_capsrc_nids,
9996 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9997 .channel_mode = alc882_3ST_6ch_modes,
9999 .input_mux = &alc882_capture_source,
10000 .unsol_event = alc882_targa_unsol_event,
10001 .setup = alc882_targa_setup,
10002 .init_hook = alc882_targa_automute,
10004 [ALC882_ASUS_A7J] = {
10005 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10006 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10007 alc882_asus_a7j_verbs},
10008 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10009 .dac_nids = alc882_dac_nids,
10010 .dig_out_nid = ALC882_DIGOUT_NID,
10011 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10012 .adc_nids = alc882_adc_nids,
10013 .capsrc_nids = alc882_capsrc_nids,
10014 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10015 .channel_mode = alc882_3ST_6ch_modes,
10017 .input_mux = &alc882_capture_source,
10019 [ALC882_ASUS_A7M] = {
10020 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10021 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10022 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10023 alc882_asus_a7m_verbs },
10024 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10025 .dac_nids = alc882_dac_nids,
10026 .dig_out_nid = ALC882_DIGOUT_NID,
10027 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10028 .channel_mode = alc880_threestack_modes,
10030 .input_mux = &alc882_capture_source,
10032 [ALC883_3ST_2ch_DIG] = {
10033 .mixers = { alc883_3ST_2ch_mixer },
10034 .init_verbs = { alc883_init_verbs },
10035 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10036 .dac_nids = alc883_dac_nids,
10037 .dig_out_nid = ALC883_DIGOUT_NID,
10038 .dig_in_nid = ALC883_DIGIN_NID,
10039 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10040 .channel_mode = alc883_3ST_2ch_modes,
10041 .input_mux = &alc883_capture_source,
10043 [ALC883_3ST_6ch_DIG] = {
10044 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10045 .init_verbs = { alc883_init_verbs },
10046 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10047 .dac_nids = alc883_dac_nids,
10048 .dig_out_nid = ALC883_DIGOUT_NID,
10049 .dig_in_nid = ALC883_DIGIN_NID,
10050 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10051 .channel_mode = alc883_3ST_6ch_modes,
10053 .input_mux = &alc883_capture_source,
10055 [ALC883_3ST_6ch] = {
10056 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10057 .init_verbs = { alc883_init_verbs },
10058 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10059 .dac_nids = alc883_dac_nids,
10060 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10061 .channel_mode = alc883_3ST_6ch_modes,
10063 .input_mux = &alc883_capture_source,
10065 [ALC883_3ST_6ch_INTEL] = {
10066 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10067 .init_verbs = { alc883_init_verbs },
10068 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10069 .dac_nids = alc883_dac_nids,
10070 .dig_out_nid = ALC883_DIGOUT_NID,
10071 .dig_in_nid = ALC883_DIGIN_NID,
10072 .slave_dig_outs = alc883_slave_dig_outs,
10073 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10074 .channel_mode = alc883_3ST_6ch_intel_modes,
10076 .input_mux = &alc883_3stack_6ch_intel,
10078 [ALC889A_INTEL] = {
10079 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10080 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10081 alc_hp15_unsol_verbs },
10082 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10083 .dac_nids = alc883_dac_nids,
10084 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10085 .adc_nids = alc889_adc_nids,
10086 .dig_out_nid = ALC883_DIGOUT_NID,
10087 .dig_in_nid = ALC883_DIGIN_NID,
10088 .slave_dig_outs = alc883_slave_dig_outs,
10089 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10090 .channel_mode = alc889_8ch_intel_modes,
10091 .capsrc_nids = alc889_capsrc_nids,
10092 .input_mux = &alc889_capture_source,
10093 .setup = alc889_automute_setup,
10094 .init_hook = alc_automute_amp,
10095 .unsol_event = alc_automute_amp_unsol_event,
10099 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10100 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10101 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10102 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10103 .dac_nids = alc883_dac_nids,
10104 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10105 .adc_nids = alc889_adc_nids,
10106 .dig_out_nid = ALC883_DIGOUT_NID,
10107 .dig_in_nid = ALC883_DIGIN_NID,
10108 .slave_dig_outs = alc883_slave_dig_outs,
10109 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10110 .channel_mode = alc889_8ch_intel_modes,
10111 .capsrc_nids = alc889_capsrc_nids,
10112 .input_mux = &alc889_capture_source,
10113 .setup = alc889_automute_setup,
10114 .init_hook = alc889_intel_init_hook,
10115 .unsol_event = alc_automute_amp_unsol_event,
10118 [ALC883_6ST_DIG] = {
10119 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10120 .init_verbs = { alc883_init_verbs },
10121 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10122 .dac_nids = alc883_dac_nids,
10123 .dig_out_nid = ALC883_DIGOUT_NID,
10124 .dig_in_nid = ALC883_DIGIN_NID,
10125 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10126 .channel_mode = alc883_sixstack_modes,
10127 .input_mux = &alc883_capture_source,
10129 [ALC883_TARGA_DIG] = {
10130 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10131 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10132 alc883_targa_verbs},
10133 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10134 .dac_nids = alc883_dac_nids,
10135 .dig_out_nid = ALC883_DIGOUT_NID,
10136 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10137 .channel_mode = alc883_3ST_6ch_modes,
10139 .input_mux = &alc883_capture_source,
10140 .unsol_event = alc883_targa_unsol_event,
10141 .setup = alc882_targa_setup,
10142 .init_hook = alc882_targa_automute,
10144 [ALC883_TARGA_2ch_DIG] = {
10145 .mixers = { alc883_targa_2ch_mixer},
10146 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10147 alc883_targa_verbs},
10148 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10149 .dac_nids = alc883_dac_nids,
10150 .adc_nids = alc883_adc_nids_alt,
10151 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10152 .capsrc_nids = alc883_capsrc_nids,
10153 .dig_out_nid = ALC883_DIGOUT_NID,
10154 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10155 .channel_mode = alc883_3ST_2ch_modes,
10156 .input_mux = &alc883_capture_source,
10157 .unsol_event = alc883_targa_unsol_event,
10158 .setup = alc882_targa_setup,
10159 .init_hook = alc882_targa_automute,
10161 [ALC883_TARGA_8ch_DIG] = {
10162 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10163 alc883_chmode_mixer },
10164 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10165 alc883_targa_verbs },
10166 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10167 .dac_nids = alc883_dac_nids,
10168 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10169 .adc_nids = alc883_adc_nids_rev,
10170 .capsrc_nids = alc883_capsrc_nids_rev,
10171 .dig_out_nid = ALC883_DIGOUT_NID,
10172 .dig_in_nid = ALC883_DIGIN_NID,
10173 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10174 .channel_mode = alc883_4ST_8ch_modes,
10176 .input_mux = &alc883_capture_source,
10177 .unsol_event = alc883_targa_unsol_event,
10178 .setup = alc882_targa_setup,
10179 .init_hook = alc882_targa_automute,
10182 .mixers = { alc883_base_mixer },
10183 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10184 * and the headphone jack. Turn this on and rely on the
10185 * standard mute methods whenever the user wants to turn
10186 * these outputs off.
10188 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10189 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10190 .dac_nids = alc883_dac_nids,
10191 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10192 .channel_mode = alc883_3ST_2ch_modes,
10193 .input_mux = &alc883_capture_source,
10195 [ALC883_ACER_ASPIRE] = {
10196 .mixers = { alc883_acer_aspire_mixer },
10197 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10198 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10199 .dac_nids = alc883_dac_nids,
10200 .dig_out_nid = ALC883_DIGOUT_NID,
10201 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10202 .channel_mode = alc883_3ST_2ch_modes,
10203 .input_mux = &alc883_capture_source,
10204 .unsol_event = alc_automute_amp_unsol_event,
10205 .setup = alc883_acer_aspire_setup,
10206 .init_hook = alc_automute_amp,
10208 [ALC888_ACER_ASPIRE_4930G] = {
10209 .mixers = { alc888_base_mixer,
10210 alc883_chmode_mixer },
10211 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10212 alc888_acer_aspire_4930g_verbs },
10213 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10214 .dac_nids = alc883_dac_nids,
10215 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10216 .adc_nids = alc883_adc_nids_rev,
10217 .capsrc_nids = alc883_capsrc_nids_rev,
10218 .dig_out_nid = ALC883_DIGOUT_NID,
10219 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10220 .channel_mode = alc883_3ST_6ch_modes,
10222 .const_channel_count = 6,
10224 ARRAY_SIZE(alc888_2_capture_sources),
10225 .input_mux = alc888_2_capture_sources,
10226 .unsol_event = alc_automute_amp_unsol_event,
10227 .setup = alc888_acer_aspire_4930g_setup,
10228 .init_hook = alc_automute_amp,
10230 [ALC888_ACER_ASPIRE_6530G] = {
10231 .mixers = { alc888_acer_aspire_6530_mixer },
10232 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10233 alc888_acer_aspire_6530g_verbs },
10234 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10235 .dac_nids = alc883_dac_nids,
10236 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10237 .adc_nids = alc883_adc_nids_rev,
10238 .capsrc_nids = alc883_capsrc_nids_rev,
10239 .dig_out_nid = ALC883_DIGOUT_NID,
10240 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10241 .channel_mode = alc883_3ST_2ch_modes,
10243 ARRAY_SIZE(alc888_2_capture_sources),
10244 .input_mux = alc888_acer_aspire_6530_sources,
10245 .unsol_event = alc_automute_amp_unsol_event,
10246 .setup = alc888_acer_aspire_6530g_setup,
10247 .init_hook = alc_automute_amp,
10249 [ALC888_ACER_ASPIRE_8930G] = {
10250 .mixers = { alc889_acer_aspire_8930g_mixer,
10251 alc883_chmode_mixer },
10252 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10253 alc889_acer_aspire_8930g_verbs,
10254 alc889_eapd_verbs},
10255 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10256 .dac_nids = alc883_dac_nids,
10257 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10258 .adc_nids = alc889_adc_nids,
10259 .capsrc_nids = alc889_capsrc_nids,
10260 .dig_out_nid = ALC883_DIGOUT_NID,
10261 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10262 .channel_mode = alc883_3ST_6ch_modes,
10264 .const_channel_count = 6,
10266 ARRAY_SIZE(alc889_capture_sources),
10267 .input_mux = alc889_capture_sources,
10268 .unsol_event = alc_automute_amp_unsol_event,
10269 .setup = alc889_acer_aspire_8930g_setup,
10270 .init_hook = alc_automute_amp,
10271 #ifdef CONFIG_SND_HDA_POWER_SAVE
10272 .power_hook = alc_power_eapd,
10275 [ALC888_ACER_ASPIRE_7730G] = {
10276 .mixers = { alc883_3ST_6ch_mixer,
10277 alc883_chmode_mixer },
10278 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10279 alc888_acer_aspire_7730G_verbs },
10280 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10281 .dac_nids = alc883_dac_nids,
10282 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10283 .adc_nids = alc883_adc_nids_rev,
10284 .capsrc_nids = alc883_capsrc_nids_rev,
10285 .dig_out_nid = ALC883_DIGOUT_NID,
10286 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10287 .channel_mode = alc883_3ST_6ch_modes,
10289 .const_channel_count = 6,
10290 .input_mux = &alc883_capture_source,
10291 .unsol_event = alc_automute_amp_unsol_event,
10292 .setup = alc888_acer_aspire_6530g_setup,
10293 .init_hook = alc_automute_amp,
10295 [ALC883_MEDION] = {
10296 .mixers = { alc883_fivestack_mixer,
10297 alc883_chmode_mixer },
10298 .init_verbs = { alc883_init_verbs,
10299 alc883_medion_eapd_verbs },
10300 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10301 .dac_nids = alc883_dac_nids,
10302 .adc_nids = alc883_adc_nids_alt,
10303 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10304 .capsrc_nids = alc883_capsrc_nids,
10305 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10306 .channel_mode = alc883_sixstack_modes,
10307 .input_mux = &alc883_capture_source,
10309 [ALC883_MEDION_MD2] = {
10310 .mixers = { alc883_medion_md2_mixer},
10311 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
10312 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10313 .dac_nids = alc883_dac_nids,
10314 .dig_out_nid = ALC883_DIGOUT_NID,
10315 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10316 .channel_mode = alc883_3ST_2ch_modes,
10317 .input_mux = &alc883_capture_source,
10318 .unsol_event = alc_automute_amp_unsol_event,
10319 .setup = alc883_medion_md2_setup,
10320 .init_hook = alc_automute_amp,
10322 [ALC883_MEDION_WIM2160] = {
10323 .mixers = { alc883_medion_wim2160_mixer },
10324 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10325 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10326 .dac_nids = alc883_dac_nids,
10327 .dig_out_nid = ALC883_DIGOUT_NID,
10328 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10329 .adc_nids = alc883_adc_nids,
10330 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10331 .channel_mode = alc883_3ST_2ch_modes,
10332 .input_mux = &alc883_capture_source,
10333 .unsol_event = alc_automute_amp_unsol_event,
10334 .setup = alc883_medion_wim2160_setup,
10335 .init_hook = alc_automute_amp,
10337 [ALC883_LAPTOP_EAPD] = {
10338 .mixers = { alc883_base_mixer },
10339 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10340 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10341 .dac_nids = alc883_dac_nids,
10342 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10343 .channel_mode = alc883_3ST_2ch_modes,
10344 .input_mux = &alc883_capture_source,
10346 [ALC883_CLEVO_M540R] = {
10347 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10348 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10349 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10350 .dac_nids = alc883_dac_nids,
10351 .dig_out_nid = ALC883_DIGOUT_NID,
10352 .dig_in_nid = ALC883_DIGIN_NID,
10353 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10354 .channel_mode = alc883_3ST_6ch_clevo_modes,
10356 .input_mux = &alc883_capture_source,
10357 /* This machine has the hardware HP auto-muting, thus
10358 * we need no software mute via unsol event
10361 [ALC883_CLEVO_M720] = {
10362 .mixers = { alc883_clevo_m720_mixer },
10363 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10364 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10365 .dac_nids = alc883_dac_nids,
10366 .dig_out_nid = ALC883_DIGOUT_NID,
10367 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10368 .channel_mode = alc883_3ST_2ch_modes,
10369 .input_mux = &alc883_capture_source,
10370 .unsol_event = alc883_clevo_m720_unsol_event,
10371 .setup = alc883_clevo_m720_setup,
10372 .init_hook = alc883_clevo_m720_init_hook,
10374 [ALC883_LENOVO_101E_2ch] = {
10375 .mixers = { alc883_lenovo_101e_2ch_mixer},
10376 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10377 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10378 .dac_nids = alc883_dac_nids,
10379 .adc_nids = alc883_adc_nids_alt,
10380 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10381 .capsrc_nids = alc883_capsrc_nids,
10382 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10383 .channel_mode = alc883_3ST_2ch_modes,
10384 .input_mux = &alc883_lenovo_101e_capture_source,
10385 .unsol_event = alc883_lenovo_101e_unsol_event,
10386 .init_hook = alc883_lenovo_101e_all_automute,
10388 [ALC883_LENOVO_NB0763] = {
10389 .mixers = { alc883_lenovo_nb0763_mixer },
10390 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10391 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10392 .dac_nids = alc883_dac_nids,
10393 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10394 .channel_mode = alc883_3ST_2ch_modes,
10396 .input_mux = &alc883_lenovo_nb0763_capture_source,
10397 .unsol_event = alc_automute_amp_unsol_event,
10398 .setup = alc883_medion_md2_setup,
10399 .init_hook = alc_automute_amp,
10401 [ALC888_LENOVO_MS7195_DIG] = {
10402 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10403 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10404 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10405 .dac_nids = alc883_dac_nids,
10406 .dig_out_nid = ALC883_DIGOUT_NID,
10407 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10408 .channel_mode = alc883_3ST_6ch_modes,
10410 .input_mux = &alc883_capture_source,
10411 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10412 .init_hook = alc888_lenovo_ms7195_front_automute,
10414 [ALC883_HAIER_W66] = {
10415 .mixers = { alc883_targa_2ch_mixer},
10416 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10417 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10418 .dac_nids = alc883_dac_nids,
10419 .dig_out_nid = ALC883_DIGOUT_NID,
10420 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10421 .channel_mode = alc883_3ST_2ch_modes,
10422 .input_mux = &alc883_capture_source,
10423 .unsol_event = alc_automute_amp_unsol_event,
10424 .setup = alc883_haier_w66_setup,
10425 .init_hook = alc_automute_amp,
10427 [ALC888_3ST_HP] = {
10428 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10429 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10430 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10431 .dac_nids = alc883_dac_nids,
10432 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10433 .channel_mode = alc888_3st_hp_modes,
10435 .input_mux = &alc883_capture_source,
10436 .unsol_event = alc_automute_amp_unsol_event,
10437 .setup = alc888_3st_hp_setup,
10438 .init_hook = alc_automute_amp,
10440 [ALC888_6ST_DELL] = {
10441 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10442 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10443 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10444 .dac_nids = alc883_dac_nids,
10445 .dig_out_nid = ALC883_DIGOUT_NID,
10446 .dig_in_nid = ALC883_DIGIN_NID,
10447 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10448 .channel_mode = alc883_sixstack_modes,
10449 .input_mux = &alc883_capture_source,
10450 .unsol_event = alc_automute_amp_unsol_event,
10451 .setup = alc888_6st_dell_setup,
10452 .init_hook = alc_automute_amp,
10455 .mixers = { alc883_mitac_mixer },
10456 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10457 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10458 .dac_nids = alc883_dac_nids,
10459 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10460 .channel_mode = alc883_3ST_2ch_modes,
10461 .input_mux = &alc883_capture_source,
10462 .unsol_event = alc_automute_amp_unsol_event,
10463 .setup = alc883_mitac_setup,
10464 .init_hook = alc_automute_amp,
10466 [ALC883_FUJITSU_PI2515] = {
10467 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10468 .init_verbs = { alc883_init_verbs,
10469 alc883_2ch_fujitsu_pi2515_verbs},
10470 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10471 .dac_nids = alc883_dac_nids,
10472 .dig_out_nid = ALC883_DIGOUT_NID,
10473 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10474 .channel_mode = alc883_3ST_2ch_modes,
10475 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10476 .unsol_event = alc_automute_amp_unsol_event,
10477 .setup = alc883_2ch_fujitsu_pi2515_setup,
10478 .init_hook = alc_automute_amp,
10480 [ALC888_FUJITSU_XA3530] = {
10481 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10482 .init_verbs = { alc883_init_verbs,
10483 alc888_fujitsu_xa3530_verbs },
10484 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10485 .dac_nids = alc883_dac_nids,
10486 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10487 .adc_nids = alc883_adc_nids_rev,
10488 .capsrc_nids = alc883_capsrc_nids_rev,
10489 .dig_out_nid = ALC883_DIGOUT_NID,
10490 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10491 .channel_mode = alc888_4ST_8ch_intel_modes,
10493 ARRAY_SIZE(alc888_2_capture_sources),
10494 .input_mux = alc888_2_capture_sources,
10495 .unsol_event = alc_automute_amp_unsol_event,
10496 .setup = alc888_fujitsu_xa3530_setup,
10497 .init_hook = alc_automute_amp,
10499 [ALC888_LENOVO_SKY] = {
10500 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10501 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10502 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10503 .dac_nids = alc883_dac_nids,
10504 .dig_out_nid = ALC883_DIGOUT_NID,
10505 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10506 .channel_mode = alc883_sixstack_modes,
10508 .input_mux = &alc883_lenovo_sky_capture_source,
10509 .unsol_event = alc_automute_amp_unsol_event,
10510 .setup = alc888_lenovo_sky_setup,
10511 .init_hook = alc_automute_amp,
10513 [ALC888_ASUS_M90V] = {
10514 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10515 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10516 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10517 .dac_nids = alc883_dac_nids,
10518 .dig_out_nid = ALC883_DIGOUT_NID,
10519 .dig_in_nid = ALC883_DIGIN_NID,
10520 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10521 .channel_mode = alc883_3ST_6ch_modes,
10523 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10524 .unsol_event = alc_sku_unsol_event,
10525 .setup = alc883_mode2_setup,
10526 .init_hook = alc_inithook,
10528 [ALC888_ASUS_EEE1601] = {
10529 .mixers = { alc883_asus_eee1601_mixer },
10530 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10531 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10532 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10533 .dac_nids = alc883_dac_nids,
10534 .dig_out_nid = ALC883_DIGOUT_NID,
10535 .dig_in_nid = ALC883_DIGIN_NID,
10536 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10537 .channel_mode = alc883_3ST_2ch_modes,
10539 .input_mux = &alc883_asus_eee1601_capture_source,
10540 .unsol_event = alc_sku_unsol_event,
10541 .init_hook = alc883_eee1601_inithook,
10543 [ALC1200_ASUS_P5Q] = {
10544 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10545 .init_verbs = { alc883_init_verbs },
10546 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10547 .dac_nids = alc883_dac_nids,
10548 .dig_out_nid = ALC1200_DIGOUT_NID,
10549 .dig_in_nid = ALC883_DIGIN_NID,
10550 .slave_dig_outs = alc1200_slave_dig_outs,
10551 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10552 .channel_mode = alc883_sixstack_modes,
10553 .input_mux = &alc883_capture_source,
10556 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10557 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10558 alc880_gpio1_init_verbs },
10559 .adc_nids = alc883_adc_nids,
10560 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10561 .capsrc_nids = alc883_capsrc_nids,
10562 .dac_nids = alc883_dac_nids,
10563 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10564 .channel_mode = alc889A_mb31_6ch_modes,
10565 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10566 .input_mux = &alc889A_mb31_capture_source,
10567 .dig_out_nid = ALC883_DIGOUT_NID,
10568 .unsol_event = alc889A_mb31_unsol_event,
10569 .init_hook = alc889A_mb31_automute,
10571 [ALC883_SONY_VAIO_TT] = {
10572 .mixers = { alc883_vaiott_mixer },
10573 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10574 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10575 .dac_nids = alc883_dac_nids,
10576 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10577 .channel_mode = alc883_3ST_2ch_modes,
10578 .input_mux = &alc883_capture_source,
10579 .unsol_event = alc_automute_amp_unsol_event,
10580 .setup = alc883_vaiott_setup,
10581 .init_hook = alc_automute_amp,
10590 PINFIX_ABIT_AW9D_MAX,
10594 static const struct alc_fixup alc882_fixups[] = {
10595 [PINFIX_ABIT_AW9D_MAX] = {
10596 .pins = (const struct alc_pincfg[]) {
10597 { 0x15, 0x01080104 }, /* side */
10598 { 0x16, 0x01011012 }, /* rear */
10599 { 0x17, 0x01016011 }, /* clfe */
10603 [PINFIX_PB_M5210] = {
10604 .verbs = (const struct hda_verb[]) {
10605 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10611 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10612 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10613 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10618 * BIOS auto configuration
10620 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10621 const struct auto_pin_cfg *cfg)
10623 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10626 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10627 hda_nid_t nid, int pin_type,
10632 /* set as output */
10633 alc_set_pin_output(codec, nid, pin_type);
10637 else if (dac >= 0x02 && dac <= 0x05)
10641 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10644 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10646 struct alc_spec *spec = codec->spec;
10649 for (i = 0; i <= HDA_SIDE; i++) {
10650 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10651 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10653 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10654 spec->multiout.dac_nids[i]);
10658 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10660 struct alc_spec *spec = codec->spec;
10661 hda_nid_t pin, dac;
10664 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10665 pin = spec->autocfg.hp_pins[i];
10668 dac = spec->multiout.hp_nid;
10670 dac = spec->multiout.dac_nids[0]; /* to front */
10671 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10673 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10674 pin = spec->autocfg.speaker_pins[i];
10677 dac = spec->multiout.extra_out_nid[0];
10679 dac = spec->multiout.dac_nids[0]; /* to front */
10680 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10684 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10686 struct alc_spec *spec = codec->spec;
10687 struct auto_pin_cfg *cfg = &spec->autocfg;
10690 for (i = 0; i < cfg->num_inputs; i++) {
10691 hda_nid_t nid = cfg->inputs[i].pin;
10692 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10693 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10694 snd_hda_codec_write(codec, nid, 0,
10695 AC_VERB_SET_AMP_GAIN_MUTE,
10700 static void alc882_auto_init_input_src(struct hda_codec *codec)
10702 struct alc_spec *spec = codec->spec;
10705 for (c = 0; c < spec->num_adc_nids; c++) {
10706 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10707 hda_nid_t nid = spec->capsrc_nids[c];
10708 unsigned int mux_idx;
10709 const struct hda_input_mux *imux;
10710 int conns, mute, idx, item;
10712 conns = snd_hda_get_connections(codec, nid, conn_list,
10713 ARRAY_SIZE(conn_list));
10716 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10717 imux = &spec->input_mux[mux_idx];
10718 if (!imux->num_items && mux_idx > 0)
10719 imux = &spec->input_mux[0];
10720 for (idx = 0; idx < conns; idx++) {
10721 /* if the current connection is the selected one,
10722 * unmute it as default - otherwise mute it
10724 mute = AMP_IN_MUTE(idx);
10725 for (item = 0; item < imux->num_items; item++) {
10726 if (imux->items[item].index == idx) {
10727 if (spec->cur_mux[c] == item)
10728 mute = AMP_IN_UNMUTE(idx);
10732 /* check if we have a selector or mixer
10733 * we could check for the widget type instead, but
10734 * just check for Amp-In presence (in case of mixer
10735 * without amp-in there is something wrong, this
10736 * function shouldn't be used or capsrc nid is wrong)
10738 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10739 snd_hda_codec_write(codec, nid, 0,
10740 AC_VERB_SET_AMP_GAIN_MUTE,
10742 else if (mute != AMP_IN_MUTE(idx))
10743 snd_hda_codec_write(codec, nid, 0,
10744 AC_VERB_SET_CONNECT_SEL,
10750 /* add mic boosts if needed */
10751 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10753 struct alc_spec *spec = codec->spec;
10754 struct auto_pin_cfg *cfg = &spec->autocfg;
10758 for (i = 0; i < cfg->num_inputs; i++) {
10759 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10761 nid = cfg->inputs[i].pin;
10762 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10764 snprintf(label, sizeof(label), "%s Boost",
10765 hda_get_autocfg_input_label(codec, cfg, i));
10766 err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0,
10767 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10775 /* almost identical with ALC880 parser... */
10776 static int alc882_parse_auto_config(struct hda_codec *codec)
10778 struct alc_spec *spec = codec->spec;
10779 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10782 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10786 if (!spec->autocfg.line_outs)
10787 return 0; /* can't find valid BIOS pin config */
10789 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10792 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10795 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10799 err = alc880_auto_create_extra_out(spec,
10800 spec->autocfg.speaker_pins[0],
10804 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10808 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10810 alc_auto_parse_digital(codec);
10812 if (spec->kctls.list)
10813 add_mixer(spec, spec->kctls.list);
10815 add_verb(spec, alc883_auto_init_verbs);
10816 /* if ADC 0x07 is available, initialize it, too */
10817 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10818 add_verb(spec, alc882_adc1_init_verbs);
10820 spec->num_mux_defs = 1;
10821 spec->input_mux = &spec->private_imux[0];
10823 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10825 err = alc_auto_add_mic_boost(codec);
10829 return 1; /* config found */
10832 /* additional initialization for auto-configuration model */
10833 static void alc882_auto_init(struct hda_codec *codec)
10835 struct alc_spec *spec = codec->spec;
10836 alc882_auto_init_multi_out(codec);
10837 alc882_auto_init_hp_out(codec);
10838 alc882_auto_init_analog_input(codec);
10839 alc882_auto_init_input_src(codec);
10840 alc_auto_init_digital(codec);
10841 if (spec->unsol_event)
10842 alc_inithook(codec);
10845 static int patch_alc882(struct hda_codec *codec)
10847 struct alc_spec *spec;
10848 int err, board_config;
10850 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10854 codec->spec = spec;
10856 alc_auto_parse_customize_define(codec);
10858 switch (codec->vendor_id) {
10863 /* ALC883 and variants */
10864 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10868 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10872 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10873 board_config = snd_hda_check_board_codec_sid_config(codec,
10874 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10876 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10877 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10879 board_config = ALC882_AUTO;
10882 if (board_config == ALC882_AUTO)
10883 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10885 if (board_config == ALC882_AUTO) {
10886 /* automatic parse from the BIOS config */
10887 err = alc882_parse_auto_config(codec);
10893 "hda_codec: Cannot set up configuration "
10894 "from BIOS. Using base mode...\n");
10895 board_config = ALC882_3ST_DIG;
10899 if (has_cdefine_beep(codec)) {
10900 err = snd_hda_attach_beep_device(codec, 0x1);
10907 if (board_config != ALC882_AUTO)
10908 setup_preset(codec, &alc882_presets[board_config]);
10910 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10911 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10912 /* FIXME: setup DAC5 */
10913 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10914 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10916 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10917 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10919 if (!spec->adc_nids && spec->input_mux) {
10921 spec->num_adc_nids = 0;
10922 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10923 const struct hda_input_mux *imux = spec->input_mux;
10925 hda_nid_t items[16];
10926 hda_nid_t nid = alc882_adc_nids[i];
10927 unsigned int wcap = get_wcaps(codec, nid);
10929 wcap = get_wcaps_type(wcap);
10930 if (wcap != AC_WID_AUD_IN)
10932 spec->private_adc_nids[spec->num_adc_nids] = nid;
10933 err = snd_hda_get_connections(codec, nid, &cap, 1);
10936 err = snd_hda_get_connections(codec, cap, items,
10937 ARRAY_SIZE(items));
10940 for (j = 0; j < imux->num_items; j++)
10941 if (imux->items[j].index >= err)
10943 if (j < imux->num_items)
10945 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10946 spec->num_adc_nids++;
10948 spec->adc_nids = spec->private_adc_nids;
10949 spec->capsrc_nids = spec->private_capsrc_nids;
10952 set_capture_mixer(codec);
10954 if (has_cdefine_beep(codec))
10955 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10957 if (board_config == ALC882_AUTO)
10958 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
10960 spec->vmaster_nid = 0x0c;
10962 codec->patch_ops = alc_patch_ops;
10963 if (board_config == ALC882_AUTO)
10964 spec->init_hook = alc882_auto_init;
10965 #ifdef CONFIG_SND_HDA_POWER_SAVE
10966 if (!spec->loopback.amplist)
10967 spec->loopback.amplist = alc882_loopbacks;
10978 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10979 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10981 #define alc262_dac_nids alc260_dac_nids
10982 #define alc262_adc_nids alc882_adc_nids
10983 #define alc262_adc_nids_alt alc882_adc_nids_alt
10984 #define alc262_capsrc_nids alc882_capsrc_nids
10985 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10987 #define alc262_modes alc260_modes
10988 #define alc262_capture_source alc882_capture_source
10990 static hda_nid_t alc262_dmic_adc_nids[1] = {
10995 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10997 static struct snd_kcontrol_new alc262_base_mixer[] = {
10998 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10999 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11000 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11001 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11002 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11003 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11004 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11005 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11006 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11007 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11008 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11009 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11010 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11011 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11012 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11013 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11017 /* update HP, line and mono-out pins according to the master switch */
11018 static void alc262_hp_master_update(struct hda_codec *codec)
11020 struct alc_spec *spec = codec->spec;
11021 int val = spec->master_sw;
11023 /* HP & line-out */
11024 snd_hda_codec_write_cache(codec, 0x1b, 0,
11025 AC_VERB_SET_PIN_WIDGET_CONTROL,
11027 snd_hda_codec_write_cache(codec, 0x15, 0,
11028 AC_VERB_SET_PIN_WIDGET_CONTROL,
11030 /* mono (speaker) depending on the HP jack sense */
11031 val = val && !spec->jack_present;
11032 snd_hda_codec_write_cache(codec, 0x16, 0,
11033 AC_VERB_SET_PIN_WIDGET_CONTROL,
11034 val ? PIN_OUT : 0);
11037 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11039 struct alc_spec *spec = codec->spec;
11041 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11042 alc262_hp_master_update(codec);
11045 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11047 if ((res >> 26) != ALC880_HP_EVENT)
11049 alc262_hp_bpc_automute(codec);
11052 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11054 struct alc_spec *spec = codec->spec;
11056 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11057 alc262_hp_master_update(codec);
11060 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11063 if ((res >> 26) != ALC880_HP_EVENT)
11065 alc262_hp_wildwest_automute(codec);
11068 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11070 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11071 struct snd_ctl_elem_value *ucontrol)
11073 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11074 struct alc_spec *spec = codec->spec;
11075 int val = !!*ucontrol->value.integer.value;
11077 if (val == spec->master_sw)
11079 spec->master_sw = val;
11080 alc262_hp_master_update(codec);
11084 #define ALC262_HP_MASTER_SWITCH \
11086 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11087 .name = "Master Playback Switch", \
11088 .info = snd_ctl_boolean_mono_info, \
11089 .get = alc262_hp_master_sw_get, \
11090 .put = alc262_hp_master_sw_put, \
11093 .iface = NID_MAPPING, \
11094 .name = "Master Playback Switch", \
11095 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11099 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11100 ALC262_HP_MASTER_SWITCH,
11101 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11102 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11103 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11104 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11106 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11110 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11111 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11112 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11113 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11114 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11115 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11116 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11117 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11118 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11119 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11123 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11124 ALC262_HP_MASTER_SWITCH,
11125 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11126 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11127 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11129 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11131 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11133 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11134 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11135 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
11136 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11137 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11138 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11139 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11143 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11144 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11145 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11146 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
11150 /* mute/unmute internal speaker according to the hp jack and mute state */
11151 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11153 struct alc_spec *spec = codec->spec;
11155 spec->autocfg.hp_pins[0] = 0x15;
11156 spec->autocfg.speaker_pins[0] = 0x14;
11159 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11160 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11161 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11162 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11163 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11164 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11165 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11166 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11170 static struct hda_verb alc262_hp_t5735_verbs[] = {
11171 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11172 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11174 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11178 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11179 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11180 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11181 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11182 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11183 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11184 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11188 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11189 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11190 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11191 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11192 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11193 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11194 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11195 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11197 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11202 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11209 /* bind hp and internal speaker mute (with plug check) as master switch */
11210 static void alc262_hippo_master_update(struct hda_codec *codec)
11212 struct alc_spec *spec = codec->spec;
11213 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11214 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11215 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11219 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11220 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11221 HDA_AMP_MUTE, mute);
11222 /* mute internal speaker per jack sense */
11223 if (spec->jack_present)
11224 mute = HDA_AMP_MUTE;
11226 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11227 HDA_AMP_MUTE, mute);
11228 if (speaker_nid && speaker_nid != line_nid)
11229 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11230 HDA_AMP_MUTE, mute);
11233 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11235 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11236 struct snd_ctl_elem_value *ucontrol)
11238 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11239 struct alc_spec *spec = codec->spec;
11240 int val = !!*ucontrol->value.integer.value;
11242 if (val == spec->master_sw)
11244 spec->master_sw = val;
11245 alc262_hippo_master_update(codec);
11249 #define ALC262_HIPPO_MASTER_SWITCH \
11251 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11252 .name = "Master Playback Switch", \
11253 .info = snd_ctl_boolean_mono_info, \
11254 .get = alc262_hippo_master_sw_get, \
11255 .put = alc262_hippo_master_sw_put, \
11258 .iface = NID_MAPPING, \
11259 .name = "Master Playback Switch", \
11260 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11261 (SUBDEV_SPEAKER(0) << 16), \
11264 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11265 ALC262_HIPPO_MASTER_SWITCH,
11266 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11267 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11268 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11269 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11270 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11272 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11274 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11275 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11276 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11277 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11281 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11282 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11283 ALC262_HIPPO_MASTER_SWITCH,
11284 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11285 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11286 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11287 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11288 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11290 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11291 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11292 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11293 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11297 /* mute/unmute internal speaker according to the hp jack and mute state */
11298 static void alc262_hippo_automute(struct hda_codec *codec)
11300 struct alc_spec *spec = codec->spec;
11301 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11303 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11304 alc262_hippo_master_update(codec);
11307 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11309 if ((res >> 26) != ALC880_HP_EVENT)
11311 alc262_hippo_automute(codec);
11314 static void alc262_hippo_setup(struct hda_codec *codec)
11316 struct alc_spec *spec = codec->spec;
11318 spec->autocfg.hp_pins[0] = 0x15;
11319 spec->autocfg.speaker_pins[0] = 0x14;
11322 static void alc262_hippo1_setup(struct hda_codec *codec)
11324 struct alc_spec *spec = codec->spec;
11326 spec->autocfg.hp_pins[0] = 0x1b;
11327 spec->autocfg.speaker_pins[0] = 0x14;
11331 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11332 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11333 ALC262_HIPPO_MASTER_SWITCH,
11334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11335 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11336 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11337 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11341 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11342 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11343 ALC262_HIPPO_MASTER_SWITCH,
11344 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11345 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11346 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11347 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11348 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11352 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11353 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11354 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11355 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11356 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11360 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11361 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11362 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11363 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11364 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11368 static struct hda_verb alc262_tyan_verbs[] = {
11369 /* Headphone automute */
11370 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11371 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11372 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11374 /* P11 AUX_IN, white 4-pin connector */
11375 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11376 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11377 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11378 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11383 /* unsolicited event for HP jack sensing */
11384 static void alc262_tyan_setup(struct hda_codec *codec)
11386 struct alc_spec *spec = codec->spec;
11388 spec->autocfg.hp_pins[0] = 0x1b;
11389 spec->autocfg.speaker_pins[0] = 0x15;
11393 #define alc262_capture_mixer alc882_capture_mixer
11394 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11397 * generic initialization of ADC, input mixers and output mixers
11399 static struct hda_verb alc262_init_verbs[] = {
11401 * Unmute ADC0-2 and set the default input to mic-in
11403 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11404 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11405 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11406 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11407 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11408 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11410 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11412 * Note: PASD motherboards uses the Line In 2 as the input for
11413 * front panel mic (mic 2)
11415 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11423 * Set up output mixers (0x0c - 0x0e)
11425 /* set vol=0 to output mixers */
11426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11427 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11428 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11429 /* set up input amps for analog loopback */
11430 /* Amp Indices: DAC = 0, mixer = 1 */
11431 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11432 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11433 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11434 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11436 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11438 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11439 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11440 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11441 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11442 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11443 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11445 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11447 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11448 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11449 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11451 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11452 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11454 /* FIXME: use matrix-type input source selection */
11455 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11456 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11458 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11467 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11475 static struct hda_verb alc262_eapd_verbs[] = {
11476 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11477 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11481 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11482 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11483 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11484 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11486 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11487 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11491 static struct hda_verb alc262_sony_unsol_verbs[] = {
11492 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11493 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11494 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11496 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11497 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11501 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11502 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11503 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11504 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11505 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11506 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11510 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11511 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11513 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11514 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11515 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11516 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11517 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11518 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11522 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11524 struct alc_spec *spec = codec->spec;
11526 spec->autocfg.hp_pins[0] = 0x15;
11527 spec->autocfg.speaker_pins[0] = 0x14;
11528 spec->ext_mic.pin = 0x18;
11529 spec->ext_mic.mux_idx = 0;
11530 spec->int_mic.pin = 0x12;
11531 spec->int_mic.mux_idx = 9;
11532 spec->auto_mic = 1;
11538 * 0x16 = internal speaker
11539 * 0x18 = external mic
11542 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11543 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11544 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11546 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11547 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11548 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11550 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11551 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11555 static struct hda_verb alc262_nec_verbs[] = {
11556 /* Unmute Speaker */
11557 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11560 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11561 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11563 /* External mic to headphone */
11564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11565 /* External mic to speaker */
11566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11572 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11573 * 0x1b = port replicator headphone out
11576 #define ALC_HP_EVENT 0x37
11578 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11579 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11581 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11582 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11586 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11587 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11588 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11592 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11593 /* Front Mic pin: input vref at 50% */
11594 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11595 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11599 static struct hda_input_mux alc262_fujitsu_capture_source = {
11603 { "Int Mic", 0x1 },
11608 static struct hda_input_mux alc262_HP_capture_source = {
11612 { "Front Mic", 0x1 },
11619 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11623 { "Front Mic", 0x2 },
11629 /* mute/unmute internal speaker according to the hp jacks and mute state */
11630 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11632 struct alc_spec *spec = codec->spec;
11635 if (force || !spec->sense_updated) {
11636 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11637 snd_hda_jack_detect(codec, 0x1b);
11638 spec->sense_updated = 1;
11640 /* unmute internal speaker only if both HPs are unplugged and
11641 * master switch is on
11643 if (spec->jack_present)
11644 mute = HDA_AMP_MUTE;
11646 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11647 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11648 HDA_AMP_MUTE, mute);
11651 /* unsolicited event for HP jack sensing */
11652 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11655 if ((res >> 26) != ALC_HP_EVENT)
11657 alc262_fujitsu_automute(codec, 1);
11660 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11662 alc262_fujitsu_automute(codec, 1);
11665 /* bind volumes of both NID 0x0c and 0x0d */
11666 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11667 .ops = &snd_hda_bind_vol,
11669 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11670 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11675 /* mute/unmute internal speaker according to the hp jack and mute state */
11676 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11678 struct alc_spec *spec = codec->spec;
11681 if (force || !spec->sense_updated) {
11682 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11683 spec->sense_updated = 1;
11685 if (spec->jack_present) {
11686 /* mute internal speaker */
11687 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11688 HDA_AMP_MUTE, HDA_AMP_MUTE);
11689 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11690 HDA_AMP_MUTE, HDA_AMP_MUTE);
11692 /* unmute internal speaker if necessary */
11693 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11694 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11695 HDA_AMP_MUTE, mute);
11696 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11697 HDA_AMP_MUTE, mute);
11701 /* unsolicited event for HP jack sensing */
11702 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11705 if ((res >> 26) != ALC_HP_EVENT)
11707 alc262_lenovo_3000_automute(codec, 1);
11710 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11711 int dir, int idx, long *valp)
11715 for (i = 0; i < 2; i++, valp++)
11716 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11718 *valp ? 0 : HDA_AMP_MUTE);
11722 /* bind hp and internal speaker mute (with plug check) */
11723 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11724 struct snd_ctl_elem_value *ucontrol)
11726 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11727 long *valp = ucontrol->value.integer.value;
11730 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11731 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11733 alc262_fujitsu_automute(codec, 0);
11737 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11738 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11740 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11741 .name = "Master Playback Switch",
11742 .subdevice = HDA_SUBDEV_AMP_FLAG,
11743 .info = snd_hda_mixer_amp_switch_info,
11744 .get = snd_hda_mixer_amp_switch_get,
11745 .put = alc262_fujitsu_master_sw_put,
11746 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11749 .iface = NID_MAPPING,
11750 .name = "Master Playback Switch",
11751 .private_value = 0x1b,
11753 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11754 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11755 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11756 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11757 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11758 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11759 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11760 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11764 /* bind hp and internal speaker mute (with plug check) */
11765 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11766 struct snd_ctl_elem_value *ucontrol)
11768 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11769 long *valp = ucontrol->value.integer.value;
11772 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11774 alc262_lenovo_3000_automute(codec, 0);
11778 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11779 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11781 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11782 .name = "Master Playback Switch",
11783 .subdevice = HDA_SUBDEV_AMP_FLAG,
11784 .info = snd_hda_mixer_amp_switch_info,
11785 .get = snd_hda_mixer_amp_switch_get,
11786 .put = alc262_lenovo_3000_master_sw_put,
11787 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11789 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11790 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11791 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11794 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11795 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11796 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11800 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11801 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11802 ALC262_HIPPO_MASTER_SWITCH,
11803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11805 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11806 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11807 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11808 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11812 /* additional init verbs for Benq laptops */
11813 static struct hda_verb alc262_EAPD_verbs[] = {
11814 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11815 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11819 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11820 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11821 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11823 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11824 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11828 /* Samsung Q1 Ultra Vista model setup */
11829 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11830 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11831 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11832 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11833 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11834 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11835 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11839 static struct hda_verb alc262_ultra_verbs[] = {
11841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11843 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11845 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11846 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11847 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11848 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11850 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11851 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11852 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11853 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11854 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11856 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11857 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11858 /* ADC, choose mic */
11859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11861 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11862 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11863 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11864 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11865 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11866 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11867 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11868 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11872 /* mute/unmute internal speaker according to the hp jack and mute state */
11873 static void alc262_ultra_automute(struct hda_codec *codec)
11875 struct alc_spec *spec = codec->spec;
11879 /* auto-mute only when HP is used as HP */
11880 if (!spec->cur_mux[0]) {
11881 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11882 if (spec->jack_present)
11883 mute = HDA_AMP_MUTE;
11885 /* mute/unmute internal speaker */
11886 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11887 HDA_AMP_MUTE, mute);
11888 /* mute/unmute HP */
11889 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11890 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11893 /* unsolicited event for HP jack sensing */
11894 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11897 if ((res >> 26) != ALC880_HP_EVENT)
11899 alc262_ultra_automute(codec);
11902 static struct hda_input_mux alc262_ultra_capture_source = {
11906 { "Headphone", 0x7 },
11910 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11911 struct snd_ctl_elem_value *ucontrol)
11913 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11914 struct alc_spec *spec = codec->spec;
11917 ret = alc_mux_enum_put(kcontrol, ucontrol);
11920 /* reprogram the HP pin as mic or HP according to the input source */
11921 snd_hda_codec_write_cache(codec, 0x15, 0,
11922 AC_VERB_SET_PIN_WIDGET_CONTROL,
11923 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11924 alc262_ultra_automute(codec); /* mute/unmute HP */
11928 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11929 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11930 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11932 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11933 .name = "Capture Source",
11934 .info = alc_mux_enum_info,
11935 .get = alc_mux_enum_get,
11936 .put = alc262_ultra_mux_enum_put,
11939 .iface = NID_MAPPING,
11940 .name = "Capture Source",
11941 .private_value = 0x15,
11946 /* We use two mixers depending on the output pin; 0x16 is a mono output
11947 * and thus it's bound with a different mixer.
11948 * This function returns which mixer amp should be used.
11950 static int alc262_check_volbit(hda_nid_t nid)
11954 else if (nid == 0x16)
11960 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11961 const char *pfx, int *vbits, int idx)
11966 vbit = alc262_check_volbit(nid);
11969 if (*vbits & vbit) /* a volume control for this mixer already there */
11973 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11975 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11976 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
11979 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11980 const char *pfx, int idx)
11987 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11989 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11990 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
11993 /* add playback controls from the parsed DAC table */
11994 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11995 const struct auto_pin_cfg *cfg)
12001 spec->multiout.num_dacs = 1; /* only use one dac */
12002 spec->multiout.dac_nids = spec->private_dac_nids;
12003 spec->multiout.dac_nids[0] = 2;
12005 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
12007 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12009 else if (cfg->line_out_type == AUTO_PIN_HP_OUT)
12013 for (i = 0; i < 2; i++) {
12014 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12017 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12018 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12023 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12024 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12031 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12032 alc262_check_volbit(cfg->speaker_pins[0]) |
12033 alc262_check_volbit(cfg->hp_pins[0]);
12034 if (vbits == 1 || vbits == 2)
12035 pfx = "Master"; /* only one mixer is used */
12037 for (i = 0; i < 2; i++) {
12038 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12042 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12043 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12044 "Speaker", &vbits, i);
12048 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12049 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12050 "Headphone", &vbits, i);
12058 #define alc262_auto_create_input_ctls \
12059 alc882_auto_create_input_ctls
12062 * generic initialization of ADC, input mixers and output mixers
12064 static struct hda_verb alc262_volume_init_verbs[] = {
12066 * Unmute ADC0-2 and set the default input to mic-in
12068 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12069 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12070 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12071 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12072 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12073 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12075 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12077 * Note: PASD motherboards uses the Line In 2 as the input for
12078 * front panel mic (mic 2)
12080 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12081 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12088 * Set up output mixers (0x0c - 0x0f)
12090 /* set vol=0 to output mixers */
12091 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12092 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12093 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12095 /* set up input amps for analog loopback */
12096 /* Amp Indices: DAC = 0, mixer = 1 */
12097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12098 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12099 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12100 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12101 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12102 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12104 /* FIXME: use matrix-type input source selection */
12105 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12106 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12107 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12108 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12109 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12110 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12112 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12113 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12114 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12115 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12120 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12125 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12127 * Unmute ADC0-2 and set the default input to mic-in
12129 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12131 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12132 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12133 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12134 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12136 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12138 * Note: PASD motherboards uses the Line In 2 as the input for
12139 * front panel mic (mic 2)
12141 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12142 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12143 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12144 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12145 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12146 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12147 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12148 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12151 * Set up output mixers (0x0c - 0x0e)
12153 /* set vol=0 to output mixers */
12154 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12155 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12156 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12158 /* set up input amps for analog loopback */
12159 /* Amp Indices: DAC = 0, mixer = 1 */
12160 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12161 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12162 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12163 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12164 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12165 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12167 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12168 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12169 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12171 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12174 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12175 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12177 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12178 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12179 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12180 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12181 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12183 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12184 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12185 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12186 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12187 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12188 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12191 /* FIXME: use matrix-type input source selection */
12192 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12193 /* Input mixer1: only unmute Mic */
12194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12200 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12201 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12202 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12204 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12205 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12206 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12207 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12208 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12209 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12210 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12212 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12214 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12220 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12221 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12222 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12224 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12229 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12231 * Unmute ADC0-2 and set the default input to mic-in
12233 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12234 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12235 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12236 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12237 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12240 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12242 * Note: PASD motherboards uses the Line In 2 as the input for front
12243 * panel mic (mic 2)
12245 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12255 * Set up output mixers (0x0c - 0x0e)
12257 /* set vol=0 to output mixers */
12258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12259 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12260 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12262 /* set up input amps for analog loopback */
12263 /* Amp Indices: DAC = 0, mixer = 1 */
12264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12265 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12266 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12267 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12268 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12269 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12272 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12273 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12274 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12275 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12276 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12277 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12278 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12280 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12281 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12283 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12284 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12286 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12287 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12288 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12289 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12290 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12291 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12293 /* FIXME: use matrix-type input source selection */
12294 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12295 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12296 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12297 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12298 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12301 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12302 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12309 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12317 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12318 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12320 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12325 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12327 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12328 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12329 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12331 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12332 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12333 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12334 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12336 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12337 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12338 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12349 static const struct alc_fixup alc262_fixups[] = {
12350 [PINFIX_FSC_H270] = {
12351 .pins = (const struct alc_pincfg[]) {
12352 { 0x14, 0x99130110 }, /* speaker */
12353 { 0x15, 0x0221142f }, /* front HP */
12354 { 0x1b, 0x0121141f }, /* rear HP */
12358 [PINFIX_PB_M5210] = {
12359 .verbs = (const struct hda_verb[]) {
12360 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
12366 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12367 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12372 #ifdef CONFIG_SND_HDA_POWER_SAVE
12373 #define alc262_loopbacks alc880_loopbacks
12376 /* pcm configuration: identical with ALC880 */
12377 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12378 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12379 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12380 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12383 * BIOS auto configuration
12385 static int alc262_parse_auto_config(struct hda_codec *codec)
12387 struct alc_spec *spec = codec->spec;
12389 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12391 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12395 if (!spec->autocfg.line_outs) {
12396 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12397 spec->multiout.max_channels = 2;
12398 spec->no_analog = 1;
12401 return 0; /* can't find valid BIOS pin config */
12403 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12406 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12410 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12413 alc_auto_parse_digital(codec);
12415 if (spec->kctls.list)
12416 add_mixer(spec, spec->kctls.list);
12418 add_verb(spec, alc262_volume_init_verbs);
12419 spec->num_mux_defs = 1;
12420 spec->input_mux = &spec->private_imux[0];
12422 err = alc_auto_add_mic_boost(codec);
12426 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12431 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12432 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12433 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12434 #define alc262_auto_init_input_src alc882_auto_init_input_src
12437 /* init callback for auto-configuration model -- overriding the default init */
12438 static void alc262_auto_init(struct hda_codec *codec)
12440 struct alc_spec *spec = codec->spec;
12441 alc262_auto_init_multi_out(codec);
12442 alc262_auto_init_hp_out(codec);
12443 alc262_auto_init_analog_input(codec);
12444 alc262_auto_init_input_src(codec);
12445 alc_auto_init_digital(codec);
12446 if (spec->unsol_event)
12447 alc_inithook(codec);
12451 * configuration and preset
12453 static const char *alc262_models[ALC262_MODEL_LAST] = {
12454 [ALC262_BASIC] = "basic",
12455 [ALC262_HIPPO] = "hippo",
12456 [ALC262_HIPPO_1] = "hippo_1",
12457 [ALC262_FUJITSU] = "fujitsu",
12458 [ALC262_HP_BPC] = "hp-bpc",
12459 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12460 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12461 [ALC262_HP_RP5700] = "hp-rp5700",
12462 [ALC262_BENQ_ED8] = "benq",
12463 [ALC262_BENQ_T31] = "benq-t31",
12464 [ALC262_SONY_ASSAMD] = "sony-assamd",
12465 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12466 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12467 [ALC262_ULTRA] = "ultra",
12468 [ALC262_LENOVO_3000] = "lenovo-3000",
12469 [ALC262_NEC] = "nec",
12470 [ALC262_TYAN] = "tyan",
12471 [ALC262_AUTO] = "auto",
12474 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12475 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12476 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12477 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12479 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12481 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12483 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12484 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12485 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12486 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12487 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12488 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12489 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12490 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12491 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12492 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12493 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12494 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12495 ALC262_HP_TC_T5735),
12496 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12497 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12498 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12499 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12500 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12501 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12502 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12503 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12504 #if 0 /* disable the quirk since model=auto works better in recent versions */
12505 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12506 ALC262_SONY_ASSAMD),
12508 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12509 ALC262_TOSHIBA_RX1),
12510 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12511 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12512 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12513 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12514 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12516 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12517 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12518 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12519 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12520 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12524 static struct alc_config_preset alc262_presets[] = {
12526 .mixers = { alc262_base_mixer },
12527 .init_verbs = { alc262_init_verbs },
12528 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12529 .dac_nids = alc262_dac_nids,
12531 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12532 .channel_mode = alc262_modes,
12533 .input_mux = &alc262_capture_source,
12536 .mixers = { alc262_hippo_mixer },
12537 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12538 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12539 .dac_nids = alc262_dac_nids,
12541 .dig_out_nid = ALC262_DIGOUT_NID,
12542 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12543 .channel_mode = alc262_modes,
12544 .input_mux = &alc262_capture_source,
12545 .unsol_event = alc262_hippo_unsol_event,
12546 .setup = alc262_hippo_setup,
12547 .init_hook = alc262_hippo_automute,
12549 [ALC262_HIPPO_1] = {
12550 .mixers = { alc262_hippo1_mixer },
12551 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12552 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12553 .dac_nids = alc262_dac_nids,
12555 .dig_out_nid = ALC262_DIGOUT_NID,
12556 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12557 .channel_mode = alc262_modes,
12558 .input_mux = &alc262_capture_source,
12559 .unsol_event = alc262_hippo_unsol_event,
12560 .setup = alc262_hippo1_setup,
12561 .init_hook = alc262_hippo_automute,
12563 [ALC262_FUJITSU] = {
12564 .mixers = { alc262_fujitsu_mixer },
12565 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12566 alc262_fujitsu_unsol_verbs },
12567 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12568 .dac_nids = alc262_dac_nids,
12570 .dig_out_nid = ALC262_DIGOUT_NID,
12571 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12572 .channel_mode = alc262_modes,
12573 .input_mux = &alc262_fujitsu_capture_source,
12574 .unsol_event = alc262_fujitsu_unsol_event,
12575 .init_hook = alc262_fujitsu_init_hook,
12577 [ALC262_HP_BPC] = {
12578 .mixers = { alc262_HP_BPC_mixer },
12579 .init_verbs = { alc262_HP_BPC_init_verbs },
12580 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12581 .dac_nids = alc262_dac_nids,
12583 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12584 .channel_mode = alc262_modes,
12585 .input_mux = &alc262_HP_capture_source,
12586 .unsol_event = alc262_hp_bpc_unsol_event,
12587 .init_hook = alc262_hp_bpc_automute,
12589 [ALC262_HP_BPC_D7000_WF] = {
12590 .mixers = { alc262_HP_BPC_WildWest_mixer },
12591 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12592 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12593 .dac_nids = alc262_dac_nids,
12595 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12596 .channel_mode = alc262_modes,
12597 .input_mux = &alc262_HP_D7000_capture_source,
12598 .unsol_event = alc262_hp_wildwest_unsol_event,
12599 .init_hook = alc262_hp_wildwest_automute,
12601 [ALC262_HP_BPC_D7000_WL] = {
12602 .mixers = { alc262_HP_BPC_WildWest_mixer,
12603 alc262_HP_BPC_WildWest_option_mixer },
12604 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12605 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12606 .dac_nids = alc262_dac_nids,
12608 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12609 .channel_mode = alc262_modes,
12610 .input_mux = &alc262_HP_D7000_capture_source,
12611 .unsol_event = alc262_hp_wildwest_unsol_event,
12612 .init_hook = alc262_hp_wildwest_automute,
12614 [ALC262_HP_TC_T5735] = {
12615 .mixers = { alc262_hp_t5735_mixer },
12616 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12617 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12618 .dac_nids = alc262_dac_nids,
12620 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12621 .channel_mode = alc262_modes,
12622 .input_mux = &alc262_capture_source,
12623 .unsol_event = alc_sku_unsol_event,
12624 .setup = alc262_hp_t5735_setup,
12625 .init_hook = alc_inithook,
12627 [ALC262_HP_RP5700] = {
12628 .mixers = { alc262_hp_rp5700_mixer },
12629 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12630 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12631 .dac_nids = alc262_dac_nids,
12632 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12633 .channel_mode = alc262_modes,
12634 .input_mux = &alc262_hp_rp5700_capture_source,
12636 [ALC262_BENQ_ED8] = {
12637 .mixers = { alc262_base_mixer },
12638 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12639 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12640 .dac_nids = alc262_dac_nids,
12642 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12643 .channel_mode = alc262_modes,
12644 .input_mux = &alc262_capture_source,
12646 [ALC262_SONY_ASSAMD] = {
12647 .mixers = { alc262_sony_mixer },
12648 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12649 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12650 .dac_nids = alc262_dac_nids,
12652 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12653 .channel_mode = alc262_modes,
12654 .input_mux = &alc262_capture_source,
12655 .unsol_event = alc262_hippo_unsol_event,
12656 .setup = alc262_hippo_setup,
12657 .init_hook = alc262_hippo_automute,
12659 [ALC262_BENQ_T31] = {
12660 .mixers = { alc262_benq_t31_mixer },
12661 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12662 alc_hp15_unsol_verbs },
12663 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12664 .dac_nids = alc262_dac_nids,
12666 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12667 .channel_mode = alc262_modes,
12668 .input_mux = &alc262_capture_source,
12669 .unsol_event = alc262_hippo_unsol_event,
12670 .setup = alc262_hippo_setup,
12671 .init_hook = alc262_hippo_automute,
12674 .mixers = { alc262_ultra_mixer },
12675 .cap_mixer = alc262_ultra_capture_mixer,
12676 .init_verbs = { alc262_ultra_verbs },
12677 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12678 .dac_nids = alc262_dac_nids,
12679 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12680 .channel_mode = alc262_modes,
12681 .input_mux = &alc262_ultra_capture_source,
12682 .adc_nids = alc262_adc_nids, /* ADC0 */
12683 .capsrc_nids = alc262_capsrc_nids,
12684 .num_adc_nids = 1, /* single ADC */
12685 .unsol_event = alc262_ultra_unsol_event,
12686 .init_hook = alc262_ultra_automute,
12688 [ALC262_LENOVO_3000] = {
12689 .mixers = { alc262_lenovo_3000_mixer },
12690 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12691 alc262_lenovo_3000_unsol_verbs,
12692 alc262_lenovo_3000_init_verbs },
12693 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12694 .dac_nids = alc262_dac_nids,
12696 .dig_out_nid = ALC262_DIGOUT_NID,
12697 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12698 .channel_mode = alc262_modes,
12699 .input_mux = &alc262_fujitsu_capture_source,
12700 .unsol_event = alc262_lenovo_3000_unsol_event,
12703 .mixers = { alc262_nec_mixer },
12704 .init_verbs = { alc262_nec_verbs },
12705 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12706 .dac_nids = alc262_dac_nids,
12708 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12709 .channel_mode = alc262_modes,
12710 .input_mux = &alc262_capture_source,
12712 [ALC262_TOSHIBA_S06] = {
12713 .mixers = { alc262_toshiba_s06_mixer },
12714 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12715 alc262_eapd_verbs },
12716 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12717 .capsrc_nids = alc262_dmic_capsrc_nids,
12718 .dac_nids = alc262_dac_nids,
12719 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12720 .num_adc_nids = 1, /* single ADC */
12721 .dig_out_nid = ALC262_DIGOUT_NID,
12722 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12723 .channel_mode = alc262_modes,
12724 .unsol_event = alc_sku_unsol_event,
12725 .setup = alc262_toshiba_s06_setup,
12726 .init_hook = alc_inithook,
12728 [ALC262_TOSHIBA_RX1] = {
12729 .mixers = { alc262_toshiba_rx1_mixer },
12730 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_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,
12737 .unsol_event = alc262_hippo_unsol_event,
12738 .setup = alc262_hippo_setup,
12739 .init_hook = alc262_hippo_automute,
12742 .mixers = { alc262_tyan_mixer },
12743 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12744 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12745 .dac_nids = alc262_dac_nids,
12747 .dig_out_nid = ALC262_DIGOUT_NID,
12748 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12749 .channel_mode = alc262_modes,
12750 .input_mux = &alc262_capture_source,
12751 .unsol_event = alc_automute_amp_unsol_event,
12752 .setup = alc262_tyan_setup,
12753 .init_hook = alc_automute_amp,
12757 static int patch_alc262(struct hda_codec *codec)
12759 struct alc_spec *spec;
12763 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12767 codec->spec = spec;
12769 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12774 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12775 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12776 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12777 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12780 alc_auto_parse_customize_define(codec);
12782 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12784 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12788 if (board_config < 0) {
12789 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12791 board_config = ALC262_AUTO;
12794 if (board_config == ALC262_AUTO)
12795 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1);
12797 if (board_config == ALC262_AUTO) {
12798 /* automatic parse from the BIOS config */
12799 err = alc262_parse_auto_config(codec);
12805 "hda_codec: Cannot set up configuration "
12806 "from BIOS. Using base mode...\n");
12807 board_config = ALC262_BASIC;
12811 if (!spec->no_analog && has_cdefine_beep(codec)) {
12812 err = snd_hda_attach_beep_device(codec, 0x1);
12819 if (board_config != ALC262_AUTO)
12820 setup_preset(codec, &alc262_presets[board_config]);
12822 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12823 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12825 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12826 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12828 if (!spec->adc_nids && spec->input_mux) {
12830 /* check whether the digital-mic has to be supported */
12831 for (i = 0; i < spec->input_mux->num_items; i++) {
12832 if (spec->input_mux->items[i].index >= 9)
12835 if (i < spec->input_mux->num_items) {
12836 /* use only ADC0 */
12837 spec->adc_nids = alc262_dmic_adc_nids;
12838 spec->num_adc_nids = 1;
12839 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12841 /* all analog inputs */
12842 /* check whether NID 0x07 is valid */
12843 unsigned int wcap = get_wcaps(codec, 0x07);
12846 wcap = get_wcaps_type(wcap);
12847 if (wcap != AC_WID_AUD_IN) {
12848 spec->adc_nids = alc262_adc_nids_alt;
12849 spec->num_adc_nids =
12850 ARRAY_SIZE(alc262_adc_nids_alt);
12851 spec->capsrc_nids = alc262_capsrc_nids_alt;
12853 spec->adc_nids = alc262_adc_nids;
12854 spec->num_adc_nids =
12855 ARRAY_SIZE(alc262_adc_nids);
12856 spec->capsrc_nids = alc262_capsrc_nids;
12860 if (!spec->cap_mixer && !spec->no_analog)
12861 set_capture_mixer(codec);
12862 if (!spec->no_analog && has_cdefine_beep(codec))
12863 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12865 if (board_config == ALC262_AUTO)
12866 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
12868 spec->vmaster_nid = 0x0c;
12870 codec->patch_ops = alc_patch_ops;
12871 if (board_config == ALC262_AUTO)
12872 spec->init_hook = alc262_auto_init;
12873 #ifdef CONFIG_SND_HDA_POWER_SAVE
12874 if (!spec->loopback.amplist)
12875 spec->loopback.amplist = alc262_loopbacks;
12882 * ALC268 channel source setting (2 channel)
12884 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12885 #define alc268_modes alc260_modes
12887 static hda_nid_t alc268_dac_nids[2] = {
12892 static hda_nid_t alc268_adc_nids[2] = {
12897 static hda_nid_t alc268_adc_nids_alt[1] = {
12902 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12904 static struct snd_kcontrol_new alc268_base_mixer[] = {
12905 /* output mixer control */
12906 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12907 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12908 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12909 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12910 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12911 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12912 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12916 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12917 /* output mixer control */
12918 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12919 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12920 ALC262_HIPPO_MASTER_SWITCH,
12921 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12922 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12923 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12927 /* bind Beep switches of both NID 0x0f and 0x10 */
12928 static struct hda_bind_ctls alc268_bind_beep_sw = {
12929 .ops = &snd_hda_bind_sw,
12931 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12932 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12937 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12938 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12939 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12943 static struct hda_verb alc268_eapd_verbs[] = {
12944 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12945 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12949 /* Toshiba specific */
12950 static struct hda_verb alc268_toshiba_verbs[] = {
12951 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12955 /* Acer specific */
12956 /* bind volumes of both NID 0x02 and 0x03 */
12957 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12958 .ops = &snd_hda_bind_vol,
12960 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12961 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12966 /* mute/unmute internal speaker according to the hp jack and mute state */
12967 static void alc268_acer_automute(struct hda_codec *codec, int force)
12969 struct alc_spec *spec = codec->spec;
12972 if (force || !spec->sense_updated) {
12973 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12974 spec->sense_updated = 1;
12976 if (spec->jack_present)
12977 mute = HDA_AMP_MUTE; /* mute internal speaker */
12978 else /* unmute internal speaker if necessary */
12979 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12980 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12981 HDA_AMP_MUTE, mute);
12985 /* bind hp and internal speaker mute (with plug check) */
12986 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12987 struct snd_ctl_elem_value *ucontrol)
12989 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12990 long *valp = ucontrol->value.integer.value;
12993 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12995 alc268_acer_automute(codec, 0);
12999 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13000 /* output mixer control */
13001 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13003 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13004 .name = "Master Playback Switch",
13005 .subdevice = HDA_SUBDEV_AMP_FLAG,
13006 .info = snd_hda_mixer_amp_switch_info,
13007 .get = snd_hda_mixer_amp_switch_get,
13008 .put = alc268_acer_master_sw_put,
13009 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13011 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13015 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13016 /* output mixer control */
13017 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13019 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13020 .name = "Master Playback Switch",
13021 .subdevice = HDA_SUBDEV_AMP_FLAG,
13022 .info = snd_hda_mixer_amp_switch_info,
13023 .get = snd_hda_mixer_amp_switch_get,
13024 .put = alc268_acer_master_sw_put,
13025 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13027 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13028 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13029 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13033 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13034 /* output mixer control */
13035 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13037 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13038 .name = "Master Playback Switch",
13039 .subdevice = HDA_SUBDEV_AMP_FLAG,
13040 .info = snd_hda_mixer_amp_switch_info,
13041 .get = snd_hda_mixer_amp_switch_get,
13042 .put = alc268_acer_master_sw_put,
13043 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13045 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13046 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13050 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13051 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13052 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13053 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13054 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13055 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13056 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13060 static struct hda_verb alc268_acer_verbs[] = {
13061 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13062 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13063 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13064 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13065 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13066 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13067 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13071 /* unsolicited event for HP jack sensing */
13072 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13073 #define alc268_toshiba_setup alc262_hippo_setup
13074 #define alc268_toshiba_automute alc262_hippo_automute
13076 static void alc268_acer_unsol_event(struct hda_codec *codec,
13079 if ((res >> 26) != ALC880_HP_EVENT)
13081 alc268_acer_automute(codec, 1);
13084 static void alc268_acer_init_hook(struct hda_codec *codec)
13086 alc268_acer_automute(codec, 1);
13089 /* toggle speaker-output according to the hp-jack state */
13090 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13092 unsigned int present;
13093 unsigned char bits;
13095 present = snd_hda_jack_detect(codec, 0x15);
13096 bits = present ? HDA_AMP_MUTE : 0;
13097 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13098 HDA_AMP_MUTE, bits);
13099 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13100 HDA_AMP_MUTE, bits);
13103 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13106 switch (res >> 26) {
13107 case ALC880_HP_EVENT:
13108 alc268_aspire_one_speaker_automute(codec);
13110 case ALC880_MIC_EVENT:
13111 alc_mic_automute(codec);
13116 static void alc268_acer_lc_setup(struct hda_codec *codec)
13118 struct alc_spec *spec = codec->spec;
13119 spec->ext_mic.pin = 0x18;
13120 spec->ext_mic.mux_idx = 0;
13121 spec->int_mic.pin = 0x12;
13122 spec->int_mic.mux_idx = 6;
13123 spec->auto_mic = 1;
13126 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13128 alc268_aspire_one_speaker_automute(codec);
13129 alc_mic_automute(codec);
13132 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13133 /* output mixer control */
13134 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13135 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13136 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13137 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13138 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13139 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13143 static struct hda_verb alc268_dell_verbs[] = {
13144 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13145 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13146 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13147 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13151 /* mute/unmute internal speaker according to the hp jack and mute state */
13152 static void alc268_dell_setup(struct hda_codec *codec)
13154 struct alc_spec *spec = codec->spec;
13156 spec->autocfg.hp_pins[0] = 0x15;
13157 spec->autocfg.speaker_pins[0] = 0x14;
13158 spec->ext_mic.pin = 0x18;
13159 spec->ext_mic.mux_idx = 0;
13160 spec->int_mic.pin = 0x19;
13161 spec->int_mic.mux_idx = 1;
13162 spec->auto_mic = 1;
13165 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13166 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13167 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13168 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13169 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13170 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13171 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13172 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13173 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13177 static struct hda_verb alc267_quanta_il1_verbs[] = {
13178 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13179 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13183 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13185 struct alc_spec *spec = codec->spec;
13186 spec->autocfg.hp_pins[0] = 0x15;
13187 spec->autocfg.speaker_pins[0] = 0x14;
13188 spec->ext_mic.pin = 0x18;
13189 spec->ext_mic.mux_idx = 0;
13190 spec->int_mic.pin = 0x19;
13191 spec->int_mic.mux_idx = 1;
13192 spec->auto_mic = 1;
13196 * generic initialization of ADC, input mixers and output mixers
13198 static struct hda_verb alc268_base_init_verbs[] = {
13199 /* Unmute DAC0-1 and set vol = 0 */
13200 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13201 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13204 * Set up output mixers (0x0c - 0x0e)
13206 /* set vol=0 to output mixers */
13207 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13208 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13210 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13211 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13213 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13214 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13215 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13216 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13217 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13218 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13219 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13220 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13222 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13223 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13224 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13225 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13226 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13228 /* set PCBEEP vol = 0, mute connections */
13229 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13230 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13231 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13233 /* Unmute Selector 23h,24h and set the default input to mic-in */
13235 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13236 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13237 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13238 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13244 * generic initialization of ADC, input mixers and output mixers
13246 static struct hda_verb alc268_volume_init_verbs[] = {
13247 /* set output DAC */
13248 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13249 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13251 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13252 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13253 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13254 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13255 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13257 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13258 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13259 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13261 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13262 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13264 /* set PCBEEP vol = 0, mute connections */
13265 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13266 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13267 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13272 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13273 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13274 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13278 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13279 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13280 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13285 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13286 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13287 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13288 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13289 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13294 static struct hda_input_mux alc268_capture_source = {
13298 { "Front Mic", 0x1 },
13304 static struct hda_input_mux alc268_acer_capture_source = {
13308 { "Internal Mic", 0x1 },
13313 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13317 { "Internal Mic", 0x6 },
13322 #ifdef CONFIG_SND_DEBUG
13323 static struct snd_kcontrol_new alc268_test_mixer[] = {
13324 /* Volume widgets */
13325 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13326 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13327 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13328 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13329 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13330 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13331 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13332 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13333 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13334 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13335 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13336 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13337 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13338 /* The below appears problematic on some hardwares */
13339 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13340 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13341 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13342 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13343 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13345 /* Modes for retasking pin widgets */
13346 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13347 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13348 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13349 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13351 /* Controls for GPIO pins, assuming they are configured as outputs */
13352 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13353 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13354 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13355 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13357 /* Switches to allow the digital SPDIF output pin to be enabled.
13358 * The ALC268 does not have an SPDIF input.
13360 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13362 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13363 * this output to turn on an external amplifier.
13365 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13366 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13372 /* create input playback/capture controls for the given pin */
13373 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13374 const char *ctlname, int idx)
13385 case 0x1a: /* ALC259/269 only */
13386 case 0x1b: /* ALC259/269 only */
13387 case 0x21: /* ALC269vb has this pin, too */
13391 snd_printd(KERN_WARNING "hda_codec: "
13392 "ignoring pin 0x%x as unknown\n", nid);
13395 if (spec->multiout.dac_nids[0] != dac &&
13396 spec->multiout.dac_nids[1] != dac) {
13397 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13398 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13402 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13406 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13407 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13409 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13410 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13416 /* add playback controls from the parsed DAC table */
13417 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13418 const struct auto_pin_cfg *cfg)
13423 spec->multiout.dac_nids = spec->private_dac_nids;
13425 nid = cfg->line_out_pins[0];
13428 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13432 err = alc268_new_analog_output(spec, nid, name, 0);
13437 nid = cfg->speaker_pins[0];
13439 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13440 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13444 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13448 nid = cfg->hp_pins[0];
13450 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13455 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13457 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13458 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13465 /* create playback/capture controls for input pins */
13466 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13467 const struct auto_pin_cfg *cfg)
13469 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13472 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13473 hda_nid_t nid, int pin_type)
13477 alc_set_pin_output(codec, nid, pin_type);
13478 if (nid == 0x14 || nid == 0x16)
13482 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13485 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13487 struct alc_spec *spec = codec->spec;
13490 for (i = 0; i < spec->autocfg.line_outs; i++) {
13491 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13492 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13493 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13497 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13499 struct alc_spec *spec = codec->spec;
13503 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13504 pin = spec->autocfg.hp_pins[i];
13505 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13507 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13508 pin = spec->autocfg.speaker_pins[i];
13509 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13511 if (spec->autocfg.mono_out_pin)
13512 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13513 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13516 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13518 struct alc_spec *spec = codec->spec;
13519 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13520 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13521 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13522 unsigned int dac_vol1, dac_vol2;
13524 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13525 snd_hda_codec_write(codec, speaker_nid, 0,
13526 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13527 /* mute mixer inputs from 0x1d */
13528 snd_hda_codec_write(codec, 0x0f, 0,
13529 AC_VERB_SET_AMP_GAIN_MUTE,
13531 snd_hda_codec_write(codec, 0x10, 0,
13532 AC_VERB_SET_AMP_GAIN_MUTE,
13535 /* unmute mixer inputs from 0x1d */
13536 snd_hda_codec_write(codec, 0x0f, 0,
13537 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13538 snd_hda_codec_write(codec, 0x10, 0,
13539 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13542 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13543 if (line_nid == 0x14)
13544 dac_vol2 = AMP_OUT_ZERO;
13545 else if (line_nid == 0x15)
13546 dac_vol1 = AMP_OUT_ZERO;
13547 if (hp_nid == 0x14)
13548 dac_vol2 = AMP_OUT_ZERO;
13549 else if (hp_nid == 0x15)
13550 dac_vol1 = AMP_OUT_ZERO;
13551 if (line_nid != 0x16 || hp_nid != 0x16 ||
13552 spec->autocfg.line_out_pins[1] != 0x16 ||
13553 spec->autocfg.line_out_pins[2] != 0x16)
13554 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13556 snd_hda_codec_write(codec, 0x02, 0,
13557 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13558 snd_hda_codec_write(codec, 0x03, 0,
13559 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13562 /* pcm configuration: identical with ALC880 */
13563 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13564 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13565 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13566 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13569 * BIOS auto configuration
13571 static int alc268_parse_auto_config(struct hda_codec *codec)
13573 struct alc_spec *spec = codec->spec;
13575 static hda_nid_t alc268_ignore[] = { 0 };
13577 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13581 if (!spec->autocfg.line_outs) {
13582 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13583 spec->multiout.max_channels = 2;
13584 spec->no_analog = 1;
13587 return 0; /* can't find valid BIOS pin config */
13589 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13592 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13596 spec->multiout.max_channels = 2;
13599 /* digital only support output */
13600 alc_auto_parse_digital(codec);
13601 if (spec->kctls.list)
13602 add_mixer(spec, spec->kctls.list);
13604 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13605 add_mixer(spec, alc268_beep_mixer);
13607 add_verb(spec, alc268_volume_init_verbs);
13608 spec->num_mux_defs = 2;
13609 spec->input_mux = &spec->private_imux[0];
13611 err = alc_auto_add_mic_boost(codec);
13615 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13620 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13622 /* init callback for auto-configuration model -- overriding the default init */
13623 static void alc268_auto_init(struct hda_codec *codec)
13625 struct alc_spec *spec = codec->spec;
13626 alc268_auto_init_multi_out(codec);
13627 alc268_auto_init_hp_out(codec);
13628 alc268_auto_init_mono_speaker_out(codec);
13629 alc268_auto_init_analog_input(codec);
13630 alc_auto_init_digital(codec);
13631 if (spec->unsol_event)
13632 alc_inithook(codec);
13636 * configuration and preset
13638 static const char *alc268_models[ALC268_MODEL_LAST] = {
13639 [ALC267_QUANTA_IL1] = "quanta-il1",
13640 [ALC268_3ST] = "3stack",
13641 [ALC268_TOSHIBA] = "toshiba",
13642 [ALC268_ACER] = "acer",
13643 [ALC268_ACER_DMIC] = "acer-dmic",
13644 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13645 [ALC268_DELL] = "dell",
13646 [ALC268_ZEPTO] = "zepto",
13647 #ifdef CONFIG_SND_DEBUG
13648 [ALC268_TEST] = "test",
13650 [ALC268_AUTO] = "auto",
13653 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13654 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13655 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13656 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13657 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13658 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13659 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13660 ALC268_ACER_ASPIRE_ONE),
13661 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13662 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13663 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13664 /* almost compatible with toshiba but with optional digital outs;
13665 * auto-probing seems working fine
13667 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13669 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13670 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13671 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13672 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13673 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13677 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13678 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13679 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13680 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13681 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13686 static struct alc_config_preset alc268_presets[] = {
13687 [ALC267_QUANTA_IL1] = {
13688 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13689 alc268_capture_nosrc_mixer },
13690 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13691 alc267_quanta_il1_verbs },
13692 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13693 .dac_nids = alc268_dac_nids,
13694 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13695 .adc_nids = alc268_adc_nids_alt,
13697 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13698 .channel_mode = alc268_modes,
13699 .unsol_event = alc_sku_unsol_event,
13700 .setup = alc267_quanta_il1_setup,
13701 .init_hook = alc_inithook,
13704 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13705 alc268_beep_mixer },
13706 .init_verbs = { alc268_base_init_verbs },
13707 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13708 .dac_nids = alc268_dac_nids,
13709 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13710 .adc_nids = alc268_adc_nids_alt,
13711 .capsrc_nids = alc268_capsrc_nids,
13713 .dig_out_nid = ALC268_DIGOUT_NID,
13714 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13715 .channel_mode = alc268_modes,
13716 .input_mux = &alc268_capture_source,
13718 [ALC268_TOSHIBA] = {
13719 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13720 alc268_beep_mixer },
13721 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13722 alc268_toshiba_verbs },
13723 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13724 .dac_nids = alc268_dac_nids,
13725 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13726 .adc_nids = alc268_adc_nids_alt,
13727 .capsrc_nids = alc268_capsrc_nids,
13729 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13730 .channel_mode = alc268_modes,
13731 .input_mux = &alc268_capture_source,
13732 .unsol_event = alc268_toshiba_unsol_event,
13733 .setup = alc268_toshiba_setup,
13734 .init_hook = alc268_toshiba_automute,
13737 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13738 alc268_beep_mixer },
13739 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13740 alc268_acer_verbs },
13741 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13742 .dac_nids = alc268_dac_nids,
13743 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13744 .adc_nids = alc268_adc_nids_alt,
13745 .capsrc_nids = alc268_capsrc_nids,
13747 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13748 .channel_mode = alc268_modes,
13749 .input_mux = &alc268_acer_capture_source,
13750 .unsol_event = alc268_acer_unsol_event,
13751 .init_hook = alc268_acer_init_hook,
13753 [ALC268_ACER_DMIC] = {
13754 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13755 alc268_beep_mixer },
13756 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13757 alc268_acer_verbs },
13758 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13759 .dac_nids = alc268_dac_nids,
13760 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13761 .adc_nids = alc268_adc_nids_alt,
13762 .capsrc_nids = alc268_capsrc_nids,
13764 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13765 .channel_mode = alc268_modes,
13766 .input_mux = &alc268_acer_dmic_capture_source,
13767 .unsol_event = alc268_acer_unsol_event,
13768 .init_hook = alc268_acer_init_hook,
13770 [ALC268_ACER_ASPIRE_ONE] = {
13771 .mixers = { alc268_acer_aspire_one_mixer,
13773 alc268_capture_nosrc_mixer },
13774 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13775 alc268_acer_aspire_one_verbs },
13776 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13777 .dac_nids = alc268_dac_nids,
13778 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13779 .adc_nids = alc268_adc_nids_alt,
13780 .capsrc_nids = alc268_capsrc_nids,
13782 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13783 .channel_mode = alc268_modes,
13784 .unsol_event = alc268_acer_lc_unsol_event,
13785 .setup = alc268_acer_lc_setup,
13786 .init_hook = alc268_acer_lc_init_hook,
13789 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13790 alc268_capture_nosrc_mixer },
13791 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13792 alc268_dell_verbs },
13793 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13794 .dac_nids = alc268_dac_nids,
13795 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13796 .adc_nids = alc268_adc_nids_alt,
13797 .capsrc_nids = alc268_capsrc_nids,
13799 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13800 .channel_mode = alc268_modes,
13801 .unsol_event = alc_sku_unsol_event,
13802 .setup = alc268_dell_setup,
13803 .init_hook = alc_inithook,
13806 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13807 alc268_beep_mixer },
13808 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13809 alc268_toshiba_verbs },
13810 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13811 .dac_nids = alc268_dac_nids,
13812 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13813 .adc_nids = alc268_adc_nids_alt,
13814 .capsrc_nids = alc268_capsrc_nids,
13816 .dig_out_nid = ALC268_DIGOUT_NID,
13817 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13818 .channel_mode = alc268_modes,
13819 .input_mux = &alc268_capture_source,
13820 .setup = alc268_toshiba_setup,
13821 .init_hook = alc268_toshiba_automute,
13823 #ifdef CONFIG_SND_DEBUG
13825 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13826 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13827 alc268_volume_init_verbs },
13828 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13829 .dac_nids = alc268_dac_nids,
13830 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13831 .adc_nids = alc268_adc_nids_alt,
13832 .capsrc_nids = alc268_capsrc_nids,
13834 .dig_out_nid = ALC268_DIGOUT_NID,
13835 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13836 .channel_mode = alc268_modes,
13837 .input_mux = &alc268_capture_source,
13842 static int patch_alc268(struct hda_codec *codec)
13844 struct alc_spec *spec;
13846 int i, has_beep, err;
13848 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13852 codec->spec = spec;
13854 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13858 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13859 board_config = snd_hda_check_board_codec_sid_config(codec,
13860 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13862 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13863 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13865 board_config = ALC268_AUTO;
13868 if (board_config == ALC268_AUTO) {
13869 /* automatic parse from the BIOS config */
13870 err = alc268_parse_auto_config(codec);
13876 "hda_codec: Cannot set up configuration "
13877 "from BIOS. Using base mode...\n");
13878 board_config = ALC268_3ST;
13882 if (board_config != ALC268_AUTO)
13883 setup_preset(codec, &alc268_presets[board_config]);
13885 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13886 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13887 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13889 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13892 for (i = 0; i < spec->num_mixers; i++) {
13893 if (spec->mixers[i] == alc268_beep_mixer) {
13900 err = snd_hda_attach_beep_device(codec, 0x1);
13905 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13906 /* override the amp caps for beep generator */
13907 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13908 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13909 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13910 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13911 (0 << AC_AMPCAP_MUTE_SHIFT));
13914 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13915 /* check whether NID 0x07 is valid */
13916 unsigned int wcap = get_wcaps(codec, 0x07);
13919 spec->capsrc_nids = alc268_capsrc_nids;
13921 wcap = get_wcaps_type(wcap);
13922 if (spec->auto_mic ||
13923 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13924 spec->adc_nids = alc268_adc_nids_alt;
13925 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13926 if (spec->auto_mic)
13927 fixup_automic_adc(codec);
13928 if (spec->auto_mic || spec->input_mux->num_items == 1)
13929 add_mixer(spec, alc268_capture_nosrc_mixer);
13931 add_mixer(spec, alc268_capture_alt_mixer);
13933 spec->adc_nids = alc268_adc_nids;
13934 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13935 add_mixer(spec, alc268_capture_mixer);
13937 /* set default input source */
13938 for (i = 0; i < spec->num_adc_nids; i++)
13939 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13940 0, AC_VERB_SET_CONNECT_SEL,
13941 i < spec->num_mux_defs ?
13942 spec->input_mux[i].items[0].index :
13943 spec->input_mux->items[0].index);
13946 spec->vmaster_nid = 0x02;
13948 codec->patch_ops = alc_patch_ops;
13949 if (board_config == ALC268_AUTO)
13950 spec->init_hook = alc268_auto_init;
13956 * ALC269 channel source setting (2 channel)
13958 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13960 #define alc269_dac_nids alc260_dac_nids
13962 static hda_nid_t alc269_adc_nids[1] = {
13967 static hda_nid_t alc269_capsrc_nids[1] = {
13971 static hda_nid_t alc269vb_adc_nids[1] = {
13976 static hda_nid_t alc269vb_capsrc_nids[1] = {
13980 static hda_nid_t alc269_adc_candidates[] = {
13984 #define alc269_modes alc260_modes
13985 #define alc269_capture_source alc880_lg_lw_capture_source
13987 static struct snd_kcontrol_new alc269_base_mixer[] = {
13988 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13989 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13990 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13991 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13994 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13996 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13997 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13998 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13999 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14003 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14004 /* output mixer control */
14005 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14007 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14008 .name = "Master Playback Switch",
14009 .subdevice = HDA_SUBDEV_AMP_FLAG,
14010 .info = snd_hda_mixer_amp_switch_info,
14011 .get = snd_hda_mixer_amp_switch_get,
14012 .put = alc268_acer_master_sw_put,
14013 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14015 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14016 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14017 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14018 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14019 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14020 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
14024 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14025 /* output mixer control */
14026 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14028 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14029 .name = "Master Playback Switch",
14030 .subdevice = HDA_SUBDEV_AMP_FLAG,
14031 .info = snd_hda_mixer_amp_switch_info,
14032 .get = snd_hda_mixer_amp_switch_get,
14033 .put = alc268_acer_master_sw_put,
14034 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14036 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14037 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14038 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14039 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14040 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14041 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
14042 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14043 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14044 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
14048 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14049 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14050 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14051 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14052 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14056 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14057 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14058 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14059 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14060 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14064 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14065 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14066 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14070 /* capture mixer elements */
14071 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14072 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14073 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14074 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14075 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
14079 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14080 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14081 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14082 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14086 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14087 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14088 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14089 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14090 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
14094 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14095 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14096 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14097 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14102 #define alc269_fujitsu_mixer alc269_laptop_mixer
14104 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14105 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14106 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14107 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14108 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14109 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14110 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14114 static struct hda_verb alc269_lifebook_verbs[] = {
14115 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14116 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14117 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14118 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14119 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14120 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14121 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14122 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14123 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14124 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14128 /* toggle speaker-output according to the hp-jack state */
14129 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14131 unsigned int present;
14132 unsigned char bits;
14134 present = snd_hda_jack_detect(codec, 0x15);
14135 bits = present ? HDA_AMP_MUTE : 0;
14136 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14137 HDA_AMP_MUTE, bits);
14138 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14139 HDA_AMP_MUTE, bits);
14141 snd_hda_codec_write(codec, 0x20, 0,
14142 AC_VERB_SET_COEF_INDEX, 0x0c);
14143 snd_hda_codec_write(codec, 0x20, 0,
14144 AC_VERB_SET_PROC_COEF, 0x680);
14146 snd_hda_codec_write(codec, 0x20, 0,
14147 AC_VERB_SET_COEF_INDEX, 0x0c);
14148 snd_hda_codec_write(codec, 0x20, 0,
14149 AC_VERB_SET_PROC_COEF, 0x480);
14152 /* toggle speaker-output according to the hp-jacks state */
14153 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14155 unsigned int present;
14156 unsigned char bits;
14158 /* Check laptop headphone socket */
14159 present = snd_hda_jack_detect(codec, 0x15);
14161 /* Check port replicator headphone socket */
14162 present |= snd_hda_jack_detect(codec, 0x1a);
14164 bits = present ? HDA_AMP_MUTE : 0;
14165 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14166 HDA_AMP_MUTE, bits);
14167 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14168 HDA_AMP_MUTE, bits);
14170 snd_hda_codec_write(codec, 0x20, 0,
14171 AC_VERB_SET_COEF_INDEX, 0x0c);
14172 snd_hda_codec_write(codec, 0x20, 0,
14173 AC_VERB_SET_PROC_COEF, 0x680);
14175 snd_hda_codec_write(codec, 0x20, 0,
14176 AC_VERB_SET_COEF_INDEX, 0x0c);
14177 snd_hda_codec_write(codec, 0x20, 0,
14178 AC_VERB_SET_PROC_COEF, 0x480);
14181 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14183 unsigned int present_laptop;
14184 unsigned int present_dock;
14186 present_laptop = snd_hda_jack_detect(codec, 0x18);
14187 present_dock = snd_hda_jack_detect(codec, 0x1b);
14189 /* Laptop mic port overrides dock mic port, design decision */
14191 snd_hda_codec_write(codec, 0x23, 0,
14192 AC_VERB_SET_CONNECT_SEL, 0x3);
14193 if (present_laptop)
14194 snd_hda_codec_write(codec, 0x23, 0,
14195 AC_VERB_SET_CONNECT_SEL, 0x0);
14196 if (!present_dock && !present_laptop)
14197 snd_hda_codec_write(codec, 0x23, 0,
14198 AC_VERB_SET_CONNECT_SEL, 0x1);
14201 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14204 switch (res >> 26) {
14205 case ALC880_HP_EVENT:
14206 alc269_quanta_fl1_speaker_automute(codec);
14208 case ALC880_MIC_EVENT:
14209 alc_mic_automute(codec);
14214 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14217 if ((res >> 26) == ALC880_HP_EVENT)
14218 alc269_lifebook_speaker_automute(codec);
14219 if ((res >> 26) == ALC880_MIC_EVENT)
14220 alc269_lifebook_mic_autoswitch(codec);
14223 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14225 struct alc_spec *spec = codec->spec;
14226 spec->autocfg.hp_pins[0] = 0x15;
14227 spec->autocfg.speaker_pins[0] = 0x14;
14228 spec->ext_mic.pin = 0x18;
14229 spec->ext_mic.mux_idx = 0;
14230 spec->int_mic.pin = 0x19;
14231 spec->int_mic.mux_idx = 1;
14232 spec->auto_mic = 1;
14235 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14237 alc269_quanta_fl1_speaker_automute(codec);
14238 alc_mic_automute(codec);
14241 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14243 alc269_lifebook_speaker_automute(codec);
14244 alc269_lifebook_mic_autoswitch(codec);
14247 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14248 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14249 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14250 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14251 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14252 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14253 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14254 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14258 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14259 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14260 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14261 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14262 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14263 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14264 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14268 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14269 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14270 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14271 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14272 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14273 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14274 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14275 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14279 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14280 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14281 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14282 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14283 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14284 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14285 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14286 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14290 static struct hda_verb alc271_acer_dmic_verbs[] = {
14291 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14292 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14293 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14294 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14295 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14296 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14297 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14298 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14299 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14300 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14304 /* toggle speaker-output according to the hp-jack state */
14305 static void alc269_speaker_automute(struct hda_codec *codec)
14307 struct alc_spec *spec = codec->spec;
14308 unsigned int nid = spec->autocfg.hp_pins[0];
14309 unsigned int present;
14310 unsigned char bits;
14312 present = snd_hda_jack_detect(codec, nid);
14313 bits = present ? HDA_AMP_MUTE : 0;
14314 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14315 HDA_AMP_MUTE, bits);
14316 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14317 HDA_AMP_MUTE, bits);
14320 /* unsolicited event for HP jack sensing */
14321 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14324 switch (res >> 26) {
14325 case ALC880_HP_EVENT:
14326 alc269_speaker_automute(codec);
14328 case ALC880_MIC_EVENT:
14329 alc_mic_automute(codec);
14334 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14336 struct alc_spec *spec = codec->spec;
14337 spec->autocfg.hp_pins[0] = 0x15;
14338 spec->autocfg.speaker_pins[0] = 0x14;
14339 spec->ext_mic.pin = 0x18;
14340 spec->ext_mic.mux_idx = 0;
14341 spec->int_mic.pin = 0x19;
14342 spec->int_mic.mux_idx = 1;
14343 spec->auto_mic = 1;
14346 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14348 struct alc_spec *spec = codec->spec;
14349 spec->autocfg.hp_pins[0] = 0x15;
14350 spec->autocfg.speaker_pins[0] = 0x14;
14351 spec->ext_mic.pin = 0x18;
14352 spec->ext_mic.mux_idx = 0;
14353 spec->int_mic.pin = 0x12;
14354 spec->int_mic.mux_idx = 5;
14355 spec->auto_mic = 1;
14358 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14360 struct alc_spec *spec = codec->spec;
14361 spec->autocfg.hp_pins[0] = 0x21;
14362 spec->autocfg.speaker_pins[0] = 0x14;
14363 spec->ext_mic.pin = 0x18;
14364 spec->ext_mic.mux_idx = 0;
14365 spec->int_mic.pin = 0x19;
14366 spec->int_mic.mux_idx = 1;
14367 spec->auto_mic = 1;
14370 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14372 struct alc_spec *spec = codec->spec;
14373 spec->autocfg.hp_pins[0] = 0x21;
14374 spec->autocfg.speaker_pins[0] = 0x14;
14375 spec->ext_mic.pin = 0x18;
14376 spec->ext_mic.mux_idx = 0;
14377 spec->int_mic.pin = 0x12;
14378 spec->int_mic.mux_idx = 6;
14379 spec->auto_mic = 1;
14382 static void alc269_laptop_inithook(struct hda_codec *codec)
14384 alc269_speaker_automute(codec);
14385 alc_mic_automute(codec);
14389 * generic initialization of ADC, input mixers and output mixers
14391 static struct hda_verb alc269_init_verbs[] = {
14393 * Unmute ADC0 and set the default input to mic-in
14395 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14398 * Set up output mixers (0x02 - 0x03)
14400 /* set vol=0 to output mixers */
14401 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14402 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14404 /* set up input amps for analog loopback */
14405 /* Amp Indices: DAC = 0, mixer = 1 */
14406 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14407 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14408 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14409 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14410 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14411 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14413 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14414 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14415 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14416 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14417 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14418 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14419 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14421 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14422 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14424 /* FIXME: use Mux-type input source selection */
14425 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14426 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14427 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14430 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14434 static struct hda_verb alc269vb_init_verbs[] = {
14436 * Unmute ADC0 and set the default input to mic-in
14438 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14441 * Set up output mixers (0x02 - 0x03)
14443 /* set vol=0 to output mixers */
14444 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14445 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14447 /* set up input amps for analog loopback */
14448 /* Amp Indices: DAC = 0, mixer = 1 */
14449 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14450 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14451 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14452 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14453 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14454 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14456 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14457 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14458 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14459 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14460 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14461 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14462 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14464 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14465 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14467 /* FIXME: use Mux-type input source selection */
14468 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14469 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14470 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14473 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14477 #define alc269_auto_create_multi_out_ctls \
14478 alc268_auto_create_multi_out_ctls
14479 #define alc269_auto_create_input_ctls \
14480 alc268_auto_create_input_ctls
14482 #ifdef CONFIG_SND_HDA_POWER_SAVE
14483 #define alc269_loopbacks alc880_loopbacks
14486 /* pcm configuration: identical with ALC880 */
14487 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14488 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14489 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14490 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14492 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14496 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14497 /* NID is set in alc_build_pcms */
14499 .open = alc880_playback_pcm_open,
14500 .prepare = alc880_playback_pcm_prepare,
14501 .cleanup = alc880_playback_pcm_cleanup
14505 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14509 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14510 /* NID is set in alc_build_pcms */
14513 #ifdef CONFIG_SND_HDA_POWER_SAVE
14514 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14516 switch (codec->subsystem_id) {
14523 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14525 /* update mute-LED according to the speaker mute state */
14526 if (nid == 0x01 || nid == 0x14) {
14528 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14533 /* mic2 vref pin is used for mute LED control */
14534 snd_hda_codec_update_cache(codec, 0x19, 0,
14535 AC_VERB_SET_PIN_WIDGET_CONTROL,
14538 return alc_check_power_status(codec, nid);
14540 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14542 static int alc275_setup_dual_adc(struct hda_codec *codec)
14544 struct alc_spec *spec = codec->spec;
14546 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14548 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14549 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14550 if (spec->ext_mic.pin <= 0x12) {
14551 spec->private_adc_nids[0] = 0x08;
14552 spec->private_adc_nids[1] = 0x11;
14553 spec->private_capsrc_nids[0] = 0x23;
14554 spec->private_capsrc_nids[1] = 0x22;
14556 spec->private_adc_nids[0] = 0x11;
14557 spec->private_adc_nids[1] = 0x08;
14558 spec->private_capsrc_nids[0] = 0x22;
14559 spec->private_capsrc_nids[1] = 0x23;
14561 spec->adc_nids = spec->private_adc_nids;
14562 spec->capsrc_nids = spec->private_capsrc_nids;
14563 spec->num_adc_nids = 2;
14564 spec->dual_adc_switch = 1;
14565 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14566 spec->adc_nids[0], spec->adc_nids[1]);
14572 /* different alc269-variants */
14574 ALC269_TYPE_NORMAL,
14575 ALC269_TYPE_ALC259,
14576 ALC269_TYPE_ALC271X,
14580 * BIOS auto configuration
14582 static int alc269_parse_auto_config(struct hda_codec *codec)
14584 struct alc_spec *spec = codec->spec;
14586 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14588 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14593 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14596 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14597 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14599 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14604 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14606 alc_auto_parse_digital(codec);
14608 if (spec->kctls.list)
14609 add_mixer(spec, spec->kctls.list);
14611 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14612 add_verb(spec, alc269vb_init_verbs);
14613 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14615 add_verb(spec, alc269_init_verbs);
14616 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14619 spec->num_mux_defs = 1;
14620 spec->input_mux = &spec->private_imux[0];
14622 if (!alc275_setup_dual_adc(codec))
14623 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14624 sizeof(alc269_adc_candidates));
14626 /* set default input source */
14627 if (!spec->dual_adc_switch)
14628 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14629 spec->input_mux->items[0].index);
14631 err = alc_auto_add_mic_boost(codec);
14635 if (!spec->cap_mixer && !spec->no_analog)
14636 set_capture_mixer(codec);
14641 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14642 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14643 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14646 /* init callback for auto-configuration model -- overriding the default init */
14647 static void alc269_auto_init(struct hda_codec *codec)
14649 struct alc_spec *spec = codec->spec;
14650 alc269_auto_init_multi_out(codec);
14651 alc269_auto_init_hp_out(codec);
14652 alc269_auto_init_analog_input(codec);
14653 alc_auto_init_digital(codec);
14654 alc_init_jacks(codec);
14655 if (spec->unsol_event)
14656 alc_inithook(codec);
14659 #ifdef CONFIG_SND_HDA_POWER_SAVE
14660 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14662 struct alc_spec *spec = codec->spec;
14665 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14666 val = alc_read_coef_idx(codec, 0x04);
14667 /* Power down output pin */
14668 alc_write_coef_idx(codec, 0x04, val & ~(1<<11));
14671 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14672 val = alc_read_coef_idx(codec, 0x04);
14673 /* Power down output pin */
14674 alc_write_coef_idx(codec, 0x04, val & ~(1<<11));
14679 if (spec && spec->power_hook)
14680 spec->power_hook(codec);
14684 #ifdef SND_HDA_NEEDS_RESUME
14685 static int alc269_resume(struct hda_codec *codec)
14689 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14690 val = alc_read_coef_idx(codec, 0x04);
14691 /* Power down output pin */
14692 alc_write_coef_idx(codec, 0x04, val & ~(1<<11));
14696 codec->patch_ops.init(codec);
14698 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14699 val = alc_read_coef_idx(codec, 0x04);
14700 /* Power up output pin */
14701 alc_write_coef_idx(codec, 0x04, val | (1<<11));
14705 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14706 val = alc_read_coef_idx(codec, 0x04);
14707 /* Power up output pin */
14708 alc_write_coef_idx(codec, 0x04, val | (1<<11));
14711 snd_hda_codec_resume_amp(codec);
14712 snd_hda_codec_resume_cache(codec);
14713 #ifdef CONFIG_SND_HDA_POWER_SAVE
14714 if (codec->patch_ops.check_power_status)
14715 codec->patch_ops.check_power_status(codec, 0x01);
14722 ALC269_FIXUP_SONY_VAIO,
14725 static const struct alc_fixup alc269_fixups[] = {
14726 [ALC269_FIXUP_SONY_VAIO] = {
14727 .verbs = (const struct hda_verb[]) {
14728 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14734 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14735 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14736 SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14742 * configuration and preset
14744 static const char *alc269_models[ALC269_MODEL_LAST] = {
14745 [ALC269_BASIC] = "basic",
14746 [ALC269_QUANTA_FL1] = "quanta",
14747 [ALC269_AMIC] = "laptop-amic",
14748 [ALC269_DMIC] = "laptop-dmic",
14749 [ALC269_FUJITSU] = "fujitsu",
14750 [ALC269_LIFEBOOK] = "lifebook",
14751 [ALC269_AUTO] = "auto",
14754 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14755 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14756 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14757 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14759 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14760 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14761 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14762 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14763 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14764 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14765 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14766 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14767 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14768 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14769 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14770 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14771 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14772 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14773 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14774 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14775 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14776 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14777 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14778 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14779 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14780 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14781 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14782 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14783 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14784 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14785 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14786 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14787 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14788 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14789 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14790 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14791 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14792 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14793 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14794 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14795 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14797 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14799 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14800 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14801 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14802 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14803 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14804 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14805 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14806 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14807 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14808 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14812 static struct alc_config_preset alc269_presets[] = {
14814 .mixers = { alc269_base_mixer },
14815 .init_verbs = { alc269_init_verbs },
14816 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14817 .dac_nids = alc269_dac_nids,
14819 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14820 .channel_mode = alc269_modes,
14821 .input_mux = &alc269_capture_source,
14823 [ALC269_QUANTA_FL1] = {
14824 .mixers = { alc269_quanta_fl1_mixer },
14825 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14826 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14827 .dac_nids = alc269_dac_nids,
14829 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14830 .channel_mode = alc269_modes,
14831 .input_mux = &alc269_capture_source,
14832 .unsol_event = alc269_quanta_fl1_unsol_event,
14833 .setup = alc269_quanta_fl1_setup,
14834 .init_hook = alc269_quanta_fl1_init_hook,
14837 .mixers = { alc269_laptop_mixer },
14838 .cap_mixer = alc269_laptop_analog_capture_mixer,
14839 .init_verbs = { alc269_init_verbs,
14840 alc269_laptop_amic_init_verbs },
14841 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14842 .dac_nids = alc269_dac_nids,
14844 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14845 .channel_mode = alc269_modes,
14846 .unsol_event = alc269_laptop_unsol_event,
14847 .setup = alc269_laptop_amic_setup,
14848 .init_hook = alc269_laptop_inithook,
14851 .mixers = { alc269_laptop_mixer },
14852 .cap_mixer = alc269_laptop_digital_capture_mixer,
14853 .init_verbs = { alc269_init_verbs,
14854 alc269_laptop_dmic_init_verbs },
14855 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14856 .dac_nids = alc269_dac_nids,
14858 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14859 .channel_mode = alc269_modes,
14860 .unsol_event = alc269_laptop_unsol_event,
14861 .setup = alc269_laptop_dmic_setup,
14862 .init_hook = alc269_laptop_inithook,
14864 [ALC269VB_AMIC] = {
14865 .mixers = { alc269vb_laptop_mixer },
14866 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14867 .init_verbs = { alc269vb_init_verbs,
14868 alc269vb_laptop_amic_init_verbs },
14869 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14870 .dac_nids = alc269_dac_nids,
14872 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14873 .channel_mode = alc269_modes,
14874 .unsol_event = alc269_laptop_unsol_event,
14875 .setup = alc269vb_laptop_amic_setup,
14876 .init_hook = alc269_laptop_inithook,
14878 [ALC269VB_DMIC] = {
14879 .mixers = { alc269vb_laptop_mixer },
14880 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14881 .init_verbs = { alc269vb_init_verbs,
14882 alc269vb_laptop_dmic_init_verbs },
14883 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14884 .dac_nids = alc269_dac_nids,
14886 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14887 .channel_mode = alc269_modes,
14888 .unsol_event = alc269_laptop_unsol_event,
14889 .setup = alc269vb_laptop_dmic_setup,
14890 .init_hook = alc269_laptop_inithook,
14892 [ALC269_FUJITSU] = {
14893 .mixers = { alc269_fujitsu_mixer },
14894 .cap_mixer = alc269_laptop_digital_capture_mixer,
14895 .init_verbs = { alc269_init_verbs,
14896 alc269_laptop_dmic_init_verbs },
14897 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14898 .dac_nids = alc269_dac_nids,
14900 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14901 .channel_mode = alc269_modes,
14902 .unsol_event = alc269_laptop_unsol_event,
14903 .setup = alc269_laptop_dmic_setup,
14904 .init_hook = alc269_laptop_inithook,
14906 [ALC269_LIFEBOOK] = {
14907 .mixers = { alc269_lifebook_mixer },
14908 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14909 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14910 .dac_nids = alc269_dac_nids,
14912 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14913 .channel_mode = alc269_modes,
14914 .input_mux = &alc269_capture_source,
14915 .unsol_event = alc269_lifebook_unsol_event,
14916 .init_hook = alc269_lifebook_init_hook,
14919 .mixers = { alc269_asus_mixer },
14920 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14921 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
14922 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14923 .dac_nids = alc269_dac_nids,
14924 .adc_nids = alc262_dmic_adc_nids,
14925 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
14926 .capsrc_nids = alc262_dmic_capsrc_nids,
14927 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14928 .channel_mode = alc269_modes,
14929 .input_mux = &alc269_capture_source,
14930 .dig_out_nid = ALC880_DIGOUT_NID,
14931 .unsol_event = alc_sku_unsol_event,
14932 .setup = alc269vb_laptop_dmic_setup,
14933 .init_hook = alc_inithook,
14937 static int alc269_fill_coef(struct hda_codec *codec)
14941 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
14942 alc_write_coef_idx(codec, 0xf, 0x960b);
14943 alc_write_coef_idx(codec, 0xe, 0x8817);
14946 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
14947 alc_write_coef_idx(codec, 0xf, 0x960b);
14948 alc_write_coef_idx(codec, 0xe, 0x8814);
14951 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14952 val = alc_read_coef_idx(codec, 0x04);
14953 /* Power up output pin */
14954 alc_write_coef_idx(codec, 0x04, val | (1<<11));
14957 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14958 val = alc_read_coef_idx(codec, 0xd);
14959 if ((val & 0x0c00) >> 10 != 0x1) {
14960 /* Capless ramp up clock control */
14961 alc_write_coef_idx(codec, 0xd, val | 1<<10);
14963 val = alc_read_coef_idx(codec, 0x17);
14964 if ((val & 0x01c0) >> 6 != 0x4) {
14965 /* Class D power on reset */
14966 alc_write_coef_idx(codec, 0x17, val | 1<<7);
14972 static int patch_alc269(struct hda_codec *codec)
14974 struct alc_spec *spec;
14978 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14982 codec->spec = spec;
14984 alc_auto_parse_customize_define(codec);
14986 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14987 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14988 spec->cdefine.platform_type == 1) {
14989 alc_codec_rename(codec, "ALC271X");
14990 spec->codec_variant = ALC269_TYPE_ALC271X;
14992 alc_codec_rename(codec, "ALC259");
14993 spec->codec_variant = ALC269_TYPE_ALC259;
14996 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14998 alc269_fill_coef(codec);
15000 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15004 if (board_config < 0) {
15005 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15007 board_config = ALC269_AUTO;
15010 if (board_config == ALC269_AUTO)
15011 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
15013 if (board_config == ALC269_AUTO) {
15014 /* automatic parse from the BIOS config */
15015 err = alc269_parse_auto_config(codec);
15021 "hda_codec: Cannot set up configuration "
15022 "from BIOS. Using base mode...\n");
15023 board_config = ALC269_BASIC;
15027 if (has_cdefine_beep(codec)) {
15028 err = snd_hda_attach_beep_device(codec, 0x1);
15035 if (board_config != ALC269_AUTO)
15036 setup_preset(codec, &alc269_presets[board_config]);
15038 if (board_config == ALC269_QUANTA_FL1) {
15039 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15040 * fix the sample rate of analog I/O to 44.1kHz
15042 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15043 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15044 } else if (spec->dual_adc_switch) {
15045 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15046 /* switch ADC dynamically */
15047 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15049 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15050 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15052 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15053 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15055 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15056 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
15057 spec->adc_nids = alc269_adc_nids;
15058 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15059 spec->capsrc_nids = alc269_capsrc_nids;
15061 spec->adc_nids = alc269vb_adc_nids;
15062 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15063 spec->capsrc_nids = alc269vb_capsrc_nids;
15067 if (!spec->cap_mixer)
15068 set_capture_mixer(codec);
15069 if (has_cdefine_beep(codec))
15070 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15072 if (board_config == ALC269_AUTO)
15073 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
15075 spec->vmaster_nid = 0x02;
15077 codec->patch_ops = alc_patch_ops;
15078 #ifdef CONFIG_SND_HDA_POWER_SAVE
15079 codec->patch_ops.suspend = alc269_suspend;
15081 #ifdef SND_HDA_NEEDS_RESUME
15082 codec->patch_ops.resume = alc269_resume;
15084 if (board_config == ALC269_AUTO)
15085 spec->init_hook = alc269_auto_init;
15086 #ifdef CONFIG_SND_HDA_POWER_SAVE
15087 if (!spec->loopback.amplist)
15088 spec->loopback.amplist = alc269_loopbacks;
15089 if (alc269_mic2_for_mute_led(codec))
15090 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15097 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15101 * set the path ways for 2 channel output
15102 * need to set the codec line out and mic 1 pin widgets to inputs
15104 static struct hda_verb alc861_threestack_ch2_init[] = {
15105 /* set pin widget 1Ah (line in) for input */
15106 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15107 /* set pin widget 18h (mic1/2) for input, for mic also enable
15110 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15112 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15114 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15115 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15121 * need to set the codec line out and mic 1 pin widgets to outputs
15123 static struct hda_verb alc861_threestack_ch6_init[] = {
15124 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15125 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15126 /* set pin widget 18h (mic1) for output (CLFE)*/
15127 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15129 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15130 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15132 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15134 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15135 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15140 static struct hda_channel_mode alc861_threestack_modes[2] = {
15141 { 2, alc861_threestack_ch2_init },
15142 { 6, alc861_threestack_ch6_init },
15144 /* Set mic1 as input and unmute the mixer */
15145 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15146 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15147 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15150 /* Set mic1 as output and mute mixer */
15151 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15152 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15153 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15157 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15158 { 2, alc861_uniwill_m31_ch2_init },
15159 { 4, alc861_uniwill_m31_ch4_init },
15162 /* Set mic1 and line-in as input and unmute the mixer */
15163 static struct hda_verb alc861_asus_ch2_init[] = {
15164 /* set pin widget 1Ah (line in) for input */
15165 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15166 /* set pin widget 18h (mic1/2) for input, for mic also enable
15169 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15171 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15173 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15174 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15178 /* Set mic1 nad line-in as output and mute mixer */
15179 static struct hda_verb alc861_asus_ch6_init[] = {
15180 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15181 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15182 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15183 /* set pin widget 18h (mic1) for output (CLFE)*/
15184 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15185 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15186 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15187 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15189 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15191 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15192 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15197 static struct hda_channel_mode alc861_asus_modes[2] = {
15198 { 2, alc861_asus_ch2_init },
15199 { 6, alc861_asus_ch6_init },
15204 static struct snd_kcontrol_new alc861_base_mixer[] = {
15205 /* output mixer control */
15206 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15207 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15208 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15209 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15210 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15212 /*Input mixer control */
15213 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15214 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15215 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15216 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15217 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15218 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15220 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15221 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15222 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15227 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15228 /* output mixer control */
15229 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15230 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15231 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15232 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15233 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15235 /* Input mixer control */
15236 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15237 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15238 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15239 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15240 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15241 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15243 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15244 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15245 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15248 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15249 .name = "Channel Mode",
15250 .info = alc_ch_mode_info,
15251 .get = alc_ch_mode_get,
15252 .put = alc_ch_mode_put,
15253 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15258 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15259 /* output mixer control */
15260 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15262 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15267 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15268 /* output mixer control */
15269 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15270 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15271 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15272 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15273 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15275 /* Input mixer control */
15276 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15277 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15278 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15279 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15280 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15281 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15282 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15283 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15284 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15285 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15288 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15289 .name = "Channel Mode",
15290 .info = alc_ch_mode_info,
15291 .get = alc_ch_mode_get,
15292 .put = alc_ch_mode_put,
15293 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15298 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15299 /* output mixer control */
15300 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15301 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15302 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15303 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15304 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15306 /* Input mixer control */
15307 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15308 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15309 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15310 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15311 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15312 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15313 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15314 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15315 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15316 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15319 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15320 .name = "Channel Mode",
15321 .info = alc_ch_mode_info,
15322 .get = alc_ch_mode_get,
15323 .put = alc_ch_mode_put,
15324 .private_value = ARRAY_SIZE(alc861_asus_modes),
15329 /* additional mixer */
15330 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15331 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15332 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15337 * generic initialization of ADC, input mixers and output mixers
15339 static struct hda_verb alc861_base_init_verbs[] = {
15341 * Unmute ADC0 and set the default input to mic-in
15343 /* port-A for surround (rear panel) */
15344 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15345 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15346 /* port-B for mic-in (rear panel) with vref */
15347 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15348 /* port-C for line-in (rear panel) */
15349 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15350 /* port-D for Front */
15351 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15352 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15353 /* port-E for HP out (front panel) */
15354 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15355 /* route front PCM to HP */
15356 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15357 /* port-F for mic-in (front panel) with vref */
15358 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15359 /* port-G for CLFE (rear panel) */
15360 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15361 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15362 /* port-H for side (rear panel) */
15363 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15364 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15366 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15367 /* route front mic to ADC1*/
15368 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15369 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15371 /* Unmute DAC0~3 & spdif out*/
15372 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15373 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15374 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15375 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15376 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15378 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15379 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15380 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15381 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15382 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15384 /* Unmute Stereo Mixer 15 */
15385 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15386 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15387 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15388 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15390 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15391 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15392 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15393 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15394 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15395 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15396 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15397 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15398 /* hp used DAC 3 (Front) */
15399 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15400 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15405 static struct hda_verb alc861_threestack_init_verbs[] = {
15407 * Unmute ADC0 and set the default input to mic-in
15409 /* port-A for surround (rear panel) */
15410 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15411 /* port-B for mic-in (rear panel) with vref */
15412 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15413 /* port-C for line-in (rear panel) */
15414 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15415 /* port-D for Front */
15416 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15417 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15418 /* port-E for HP out (front panel) */
15419 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15420 /* route front PCM to HP */
15421 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15422 /* port-F for mic-in (front panel) with vref */
15423 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15424 /* port-G for CLFE (rear panel) */
15425 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15426 /* port-H for side (rear panel) */
15427 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15429 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15430 /* route front mic to ADC1*/
15431 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15432 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15433 /* Unmute DAC0~3 & spdif out*/
15434 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15435 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15436 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15437 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15438 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15440 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15441 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15442 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15443 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15444 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15446 /* Unmute Stereo Mixer 15 */
15447 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15449 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15450 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15452 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15453 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15454 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15455 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15456 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15457 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15458 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15459 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15460 /* hp used DAC 3 (Front) */
15461 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15462 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15466 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15468 * Unmute ADC0 and set the default input to mic-in
15470 /* port-A for surround (rear panel) */
15471 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15472 /* port-B for mic-in (rear panel) with vref */
15473 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15474 /* port-C for line-in (rear panel) */
15475 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15476 /* port-D for Front */
15477 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15478 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15479 /* port-E for HP out (front panel) */
15480 /* this has to be set to VREF80 */
15481 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15482 /* route front PCM to HP */
15483 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15484 /* port-F for mic-in (front panel) with vref */
15485 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15486 /* port-G for CLFE (rear panel) */
15487 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15488 /* port-H for side (rear panel) */
15489 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15491 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15492 /* route front mic to ADC1*/
15493 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15494 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15495 /* Unmute DAC0~3 & spdif out*/
15496 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15497 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15498 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15499 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15500 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15502 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15503 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15504 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15505 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15506 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15508 /* Unmute Stereo Mixer 15 */
15509 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15510 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15511 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15512 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15514 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15515 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15516 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15517 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15518 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15519 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15520 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15521 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15522 /* hp used DAC 3 (Front) */
15523 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15524 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15528 static struct hda_verb alc861_asus_init_verbs[] = {
15530 * Unmute ADC0 and set the default input to mic-in
15532 /* port-A for surround (rear panel)
15533 * according to codec#0 this is the HP jack
15535 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15536 /* route front PCM to HP */
15537 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15538 /* port-B for mic-in (rear panel) with vref */
15539 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15540 /* port-C for line-in (rear panel) */
15541 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15542 /* port-D for Front */
15543 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15544 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15545 /* port-E for HP out (front panel) */
15546 /* this has to be set to VREF80 */
15547 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15548 /* route front PCM to HP */
15549 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15550 /* port-F for mic-in (front panel) with vref */
15551 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15552 /* port-G for CLFE (rear panel) */
15553 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15554 /* port-H for side (rear panel) */
15555 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15557 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15558 /* route front mic to ADC1*/
15559 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15560 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15561 /* Unmute DAC0~3 & spdif out*/
15562 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15563 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15564 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15565 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15566 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15567 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15568 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15569 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15570 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15571 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15573 /* Unmute Stereo Mixer 15 */
15574 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15575 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15576 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15577 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15579 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15580 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15581 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15582 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15583 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15584 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15585 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15586 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15587 /* hp used DAC 3 (Front) */
15588 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15589 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15593 /* additional init verbs for ASUS laptops */
15594 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15595 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15596 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15601 * generic initialization of ADC, input mixers and output mixers
15603 static struct hda_verb alc861_auto_init_verbs[] = {
15605 * Unmute ADC0 and set the default input to mic-in
15607 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15608 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15610 /* Unmute DAC0~3 & spdif out*/
15611 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15612 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15613 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15614 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15617 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15618 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15619 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15620 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15621 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15623 /* Unmute Stereo Mixer 15 */
15624 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15625 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15626 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15627 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15629 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15630 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15631 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15632 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15633 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15634 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15635 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15636 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15638 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15639 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15640 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15641 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15642 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15643 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15644 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15645 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15647 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15652 static struct hda_verb alc861_toshiba_init_verbs[] = {
15653 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15658 /* toggle speaker-output according to the hp-jack state */
15659 static void alc861_toshiba_automute(struct hda_codec *codec)
15661 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15663 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15664 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15665 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15666 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15669 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15672 if ((res >> 26) == ALC880_HP_EVENT)
15673 alc861_toshiba_automute(codec);
15676 /* pcm configuration: identical with ALC880 */
15677 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15678 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15679 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15680 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15683 #define ALC861_DIGOUT_NID 0x07
15685 static struct hda_channel_mode alc861_8ch_modes[1] = {
15689 static hda_nid_t alc861_dac_nids[4] = {
15690 /* front, surround, clfe, side */
15691 0x03, 0x06, 0x05, 0x04
15694 static hda_nid_t alc660_dac_nids[3] = {
15695 /* front, clfe, surround */
15699 static hda_nid_t alc861_adc_nids[1] = {
15704 static struct hda_input_mux alc861_capture_source = {
15708 { "Front Mic", 0x3 },
15715 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15717 struct alc_spec *spec = codec->spec;
15718 hda_nid_t mix, srcs[5];
15721 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15723 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15726 for (i = 0; i < num; i++) {
15728 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15729 if (type != AC_WID_AUD_OUT)
15731 for (j = 0; j < spec->multiout.num_dacs; j++)
15732 if (spec->multiout.dac_nids[j] == srcs[i])
15734 if (j >= spec->multiout.num_dacs)
15740 /* fill in the dac_nids table from the parsed pin configuration */
15741 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15742 const struct auto_pin_cfg *cfg)
15744 struct alc_spec *spec = codec->spec;
15746 hda_nid_t nid, dac;
15748 spec->multiout.dac_nids = spec->private_dac_nids;
15749 for (i = 0; i < cfg->line_outs; i++) {
15750 nid = cfg->line_out_pins[i];
15751 dac = alc861_look_for_dac(codec, nid);
15754 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15759 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15760 hda_nid_t nid, unsigned int chs)
15762 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15763 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15766 /* add playback controls from the parsed DAC table */
15767 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15768 const struct auto_pin_cfg *cfg)
15770 struct alc_spec *spec = codec->spec;
15771 static const char *chname[4] = {
15772 "Front", "Surround", NULL /*CLFE*/, "Side"
15777 if (cfg->line_outs == 1) {
15778 const char *pfx = NULL;
15781 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15784 nid = spec->multiout.dac_nids[0];
15785 return alc861_create_out_sw(codec, pfx, nid, 3);
15789 for (i = 0; i < cfg->line_outs; i++) {
15790 nid = spec->multiout.dac_nids[i];
15795 err = alc861_create_out_sw(codec, "Center", nid, 1);
15798 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15802 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15810 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15812 struct alc_spec *spec = codec->spec;
15819 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15820 nid = alc861_look_for_dac(codec, pin);
15822 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15825 spec->multiout.hp_nid = nid;
15831 /* create playback/capture controls for input pins */
15832 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15833 const struct auto_pin_cfg *cfg)
15835 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15838 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15840 int pin_type, hda_nid_t dac)
15842 hda_nid_t mix, srcs[5];
15845 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15847 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15849 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15851 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15854 for (i = 0; i < num; i++) {
15856 if (srcs[i] == dac || srcs[i] == 0x15)
15857 mute = AMP_IN_UNMUTE(i);
15859 mute = AMP_IN_MUTE(i);
15860 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15865 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15867 struct alc_spec *spec = codec->spec;
15870 for (i = 0; i < spec->autocfg.line_outs; i++) {
15871 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15872 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15874 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15875 spec->multiout.dac_nids[i]);
15879 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15881 struct alc_spec *spec = codec->spec;
15883 if (spec->autocfg.hp_outs)
15884 alc861_auto_set_output_and_unmute(codec,
15885 spec->autocfg.hp_pins[0],
15887 spec->multiout.hp_nid);
15888 if (spec->autocfg.speaker_outs)
15889 alc861_auto_set_output_and_unmute(codec,
15890 spec->autocfg.speaker_pins[0],
15892 spec->multiout.dac_nids[0]);
15895 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15897 struct alc_spec *spec = codec->spec;
15898 struct auto_pin_cfg *cfg = &spec->autocfg;
15901 for (i = 0; i < cfg->num_inputs; i++) {
15902 hda_nid_t nid = cfg->inputs[i].pin;
15903 if (nid >= 0x0c && nid <= 0x11)
15904 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
15908 /* parse the BIOS configuration and set up the alc_spec */
15909 /* return 1 if successful, 0 if the proper config is not found,
15910 * or a negative error code
15912 static int alc861_parse_auto_config(struct hda_codec *codec)
15914 struct alc_spec *spec = codec->spec;
15916 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15918 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15922 if (!spec->autocfg.line_outs)
15923 return 0; /* can't find valid BIOS pin config */
15925 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15928 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15931 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15934 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15938 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15940 alc_auto_parse_digital(codec);
15942 if (spec->kctls.list)
15943 add_mixer(spec, spec->kctls.list);
15945 add_verb(spec, alc861_auto_init_verbs);
15947 spec->num_mux_defs = 1;
15948 spec->input_mux = &spec->private_imux[0];
15950 spec->adc_nids = alc861_adc_nids;
15951 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15952 set_capture_mixer(codec);
15954 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15959 /* additional initialization for auto-configuration model */
15960 static void alc861_auto_init(struct hda_codec *codec)
15962 struct alc_spec *spec = codec->spec;
15963 alc861_auto_init_multi_out(codec);
15964 alc861_auto_init_hp_out(codec);
15965 alc861_auto_init_analog_input(codec);
15966 alc_auto_init_digital(codec);
15967 if (spec->unsol_event)
15968 alc_inithook(codec);
15971 #ifdef CONFIG_SND_HDA_POWER_SAVE
15972 static struct hda_amp_list alc861_loopbacks[] = {
15973 { 0x15, HDA_INPUT, 0 },
15974 { 0x15, HDA_INPUT, 1 },
15975 { 0x15, HDA_INPUT, 2 },
15976 { 0x15, HDA_INPUT, 3 },
15983 * configuration and preset
15985 static const char *alc861_models[ALC861_MODEL_LAST] = {
15986 [ALC861_3ST] = "3stack",
15987 [ALC660_3ST] = "3stack-660",
15988 [ALC861_3ST_DIG] = "3stack-dig",
15989 [ALC861_6ST_DIG] = "6stack-dig",
15990 [ALC861_UNIWILL_M31] = "uniwill-m31",
15991 [ALC861_TOSHIBA] = "toshiba",
15992 [ALC861_ASUS] = "asus",
15993 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15994 [ALC861_AUTO] = "auto",
15997 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15998 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15999 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16000 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16001 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16002 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16003 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16004 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16005 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16006 * Any other models that need this preset?
16008 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16009 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16010 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16011 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16012 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16013 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16014 /* FIXME: the below seems conflict */
16015 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16016 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16017 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16021 static struct alc_config_preset alc861_presets[] = {
16023 .mixers = { alc861_3ST_mixer },
16024 .init_verbs = { alc861_threestack_init_verbs },
16025 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16026 .dac_nids = alc861_dac_nids,
16027 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16028 .channel_mode = alc861_threestack_modes,
16030 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16031 .adc_nids = alc861_adc_nids,
16032 .input_mux = &alc861_capture_source,
16034 [ALC861_3ST_DIG] = {
16035 .mixers = { alc861_base_mixer },
16036 .init_verbs = { alc861_threestack_init_verbs },
16037 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16038 .dac_nids = alc861_dac_nids,
16039 .dig_out_nid = ALC861_DIGOUT_NID,
16040 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16041 .channel_mode = alc861_threestack_modes,
16043 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16044 .adc_nids = alc861_adc_nids,
16045 .input_mux = &alc861_capture_source,
16047 [ALC861_6ST_DIG] = {
16048 .mixers = { alc861_base_mixer },
16049 .init_verbs = { alc861_base_init_verbs },
16050 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16051 .dac_nids = alc861_dac_nids,
16052 .dig_out_nid = ALC861_DIGOUT_NID,
16053 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16054 .channel_mode = alc861_8ch_modes,
16055 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16056 .adc_nids = alc861_adc_nids,
16057 .input_mux = &alc861_capture_source,
16060 .mixers = { alc861_3ST_mixer },
16061 .init_verbs = { alc861_threestack_init_verbs },
16062 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16063 .dac_nids = alc660_dac_nids,
16064 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16065 .channel_mode = alc861_threestack_modes,
16067 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16068 .adc_nids = alc861_adc_nids,
16069 .input_mux = &alc861_capture_source,
16071 [ALC861_UNIWILL_M31] = {
16072 .mixers = { alc861_uniwill_m31_mixer },
16073 .init_verbs = { alc861_uniwill_m31_init_verbs },
16074 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16075 .dac_nids = alc861_dac_nids,
16076 .dig_out_nid = ALC861_DIGOUT_NID,
16077 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16078 .channel_mode = alc861_uniwill_m31_modes,
16080 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16081 .adc_nids = alc861_adc_nids,
16082 .input_mux = &alc861_capture_source,
16084 [ALC861_TOSHIBA] = {
16085 .mixers = { alc861_toshiba_mixer },
16086 .init_verbs = { alc861_base_init_verbs,
16087 alc861_toshiba_init_verbs },
16088 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16089 .dac_nids = alc861_dac_nids,
16090 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16091 .channel_mode = alc883_3ST_2ch_modes,
16092 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16093 .adc_nids = alc861_adc_nids,
16094 .input_mux = &alc861_capture_source,
16095 .unsol_event = alc861_toshiba_unsol_event,
16096 .init_hook = alc861_toshiba_automute,
16099 .mixers = { alc861_asus_mixer },
16100 .init_verbs = { alc861_asus_init_verbs },
16101 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16102 .dac_nids = alc861_dac_nids,
16103 .dig_out_nid = ALC861_DIGOUT_NID,
16104 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16105 .channel_mode = alc861_asus_modes,
16108 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16109 .adc_nids = alc861_adc_nids,
16110 .input_mux = &alc861_capture_source,
16112 [ALC861_ASUS_LAPTOP] = {
16113 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16114 .init_verbs = { alc861_asus_init_verbs,
16115 alc861_asus_laptop_init_verbs },
16116 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16117 .dac_nids = alc861_dac_nids,
16118 .dig_out_nid = ALC861_DIGOUT_NID,
16119 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16120 .channel_mode = alc883_3ST_2ch_modes,
16122 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16123 .adc_nids = alc861_adc_nids,
16124 .input_mux = &alc861_capture_source,
16128 /* Pin config fixes */
16130 PINFIX_FSC_AMILO_PI1505,
16133 static const struct alc_fixup alc861_fixups[] = {
16134 [PINFIX_FSC_AMILO_PI1505] = {
16135 .pins = (const struct alc_pincfg[]) {
16136 { 0x0b, 0x0221101f }, /* HP */
16137 { 0x0f, 0x90170310 }, /* speaker */
16143 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16144 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16148 static int patch_alc861(struct hda_codec *codec)
16150 struct alc_spec *spec;
16154 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16158 codec->spec = spec;
16160 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16164 if (board_config < 0) {
16165 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16167 board_config = ALC861_AUTO;
16170 if (board_config == ALC861_AUTO)
16171 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
16173 if (board_config == ALC861_AUTO) {
16174 /* automatic parse from the BIOS config */
16175 err = alc861_parse_auto_config(codec);
16181 "hda_codec: Cannot set up configuration "
16182 "from BIOS. Using base mode...\n");
16183 board_config = ALC861_3ST_DIG;
16187 err = snd_hda_attach_beep_device(codec, 0x23);
16193 if (board_config != ALC861_AUTO)
16194 setup_preset(codec, &alc861_presets[board_config]);
16196 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16197 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16199 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16200 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16202 if (!spec->cap_mixer)
16203 set_capture_mixer(codec);
16204 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16206 spec->vmaster_nid = 0x03;
16208 if (board_config == ALC861_AUTO)
16209 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
16211 codec->patch_ops = alc_patch_ops;
16212 if (board_config == ALC861_AUTO) {
16213 spec->init_hook = alc861_auto_init;
16214 #ifdef CONFIG_SND_HDA_POWER_SAVE
16215 spec->power_hook = alc_power_eapd;
16218 #ifdef CONFIG_SND_HDA_POWER_SAVE
16219 if (!spec->loopback.amplist)
16220 spec->loopback.amplist = alc861_loopbacks;
16227 * ALC861-VD support
16231 * In addition, an independent DAC
16233 #define ALC861VD_DIGOUT_NID 0x06
16235 static hda_nid_t alc861vd_dac_nids[4] = {
16236 /* front, surr, clfe, side surr */
16237 0x02, 0x03, 0x04, 0x05
16240 /* dac_nids for ALC660vd are in a different order - according to
16241 * Realtek's driver.
16242 * This should probably result in a different mixer for 6stack models
16243 * of ALC660vd codecs, but for now there is only 3stack mixer
16244 * - and it is the same as in 861vd.
16245 * adc_nids in ALC660vd are (is) the same as in 861vd
16247 static hda_nid_t alc660vd_dac_nids[3] = {
16248 /* front, rear, clfe, rear_surr */
16252 static hda_nid_t alc861vd_adc_nids[1] = {
16257 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16260 /* FIXME: should be a matrix-type input source selection */
16261 static struct hda_input_mux alc861vd_capture_source = {
16265 { "Front Mic", 0x1 },
16271 static struct hda_input_mux alc861vd_dallas_capture_source = {
16274 { "Ext Mic", 0x0 },
16275 { "Int Mic", 0x1 },
16279 static struct hda_input_mux alc861vd_hp_capture_source = {
16282 { "Front Mic", 0x0 },
16283 { "ATAPI Mic", 0x1 },
16290 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16297 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16298 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16299 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16300 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16301 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16308 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16309 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16310 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16311 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16312 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16316 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16317 { 6, alc861vd_6stack_ch6_init },
16318 { 8, alc861vd_6stack_ch8_init },
16321 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16323 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16324 .name = "Channel Mode",
16325 .info = alc_ch_mode_info,
16326 .get = alc_ch_mode_get,
16327 .put = alc_ch_mode_put,
16332 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16333 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16335 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16336 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16337 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16339 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16340 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16342 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16344 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16346 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16347 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16349 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16350 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16352 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16354 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16356 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16358 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16359 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16360 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16362 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16363 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16365 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16366 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16371 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16372 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16373 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16375 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16377 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16379 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16381 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16382 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16383 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16385 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16386 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16388 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16389 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16394 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16395 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16396 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16397 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16399 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16401 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16402 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16403 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16405 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16406 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16407 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16409 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16410 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16415 /* Pin assignment: Speaker=0x14, HP = 0x15,
16416 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16418 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16419 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16420 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16421 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16422 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16423 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16424 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16425 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16426 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16427 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16428 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16432 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16433 * Front Mic=0x18, ATAPI Mic = 0x19,
16435 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16436 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16437 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16438 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16439 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16440 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16441 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16442 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16443 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16449 * generic initialization of ADC, input mixers and output mixers
16451 static struct hda_verb alc861vd_volume_init_verbs[] = {
16453 * Unmute ADC0 and set the default input to mic-in
16455 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16456 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16458 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16459 * the analog-loopback mixer widget
16461 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16462 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16463 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16464 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16465 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16466 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16468 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16472 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16475 * Set up output mixers (0x02 - 0x05)
16477 /* set vol=0 to output mixers */
16478 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16479 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16480 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16481 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16483 /* set up input amps for analog loopback */
16484 /* Amp Indices: DAC = 0, mixer = 1 */
16485 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16486 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16487 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16488 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16489 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16490 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16491 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16492 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16498 * 3-stack pin configuration:
16499 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16501 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16503 * Set pin mode and muting
16505 /* set front pin widgets 0x14 for output */
16506 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16507 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16508 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16510 /* Mic (rear) pin: input vref at 80% */
16511 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16513 /* Front Mic pin: input vref at 80% */
16514 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16515 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16516 /* Line In pin: input */
16517 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16518 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16519 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16520 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16521 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16522 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16523 /* CD pin widget for input */
16524 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16530 * 6-stack pin configuration:
16532 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16534 * Set pin mode and muting
16536 /* set front pin widgets 0x14 for output */
16537 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16538 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16539 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16541 /* Rear Pin: output 1 (0x0d) */
16542 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16543 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16544 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16545 /* CLFE Pin: output 2 (0x0e) */
16546 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16547 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16548 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16549 /* Side Pin: output 3 (0x0f) */
16550 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16551 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16552 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16554 /* Mic (rear) pin: input vref at 80% */
16555 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16556 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16557 /* Front Mic pin: input vref at 80% */
16558 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16559 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16560 /* Line In pin: input */
16561 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16562 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16563 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16564 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16565 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16566 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16567 /* CD pin widget for input */
16568 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16573 static struct hda_verb alc861vd_eapd_verbs[] = {
16574 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16578 static struct hda_verb alc660vd_eapd_verbs[] = {
16579 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16580 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16584 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16587 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16588 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16589 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16593 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16595 unsigned int present;
16596 unsigned char bits;
16598 present = snd_hda_jack_detect(codec, 0x18);
16599 bits = present ? HDA_AMP_MUTE : 0;
16601 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16602 HDA_AMP_MUTE, bits);
16605 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16607 struct alc_spec *spec = codec->spec;
16608 spec->autocfg.hp_pins[0] = 0x1b;
16609 spec->autocfg.speaker_pins[0] = 0x14;
16612 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16614 alc_automute_amp(codec);
16615 alc861vd_lenovo_mic_automute(codec);
16618 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16621 switch (res >> 26) {
16622 case ALC880_MIC_EVENT:
16623 alc861vd_lenovo_mic_automute(codec);
16626 alc_automute_amp_unsol_event(codec, res);
16631 static struct hda_verb alc861vd_dallas_verbs[] = {
16632 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16633 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16634 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16635 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16637 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16638 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16639 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16640 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16641 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16642 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16643 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16644 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16646 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16647 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16648 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16649 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16650 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16651 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16652 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16653 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16655 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16656 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16657 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16658 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16659 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16660 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16661 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16662 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16665 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16666 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16669 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16670 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16671 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16676 /* toggle speaker-output according to the hp-jack state */
16677 static void alc861vd_dallas_setup(struct hda_codec *codec)
16679 struct alc_spec *spec = codec->spec;
16681 spec->autocfg.hp_pins[0] = 0x15;
16682 spec->autocfg.speaker_pins[0] = 0x14;
16685 #ifdef CONFIG_SND_HDA_POWER_SAVE
16686 #define alc861vd_loopbacks alc880_loopbacks
16689 /* pcm configuration: identical with ALC880 */
16690 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16691 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16692 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16693 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16696 * configuration and preset
16698 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16699 [ALC660VD_3ST] = "3stack-660",
16700 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16701 [ALC660VD_ASUS_V1S] = "asus-v1s",
16702 [ALC861VD_3ST] = "3stack",
16703 [ALC861VD_3ST_DIG] = "3stack-digout",
16704 [ALC861VD_6ST_DIG] = "6stack-digout",
16705 [ALC861VD_LENOVO] = "lenovo",
16706 [ALC861VD_DALLAS] = "dallas",
16707 [ALC861VD_HP] = "hp",
16708 [ALC861VD_AUTO] = "auto",
16711 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16712 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16713 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16714 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16715 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16716 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16717 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16718 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16719 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16720 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16721 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16722 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16723 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16724 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16725 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16726 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16730 static struct alc_config_preset alc861vd_presets[] = {
16732 .mixers = { alc861vd_3st_mixer },
16733 .init_verbs = { alc861vd_volume_init_verbs,
16734 alc861vd_3stack_init_verbs },
16735 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16736 .dac_nids = alc660vd_dac_nids,
16737 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16738 .channel_mode = alc861vd_3stack_2ch_modes,
16739 .input_mux = &alc861vd_capture_source,
16741 [ALC660VD_3ST_DIG] = {
16742 .mixers = { alc861vd_3st_mixer },
16743 .init_verbs = { alc861vd_volume_init_verbs,
16744 alc861vd_3stack_init_verbs },
16745 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16746 .dac_nids = alc660vd_dac_nids,
16747 .dig_out_nid = ALC861VD_DIGOUT_NID,
16748 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16749 .channel_mode = alc861vd_3stack_2ch_modes,
16750 .input_mux = &alc861vd_capture_source,
16753 .mixers = { alc861vd_3st_mixer },
16754 .init_verbs = { alc861vd_volume_init_verbs,
16755 alc861vd_3stack_init_verbs },
16756 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16757 .dac_nids = alc861vd_dac_nids,
16758 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16759 .channel_mode = alc861vd_3stack_2ch_modes,
16760 .input_mux = &alc861vd_capture_source,
16762 [ALC861VD_3ST_DIG] = {
16763 .mixers = { alc861vd_3st_mixer },
16764 .init_verbs = { alc861vd_volume_init_verbs,
16765 alc861vd_3stack_init_verbs },
16766 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16767 .dac_nids = alc861vd_dac_nids,
16768 .dig_out_nid = ALC861VD_DIGOUT_NID,
16769 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16770 .channel_mode = alc861vd_3stack_2ch_modes,
16771 .input_mux = &alc861vd_capture_source,
16773 [ALC861VD_6ST_DIG] = {
16774 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16775 .init_verbs = { alc861vd_volume_init_verbs,
16776 alc861vd_6stack_init_verbs },
16777 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16778 .dac_nids = alc861vd_dac_nids,
16779 .dig_out_nid = ALC861VD_DIGOUT_NID,
16780 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16781 .channel_mode = alc861vd_6stack_modes,
16782 .input_mux = &alc861vd_capture_source,
16784 [ALC861VD_LENOVO] = {
16785 .mixers = { alc861vd_lenovo_mixer },
16786 .init_verbs = { alc861vd_volume_init_verbs,
16787 alc861vd_3stack_init_verbs,
16788 alc861vd_eapd_verbs,
16789 alc861vd_lenovo_unsol_verbs },
16790 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16791 .dac_nids = alc660vd_dac_nids,
16792 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16793 .channel_mode = alc861vd_3stack_2ch_modes,
16794 .input_mux = &alc861vd_capture_source,
16795 .unsol_event = alc861vd_lenovo_unsol_event,
16796 .setup = alc861vd_lenovo_setup,
16797 .init_hook = alc861vd_lenovo_init_hook,
16799 [ALC861VD_DALLAS] = {
16800 .mixers = { alc861vd_dallas_mixer },
16801 .init_verbs = { alc861vd_dallas_verbs },
16802 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16803 .dac_nids = alc861vd_dac_nids,
16804 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16805 .channel_mode = alc861vd_3stack_2ch_modes,
16806 .input_mux = &alc861vd_dallas_capture_source,
16807 .unsol_event = alc_automute_amp_unsol_event,
16808 .setup = alc861vd_dallas_setup,
16809 .init_hook = alc_automute_amp,
16812 .mixers = { alc861vd_hp_mixer },
16813 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16814 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16815 .dac_nids = alc861vd_dac_nids,
16816 .dig_out_nid = ALC861VD_DIGOUT_NID,
16817 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16818 .channel_mode = alc861vd_3stack_2ch_modes,
16819 .input_mux = &alc861vd_hp_capture_source,
16820 .unsol_event = alc_automute_amp_unsol_event,
16821 .setup = alc861vd_dallas_setup,
16822 .init_hook = alc_automute_amp,
16824 [ALC660VD_ASUS_V1S] = {
16825 .mixers = { alc861vd_lenovo_mixer },
16826 .init_verbs = { alc861vd_volume_init_verbs,
16827 alc861vd_3stack_init_verbs,
16828 alc861vd_eapd_verbs,
16829 alc861vd_lenovo_unsol_verbs },
16830 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16831 .dac_nids = alc660vd_dac_nids,
16832 .dig_out_nid = ALC861VD_DIGOUT_NID,
16833 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16834 .channel_mode = alc861vd_3stack_2ch_modes,
16835 .input_mux = &alc861vd_capture_source,
16836 .unsol_event = alc861vd_lenovo_unsol_event,
16837 .setup = alc861vd_lenovo_setup,
16838 .init_hook = alc861vd_lenovo_init_hook,
16843 * BIOS auto configuration
16845 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16846 const struct auto_pin_cfg *cfg)
16848 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16852 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16853 hda_nid_t nid, int pin_type, int dac_idx)
16855 alc_set_pin_output(codec, nid, pin_type);
16858 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16860 struct alc_spec *spec = codec->spec;
16863 for (i = 0; i <= HDA_SIDE; i++) {
16864 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16865 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16867 alc861vd_auto_set_output_and_unmute(codec, nid,
16873 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16875 struct alc_spec *spec = codec->spec;
16878 pin = spec->autocfg.hp_pins[0];
16879 if (pin) /* connect to front and use dac 0 */
16880 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16881 pin = spec->autocfg.speaker_pins[0];
16883 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16886 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16888 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16890 struct alc_spec *spec = codec->spec;
16891 struct auto_pin_cfg *cfg = &spec->autocfg;
16894 for (i = 0; i < cfg->num_inputs; i++) {
16895 hda_nid_t nid = cfg->inputs[i].pin;
16896 if (alc_is_input_pin(codec, nid)) {
16897 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16898 if (nid != ALC861VD_PIN_CD_NID &&
16899 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16900 snd_hda_codec_write(codec, nid, 0,
16901 AC_VERB_SET_AMP_GAIN_MUTE,
16907 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16909 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16910 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16912 /* add playback controls from the parsed DAC table */
16913 /* Based on ALC880 version. But ALC861VD has separate,
16914 * different NIDs for mute/unmute switch and volume control */
16915 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16916 const struct auto_pin_cfg *cfg)
16918 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16919 hda_nid_t nid_v, nid_s;
16922 for (i = 0; i < cfg->line_outs; i++) {
16923 if (!spec->multiout.dac_nids[i])
16925 nid_v = alc861vd_idx_to_mixer_vol(
16927 spec->multiout.dac_nids[i]));
16928 nid_s = alc861vd_idx_to_mixer_switch(
16930 spec->multiout.dac_nids[i]));
16934 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16936 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16940 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16942 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16946 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16948 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16952 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16954 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16960 if (cfg->line_outs == 1 &&
16961 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16968 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16969 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16973 if (cfg->line_outs == 1 &&
16974 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16976 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16977 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16986 /* add playback controls for speaker and HP outputs */
16987 /* Based on ALC880 version. But ALC861VD has separate,
16988 * different NIDs for mute/unmute switch and volume control */
16989 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16990 hda_nid_t pin, const char *pfx)
16992 hda_nid_t nid_v, nid_s;
16998 if (alc880_is_fixed_pin(pin)) {
16999 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17000 /* specify the DAC as the extra output */
17001 if (!spec->multiout.hp_nid)
17002 spec->multiout.hp_nid = nid_v;
17004 spec->multiout.extra_out_nid[0] = nid_v;
17005 /* control HP volume/switch on the output mixer amp */
17006 nid_v = alc861vd_idx_to_mixer_vol(
17007 alc880_fixed_pin_idx(pin));
17008 nid_s = alc861vd_idx_to_mixer_switch(
17009 alc880_fixed_pin_idx(pin));
17011 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17012 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17015 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17016 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17019 } else if (alc880_is_multi_pin(pin)) {
17020 /* set manual connection */
17021 /* we have only a switch on HP-out PIN */
17022 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17023 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17030 /* parse the BIOS configuration and set up the alc_spec
17031 * return 1 if successful, 0 if the proper config is not found,
17032 * or a negative error code
17033 * Based on ALC880 version - had to change it to override
17034 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17035 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17037 struct alc_spec *spec = codec->spec;
17039 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17041 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17045 if (!spec->autocfg.line_outs)
17046 return 0; /* can't find valid BIOS pin config */
17048 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17051 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17054 err = alc861vd_auto_create_extra_out(spec,
17055 spec->autocfg.speaker_pins[0],
17059 err = alc861vd_auto_create_extra_out(spec,
17060 spec->autocfg.hp_pins[0],
17064 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17068 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17070 alc_auto_parse_digital(codec);
17072 if (spec->kctls.list)
17073 add_mixer(spec, spec->kctls.list);
17075 add_verb(spec, alc861vd_volume_init_verbs);
17077 spec->num_mux_defs = 1;
17078 spec->input_mux = &spec->private_imux[0];
17080 err = alc_auto_add_mic_boost(codec);
17084 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17089 /* additional initialization for auto-configuration model */
17090 static void alc861vd_auto_init(struct hda_codec *codec)
17092 struct alc_spec *spec = codec->spec;
17093 alc861vd_auto_init_multi_out(codec);
17094 alc861vd_auto_init_hp_out(codec);
17095 alc861vd_auto_init_analog_input(codec);
17096 alc861vd_auto_init_input_src(codec);
17097 alc_auto_init_digital(codec);
17098 if (spec->unsol_event)
17099 alc_inithook(codec);
17103 ALC660VD_FIX_ASUS_GPIO1
17107 static const struct alc_fixup alc861vd_fixups[] = {
17108 [ALC660VD_FIX_ASUS_GPIO1] = {
17109 .verbs = (const struct hda_verb[]) {
17110 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17111 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17112 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17118 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17119 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17123 static int patch_alc861vd(struct hda_codec *codec)
17125 struct alc_spec *spec;
17126 int err, board_config;
17128 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17132 codec->spec = spec;
17134 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17138 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17139 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17141 board_config = ALC861VD_AUTO;
17144 if (board_config == ALC861VD_AUTO)
17145 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
17147 if (board_config == ALC861VD_AUTO) {
17148 /* automatic parse from the BIOS config */
17149 err = alc861vd_parse_auto_config(codec);
17155 "hda_codec: Cannot set up configuration "
17156 "from BIOS. Using base mode...\n");
17157 board_config = ALC861VD_3ST;
17161 err = snd_hda_attach_beep_device(codec, 0x23);
17167 if (board_config != ALC861VD_AUTO)
17168 setup_preset(codec, &alc861vd_presets[board_config]);
17170 if (codec->vendor_id == 0x10ec0660) {
17171 /* always turn on EAPD */
17172 add_verb(spec, alc660vd_eapd_verbs);
17175 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17176 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17178 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17179 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17181 if (!spec->adc_nids) {
17182 spec->adc_nids = alc861vd_adc_nids;
17183 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17185 if (!spec->capsrc_nids)
17186 spec->capsrc_nids = alc861vd_capsrc_nids;
17188 set_capture_mixer(codec);
17189 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17191 spec->vmaster_nid = 0x02;
17193 if (board_config == ALC861VD_AUTO)
17194 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
17196 codec->patch_ops = alc_patch_ops;
17198 if (board_config == ALC861VD_AUTO)
17199 spec->init_hook = alc861vd_auto_init;
17200 #ifdef CONFIG_SND_HDA_POWER_SAVE
17201 if (!spec->loopback.amplist)
17202 spec->loopback.amplist = alc861vd_loopbacks;
17211 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17212 * configuration. Each pin widget can choose any input DACs and a mixer.
17213 * Each ADC is connected from a mixer of all inputs. This makes possible
17214 * 6-channel independent captures.
17216 * In addition, an independent DAC for the multi-playback (not used in this
17219 #define ALC662_DIGOUT_NID 0x06
17220 #define ALC662_DIGIN_NID 0x0a
17222 static hda_nid_t alc662_dac_nids[4] = {
17223 /* front, rear, clfe, rear_surr */
17227 static hda_nid_t alc272_dac_nids[2] = {
17231 static hda_nid_t alc662_adc_nids[2] = {
17236 static hda_nid_t alc272_adc_nids[1] = {
17241 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17242 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17246 /* FIXME: should be a matrix-type input source selection */
17247 static struct hda_input_mux alc662_capture_source = {
17251 { "Front Mic", 0x1 },
17257 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17265 static struct hda_input_mux alc663_capture_source = {
17269 { "Front Mic", 0x1 },
17274 #if 0 /* set to 1 for testing other input sources below */
17275 static struct hda_input_mux alc272_nc10_capture_source = {
17278 { "Autoselect Mic", 0x0 },
17279 { "Internal Mic", 0x1 },
17280 { "In-0x02", 0x2 },
17281 { "In-0x03", 0x3 },
17282 { "In-0x04", 0x4 },
17283 { "In-0x05", 0x5 },
17284 { "In-0x06", 0x6 },
17285 { "In-0x07", 0x7 },
17286 { "In-0x08", 0x8 },
17287 { "In-0x09", 0x9 },
17288 { "In-0x0a", 0x0a },
17289 { "In-0x0b", 0x0b },
17290 { "In-0x0c", 0x0c },
17291 { "In-0x0d", 0x0d },
17292 { "In-0x0e", 0x0e },
17293 { "In-0x0f", 0x0f },
17301 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17308 static struct hda_verb alc662_3ST_ch2_init[] = {
17309 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17310 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17311 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17312 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17319 static struct hda_verb alc662_3ST_ch6_init[] = {
17320 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17321 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17322 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17323 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17324 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17325 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17329 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17330 { 2, alc662_3ST_ch2_init },
17331 { 6, alc662_3ST_ch6_init },
17337 static struct hda_verb alc662_sixstack_ch6_init[] = {
17338 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17339 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17340 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17347 static struct hda_verb alc662_sixstack_ch8_init[] = {
17348 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17349 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17350 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17354 static struct hda_channel_mode alc662_5stack_modes[2] = {
17355 { 2, alc662_sixstack_ch6_init },
17356 { 6, alc662_sixstack_ch8_init },
17359 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17360 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17363 static struct snd_kcontrol_new alc662_base_mixer[] = {
17364 /* output mixer control */
17365 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17366 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17367 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17368 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17369 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17370 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17371 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17372 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17375 /*Input mixer control */
17376 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17377 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17378 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17379 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17380 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17381 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17382 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17383 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17387 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17388 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17389 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17390 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17391 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17392 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17393 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17394 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17395 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17396 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17397 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17398 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17402 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17403 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17404 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17405 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17406 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17407 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17408 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17409 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17410 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17411 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17412 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17413 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17414 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17415 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17416 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17417 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17418 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17419 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17423 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17424 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17425 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17426 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17427 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17428 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17429 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17430 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17431 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17432 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17436 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17437 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17438 ALC262_HIPPO_MASTER_SWITCH,
17440 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
17441 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17442 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17444 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17445 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17446 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17450 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17451 ALC262_HIPPO_MASTER_SWITCH,
17452 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17453 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17454 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17455 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17456 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17457 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17458 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17460 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17464 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17465 .ops = &snd_hda_bind_vol,
17467 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17468 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17473 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17474 .ops = &snd_hda_bind_sw,
17476 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17477 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17482 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17483 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17484 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17486 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17490 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17491 .ops = &snd_hda_bind_sw,
17493 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17494 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17495 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17500 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17501 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17502 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17503 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17504 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17505 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17506 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17511 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17512 .ops = &snd_hda_bind_sw,
17514 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17515 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17516 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17521 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17522 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17523 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17525 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17526 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17527 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17531 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17532 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17533 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17534 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17535 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17536 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17537 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17538 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17542 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17543 .ops = &snd_hda_bind_vol,
17545 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17546 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17551 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17552 .ops = &snd_hda_bind_sw,
17554 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17555 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17560 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17561 HDA_BIND_VOL("Master Playback Volume",
17562 &alc663_asus_two_bind_master_vol),
17563 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17564 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17565 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17566 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17567 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17571 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17572 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17573 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17574 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17575 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17576 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17577 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17581 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17582 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17583 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17584 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17585 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17586 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17588 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17589 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17590 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17591 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17595 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17596 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17597 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17598 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17600 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17601 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17602 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17603 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17604 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17605 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17609 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17610 .ops = &snd_hda_bind_sw,
17612 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17613 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17614 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17615 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17616 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17621 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17622 .ops = &snd_hda_bind_sw,
17624 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17625 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17630 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17631 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17632 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17633 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17634 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17635 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17636 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17637 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17639 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17643 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17644 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17645 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17646 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17647 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17648 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17649 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17650 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17655 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17657 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17658 .name = "Channel Mode",
17659 .info = alc_ch_mode_info,
17660 .get = alc_ch_mode_get,
17661 .put = alc_ch_mode_put,
17666 static struct hda_verb alc662_init_verbs[] = {
17667 /* ADC: mute amp left and right */
17668 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17669 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17671 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17672 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17673 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17674 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17675 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17676 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17678 /* Front Pin: output 0 (0x0c) */
17679 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17680 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17682 /* Rear Pin: output 1 (0x0d) */
17683 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17684 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17686 /* CLFE Pin: output 2 (0x0e) */
17687 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17688 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17690 /* Mic (rear) pin: input vref at 80% */
17691 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17692 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17693 /* Front Mic pin: input vref at 80% */
17694 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17695 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17696 /* Line In pin: input */
17697 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17698 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17699 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17700 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17701 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17702 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17703 /* CD pin widget for input */
17704 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17706 /* FIXME: use matrix-type input source selection */
17707 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17710 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17712 /* always trun on EAPD */
17713 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17714 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17719 static struct hda_verb alc663_init_verbs[] = {
17720 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17721 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17722 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17723 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17724 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17725 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17729 static struct hda_verb alc272_init_verbs[] = {
17730 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17731 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17732 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17733 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17734 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17735 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17736 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17737 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17741 static struct hda_verb alc662_sue_init_verbs[] = {
17742 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17743 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17747 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17748 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17749 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17753 /* Set Unsolicited Event*/
17754 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17756 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17760 static struct hda_verb alc663_m51va_init_verbs[] = {
17761 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17762 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17763 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17764 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17765 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17766 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17767 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17768 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17769 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17773 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17774 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17775 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17776 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17779 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17780 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17784 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17785 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17786 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17787 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17788 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17789 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17791 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17792 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17796 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17797 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17798 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17799 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17800 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17801 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17802 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17803 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17807 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17808 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17809 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17810 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17811 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17814 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17815 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17816 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17817 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17818 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17819 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17823 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17824 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17825 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17826 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17827 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17828 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17829 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17830 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17831 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17832 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17833 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17834 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17835 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17839 static struct hda_verb alc663_g71v_init_verbs[] = {
17840 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17841 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17842 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17844 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17845 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17846 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17848 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17849 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17850 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17854 static struct hda_verb alc663_g50v_init_verbs[] = {
17855 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17856 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17857 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17859 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17860 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17864 static struct hda_verb alc662_ecs_init_verbs[] = {
17865 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17866 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17867 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17868 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17872 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17873 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17874 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17875 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17876 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17877 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17878 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17879 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17880 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17881 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17882 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17883 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17887 static struct hda_verb alc272_dell_init_verbs[] = {
17888 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17889 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17890 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17891 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17892 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17893 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17894 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17895 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17896 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17897 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17898 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17902 static struct hda_verb alc663_mode7_init_verbs[] = {
17903 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17904 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17905 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17906 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17907 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17908 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17909 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17910 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17911 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17912 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17913 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17914 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17915 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17916 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17917 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17921 static struct hda_verb alc663_mode8_init_verbs[] = {
17922 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17923 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17924 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17925 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17926 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17927 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17928 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17929 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17930 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17931 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17932 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17934 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17935 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17936 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17937 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17941 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17942 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17943 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17947 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17948 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17949 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17953 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17955 unsigned int present;
17956 unsigned char bits;
17958 present = snd_hda_jack_detect(codec, 0x14);
17959 bits = present ? HDA_AMP_MUTE : 0;
17961 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17962 HDA_AMP_MUTE, bits);
17965 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17967 unsigned int present;
17968 unsigned char bits;
17970 present = snd_hda_jack_detect(codec, 0x1b);
17971 bits = present ? HDA_AMP_MUTE : 0;
17973 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17974 HDA_AMP_MUTE, bits);
17975 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17976 HDA_AMP_MUTE, bits);
17979 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17982 if ((res >> 26) == ALC880_HP_EVENT)
17983 alc662_lenovo_101e_all_automute(codec);
17984 if ((res >> 26) == ALC880_FRONT_EVENT)
17985 alc662_lenovo_101e_ispeaker_automute(codec);
17988 /* unsolicited event for HP jack sensing */
17989 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17992 if ((res >> 26) == ALC880_MIC_EVENT)
17993 alc_mic_automute(codec);
17995 alc262_hippo_unsol_event(codec, res);
17998 static void alc662_eeepc_setup(struct hda_codec *codec)
18000 struct alc_spec *spec = codec->spec;
18002 alc262_hippo1_setup(codec);
18003 spec->ext_mic.pin = 0x18;
18004 spec->ext_mic.mux_idx = 0;
18005 spec->int_mic.pin = 0x19;
18006 spec->int_mic.mux_idx = 1;
18007 spec->auto_mic = 1;
18010 static void alc662_eeepc_inithook(struct hda_codec *codec)
18012 alc262_hippo_automute(codec);
18013 alc_mic_automute(codec);
18016 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18018 struct alc_spec *spec = codec->spec;
18020 spec->autocfg.hp_pins[0] = 0x14;
18021 spec->autocfg.speaker_pins[0] = 0x1b;
18024 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18026 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18028 unsigned int present;
18029 unsigned char bits;
18031 present = snd_hda_jack_detect(codec, 0x21);
18032 bits = present ? HDA_AMP_MUTE : 0;
18033 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18034 HDA_AMP_MUTE, bits);
18035 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18036 HDA_AMP_MUTE, bits);
18039 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18041 unsigned int present;
18042 unsigned char bits;
18044 present = snd_hda_jack_detect(codec, 0x21);
18045 bits = present ? HDA_AMP_MUTE : 0;
18046 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18047 HDA_AMP_MUTE, bits);
18048 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18049 HDA_AMP_MUTE, bits);
18050 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18051 HDA_AMP_MUTE, bits);
18052 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18053 HDA_AMP_MUTE, bits);
18056 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18058 unsigned int present;
18059 unsigned char bits;
18061 present = snd_hda_jack_detect(codec, 0x15);
18062 bits = present ? HDA_AMP_MUTE : 0;
18063 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18064 HDA_AMP_MUTE, bits);
18065 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18066 HDA_AMP_MUTE, bits);
18067 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18068 HDA_AMP_MUTE, bits);
18069 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18070 HDA_AMP_MUTE, bits);
18073 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18075 unsigned int present;
18076 unsigned char bits;
18078 present = snd_hda_jack_detect(codec, 0x1b);
18079 bits = present ? 0 : PIN_OUT;
18080 snd_hda_codec_write(codec, 0x14, 0,
18081 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18084 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18086 unsigned int present1, present2;
18088 present1 = snd_hda_jack_detect(codec, 0x21);
18089 present2 = snd_hda_jack_detect(codec, 0x15);
18091 if (present1 || present2) {
18092 snd_hda_codec_write_cache(codec, 0x14, 0,
18093 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18095 snd_hda_codec_write_cache(codec, 0x14, 0,
18096 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18100 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18102 unsigned int present1, present2;
18104 present1 = snd_hda_jack_detect(codec, 0x1b);
18105 present2 = snd_hda_jack_detect(codec, 0x15);
18107 if (present1 || present2) {
18108 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18109 HDA_AMP_MUTE, HDA_AMP_MUTE);
18110 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18111 HDA_AMP_MUTE, HDA_AMP_MUTE);
18113 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18115 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18120 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18122 unsigned int present1, present2;
18124 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18125 AC_VERB_GET_PIN_SENSE, 0)
18126 & AC_PINSENSE_PRESENCE;
18127 present2 = snd_hda_codec_read(codec, 0x21, 0,
18128 AC_VERB_GET_PIN_SENSE, 0)
18129 & AC_PINSENSE_PRESENCE;
18131 if (present1 || present2) {
18132 snd_hda_codec_write_cache(codec, 0x14, 0,
18133 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18134 snd_hda_codec_write_cache(codec, 0x17, 0,
18135 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18137 snd_hda_codec_write_cache(codec, 0x14, 0,
18138 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18139 snd_hda_codec_write_cache(codec, 0x17, 0,
18140 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18144 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18146 unsigned int present1, present2;
18148 present1 = snd_hda_codec_read(codec, 0x21, 0,
18149 AC_VERB_GET_PIN_SENSE, 0)
18150 & AC_PINSENSE_PRESENCE;
18151 present2 = snd_hda_codec_read(codec, 0x15, 0,
18152 AC_VERB_GET_PIN_SENSE, 0)
18153 & AC_PINSENSE_PRESENCE;
18155 if (present1 || present2) {
18156 snd_hda_codec_write_cache(codec, 0x14, 0,
18157 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18158 snd_hda_codec_write_cache(codec, 0x17, 0,
18159 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18161 snd_hda_codec_write_cache(codec, 0x14, 0,
18162 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18163 snd_hda_codec_write_cache(codec, 0x17, 0,
18164 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18168 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18171 switch (res >> 26) {
18172 case ALC880_HP_EVENT:
18173 alc663_m51va_speaker_automute(codec);
18175 case ALC880_MIC_EVENT:
18176 alc_mic_automute(codec);
18181 static void alc663_m51va_setup(struct hda_codec *codec)
18183 struct alc_spec *spec = codec->spec;
18184 spec->ext_mic.pin = 0x18;
18185 spec->ext_mic.mux_idx = 0;
18186 spec->int_mic.pin = 0x12;
18187 spec->int_mic.mux_idx = 9;
18188 spec->auto_mic = 1;
18191 static void alc663_m51va_inithook(struct hda_codec *codec)
18193 alc663_m51va_speaker_automute(codec);
18194 alc_mic_automute(codec);
18197 /* ***************** Mode1 ******************************/
18198 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18200 static void alc663_mode1_setup(struct hda_codec *codec)
18202 struct alc_spec *spec = codec->spec;
18203 spec->ext_mic.pin = 0x18;
18204 spec->ext_mic.mux_idx = 0;
18205 spec->int_mic.pin = 0x19;
18206 spec->int_mic.mux_idx = 1;
18207 spec->auto_mic = 1;
18210 #define alc663_mode1_inithook alc663_m51va_inithook
18212 /* ***************** Mode2 ******************************/
18213 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18216 switch (res >> 26) {
18217 case ALC880_HP_EVENT:
18218 alc662_f5z_speaker_automute(codec);
18220 case ALC880_MIC_EVENT:
18221 alc_mic_automute(codec);
18226 #define alc662_mode2_setup alc663_mode1_setup
18228 static void alc662_mode2_inithook(struct hda_codec *codec)
18230 alc662_f5z_speaker_automute(codec);
18231 alc_mic_automute(codec);
18233 /* ***************** Mode3 ******************************/
18234 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18237 switch (res >> 26) {
18238 case ALC880_HP_EVENT:
18239 alc663_two_hp_m1_speaker_automute(codec);
18241 case ALC880_MIC_EVENT:
18242 alc_mic_automute(codec);
18247 #define alc663_mode3_setup alc663_mode1_setup
18249 static void alc663_mode3_inithook(struct hda_codec *codec)
18251 alc663_two_hp_m1_speaker_automute(codec);
18252 alc_mic_automute(codec);
18254 /* ***************** Mode4 ******************************/
18255 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18258 switch (res >> 26) {
18259 case ALC880_HP_EVENT:
18260 alc663_21jd_two_speaker_automute(codec);
18262 case ALC880_MIC_EVENT:
18263 alc_mic_automute(codec);
18268 #define alc663_mode4_setup alc663_mode1_setup
18270 static void alc663_mode4_inithook(struct hda_codec *codec)
18272 alc663_21jd_two_speaker_automute(codec);
18273 alc_mic_automute(codec);
18275 /* ***************** Mode5 ******************************/
18276 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18279 switch (res >> 26) {
18280 case ALC880_HP_EVENT:
18281 alc663_15jd_two_speaker_automute(codec);
18283 case ALC880_MIC_EVENT:
18284 alc_mic_automute(codec);
18289 #define alc663_mode5_setup alc663_mode1_setup
18291 static void alc663_mode5_inithook(struct hda_codec *codec)
18293 alc663_15jd_two_speaker_automute(codec);
18294 alc_mic_automute(codec);
18296 /* ***************** Mode6 ******************************/
18297 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18300 switch (res >> 26) {
18301 case ALC880_HP_EVENT:
18302 alc663_two_hp_m2_speaker_automute(codec);
18304 case ALC880_MIC_EVENT:
18305 alc_mic_automute(codec);
18310 #define alc663_mode6_setup alc663_mode1_setup
18312 static void alc663_mode6_inithook(struct hda_codec *codec)
18314 alc663_two_hp_m2_speaker_automute(codec);
18315 alc_mic_automute(codec);
18318 /* ***************** Mode7 ******************************/
18319 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18322 switch (res >> 26) {
18323 case ALC880_HP_EVENT:
18324 alc663_two_hp_m7_speaker_automute(codec);
18326 case ALC880_MIC_EVENT:
18327 alc_mic_automute(codec);
18332 #define alc663_mode7_setup alc663_mode1_setup
18334 static void alc663_mode7_inithook(struct hda_codec *codec)
18336 alc663_two_hp_m7_speaker_automute(codec);
18337 alc_mic_automute(codec);
18340 /* ***************** Mode8 ******************************/
18341 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18344 switch (res >> 26) {
18345 case ALC880_HP_EVENT:
18346 alc663_two_hp_m8_speaker_automute(codec);
18348 case ALC880_MIC_EVENT:
18349 alc_mic_automute(codec);
18354 #define alc663_mode8_setup alc663_m51va_setup
18356 static void alc663_mode8_inithook(struct hda_codec *codec)
18358 alc663_two_hp_m8_speaker_automute(codec);
18359 alc_mic_automute(codec);
18362 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18364 unsigned int present;
18365 unsigned char bits;
18367 present = snd_hda_jack_detect(codec, 0x21);
18368 bits = present ? HDA_AMP_MUTE : 0;
18369 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18370 HDA_AMP_MUTE, bits);
18371 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18372 HDA_AMP_MUTE, bits);
18375 static void alc663_g71v_front_automute(struct hda_codec *codec)
18377 unsigned int present;
18378 unsigned char bits;
18380 present = snd_hda_jack_detect(codec, 0x15);
18381 bits = present ? HDA_AMP_MUTE : 0;
18382 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18383 HDA_AMP_MUTE, bits);
18386 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18389 switch (res >> 26) {
18390 case ALC880_HP_EVENT:
18391 alc663_g71v_hp_automute(codec);
18393 case ALC880_FRONT_EVENT:
18394 alc663_g71v_front_automute(codec);
18396 case ALC880_MIC_EVENT:
18397 alc_mic_automute(codec);
18402 #define alc663_g71v_setup alc663_m51va_setup
18404 static void alc663_g71v_inithook(struct hda_codec *codec)
18406 alc663_g71v_front_automute(codec);
18407 alc663_g71v_hp_automute(codec);
18408 alc_mic_automute(codec);
18411 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18414 switch (res >> 26) {
18415 case ALC880_HP_EVENT:
18416 alc663_m51va_speaker_automute(codec);
18418 case ALC880_MIC_EVENT:
18419 alc_mic_automute(codec);
18424 #define alc663_g50v_setup alc663_m51va_setup
18426 static void alc663_g50v_inithook(struct hda_codec *codec)
18428 alc663_m51va_speaker_automute(codec);
18429 alc_mic_automute(codec);
18432 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18433 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18434 ALC262_HIPPO_MASTER_SWITCH,
18436 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
18437 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18438 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18440 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
18441 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18442 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18446 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18447 /* Master Playback automatically created from Speaker and Headphone */
18448 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18449 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18450 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18451 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18453 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18454 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18455 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
18457 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18458 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18459 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
18463 #ifdef CONFIG_SND_HDA_POWER_SAVE
18464 #define alc662_loopbacks alc880_loopbacks
18468 /* pcm configuration: identical with ALC880 */
18469 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18470 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18471 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18472 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18475 * configuration and preset
18477 static const char *alc662_models[ALC662_MODEL_LAST] = {
18478 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18479 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18480 [ALC662_3ST_6ch] = "3stack-6ch",
18481 [ALC662_5ST_DIG] = "6stack-dig",
18482 [ALC662_LENOVO_101E] = "lenovo-101e",
18483 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18484 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18485 [ALC662_ECS] = "ecs",
18486 [ALC663_ASUS_M51VA] = "m51va",
18487 [ALC663_ASUS_G71V] = "g71v",
18488 [ALC663_ASUS_H13] = "h13",
18489 [ALC663_ASUS_G50V] = "g50v",
18490 [ALC663_ASUS_MODE1] = "asus-mode1",
18491 [ALC662_ASUS_MODE2] = "asus-mode2",
18492 [ALC663_ASUS_MODE3] = "asus-mode3",
18493 [ALC663_ASUS_MODE4] = "asus-mode4",
18494 [ALC663_ASUS_MODE5] = "asus-mode5",
18495 [ALC663_ASUS_MODE6] = "asus-mode6",
18496 [ALC663_ASUS_MODE7] = "asus-mode7",
18497 [ALC663_ASUS_MODE8] = "asus-mode8",
18498 [ALC272_DELL] = "dell",
18499 [ALC272_DELL_ZM1] = "dell-zm1",
18500 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18501 [ALC662_AUTO] = "auto",
18504 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18505 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18506 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18507 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18508 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18509 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18510 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18511 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18512 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18513 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18514 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18515 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18516 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18517 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18518 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18519 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18520 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18521 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18522 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18523 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18524 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18525 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18526 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18527 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18528 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18529 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18530 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18531 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18532 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18533 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18534 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18535 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18536 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18537 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18538 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18539 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18540 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18541 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18542 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18543 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18544 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18545 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18546 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18547 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18548 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18549 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18550 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18551 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18552 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18553 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18554 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18555 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18556 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18557 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18558 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18559 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18560 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18561 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18562 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18563 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18564 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18565 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18566 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18567 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18568 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18569 ALC662_3ST_6ch_DIG),
18570 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18571 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18572 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18573 ALC662_3ST_6ch_DIG),
18574 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18575 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18576 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18577 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18578 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18579 ALC662_3ST_6ch_DIG),
18580 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18585 static struct alc_config_preset alc662_presets[] = {
18586 [ALC662_3ST_2ch_DIG] = {
18587 .mixers = { alc662_3ST_2ch_mixer },
18588 .init_verbs = { alc662_init_verbs },
18589 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18590 .dac_nids = alc662_dac_nids,
18591 .dig_out_nid = ALC662_DIGOUT_NID,
18592 .dig_in_nid = ALC662_DIGIN_NID,
18593 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18594 .channel_mode = alc662_3ST_2ch_modes,
18595 .input_mux = &alc662_capture_source,
18597 [ALC662_3ST_6ch_DIG] = {
18598 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18599 .init_verbs = { alc662_init_verbs },
18600 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18601 .dac_nids = alc662_dac_nids,
18602 .dig_out_nid = ALC662_DIGOUT_NID,
18603 .dig_in_nid = ALC662_DIGIN_NID,
18604 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18605 .channel_mode = alc662_3ST_6ch_modes,
18607 .input_mux = &alc662_capture_source,
18609 [ALC662_3ST_6ch] = {
18610 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18611 .init_verbs = { alc662_init_verbs },
18612 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18613 .dac_nids = alc662_dac_nids,
18614 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18615 .channel_mode = alc662_3ST_6ch_modes,
18617 .input_mux = &alc662_capture_source,
18619 [ALC662_5ST_DIG] = {
18620 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18621 .init_verbs = { alc662_init_verbs },
18622 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18623 .dac_nids = alc662_dac_nids,
18624 .dig_out_nid = ALC662_DIGOUT_NID,
18625 .dig_in_nid = ALC662_DIGIN_NID,
18626 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18627 .channel_mode = alc662_5stack_modes,
18628 .input_mux = &alc662_capture_source,
18630 [ALC662_LENOVO_101E] = {
18631 .mixers = { alc662_lenovo_101e_mixer },
18632 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18633 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18634 .dac_nids = alc662_dac_nids,
18635 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18636 .channel_mode = alc662_3ST_2ch_modes,
18637 .input_mux = &alc662_lenovo_101e_capture_source,
18638 .unsol_event = alc662_lenovo_101e_unsol_event,
18639 .init_hook = alc662_lenovo_101e_all_automute,
18641 [ALC662_ASUS_EEEPC_P701] = {
18642 .mixers = { alc662_eeepc_p701_mixer },
18643 .init_verbs = { alc662_init_verbs,
18644 alc662_eeepc_sue_init_verbs },
18645 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18646 .dac_nids = alc662_dac_nids,
18647 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18648 .channel_mode = alc662_3ST_2ch_modes,
18649 .unsol_event = alc662_eeepc_unsol_event,
18650 .setup = alc662_eeepc_setup,
18651 .init_hook = alc662_eeepc_inithook,
18653 [ALC662_ASUS_EEEPC_EP20] = {
18654 .mixers = { alc662_eeepc_ep20_mixer,
18655 alc662_chmode_mixer },
18656 .init_verbs = { alc662_init_verbs,
18657 alc662_eeepc_ep20_sue_init_verbs },
18658 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18659 .dac_nids = alc662_dac_nids,
18660 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18661 .channel_mode = alc662_3ST_6ch_modes,
18662 .input_mux = &alc662_lenovo_101e_capture_source,
18663 .unsol_event = alc662_eeepc_unsol_event,
18664 .setup = alc662_eeepc_ep20_setup,
18665 .init_hook = alc662_eeepc_ep20_inithook,
18668 .mixers = { alc662_ecs_mixer },
18669 .init_verbs = { alc662_init_verbs,
18670 alc662_ecs_init_verbs },
18671 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18672 .dac_nids = alc662_dac_nids,
18673 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18674 .channel_mode = alc662_3ST_2ch_modes,
18675 .unsol_event = alc662_eeepc_unsol_event,
18676 .setup = alc662_eeepc_setup,
18677 .init_hook = alc662_eeepc_inithook,
18679 [ALC663_ASUS_M51VA] = {
18680 .mixers = { alc663_m51va_mixer },
18681 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18682 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18683 .dac_nids = alc662_dac_nids,
18684 .dig_out_nid = ALC662_DIGOUT_NID,
18685 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18686 .channel_mode = alc662_3ST_2ch_modes,
18687 .unsol_event = alc663_m51va_unsol_event,
18688 .setup = alc663_m51va_setup,
18689 .init_hook = alc663_m51va_inithook,
18691 [ALC663_ASUS_G71V] = {
18692 .mixers = { alc663_g71v_mixer },
18693 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18694 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18695 .dac_nids = alc662_dac_nids,
18696 .dig_out_nid = ALC662_DIGOUT_NID,
18697 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18698 .channel_mode = alc662_3ST_2ch_modes,
18699 .unsol_event = alc663_g71v_unsol_event,
18700 .setup = alc663_g71v_setup,
18701 .init_hook = alc663_g71v_inithook,
18703 [ALC663_ASUS_H13] = {
18704 .mixers = { alc663_m51va_mixer },
18705 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18706 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18707 .dac_nids = alc662_dac_nids,
18708 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18709 .channel_mode = alc662_3ST_2ch_modes,
18710 .unsol_event = alc663_m51va_unsol_event,
18711 .init_hook = alc663_m51va_inithook,
18713 [ALC663_ASUS_G50V] = {
18714 .mixers = { alc663_g50v_mixer },
18715 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18716 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18717 .dac_nids = alc662_dac_nids,
18718 .dig_out_nid = ALC662_DIGOUT_NID,
18719 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18720 .channel_mode = alc662_3ST_6ch_modes,
18721 .input_mux = &alc663_capture_source,
18722 .unsol_event = alc663_g50v_unsol_event,
18723 .setup = alc663_g50v_setup,
18724 .init_hook = alc663_g50v_inithook,
18726 [ALC663_ASUS_MODE1] = {
18727 .mixers = { alc663_m51va_mixer },
18728 .cap_mixer = alc662_auto_capture_mixer,
18729 .init_verbs = { alc662_init_verbs,
18730 alc663_21jd_amic_init_verbs },
18731 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18733 .dac_nids = alc662_dac_nids,
18734 .dig_out_nid = ALC662_DIGOUT_NID,
18735 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18736 .channel_mode = alc662_3ST_2ch_modes,
18737 .unsol_event = alc663_mode1_unsol_event,
18738 .setup = alc663_mode1_setup,
18739 .init_hook = alc663_mode1_inithook,
18741 [ALC662_ASUS_MODE2] = {
18742 .mixers = { alc662_1bjd_mixer },
18743 .cap_mixer = alc662_auto_capture_mixer,
18744 .init_verbs = { alc662_init_verbs,
18745 alc662_1bjd_amic_init_verbs },
18746 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18747 .dac_nids = alc662_dac_nids,
18748 .dig_out_nid = ALC662_DIGOUT_NID,
18749 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18750 .channel_mode = alc662_3ST_2ch_modes,
18751 .unsol_event = alc662_mode2_unsol_event,
18752 .setup = alc662_mode2_setup,
18753 .init_hook = alc662_mode2_inithook,
18755 [ALC663_ASUS_MODE3] = {
18756 .mixers = { alc663_two_hp_m1_mixer },
18757 .cap_mixer = alc662_auto_capture_mixer,
18758 .init_verbs = { alc662_init_verbs,
18759 alc663_two_hp_amic_m1_init_verbs },
18760 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18762 .dac_nids = alc662_dac_nids,
18763 .dig_out_nid = ALC662_DIGOUT_NID,
18764 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18765 .channel_mode = alc662_3ST_2ch_modes,
18766 .unsol_event = alc663_mode3_unsol_event,
18767 .setup = alc663_mode3_setup,
18768 .init_hook = alc663_mode3_inithook,
18770 [ALC663_ASUS_MODE4] = {
18771 .mixers = { alc663_asus_21jd_clfe_mixer },
18772 .cap_mixer = alc662_auto_capture_mixer,
18773 .init_verbs = { alc662_init_verbs,
18774 alc663_21jd_amic_init_verbs},
18775 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18777 .dac_nids = alc662_dac_nids,
18778 .dig_out_nid = ALC662_DIGOUT_NID,
18779 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18780 .channel_mode = alc662_3ST_2ch_modes,
18781 .unsol_event = alc663_mode4_unsol_event,
18782 .setup = alc663_mode4_setup,
18783 .init_hook = alc663_mode4_inithook,
18785 [ALC663_ASUS_MODE5] = {
18786 .mixers = { alc663_asus_15jd_clfe_mixer },
18787 .cap_mixer = alc662_auto_capture_mixer,
18788 .init_verbs = { alc662_init_verbs,
18789 alc663_15jd_amic_init_verbs },
18790 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18792 .dac_nids = alc662_dac_nids,
18793 .dig_out_nid = ALC662_DIGOUT_NID,
18794 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18795 .channel_mode = alc662_3ST_2ch_modes,
18796 .unsol_event = alc663_mode5_unsol_event,
18797 .setup = alc663_mode5_setup,
18798 .init_hook = alc663_mode5_inithook,
18800 [ALC663_ASUS_MODE6] = {
18801 .mixers = { alc663_two_hp_m2_mixer },
18802 .cap_mixer = alc662_auto_capture_mixer,
18803 .init_verbs = { alc662_init_verbs,
18804 alc663_two_hp_amic_m2_init_verbs },
18805 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18807 .dac_nids = alc662_dac_nids,
18808 .dig_out_nid = ALC662_DIGOUT_NID,
18809 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18810 .channel_mode = alc662_3ST_2ch_modes,
18811 .unsol_event = alc663_mode6_unsol_event,
18812 .setup = alc663_mode6_setup,
18813 .init_hook = alc663_mode6_inithook,
18815 [ALC663_ASUS_MODE7] = {
18816 .mixers = { alc663_mode7_mixer },
18817 .cap_mixer = alc662_auto_capture_mixer,
18818 .init_verbs = { alc662_init_verbs,
18819 alc663_mode7_init_verbs },
18820 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18822 .dac_nids = alc662_dac_nids,
18823 .dig_out_nid = ALC662_DIGOUT_NID,
18824 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18825 .channel_mode = alc662_3ST_2ch_modes,
18826 .unsol_event = alc663_mode7_unsol_event,
18827 .setup = alc663_mode7_setup,
18828 .init_hook = alc663_mode7_inithook,
18830 [ALC663_ASUS_MODE8] = {
18831 .mixers = { alc663_mode8_mixer },
18832 .cap_mixer = alc662_auto_capture_mixer,
18833 .init_verbs = { alc662_init_verbs,
18834 alc663_mode8_init_verbs },
18835 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18837 .dac_nids = alc662_dac_nids,
18838 .dig_out_nid = ALC662_DIGOUT_NID,
18839 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18840 .channel_mode = alc662_3ST_2ch_modes,
18841 .unsol_event = alc663_mode8_unsol_event,
18842 .setup = alc663_mode8_setup,
18843 .init_hook = alc663_mode8_inithook,
18846 .mixers = { alc663_m51va_mixer },
18847 .cap_mixer = alc272_auto_capture_mixer,
18848 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18849 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18850 .dac_nids = alc662_dac_nids,
18851 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18852 .adc_nids = alc272_adc_nids,
18853 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18854 .capsrc_nids = alc272_capsrc_nids,
18855 .channel_mode = alc662_3ST_2ch_modes,
18856 .unsol_event = alc663_m51va_unsol_event,
18857 .setup = alc663_m51va_setup,
18858 .init_hook = alc663_m51va_inithook,
18860 [ALC272_DELL_ZM1] = {
18861 .mixers = { alc663_m51va_mixer },
18862 .cap_mixer = alc662_auto_capture_mixer,
18863 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18864 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18865 .dac_nids = alc662_dac_nids,
18866 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18867 .adc_nids = alc662_adc_nids,
18869 .capsrc_nids = alc662_capsrc_nids,
18870 .channel_mode = alc662_3ST_2ch_modes,
18871 .unsol_event = alc663_m51va_unsol_event,
18872 .setup = alc663_m51va_setup,
18873 .init_hook = alc663_m51va_inithook,
18875 [ALC272_SAMSUNG_NC10] = {
18876 .mixers = { alc272_nc10_mixer },
18877 .init_verbs = { alc662_init_verbs,
18878 alc663_21jd_amic_init_verbs },
18879 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18880 .dac_nids = alc272_dac_nids,
18881 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18882 .channel_mode = alc662_3ST_2ch_modes,
18883 /*.input_mux = &alc272_nc10_capture_source,*/
18884 .unsol_event = alc663_mode4_unsol_event,
18885 .setup = alc663_mode4_setup,
18886 .init_hook = alc663_mode4_inithook,
18892 * BIOS auto configuration
18895 /* convert from MIX nid to DAC */
18896 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18900 else if (nid >= 0x0c && nid <= 0x0e)
18901 return nid - 0x0c + 0x02;
18906 /* get MIX nid connected to the given pin targeted to DAC */
18907 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18913 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18914 for (i = 0; i < num; i++) {
18915 if (alc662_mix_to_dac(mix[i]) == dac)
18921 /* look for an empty DAC slot */
18922 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18924 struct alc_spec *spec = codec->spec;
18928 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18931 for (i = 0; i < num; i++) {
18932 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18935 for (j = 0; j < spec->multiout.num_dacs; j++)
18936 if (spec->multiout.dac_nids[j] == nid)
18938 if (j >= spec->multiout.num_dacs)
18944 /* fill in the dac_nids table from the parsed pin configuration */
18945 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18946 const struct auto_pin_cfg *cfg)
18948 struct alc_spec *spec = codec->spec;
18952 spec->multiout.dac_nids = spec->private_dac_nids;
18953 for (i = 0; i < cfg->line_outs; i++) {
18954 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18957 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18962 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18963 hda_nid_t nid, unsigned int chs)
18965 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18966 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18969 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18970 hda_nid_t nid, unsigned int chs)
18972 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18973 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18976 #define alc662_add_stereo_vol(spec, pfx, nid) \
18977 alc662_add_vol_ctl(spec, pfx, nid, 3)
18978 #define alc662_add_stereo_sw(spec, pfx, nid) \
18979 alc662_add_sw_ctl(spec, pfx, nid, 3)
18981 /* add playback controls from the parsed DAC table */
18982 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18983 const struct auto_pin_cfg *cfg)
18985 struct alc_spec *spec = codec->spec;
18986 static const char *chname[4] = {
18987 "Front", "Surround", NULL /*CLFE*/, "Side"
18989 hda_nid_t nid, mix;
18992 for (i = 0; i < cfg->line_outs; i++) {
18993 nid = spec->multiout.dac_nids[i];
18996 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19001 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19004 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19007 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19010 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19015 if (cfg->line_outs == 1 &&
19016 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
19023 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19026 if (cfg->line_outs == 1 &&
19027 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19029 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19037 /* add playback controls for speaker and HP outputs */
19038 /* return DAC nid if any new DAC is assigned */
19039 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19042 struct alc_spec *spec = codec->spec;
19043 hda_nid_t nid, mix;
19048 nid = alc662_look_for_dac(codec, pin);
19050 /* the corresponding DAC is already occupied */
19051 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19052 return 0; /* no way */
19053 /* create a switch only */
19054 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19055 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19058 mix = alc662_dac_to_mix(codec, pin, nid);
19061 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19064 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19070 /* create playback/capture controls for input pins */
19071 #define alc662_auto_create_input_ctls \
19072 alc882_auto_create_input_ctls
19074 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19075 hda_nid_t nid, int pin_type,
19079 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19081 alc_set_pin_output(codec, nid, pin_type);
19082 /* need the manual connection? */
19083 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19086 for (i = 0; i < num; i++) {
19087 if (alc662_mix_to_dac(srcs[i]) != dac)
19089 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19094 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19096 struct alc_spec *spec = codec->spec;
19097 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19100 for (i = 0; i <= HDA_SIDE; i++) {
19101 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19103 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19104 spec->multiout.dac_nids[i]);
19108 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19110 struct alc_spec *spec = codec->spec;
19113 pin = spec->autocfg.hp_pins[0];
19115 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19116 spec->multiout.hp_nid);
19117 pin = spec->autocfg.speaker_pins[0];
19119 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19120 spec->multiout.extra_out_nid[0]);
19123 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19125 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19127 struct alc_spec *spec = codec->spec;
19128 struct auto_pin_cfg *cfg = &spec->autocfg;
19131 for (i = 0; i < cfg->num_inputs; i++) {
19132 hda_nid_t nid = cfg->inputs[i].pin;
19133 if (alc_is_input_pin(codec, nid)) {
19134 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19135 if (nid != ALC662_PIN_CD_NID &&
19136 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19137 snd_hda_codec_write(codec, nid, 0,
19138 AC_VERB_SET_AMP_GAIN_MUTE,
19144 #define alc662_auto_init_input_src alc882_auto_init_input_src
19146 static int alc662_parse_auto_config(struct hda_codec *codec)
19148 struct alc_spec *spec = codec->spec;
19150 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19152 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19156 if (!spec->autocfg.line_outs)
19157 return 0; /* can't find valid BIOS pin config */
19159 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19162 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19165 err = alc662_auto_create_extra_out(codec,
19166 spec->autocfg.speaker_pins[0],
19171 spec->multiout.extra_out_nid[0] = err;
19172 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19177 spec->multiout.hp_nid = err;
19178 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19182 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19184 alc_auto_parse_digital(codec);
19186 if (spec->kctls.list)
19187 add_mixer(spec, spec->kctls.list);
19189 spec->num_mux_defs = 1;
19190 spec->input_mux = &spec->private_imux[0];
19192 add_verb(spec, alc662_init_verbs);
19193 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19194 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19195 add_verb(spec, alc663_init_verbs);
19197 if (codec->vendor_id == 0x10ec0272)
19198 add_verb(spec, alc272_init_verbs);
19200 err = alc_auto_add_mic_boost(codec);
19204 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19205 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19206 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19208 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19213 /* additional initialization for auto-configuration model */
19214 static void alc662_auto_init(struct hda_codec *codec)
19216 struct alc_spec *spec = codec->spec;
19217 alc662_auto_init_multi_out(codec);
19218 alc662_auto_init_hp_out(codec);
19219 alc662_auto_init_analog_input(codec);
19220 alc662_auto_init_input_src(codec);
19221 alc_auto_init_digital(codec);
19222 if (spec->unsol_event)
19223 alc_inithook(codec);
19227 ALC662_FIXUP_IDEAPAD,
19230 static const struct alc_fixup alc662_fixups[] = {
19231 [ALC662_FIXUP_IDEAPAD] = {
19232 .pins = (const struct alc_pincfg[]) {
19233 { 0x17, 0x99130112 }, /* subwoofer */
19239 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19240 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19246 static int patch_alc662(struct hda_codec *codec)
19248 struct alc_spec *spec;
19249 int err, board_config;
19251 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19255 codec->spec = spec;
19257 alc_auto_parse_customize_define(codec);
19259 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19261 if (alc_read_coef_idx(codec, 0) == 0x8020)
19262 alc_codec_rename(codec, "ALC661");
19263 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
19264 codec->bus->pci->subsystem_vendor == 0x1025 &&
19265 spec->cdefine.platform_type == 1)
19266 alc_codec_rename(codec, "ALC272X");
19268 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19271 if (board_config < 0) {
19272 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19274 board_config = ALC662_AUTO;
19277 if (board_config == ALC662_AUTO) {
19278 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1);
19279 /* automatic parse from the BIOS config */
19280 err = alc662_parse_auto_config(codec);
19286 "hda_codec: Cannot set up configuration "
19287 "from BIOS. Using base mode...\n");
19288 board_config = ALC662_3ST_2ch_DIG;
19292 if (has_cdefine_beep(codec)) {
19293 err = snd_hda_attach_beep_device(codec, 0x1);
19300 if (board_config != ALC662_AUTO)
19301 setup_preset(codec, &alc662_presets[board_config]);
19303 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19304 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19306 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19307 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19309 if (!spec->adc_nids) {
19310 spec->adc_nids = alc662_adc_nids;
19311 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19313 if (!spec->capsrc_nids)
19314 spec->capsrc_nids = alc662_capsrc_nids;
19316 if (!spec->cap_mixer)
19317 set_capture_mixer(codec);
19319 if (has_cdefine_beep(codec)) {
19320 switch (codec->vendor_id) {
19322 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19327 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19330 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19334 spec->vmaster_nid = 0x02;
19336 codec->patch_ops = alc_patch_ops;
19337 if (board_config == ALC662_AUTO) {
19338 spec->init_hook = alc662_auto_init;
19339 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0);
19342 #ifdef CONFIG_SND_HDA_POWER_SAVE
19343 if (!spec->loopback.amplist)
19344 spec->loopback.amplist = alc662_loopbacks;
19350 static int patch_alc888(struct hda_codec *codec)
19352 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19353 kfree(codec->chip_name);
19354 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19355 if (!codec->chip_name) {
19359 return patch_alc662(codec);
19361 return patch_alc882(codec);
19367 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19368 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19369 #define alc680_modes alc260_modes
19371 static hda_nid_t alc680_dac_nids[3] = {
19372 /* Lout1, Lout2, hp */
19376 static hda_nid_t alc680_adc_nids[3] = {
19378 /* DMIC, MIC, Line-in*/
19383 * Analog capture ADC cgange
19385 static void alc680_rec_autoswitch(struct hda_codec *codec)
19387 struct alc_spec *spec = codec->spec;
19388 struct auto_pin_cfg *cfg = &spec->autocfg;
19390 int type_found = AUTO_PIN_LAST;
19394 for (i = 0; i < cfg->num_inputs; i++) {
19395 nid = cfg->inputs[i].pin;
19396 if (!(snd_hda_query_pin_caps(codec, nid) &
19397 AC_PINCAP_PRES_DETECT))
19399 if (snd_hda_jack_detect(codec, nid)) {
19400 if (cfg->inputs[i].type < type_found) {
19401 type_found = cfg->inputs[i].type;
19409 snd_hda_get_connections(codec, pin_found, &nid, 1);
19411 if (nid != spec->cur_adc)
19412 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19413 spec->cur_adc = nid;
19414 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19415 spec->cur_adc_format);
19418 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19419 struct hda_codec *codec,
19420 unsigned int stream_tag,
19421 unsigned int format,
19422 struct snd_pcm_substream *substream)
19424 struct alc_spec *spec = codec->spec;
19426 spec->cur_adc = 0x07;
19427 spec->cur_adc_stream_tag = stream_tag;
19428 spec->cur_adc_format = format;
19430 alc680_rec_autoswitch(codec);
19434 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19435 struct hda_codec *codec,
19436 struct snd_pcm_substream *substream)
19438 snd_hda_codec_cleanup_stream(codec, 0x07);
19439 snd_hda_codec_cleanup_stream(codec, 0x08);
19440 snd_hda_codec_cleanup_stream(codec, 0x09);
19444 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19445 .substreams = 1, /* can be overridden */
19448 /* NID is set in alc_build_pcms */
19450 .prepare = alc680_capture_pcm_prepare,
19451 .cleanup = alc680_capture_pcm_cleanup
19455 static struct snd_kcontrol_new alc680_base_mixer[] = {
19456 /* output mixer control */
19457 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19458 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19459 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19460 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19461 HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT),
19462 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
19463 HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT),
19467 static struct hda_bind_ctls alc680_bind_cap_vol = {
19468 .ops = &snd_hda_bind_vol,
19470 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19471 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19472 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19477 static struct hda_bind_ctls alc680_bind_cap_switch = {
19478 .ops = &snd_hda_bind_sw,
19480 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19481 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19482 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19487 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19488 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19489 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19494 * generic initialization of ADC, input mixers and output mixers
19496 static struct hda_verb alc680_init_verbs[] = {
19497 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19498 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19499 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19501 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19502 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19504 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19505 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19506 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19509 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19510 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19511 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19512 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19514 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19515 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19516 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19521 /* toggle speaker-output according to the hp-jack state */
19522 static void alc680_base_setup(struct hda_codec *codec)
19524 struct alc_spec *spec = codec->spec;
19526 spec->autocfg.hp_pins[0] = 0x16;
19527 spec->autocfg.speaker_pins[0] = 0x14;
19528 spec->autocfg.speaker_pins[1] = 0x15;
19529 spec->autocfg.num_inputs = 2;
19530 spec->autocfg.inputs[0].pin = 0x18;
19531 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19532 spec->autocfg.inputs[1].pin = 0x19;
19533 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19536 static void alc680_unsol_event(struct hda_codec *codec,
19539 if ((res >> 26) == ALC880_HP_EVENT)
19540 alc_automute_amp(codec);
19541 if ((res >> 26) == ALC880_MIC_EVENT)
19542 alc680_rec_autoswitch(codec);
19545 static void alc680_inithook(struct hda_codec *codec)
19547 alc_automute_amp(codec);
19548 alc680_rec_autoswitch(codec);
19551 /* create input playback/capture controls for the given pin */
19552 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19553 const char *ctlname, int idx)
19571 if (spec->multiout.dac_nids[0] != dac &&
19572 spec->multiout.dac_nids[1] != dac) {
19573 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19574 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19579 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19580 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19584 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19590 /* add playback controls from the parsed DAC table */
19591 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19592 const struct auto_pin_cfg *cfg)
19597 spec->multiout.dac_nids = spec->private_dac_nids;
19599 nid = cfg->line_out_pins[0];
19602 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19606 err = alc680_new_analog_output(spec, nid, name, 0);
19611 nid = cfg->speaker_pins[0];
19613 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19617 nid = cfg->hp_pins[0];
19619 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19627 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19628 hda_nid_t nid, int pin_type)
19630 alc_set_pin_output(codec, nid, pin_type);
19633 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19635 struct alc_spec *spec = codec->spec;
19636 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19638 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19639 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19643 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19645 struct alc_spec *spec = codec->spec;
19648 pin = spec->autocfg.hp_pins[0];
19650 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19651 pin = spec->autocfg.speaker_pins[0];
19653 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19656 /* pcm configuration: identical with ALC880 */
19657 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19658 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19659 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19660 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19661 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19664 * BIOS auto configuration
19666 static int alc680_parse_auto_config(struct hda_codec *codec)
19668 struct alc_spec *spec = codec->spec;
19670 static hda_nid_t alc680_ignore[] = { 0 };
19672 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19677 if (!spec->autocfg.line_outs) {
19678 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19679 spec->multiout.max_channels = 2;
19680 spec->no_analog = 1;
19683 return 0; /* can't find valid BIOS pin config */
19685 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19689 spec->multiout.max_channels = 2;
19692 /* digital only support output */
19693 alc_auto_parse_digital(codec);
19694 if (spec->kctls.list)
19695 add_mixer(spec, spec->kctls.list);
19697 add_verb(spec, alc680_init_verbs);
19699 err = alc_auto_add_mic_boost(codec);
19706 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19708 /* init callback for auto-configuration model -- overriding the default init */
19709 static void alc680_auto_init(struct hda_codec *codec)
19711 struct alc_spec *spec = codec->spec;
19712 alc680_auto_init_multi_out(codec);
19713 alc680_auto_init_hp_out(codec);
19714 alc680_auto_init_analog_input(codec);
19715 alc_auto_init_digital(codec);
19716 if (spec->unsol_event)
19717 alc_inithook(codec);
19721 * configuration and preset
19723 static const char *alc680_models[ALC680_MODEL_LAST] = {
19724 [ALC680_BASE] = "base",
19725 [ALC680_AUTO] = "auto",
19728 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19729 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19733 static struct alc_config_preset alc680_presets[] = {
19735 .mixers = { alc680_base_mixer },
19736 .cap_mixer = alc680_master_capture_mixer,
19737 .init_verbs = { alc680_init_verbs },
19738 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19739 .dac_nids = alc680_dac_nids,
19740 .dig_out_nid = ALC680_DIGOUT_NID,
19741 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19742 .channel_mode = alc680_modes,
19743 .unsol_event = alc680_unsol_event,
19744 .setup = alc680_base_setup,
19745 .init_hook = alc680_inithook,
19750 static int patch_alc680(struct hda_codec *codec)
19752 struct alc_spec *spec;
19756 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19760 codec->spec = spec;
19762 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19766 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19767 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19769 board_config = ALC680_AUTO;
19772 if (board_config == ALC680_AUTO) {
19773 /* automatic parse from the BIOS config */
19774 err = alc680_parse_auto_config(codec);
19780 "hda_codec: Cannot set up configuration "
19781 "from BIOS. Using base mode...\n");
19782 board_config = ALC680_BASE;
19786 if (board_config != ALC680_AUTO)
19787 setup_preset(codec, &alc680_presets[board_config]);
19789 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19790 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19791 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19792 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19794 if (!spec->adc_nids) {
19795 spec->adc_nids = alc680_adc_nids;
19796 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19799 if (!spec->cap_mixer)
19800 set_capture_mixer(codec);
19802 spec->vmaster_nid = 0x02;
19804 codec->patch_ops = alc_patch_ops;
19805 if (board_config == ALC680_AUTO)
19806 spec->init_hook = alc680_auto_init;
19814 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19815 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19816 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19817 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19818 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19819 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19820 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19821 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19822 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19823 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19824 .patch = patch_alc861 },
19825 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19826 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19827 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19828 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19829 .patch = patch_alc882 },
19830 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19831 .patch = patch_alc662 },
19832 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19833 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19834 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19835 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19836 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19837 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19838 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19839 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19840 .patch = patch_alc882 },
19841 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19842 .patch = patch_alc882 },
19843 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19844 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
19845 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19846 .patch = patch_alc882 },
19847 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19848 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19849 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19850 {} /* terminator */
19853 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19855 MODULE_LICENSE("GPL");
19856 MODULE_DESCRIPTION("Realtek HD-audio codec");
19858 static struct hda_codec_preset_list realtek_list = {
19859 .preset = snd_hda_preset_realtek,
19860 .owner = THIS_MODULE,
19863 static int __init patch_realtek_init(void)
19865 return snd_hda_add_codec_preset(&realtek_list);
19868 static void __exit patch_realtek_exit(void)
19870 snd_hda_delete_codec_preset(&realtek_list);
19873 module_init(patch_realtek_init)
19874 module_exit(patch_realtek_exit)