2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include <sound/jack.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
36 #define ALC880_FRONT_EVENT 0x01
37 #define ALC880_DCVOL_EVENT 0x02
38 #define ALC880_HP_EVENT 0x04
39 #define ALC880_MIC_EVENT 0x08
41 /* ALC880 board config type */
65 #ifdef CONFIG_SND_DEBUG
69 ALC880_MODEL_LAST /* last tag */
83 #ifdef CONFIG_SND_DEBUG
87 ALC260_MODEL_LAST /* last tag */
97 ALC262_HP_BPC_D7000_WL,
98 ALC262_HP_BPC_D7000_WF,
111 ALC262_MODEL_LAST /* last tag */
121 ALC268_ACER_ASPIRE_ONE,
124 #ifdef CONFIG_SND_DEBUG
128 ALC268_MODEL_LAST /* last tag */
143 ALC269_MODEL_LAST /* last tag */
160 /* ALC861-VD models */
182 ALC662_ASUS_EEEPC_P701,
183 ALC662_ASUS_EEEPC_EP20,
225 ALC883_TARGA_2ch_DIG,
226 ALC883_TARGA_8ch_DIG,
229 ALC888_ACER_ASPIRE_4930G,
230 ALC888_ACER_ASPIRE_6530G,
231 ALC888_ACER_ASPIRE_8930G,
232 ALC888_ACER_ASPIRE_7730G,
234 ALC883_MEDION_WIM2160,
236 ALC883_LENOVO_101E_2ch,
237 ALC883_LENOVO_NB0763,
238 ALC888_LENOVO_MS7195_DIG,
246 ALC883_FUJITSU_PI2515,
247 ALC888_FUJITSU_XA3530,
248 ALC883_3ST_6ch_INTEL,
268 #define GPIO_MASK 0x03
270 /* extra amp-initialization sequence types */
279 struct alc_mic_route {
281 unsigned char mux_idx;
282 unsigned char amix_idx;
288 struct snd_jack *jack;
291 #define MUX_IDX_UNDEF ((unsigned char)-1)
293 struct alc_customize_define {
294 unsigned int sku_cfg;
295 unsigned char port_connectivity;
296 unsigned char check_sum;
297 unsigned char customization;
298 unsigned char external_amp;
299 unsigned int enable_pcbeep:1;
300 unsigned int platform_type:1;
302 unsigned int override:1;
303 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
307 /* codec parameterization */
308 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
309 unsigned int num_mixers;
310 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
311 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
313 const struct hda_verb *init_verbs[10]; /* initialization verbs
317 unsigned int num_init_verbs;
319 char stream_name_analog[32]; /* analog PCM stream */
320 struct hda_pcm_stream *stream_analog_playback;
321 struct hda_pcm_stream *stream_analog_capture;
322 struct hda_pcm_stream *stream_analog_alt_playback;
323 struct hda_pcm_stream *stream_analog_alt_capture;
325 char stream_name_digital[32]; /* digital PCM stream */
326 struct hda_pcm_stream *stream_digital_playback;
327 struct hda_pcm_stream *stream_digital_capture;
330 struct hda_multi_out multiout; /* playback set-up
331 * max_channels, dacs must be set
332 * dig_out_nid and hp_nid are optional
334 hda_nid_t alt_dac_nid;
335 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
339 unsigned int num_adc_nids;
341 hda_nid_t *capsrc_nids;
342 hda_nid_t dig_in_nid; /* digital-in NID; optional */
344 /* capture setup for dynamic dual-adc switch */
345 unsigned int cur_adc_idx;
347 unsigned int cur_adc_stream_tag;
348 unsigned int cur_adc_format;
351 unsigned int num_mux_defs;
352 const struct hda_input_mux *input_mux;
353 unsigned int cur_mux[3];
354 struct alc_mic_route ext_mic;
355 struct alc_mic_route int_mic;
358 const struct hda_channel_mode *channel_mode;
359 int num_channel_mode;
361 int const_channel_count;
362 int ext_channel_count;
364 /* PCM information */
365 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
368 struct snd_array jacks;
370 /* dynamic controls, init_verbs and input_mux */
371 struct auto_pin_cfg autocfg;
372 struct alc_customize_define cdefine;
373 struct snd_array kctls;
374 struct hda_input_mux private_imux[3];
375 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
376 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
377 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
380 void (*init_hook)(struct hda_codec *codec);
381 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
382 #ifdef CONFIG_SND_HDA_POWER_SAVE
383 void (*power_hook)(struct hda_codec *codec);
386 /* for pin sensing */
387 unsigned int sense_updated: 1;
388 unsigned int jack_present: 1;
389 unsigned int master_sw: 1;
390 unsigned int auto_mic:1;
393 unsigned int no_analog :1; /* digital I/O only */
394 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
396 int codec_variant; /* flag for other variants */
398 /* for virtual master */
399 hda_nid_t vmaster_nid;
400 #ifdef CONFIG_SND_HDA_POWER_SAVE
401 struct hda_loopback_check loopback;
406 unsigned int pll_coef_idx, pll_coef_bit;
410 * configuration template - to be copied to the spec instance
412 struct alc_config_preset {
413 struct snd_kcontrol_new *mixers[5]; /* should be identical size
416 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
417 const struct hda_verb *init_verbs[5];
418 unsigned int num_dacs;
420 hda_nid_t dig_out_nid; /* optional */
421 hda_nid_t hp_nid; /* optional */
422 hda_nid_t *slave_dig_outs;
423 unsigned int num_adc_nids;
425 hda_nid_t *capsrc_nids;
426 hda_nid_t dig_in_nid;
427 unsigned int num_channel_mode;
428 const struct hda_channel_mode *channel_mode;
430 int const_channel_count;
431 unsigned int num_mux_defs;
432 const struct hda_input_mux *input_mux;
433 void (*unsol_event)(struct hda_codec *, unsigned int);
434 void (*setup)(struct hda_codec *);
435 void (*init_hook)(struct hda_codec *);
436 #ifdef CONFIG_SND_HDA_POWER_SAVE
437 struct hda_amp_list *loopbacks;
438 void (*power_hook)(struct hda_codec *codec);
446 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
447 struct snd_ctl_elem_info *uinfo)
449 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
450 struct alc_spec *spec = codec->spec;
451 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
452 if (mux_idx >= spec->num_mux_defs)
454 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
456 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
459 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
460 struct snd_ctl_elem_value *ucontrol)
462 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
463 struct alc_spec *spec = codec->spec;
464 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
466 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
470 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
471 struct snd_ctl_elem_value *ucontrol)
473 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
474 struct alc_spec *spec = codec->spec;
475 const struct hda_input_mux *imux;
476 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
477 unsigned int mux_idx;
478 hda_nid_t nid = spec->capsrc_nids ?
479 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
482 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
483 imux = &spec->input_mux[mux_idx];
484 if (!imux->num_items && mux_idx > 0)
485 imux = &spec->input_mux[0];
487 type = get_wcaps_type(get_wcaps(codec, nid));
488 if (type == AC_WID_AUD_MIX) {
489 /* Matrix-mixer style (e.g. ALC882) */
490 unsigned int *cur_val = &spec->cur_mux[adc_idx];
493 idx = ucontrol->value.enumerated.item[0];
494 if (idx >= imux->num_items)
495 idx = imux->num_items - 1;
498 for (i = 0; i < imux->num_items; i++) {
499 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
500 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
501 imux->items[i].index,
507 /* MUX style (e.g. ALC880) */
508 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
509 &spec->cur_mux[adc_idx]);
514 * channel mode setting
516 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
517 struct snd_ctl_elem_info *uinfo)
519 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
520 struct alc_spec *spec = codec->spec;
521 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
522 spec->num_channel_mode);
525 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
526 struct snd_ctl_elem_value *ucontrol)
528 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
529 struct alc_spec *spec = codec->spec;
530 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
531 spec->num_channel_mode,
532 spec->ext_channel_count);
535 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
536 struct snd_ctl_elem_value *ucontrol)
538 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
539 struct alc_spec *spec = codec->spec;
540 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
541 spec->num_channel_mode,
542 &spec->ext_channel_count);
543 if (err >= 0 && !spec->const_channel_count) {
544 spec->multiout.max_channels = spec->ext_channel_count;
545 if (spec->need_dac_fix)
546 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
552 * Control the mode of pin widget settings via the mixer. "pc" is used
553 * instead of "%" to avoid consequences of accidently treating the % as
554 * being part of a format specifier. Maximum allowed length of a value is
555 * 63 characters plus NULL terminator.
557 * Note: some retasking pin complexes seem to ignore requests for input
558 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
559 * are requested. Therefore order this list so that this behaviour will not
560 * cause problems when mixer clients move through the enum sequentially.
561 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
564 static char *alc_pin_mode_names[] = {
565 "Mic 50pc bias", "Mic 80pc bias",
566 "Line in", "Line out", "Headphone out",
568 static unsigned char alc_pin_mode_values[] = {
569 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
571 /* The control can present all 5 options, or it can limit the options based
572 * in the pin being assumed to be exclusively an input or an output pin. In
573 * addition, "input" pins may or may not process the mic bias option
574 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
575 * accept requests for bias as of chip versions up to March 2006) and/or
576 * wiring in the computer.
578 #define ALC_PIN_DIR_IN 0x00
579 #define ALC_PIN_DIR_OUT 0x01
580 #define ALC_PIN_DIR_INOUT 0x02
581 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
582 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
584 /* Info about the pin modes supported by the different pin direction modes.
585 * For each direction the minimum and maximum values are given.
587 static signed char alc_pin_mode_dir_info[5][2] = {
588 { 0, 2 }, /* ALC_PIN_DIR_IN */
589 { 3, 4 }, /* ALC_PIN_DIR_OUT */
590 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
591 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
592 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
594 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
595 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
596 #define alc_pin_mode_n_items(_dir) \
597 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
599 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
600 struct snd_ctl_elem_info *uinfo)
602 unsigned int item_num = uinfo->value.enumerated.item;
603 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
605 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
607 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
609 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
610 item_num = alc_pin_mode_min(dir);
611 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
615 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
616 struct snd_ctl_elem_value *ucontrol)
619 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
620 hda_nid_t nid = kcontrol->private_value & 0xffff;
621 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
622 long *valp = ucontrol->value.integer.value;
623 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
624 AC_VERB_GET_PIN_WIDGET_CONTROL,
627 /* Find enumerated value for current pinctl setting */
628 i = alc_pin_mode_min(dir);
629 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
631 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
635 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
636 struct snd_ctl_elem_value *ucontrol)
639 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
640 hda_nid_t nid = kcontrol->private_value & 0xffff;
641 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
642 long val = *ucontrol->value.integer.value;
643 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
644 AC_VERB_GET_PIN_WIDGET_CONTROL,
647 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
648 val = alc_pin_mode_min(dir);
650 change = pinctl != alc_pin_mode_values[val];
652 /* Set pin mode to that requested */
653 snd_hda_codec_write_cache(codec, nid, 0,
654 AC_VERB_SET_PIN_WIDGET_CONTROL,
655 alc_pin_mode_values[val]);
657 /* Also enable the retasking pin's input/output as required
658 * for the requested pin mode. Enum values of 2 or less are
661 * Dynamically switching the input/output buffers probably
662 * reduces noise slightly (particularly on input) so we'll
663 * do it. However, having both input and output buffers
664 * enabled simultaneously doesn't seem to be problematic if
665 * this turns out to be necessary in the future.
668 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
669 HDA_AMP_MUTE, HDA_AMP_MUTE);
670 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
673 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
674 HDA_AMP_MUTE, HDA_AMP_MUTE);
675 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
682 #define ALC_PIN_MODE(xname, nid, dir) \
683 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
684 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
685 .info = alc_pin_mode_info, \
686 .get = alc_pin_mode_get, \
687 .put = alc_pin_mode_put, \
688 .private_value = nid | (dir<<16) }
690 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
691 * together using a mask with more than one bit set. This control is
692 * currently used only by the ALC260 test model. At this stage they are not
693 * needed for any "production" models.
695 #ifdef CONFIG_SND_DEBUG
696 #define alc_gpio_data_info snd_ctl_boolean_mono_info
698 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
699 struct snd_ctl_elem_value *ucontrol)
701 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
702 hda_nid_t nid = kcontrol->private_value & 0xffff;
703 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
704 long *valp = ucontrol->value.integer.value;
705 unsigned int val = snd_hda_codec_read(codec, nid, 0,
706 AC_VERB_GET_GPIO_DATA, 0x00);
708 *valp = (val & mask) != 0;
711 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
712 struct snd_ctl_elem_value *ucontrol)
715 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
716 hda_nid_t nid = kcontrol->private_value & 0xffff;
717 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
718 long val = *ucontrol->value.integer.value;
719 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
720 AC_VERB_GET_GPIO_DATA,
723 /* Set/unset the masked GPIO bit(s) as needed */
724 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
729 snd_hda_codec_write_cache(codec, nid, 0,
730 AC_VERB_SET_GPIO_DATA, gpio_data);
734 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
735 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
736 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
737 .info = alc_gpio_data_info, \
738 .get = alc_gpio_data_get, \
739 .put = alc_gpio_data_put, \
740 .private_value = nid | (mask<<16) }
741 #endif /* CONFIG_SND_DEBUG */
743 /* A switch control to allow the enabling of the digital IO pins on the
744 * ALC260. This is incredibly simplistic; the intention of this control is
745 * to provide something in the test model allowing digital outputs to be
746 * identified if present. If models are found which can utilise these
747 * outputs a more complete mixer control can be devised for those models if
750 #ifdef CONFIG_SND_DEBUG
751 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
753 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
754 struct snd_ctl_elem_value *ucontrol)
756 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
757 hda_nid_t nid = kcontrol->private_value & 0xffff;
758 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
759 long *valp = ucontrol->value.integer.value;
760 unsigned int val = snd_hda_codec_read(codec, nid, 0,
761 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
763 *valp = (val & mask) != 0;
766 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
767 struct snd_ctl_elem_value *ucontrol)
770 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
771 hda_nid_t nid = kcontrol->private_value & 0xffff;
772 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
773 long val = *ucontrol->value.integer.value;
774 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
775 AC_VERB_GET_DIGI_CONVERT_1,
778 /* Set/unset the masked control bit(s) as needed */
779 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
784 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
789 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
790 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
791 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
792 .info = alc_spdif_ctrl_info, \
793 .get = alc_spdif_ctrl_get, \
794 .put = alc_spdif_ctrl_put, \
795 .private_value = nid | (mask<<16) }
796 #endif /* CONFIG_SND_DEBUG */
798 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
799 * Again, this is only used in the ALC26x test models to help identify when
800 * the EAPD line must be asserted for features to work.
802 #ifdef CONFIG_SND_DEBUG
803 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
805 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
806 struct snd_ctl_elem_value *ucontrol)
808 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
809 hda_nid_t nid = kcontrol->private_value & 0xffff;
810 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
811 long *valp = ucontrol->value.integer.value;
812 unsigned int val = snd_hda_codec_read(codec, nid, 0,
813 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
815 *valp = (val & mask) != 0;
819 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
820 struct snd_ctl_elem_value *ucontrol)
823 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
824 hda_nid_t nid = kcontrol->private_value & 0xffff;
825 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
826 long val = *ucontrol->value.integer.value;
827 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
828 AC_VERB_GET_EAPD_BTLENABLE,
831 /* Set/unset the masked control bit(s) as needed */
832 change = (!val ? 0 : mask) != (ctrl_data & mask);
837 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
843 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
844 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
845 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
846 .info = alc_eapd_ctrl_info, \
847 .get = alc_eapd_ctrl_get, \
848 .put = alc_eapd_ctrl_put, \
849 .private_value = nid | (mask<<16) }
850 #endif /* CONFIG_SND_DEBUG */
853 * set up the input pin config (depending on the given auto-pin type)
855 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
858 unsigned int val = PIN_IN;
860 if (auto_pin_type == AUTO_PIN_MIC) {
863 oldval = snd_hda_codec_read(codec, nid, 0,
864 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
865 pincap = snd_hda_query_pin_caps(codec, nid);
866 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
867 /* if the default pin setup is vref50, we give it priority */
868 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
870 else if (pincap & AC_PINCAP_VREF_50)
872 else if (pincap & AC_PINCAP_VREF_100)
874 else if (pincap & AC_PINCAP_VREF_GRD)
877 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
880 static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
882 struct alc_spec *spec = codec->spec;
883 struct auto_pin_cfg *cfg = &spec->autocfg;
885 if (!cfg->line_outs) {
886 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
887 cfg->line_out_pins[cfg->line_outs])
890 if (!cfg->speaker_outs) {
891 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
892 cfg->speaker_pins[cfg->speaker_outs])
896 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
897 cfg->hp_pins[cfg->hp_outs])
904 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
906 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
908 spec->mixers[spec->num_mixers++] = mix;
911 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
913 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
915 spec->init_verbs[spec->num_init_verbs++] = verb;
919 * set up from the preset table
921 static void setup_preset(struct hda_codec *codec,
922 const struct alc_config_preset *preset)
924 struct alc_spec *spec = codec->spec;
927 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
928 add_mixer(spec, preset->mixers[i]);
929 spec->cap_mixer = preset->cap_mixer;
930 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
932 add_verb(spec, preset->init_verbs[i]);
934 spec->channel_mode = preset->channel_mode;
935 spec->num_channel_mode = preset->num_channel_mode;
936 spec->need_dac_fix = preset->need_dac_fix;
937 spec->const_channel_count = preset->const_channel_count;
939 if (preset->const_channel_count)
940 spec->multiout.max_channels = preset->const_channel_count;
942 spec->multiout.max_channels = spec->channel_mode[0].channels;
943 spec->ext_channel_count = spec->channel_mode[0].channels;
945 spec->multiout.num_dacs = preset->num_dacs;
946 spec->multiout.dac_nids = preset->dac_nids;
947 spec->multiout.dig_out_nid = preset->dig_out_nid;
948 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
949 spec->multiout.hp_nid = preset->hp_nid;
951 spec->num_mux_defs = preset->num_mux_defs;
952 if (!spec->num_mux_defs)
953 spec->num_mux_defs = 1;
954 spec->input_mux = preset->input_mux;
956 spec->num_adc_nids = preset->num_adc_nids;
957 spec->adc_nids = preset->adc_nids;
958 spec->capsrc_nids = preset->capsrc_nids;
959 spec->dig_in_nid = preset->dig_in_nid;
961 spec->unsol_event = preset->unsol_event;
962 spec->init_hook = preset->init_hook;
963 #ifdef CONFIG_SND_HDA_POWER_SAVE
964 spec->power_hook = preset->power_hook;
965 spec->loopback.amplist = preset->loopbacks;
969 preset->setup(codec);
971 alc_fixup_autocfg_pin_nums(codec);
974 /* Enable GPIO mask and set output */
975 static struct hda_verb alc_gpio1_init_verbs[] = {
976 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
977 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
978 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
982 static struct hda_verb alc_gpio2_init_verbs[] = {
983 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
984 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
985 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
989 static struct hda_verb alc_gpio3_init_verbs[] = {
990 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
991 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
992 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
997 * Fix hardware PLL issue
998 * On some codecs, the analog PLL gating control must be off while
999 * the default value is 1.
1001 static void alc_fix_pll(struct hda_codec *codec)
1003 struct alc_spec *spec = codec->spec;
1008 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1009 spec->pll_coef_idx);
1010 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1011 AC_VERB_GET_PROC_COEF, 0);
1012 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1013 spec->pll_coef_idx);
1014 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1015 val & ~(1 << spec->pll_coef_bit));
1018 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
1019 unsigned int coef_idx, unsigned int coef_bit)
1021 struct alc_spec *spec = codec->spec;
1022 spec->pll_nid = nid;
1023 spec->pll_coef_idx = coef_idx;
1024 spec->pll_coef_bit = coef_bit;
1028 #ifdef CONFIG_SND_HDA_INPUT_JACK
1029 static void alc_free_jack_priv(struct snd_jack *jack)
1031 struct alc_jack *jacks = jack->private_data;
1036 static int alc_add_jack(struct hda_codec *codec,
1037 hda_nid_t nid, int type)
1039 struct alc_spec *spec;
1040 struct alc_jack *jack;
1045 snd_array_init(&spec->jacks, sizeof(*jack), 32);
1046 jack = snd_array_new(&spec->jacks);
1052 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;
1054 err = snd_jack_new(codec->bus->card, name, type, &jack->jack);
1057 jack->jack->private_data = jack;
1058 jack->jack->private_free = alc_free_jack_priv;
1062 static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1064 struct alc_spec *spec = codec->spec;
1065 struct alc_jack *jacks = spec->jacks.list;
1069 for (i = 0; i < spec->jacks.used; i++) {
1070 if (jacks->nid == nid) {
1071 unsigned int present;
1072 present = snd_hda_jack_detect(codec, nid);
1074 present = (present) ? jacks->type : 0;
1076 snd_jack_report(jacks->jack, present);
1083 static int alc_init_jacks(struct hda_codec *codec)
1085 struct alc_spec *spec = codec->spec;
1087 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1088 unsigned int mic_nid = spec->ext_mic.pin;
1091 err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE);
1094 alc_report_jack(codec, hp_nid);
1098 err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE);
1101 alc_report_jack(codec, mic_nid);
1107 static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1111 static inline int alc_init_jacks(struct hda_codec *codec)
1117 static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1119 struct alc_spec *spec = codec->spec;
1124 spec->jack_present = 0;
1125 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1126 nid = spec->autocfg.hp_pins[i];
1129 if (snd_hda_jack_detect(codec, nid)) {
1130 spec->jack_present = 1;
1133 alc_report_jack(codec, spec->autocfg.hp_pins[i]);
1136 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1137 /* Toggle internal speakers muting */
1138 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1139 nid = spec->autocfg.speaker_pins[i];
1143 snd_hda_codec_write(codec, nid, 0,
1144 AC_VERB_SET_PIN_WIDGET_CONTROL,
1145 spec->jack_present ? 0 : PIN_OUT);
1147 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1148 HDA_AMP_MUTE, mute);
1153 static void alc_automute_pin(struct hda_codec *codec)
1155 alc_automute_speaker(codec, 1);
1158 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1161 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1164 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1165 for (i = 0; i < nums; i++)
1171 /* switch the current ADC according to the jack state */
1172 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1174 struct alc_spec *spec = codec->spec;
1175 unsigned int present;
1178 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1180 spec->cur_adc_idx = 1;
1182 spec->cur_adc_idx = 0;
1183 new_adc = spec->adc_nids[spec->cur_adc_idx];
1184 if (spec->cur_adc && spec->cur_adc != new_adc) {
1185 /* stream is running, let's swap the current ADC */
1186 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1187 spec->cur_adc = new_adc;
1188 snd_hda_codec_setup_stream(codec, new_adc,
1189 spec->cur_adc_stream_tag, 0,
1190 spec->cur_adc_format);
1194 static void alc_mic_automute(struct hda_codec *codec)
1196 struct alc_spec *spec = codec->spec;
1197 struct alc_mic_route *dead, *alive;
1198 unsigned int present, type;
1201 if (!spec->auto_mic)
1203 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1205 if (snd_BUG_ON(!spec->adc_nids))
1208 if (spec->dual_adc_switch) {
1209 alc_dual_mic_adc_auto_switch(codec);
1213 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1215 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1217 alive = &spec->ext_mic;
1218 dead = &spec->int_mic;
1220 alive = &spec->int_mic;
1221 dead = &spec->ext_mic;
1224 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1225 if (type == AC_WID_AUD_MIX) {
1226 /* Matrix-mixer style (e.g. ALC882) */
1227 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1230 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1232 HDA_AMP_MUTE, HDA_AMP_MUTE);
1234 /* MUX style (e.g. ALC880) */
1235 snd_hda_codec_write_cache(codec, cap_nid, 0,
1236 AC_VERB_SET_CONNECT_SEL,
1239 alc_report_jack(codec, spec->ext_mic.pin);
1241 /* FIXME: analog mixer */
1244 /* unsolicited event for HP jack sensing */
1245 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1247 if (codec->vendor_id == 0x10ec0880)
1252 case ALC880_HP_EVENT:
1253 alc_automute_pin(codec);
1255 case ALC880_MIC_EVENT:
1256 alc_mic_automute(codec);
1261 static void alc_inithook(struct hda_codec *codec)
1263 alc_automute_pin(codec);
1264 alc_mic_automute(codec);
1267 /* additional initialization for ALC888 variants */
1268 static void alc888_coef_init(struct hda_codec *codec)
1272 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1273 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1274 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1275 if ((tmp & 0xf0) == 0x20)
1277 snd_hda_codec_read(codec, 0x20, 0,
1278 AC_VERB_SET_PROC_COEF, 0x830);
1281 snd_hda_codec_read(codec, 0x20, 0,
1282 AC_VERB_SET_PROC_COEF, 0x3030);
1285 static void alc889_coef_init(struct hda_codec *codec)
1289 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1290 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1291 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1292 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1295 /* turn on/off EAPD control (only if available) */
1296 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1298 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1300 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1301 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1305 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1310 case ALC_INIT_GPIO1:
1311 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1313 case ALC_INIT_GPIO2:
1314 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1316 case ALC_INIT_GPIO3:
1317 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1319 case ALC_INIT_DEFAULT:
1320 switch (codec->vendor_id) {
1322 set_eapd(codec, 0x0f, 1);
1323 set_eapd(codec, 0x10, 1);
1336 set_eapd(codec, 0x14, 1);
1337 set_eapd(codec, 0x15, 1);
1340 switch (codec->vendor_id) {
1342 snd_hda_codec_write(codec, 0x1a, 0,
1343 AC_VERB_SET_COEF_INDEX, 7);
1344 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1345 AC_VERB_GET_PROC_COEF, 0);
1346 snd_hda_codec_write(codec, 0x1a, 0,
1347 AC_VERB_SET_COEF_INDEX, 7);
1348 snd_hda_codec_write(codec, 0x1a, 0,
1349 AC_VERB_SET_PROC_COEF,
1359 alc889_coef_init(codec);
1362 alc888_coef_init(codec);
1364 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1367 snd_hda_codec_write(codec, 0x20, 0,
1368 AC_VERB_SET_COEF_INDEX, 7);
1369 tmp = snd_hda_codec_read(codec, 0x20, 0,
1370 AC_VERB_GET_PROC_COEF, 0);
1371 snd_hda_codec_write(codec, 0x20, 0,
1372 AC_VERB_SET_COEF_INDEX, 7);
1373 snd_hda_codec_write(codec, 0x20, 0,
1374 AC_VERB_SET_PROC_COEF,
1383 static void alc_init_auto_hp(struct hda_codec *codec)
1385 struct alc_spec *spec = codec->spec;
1386 struct auto_pin_cfg *cfg = &spec->autocfg;
1389 if (!cfg->hp_pins[0]) {
1390 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1394 if (!cfg->speaker_pins[0]) {
1395 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1397 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1398 sizeof(cfg->speaker_pins));
1399 cfg->speaker_outs = cfg->line_outs;
1402 if (!cfg->hp_pins[0]) {
1403 memcpy(cfg->hp_pins, cfg->line_out_pins,
1404 sizeof(cfg->hp_pins));
1405 cfg->hp_outs = cfg->line_outs;
1408 for (i = 0; i < cfg->hp_outs; i++) {
1409 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1411 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1412 AC_VERB_SET_UNSOLICITED_ENABLE,
1413 AC_USRSP_EN | ALC880_HP_EVENT);
1415 spec->unsol_event = alc_sku_unsol_event;
1418 static void alc_init_auto_mic(struct hda_codec *codec)
1420 struct alc_spec *spec = codec->spec;
1421 struct auto_pin_cfg *cfg = &spec->autocfg;
1422 hda_nid_t fixed, ext;
1425 /* there must be only two mic inputs exclusively */
1426 for (i = 0; i < cfg->num_inputs; i++)
1427 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1431 for (i = 0; i < cfg->num_inputs; i++) {
1432 hda_nid_t nid = cfg->inputs[i].pin;
1433 unsigned int defcfg;
1434 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1435 switch (snd_hda_get_input_pin_attr(defcfg)) {
1436 case INPUT_PIN_ATTR_INT:
1438 return; /* already occupied */
1441 case INPUT_PIN_ATTR_UNUSED:
1442 return; /* invalid entry */
1445 return; /* already occupied */
1452 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1453 return; /* no unsol support */
1454 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1456 spec->ext_mic.pin = ext;
1457 spec->int_mic.pin = fixed;
1458 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1459 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1461 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1462 AC_VERB_SET_UNSOLICITED_ENABLE,
1463 AC_USRSP_EN | ALC880_MIC_EVENT);
1464 spec->unsol_event = alc_sku_unsol_event;
1467 /* Could be any non-zero and even value. When used as fixup, tells
1468 * the driver to ignore any present sku defines.
1470 #define ALC_FIXUP_SKU_IGNORE (2)
1472 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1474 unsigned int ass, tmp, i;
1476 struct alc_spec *spec = codec->spec;
1478 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1480 if (spec->cdefine.fixup) {
1481 ass = spec->cdefine.sku_cfg;
1482 if (ass == ALC_FIXUP_SKU_IGNORE)
1487 ass = codec->subsystem_id & 0xffff;
1488 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1492 if (codec->vendor_id == 0x10ec0260)
1494 ass = snd_hda_codec_get_pincfg(codec, nid);
1497 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1498 codec->chip_name, ass);
1504 for (i = 1; i < 16; i++) {
1508 if (((ass >> 16) & 0xf) != tmp)
1511 spec->cdefine.port_connectivity = ass >> 30;
1512 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1513 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1514 spec->cdefine.customization = ass >> 8;
1516 spec->cdefine.sku_cfg = ass;
1517 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1518 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1519 spec->cdefine.swap = (ass & 0x2) >> 1;
1520 spec->cdefine.override = ass & 0x1;
1522 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1523 nid, spec->cdefine.sku_cfg);
1524 snd_printd("SKU: port_connectivity=0x%x\n",
1525 spec->cdefine.port_connectivity);
1526 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1527 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1528 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1529 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1530 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1531 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1532 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1537 /* check subsystem ID and set up device-specific initialization;
1538 * return 1 if initialized, 0 if invalid SSID
1540 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1541 * 31 ~ 16 : Manufacture ID
1543 * 7 ~ 0 : Assembly ID
1544 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1546 static int alc_subsystem_id(struct hda_codec *codec,
1547 hda_nid_t porta, hda_nid_t porte,
1548 hda_nid_t portd, hda_nid_t porti)
1550 unsigned int ass, tmp, i;
1552 struct alc_spec *spec = codec->spec;
1554 if (spec->cdefine.fixup) {
1555 ass = spec->cdefine.sku_cfg;
1556 if (ass == ALC_FIXUP_SKU_IGNORE)
1561 ass = codec->subsystem_id & 0xffff;
1562 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1565 /* invalid SSID, check the special NID pin defcfg instead */
1567 * 31~30 : port connectivity
1570 * 19~16 : Check sum (15:1)
1575 if (codec->vendor_id == 0x10ec0260)
1577 ass = snd_hda_codec_get_pincfg(codec, nid);
1578 snd_printd("realtek: No valid SSID, "
1579 "checking pincfg 0x%08x for NID 0x%x\n",
1583 if ((ass >> 30) != 1) /* no physical connection */
1588 for (i = 1; i < 16; i++) {
1592 if (((ass >> 16) & 0xf) != tmp)
1595 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1596 ass & 0xffff, codec->vendor_id);
1600 * 2 : 0 --> Desktop, 1 --> Laptop
1601 * 3~5 : External Amplifier control
1604 tmp = (ass & 0x38) >> 3; /* external Amp control */
1607 spec->init_amp = ALC_INIT_GPIO1;
1610 spec->init_amp = ALC_INIT_GPIO2;
1613 spec->init_amp = ALC_INIT_GPIO3;
1617 spec->init_amp = ALC_INIT_DEFAULT;
1621 /* is laptop or Desktop and enable the function "Mute internal speaker
1622 * when the external headphone out jack is plugged"
1624 if (!(ass & 0x8000))
1627 * 10~8 : Jack location
1628 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1630 * 15 : 1 --> enable the function "Mute internal speaker
1631 * when the external headphone out jack is plugged"
1633 if (!spec->autocfg.hp_pins[0]) {
1635 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1646 for (i = 0; i < spec->autocfg.line_outs; i++)
1647 if (spec->autocfg.line_out_pins[i] == nid)
1649 spec->autocfg.hp_pins[0] = nid;
1652 alc_init_auto_hp(codec);
1653 alc_init_auto_mic(codec);
1657 static void alc_ssid_check(struct hda_codec *codec,
1658 hda_nid_t porta, hda_nid_t porte,
1659 hda_nid_t portd, hda_nid_t porti)
1661 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1662 struct alc_spec *spec = codec->spec;
1663 snd_printd("realtek: "
1664 "Enable default setup for auto mode as fallback\n");
1665 spec->init_amp = ALC_INIT_DEFAULT;
1666 alc_init_auto_hp(codec);
1667 alc_init_auto_mic(codec);
1672 * Fix-up pin default configurations and add default verbs
1680 struct alc_model_fixup {
1687 const struct alc_pincfg *pins;
1688 const struct hda_verb *verbs;
1689 void (*func)(struct hda_codec *codec, const struct alc_fixup *fix,
1693 static void __alc_pick_fixup(struct hda_codec *codec,
1694 const struct alc_fixup *fix,
1695 const char *modelname,
1698 const struct alc_pincfg *cfg;
1699 struct alc_spec *spec;
1702 if (pre_init && fix->sku) {
1703 #ifdef CONFIG_SND_DEBUG_VERBOSE
1704 snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n",
1705 codec->chip_name, modelname);
1708 spec->cdefine.sku_cfg = fix->sku;
1709 spec->cdefine.fixup = 1;
1711 if (pre_init && cfg) {
1712 #ifdef CONFIG_SND_DEBUG_VERBOSE
1713 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1714 codec->chip_name, modelname);
1716 for (; cfg->nid; cfg++)
1717 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1719 if (!pre_init && fix->verbs) {
1720 #ifdef CONFIG_SND_DEBUG_VERBOSE
1721 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1722 codec->chip_name, modelname);
1724 add_verb(codec->spec, fix->verbs);
1727 #ifdef CONFIG_SND_DEBUG_VERBOSE
1728 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-func for %s\n",
1729 codec->chip_name, modelname);
1731 fix->func(codec, fix, pre_init);
1735 static void alc_pick_fixup(struct hda_codec *codec,
1736 const struct snd_pci_quirk *quirk,
1737 const struct alc_fixup *fix,
1740 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1742 fix += quirk->value;
1743 #ifdef CONFIG_SND_DEBUG_VERBOSE
1744 __alc_pick_fixup(codec, fix, quirk->name, pre_init);
1746 __alc_pick_fixup(codec, fix, NULL, pre_init);
1751 static void alc_pick_fixup_model(struct hda_codec *codec,
1752 const struct alc_model_fixup *models,
1753 const struct snd_pci_quirk *quirk,
1754 const struct alc_fixup *fix,
1757 if (codec->modelname && models) {
1758 while (models->name) {
1759 if (!strcmp(codec->modelname, models->name)) {
1765 __alc_pick_fixup(codec, fix, codec->modelname, pre_init);
1767 alc_pick_fixup(codec, quirk, fix, pre_init);
1771 static int alc_read_coef_idx(struct hda_codec *codec,
1772 unsigned int coef_idx)
1775 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1777 val = snd_hda_codec_read(codec, 0x20, 0,
1778 AC_VERB_GET_PROC_COEF, 0);
1782 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
1783 unsigned int coef_val)
1785 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1787 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
1791 /* set right pin controls for digital I/O */
1792 static void alc_auto_init_digital(struct hda_codec *codec)
1794 struct alc_spec *spec = codec->spec;
1798 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1799 pin = spec->autocfg.dig_out_pins[i];
1801 snd_hda_codec_write(codec, pin, 0,
1802 AC_VERB_SET_PIN_WIDGET_CONTROL,
1806 pin = spec->autocfg.dig_in_pin;
1808 snd_hda_codec_write(codec, pin, 0,
1809 AC_VERB_SET_PIN_WIDGET_CONTROL,
1813 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1814 static void alc_auto_parse_digital(struct hda_codec *codec)
1816 struct alc_spec *spec = codec->spec;
1820 /* support multiple SPDIFs; the secondary is set up as a slave */
1821 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1822 err = snd_hda_get_connections(codec,
1823 spec->autocfg.dig_out_pins[i],
1828 spec->multiout.dig_out_nid = dig_nid;
1829 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1831 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1832 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1834 spec->slave_dig_outs[i - 1] = dig_nid;
1838 if (spec->autocfg.dig_in_pin) {
1839 dig_nid = codec->start_nid;
1840 for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
1841 unsigned int wcaps = get_wcaps(codec, dig_nid);
1842 if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
1844 if (!(wcaps & AC_WCAP_DIGITAL))
1846 if (!(wcaps & AC_WCAP_CONN_LIST))
1848 err = get_connection_index(codec, dig_nid,
1849 spec->autocfg.dig_in_pin);
1851 spec->dig_in_nid = dig_nid;
1865 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1866 /* Mic-in jack as mic in */
1867 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1868 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1869 /* Line-in jack as Line in */
1870 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1871 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1872 /* Line-Out as Front */
1873 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1880 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1881 /* Mic-in jack as mic in */
1882 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1883 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1884 /* Line-in jack as Surround */
1885 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1886 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1887 /* Line-Out as Front */
1888 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1895 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1896 /* Mic-in jack as CLFE */
1897 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1898 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1899 /* Line-in jack as Surround */
1900 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1901 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1902 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1903 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1910 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1911 /* Mic-in jack as CLFE */
1912 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1913 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1914 /* Line-in jack as Surround */
1915 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1916 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1917 /* Line-Out as Side */
1918 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1922 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1923 { 2, alc888_4ST_ch2_intel_init },
1924 { 4, alc888_4ST_ch4_intel_init },
1925 { 6, alc888_4ST_ch6_intel_init },
1926 { 8, alc888_4ST_ch8_intel_init },
1930 * ALC888 Fujitsu Siemens Amillo xa3530
1933 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1934 /* Front Mic: set to PIN_IN (empty by default) */
1935 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1936 /* Connect Internal HP to Front */
1937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1938 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1939 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1940 /* Connect Bass HP to Front */
1941 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1942 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1943 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1944 /* Connect Line-Out side jack (SPDIF) to Side */
1945 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1946 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1947 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1948 /* Connect Mic jack to CLFE */
1949 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1950 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1951 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1952 /* Connect Line-in jack to Surround */
1953 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1954 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1955 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1956 /* Connect HP out jack to Front */
1957 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1958 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1959 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1960 /* Enable unsolicited event for HP jack and Line-out jack */
1961 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1962 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1966 static void alc_automute_amp(struct hda_codec *codec)
1968 alc_automute_speaker(codec, 0);
1971 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1974 if (codec->vendor_id == 0x10ec0880)
1978 if (res == ALC880_HP_EVENT)
1979 alc_automute_amp(codec);
1982 static void alc889_automute_setup(struct hda_codec *codec)
1984 struct alc_spec *spec = codec->spec;
1986 spec->autocfg.hp_pins[0] = 0x15;
1987 spec->autocfg.speaker_pins[0] = 0x14;
1988 spec->autocfg.speaker_pins[1] = 0x16;
1989 spec->autocfg.speaker_pins[2] = 0x17;
1990 spec->autocfg.speaker_pins[3] = 0x19;
1991 spec->autocfg.speaker_pins[4] = 0x1a;
1994 static void alc889_intel_init_hook(struct hda_codec *codec)
1996 alc889_coef_init(codec);
1997 alc_automute_amp(codec);
2000 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
2002 struct alc_spec *spec = codec->spec;
2004 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
2005 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
2006 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
2007 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
2011 * ALC888 Acer Aspire 4930G model
2014 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
2015 /* Front Mic: set to PIN_IN (empty by default) */
2016 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2017 /* Unselect Front Mic by default in input mixer 3 */
2018 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2019 /* Enable unsolicited event for HP jack */
2020 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2021 /* Connect Internal HP to front */
2022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2024 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2025 /* Connect HP out to front */
2026 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2027 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2028 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2033 * ALC888 Acer Aspire 6530G model
2036 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2037 /* Route to built-in subwoofer as well as speakers */
2038 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2040 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2041 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2042 /* Bias voltage on for external mic port */
2043 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2044 /* Front Mic: set to PIN_IN (empty by default) */
2045 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2046 /* Unselect Front Mic by default in input mixer 3 */
2047 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2048 /* Enable unsolicited event for HP jack */
2049 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2050 /* Enable speaker output */
2051 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2052 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2053 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2054 /* Enable headphone output */
2055 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2056 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2057 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2058 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2063 *ALC888 Acer Aspire 7730G model
2066 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2067 /* Bias voltage on for external mic port */
2068 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2069 /* Front Mic: set to PIN_IN (empty by default) */
2070 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2071 /* Unselect Front Mic by default in input mixer 3 */
2072 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2073 /* Enable unsolicited event for HP jack */
2074 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2075 /* Enable speaker output */
2076 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2077 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2078 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2079 /* Enable headphone output */
2080 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2081 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2082 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2083 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2084 /*Enable internal subwoofer */
2085 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2086 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2087 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2088 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
2093 * ALC889 Acer Aspire 8930G model
2096 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2097 /* Front Mic: set to PIN_IN (empty by default) */
2098 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2099 /* Unselect Front Mic by default in input mixer 3 */
2100 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2101 /* Enable unsolicited event for HP jack */
2102 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2103 /* Connect Internal Front to Front */
2104 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2105 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2106 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2107 /* Connect Internal Rear to Rear */
2108 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2109 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2110 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
2111 /* Connect Internal CLFE to CLFE */
2112 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2113 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2114 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
2115 /* Connect HP out to Front */
2116 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2117 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2118 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2119 /* Enable all DACs */
2120 /* DAC DISABLE/MUTE 1? */
2121 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2122 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2123 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2124 /* DAC DISABLE/MUTE 2? */
2125 /* some bit here disables the other DACs. Init=0x4900 */
2126 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2127 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2129 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2130 * which makes the stereo useless. However, either the mic or the ALC889
2131 * makes the signal become a difference/sum signal instead of standard
2132 * stereo, which is annoying. So instead we flip this bit which makes the
2133 * codec replicate the sum signal to both channels, turning it into a
2136 /* DMIC_CONTROL? Init value = 0x0001 */
2137 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2138 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2142 static struct hda_input_mux alc888_2_capture_sources[2] = {
2143 /* Front mic only available on one ADC */
2150 { "Front Mic", 0xb },
2163 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2164 /* Interal mic only available on one ADC */
2171 { "Input Mix", 0xa },
2181 { "Input Mix", 0xa },
2186 static struct hda_input_mux alc889_capture_sources[3] = {
2187 /* Digital mic only available on first "ADC" */
2194 { "Front Mic", 0xb },
2195 { "Input Mix", 0xa },
2204 { "Input Mix", 0xa },
2213 { "Input Mix", 0xa },
2218 static struct snd_kcontrol_new alc888_base_mixer[] = {
2219 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2220 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2221 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2222 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2223 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2225 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2226 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2227 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2228 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2229 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2230 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2231 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2232 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2233 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2235 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
2236 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2240 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2241 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2242 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2243 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2244 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2245 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2247 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2248 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2249 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2250 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2251 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2253 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
2254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2259 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2261 struct alc_spec *spec = codec->spec;
2263 spec->autocfg.hp_pins[0] = 0x15;
2264 spec->autocfg.speaker_pins[0] = 0x14;
2265 spec->autocfg.speaker_pins[1] = 0x16;
2266 spec->autocfg.speaker_pins[2] = 0x17;
2269 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2271 struct alc_spec *spec = codec->spec;
2273 spec->autocfg.hp_pins[0] = 0x15;
2274 spec->autocfg.speaker_pins[0] = 0x14;
2275 spec->autocfg.speaker_pins[1] = 0x16;
2276 spec->autocfg.speaker_pins[2] = 0x17;
2279 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2281 struct alc_spec *spec = codec->spec;
2283 spec->autocfg.hp_pins[0] = 0x15;
2284 spec->autocfg.speaker_pins[0] = 0x14;
2285 spec->autocfg.speaker_pins[1] = 0x16;
2286 spec->autocfg.speaker_pins[2] = 0x17;
2289 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2291 struct alc_spec *spec = codec->spec;
2293 spec->autocfg.hp_pins[0] = 0x15;
2294 spec->autocfg.speaker_pins[0] = 0x14;
2295 spec->autocfg.speaker_pins[1] = 0x16;
2296 spec->autocfg.speaker_pins[2] = 0x1b;
2300 * ALC880 3-stack model
2302 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2303 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2304 * F-Mic = 0x1b, HP = 0x19
2307 static hda_nid_t alc880_dac_nids[4] = {
2308 /* front, rear, clfe, rear_surr */
2309 0x02, 0x05, 0x04, 0x03
2312 static hda_nid_t alc880_adc_nids[3] = {
2317 /* The datasheet says the node 0x07 is connected from inputs,
2318 * but it shows zero connection in the real implementation on some devices.
2319 * Note: this is a 915GAV bug, fixed on 915GLV
2321 static hda_nid_t alc880_adc_nids_alt[2] = {
2326 #define ALC880_DIGOUT_NID 0x06
2327 #define ALC880_DIGIN_NID 0x0a
2329 static struct hda_input_mux alc880_capture_source = {
2333 { "Front Mic", 0x3 },
2339 /* channel source setting (2/6 channel selection for 3-stack) */
2341 static struct hda_verb alc880_threestack_ch2_init[] = {
2342 /* set line-in to input, mute it */
2343 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2344 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2345 /* set mic-in to input vref 80%, mute it */
2346 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2347 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2352 static struct hda_verb alc880_threestack_ch6_init[] = {
2353 /* set line-in to output, unmute it */
2354 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2355 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2356 /* set mic-in to output, unmute it */
2357 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2358 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2362 static struct hda_channel_mode alc880_threestack_modes[2] = {
2363 { 2, alc880_threestack_ch2_init },
2364 { 6, alc880_threestack_ch6_init },
2367 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2368 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2369 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2370 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2371 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2372 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2373 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2374 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2375 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2376 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2377 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2378 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2379 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2380 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2381 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2382 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2383 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2384 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2386 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2387 .name = "Channel Mode",
2388 .info = alc_ch_mode_info,
2389 .get = alc_ch_mode_get,
2390 .put = alc_ch_mode_put,
2395 /* capture mixer elements */
2396 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2397 struct snd_ctl_elem_info *uinfo)
2399 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2400 struct alc_spec *spec = codec->spec;
2403 mutex_lock(&codec->control_mutex);
2404 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2406 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2407 mutex_unlock(&codec->control_mutex);
2411 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2412 unsigned int size, unsigned int __user *tlv)
2414 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2415 struct alc_spec *spec = codec->spec;
2418 mutex_lock(&codec->control_mutex);
2419 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2421 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2422 mutex_unlock(&codec->control_mutex);
2426 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2427 struct snd_ctl_elem_value *ucontrol);
2429 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2430 struct snd_ctl_elem_value *ucontrol,
2433 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2434 struct alc_spec *spec = codec->spec;
2435 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2438 mutex_lock(&codec->control_mutex);
2439 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2441 err = func(kcontrol, ucontrol);
2442 mutex_unlock(&codec->control_mutex);
2446 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2447 struct snd_ctl_elem_value *ucontrol)
2449 return alc_cap_getput_caller(kcontrol, ucontrol,
2450 snd_hda_mixer_amp_volume_get);
2453 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2454 struct snd_ctl_elem_value *ucontrol)
2456 return alc_cap_getput_caller(kcontrol, ucontrol,
2457 snd_hda_mixer_amp_volume_put);
2460 /* capture mixer elements */
2461 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2463 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2464 struct snd_ctl_elem_value *ucontrol)
2466 return alc_cap_getput_caller(kcontrol, ucontrol,
2467 snd_hda_mixer_amp_switch_get);
2470 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2471 struct snd_ctl_elem_value *ucontrol)
2473 return alc_cap_getput_caller(kcontrol, ucontrol,
2474 snd_hda_mixer_amp_switch_put);
2477 #define _DEFINE_CAPMIX(num) \
2479 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2480 .name = "Capture Switch", \
2481 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2483 .info = alc_cap_sw_info, \
2484 .get = alc_cap_sw_get, \
2485 .put = alc_cap_sw_put, \
2488 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2489 .name = "Capture Volume", \
2490 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2491 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2492 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2494 .info = alc_cap_vol_info, \
2495 .get = alc_cap_vol_get, \
2496 .put = alc_cap_vol_put, \
2497 .tlv = { .c = alc_cap_vol_tlv }, \
2500 #define _DEFINE_CAPSRC(num) \
2502 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2503 /* .name = "Capture Source", */ \
2504 .name = "Input Source", \
2506 .info = alc_mux_enum_info, \
2507 .get = alc_mux_enum_get, \
2508 .put = alc_mux_enum_put, \
2511 #define DEFINE_CAPMIX(num) \
2512 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2513 _DEFINE_CAPMIX(num), \
2514 _DEFINE_CAPSRC(num), \
2518 #define DEFINE_CAPMIX_NOSRC(num) \
2519 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2520 _DEFINE_CAPMIX(num), \
2524 /* up to three ADCs */
2528 DEFINE_CAPMIX_NOSRC(1);
2529 DEFINE_CAPMIX_NOSRC(2);
2530 DEFINE_CAPMIX_NOSRC(3);
2533 * ALC880 5-stack model
2535 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2537 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2538 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2541 /* additional mixers to alc880_three_stack_mixer */
2542 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2543 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2544 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2548 /* channel source setting (6/8 channel selection for 5-stack) */
2550 static struct hda_verb alc880_fivestack_ch6_init[] = {
2551 /* set line-in to input, mute it */
2552 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2553 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2558 static struct hda_verb alc880_fivestack_ch8_init[] = {
2559 /* set line-in to output, unmute it */
2560 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2561 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2565 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2566 { 6, alc880_fivestack_ch6_init },
2567 { 8, alc880_fivestack_ch8_init },
2572 * ALC880 6-stack model
2574 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2575 * Side = 0x05 (0x0f)
2576 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2577 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2580 static hda_nid_t alc880_6st_dac_nids[4] = {
2581 /* front, rear, clfe, rear_surr */
2582 0x02, 0x03, 0x04, 0x05
2585 static struct hda_input_mux alc880_6stack_capture_source = {
2589 { "Front Mic", 0x1 },
2595 /* fixed 8-channels */
2596 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2600 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2601 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2602 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2603 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2604 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2605 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2606 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2607 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2608 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2609 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2610 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2611 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2612 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2613 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2614 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2615 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2616 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2617 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2618 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2620 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2621 .name = "Channel Mode",
2622 .info = alc_ch_mode_info,
2623 .get = alc_ch_mode_get,
2624 .put = alc_ch_mode_put,
2633 * W810 has rear IO for:
2636 * Center/LFE (DAC 04)
2639 * The system also has a pair of internal speakers, and a headphone jack.
2640 * These are both connected to Line2 on the codec, hence to DAC 02.
2642 * There is a variable resistor to control the speaker or headphone
2643 * volume. This is a hardware-only device without a software API.
2645 * Plugging headphones in will disable the internal speakers. This is
2646 * implemented in hardware, not via the driver using jack sense. In
2647 * a similar fashion, plugging into the rear socket marked "front" will
2648 * disable both the speakers and headphones.
2650 * For input, there's a microphone jack, and an "audio in" jack.
2651 * These may not do anything useful with this driver yet, because I
2652 * haven't setup any initialization verbs for these yet...
2655 static hda_nid_t alc880_w810_dac_nids[3] = {
2656 /* front, rear/surround, clfe */
2660 /* fixed 6 channels */
2661 static struct hda_channel_mode alc880_w810_modes[1] = {
2665 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2666 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2667 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2668 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2669 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2670 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2671 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2672 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2673 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2674 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2675 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2683 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2684 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2688 static hda_nid_t alc880_z71v_dac_nids[1] = {
2691 #define ALC880_Z71V_HP_DAC 0x03
2693 /* fixed 2 channels */
2694 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2698 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2699 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2700 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2701 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2702 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2703 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2704 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2705 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2706 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2712 * ALC880 F1734 model
2714 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2715 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2718 static hda_nid_t alc880_f1734_dac_nids[1] = {
2721 #define ALC880_F1734_HP_DAC 0x02
2723 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2724 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2725 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2726 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2727 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2728 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2729 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2730 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2735 static struct hda_input_mux alc880_f1734_capture_source = {
2747 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2748 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2749 * Mic = 0x18, Line = 0x1a
2752 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2753 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2755 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2756 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2757 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2758 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2759 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2760 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2761 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2762 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2763 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2764 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2765 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2766 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2767 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2768 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2769 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2771 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2772 .name = "Channel Mode",
2773 .info = alc_ch_mode_info,
2774 .get = alc_ch_mode_get,
2775 .put = alc_ch_mode_put,
2781 * ALC880 ASUS W1V model
2783 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2784 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2785 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2788 /* additional mixers to alc880_asus_mixer */
2789 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2790 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2791 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2796 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2797 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2798 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2799 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2800 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2801 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2802 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2804 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2805 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2810 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2811 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2812 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2813 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2814 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2815 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2816 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2817 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2818 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2819 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2820 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2821 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2822 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2823 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2824 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2825 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2826 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2828 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2829 .name = "Channel Mode",
2830 .info = alc_ch_mode_info,
2831 .get = alc_ch_mode_get,
2832 .put = alc_ch_mode_put,
2837 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2838 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2839 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2840 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2841 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2842 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2843 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2844 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2845 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2846 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2847 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2851 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2852 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2853 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2854 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2855 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2856 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2857 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2862 * virtual master controls
2866 * slave controls for virtual master
2868 static const char *alc_slave_vols[] = {
2869 "Front Playback Volume",
2870 "Surround Playback Volume",
2871 "Center Playback Volume",
2872 "LFE Playback Volume",
2873 "Side Playback Volume",
2874 "Headphone Playback Volume",
2875 "Speaker Playback Volume",
2876 "Mono Playback Volume",
2877 "Line-Out Playback Volume",
2878 "PCM Playback Volume",
2882 static const char *alc_slave_sws[] = {
2883 "Front Playback Switch",
2884 "Surround Playback Switch",
2885 "Center Playback Switch",
2886 "LFE Playback Switch",
2887 "Side Playback Switch",
2888 "Headphone Playback Switch",
2889 "Speaker Playback Switch",
2890 "Mono Playback Switch",
2891 "IEC958 Playback Switch",
2892 "Line-Out Playback Switch",
2893 "PCM Playback Switch",
2898 * build control elements
2901 #define NID_MAPPING (-1)
2903 #define SUBDEV_SPEAKER_ (0 << 6)
2904 #define SUBDEV_HP_ (1 << 6)
2905 #define SUBDEV_LINE_ (2 << 6)
2906 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2907 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2908 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2910 static void alc_free_kctls(struct hda_codec *codec);
2912 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2913 /* additional beep mixers; the actual parameters are overwritten at build */
2914 static struct snd_kcontrol_new alc_beep_mixer[] = {
2915 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2916 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2921 static int alc_build_controls(struct hda_codec *codec)
2923 struct alc_spec *spec = codec->spec;
2924 struct snd_kcontrol *kctl = NULL;
2925 struct snd_kcontrol_new *knew;
2930 for (i = 0; i < spec->num_mixers; i++) {
2931 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2935 if (spec->cap_mixer) {
2936 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2940 if (spec->multiout.dig_out_nid) {
2941 err = snd_hda_create_spdif_out_ctls(codec,
2942 spec->multiout.dig_out_nid);
2945 if (!spec->no_analog) {
2946 err = snd_hda_create_spdif_share_sw(codec,
2950 spec->multiout.share_spdif = 1;
2953 if (spec->dig_in_nid) {
2954 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2959 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2960 /* create beep controls if needed */
2961 if (spec->beep_amp) {
2962 struct snd_kcontrol_new *knew;
2963 for (knew = alc_beep_mixer; knew->name; knew++) {
2964 struct snd_kcontrol *kctl;
2965 kctl = snd_ctl_new1(knew, codec);
2968 kctl->private_value = spec->beep_amp;
2969 err = snd_hda_ctl_add(codec, 0, kctl);
2976 /* if we have no master control, let's create it */
2977 if (!spec->no_analog &&
2978 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2979 unsigned int vmaster_tlv[4];
2980 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2981 HDA_OUTPUT, vmaster_tlv);
2982 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2983 vmaster_tlv, alc_slave_vols);
2987 if (!spec->no_analog &&
2988 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2989 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2990 NULL, alc_slave_sws);
2995 /* assign Capture Source enums to NID */
2996 if (spec->capsrc_nids || spec->adc_nids) {
2997 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2999 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3000 for (i = 0; kctl && i < kctl->count; i++) {
3001 hda_nid_t *nids = spec->capsrc_nids;
3003 nids = spec->adc_nids;
3004 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
3009 if (spec->cap_mixer) {
3010 const char *kname = kctl ? kctl->id.name : NULL;
3011 for (knew = spec->cap_mixer; knew->name; knew++) {
3012 if (kname && strcmp(knew->name, kname) == 0)
3014 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3015 for (i = 0; kctl && i < kctl->count; i++) {
3016 err = snd_hda_add_nid(codec, kctl, i,
3024 /* other nid->control mapping */
3025 for (i = 0; i < spec->num_mixers; i++) {
3026 for (knew = spec->mixers[i]; knew->name; knew++) {
3027 if (knew->iface != NID_MAPPING)
3029 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3032 u = knew->subdevice;
3033 for (j = 0; j < 4; j++, u >>= 8) {
3038 case SUBDEV_SPEAKER_:
3039 nid = spec->autocfg.speaker_pins[nid];
3042 nid = spec->autocfg.line_out_pins[nid];
3045 nid = spec->autocfg.hp_pins[nid];
3050 err = snd_hda_add_nid(codec, kctl, 0, nid);
3054 u = knew->private_value;
3055 for (j = 0; j < 4; j++, u >>= 8) {
3059 err = snd_hda_add_nid(codec, kctl, 0, nid);
3066 alc_free_kctls(codec); /* no longer needed */
3073 * initialize the codec volumes, etc
3077 * generic initialization of ADC, input mixers and output mixers
3079 static struct hda_verb alc880_volume_init_verbs[] = {
3081 * Unmute ADC0-2 and set the default input to mic-in
3083 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3084 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3085 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3086 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3087 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3088 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3090 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3092 * Note: PASD motherboards uses the Line In 2 as the input for front
3095 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3096 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3097 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3098 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3099 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3105 * Set up output mixers (0x0c - 0x0f)
3107 /* set vol=0 to output mixers */
3108 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3109 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3110 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3111 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3112 /* set up input amps for analog loopback */
3113 /* Amp Indices: DAC = 0, mixer = 1 */
3114 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3116 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3117 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3118 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3119 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3120 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3121 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3127 * 3-stack pin configuration:
3128 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3130 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3132 * preset connection lists of input pins
3133 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3135 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3136 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3137 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3140 * Set pin mode and muting
3142 /* set front pin widgets 0x14 for output */
3143 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3144 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3145 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3146 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3147 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3148 /* Mic2 (as headphone out) for HP output */
3149 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3150 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3151 /* Line In pin widget for input */
3152 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3153 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3154 /* Line2 (as front mic) pin widget for input and vref at 80% */
3155 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3156 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3157 /* CD pin widget for input */
3158 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3164 * 5-stack pin configuration:
3165 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3166 * line-in/side = 0x1a, f-mic = 0x1b
3168 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3170 * preset connection lists of input pins
3171 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3173 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3174 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3177 * Set pin mode and muting
3179 /* set pin widgets 0x14-0x17 for output */
3180 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3181 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3182 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3183 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3184 /* unmute pins for output (no gain on this amp) */
3185 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3186 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3187 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3188 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3190 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3191 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3192 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3193 /* Mic2 (as headphone out) for HP output */
3194 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3195 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3196 /* Line In pin widget for input */
3197 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3198 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3199 /* Line2 (as front mic) pin widget for input and vref at 80% */
3200 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3201 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3202 /* CD pin widget for input */
3203 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3209 * W810 pin configuration:
3210 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3212 static struct hda_verb alc880_pin_w810_init_verbs[] = {
3213 /* hphone/speaker input selector: front DAC */
3214 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3216 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3217 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3218 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3219 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3220 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3221 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3223 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3224 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3230 * Z71V pin configuration:
3231 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3233 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3234 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3235 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3237 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3239 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3240 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3241 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3242 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3248 * 6-stack pin configuration:
3249 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3250 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3252 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3253 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3255 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3256 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3258 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3259 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3260 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3261 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3262 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3264 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3265 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3266 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3267 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3268 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3269 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3270 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3271 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3272 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3278 * Uniwill pin configuration:
3279 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3282 static struct hda_verb alc880_uniwill_init_verbs[] = {
3283 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3285 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3286 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3287 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3288 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3289 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3290 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3291 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3292 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3293 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3294 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3295 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3296 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3297 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3300 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3301 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3302 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3303 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3304 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3305 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3306 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3307 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3308 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3310 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3311 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3318 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3320 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3321 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3323 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3324 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3325 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3326 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3327 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3328 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3329 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3331 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3336 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3337 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3338 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3339 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3340 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3341 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3343 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3344 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3349 static struct hda_verb alc880_beep_init_verbs[] = {
3350 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3354 /* auto-toggle front mic */
3355 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
3357 unsigned int present;
3360 present = snd_hda_jack_detect(codec, 0x18);
3361 bits = present ? HDA_AMP_MUTE : 0;
3362 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3365 static void alc880_uniwill_setup(struct hda_codec *codec)
3367 struct alc_spec *spec = codec->spec;
3369 spec->autocfg.hp_pins[0] = 0x14;
3370 spec->autocfg.speaker_pins[0] = 0x15;
3371 spec->autocfg.speaker_pins[0] = 0x16;
3374 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3376 alc_automute_amp(codec);
3377 alc880_uniwill_mic_automute(codec);
3380 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3383 /* Looks like the unsol event is incompatible with the standard
3384 * definition. 4bit tag is placed at 28 bit!
3386 switch (res >> 28) {
3387 case ALC880_MIC_EVENT:
3388 alc880_uniwill_mic_automute(codec);
3391 alc_automute_amp_unsol_event(codec, res);
3396 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3398 struct alc_spec *spec = codec->spec;
3400 spec->autocfg.hp_pins[0] = 0x14;
3401 spec->autocfg.speaker_pins[0] = 0x15;
3404 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3406 unsigned int present;
3408 present = snd_hda_codec_read(codec, 0x21, 0,
3409 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3410 present &= HDA_AMP_VOLMASK;
3411 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3412 HDA_AMP_VOLMASK, present);
3413 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3414 HDA_AMP_VOLMASK, present);
3417 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3420 /* Looks like the unsol event is incompatible with the standard
3421 * definition. 4bit tag is placed at 28 bit!
3423 if ((res >> 28) == ALC880_DCVOL_EVENT)
3424 alc880_uniwill_p53_dcvol_automute(codec);
3426 alc_automute_amp_unsol_event(codec, res);
3430 * F1734 pin configuration:
3431 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3433 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3434 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3435 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3436 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3437 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3438 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3440 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3441 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3442 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3443 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3445 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3446 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3447 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3448 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3449 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3450 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3451 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3452 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3453 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3455 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3456 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3462 * ASUS pin configuration:
3463 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3465 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3466 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3467 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3468 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3469 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3471 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3472 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3473 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3474 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3475 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3476 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3477 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3478 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3480 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3481 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3482 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3483 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3484 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3485 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3486 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3487 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3488 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3493 /* Enable GPIO mask and set output */
3494 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3495 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3496 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3498 /* Clevo m520g init */
3499 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3500 /* headphone output */
3501 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3503 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3504 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3506 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3507 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3509 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3510 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3511 /* Mic1 (rear panel) */
3512 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3513 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3514 /* Mic2 (front panel) */
3515 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3516 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3518 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3519 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3520 /* change to EAPD mode */
3521 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3522 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3527 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3528 /* change to EAPD mode */
3529 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3530 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3532 /* Headphone output */
3533 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3535 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3536 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3538 /* Line In pin widget for input */
3539 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3540 /* CD pin widget for input */
3541 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3542 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3543 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3545 /* change to EAPD mode */
3546 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3547 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3553 * LG m1 express dual
3556 * Rear Line-In/Out (blue): 0x14
3557 * Build-in Mic-In: 0x15
3559 * HP-Out (green): 0x1b
3560 * Mic-In/Out (red): 0x19
3564 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3565 static hda_nid_t alc880_lg_dac_nids[3] = {
3569 /* seems analog CD is not working */
3570 static struct hda_input_mux alc880_lg_capture_source = {
3575 { "Internal Mic", 0x6 },
3579 /* 2,4,6 channel modes */
3580 static struct hda_verb alc880_lg_ch2_init[] = {
3581 /* set line-in and mic-in to input */
3582 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3583 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3587 static struct hda_verb alc880_lg_ch4_init[] = {
3588 /* set line-in to out and mic-in to input */
3589 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3590 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3594 static struct hda_verb alc880_lg_ch6_init[] = {
3595 /* set line-in and mic-in to output */
3596 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3597 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3601 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3602 { 2, alc880_lg_ch2_init },
3603 { 4, alc880_lg_ch4_init },
3604 { 6, alc880_lg_ch6_init },
3607 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3608 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3609 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3610 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3611 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3612 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3613 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3614 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3615 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3618 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3619 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3620 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3621 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3623 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3624 .name = "Channel Mode",
3625 .info = alc_ch_mode_info,
3626 .get = alc_ch_mode_get,
3627 .put = alc_ch_mode_put,
3632 static struct hda_verb alc880_lg_init_verbs[] = {
3633 /* set capture source to mic-in */
3634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3635 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3636 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3637 /* mute all amp mixer inputs */
3638 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3639 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3641 /* line-in to input */
3642 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3643 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3645 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3646 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3648 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3649 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3650 /* mic-in to input */
3651 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3652 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3653 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3655 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3656 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3657 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3659 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3663 /* toggle speaker-output according to the hp-jack state */
3664 static void alc880_lg_setup(struct hda_codec *codec)
3666 struct alc_spec *spec = codec->spec;
3668 spec->autocfg.hp_pins[0] = 0x1b;
3669 spec->autocfg.speaker_pins[0] = 0x17;
3678 * Built-in Mic-In: 0x19
3684 static struct hda_input_mux alc880_lg_lw_capture_source = {
3688 { "Internal Mic", 0x1 },
3693 #define alc880_lg_lw_modes alc880_threestack_modes
3695 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3696 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3697 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3698 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3699 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3700 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3701 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3702 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3703 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3704 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3705 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3706 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3707 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3708 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3709 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3711 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3712 .name = "Channel Mode",
3713 .info = alc_ch_mode_info,
3714 .get = alc_ch_mode_get,
3715 .put = alc_ch_mode_put,
3720 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3721 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3722 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3723 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3725 /* set capture source to mic-in */
3726 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3727 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3728 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3731 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3732 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3734 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3735 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3736 /* mic-in to input */
3737 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3738 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3740 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3741 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3743 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3747 /* toggle speaker-output according to the hp-jack state */
3748 static void alc880_lg_lw_setup(struct hda_codec *codec)
3750 struct alc_spec *spec = codec->spec;
3752 spec->autocfg.hp_pins[0] = 0x1b;
3753 spec->autocfg.speaker_pins[0] = 0x14;
3756 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3757 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3758 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3760 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3761 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3762 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3766 static struct hda_input_mux alc880_medion_rim_capture_source = {
3770 { "Internal Mic", 0x1 },
3774 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3775 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3777 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3778 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3780 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3781 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3782 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3783 /* Mic2 (as headphone out) for HP output */
3784 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3785 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3786 /* Internal Speaker */
3787 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3788 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3790 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3791 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3793 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3797 /* toggle speaker-output according to the hp-jack state */
3798 static void alc880_medion_rim_automute(struct hda_codec *codec)
3800 struct alc_spec *spec = codec->spec;
3801 alc_automute_amp(codec);
3803 if (spec->jack_present)
3804 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3806 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3809 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3812 /* Looks like the unsol event is incompatible with the standard
3813 * definition. 4bit tag is placed at 28 bit!
3815 if ((res >> 28) == ALC880_HP_EVENT)
3816 alc880_medion_rim_automute(codec);
3819 static void alc880_medion_rim_setup(struct hda_codec *codec)
3821 struct alc_spec *spec = codec->spec;
3823 spec->autocfg.hp_pins[0] = 0x14;
3824 spec->autocfg.speaker_pins[0] = 0x1b;
3827 #ifdef CONFIG_SND_HDA_POWER_SAVE
3828 static struct hda_amp_list alc880_loopbacks[] = {
3829 { 0x0b, HDA_INPUT, 0 },
3830 { 0x0b, HDA_INPUT, 1 },
3831 { 0x0b, HDA_INPUT, 2 },
3832 { 0x0b, HDA_INPUT, 3 },
3833 { 0x0b, HDA_INPUT, 4 },
3837 static struct hda_amp_list alc880_lg_loopbacks[] = {
3838 { 0x0b, HDA_INPUT, 1 },
3839 { 0x0b, HDA_INPUT, 6 },
3840 { 0x0b, HDA_INPUT, 7 },
3849 static int alc_init(struct hda_codec *codec)
3851 struct alc_spec *spec = codec->spec;
3855 alc_auto_init_amp(codec, spec->init_amp);
3857 for (i = 0; i < spec->num_init_verbs; i++)
3858 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3860 if (spec->init_hook)
3861 spec->init_hook(codec);
3863 hda_call_check_power_status(codec, 0x01);
3867 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3869 struct alc_spec *spec = codec->spec;
3871 if (spec->unsol_event)
3872 spec->unsol_event(codec, res);
3875 #ifdef CONFIG_SND_HDA_POWER_SAVE
3876 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3878 struct alc_spec *spec = codec->spec;
3879 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3884 * Analog playback callbacks
3886 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3887 struct hda_codec *codec,
3888 struct snd_pcm_substream *substream)
3890 struct alc_spec *spec = codec->spec;
3891 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3895 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3896 struct hda_codec *codec,
3897 unsigned int stream_tag,
3898 unsigned int format,
3899 struct snd_pcm_substream *substream)
3901 struct alc_spec *spec = codec->spec;
3902 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3903 stream_tag, format, substream);
3906 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3907 struct hda_codec *codec,
3908 struct snd_pcm_substream *substream)
3910 struct alc_spec *spec = codec->spec;
3911 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3917 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3918 struct hda_codec *codec,
3919 struct snd_pcm_substream *substream)
3921 struct alc_spec *spec = codec->spec;
3922 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3925 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3926 struct hda_codec *codec,
3927 unsigned int stream_tag,
3928 unsigned int format,
3929 struct snd_pcm_substream *substream)
3931 struct alc_spec *spec = codec->spec;
3932 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3933 stream_tag, format, substream);
3936 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3937 struct hda_codec *codec,
3938 struct snd_pcm_substream *substream)
3940 struct alc_spec *spec = codec->spec;
3941 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3944 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3945 struct hda_codec *codec,
3946 struct snd_pcm_substream *substream)
3948 struct alc_spec *spec = codec->spec;
3949 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3955 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3956 struct hda_codec *codec,
3957 unsigned int stream_tag,
3958 unsigned int format,
3959 struct snd_pcm_substream *substream)
3961 struct alc_spec *spec = codec->spec;
3963 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3964 stream_tag, 0, format);
3968 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3969 struct hda_codec *codec,
3970 struct snd_pcm_substream *substream)
3972 struct alc_spec *spec = codec->spec;
3974 snd_hda_codec_cleanup_stream(codec,
3975 spec->adc_nids[substream->number + 1]);
3979 /* analog capture with dynamic dual-adc changes */
3980 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3981 struct hda_codec *codec,
3982 unsigned int stream_tag,
3983 unsigned int format,
3984 struct snd_pcm_substream *substream)
3986 struct alc_spec *spec = codec->spec;
3987 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
3988 spec->cur_adc_stream_tag = stream_tag;
3989 spec->cur_adc_format = format;
3990 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
3994 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3995 struct hda_codec *codec,
3996 struct snd_pcm_substream *substream)
3998 struct alc_spec *spec = codec->spec;
3999 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
4004 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
4008 .nid = 0, /* fill later */
4010 .prepare = dualmic_capture_pcm_prepare,
4011 .cleanup = dualmic_capture_pcm_cleanup
4017 static struct hda_pcm_stream alc880_pcm_analog_playback = {
4021 /* NID is set in alc_build_pcms */
4023 .open = alc880_playback_pcm_open,
4024 .prepare = alc880_playback_pcm_prepare,
4025 .cleanup = alc880_playback_pcm_cleanup
4029 static struct hda_pcm_stream alc880_pcm_analog_capture = {
4033 /* NID is set in alc_build_pcms */
4036 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4040 /* NID is set in alc_build_pcms */
4043 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4044 .substreams = 2, /* can be overridden */
4047 /* NID is set in alc_build_pcms */
4049 .prepare = alc880_alt_capture_pcm_prepare,
4050 .cleanup = alc880_alt_capture_pcm_cleanup
4054 static struct hda_pcm_stream alc880_pcm_digital_playback = {
4058 /* NID is set in alc_build_pcms */
4060 .open = alc880_dig_playback_pcm_open,
4061 .close = alc880_dig_playback_pcm_close,
4062 .prepare = alc880_dig_playback_pcm_prepare,
4063 .cleanup = alc880_dig_playback_pcm_cleanup
4067 static struct hda_pcm_stream alc880_pcm_digital_capture = {
4071 /* NID is set in alc_build_pcms */
4074 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4075 static struct hda_pcm_stream alc_pcm_null_stream = {
4081 static int alc_build_pcms(struct hda_codec *codec)
4083 struct alc_spec *spec = codec->spec;
4084 struct hda_pcm *info = spec->pcm_rec;
4087 codec->num_pcms = 1;
4088 codec->pcm_info = info;
4090 if (spec->no_analog)
4093 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4094 "%s Analog", codec->chip_name);
4095 info->name = spec->stream_name_analog;
4097 if (spec->stream_analog_playback) {
4098 if (snd_BUG_ON(!spec->multiout.dac_nids))
4100 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4101 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4103 if (spec->stream_analog_capture) {
4104 if (snd_BUG_ON(!spec->adc_nids))
4106 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4107 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4110 if (spec->channel_mode) {
4111 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4112 for (i = 0; i < spec->num_channel_mode; i++) {
4113 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4114 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4120 /* SPDIF for stream index #1 */
4121 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4122 snprintf(spec->stream_name_digital,
4123 sizeof(spec->stream_name_digital),
4124 "%s Digital", codec->chip_name);
4125 codec->num_pcms = 2;
4126 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4127 info = spec->pcm_rec + 1;
4128 info->name = spec->stream_name_digital;
4129 if (spec->dig_out_type)
4130 info->pcm_type = spec->dig_out_type;
4132 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4133 if (spec->multiout.dig_out_nid &&
4134 spec->stream_digital_playback) {
4135 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4136 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4138 if (spec->dig_in_nid &&
4139 spec->stream_digital_capture) {
4140 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4141 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4143 /* FIXME: do we need this for all Realtek codec models? */
4144 codec->spdif_status_reset = 1;
4147 if (spec->no_analog)
4150 /* If the use of more than one ADC is requested for the current
4151 * model, configure a second analog capture-only PCM.
4153 /* Additional Analaog capture for index #2 */
4154 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4155 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4156 codec->num_pcms = 3;
4157 info = spec->pcm_rec + 2;
4158 info->name = spec->stream_name_analog;
4159 if (spec->alt_dac_nid) {
4160 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4161 *spec->stream_analog_alt_playback;
4162 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4165 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4166 alc_pcm_null_stream;
4167 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4169 if (spec->num_adc_nids > 1) {
4170 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4171 *spec->stream_analog_alt_capture;
4172 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4174 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4175 spec->num_adc_nids - 1;
4177 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4178 alc_pcm_null_stream;
4179 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4186 static inline void alc_shutup(struct hda_codec *codec)
4188 snd_hda_shutup_pins(codec);
4191 static void alc_free_kctls(struct hda_codec *codec)
4193 struct alc_spec *spec = codec->spec;
4195 if (spec->kctls.list) {
4196 struct snd_kcontrol_new *kctl = spec->kctls.list;
4198 for (i = 0; i < spec->kctls.used; i++)
4199 kfree(kctl[i].name);
4201 snd_array_free(&spec->kctls);
4204 static void alc_free(struct hda_codec *codec)
4206 struct alc_spec *spec = codec->spec;
4212 alc_free_kctls(codec);
4214 snd_hda_detach_beep_device(codec);
4217 #ifdef CONFIG_SND_HDA_POWER_SAVE
4218 static void alc_power_eapd(struct hda_codec *codec)
4220 /* We currently only handle front, HP */
4221 switch (codec->vendor_id) {
4223 set_eapd(codec, 0x0f, 0);
4224 set_eapd(codec, 0x10, 0);
4237 set_eapd(codec, 0x14, 0);
4238 set_eapd(codec, 0x15, 0);
4243 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4245 struct alc_spec *spec = codec->spec;
4247 if (spec && spec->power_hook)
4248 spec->power_hook(codec);
4253 #ifdef SND_HDA_NEEDS_RESUME
4254 static int alc_resume(struct hda_codec *codec)
4256 codec->patch_ops.init(codec);
4257 snd_hda_codec_resume_amp(codec);
4258 snd_hda_codec_resume_cache(codec);
4259 hda_call_check_power_status(codec, 0x01);
4266 static struct hda_codec_ops alc_patch_ops = {
4267 .build_controls = alc_build_controls,
4268 .build_pcms = alc_build_pcms,
4271 .unsol_event = alc_unsol_event,
4272 #ifdef SND_HDA_NEEDS_RESUME
4273 .resume = alc_resume,
4275 #ifdef CONFIG_SND_HDA_POWER_SAVE
4276 .suspend = alc_suspend,
4277 .check_power_status = alc_check_power_status,
4279 .reboot_notify = alc_shutup,
4282 /* replace the codec chip_name with the given string */
4283 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4285 kfree(codec->chip_name);
4286 codec->chip_name = kstrdup(name, GFP_KERNEL);
4287 if (!codec->chip_name) {
4295 * Test configuration for debugging
4297 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4300 #ifdef CONFIG_SND_DEBUG
4301 static hda_nid_t alc880_test_dac_nids[4] = {
4302 0x02, 0x03, 0x04, 0x05
4305 static struct hda_input_mux alc880_test_capture_source = {
4314 { "Surround", 0x6 },
4318 static struct hda_channel_mode alc880_test_modes[4] = {
4325 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4326 struct snd_ctl_elem_info *uinfo)
4328 static char *texts[] = {
4329 "N/A", "Line Out", "HP Out",
4330 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4332 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4334 uinfo->value.enumerated.items = 8;
4335 if (uinfo->value.enumerated.item >= 8)
4336 uinfo->value.enumerated.item = 7;
4337 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4341 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4342 struct snd_ctl_elem_value *ucontrol)
4344 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4345 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4346 unsigned int pin_ctl, item = 0;
4348 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4349 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4350 if (pin_ctl & AC_PINCTL_OUT_EN) {
4351 if (pin_ctl & AC_PINCTL_HP_EN)
4355 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4356 switch (pin_ctl & AC_PINCTL_VREFEN) {
4357 case AC_PINCTL_VREF_HIZ: item = 3; break;
4358 case AC_PINCTL_VREF_50: item = 4; break;
4359 case AC_PINCTL_VREF_GRD: item = 5; break;
4360 case AC_PINCTL_VREF_80: item = 6; break;
4361 case AC_PINCTL_VREF_100: item = 7; break;
4364 ucontrol->value.enumerated.item[0] = item;
4368 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4369 struct snd_ctl_elem_value *ucontrol)
4371 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4372 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4373 static unsigned int ctls[] = {
4374 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4375 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4376 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4377 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4378 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4379 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4381 unsigned int old_ctl, new_ctl;
4383 old_ctl = snd_hda_codec_read(codec, nid, 0,
4384 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4385 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4386 if (old_ctl != new_ctl) {
4388 snd_hda_codec_write_cache(codec, nid, 0,
4389 AC_VERB_SET_PIN_WIDGET_CONTROL,
4391 val = ucontrol->value.enumerated.item[0] >= 3 ?
4393 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4400 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4401 struct snd_ctl_elem_info *uinfo)
4403 static char *texts[] = {
4404 "Front", "Surround", "CLFE", "Side"
4406 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4408 uinfo->value.enumerated.items = 4;
4409 if (uinfo->value.enumerated.item >= 4)
4410 uinfo->value.enumerated.item = 3;
4411 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4415 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4416 struct snd_ctl_elem_value *ucontrol)
4418 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4419 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4422 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4423 ucontrol->value.enumerated.item[0] = sel & 3;
4427 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4428 struct snd_ctl_elem_value *ucontrol)
4430 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4431 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4434 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4435 if (ucontrol->value.enumerated.item[0] != sel) {
4436 sel = ucontrol->value.enumerated.item[0] & 3;
4437 snd_hda_codec_write_cache(codec, nid, 0,
4438 AC_VERB_SET_CONNECT_SEL, sel);
4444 #define PIN_CTL_TEST(xname,nid) { \
4445 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4447 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4448 .info = alc_test_pin_ctl_info, \
4449 .get = alc_test_pin_ctl_get, \
4450 .put = alc_test_pin_ctl_put, \
4451 .private_value = nid \
4454 #define PIN_SRC_TEST(xname,nid) { \
4455 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4457 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4458 .info = alc_test_pin_src_info, \
4459 .get = alc_test_pin_src_get, \
4460 .put = alc_test_pin_src_put, \
4461 .private_value = nid \
4464 static struct snd_kcontrol_new alc880_test_mixer[] = {
4465 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4466 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4467 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4468 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4469 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4470 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4471 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4472 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4473 PIN_CTL_TEST("Front Pin Mode", 0x14),
4474 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4475 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4476 PIN_CTL_TEST("Side Pin Mode", 0x17),
4477 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4478 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4479 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4480 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4481 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4482 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4483 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4484 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4485 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4486 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4487 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4488 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4489 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4490 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4491 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4492 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4493 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4494 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4496 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4497 .name = "Channel Mode",
4498 .info = alc_ch_mode_info,
4499 .get = alc_ch_mode_get,
4500 .put = alc_ch_mode_put,
4505 static struct hda_verb alc880_test_init_verbs[] = {
4506 /* Unmute inputs of 0x0c - 0x0f */
4507 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4509 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4510 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4511 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4512 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4513 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4514 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4515 /* Vol output for 0x0c-0x0f */
4516 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4517 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4518 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4519 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4520 /* Set output pins 0x14-0x17 */
4521 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4523 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4524 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4525 /* Unmute output pins 0x14-0x17 */
4526 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4527 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4528 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4529 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4530 /* Set input pins 0x18-0x1c */
4531 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4532 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4533 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4534 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4535 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4536 /* Mute input pins 0x18-0x1b */
4537 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4538 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4539 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4540 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4542 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4543 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4544 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4545 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4546 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4547 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4548 /* Analog input/passthru */
4549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4551 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4552 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4553 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4561 static const char *alc880_models[ALC880_MODEL_LAST] = {
4562 [ALC880_3ST] = "3stack",
4563 [ALC880_TCL_S700] = "tcl",
4564 [ALC880_3ST_DIG] = "3stack-digout",
4565 [ALC880_CLEVO] = "clevo",
4566 [ALC880_5ST] = "5stack",
4567 [ALC880_5ST_DIG] = "5stack-digout",
4568 [ALC880_W810] = "w810",
4569 [ALC880_Z71V] = "z71v",
4570 [ALC880_6ST] = "6stack",
4571 [ALC880_6ST_DIG] = "6stack-digout",
4572 [ALC880_ASUS] = "asus",
4573 [ALC880_ASUS_W1V] = "asus-w1v",
4574 [ALC880_ASUS_DIG] = "asus-dig",
4575 [ALC880_ASUS_DIG2] = "asus-dig2",
4576 [ALC880_UNIWILL_DIG] = "uniwill",
4577 [ALC880_UNIWILL_P53] = "uniwill-p53",
4578 [ALC880_FUJITSU] = "fujitsu",
4579 [ALC880_F1734] = "F1734",
4581 [ALC880_LG_LW] = "lg-lw",
4582 [ALC880_MEDION_RIM] = "medion",
4583 #ifdef CONFIG_SND_DEBUG
4584 [ALC880_TEST] = "test",
4586 [ALC880_AUTO] = "auto",
4589 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4590 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4591 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4592 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4593 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4594 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4595 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4596 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4597 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4598 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4599 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4600 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4601 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4602 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4603 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4604 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4605 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4606 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4607 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4608 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4609 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4610 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4611 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4612 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4613 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4614 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4615 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4616 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4617 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4618 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4619 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4620 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4621 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4622 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4623 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4624 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4625 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4626 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4627 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4628 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4629 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4630 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4631 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4632 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4633 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4634 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4635 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4636 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4637 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4638 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4639 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4640 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4641 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4642 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4643 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
4644 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4645 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4646 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4647 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4648 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4649 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4650 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4651 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4652 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4653 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4654 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4655 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4656 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4657 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4658 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4660 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4661 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4662 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4667 * ALC880 codec presets
4669 static struct alc_config_preset alc880_presets[] = {
4671 .mixers = { alc880_three_stack_mixer },
4672 .init_verbs = { alc880_volume_init_verbs,
4673 alc880_pin_3stack_init_verbs },
4674 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4675 .dac_nids = alc880_dac_nids,
4676 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4677 .channel_mode = alc880_threestack_modes,
4679 .input_mux = &alc880_capture_source,
4681 [ALC880_3ST_DIG] = {
4682 .mixers = { alc880_three_stack_mixer },
4683 .init_verbs = { alc880_volume_init_verbs,
4684 alc880_pin_3stack_init_verbs },
4685 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4686 .dac_nids = alc880_dac_nids,
4687 .dig_out_nid = ALC880_DIGOUT_NID,
4688 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4689 .channel_mode = alc880_threestack_modes,
4691 .input_mux = &alc880_capture_source,
4693 [ALC880_TCL_S700] = {
4694 .mixers = { alc880_tcl_s700_mixer },
4695 .init_verbs = { alc880_volume_init_verbs,
4696 alc880_pin_tcl_S700_init_verbs,
4697 alc880_gpio2_init_verbs },
4698 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4699 .dac_nids = alc880_dac_nids,
4700 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4701 .num_adc_nids = 1, /* single ADC */
4703 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4704 .channel_mode = alc880_2_jack_modes,
4705 .input_mux = &alc880_capture_source,
4708 .mixers = { alc880_three_stack_mixer,
4709 alc880_five_stack_mixer},
4710 .init_verbs = { alc880_volume_init_verbs,
4711 alc880_pin_5stack_init_verbs },
4712 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4713 .dac_nids = alc880_dac_nids,
4714 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4715 .channel_mode = alc880_fivestack_modes,
4716 .input_mux = &alc880_capture_source,
4718 [ALC880_5ST_DIG] = {
4719 .mixers = { alc880_three_stack_mixer,
4720 alc880_five_stack_mixer },
4721 .init_verbs = { alc880_volume_init_verbs,
4722 alc880_pin_5stack_init_verbs },
4723 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4724 .dac_nids = alc880_dac_nids,
4725 .dig_out_nid = ALC880_DIGOUT_NID,
4726 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4727 .channel_mode = alc880_fivestack_modes,
4728 .input_mux = &alc880_capture_source,
4731 .mixers = { alc880_six_stack_mixer },
4732 .init_verbs = { alc880_volume_init_verbs,
4733 alc880_pin_6stack_init_verbs },
4734 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4735 .dac_nids = alc880_6st_dac_nids,
4736 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4737 .channel_mode = alc880_sixstack_modes,
4738 .input_mux = &alc880_6stack_capture_source,
4740 [ALC880_6ST_DIG] = {
4741 .mixers = { alc880_six_stack_mixer },
4742 .init_verbs = { alc880_volume_init_verbs,
4743 alc880_pin_6stack_init_verbs },
4744 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4745 .dac_nids = alc880_6st_dac_nids,
4746 .dig_out_nid = ALC880_DIGOUT_NID,
4747 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4748 .channel_mode = alc880_sixstack_modes,
4749 .input_mux = &alc880_6stack_capture_source,
4752 .mixers = { alc880_w810_base_mixer },
4753 .init_verbs = { alc880_volume_init_verbs,
4754 alc880_pin_w810_init_verbs,
4755 alc880_gpio2_init_verbs },
4756 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4757 .dac_nids = alc880_w810_dac_nids,
4758 .dig_out_nid = ALC880_DIGOUT_NID,
4759 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4760 .channel_mode = alc880_w810_modes,
4761 .input_mux = &alc880_capture_source,
4764 .mixers = { alc880_z71v_mixer },
4765 .init_verbs = { alc880_volume_init_verbs,
4766 alc880_pin_z71v_init_verbs },
4767 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4768 .dac_nids = alc880_z71v_dac_nids,
4769 .dig_out_nid = ALC880_DIGOUT_NID,
4771 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4772 .channel_mode = alc880_2_jack_modes,
4773 .input_mux = &alc880_capture_source,
4776 .mixers = { alc880_f1734_mixer },
4777 .init_verbs = { alc880_volume_init_verbs,
4778 alc880_pin_f1734_init_verbs },
4779 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4780 .dac_nids = alc880_f1734_dac_nids,
4782 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4783 .channel_mode = alc880_2_jack_modes,
4784 .input_mux = &alc880_f1734_capture_source,
4785 .unsol_event = alc880_uniwill_p53_unsol_event,
4786 .setup = alc880_uniwill_p53_setup,
4787 .init_hook = alc_automute_amp,
4790 .mixers = { alc880_asus_mixer },
4791 .init_verbs = { alc880_volume_init_verbs,
4792 alc880_pin_asus_init_verbs,
4793 alc880_gpio1_init_verbs },
4794 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4795 .dac_nids = alc880_asus_dac_nids,
4796 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4797 .channel_mode = alc880_asus_modes,
4799 .input_mux = &alc880_capture_source,
4801 [ALC880_ASUS_DIG] = {
4802 .mixers = { alc880_asus_mixer },
4803 .init_verbs = { alc880_volume_init_verbs,
4804 alc880_pin_asus_init_verbs,
4805 alc880_gpio1_init_verbs },
4806 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4807 .dac_nids = alc880_asus_dac_nids,
4808 .dig_out_nid = ALC880_DIGOUT_NID,
4809 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4810 .channel_mode = alc880_asus_modes,
4812 .input_mux = &alc880_capture_source,
4814 [ALC880_ASUS_DIG2] = {
4815 .mixers = { alc880_asus_mixer },
4816 .init_verbs = { alc880_volume_init_verbs,
4817 alc880_pin_asus_init_verbs,
4818 alc880_gpio2_init_verbs }, /* use GPIO2 */
4819 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4820 .dac_nids = alc880_asus_dac_nids,
4821 .dig_out_nid = ALC880_DIGOUT_NID,
4822 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4823 .channel_mode = alc880_asus_modes,
4825 .input_mux = &alc880_capture_source,
4827 [ALC880_ASUS_W1V] = {
4828 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4829 .init_verbs = { alc880_volume_init_verbs,
4830 alc880_pin_asus_init_verbs,
4831 alc880_gpio1_init_verbs },
4832 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4833 .dac_nids = alc880_asus_dac_nids,
4834 .dig_out_nid = ALC880_DIGOUT_NID,
4835 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4836 .channel_mode = alc880_asus_modes,
4838 .input_mux = &alc880_capture_source,
4840 [ALC880_UNIWILL_DIG] = {
4841 .mixers = { alc880_asus_mixer },
4842 .init_verbs = { alc880_volume_init_verbs,
4843 alc880_pin_asus_init_verbs },
4844 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4845 .dac_nids = alc880_asus_dac_nids,
4846 .dig_out_nid = ALC880_DIGOUT_NID,
4847 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4848 .channel_mode = alc880_asus_modes,
4850 .input_mux = &alc880_capture_source,
4852 [ALC880_UNIWILL] = {
4853 .mixers = { alc880_uniwill_mixer },
4854 .init_verbs = { alc880_volume_init_verbs,
4855 alc880_uniwill_init_verbs },
4856 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4857 .dac_nids = alc880_asus_dac_nids,
4858 .dig_out_nid = ALC880_DIGOUT_NID,
4859 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4860 .channel_mode = alc880_threestack_modes,
4862 .input_mux = &alc880_capture_source,
4863 .unsol_event = alc880_uniwill_unsol_event,
4864 .setup = alc880_uniwill_setup,
4865 .init_hook = alc880_uniwill_init_hook,
4867 [ALC880_UNIWILL_P53] = {
4868 .mixers = { alc880_uniwill_p53_mixer },
4869 .init_verbs = { alc880_volume_init_verbs,
4870 alc880_uniwill_p53_init_verbs },
4871 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4872 .dac_nids = alc880_asus_dac_nids,
4873 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4874 .channel_mode = alc880_threestack_modes,
4875 .input_mux = &alc880_capture_source,
4876 .unsol_event = alc880_uniwill_p53_unsol_event,
4877 .setup = alc880_uniwill_p53_setup,
4878 .init_hook = alc_automute_amp,
4880 [ALC880_FUJITSU] = {
4881 .mixers = { alc880_fujitsu_mixer },
4882 .init_verbs = { alc880_volume_init_verbs,
4883 alc880_uniwill_p53_init_verbs,
4884 alc880_beep_init_verbs },
4885 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4886 .dac_nids = alc880_dac_nids,
4887 .dig_out_nid = ALC880_DIGOUT_NID,
4888 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4889 .channel_mode = alc880_2_jack_modes,
4890 .input_mux = &alc880_capture_source,
4891 .unsol_event = alc880_uniwill_p53_unsol_event,
4892 .setup = alc880_uniwill_p53_setup,
4893 .init_hook = alc_automute_amp,
4896 .mixers = { alc880_three_stack_mixer },
4897 .init_verbs = { alc880_volume_init_verbs,
4898 alc880_pin_clevo_init_verbs },
4899 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4900 .dac_nids = alc880_dac_nids,
4902 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4903 .channel_mode = alc880_threestack_modes,
4905 .input_mux = &alc880_capture_source,
4908 .mixers = { alc880_lg_mixer },
4909 .init_verbs = { alc880_volume_init_verbs,
4910 alc880_lg_init_verbs },
4911 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4912 .dac_nids = alc880_lg_dac_nids,
4913 .dig_out_nid = ALC880_DIGOUT_NID,
4914 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4915 .channel_mode = alc880_lg_ch_modes,
4917 .input_mux = &alc880_lg_capture_source,
4918 .unsol_event = alc_automute_amp_unsol_event,
4919 .setup = alc880_lg_setup,
4920 .init_hook = alc_automute_amp,
4921 #ifdef CONFIG_SND_HDA_POWER_SAVE
4922 .loopbacks = alc880_lg_loopbacks,
4926 .mixers = { alc880_lg_lw_mixer },
4927 .init_verbs = { alc880_volume_init_verbs,
4928 alc880_lg_lw_init_verbs },
4929 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4930 .dac_nids = alc880_dac_nids,
4931 .dig_out_nid = ALC880_DIGOUT_NID,
4932 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4933 .channel_mode = alc880_lg_lw_modes,
4934 .input_mux = &alc880_lg_lw_capture_source,
4935 .unsol_event = alc_automute_amp_unsol_event,
4936 .setup = alc880_lg_lw_setup,
4937 .init_hook = alc_automute_amp,
4939 [ALC880_MEDION_RIM] = {
4940 .mixers = { alc880_medion_rim_mixer },
4941 .init_verbs = { alc880_volume_init_verbs,
4942 alc880_medion_rim_init_verbs,
4943 alc_gpio2_init_verbs },
4944 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4945 .dac_nids = alc880_dac_nids,
4946 .dig_out_nid = ALC880_DIGOUT_NID,
4947 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4948 .channel_mode = alc880_2_jack_modes,
4949 .input_mux = &alc880_medion_rim_capture_source,
4950 .unsol_event = alc880_medion_rim_unsol_event,
4951 .setup = alc880_medion_rim_setup,
4952 .init_hook = alc880_medion_rim_automute,
4954 #ifdef CONFIG_SND_DEBUG
4956 .mixers = { alc880_test_mixer },
4957 .init_verbs = { alc880_test_init_verbs },
4958 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4959 .dac_nids = alc880_test_dac_nids,
4960 .dig_out_nid = ALC880_DIGOUT_NID,
4961 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4962 .channel_mode = alc880_test_modes,
4963 .input_mux = &alc880_test_capture_source,
4969 * Automatic parse of I/O pins from the BIOS configuration
4974 ALC_CTL_WIDGET_MUTE,
4977 static struct snd_kcontrol_new alc880_control_templates[] = {
4978 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4979 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4980 HDA_BIND_MUTE(NULL, 0, 0, 0),
4983 /* add dynamic controls */
4984 static int add_control(struct alc_spec *spec, int type, const char *name,
4985 int cidx, unsigned long val)
4987 struct snd_kcontrol_new *knew;
4989 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4990 knew = snd_array_new(&spec->kctls);
4993 *knew = alc880_control_templates[type];
4994 knew->name = kstrdup(name, GFP_KERNEL);
4998 if (get_amp_nid_(val))
4999 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
5000 knew->private_value = val;
5004 static int add_control_with_pfx(struct alc_spec *spec, int type,
5005 const char *pfx, const char *dir,
5006 const char *sfx, int cidx, unsigned long val)
5009 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
5010 return add_control(spec, type, name, cidx, val);
5013 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5014 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5015 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5016 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5017 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5018 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5019 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5020 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5022 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5023 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5024 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5025 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5026 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5027 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5028 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5029 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5030 #define ALC880_PIN_CD_NID 0x1c
5032 /* fill in the dac_nids table from the parsed pin configuration */
5033 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
5034 const struct auto_pin_cfg *cfg)
5040 memset(assigned, 0, sizeof(assigned));
5041 spec->multiout.dac_nids = spec->private_dac_nids;
5043 /* check the pins hardwired to audio widget */
5044 for (i = 0; i < cfg->line_outs; i++) {
5045 nid = cfg->line_out_pins[i];
5046 if (alc880_is_fixed_pin(nid)) {
5047 int idx = alc880_fixed_pin_idx(nid);
5048 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
5052 /* left pins can be connect to any audio widget */
5053 for (i = 0; i < cfg->line_outs; i++) {
5054 nid = cfg->line_out_pins[i];
5055 if (alc880_is_fixed_pin(nid))
5057 /* search for an empty channel */
5058 for (j = 0; j < cfg->line_outs; j++) {
5060 spec->multiout.dac_nids[i] =
5061 alc880_idx_to_dac(j);
5067 spec->multiout.num_dacs = cfg->line_outs;
5071 /* add playback controls from the parsed DAC table */
5072 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5073 const struct auto_pin_cfg *cfg)
5075 static const char *chname[4] = {
5076 "Front", "Surround", NULL /*CLFE*/, "Side"
5081 for (i = 0; i < cfg->line_outs; i++) {
5082 if (!spec->multiout.dac_nids[i])
5084 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5087 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5089 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5093 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5095 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5099 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5101 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5105 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5107 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5113 if (cfg->line_outs == 1 &&
5114 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
5118 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5119 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5123 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5124 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5133 /* add playback controls for speaker and HP outputs */
5134 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5143 if (alc880_is_fixed_pin(pin)) {
5144 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5145 /* specify the DAC as the extra output */
5146 if (!spec->multiout.hp_nid)
5147 spec->multiout.hp_nid = nid;
5149 spec->multiout.extra_out_nid[0] = nid;
5150 /* control HP volume/switch on the output mixer amp */
5151 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5152 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5153 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5156 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5157 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5160 } else if (alc880_is_multi_pin(pin)) {
5161 /* set manual connection */
5162 /* we have only a switch on HP-out PIN */
5163 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5164 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5171 /* create input playback/capture controls for the given pin */
5172 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5173 const char *ctlname, int ctlidx,
5174 int idx, hda_nid_t mix_nid)
5178 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5179 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5182 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5183 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5189 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5191 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5192 return (pincap & AC_PINCAP_IN) != 0;
5195 /* create playback/capture controls for input pins */
5196 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5197 const struct auto_pin_cfg *cfg,
5199 hda_nid_t cap1, hda_nid_t cap2)
5201 struct alc_spec *spec = codec->spec;
5202 struct hda_input_mux *imux = &spec->private_imux[0];
5203 int i, err, idx, type, type_idx = 0;
5205 for (i = 0; i < cfg->num_inputs; i++) {
5209 pin = cfg->inputs[i].pin;
5210 if (!alc_is_input_pin(codec, pin))
5213 type = cfg->inputs[i].type;
5214 if (i > 0 && type == cfg->inputs[i - 1].type)
5218 label = hda_get_autocfg_input_label(codec, cfg, i);
5220 idx = get_connection_index(codec, mixer, pin);
5222 err = new_analog_input(spec, pin,
5232 idx = get_connection_index(codec, cap1, pin);
5233 if (idx < 0 && cap2)
5234 idx = get_connection_index(codec, cap2, pin);
5236 snd_hda_add_imux_item(imux, label, idx, NULL);
5241 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5242 const struct auto_pin_cfg *cfg)
5244 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5247 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5248 unsigned int pin_type)
5250 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5253 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5257 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5258 hda_nid_t nid, int pin_type,
5261 alc_set_pin_output(codec, nid, pin_type);
5262 /* need the manual connection? */
5263 if (alc880_is_multi_pin(nid)) {
5264 struct alc_spec *spec = codec->spec;
5265 int idx = alc880_multi_pin_idx(nid);
5266 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5267 AC_VERB_SET_CONNECT_SEL,
5268 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5272 static int get_pin_type(int line_out_type)
5274 if (line_out_type == AUTO_PIN_HP_OUT)
5280 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5282 struct alc_spec *spec = codec->spec;
5285 for (i = 0; i < spec->autocfg.line_outs; i++) {
5286 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5287 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5288 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5292 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5294 struct alc_spec *spec = codec->spec;
5297 pin = spec->autocfg.speaker_pins[0];
5298 if (pin) /* connect to front */
5299 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5300 pin = spec->autocfg.hp_pins[0];
5301 if (pin) /* connect to front */
5302 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5305 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5307 struct alc_spec *spec = codec->spec;
5308 struct auto_pin_cfg *cfg = &spec->autocfg;
5311 for (i = 0; i < cfg->num_inputs; i++) {
5312 hda_nid_t nid = cfg->inputs[i].pin;
5313 if (alc_is_input_pin(codec, nid)) {
5314 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5315 if (nid != ALC880_PIN_CD_NID &&
5316 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5317 snd_hda_codec_write(codec, nid, 0,
5318 AC_VERB_SET_AMP_GAIN_MUTE,
5324 static void alc880_auto_init_input_src(struct hda_codec *codec)
5326 struct alc_spec *spec = codec->spec;
5329 for (c = 0; c < spec->num_adc_nids; c++) {
5330 unsigned int mux_idx;
5331 const struct hda_input_mux *imux;
5332 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5333 imux = &spec->input_mux[mux_idx];
5334 if (!imux->num_items && mux_idx > 0)
5335 imux = &spec->input_mux[0];
5337 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5338 AC_VERB_SET_CONNECT_SEL,
5339 imux->items[0].index);
5343 /* parse the BIOS configuration and set up the alc_spec */
5344 /* return 1 if successful, 0 if the proper config is not found,
5345 * or a negative error code
5347 static int alc880_parse_auto_config(struct hda_codec *codec)
5349 struct alc_spec *spec = codec->spec;
5351 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5353 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5357 if (!spec->autocfg.line_outs)
5358 return 0; /* can't find valid BIOS pin config */
5360 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5363 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5366 err = alc880_auto_create_extra_out(spec,
5367 spec->autocfg.speaker_pins[0],
5371 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5375 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5379 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5381 alc_auto_parse_digital(codec);
5383 if (spec->kctls.list)
5384 add_mixer(spec, spec->kctls.list);
5386 add_verb(spec, alc880_volume_init_verbs);
5388 spec->num_mux_defs = 1;
5389 spec->input_mux = &spec->private_imux[0];
5391 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5396 /* additional initialization for auto-configuration model */
5397 static void alc880_auto_init(struct hda_codec *codec)
5399 struct alc_spec *spec = codec->spec;
5400 alc880_auto_init_multi_out(codec);
5401 alc880_auto_init_extra_out(codec);
5402 alc880_auto_init_analog_input(codec);
5403 alc880_auto_init_input_src(codec);
5404 alc_auto_init_digital(codec);
5405 if (spec->unsol_event)
5406 alc_inithook(codec);
5409 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5410 * one of two digital mic pins, e.g. on ALC272
5412 static void fixup_automic_adc(struct hda_codec *codec)
5414 struct alc_spec *spec = codec->spec;
5417 for (i = 0; i < spec->num_adc_nids; i++) {
5418 hda_nid_t cap = spec->capsrc_nids ?
5419 spec->capsrc_nids[i] : spec->adc_nids[i];
5422 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5425 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5428 spec->int_mic.mux_idx = iidx;
5429 spec->ext_mic.mux_idx = eidx;
5430 if (spec->capsrc_nids)
5431 spec->capsrc_nids += i;
5432 spec->adc_nids += i;
5433 spec->num_adc_nids = 1;
5436 snd_printd(KERN_INFO "hda_codec: %s: "
5437 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5438 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5439 spec->auto_mic = 0; /* disable auto-mic to be sure */
5442 /* select or unmute the given capsrc route */
5443 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5446 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5447 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5450 snd_hda_codec_write_cache(codec, cap, 0,
5451 AC_VERB_SET_CONNECT_SEL, idx);
5455 /* set the default connection to that pin */
5456 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5458 struct alc_spec *spec = codec->spec;
5461 for (i = 0; i < spec->num_adc_nids; i++) {
5462 hda_nid_t cap = spec->capsrc_nids ?
5463 spec->capsrc_nids[i] : spec->adc_nids[i];
5466 idx = get_connection_index(codec, cap, pin);
5469 select_or_unmute_capsrc(codec, cap, idx);
5470 return i; /* return the found index */
5472 return -1; /* not found */
5475 /* choose the ADC/MUX containing the input pin and initialize the setup */
5476 static void fixup_single_adc(struct hda_codec *codec)
5478 struct alc_spec *spec = codec->spec;
5479 struct auto_pin_cfg *cfg = &spec->autocfg;
5482 /* search for the input pin; there must be only one */
5483 if (cfg->num_inputs != 1)
5485 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5487 /* use only this ADC */
5488 if (spec->capsrc_nids)
5489 spec->capsrc_nids += i;
5490 spec->adc_nids += i;
5491 spec->num_adc_nids = 1;
5495 /* initialize dual adcs */
5496 static void fixup_dual_adc_switch(struct hda_codec *codec)
5498 struct alc_spec *spec = codec->spec;
5499 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5500 init_capsrc_for_pin(codec, spec->int_mic.pin);
5503 static void set_capture_mixer(struct hda_codec *codec)
5505 struct alc_spec *spec = codec->spec;
5506 static struct snd_kcontrol_new *caps[2][3] = {
5507 { alc_capture_mixer_nosrc1,
5508 alc_capture_mixer_nosrc2,
5509 alc_capture_mixer_nosrc3 },
5510 { alc_capture_mixer1,
5512 alc_capture_mixer3 },
5514 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5516 int num_adcs = spec->num_adc_nids;
5517 if (spec->dual_adc_switch)
5518 fixup_dual_adc_switch(codec);
5519 else if (spec->auto_mic)
5520 fixup_automic_adc(codec);
5521 else if (spec->input_mux) {
5522 if (spec->input_mux->num_items > 1)
5524 else if (spec->input_mux->num_items == 1)
5525 fixup_single_adc(codec);
5527 if (spec->dual_adc_switch)
5529 spec->cap_mixer = caps[mux][num_adcs - 1];
5533 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5534 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5537 struct alc_spec *spec = codec->spec;
5538 struct auto_pin_cfg *cfg = &spec->autocfg;
5540 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5542 for (n = 0; n < num_nids; n++) {
5544 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5548 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5551 nconns = snd_hda_get_connections(codec, cap, conn,
5555 nconns = snd_hda_get_connections(codec, cap, conn,
5560 if (!fallback_adc) {
5564 for (i = 0; i < cfg->num_inputs; i++) {
5565 hda_nid_t nid = cfg->inputs[i].pin;
5566 for (j = 0; j < nconns; j++) {
5573 if (i >= cfg->num_inputs) {
5574 int num_adcs = spec->num_adc_nids;
5575 spec->private_adc_nids[num_adcs] = adc;
5576 spec->private_capsrc_nids[num_adcs] = cap;
5577 spec->num_adc_nids++;
5578 spec->adc_nids = spec->private_adc_nids;
5580 spec->capsrc_nids = spec->private_capsrc_nids;
5583 if (!spec->num_adc_nids) {
5584 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5585 " using fallback 0x%x\n",
5586 codec->chip_name, fallback_adc);
5587 spec->private_adc_nids[0] = fallback_adc;
5588 spec->adc_nids = spec->private_adc_nids;
5589 if (fallback_adc != fallback_cap) {
5590 spec->private_capsrc_nids[0] = fallback_cap;
5591 spec->capsrc_nids = spec->private_adc_nids;
5596 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5597 #define set_beep_amp(spec, nid, idx, dir) \
5598 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5600 static struct snd_pci_quirk beep_white_list[] = {
5601 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5602 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5603 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5607 static inline int has_cdefine_beep(struct hda_codec *codec)
5609 struct alc_spec *spec = codec->spec;
5610 const struct snd_pci_quirk *q;
5611 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5614 return spec->cdefine.enable_pcbeep;
5617 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5618 #define has_cdefine_beep(codec) 0
5622 * OK, here we have finally the patch for ALC880
5625 static int patch_alc880(struct hda_codec *codec)
5627 struct alc_spec *spec;
5631 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5637 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5640 if (board_config < 0) {
5641 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5643 board_config = ALC880_AUTO;
5646 if (board_config == ALC880_AUTO) {
5647 /* automatic parse from the BIOS config */
5648 err = alc880_parse_auto_config(codec);
5654 "hda_codec: Cannot set up configuration "
5655 "from BIOS. Using 3-stack mode...\n");
5656 board_config = ALC880_3ST;
5660 err = snd_hda_attach_beep_device(codec, 0x1);
5666 if (board_config != ALC880_AUTO)
5667 setup_preset(codec, &alc880_presets[board_config]);
5669 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5670 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5671 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5673 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5674 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5676 if (!spec->adc_nids && spec->input_mux) {
5677 /* check whether NID 0x07 is valid */
5678 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5680 wcap = get_wcaps_type(wcap);
5681 if (wcap != AC_WID_AUD_IN) {
5682 spec->adc_nids = alc880_adc_nids_alt;
5683 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5685 spec->adc_nids = alc880_adc_nids;
5686 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5689 set_capture_mixer(codec);
5690 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5692 spec->vmaster_nid = 0x0c;
5694 codec->patch_ops = alc_patch_ops;
5695 if (board_config == ALC880_AUTO)
5696 spec->init_hook = alc880_auto_init;
5697 #ifdef CONFIG_SND_HDA_POWER_SAVE
5698 if (!spec->loopback.amplist)
5699 spec->loopback.amplist = alc880_loopbacks;
5710 static hda_nid_t alc260_dac_nids[1] = {
5715 static hda_nid_t alc260_adc_nids[1] = {
5720 static hda_nid_t alc260_adc_nids_alt[1] = {
5725 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5726 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5728 static hda_nid_t alc260_dual_adc_nids[2] = {
5733 #define ALC260_DIGOUT_NID 0x03
5734 #define ALC260_DIGIN_NID 0x06
5736 static struct hda_input_mux alc260_capture_source = {
5740 { "Front Mic", 0x1 },
5746 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5747 * headphone jack and the internal CD lines since these are the only pins at
5748 * which audio can appear. For flexibility, also allow the option of
5749 * recording the mixer output on the second ADC (ADC0 doesn't have a
5750 * connection to the mixer output).
5752 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5756 { "Mic/Line", 0x0 },
5758 { "Headphone", 0x2 },
5764 { "Mic/Line", 0x0 },
5766 { "Headphone", 0x2 },
5773 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5774 * the Fujitsu S702x, but jacks are marked differently.
5776 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5783 { "Headphone", 0x5 },
5792 { "Headphone", 0x6 },
5798 /* Maxdata Favorit 100XS */
5799 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5803 { "Line/Mic", 0x0 },
5810 { "Line/Mic", 0x0 },
5818 * This is just place-holder, so there's something for alc_build_pcms to look
5819 * at when it calculates the maximum number of channels. ALC260 has no mixer
5820 * element which allows changing the channel mode, so the verb list is
5823 static struct hda_channel_mode alc260_modes[1] = {
5828 /* Mixer combinations
5830 * basic: base_output + input + pc_beep + capture
5831 * HP: base_output + input + capture_alt
5832 * HP_3013: hp_3013 + input + capture
5833 * fujitsu: fujitsu + capture
5834 * acer: acer + capture
5837 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5838 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5839 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5840 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5841 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5842 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5843 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5847 static struct snd_kcontrol_new alc260_input_mixer[] = {
5848 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5849 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5850 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5851 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5853 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5854 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5855 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5859 /* update HP, line and mono out pins according to the master switch */
5860 static void alc260_hp_master_update(struct hda_codec *codec,
5861 hda_nid_t hp, hda_nid_t line,
5864 struct alc_spec *spec = codec->spec;
5865 unsigned int val = spec->master_sw ? PIN_HP : 0;
5866 /* change HP and line-out pins */
5867 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5869 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5871 /* mono (speaker) depending on the HP jack sense */
5872 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5873 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5877 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5878 struct snd_ctl_elem_value *ucontrol)
5880 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5881 struct alc_spec *spec = codec->spec;
5882 *ucontrol->value.integer.value = spec->master_sw;
5886 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5887 struct snd_ctl_elem_value *ucontrol)
5889 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5890 struct alc_spec *spec = codec->spec;
5891 int val = !!*ucontrol->value.integer.value;
5892 hda_nid_t hp, line, mono;
5894 if (val == spec->master_sw)
5896 spec->master_sw = val;
5897 hp = (kcontrol->private_value >> 16) & 0xff;
5898 line = (kcontrol->private_value >> 8) & 0xff;
5899 mono = kcontrol->private_value & 0xff;
5900 alc260_hp_master_update(codec, hp, line, mono);
5904 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5906 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5907 .name = "Master Playback Switch",
5908 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5909 .info = snd_ctl_boolean_mono_info,
5910 .get = alc260_hp_master_sw_get,
5911 .put = alc260_hp_master_sw_put,
5912 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5914 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5915 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5916 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5917 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5918 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5920 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5924 static struct hda_verb alc260_hp_unsol_verbs[] = {
5925 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5929 static void alc260_hp_automute(struct hda_codec *codec)
5931 struct alc_spec *spec = codec->spec;
5933 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5934 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5937 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5939 if ((res >> 26) == ALC880_HP_EVENT)
5940 alc260_hp_automute(codec);
5943 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5945 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5946 .name = "Master Playback Switch",
5947 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5948 .info = snd_ctl_boolean_mono_info,
5949 .get = alc260_hp_master_sw_get,
5950 .put = alc260_hp_master_sw_put,
5951 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5953 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5954 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5955 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5956 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5957 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5958 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5959 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5960 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5964 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5965 .ops = &snd_hda_bind_vol,
5967 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5968 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5969 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5974 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5975 .ops = &snd_hda_bind_sw,
5977 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5978 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5983 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5984 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5985 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5986 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5987 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5991 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5992 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5996 static void alc260_hp_3013_automute(struct hda_codec *codec)
5998 struct alc_spec *spec = codec->spec;
6000 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
6001 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
6004 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
6007 if ((res >> 26) == ALC880_HP_EVENT)
6008 alc260_hp_3013_automute(codec);
6011 static void alc260_hp_3012_automute(struct hda_codec *codec)
6013 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6015 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6017 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6019 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6023 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6026 if ((res >> 26) == ALC880_HP_EVENT)
6027 alc260_hp_3012_automute(codec);
6030 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6031 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6033 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6034 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6035 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6036 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6037 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6038 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6039 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6040 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6041 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6042 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6043 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6047 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6048 * versions of the ALC260 don't act on requests to enable mic bias from NID
6049 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6050 * datasheet doesn't mention this restriction. At this stage it's not clear
6051 * whether this behaviour is intentional or is a hardware bug in chip
6052 * revisions available in early 2006. Therefore for now allow the
6053 * "Headphone Jack Mode" control to span all choices, but if it turns out
6054 * that the lack of mic bias for this NID is intentional we could change the
6055 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6057 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6058 * don't appear to make the mic bias available from the "line" jack, even
6059 * though the NID used for this jack (0x14) can supply it. The theory is
6060 * that perhaps Acer have included blocking capacitors between the ALC260
6061 * and the output jack. If this turns out to be the case for all such
6062 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6063 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6065 * The C20x Tablet series have a mono internal speaker which is controlled
6066 * via the chip's Mono sum widget and pin complex, so include the necessary
6067 * controls for such models. On models without a "mono speaker" the control
6068 * won't do anything.
6070 static struct snd_kcontrol_new alc260_acer_mixer[] = {
6071 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6072 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6073 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6074 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6076 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6078 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6079 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6080 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6081 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6082 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6083 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6084 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6085 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6089 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6091 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6092 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6093 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6094 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6095 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6096 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6097 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6101 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6102 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6104 static struct snd_kcontrol_new alc260_will_mixer[] = {
6105 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6106 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6108 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6109 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6110 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6111 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6112 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6113 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6114 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6118 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6119 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6121 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6122 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6123 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6125 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6126 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6127 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6128 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6129 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6130 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6131 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6136 * initialization verbs
6138 static struct hda_verb alc260_init_verbs[] = {
6139 /* Line In pin widget for input */
6140 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6141 /* CD pin widget for input */
6142 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6143 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6144 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6145 /* Mic2 (front panel) pin widget for input and vref at 80% */
6146 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6147 /* LINE-2 is used for line-out in rear */
6148 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6149 /* select line-out */
6150 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6152 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6154 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6156 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6157 /* mute capture amp left and right */
6158 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6159 /* set connection select to line in (default select for this ADC) */
6160 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6161 /* mute capture amp left and right */
6162 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6163 /* set connection select to line in (default select for this ADC) */
6164 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6165 /* set vol=0 Line-Out mixer amp left and right */
6166 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6167 /* unmute pin widget amp left and right (no gain on this amp) */
6168 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6169 /* set vol=0 HP mixer amp left and right */
6170 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6171 /* unmute pin widget amp left and right (no gain on this amp) */
6172 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6173 /* set vol=0 Mono mixer amp left and right */
6174 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6175 /* unmute pin widget amp left and right (no gain on this amp) */
6176 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6177 /* unmute LINE-2 out pin */
6178 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6179 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6182 /* mute analog inputs */
6183 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6184 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6185 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6186 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6187 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6188 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6189 /* mute Front out path */
6190 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6191 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6192 /* mute Headphone out path */
6193 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6194 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6195 /* mute Mono out path */
6196 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6197 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6201 #if 0 /* should be identical with alc260_init_verbs? */
6202 static struct hda_verb alc260_hp_init_verbs[] = {
6203 /* Headphone and output */
6204 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6206 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6207 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6208 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6209 /* Mic2 (front panel) pin widget for input and vref at 80% */
6210 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6211 /* Line In pin widget for input */
6212 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6213 /* Line-2 pin widget for output */
6214 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6215 /* CD pin widget for input */
6216 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6217 /* unmute amp left and right */
6218 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6219 /* set connection select to line in (default select for this ADC) */
6220 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6221 /* unmute Line-Out mixer amp left and right (volume = 0) */
6222 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6223 /* mute pin widget amp left and right (no gain on this amp) */
6224 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6225 /* unmute HP mixer amp left and right (volume = 0) */
6226 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6227 /* mute pin widget amp left and right (no gain on this amp) */
6228 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6229 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6232 /* mute analog inputs */
6233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6234 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6235 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6236 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6238 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6239 /* Unmute Front out path */
6240 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6241 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6242 /* Unmute Headphone out path */
6243 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6244 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6245 /* Unmute Mono out path */
6246 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6247 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6252 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6253 /* Line out and output */
6254 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6256 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6257 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6258 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6259 /* Mic2 (front panel) pin widget for input and vref at 80% */
6260 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6261 /* Line In pin widget for input */
6262 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6263 /* Headphone pin widget for output */
6264 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6265 /* CD pin widget for input */
6266 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6267 /* unmute amp left and right */
6268 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6269 /* set connection select to line in (default select for this ADC) */
6270 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6271 /* unmute Line-Out mixer amp left and right (volume = 0) */
6272 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6273 /* mute pin widget amp left and right (no gain on this amp) */
6274 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6275 /* unmute HP mixer amp left and right (volume = 0) */
6276 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6277 /* mute pin widget amp left and right (no gain on this amp) */
6278 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6279 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6282 /* mute analog inputs */
6283 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6284 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6285 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6286 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6287 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6288 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6289 /* Unmute Front out path */
6290 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6291 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6292 /* Unmute Headphone out path */
6293 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6294 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6295 /* Unmute Mono out path */
6296 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6297 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6301 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6302 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6303 * audio = 0x16, internal speaker = 0x10.
6305 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6306 /* Disable all GPIOs */
6307 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6308 /* Internal speaker is connected to headphone pin */
6309 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6310 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6311 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6312 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6313 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6314 /* Ensure all other unused pins are disabled and muted. */
6315 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6316 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6317 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6318 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6319 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6320 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6321 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6322 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6324 /* Disable digital (SPDIF) pins */
6325 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6326 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6328 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6329 * when acting as an output.
6331 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6333 /* Start with output sum widgets muted and their output gains at min */
6334 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6335 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6336 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6337 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6338 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6339 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6340 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6341 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6342 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6344 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6345 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6346 /* Unmute Line1 pin widget output buffer since it starts as an output.
6347 * If the pin mode is changed by the user the pin mode control will
6348 * take care of enabling the pin's input/output buffers as needed.
6349 * Therefore there's no need to enable the input buffer at this
6352 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6353 /* Unmute input buffer of pin widget used for Line-in (no equiv
6356 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6358 /* Mute capture amp left and right */
6359 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6360 /* Set ADC connection select to match default mixer setting - line
6363 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6365 /* Do the same for the second ADC: mute capture input amp and
6366 * set ADC connection to line in (on mic1 pin)
6368 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6369 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6371 /* Mute all inputs to mixer widget (even unconnected ones) */
6372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6373 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6376 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6377 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6378 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6379 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6384 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6385 * similar laptops (adapted from Fujitsu init verbs).
6387 static struct hda_verb alc260_acer_init_verbs[] = {
6388 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6389 * the headphone jack. Turn this on and rely on the standard mute
6390 * methods whenever the user wants to turn these outputs off.
6392 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6393 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6394 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6395 /* Internal speaker/Headphone jack is connected to Line-out pin */
6396 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6397 /* Internal microphone/Mic jack is connected to Mic1 pin */
6398 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6399 /* Line In jack is connected to Line1 pin */
6400 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6401 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6402 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6403 /* Ensure all other unused pins are disabled and muted. */
6404 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6405 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6406 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6407 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6408 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6409 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6410 /* Disable digital (SPDIF) pins */
6411 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6412 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6414 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6415 * bus when acting as outputs.
6417 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6418 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6420 /* Start with output sum widgets muted and their output gains at min */
6421 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6422 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6423 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6424 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6425 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6426 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6427 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6428 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6429 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6431 /* Unmute Line-out pin widget amp left and right
6432 * (no equiv mixer ctrl)
6434 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6435 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6436 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6437 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6438 * inputs. If the pin mode is changed by the user the pin mode control
6439 * will take care of enabling the pin's input/output buffers as needed.
6440 * Therefore there's no need to enable the input buffer at this
6443 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6444 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6446 /* Mute capture amp left and right */
6447 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6448 /* Set ADC connection select to match default mixer setting - mic
6451 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6453 /* Do similar with the second ADC: mute capture input amp and
6454 * set ADC connection to mic to match ALSA's default state.
6456 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6457 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6459 /* Mute all inputs to mixer widget (even unconnected ones) */
6460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6462 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6463 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6464 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6465 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6466 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6467 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6472 /* Initialisation sequence for Maxdata Favorit 100XS
6473 * (adapted from Acer init verbs).
6475 static struct hda_verb alc260_favorit100_init_verbs[] = {
6476 /* GPIO 0 enables the output jack.
6477 * Turn this on and rely on the standard mute
6478 * methods whenever the user wants to turn these outputs off.
6480 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6481 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6482 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6483 /* Line/Mic input jack is connected to Mic1 pin */
6484 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6485 /* Ensure all other unused pins are disabled and muted. */
6486 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6487 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6488 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6489 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6490 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6491 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6492 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6493 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6494 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6495 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6496 /* Disable digital (SPDIF) pins */
6497 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6498 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6500 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6501 * bus when acting as outputs.
6503 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6504 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6506 /* Start with output sum widgets muted and their output gains at min */
6507 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6509 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6511 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6512 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6513 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6514 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6515 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6517 /* Unmute Line-out pin widget amp left and right
6518 * (no equiv mixer ctrl)
6520 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6521 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6522 * inputs. If the pin mode is changed by the user the pin mode control
6523 * will take care of enabling the pin's input/output buffers as needed.
6524 * Therefore there's no need to enable the input buffer at this
6527 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6529 /* Mute capture amp left and right */
6530 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6531 /* Set ADC connection select to match default mixer setting - mic
6534 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6536 /* Do similar with the second ADC: mute capture input amp and
6537 * set ADC connection to mic to match ALSA's default state.
6539 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6540 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6542 /* Mute all inputs to mixer widget (even unconnected ones) */
6543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6555 static struct hda_verb alc260_will_verbs[] = {
6556 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6557 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6558 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6559 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6560 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6561 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6565 static struct hda_verb alc260_replacer_672v_verbs[] = {
6566 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6567 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6568 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6570 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6571 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6572 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6574 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6578 /* toggle speaker-output according to the hp-jack state */
6579 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6581 unsigned int present;
6583 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6584 present = snd_hda_jack_detect(codec, 0x0f);
6586 snd_hda_codec_write_cache(codec, 0x01, 0,
6587 AC_VERB_SET_GPIO_DATA, 1);
6588 snd_hda_codec_write_cache(codec, 0x0f, 0,
6589 AC_VERB_SET_PIN_WIDGET_CONTROL,
6592 snd_hda_codec_write_cache(codec, 0x01, 0,
6593 AC_VERB_SET_GPIO_DATA, 0);
6594 snd_hda_codec_write_cache(codec, 0x0f, 0,
6595 AC_VERB_SET_PIN_WIDGET_CONTROL,
6600 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6603 if ((res >> 26) == ALC880_HP_EVENT)
6604 alc260_replacer_672v_automute(codec);
6607 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6608 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6609 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6610 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6611 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6612 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6613 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6614 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6615 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6616 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6617 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6621 /* Test configuration for debugging, modelled after the ALC880 test
6624 #ifdef CONFIG_SND_DEBUG
6625 static hda_nid_t alc260_test_dac_nids[1] = {
6628 static hda_nid_t alc260_test_adc_nids[2] = {
6631 /* For testing the ALC260, each input MUX needs its own definition since
6632 * the signal assignments are different. This assumes that the first ADC
6635 static struct hda_input_mux alc260_test_capture_sources[2] = {
6639 { "MIC1 pin", 0x0 },
6640 { "MIC2 pin", 0x1 },
6641 { "LINE1 pin", 0x2 },
6642 { "LINE2 pin", 0x3 },
6644 { "LINE-OUT pin", 0x5 },
6645 { "HP-OUT pin", 0x6 },
6651 { "MIC1 pin", 0x0 },
6652 { "MIC2 pin", 0x1 },
6653 { "LINE1 pin", 0x2 },
6654 { "LINE2 pin", 0x3 },
6657 { "LINE-OUT pin", 0x6 },
6658 { "HP-OUT pin", 0x7 },
6662 static struct snd_kcontrol_new alc260_test_mixer[] = {
6663 /* Output driver widgets */
6664 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6665 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6666 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6667 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6668 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6669 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6671 /* Modes for retasking pin widgets
6672 * Note: the ALC260 doesn't seem to act on requests to enable mic
6673 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6674 * mention this restriction. At this stage it's not clear whether
6675 * this behaviour is intentional or is a hardware bug in chip
6676 * revisions available at least up until early 2006. Therefore for
6677 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6678 * choices, but if it turns out that the lack of mic bias for these
6679 * NIDs is intentional we could change their modes from
6680 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6682 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6683 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6684 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6685 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6686 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6687 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6689 /* Loopback mixer controls */
6690 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6691 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6692 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6693 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6694 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6695 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6696 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6697 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6698 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6699 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6700 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6701 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6702 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6703 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6705 /* Controls for GPIO pins, assuming they are configured as outputs */
6706 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6707 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6708 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6709 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6711 /* Switches to allow the digital IO pins to be enabled. The datasheet
6712 * is ambigious as to which NID is which; testing on laptops which
6713 * make this output available should provide clarification.
6715 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6716 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6718 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6719 * this output to turn on an external amplifier.
6721 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6722 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6726 static struct hda_verb alc260_test_init_verbs[] = {
6727 /* Enable all GPIOs as outputs with an initial value of 0 */
6728 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6729 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6730 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6732 /* Enable retasking pins as output, initially without power amp */
6733 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6734 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6735 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6736 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6737 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6738 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6740 /* Disable digital (SPDIF) pins initially, but users can enable
6741 * them via a mixer switch. In the case of SPDIF-out, this initverb
6742 * payload also sets the generation to 0, output to be in "consumer"
6743 * PCM format, copyright asserted, no pre-emphasis and no validity
6746 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6747 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6749 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6750 * OUT1 sum bus when acting as an output.
6752 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6753 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6754 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6755 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6757 /* Start with output sum widgets muted and their output gains at min */
6758 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6759 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6760 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6761 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6762 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6763 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6764 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6765 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6766 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6768 /* Unmute retasking pin widget output buffers since the default
6769 * state appears to be output. As the pin mode is changed by the
6770 * user the pin mode control will take care of enabling the pin's
6771 * input/output buffers as needed.
6773 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6774 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6776 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6777 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6778 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6779 /* Also unmute the mono-out pin widget */
6780 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6782 /* Mute capture amp left and right */
6783 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6784 /* Set ADC connection select to match default mixer setting (mic1
6787 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6789 /* Do the same for the second ADC: mute capture input amp and
6790 * set ADC connection to mic1 pin
6792 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6793 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6795 /* Mute all inputs to mixer widget (even unconnected ones) */
6796 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6797 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6798 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6800 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6801 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6802 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6803 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6809 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6810 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6812 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6813 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6816 * for BIOS auto-configuration
6819 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6820 const char *pfx, int *vol_bits)
6823 unsigned long vol_val, sw_val;
6826 if (nid >= 0x0f && nid < 0x11) {
6827 nid_vol = nid - 0x7;
6828 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6829 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6830 } else if (nid == 0x11) {
6831 nid_vol = nid - 0x7;
6832 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6833 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6834 } else if (nid >= 0x12 && nid <= 0x15) {
6836 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6837 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6841 if (!(*vol_bits & (1 << nid_vol))) {
6842 /* first control for the volume widget */
6843 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6846 *vol_bits |= (1 << nid_vol);
6848 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6854 /* add playback controls from the parsed DAC table */
6855 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6856 const struct auto_pin_cfg *cfg)
6862 spec->multiout.num_dacs = 1;
6863 spec->multiout.dac_nids = spec->private_dac_nids;
6864 spec->multiout.dac_nids[0] = 0x02;
6866 nid = cfg->line_out_pins[0];
6869 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6871 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6875 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6880 nid = cfg->speaker_pins[0];
6882 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6887 nid = cfg->hp_pins[0];
6889 err = alc260_add_playback_controls(spec, nid, "Headphone",
6897 /* create playback/capture controls for input pins */
6898 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6899 const struct auto_pin_cfg *cfg)
6901 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6904 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6905 hda_nid_t nid, int pin_type,
6908 alc_set_pin_output(codec, nid, pin_type);
6909 /* need the manual connection? */
6911 int idx = nid - 0x12;
6912 snd_hda_codec_write(codec, idx + 0x0b, 0,
6913 AC_VERB_SET_CONNECT_SEL, sel_idx);
6917 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6919 struct alc_spec *spec = codec->spec;
6922 nid = spec->autocfg.line_out_pins[0];
6924 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6925 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6928 nid = spec->autocfg.speaker_pins[0];
6930 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6932 nid = spec->autocfg.hp_pins[0];
6934 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6937 #define ALC260_PIN_CD_NID 0x16
6938 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6940 struct alc_spec *spec = codec->spec;
6941 struct auto_pin_cfg *cfg = &spec->autocfg;
6944 for (i = 0; i < cfg->num_inputs; i++) {
6945 hda_nid_t nid = cfg->inputs[i].pin;
6947 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
6948 if (nid != ALC260_PIN_CD_NID &&
6949 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6950 snd_hda_codec_write(codec, nid, 0,
6951 AC_VERB_SET_AMP_GAIN_MUTE,
6957 #define alc260_auto_init_input_src alc880_auto_init_input_src
6960 * generic initialization of ADC, input mixers and output mixers
6962 static struct hda_verb alc260_volume_init_verbs[] = {
6964 * Unmute ADC0-1 and set the default input to mic-in
6966 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6967 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6968 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6969 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6971 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6973 * Note: PASD motherboards uses the Line In 2 as the input for
6974 * front panel mic (mic 2)
6976 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6977 /* mute analog inputs */
6978 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6979 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6980 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6981 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6982 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6985 * Set up output mixers (0x08 - 0x0a)
6987 /* set vol=0 to output mixers */
6988 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6989 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6990 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6991 /* set up input amps for analog loopback */
6992 /* Amp Indices: DAC = 0, mixer = 1 */
6993 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6994 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6995 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6996 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6997 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6998 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7003 static int alc260_parse_auto_config(struct hda_codec *codec)
7005 struct alc_spec *spec = codec->spec;
7007 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
7009 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7013 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7016 if (!spec->kctls.list)
7017 return 0; /* can't find valid BIOS pin config */
7018 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7022 spec->multiout.max_channels = 2;
7024 if (spec->autocfg.dig_outs)
7025 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7026 if (spec->kctls.list)
7027 add_mixer(spec, spec->kctls.list);
7029 add_verb(spec, alc260_volume_init_verbs);
7031 spec->num_mux_defs = 1;
7032 spec->input_mux = &spec->private_imux[0];
7034 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7039 /* additional initialization for auto-configuration model */
7040 static void alc260_auto_init(struct hda_codec *codec)
7042 struct alc_spec *spec = codec->spec;
7043 alc260_auto_init_multi_out(codec);
7044 alc260_auto_init_analog_input(codec);
7045 alc260_auto_init_input_src(codec);
7046 alc_auto_init_digital(codec);
7047 if (spec->unsol_event)
7048 alc_inithook(codec);
7051 #ifdef CONFIG_SND_HDA_POWER_SAVE
7052 static struct hda_amp_list alc260_loopbacks[] = {
7053 { 0x07, HDA_INPUT, 0 },
7054 { 0x07, HDA_INPUT, 1 },
7055 { 0x07, HDA_INPUT, 2 },
7056 { 0x07, HDA_INPUT, 3 },
7057 { 0x07, HDA_INPUT, 4 },
7069 static const struct alc_fixup alc260_fixups[] = {
7070 [PINFIX_HP_DC5750] = {
7071 .pins = (const struct alc_pincfg[]) {
7072 { 0x11, 0x90130110 }, /* speaker */
7078 static struct snd_pci_quirk alc260_fixup_tbl[] = {
7079 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7084 * ALC260 configurations
7086 static const char *alc260_models[ALC260_MODEL_LAST] = {
7087 [ALC260_BASIC] = "basic",
7089 [ALC260_HP_3013] = "hp-3013",
7090 [ALC260_HP_DC7600] = "hp-dc7600",
7091 [ALC260_FUJITSU_S702X] = "fujitsu",
7092 [ALC260_ACER] = "acer",
7093 [ALC260_WILL] = "will",
7094 [ALC260_REPLACER_672V] = "replacer",
7095 [ALC260_FAVORIT100] = "favorit100",
7096 #ifdef CONFIG_SND_DEBUG
7097 [ALC260_TEST] = "test",
7099 [ALC260_AUTO] = "auto",
7102 static struct snd_pci_quirk alc260_cfg_tbl[] = {
7103 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7104 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7105 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7106 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7107 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7108 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7109 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7110 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7111 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7112 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7113 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7114 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7115 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7116 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7117 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7118 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7119 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7120 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7121 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7122 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7126 static struct alc_config_preset alc260_presets[] = {
7128 .mixers = { alc260_base_output_mixer,
7129 alc260_input_mixer },
7130 .init_verbs = { alc260_init_verbs },
7131 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7132 .dac_nids = alc260_dac_nids,
7133 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7134 .adc_nids = alc260_dual_adc_nids,
7135 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7136 .channel_mode = alc260_modes,
7137 .input_mux = &alc260_capture_source,
7140 .mixers = { alc260_hp_output_mixer,
7141 alc260_input_mixer },
7142 .init_verbs = { alc260_init_verbs,
7143 alc260_hp_unsol_verbs },
7144 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7145 .dac_nids = alc260_dac_nids,
7146 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7147 .adc_nids = alc260_adc_nids_alt,
7148 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7149 .channel_mode = alc260_modes,
7150 .input_mux = &alc260_capture_source,
7151 .unsol_event = alc260_hp_unsol_event,
7152 .init_hook = alc260_hp_automute,
7154 [ALC260_HP_DC7600] = {
7155 .mixers = { alc260_hp_dc7600_mixer,
7156 alc260_input_mixer },
7157 .init_verbs = { alc260_init_verbs,
7158 alc260_hp_dc7600_verbs },
7159 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7160 .dac_nids = alc260_dac_nids,
7161 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7162 .adc_nids = alc260_adc_nids_alt,
7163 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7164 .channel_mode = alc260_modes,
7165 .input_mux = &alc260_capture_source,
7166 .unsol_event = alc260_hp_3012_unsol_event,
7167 .init_hook = alc260_hp_3012_automute,
7169 [ALC260_HP_3013] = {
7170 .mixers = { alc260_hp_3013_mixer,
7171 alc260_input_mixer },
7172 .init_verbs = { alc260_hp_3013_init_verbs,
7173 alc260_hp_3013_unsol_verbs },
7174 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7175 .dac_nids = alc260_dac_nids,
7176 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7177 .adc_nids = alc260_adc_nids_alt,
7178 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7179 .channel_mode = alc260_modes,
7180 .input_mux = &alc260_capture_source,
7181 .unsol_event = alc260_hp_3013_unsol_event,
7182 .init_hook = alc260_hp_3013_automute,
7184 [ALC260_FUJITSU_S702X] = {
7185 .mixers = { alc260_fujitsu_mixer },
7186 .init_verbs = { alc260_fujitsu_init_verbs },
7187 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7188 .dac_nids = alc260_dac_nids,
7189 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7190 .adc_nids = alc260_dual_adc_nids,
7191 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7192 .channel_mode = alc260_modes,
7193 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7194 .input_mux = alc260_fujitsu_capture_sources,
7197 .mixers = { alc260_acer_mixer },
7198 .init_verbs = { alc260_acer_init_verbs },
7199 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7200 .dac_nids = alc260_dac_nids,
7201 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7202 .adc_nids = alc260_dual_adc_nids,
7203 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7204 .channel_mode = alc260_modes,
7205 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7206 .input_mux = alc260_acer_capture_sources,
7208 [ALC260_FAVORIT100] = {
7209 .mixers = { alc260_favorit100_mixer },
7210 .init_verbs = { alc260_favorit100_init_verbs },
7211 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7212 .dac_nids = alc260_dac_nids,
7213 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7214 .adc_nids = alc260_dual_adc_nids,
7215 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7216 .channel_mode = alc260_modes,
7217 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7218 .input_mux = alc260_favorit100_capture_sources,
7221 .mixers = { alc260_will_mixer },
7222 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7223 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7224 .dac_nids = alc260_dac_nids,
7225 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7226 .adc_nids = alc260_adc_nids,
7227 .dig_out_nid = ALC260_DIGOUT_NID,
7228 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7229 .channel_mode = alc260_modes,
7230 .input_mux = &alc260_capture_source,
7232 [ALC260_REPLACER_672V] = {
7233 .mixers = { alc260_replacer_672v_mixer },
7234 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7235 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7236 .dac_nids = alc260_dac_nids,
7237 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7238 .adc_nids = alc260_adc_nids,
7239 .dig_out_nid = ALC260_DIGOUT_NID,
7240 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7241 .channel_mode = alc260_modes,
7242 .input_mux = &alc260_capture_source,
7243 .unsol_event = alc260_replacer_672v_unsol_event,
7244 .init_hook = alc260_replacer_672v_automute,
7246 #ifdef CONFIG_SND_DEBUG
7248 .mixers = { alc260_test_mixer },
7249 .init_verbs = { alc260_test_init_verbs },
7250 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7251 .dac_nids = alc260_test_dac_nids,
7252 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7253 .adc_nids = alc260_test_adc_nids,
7254 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7255 .channel_mode = alc260_modes,
7256 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7257 .input_mux = alc260_test_capture_sources,
7262 static int patch_alc260(struct hda_codec *codec)
7264 struct alc_spec *spec;
7265 int err, board_config;
7267 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7273 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7276 if (board_config < 0) {
7277 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7279 board_config = ALC260_AUTO;
7282 if (board_config == ALC260_AUTO)
7283 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1);
7285 if (board_config == ALC260_AUTO) {
7286 /* automatic parse from the BIOS config */
7287 err = alc260_parse_auto_config(codec);
7293 "hda_codec: Cannot set up configuration "
7294 "from BIOS. Using base mode...\n");
7295 board_config = ALC260_BASIC;
7299 err = snd_hda_attach_beep_device(codec, 0x1);
7305 if (board_config != ALC260_AUTO)
7306 setup_preset(codec, &alc260_presets[board_config]);
7308 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7309 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7310 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7312 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7313 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7315 if (!spec->adc_nids && spec->input_mux) {
7316 /* check whether NID 0x04 is valid */
7317 unsigned int wcap = get_wcaps(codec, 0x04);
7318 wcap = get_wcaps_type(wcap);
7320 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7321 spec->adc_nids = alc260_adc_nids_alt;
7322 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7324 spec->adc_nids = alc260_adc_nids;
7325 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7328 set_capture_mixer(codec);
7329 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7331 if (board_config == ALC260_AUTO)
7332 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7334 spec->vmaster_nid = 0x08;
7336 codec->patch_ops = alc_patch_ops;
7337 if (board_config == ALC260_AUTO)
7338 spec->init_hook = alc260_auto_init;
7339 #ifdef CONFIG_SND_HDA_POWER_SAVE
7340 if (!spec->loopback.amplist)
7341 spec->loopback.amplist = alc260_loopbacks;
7349 * ALC882/883/885/888/889 support
7351 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7352 * configuration. Each pin widget can choose any input DACs and a mixer.
7353 * Each ADC is connected from a mixer of all inputs. This makes possible
7354 * 6-channel independent captures.
7356 * In addition, an independent DAC for the multi-playback (not used in this
7359 #define ALC882_DIGOUT_NID 0x06
7360 #define ALC882_DIGIN_NID 0x0a
7361 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7362 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7363 #define ALC1200_DIGOUT_NID 0x10
7366 static struct hda_channel_mode alc882_ch_modes[1] = {
7371 static hda_nid_t alc882_dac_nids[4] = {
7372 /* front, rear, clfe, rear_surr */
7373 0x02, 0x03, 0x04, 0x05
7375 #define alc883_dac_nids alc882_dac_nids
7378 #define alc882_adc_nids alc880_adc_nids
7379 #define alc882_adc_nids_alt alc880_adc_nids_alt
7380 #define alc883_adc_nids alc882_adc_nids_alt
7381 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7382 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7383 #define alc889_adc_nids alc880_adc_nids
7385 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7386 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7387 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7388 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7389 #define alc889_capsrc_nids alc882_capsrc_nids
7392 /* FIXME: should be a matrix-type input source selection */
7394 static struct hda_input_mux alc882_capture_source = {
7398 { "Front Mic", 0x1 },
7404 #define alc883_capture_source alc882_capture_source
7406 static struct hda_input_mux alc889_capture_source = {
7409 { "Front Mic", 0x0 },
7415 static struct hda_input_mux mb5_capture_source = {
7424 static struct hda_input_mux macmini3_capture_source = {
7432 static struct hda_input_mux alc883_3stack_6ch_intel = {
7436 { "Front Mic", 0x0 },
7442 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7450 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7460 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7468 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7472 { "Front Mic", 0x1 },
7477 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7485 static struct hda_input_mux alc889A_mb31_capture_source = {
7489 /* Front Mic (0x01) unused */
7491 /* Line 2 (0x03) unused */
7492 /* CD (0x04) unused? */
7496 static struct hda_input_mux alc889A_imac91_capture_source = {
7500 { "Line", 0x2 }, /* Not sure! */
7507 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7514 static struct hda_verb alc882_3ST_ch2_init[] = {
7515 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7516 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7517 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7518 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7525 static struct hda_verb alc882_3ST_ch4_init[] = {
7526 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7527 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7528 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7529 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7530 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7537 static struct hda_verb alc882_3ST_ch6_init[] = {
7538 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7539 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7540 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7541 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7542 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7543 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7547 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7548 { 2, alc882_3ST_ch2_init },
7549 { 4, alc882_3ST_ch4_init },
7550 { 6, alc882_3ST_ch6_init },
7553 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7558 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7559 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7560 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7561 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7562 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7563 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7570 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7571 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7572 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7573 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7574 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7575 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7576 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7583 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7584 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7585 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7586 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7587 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7588 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7589 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7590 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7594 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7595 { 2, alc883_3ST_ch2_clevo_init },
7596 { 4, alc883_3ST_ch4_clevo_init },
7597 { 6, alc883_3ST_ch6_clevo_init },
7604 static struct hda_verb alc882_sixstack_ch6_init[] = {
7605 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7606 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7607 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7608 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7615 static struct hda_verb alc882_sixstack_ch8_init[] = {
7616 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7617 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7618 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7619 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7623 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7624 { 6, alc882_sixstack_ch6_init },
7625 { 8, alc882_sixstack_ch8_init },
7629 /* Macbook Air 2,1 */
7631 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7636 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7642 static struct hda_verb alc885_mbp_ch2_init[] = {
7643 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7644 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7645 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7652 static struct hda_verb alc885_mbp_ch4_init[] = {
7653 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7654 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7655 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7656 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7657 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7661 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7662 { 2, alc885_mbp_ch2_init },
7663 { 4, alc885_mbp_ch4_init },
7668 * Speakers/Woofer/HP = Front
7671 static struct hda_verb alc885_mb5_ch2_init[] = {
7672 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7673 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7679 * Speakers/HP = Front
7683 static struct hda_verb alc885_mb5_ch6_init[] = {
7684 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7685 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7686 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7690 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7691 { 2, alc885_mb5_ch2_init },
7692 { 6, alc885_mb5_ch6_init },
7695 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7700 static struct hda_verb alc883_4ST_ch2_init[] = {
7701 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7702 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7703 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7704 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7705 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7706 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7713 static struct hda_verb alc883_4ST_ch4_init[] = {
7714 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7715 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7716 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7717 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7718 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7719 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7720 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7727 static struct hda_verb alc883_4ST_ch6_init[] = {
7728 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7729 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7730 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7731 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7732 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7733 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7734 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7735 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7742 static struct hda_verb alc883_4ST_ch8_init[] = {
7743 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7744 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7745 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7746 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7747 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7748 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7749 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7750 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7751 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7755 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7756 { 2, alc883_4ST_ch2_init },
7757 { 4, alc883_4ST_ch4_init },
7758 { 6, alc883_4ST_ch6_init },
7759 { 8, alc883_4ST_ch8_init },
7766 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7767 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7768 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7769 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7770 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7777 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7778 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7779 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7780 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7781 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7782 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7789 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7790 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7791 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7792 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7793 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7794 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7795 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7799 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7800 { 2, alc883_3ST_ch2_intel_init },
7801 { 4, alc883_3ST_ch4_intel_init },
7802 { 6, alc883_3ST_ch6_intel_init },
7808 static struct hda_verb alc889_ch2_intel_init[] = {
7809 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7810 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7811 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7812 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7813 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7814 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7821 static struct hda_verb alc889_ch6_intel_init[] = {
7822 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7823 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7824 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7825 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7826 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7827 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7834 static struct hda_verb alc889_ch8_intel_init[] = {
7835 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7836 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7837 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7838 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7839 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7840 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7841 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7845 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7846 { 2, alc889_ch2_intel_init },
7847 { 6, alc889_ch6_intel_init },
7848 { 8, alc889_ch8_intel_init },
7854 static struct hda_verb alc883_sixstack_ch6_init[] = {
7855 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7856 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7857 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7858 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7865 static struct hda_verb alc883_sixstack_ch8_init[] = {
7866 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7867 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7868 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7869 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7873 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7874 { 6, alc883_sixstack_ch6_init },
7875 { 8, alc883_sixstack_ch8_init },
7879 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7880 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7882 static struct snd_kcontrol_new alc882_base_mixer[] = {
7883 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7884 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7885 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7886 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7887 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7888 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7889 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7890 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7891 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7892 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7893 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7894 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7895 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7896 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7897 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7898 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7899 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7900 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7901 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7902 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7903 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7907 /* Macbook Air 2,1 same control for HP and internal Speaker */
7909 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7910 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7911 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7916 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7917 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7918 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7919 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7920 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7921 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7922 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7923 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7925 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7926 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7927 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7931 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7932 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7933 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7934 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7935 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7936 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7937 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7938 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7939 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7940 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7941 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7943 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7944 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7945 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7949 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7950 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7951 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7952 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7953 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7954 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7955 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7956 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7957 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7958 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7959 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7960 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7964 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7965 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7966 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7971 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7972 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7973 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7974 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7975 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7976 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7977 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7979 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7980 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7984 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7985 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7986 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7987 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7988 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7989 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7990 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7991 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7994 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7996 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7997 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8001 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8002 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8004 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8005 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8006 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8008 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8009 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8010 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8011 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8012 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8013 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8014 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8015 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8016 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8017 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8021 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8022 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8023 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8024 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8025 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8026 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8027 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8028 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8029 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8030 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8031 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8035 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8037 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8038 .name = "Channel Mode",
8039 .info = alc_ch_mode_info,
8040 .get = alc_ch_mode_get,
8041 .put = alc_ch_mode_put,
8046 static struct hda_verb alc882_base_init_verbs[] = {
8047 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8048 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8049 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8051 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8052 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8054 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8055 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8057 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8058 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8060 /* Front Pin: output 0 (0x0c) */
8061 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8062 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8063 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8064 /* Rear Pin: output 1 (0x0d) */
8065 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8067 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8068 /* CLFE Pin: output 2 (0x0e) */
8069 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8070 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8071 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8072 /* Side Pin: output 3 (0x0f) */
8073 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8074 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8075 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8076 /* Mic (rear) pin: input vref at 80% */
8077 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8078 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8079 /* Front Mic pin: input vref at 80% */
8080 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8081 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8082 /* Line In pin: input */
8083 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8084 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8085 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8086 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8087 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8088 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8089 /* CD pin widget for input */
8090 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8092 /* FIXME: use matrix-type input source selection */
8093 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8095 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8098 /* ADC2: mute amp left and right */
8099 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8100 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8101 /* ADC3: mute amp left and right */
8102 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8103 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8108 static struct hda_verb alc882_adc1_init_verbs[] = {
8109 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8110 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8111 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8112 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8113 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8114 /* ADC1: mute amp left and right */
8115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8116 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8120 static struct hda_verb alc882_eapd_verbs[] = {
8121 /* change to EAPD mode */
8122 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8123 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8127 static struct hda_verb alc889_eapd_verbs[] = {
8128 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8129 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8133 static struct hda_verb alc_hp15_unsol_verbs[] = {
8134 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8135 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8139 static struct hda_verb alc885_init_verbs[] = {
8140 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8141 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8142 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8144 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8145 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8147 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8148 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8150 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8151 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8153 /* Front HP Pin: output 0 (0x0c) */
8154 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8155 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8156 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8157 /* Front Pin: output 0 (0x0c) */
8158 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8159 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8160 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8161 /* Rear Pin: output 1 (0x0d) */
8162 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8163 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8164 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8165 /* CLFE Pin: output 2 (0x0e) */
8166 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8167 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8168 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8169 /* Side Pin: output 3 (0x0f) */
8170 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8171 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8172 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8173 /* Mic (rear) pin: input vref at 80% */
8174 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8175 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8176 /* Front Mic pin: input vref at 80% */
8177 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8178 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8179 /* Line In pin: input */
8180 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8181 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8183 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8185 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8187 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8189 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8190 /* ADC2: mute amp left and right */
8191 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8192 /* ADC3: mute amp left and right */
8193 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8198 static struct hda_verb alc885_init_input_verbs[] = {
8199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8200 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8201 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8206 /* Unmute Selector 24h and set the default input to front mic */
8207 static struct hda_verb alc889_init_input_verbs[] = {
8208 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8209 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8214 #define alc883_init_verbs alc882_base_init_verbs
8217 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8218 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8219 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8220 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8221 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8222 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8223 /* FIXME: this looks suspicious...
8224 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8225 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8230 static struct hda_verb alc882_macpro_init_verbs[] = {
8231 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8232 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8233 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8234 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8235 /* Front Pin: output 0 (0x0c) */
8236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8237 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8238 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8239 /* Front Mic pin: input vref at 80% */
8240 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8241 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8242 /* Speaker: output */
8243 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8244 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8245 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8246 /* Headphone output (output 0 - 0x0c) */
8247 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8248 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8249 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8251 /* FIXME: use matrix-type input source selection */
8252 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8253 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8254 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8255 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8256 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8257 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8260 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8261 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8262 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8268 /* ADC1: mute amp left and right */
8269 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8270 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8271 /* ADC2: mute amp left and right */
8272 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8273 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8274 /* ADC3: mute amp left and right */
8275 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8276 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8282 static struct hda_verb alc885_mb5_init_verbs[] = {
8284 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8285 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8286 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8287 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8291 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8292 /* Surround mixer */
8293 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8294 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8295 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8297 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8301 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8302 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8303 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8304 /* Front Pin (0x0c) */
8305 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8306 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8307 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8308 /* LFE Pin (0x0e) */
8309 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8310 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8311 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8314 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8315 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8316 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8317 /* Front Mic pin: input vref at 80% */
8318 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8319 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8321 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8322 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8326 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8331 static struct hda_verb alc885_macmini3_init_verbs[] = {
8333 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8334 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8335 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8336 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8339 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8340 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8341 /* Surround mixer */
8342 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8343 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8344 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8350 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8351 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8352 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8353 /* Front Pin (0x0c) */
8354 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8355 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8356 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8357 /* LFE Pin (0x0e) */
8358 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8359 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8360 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8362 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8363 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8364 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8365 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8367 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8371 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8378 static struct hda_verb alc885_mba21_init_verbs[] = {
8379 /*Internal and HP Speaker Mixer*/
8380 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8381 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8383 /*Internal Speaker Pin (0x0c)*/
8384 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8385 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8386 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8387 /* HP Pin: output 0 (0x0e) */
8388 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8389 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8390 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8391 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8392 /* Line in (is hp when jack connected)*/
8393 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8394 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8400 /* Macbook Pro rev3 */
8401 static struct hda_verb alc885_mbp3_init_verbs[] = {
8402 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8404 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8405 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8407 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8408 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8409 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8411 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8412 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8413 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8414 /* Front Pin: output 0 (0x0c) */
8415 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8416 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8417 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8418 /* HP Pin: output 0 (0x0e) */
8419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8420 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8421 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8422 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8423 /* Mic (rear) pin: input vref at 80% */
8424 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8425 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8426 /* Front Mic pin: input vref at 80% */
8427 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8428 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8429 /* Line In pin: use output 1 when in LineOut mode */
8430 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8431 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8432 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8434 /* FIXME: use matrix-type input source selection */
8435 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8436 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8437 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8439 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8440 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8442 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8443 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8444 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8445 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8447 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8448 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8449 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8450 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8451 /* ADC1: mute amp left and right */
8452 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8453 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8454 /* ADC2: mute amp left and right */
8455 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8456 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8457 /* ADC3: mute amp left and right */
8458 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8459 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8465 static struct hda_verb alc885_imac91_init_verbs[] = {
8466 /* Internal Speaker Pin (0x0c) */
8467 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8468 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8469 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8470 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8471 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8472 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8475 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8476 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8477 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8479 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8480 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8481 /* Front Mic pin: input vref at 80% */
8482 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8483 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8485 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8486 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8487 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8488 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8489 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8490 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8492 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8493 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8494 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8495 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8496 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8497 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8498 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8499 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8500 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8501 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8502 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8505 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8506 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8507 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8508 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8509 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8510 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8511 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8512 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8513 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8514 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8515 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8519 /* iMac 24 mixer. */
8520 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8521 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8522 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8526 /* iMac 24 init verbs. */
8527 static struct hda_verb alc885_imac24_init_verbs[] = {
8528 /* Internal speakers: output 0 (0x0c) */
8529 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8530 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8531 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8532 /* Internal speakers: output 0 (0x0c) */
8533 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8534 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8535 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8536 /* Headphone: output 0 (0x0c) */
8537 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8538 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8539 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8540 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8541 /* Front Mic: input vref at 80% */
8542 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8543 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8547 /* Toggle speaker-output according to the hp-jack state */
8548 static void alc885_imac24_setup(struct hda_codec *codec)
8550 struct alc_spec *spec = codec->spec;
8552 spec->autocfg.hp_pins[0] = 0x14;
8553 spec->autocfg.speaker_pins[0] = 0x18;
8554 spec->autocfg.speaker_pins[1] = 0x1a;
8557 #define alc885_mb5_setup alc885_imac24_setup
8558 #define alc885_macmini3_setup alc885_imac24_setup
8560 /* Macbook Air 2,1 */
8561 static void alc885_mba21_setup(struct hda_codec *codec)
8563 struct alc_spec *spec = codec->spec;
8565 spec->autocfg.hp_pins[0] = 0x14;
8566 spec->autocfg.speaker_pins[0] = 0x18;
8571 static void alc885_mbp3_setup(struct hda_codec *codec)
8573 struct alc_spec *spec = codec->spec;
8575 spec->autocfg.hp_pins[0] = 0x15;
8576 spec->autocfg.speaker_pins[0] = 0x14;
8579 static void alc885_imac91_setup(struct hda_codec *codec)
8581 struct alc_spec *spec = codec->spec;
8583 spec->autocfg.hp_pins[0] = 0x14;
8584 spec->autocfg.speaker_pins[0] = 0x18;
8585 spec->autocfg.speaker_pins[1] = 0x1a;
8588 static struct hda_verb alc882_targa_verbs[] = {
8589 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8590 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8592 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8593 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8595 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8596 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8597 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8599 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8603 /* toggle speaker-output according to the hp-jack state */
8604 static void alc882_targa_automute(struct hda_codec *codec)
8606 struct alc_spec *spec = codec->spec;
8607 alc_automute_amp(codec);
8608 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8609 spec->jack_present ? 1 : 3);
8612 static void alc882_targa_setup(struct hda_codec *codec)
8614 struct alc_spec *spec = codec->spec;
8616 spec->autocfg.hp_pins[0] = 0x14;
8617 spec->autocfg.speaker_pins[0] = 0x1b;
8620 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8622 if ((res >> 26) == ALC880_HP_EVENT)
8623 alc882_targa_automute(codec);
8626 static struct hda_verb alc882_asus_a7j_verbs[] = {
8627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8630 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8631 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8632 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8634 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8635 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8636 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8638 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8639 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8640 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8644 static struct hda_verb alc882_asus_a7m_verbs[] = {
8645 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8646 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8648 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8649 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8650 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8652 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8653 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8654 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8656 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8657 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8658 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8662 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8664 unsigned int gpiostate, gpiomask, gpiodir;
8666 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8667 AC_VERB_GET_GPIO_DATA, 0);
8670 gpiostate |= (1 << pin);
8672 gpiostate &= ~(1 << pin);
8674 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8675 AC_VERB_GET_GPIO_MASK, 0);
8676 gpiomask |= (1 << pin);
8678 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8679 AC_VERB_GET_GPIO_DIRECTION, 0);
8680 gpiodir |= (1 << pin);
8683 snd_hda_codec_write(codec, codec->afg, 0,
8684 AC_VERB_SET_GPIO_MASK, gpiomask);
8685 snd_hda_codec_write(codec, codec->afg, 0,
8686 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8690 snd_hda_codec_write(codec, codec->afg, 0,
8691 AC_VERB_SET_GPIO_DATA, gpiostate);
8694 /* set up GPIO at initialization */
8695 static void alc885_macpro_init_hook(struct hda_codec *codec)
8697 alc882_gpio_mute(codec, 0, 0);
8698 alc882_gpio_mute(codec, 1, 0);
8701 /* set up GPIO and update auto-muting at initialization */
8702 static void alc885_imac24_init_hook(struct hda_codec *codec)
8704 alc885_macpro_init_hook(codec);
8705 alc_automute_amp(codec);
8709 * generic initialization of ADC, input mixers and output mixers
8711 static struct hda_verb alc883_auto_init_verbs[] = {
8713 * Unmute ADC0-2 and set the default input to mic-in
8715 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8716 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8717 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8718 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8721 * Set up output mixers (0x0c - 0x0f)
8723 /* set vol=0 to output mixers */
8724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8725 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8726 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8727 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8728 /* set up input amps for analog loopback */
8729 /* Amp Indices: DAC = 0, mixer = 1 */
8730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8731 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8732 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8733 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8735 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8736 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8737 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8738 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8739 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8741 /* FIXME: use matrix-type input source selection */
8742 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8744 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8746 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8750 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8751 static struct hda_verb alc889A_mb31_ch2_init[] = {
8752 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8753 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8754 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8755 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8759 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8760 static struct hda_verb alc889A_mb31_ch4_init[] = {
8761 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8762 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8763 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8764 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8768 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8769 static struct hda_verb alc889A_mb31_ch5_init[] = {
8770 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8771 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8772 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8773 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8777 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8778 static struct hda_verb alc889A_mb31_ch6_init[] = {
8779 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8780 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8781 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8782 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8786 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8787 { 2, alc889A_mb31_ch2_init },
8788 { 4, alc889A_mb31_ch4_init },
8789 { 5, alc889A_mb31_ch5_init },
8790 { 6, alc889A_mb31_ch6_init },
8793 static struct hda_verb alc883_medion_eapd_verbs[] = {
8794 /* eanable EAPD on medion laptop */
8795 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8796 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8800 #define alc883_base_mixer alc882_base_mixer
8802 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8803 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8804 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8805 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8806 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8807 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8808 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8809 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8810 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8811 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8812 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8813 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8814 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8815 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8819 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8820 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8821 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8822 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8823 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8825 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8826 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8827 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8828 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8829 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8833 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8834 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8835 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8836 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8837 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8838 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8839 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8840 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8841 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8842 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8843 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8847 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8848 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8849 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8850 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8851 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8852 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8853 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8854 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8855 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8856 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8857 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8858 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8859 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8860 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8864 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8865 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8866 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8867 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8868 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8869 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8870 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8871 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8872 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8873 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8874 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8875 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8876 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8877 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8879 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8880 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8881 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8882 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8883 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8887 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8888 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8889 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8890 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8891 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8892 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8894 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8895 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8896 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8897 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8898 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8899 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8900 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8901 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8903 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8904 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8905 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8906 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8907 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8911 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8912 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8913 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8914 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8915 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8916 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8918 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8919 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8920 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8921 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8922 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8923 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8924 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8925 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8927 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8928 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8929 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8930 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8931 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8935 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8936 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8937 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8938 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8939 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8940 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8941 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8942 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8943 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8944 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8945 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8946 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8947 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8948 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8949 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8950 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8951 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8952 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8953 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8954 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8958 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8959 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8960 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8961 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8962 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8963 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8964 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8965 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8966 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8967 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8968 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8969 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8970 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8971 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8972 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8973 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8974 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8979 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8980 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8981 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8982 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8983 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8984 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8985 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8986 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8987 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8988 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8989 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8990 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8991 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8995 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8996 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8997 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8998 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8999 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9000 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9004 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9005 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9006 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9007 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9008 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9010 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9011 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9012 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9016 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9017 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9018 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9019 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9020 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9021 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9022 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9023 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9024 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9025 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9029 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9030 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9031 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9032 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9033 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9034 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9035 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9039 static struct hda_verb alc883_medion_wim2160_verbs[] = {
9040 /* Unmute front mixer */
9041 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9042 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9044 /* Set speaker pin to front mixer */
9045 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9047 /* Init headphone pin */
9048 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9049 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9050 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9051 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9056 /* toggle speaker-output according to the hp-jack state */
9057 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9059 struct alc_spec *spec = codec->spec;
9061 spec->autocfg.hp_pins[0] = 0x1a;
9062 spec->autocfg.speaker_pins[0] = 0x15;
9065 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9066 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9067 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9068 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9069 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9070 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9071 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9072 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9073 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9077 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9078 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9079 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9080 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9081 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9082 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9083 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9084 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9085 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9086 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9090 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9091 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9092 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9093 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9094 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9095 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9096 0x0d, 1, 0x0, HDA_OUTPUT),
9097 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9098 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9099 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9100 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9101 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9102 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9103 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9104 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9105 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9106 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9107 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9109 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9110 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9115 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9117 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9118 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9119 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9120 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9121 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9123 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9124 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9125 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9126 /* Output switches */
9127 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9128 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9129 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9131 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
9132 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
9134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9135 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9136 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9137 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9141 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9142 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9143 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9144 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9146 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9147 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9151 static struct hda_bind_ctls alc883_bind_cap_vol = {
9152 .ops = &snd_hda_bind_vol,
9154 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9155 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9160 static struct hda_bind_ctls alc883_bind_cap_switch = {
9161 .ops = &snd_hda_bind_sw,
9163 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9164 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9169 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9170 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9171 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9172 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9173 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9174 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9175 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9176 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9177 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9181 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9182 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9183 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9185 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9186 /* .name = "Capture Source", */
9187 .name = "Input Source",
9189 .info = alc_mux_enum_info,
9190 .get = alc_mux_enum_get,
9191 .put = alc_mux_enum_put,
9196 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9198 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9199 .name = "Channel Mode",
9200 .info = alc_ch_mode_info,
9201 .get = alc_ch_mode_get,
9202 .put = alc_ch_mode_put,
9207 /* toggle speaker-output according to the hp-jack state */
9208 static void alc883_mitac_setup(struct hda_codec *codec)
9210 struct alc_spec *spec = codec->spec;
9212 spec->autocfg.hp_pins[0] = 0x15;
9213 spec->autocfg.speaker_pins[0] = 0x14;
9214 spec->autocfg.speaker_pins[1] = 0x17;
9217 /* auto-toggle front mic */
9219 static void alc883_mitac_mic_automute(struct hda_codec *codec)
9221 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
9223 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
9227 static struct hda_verb alc883_mitac_verbs[] = {
9229 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9230 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9232 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9233 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9235 /* enable unsolicited event */
9236 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9237 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9242 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9244 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9245 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9247 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9249 /* enable unsolicited event */
9251 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9252 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9258 static struct hda_verb alc883_clevo_m720_verbs[] = {
9260 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9261 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9263 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9264 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9266 /* enable unsolicited event */
9267 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9268 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9273 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9275 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9276 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9278 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9279 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9281 /* enable unsolicited event */
9282 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9287 static struct hda_verb alc883_targa_verbs[] = {
9288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9291 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9292 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9294 /* Connect Line-Out side jack (SPDIF) to Side */
9295 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9296 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9297 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9298 /* Connect Mic jack to CLFE */
9299 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9300 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9301 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9302 /* Connect Line-in jack to Surround */
9303 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9304 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9305 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9306 /* Connect HP out jack to Front */
9307 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9308 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9309 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9311 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9316 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9317 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9318 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9319 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9323 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9324 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9325 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9326 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9327 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9331 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9334 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9335 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9336 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9340 static struct hda_verb alc883_haier_w66_verbs[] = {
9341 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9342 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9344 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9346 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9347 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9348 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9349 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9353 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9355 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9356 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9358 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9359 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9360 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9361 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9365 static struct hda_verb alc888_6st_dell_verbs[] = {
9366 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9370 static struct hda_verb alc883_vaiott_verbs[] = {
9372 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9373 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9375 /* enable unsolicited event */
9376 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9381 static void alc888_3st_hp_setup(struct hda_codec *codec)
9383 struct alc_spec *spec = codec->spec;
9385 spec->autocfg.hp_pins[0] = 0x1b;
9386 spec->autocfg.speaker_pins[0] = 0x14;
9387 spec->autocfg.speaker_pins[1] = 0x16;
9388 spec->autocfg.speaker_pins[2] = 0x18;
9391 static struct hda_verb alc888_3st_hp_verbs[] = {
9392 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9393 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9394 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9395 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9402 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9403 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9404 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9405 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9406 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9413 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9414 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9415 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9416 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9417 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9418 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9425 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9426 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9427 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9428 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9429 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9430 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9431 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9435 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9436 { 2, alc888_3st_hp_2ch_init },
9437 { 4, alc888_3st_hp_4ch_init },
9438 { 6, alc888_3st_hp_6ch_init },
9441 /* toggle front-jack and RCA according to the hp-jack state */
9442 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9444 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9446 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9447 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9448 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9449 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9452 /* toggle RCA according to the front-jack state */
9453 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9455 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9457 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9458 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9461 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9464 if ((res >> 26) == ALC880_HP_EVENT)
9465 alc888_lenovo_ms7195_front_automute(codec);
9466 if ((res >> 26) == ALC880_FRONT_EVENT)
9467 alc888_lenovo_ms7195_rca_automute(codec);
9470 /* toggle speaker-output according to the hp-jack state */
9471 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9473 struct alc_spec *spec = codec->spec;
9475 spec->autocfg.hp_pins[0] = 0x14;
9476 spec->autocfg.speaker_pins[0] = 0x15;
9479 /* toggle speaker-output according to the hp-jack state */
9480 #define alc883_targa_init_hook alc882_targa_init_hook
9481 #define alc883_targa_unsol_event alc882_targa_unsol_event
9483 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9485 unsigned int present;
9487 present = snd_hda_jack_detect(codec, 0x18);
9488 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9489 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9492 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9494 struct alc_spec *spec = codec->spec;
9496 spec->autocfg.hp_pins[0] = 0x15;
9497 spec->autocfg.speaker_pins[0] = 0x14;
9500 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9502 alc_automute_amp(codec);
9503 alc883_clevo_m720_mic_automute(codec);
9506 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9509 switch (res >> 26) {
9510 case ALC880_MIC_EVENT:
9511 alc883_clevo_m720_mic_automute(codec);
9514 alc_automute_amp_unsol_event(codec, res);
9519 /* toggle speaker-output according to the hp-jack state */
9520 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9522 struct alc_spec *spec = codec->spec;
9524 spec->autocfg.hp_pins[0] = 0x14;
9525 spec->autocfg.speaker_pins[0] = 0x15;
9528 static void alc883_haier_w66_setup(struct hda_codec *codec)
9530 struct alc_spec *spec = codec->spec;
9532 spec->autocfg.hp_pins[0] = 0x1b;
9533 spec->autocfg.speaker_pins[0] = 0x14;
9536 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9538 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9540 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9541 HDA_AMP_MUTE, bits);
9544 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9546 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9548 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9549 HDA_AMP_MUTE, bits);
9550 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9551 HDA_AMP_MUTE, bits);
9554 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9557 if ((res >> 26) == ALC880_HP_EVENT)
9558 alc883_lenovo_101e_all_automute(codec);
9559 if ((res >> 26) == ALC880_FRONT_EVENT)
9560 alc883_lenovo_101e_ispeaker_automute(codec);
9563 /* toggle speaker-output according to the hp-jack state */
9564 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9566 struct alc_spec *spec = codec->spec;
9568 spec->autocfg.hp_pins[0] = 0x14;
9569 spec->autocfg.speaker_pins[0] = 0x15;
9570 spec->autocfg.speaker_pins[1] = 0x16;
9573 static struct hda_verb alc883_acer_eapd_verbs[] = {
9574 /* HP Pin: output 0 (0x0c) */
9575 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9576 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9577 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9578 /* Front Pin: output 0 (0x0c) */
9579 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9580 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9581 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9582 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9583 /* eanable EAPD on medion laptop */
9584 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9585 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9586 /* enable unsolicited event */
9587 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9591 static void alc888_6st_dell_setup(struct hda_codec *codec)
9593 struct alc_spec *spec = codec->spec;
9595 spec->autocfg.hp_pins[0] = 0x1b;
9596 spec->autocfg.speaker_pins[0] = 0x14;
9597 spec->autocfg.speaker_pins[1] = 0x15;
9598 spec->autocfg.speaker_pins[2] = 0x16;
9599 spec->autocfg.speaker_pins[3] = 0x17;
9602 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9604 struct alc_spec *spec = codec->spec;
9606 spec->autocfg.hp_pins[0] = 0x1b;
9607 spec->autocfg.speaker_pins[0] = 0x14;
9608 spec->autocfg.speaker_pins[1] = 0x15;
9609 spec->autocfg.speaker_pins[2] = 0x16;
9610 spec->autocfg.speaker_pins[3] = 0x17;
9611 spec->autocfg.speaker_pins[4] = 0x1a;
9614 static void alc883_vaiott_setup(struct hda_codec *codec)
9616 struct alc_spec *spec = codec->spec;
9618 spec->autocfg.hp_pins[0] = 0x15;
9619 spec->autocfg.speaker_pins[0] = 0x14;
9620 spec->autocfg.speaker_pins[1] = 0x17;
9623 static struct hda_verb alc888_asus_m90v_verbs[] = {
9624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9625 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9626 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9627 /* enable unsolicited event */
9628 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9629 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9633 static void alc883_mode2_setup(struct hda_codec *codec)
9635 struct alc_spec *spec = codec->spec;
9637 spec->autocfg.hp_pins[0] = 0x1b;
9638 spec->autocfg.speaker_pins[0] = 0x14;
9639 spec->autocfg.speaker_pins[1] = 0x15;
9640 spec->autocfg.speaker_pins[2] = 0x16;
9641 spec->ext_mic.pin = 0x18;
9642 spec->int_mic.pin = 0x19;
9643 spec->ext_mic.mux_idx = 0;
9644 spec->int_mic.mux_idx = 1;
9648 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9649 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9650 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9654 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9655 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9656 /* enable unsolicited event */
9657 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9661 static void alc883_eee1601_inithook(struct hda_codec *codec)
9663 struct alc_spec *spec = codec->spec;
9665 spec->autocfg.hp_pins[0] = 0x14;
9666 spec->autocfg.speaker_pins[0] = 0x1b;
9667 alc_automute_pin(codec);
9670 static struct hda_verb alc889A_mb31_verbs[] = {
9671 /* Init rear pin (used as headphone output) */
9672 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9673 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9674 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9675 /* Init line pin (used as output in 4ch and 6ch mode) */
9676 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9677 /* Init line 2 pin (used as headphone out by default) */
9678 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9679 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9683 /* Mute speakers according to the headphone jack state */
9684 static void alc889A_mb31_automute(struct hda_codec *codec)
9686 unsigned int present;
9688 /* Mute only in 2ch or 4ch mode */
9689 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9691 present = snd_hda_jack_detect(codec, 0x15);
9692 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9693 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9694 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9695 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9699 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9701 if ((res >> 26) == ALC880_HP_EVENT)
9702 alc889A_mb31_automute(codec);
9706 #ifdef CONFIG_SND_HDA_POWER_SAVE
9707 #define alc882_loopbacks alc880_loopbacks
9710 /* pcm configuration: identical with ALC880 */
9711 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9712 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9713 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9714 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9716 static hda_nid_t alc883_slave_dig_outs[] = {
9717 ALC1200_DIGOUT_NID, 0,
9720 static hda_nid_t alc1200_slave_dig_outs[] = {
9721 ALC883_DIGOUT_NID, 0,
9725 * configuration and preset
9727 static const char *alc882_models[ALC882_MODEL_LAST] = {
9728 [ALC882_3ST_DIG] = "3stack-dig",
9729 [ALC882_6ST_DIG] = "6stack-dig",
9730 [ALC882_ARIMA] = "arima",
9731 [ALC882_W2JC] = "w2jc",
9732 [ALC882_TARGA] = "targa",
9733 [ALC882_ASUS_A7J] = "asus-a7j",
9734 [ALC882_ASUS_A7M] = "asus-a7m",
9735 [ALC885_MACPRO] = "macpro",
9736 [ALC885_MB5] = "mb5",
9737 [ALC885_MACMINI3] = "macmini3",
9738 [ALC885_MBA21] = "mba21",
9739 [ALC885_MBP3] = "mbp3",
9740 [ALC885_IMAC24] = "imac24",
9741 [ALC885_IMAC91] = "imac91",
9742 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9743 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9744 [ALC883_3ST_6ch] = "3stack-6ch",
9745 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9746 [ALC883_TARGA_DIG] = "targa-dig",
9747 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9748 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9749 [ALC883_ACER] = "acer",
9750 [ALC883_ACER_ASPIRE] = "acer-aspire",
9751 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9752 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9753 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9754 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9755 [ALC883_MEDION] = "medion",
9756 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9757 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9758 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9759 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9760 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9761 [ALC888_LENOVO_SKY] = "lenovo-sky",
9762 [ALC883_HAIER_W66] = "haier-w66",
9763 [ALC888_3ST_HP] = "3stack-hp",
9764 [ALC888_6ST_DELL] = "6stack-dell",
9765 [ALC883_MITAC] = "mitac",
9766 [ALC883_CLEVO_M540R] = "clevo-m540r",
9767 [ALC883_CLEVO_M720] = "clevo-m720",
9768 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9769 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9770 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9771 [ALC889A_INTEL] = "intel-alc889a",
9772 [ALC889_INTEL] = "intel-x58",
9773 [ALC1200_ASUS_P5Q] = "asus-p5q",
9774 [ALC889A_MB31] = "mb31",
9775 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9776 [ALC882_AUTO] = "auto",
9779 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9780 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9782 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9783 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9784 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9785 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9786 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9787 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9788 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9789 ALC888_ACER_ASPIRE_4930G),
9790 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9791 ALC888_ACER_ASPIRE_4930G),
9792 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9793 ALC888_ACER_ASPIRE_8930G),
9794 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9795 ALC888_ACER_ASPIRE_8930G),
9796 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9797 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9798 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9799 ALC888_ACER_ASPIRE_6530G),
9800 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9801 ALC888_ACER_ASPIRE_6530G),
9802 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9803 ALC888_ACER_ASPIRE_7730G),
9804 /* default Acer -- disabled as it causes more problems.
9805 * model=auto should work fine now
9807 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9809 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9811 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9812 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9813 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9814 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9815 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9816 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9818 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9819 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9820 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9821 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9822 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9823 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9824 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9825 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9826 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9827 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9828 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9830 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9831 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9832 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9833 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9834 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9835 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9836 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9837 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9838 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9840 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9841 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9842 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9843 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9844 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9845 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9846 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9847 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9848 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9849 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9850 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9851 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9852 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9853 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9854 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9855 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9856 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9857 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9858 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9859 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9860 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9861 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9862 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9863 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9864 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9865 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9866 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9867 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9868 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9869 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9870 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9872 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9873 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9874 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9875 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9876 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9877 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9878 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9879 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9880 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9881 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9882 ALC883_FUJITSU_PI2515),
9883 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9884 ALC888_FUJITSU_XA3530),
9885 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9886 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9887 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9888 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9889 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9890 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9891 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9892 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9894 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9895 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9896 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9897 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9898 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9899 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9900 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9905 /* codec SSID table for Intel Mac */
9906 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9907 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9908 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9909 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9910 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9911 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9912 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9913 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9914 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9915 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9916 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9917 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9918 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9919 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9920 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9921 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9922 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9923 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9924 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9925 * so apparently no perfect solution yet
9927 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9928 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9929 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9933 static struct alc_config_preset alc882_presets[] = {
9934 [ALC882_3ST_DIG] = {
9935 .mixers = { alc882_base_mixer },
9936 .init_verbs = { alc882_base_init_verbs,
9937 alc882_adc1_init_verbs },
9938 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9939 .dac_nids = alc882_dac_nids,
9940 .dig_out_nid = ALC882_DIGOUT_NID,
9941 .dig_in_nid = ALC882_DIGIN_NID,
9942 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9943 .channel_mode = alc882_ch_modes,
9945 .input_mux = &alc882_capture_source,
9947 [ALC882_6ST_DIG] = {
9948 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9949 .init_verbs = { alc882_base_init_verbs,
9950 alc882_adc1_init_verbs },
9951 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9952 .dac_nids = alc882_dac_nids,
9953 .dig_out_nid = ALC882_DIGOUT_NID,
9954 .dig_in_nid = ALC882_DIGIN_NID,
9955 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9956 .channel_mode = alc882_sixstack_modes,
9957 .input_mux = &alc882_capture_source,
9960 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9961 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9962 alc882_eapd_verbs },
9963 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9964 .dac_nids = alc882_dac_nids,
9965 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9966 .channel_mode = alc882_sixstack_modes,
9967 .input_mux = &alc882_capture_source,
9970 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9971 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9972 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9973 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9974 .dac_nids = alc882_dac_nids,
9975 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9976 .channel_mode = alc880_threestack_modes,
9978 .input_mux = &alc882_capture_source,
9979 .dig_out_nid = ALC882_DIGOUT_NID,
9982 .mixers = { alc885_mba21_mixer },
9983 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9985 .dac_nids = alc882_dac_nids,
9986 .channel_mode = alc885_mba21_ch_modes,
9987 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9988 .input_mux = &alc882_capture_source,
9989 .unsol_event = alc_automute_amp_unsol_event,
9990 .setup = alc885_mba21_setup,
9991 .init_hook = alc_automute_amp,
9994 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9995 .init_verbs = { alc885_mbp3_init_verbs,
9996 alc880_gpio1_init_verbs },
9998 .dac_nids = alc882_dac_nids,
10000 .channel_mode = alc885_mbp_4ch_modes,
10001 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10002 .input_mux = &alc882_capture_source,
10003 .dig_out_nid = ALC882_DIGOUT_NID,
10004 .dig_in_nid = ALC882_DIGIN_NID,
10005 .unsol_event = alc_automute_amp_unsol_event,
10006 .setup = alc885_mbp3_setup,
10007 .init_hook = alc_automute_amp,
10010 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10011 .init_verbs = { alc885_mb5_init_verbs,
10012 alc880_gpio1_init_verbs },
10013 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10014 .dac_nids = alc882_dac_nids,
10015 .channel_mode = alc885_mb5_6ch_modes,
10016 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10017 .input_mux = &mb5_capture_source,
10018 .dig_out_nid = ALC882_DIGOUT_NID,
10019 .dig_in_nid = ALC882_DIGIN_NID,
10020 .unsol_event = alc_automute_amp_unsol_event,
10021 .setup = alc885_mb5_setup,
10022 .init_hook = alc_automute_amp,
10024 [ALC885_MACMINI3] = {
10025 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10026 .init_verbs = { alc885_macmini3_init_verbs,
10027 alc880_gpio1_init_verbs },
10028 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10029 .dac_nids = alc882_dac_nids,
10030 .channel_mode = alc885_macmini3_6ch_modes,
10031 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10032 .input_mux = &macmini3_capture_source,
10033 .dig_out_nid = ALC882_DIGOUT_NID,
10034 .dig_in_nid = ALC882_DIGIN_NID,
10035 .unsol_event = alc_automute_amp_unsol_event,
10036 .setup = alc885_macmini3_setup,
10037 .init_hook = alc_automute_amp,
10039 [ALC885_MACPRO] = {
10040 .mixers = { alc882_macpro_mixer },
10041 .init_verbs = { alc882_macpro_init_verbs },
10042 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10043 .dac_nids = alc882_dac_nids,
10044 .dig_out_nid = ALC882_DIGOUT_NID,
10045 .dig_in_nid = ALC882_DIGIN_NID,
10046 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10047 .channel_mode = alc882_ch_modes,
10048 .input_mux = &alc882_capture_source,
10049 .init_hook = alc885_macpro_init_hook,
10051 [ALC885_IMAC24] = {
10052 .mixers = { alc885_imac24_mixer },
10053 .init_verbs = { alc885_imac24_init_verbs },
10054 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10055 .dac_nids = alc882_dac_nids,
10056 .dig_out_nid = ALC882_DIGOUT_NID,
10057 .dig_in_nid = ALC882_DIGIN_NID,
10058 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10059 .channel_mode = alc882_ch_modes,
10060 .input_mux = &alc882_capture_source,
10061 .unsol_event = alc_automute_amp_unsol_event,
10062 .setup = alc885_imac24_setup,
10063 .init_hook = alc885_imac24_init_hook,
10065 [ALC885_IMAC91] = {
10066 .mixers = {alc885_imac91_mixer},
10067 .init_verbs = { alc885_imac91_init_verbs,
10068 alc880_gpio1_init_verbs },
10069 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10070 .dac_nids = alc882_dac_nids,
10071 .channel_mode = alc885_mba21_ch_modes,
10072 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10073 .input_mux = &alc889A_imac91_capture_source,
10074 .dig_out_nid = ALC882_DIGOUT_NID,
10075 .dig_in_nid = ALC882_DIGIN_NID,
10076 .unsol_event = alc_automute_amp_unsol_event,
10077 .setup = alc885_imac91_setup,
10078 .init_hook = alc_automute_amp,
10081 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10082 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10083 alc880_gpio3_init_verbs, alc882_targa_verbs},
10084 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10085 .dac_nids = alc882_dac_nids,
10086 .dig_out_nid = ALC882_DIGOUT_NID,
10087 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10088 .adc_nids = alc882_adc_nids,
10089 .capsrc_nids = alc882_capsrc_nids,
10090 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10091 .channel_mode = alc882_3ST_6ch_modes,
10093 .input_mux = &alc882_capture_source,
10094 .unsol_event = alc882_targa_unsol_event,
10095 .setup = alc882_targa_setup,
10096 .init_hook = alc882_targa_automute,
10098 [ALC882_ASUS_A7J] = {
10099 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10100 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10101 alc882_asus_a7j_verbs},
10102 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10103 .dac_nids = alc882_dac_nids,
10104 .dig_out_nid = ALC882_DIGOUT_NID,
10105 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10106 .adc_nids = alc882_adc_nids,
10107 .capsrc_nids = alc882_capsrc_nids,
10108 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10109 .channel_mode = alc882_3ST_6ch_modes,
10111 .input_mux = &alc882_capture_source,
10113 [ALC882_ASUS_A7M] = {
10114 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10115 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10116 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10117 alc882_asus_a7m_verbs },
10118 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10119 .dac_nids = alc882_dac_nids,
10120 .dig_out_nid = ALC882_DIGOUT_NID,
10121 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10122 .channel_mode = alc880_threestack_modes,
10124 .input_mux = &alc882_capture_source,
10126 [ALC883_3ST_2ch_DIG] = {
10127 .mixers = { alc883_3ST_2ch_mixer },
10128 .init_verbs = { alc883_init_verbs },
10129 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10130 .dac_nids = alc883_dac_nids,
10131 .dig_out_nid = ALC883_DIGOUT_NID,
10132 .dig_in_nid = ALC883_DIGIN_NID,
10133 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10134 .channel_mode = alc883_3ST_2ch_modes,
10135 .input_mux = &alc883_capture_source,
10137 [ALC883_3ST_6ch_DIG] = {
10138 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10139 .init_verbs = { alc883_init_verbs },
10140 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10141 .dac_nids = alc883_dac_nids,
10142 .dig_out_nid = ALC883_DIGOUT_NID,
10143 .dig_in_nid = ALC883_DIGIN_NID,
10144 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10145 .channel_mode = alc883_3ST_6ch_modes,
10147 .input_mux = &alc883_capture_source,
10149 [ALC883_3ST_6ch] = {
10150 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10151 .init_verbs = { alc883_init_verbs },
10152 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10153 .dac_nids = alc883_dac_nids,
10154 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10155 .channel_mode = alc883_3ST_6ch_modes,
10157 .input_mux = &alc883_capture_source,
10159 [ALC883_3ST_6ch_INTEL] = {
10160 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10161 .init_verbs = { alc883_init_verbs },
10162 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10163 .dac_nids = alc883_dac_nids,
10164 .dig_out_nid = ALC883_DIGOUT_NID,
10165 .dig_in_nid = ALC883_DIGIN_NID,
10166 .slave_dig_outs = alc883_slave_dig_outs,
10167 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10168 .channel_mode = alc883_3ST_6ch_intel_modes,
10170 .input_mux = &alc883_3stack_6ch_intel,
10172 [ALC889A_INTEL] = {
10173 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10174 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10175 alc_hp15_unsol_verbs },
10176 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10177 .dac_nids = alc883_dac_nids,
10178 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10179 .adc_nids = alc889_adc_nids,
10180 .dig_out_nid = ALC883_DIGOUT_NID,
10181 .dig_in_nid = ALC883_DIGIN_NID,
10182 .slave_dig_outs = alc883_slave_dig_outs,
10183 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10184 .channel_mode = alc889_8ch_intel_modes,
10185 .capsrc_nids = alc889_capsrc_nids,
10186 .input_mux = &alc889_capture_source,
10187 .setup = alc889_automute_setup,
10188 .init_hook = alc_automute_amp,
10189 .unsol_event = alc_automute_amp_unsol_event,
10193 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10194 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10195 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10196 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10197 .dac_nids = alc883_dac_nids,
10198 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10199 .adc_nids = alc889_adc_nids,
10200 .dig_out_nid = ALC883_DIGOUT_NID,
10201 .dig_in_nid = ALC883_DIGIN_NID,
10202 .slave_dig_outs = alc883_slave_dig_outs,
10203 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10204 .channel_mode = alc889_8ch_intel_modes,
10205 .capsrc_nids = alc889_capsrc_nids,
10206 .input_mux = &alc889_capture_source,
10207 .setup = alc889_automute_setup,
10208 .init_hook = alc889_intel_init_hook,
10209 .unsol_event = alc_automute_amp_unsol_event,
10212 [ALC883_6ST_DIG] = {
10213 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10214 .init_verbs = { alc883_init_verbs },
10215 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10216 .dac_nids = alc883_dac_nids,
10217 .dig_out_nid = ALC883_DIGOUT_NID,
10218 .dig_in_nid = ALC883_DIGIN_NID,
10219 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10220 .channel_mode = alc883_sixstack_modes,
10221 .input_mux = &alc883_capture_source,
10223 [ALC883_TARGA_DIG] = {
10224 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10225 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10226 alc883_targa_verbs},
10227 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10228 .dac_nids = alc883_dac_nids,
10229 .dig_out_nid = ALC883_DIGOUT_NID,
10230 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10231 .channel_mode = alc883_3ST_6ch_modes,
10233 .input_mux = &alc883_capture_source,
10234 .unsol_event = alc883_targa_unsol_event,
10235 .setup = alc882_targa_setup,
10236 .init_hook = alc882_targa_automute,
10238 [ALC883_TARGA_2ch_DIG] = {
10239 .mixers = { alc883_targa_2ch_mixer},
10240 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10241 alc883_targa_verbs},
10242 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10243 .dac_nids = alc883_dac_nids,
10244 .adc_nids = alc883_adc_nids_alt,
10245 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10246 .capsrc_nids = alc883_capsrc_nids,
10247 .dig_out_nid = ALC883_DIGOUT_NID,
10248 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10249 .channel_mode = alc883_3ST_2ch_modes,
10250 .input_mux = &alc883_capture_source,
10251 .unsol_event = alc883_targa_unsol_event,
10252 .setup = alc882_targa_setup,
10253 .init_hook = alc882_targa_automute,
10255 [ALC883_TARGA_8ch_DIG] = {
10256 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10257 alc883_chmode_mixer },
10258 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10259 alc883_targa_verbs },
10260 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10261 .dac_nids = alc883_dac_nids,
10262 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10263 .adc_nids = alc883_adc_nids_rev,
10264 .capsrc_nids = alc883_capsrc_nids_rev,
10265 .dig_out_nid = ALC883_DIGOUT_NID,
10266 .dig_in_nid = ALC883_DIGIN_NID,
10267 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10268 .channel_mode = alc883_4ST_8ch_modes,
10270 .input_mux = &alc883_capture_source,
10271 .unsol_event = alc883_targa_unsol_event,
10272 .setup = alc882_targa_setup,
10273 .init_hook = alc882_targa_automute,
10276 .mixers = { alc883_base_mixer },
10277 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10278 * and the headphone jack. Turn this on and rely on the
10279 * standard mute methods whenever the user wants to turn
10280 * these outputs off.
10282 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10283 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10284 .dac_nids = alc883_dac_nids,
10285 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10286 .channel_mode = alc883_3ST_2ch_modes,
10287 .input_mux = &alc883_capture_source,
10289 [ALC883_ACER_ASPIRE] = {
10290 .mixers = { alc883_acer_aspire_mixer },
10291 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10292 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10293 .dac_nids = alc883_dac_nids,
10294 .dig_out_nid = ALC883_DIGOUT_NID,
10295 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10296 .channel_mode = alc883_3ST_2ch_modes,
10297 .input_mux = &alc883_capture_source,
10298 .unsol_event = alc_automute_amp_unsol_event,
10299 .setup = alc883_acer_aspire_setup,
10300 .init_hook = alc_automute_amp,
10302 [ALC888_ACER_ASPIRE_4930G] = {
10303 .mixers = { alc888_base_mixer,
10304 alc883_chmode_mixer },
10305 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10306 alc888_acer_aspire_4930g_verbs },
10307 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10308 .dac_nids = alc883_dac_nids,
10309 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10310 .adc_nids = alc883_adc_nids_rev,
10311 .capsrc_nids = alc883_capsrc_nids_rev,
10312 .dig_out_nid = ALC883_DIGOUT_NID,
10313 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10314 .channel_mode = alc883_3ST_6ch_modes,
10316 .const_channel_count = 6,
10318 ARRAY_SIZE(alc888_2_capture_sources),
10319 .input_mux = alc888_2_capture_sources,
10320 .unsol_event = alc_automute_amp_unsol_event,
10321 .setup = alc888_acer_aspire_4930g_setup,
10322 .init_hook = alc_automute_amp,
10324 [ALC888_ACER_ASPIRE_6530G] = {
10325 .mixers = { alc888_acer_aspire_6530_mixer },
10326 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10327 alc888_acer_aspire_6530g_verbs },
10328 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10329 .dac_nids = alc883_dac_nids,
10330 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10331 .adc_nids = alc883_adc_nids_rev,
10332 .capsrc_nids = alc883_capsrc_nids_rev,
10333 .dig_out_nid = ALC883_DIGOUT_NID,
10334 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10335 .channel_mode = alc883_3ST_2ch_modes,
10337 ARRAY_SIZE(alc888_2_capture_sources),
10338 .input_mux = alc888_acer_aspire_6530_sources,
10339 .unsol_event = alc_automute_amp_unsol_event,
10340 .setup = alc888_acer_aspire_6530g_setup,
10341 .init_hook = alc_automute_amp,
10343 [ALC888_ACER_ASPIRE_8930G] = {
10344 .mixers = { alc889_acer_aspire_8930g_mixer,
10345 alc883_chmode_mixer },
10346 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10347 alc889_acer_aspire_8930g_verbs,
10348 alc889_eapd_verbs},
10349 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10350 .dac_nids = alc883_dac_nids,
10351 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10352 .adc_nids = alc889_adc_nids,
10353 .capsrc_nids = alc889_capsrc_nids,
10354 .dig_out_nid = ALC883_DIGOUT_NID,
10355 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10356 .channel_mode = alc883_3ST_6ch_modes,
10358 .const_channel_count = 6,
10360 ARRAY_SIZE(alc889_capture_sources),
10361 .input_mux = alc889_capture_sources,
10362 .unsol_event = alc_automute_amp_unsol_event,
10363 .setup = alc889_acer_aspire_8930g_setup,
10364 .init_hook = alc_automute_amp,
10365 #ifdef CONFIG_SND_HDA_POWER_SAVE
10366 .power_hook = alc_power_eapd,
10369 [ALC888_ACER_ASPIRE_7730G] = {
10370 .mixers = { alc883_3ST_6ch_mixer,
10371 alc883_chmode_mixer },
10372 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10373 alc888_acer_aspire_7730G_verbs },
10374 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10375 .dac_nids = alc883_dac_nids,
10376 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10377 .adc_nids = alc883_adc_nids_rev,
10378 .capsrc_nids = alc883_capsrc_nids_rev,
10379 .dig_out_nid = ALC883_DIGOUT_NID,
10380 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10381 .channel_mode = alc883_3ST_6ch_modes,
10383 .const_channel_count = 6,
10384 .input_mux = &alc883_capture_source,
10385 .unsol_event = alc_automute_amp_unsol_event,
10386 .setup = alc888_acer_aspire_7730g_setup,
10387 .init_hook = alc_automute_amp,
10389 [ALC883_MEDION] = {
10390 .mixers = { alc883_fivestack_mixer,
10391 alc883_chmode_mixer },
10392 .init_verbs = { alc883_init_verbs,
10393 alc883_medion_eapd_verbs },
10394 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10395 .dac_nids = alc883_dac_nids,
10396 .adc_nids = alc883_adc_nids_alt,
10397 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10398 .capsrc_nids = alc883_capsrc_nids,
10399 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10400 .channel_mode = alc883_sixstack_modes,
10401 .input_mux = &alc883_capture_source,
10403 [ALC883_MEDION_WIM2160] = {
10404 .mixers = { alc883_medion_wim2160_mixer },
10405 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10406 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10407 .dac_nids = alc883_dac_nids,
10408 .dig_out_nid = ALC883_DIGOUT_NID,
10409 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10410 .adc_nids = alc883_adc_nids,
10411 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10412 .channel_mode = alc883_3ST_2ch_modes,
10413 .input_mux = &alc883_capture_source,
10414 .unsol_event = alc_automute_amp_unsol_event,
10415 .setup = alc883_medion_wim2160_setup,
10416 .init_hook = alc_automute_amp,
10418 [ALC883_LAPTOP_EAPD] = {
10419 .mixers = { alc883_base_mixer },
10420 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10421 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10422 .dac_nids = alc883_dac_nids,
10423 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10424 .channel_mode = alc883_3ST_2ch_modes,
10425 .input_mux = &alc883_capture_source,
10427 [ALC883_CLEVO_M540R] = {
10428 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10429 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10430 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10431 .dac_nids = alc883_dac_nids,
10432 .dig_out_nid = ALC883_DIGOUT_NID,
10433 .dig_in_nid = ALC883_DIGIN_NID,
10434 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10435 .channel_mode = alc883_3ST_6ch_clevo_modes,
10437 .input_mux = &alc883_capture_source,
10438 /* This machine has the hardware HP auto-muting, thus
10439 * we need no software mute via unsol event
10442 [ALC883_CLEVO_M720] = {
10443 .mixers = { alc883_clevo_m720_mixer },
10444 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10445 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10446 .dac_nids = alc883_dac_nids,
10447 .dig_out_nid = ALC883_DIGOUT_NID,
10448 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10449 .channel_mode = alc883_3ST_2ch_modes,
10450 .input_mux = &alc883_capture_source,
10451 .unsol_event = alc883_clevo_m720_unsol_event,
10452 .setup = alc883_clevo_m720_setup,
10453 .init_hook = alc883_clevo_m720_init_hook,
10455 [ALC883_LENOVO_101E_2ch] = {
10456 .mixers = { alc883_lenovo_101e_2ch_mixer},
10457 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10458 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10459 .dac_nids = alc883_dac_nids,
10460 .adc_nids = alc883_adc_nids_alt,
10461 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10462 .capsrc_nids = alc883_capsrc_nids,
10463 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10464 .channel_mode = alc883_3ST_2ch_modes,
10465 .input_mux = &alc883_lenovo_101e_capture_source,
10466 .unsol_event = alc883_lenovo_101e_unsol_event,
10467 .init_hook = alc883_lenovo_101e_all_automute,
10469 [ALC883_LENOVO_NB0763] = {
10470 .mixers = { alc883_lenovo_nb0763_mixer },
10471 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10472 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10473 .dac_nids = alc883_dac_nids,
10474 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10475 .channel_mode = alc883_3ST_2ch_modes,
10477 .input_mux = &alc883_lenovo_nb0763_capture_source,
10478 .unsol_event = alc_automute_amp_unsol_event,
10479 .setup = alc883_lenovo_nb0763_setup,
10480 .init_hook = alc_automute_amp,
10482 [ALC888_LENOVO_MS7195_DIG] = {
10483 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10484 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10485 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10486 .dac_nids = alc883_dac_nids,
10487 .dig_out_nid = ALC883_DIGOUT_NID,
10488 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10489 .channel_mode = alc883_3ST_6ch_modes,
10491 .input_mux = &alc883_capture_source,
10492 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10493 .init_hook = alc888_lenovo_ms7195_front_automute,
10495 [ALC883_HAIER_W66] = {
10496 .mixers = { alc883_targa_2ch_mixer},
10497 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10498 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10499 .dac_nids = alc883_dac_nids,
10500 .dig_out_nid = ALC883_DIGOUT_NID,
10501 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10502 .channel_mode = alc883_3ST_2ch_modes,
10503 .input_mux = &alc883_capture_source,
10504 .unsol_event = alc_automute_amp_unsol_event,
10505 .setup = alc883_haier_w66_setup,
10506 .init_hook = alc_automute_amp,
10508 [ALC888_3ST_HP] = {
10509 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10510 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10511 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10512 .dac_nids = alc883_dac_nids,
10513 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10514 .channel_mode = alc888_3st_hp_modes,
10516 .input_mux = &alc883_capture_source,
10517 .unsol_event = alc_automute_amp_unsol_event,
10518 .setup = alc888_3st_hp_setup,
10519 .init_hook = alc_automute_amp,
10521 [ALC888_6ST_DELL] = {
10522 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10523 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10524 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10525 .dac_nids = alc883_dac_nids,
10526 .dig_out_nid = ALC883_DIGOUT_NID,
10527 .dig_in_nid = ALC883_DIGIN_NID,
10528 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10529 .channel_mode = alc883_sixstack_modes,
10530 .input_mux = &alc883_capture_source,
10531 .unsol_event = alc_automute_amp_unsol_event,
10532 .setup = alc888_6st_dell_setup,
10533 .init_hook = alc_automute_amp,
10536 .mixers = { alc883_mitac_mixer },
10537 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10538 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10539 .dac_nids = alc883_dac_nids,
10540 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10541 .channel_mode = alc883_3ST_2ch_modes,
10542 .input_mux = &alc883_capture_source,
10543 .unsol_event = alc_automute_amp_unsol_event,
10544 .setup = alc883_mitac_setup,
10545 .init_hook = alc_automute_amp,
10547 [ALC883_FUJITSU_PI2515] = {
10548 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10549 .init_verbs = { alc883_init_verbs,
10550 alc883_2ch_fujitsu_pi2515_verbs},
10551 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10552 .dac_nids = alc883_dac_nids,
10553 .dig_out_nid = ALC883_DIGOUT_NID,
10554 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10555 .channel_mode = alc883_3ST_2ch_modes,
10556 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10557 .unsol_event = alc_automute_amp_unsol_event,
10558 .setup = alc883_2ch_fujitsu_pi2515_setup,
10559 .init_hook = alc_automute_amp,
10561 [ALC888_FUJITSU_XA3530] = {
10562 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10563 .init_verbs = { alc883_init_verbs,
10564 alc888_fujitsu_xa3530_verbs },
10565 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10566 .dac_nids = alc883_dac_nids,
10567 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10568 .adc_nids = alc883_adc_nids_rev,
10569 .capsrc_nids = alc883_capsrc_nids_rev,
10570 .dig_out_nid = ALC883_DIGOUT_NID,
10571 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10572 .channel_mode = alc888_4ST_8ch_intel_modes,
10574 ARRAY_SIZE(alc888_2_capture_sources),
10575 .input_mux = alc888_2_capture_sources,
10576 .unsol_event = alc_automute_amp_unsol_event,
10577 .setup = alc888_fujitsu_xa3530_setup,
10578 .init_hook = alc_automute_amp,
10580 [ALC888_LENOVO_SKY] = {
10581 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10582 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10583 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10584 .dac_nids = alc883_dac_nids,
10585 .dig_out_nid = ALC883_DIGOUT_NID,
10586 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10587 .channel_mode = alc883_sixstack_modes,
10589 .input_mux = &alc883_lenovo_sky_capture_source,
10590 .unsol_event = alc_automute_amp_unsol_event,
10591 .setup = alc888_lenovo_sky_setup,
10592 .init_hook = alc_automute_amp,
10594 [ALC888_ASUS_M90V] = {
10595 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10596 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10597 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10598 .dac_nids = alc883_dac_nids,
10599 .dig_out_nid = ALC883_DIGOUT_NID,
10600 .dig_in_nid = ALC883_DIGIN_NID,
10601 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10602 .channel_mode = alc883_3ST_6ch_modes,
10604 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10605 .unsol_event = alc_sku_unsol_event,
10606 .setup = alc883_mode2_setup,
10607 .init_hook = alc_inithook,
10609 [ALC888_ASUS_EEE1601] = {
10610 .mixers = { alc883_asus_eee1601_mixer },
10611 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10612 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10613 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10614 .dac_nids = alc883_dac_nids,
10615 .dig_out_nid = ALC883_DIGOUT_NID,
10616 .dig_in_nid = ALC883_DIGIN_NID,
10617 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10618 .channel_mode = alc883_3ST_2ch_modes,
10620 .input_mux = &alc883_asus_eee1601_capture_source,
10621 .unsol_event = alc_sku_unsol_event,
10622 .init_hook = alc883_eee1601_inithook,
10624 [ALC1200_ASUS_P5Q] = {
10625 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10626 .init_verbs = { alc883_init_verbs },
10627 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10628 .dac_nids = alc883_dac_nids,
10629 .dig_out_nid = ALC1200_DIGOUT_NID,
10630 .dig_in_nid = ALC883_DIGIN_NID,
10631 .slave_dig_outs = alc1200_slave_dig_outs,
10632 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10633 .channel_mode = alc883_sixstack_modes,
10634 .input_mux = &alc883_capture_source,
10637 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10638 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10639 alc880_gpio1_init_verbs },
10640 .adc_nids = alc883_adc_nids,
10641 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10642 .capsrc_nids = alc883_capsrc_nids,
10643 .dac_nids = alc883_dac_nids,
10644 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10645 .channel_mode = alc889A_mb31_6ch_modes,
10646 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10647 .input_mux = &alc889A_mb31_capture_source,
10648 .dig_out_nid = ALC883_DIGOUT_NID,
10649 .unsol_event = alc889A_mb31_unsol_event,
10650 .init_hook = alc889A_mb31_automute,
10652 [ALC883_SONY_VAIO_TT] = {
10653 .mixers = { alc883_vaiott_mixer },
10654 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10655 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10656 .dac_nids = alc883_dac_nids,
10657 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10658 .channel_mode = alc883_3ST_2ch_modes,
10659 .input_mux = &alc883_capture_source,
10660 .unsol_event = alc_automute_amp_unsol_event,
10661 .setup = alc883_vaiott_setup,
10662 .init_hook = alc_automute_amp,
10671 PINFIX_ABIT_AW9D_MAX,
10673 PINFIX_ACER_ASPIRE_7736,
10676 static const struct alc_fixup alc882_fixups[] = {
10677 [PINFIX_ABIT_AW9D_MAX] = {
10678 .pins = (const struct alc_pincfg[]) {
10679 { 0x15, 0x01080104 }, /* side */
10680 { 0x16, 0x01011012 }, /* rear */
10681 { 0x17, 0x01016011 }, /* clfe */
10685 [PINFIX_PB_M5210] = {
10686 .verbs = (const struct hda_verb[]) {
10687 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10691 [PINFIX_ACER_ASPIRE_7736] = {
10692 .sku = ALC_FIXUP_SKU_IGNORE,
10696 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10697 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10698 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10699 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10704 * BIOS auto configuration
10706 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10707 const struct auto_pin_cfg *cfg)
10709 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10712 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10713 hda_nid_t nid, int pin_type,
10718 /* set as output */
10719 alc_set_pin_output(codec, nid, pin_type);
10723 else if (dac >= 0x02 && dac <= 0x05)
10727 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10730 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10732 struct alc_spec *spec = codec->spec;
10735 for (i = 0; i <= HDA_SIDE; i++) {
10736 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10737 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10739 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10740 spec->multiout.dac_nids[i]);
10744 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10746 struct alc_spec *spec = codec->spec;
10747 hda_nid_t pin, dac;
10750 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10751 pin = spec->autocfg.hp_pins[i];
10754 dac = spec->multiout.hp_nid;
10756 dac = spec->multiout.dac_nids[0]; /* to front */
10757 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10759 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10760 pin = spec->autocfg.speaker_pins[i];
10763 dac = spec->multiout.extra_out_nid[0];
10765 dac = spec->multiout.dac_nids[0]; /* to front */
10766 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10770 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10772 struct alc_spec *spec = codec->spec;
10773 struct auto_pin_cfg *cfg = &spec->autocfg;
10776 for (i = 0; i < cfg->num_inputs; i++) {
10777 hda_nid_t nid = cfg->inputs[i].pin;
10778 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10779 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10780 snd_hda_codec_write(codec, nid, 0,
10781 AC_VERB_SET_AMP_GAIN_MUTE,
10786 static void alc882_auto_init_input_src(struct hda_codec *codec)
10788 struct alc_spec *spec = codec->spec;
10791 for (c = 0; c < spec->num_adc_nids; c++) {
10792 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10793 hda_nid_t nid = spec->capsrc_nids[c];
10794 unsigned int mux_idx;
10795 const struct hda_input_mux *imux;
10796 int conns, mute, idx, item;
10798 conns = snd_hda_get_connections(codec, nid, conn_list,
10799 ARRAY_SIZE(conn_list));
10802 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10803 imux = &spec->input_mux[mux_idx];
10804 if (!imux->num_items && mux_idx > 0)
10805 imux = &spec->input_mux[0];
10806 for (idx = 0; idx < conns; idx++) {
10807 /* if the current connection is the selected one,
10808 * unmute it as default - otherwise mute it
10810 mute = AMP_IN_MUTE(idx);
10811 for (item = 0; item < imux->num_items; item++) {
10812 if (imux->items[item].index == idx) {
10813 if (spec->cur_mux[c] == item)
10814 mute = AMP_IN_UNMUTE(idx);
10818 /* check if we have a selector or mixer
10819 * we could check for the widget type instead, but
10820 * just check for Amp-In presence (in case of mixer
10821 * without amp-in there is something wrong, this
10822 * function shouldn't be used or capsrc nid is wrong)
10824 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10825 snd_hda_codec_write(codec, nid, 0,
10826 AC_VERB_SET_AMP_GAIN_MUTE,
10828 else if (mute != AMP_IN_MUTE(idx))
10829 snd_hda_codec_write(codec, nid, 0,
10830 AC_VERB_SET_CONNECT_SEL,
10836 /* add mic boosts if needed */
10837 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10839 struct alc_spec *spec = codec->spec;
10840 struct auto_pin_cfg *cfg = &spec->autocfg;
10844 for (i = 0; i < cfg->num_inputs; i++) {
10845 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10847 nid = cfg->inputs[i].pin;
10848 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10850 snprintf(label, sizeof(label), "%s Boost",
10851 hda_get_autocfg_input_label(codec, cfg, i));
10852 err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0,
10853 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10861 /* almost identical with ALC880 parser... */
10862 static int alc882_parse_auto_config(struct hda_codec *codec)
10864 struct alc_spec *spec = codec->spec;
10865 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10868 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10872 if (!spec->autocfg.line_outs)
10873 return 0; /* can't find valid BIOS pin config */
10875 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10878 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10881 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10885 err = alc880_auto_create_extra_out(spec,
10886 spec->autocfg.speaker_pins[0],
10890 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10894 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10896 alc_auto_parse_digital(codec);
10898 if (spec->kctls.list)
10899 add_mixer(spec, spec->kctls.list);
10901 add_verb(spec, alc883_auto_init_verbs);
10902 /* if ADC 0x07 is available, initialize it, too */
10903 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10904 add_verb(spec, alc882_adc1_init_verbs);
10906 spec->num_mux_defs = 1;
10907 spec->input_mux = &spec->private_imux[0];
10909 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10911 err = alc_auto_add_mic_boost(codec);
10915 return 1; /* config found */
10918 /* additional initialization for auto-configuration model */
10919 static void alc882_auto_init(struct hda_codec *codec)
10921 struct alc_spec *spec = codec->spec;
10922 alc882_auto_init_multi_out(codec);
10923 alc882_auto_init_hp_out(codec);
10924 alc882_auto_init_analog_input(codec);
10925 alc882_auto_init_input_src(codec);
10926 alc_auto_init_digital(codec);
10927 if (spec->unsol_event)
10928 alc_inithook(codec);
10931 static int patch_alc882(struct hda_codec *codec)
10933 struct alc_spec *spec;
10934 int err, board_config;
10936 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10940 codec->spec = spec;
10942 switch (codec->vendor_id) {
10947 /* ALC883 and variants */
10948 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10952 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10956 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10957 board_config = snd_hda_check_board_codec_sid_config(codec,
10958 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10960 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10961 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10963 board_config = ALC882_AUTO;
10966 if (board_config == ALC882_AUTO)
10967 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10969 alc_auto_parse_customize_define(codec);
10971 if (board_config == ALC882_AUTO) {
10972 /* automatic parse from the BIOS config */
10973 err = alc882_parse_auto_config(codec);
10979 "hda_codec: Cannot set up configuration "
10980 "from BIOS. Using base mode...\n");
10981 board_config = ALC882_3ST_DIG;
10985 if (has_cdefine_beep(codec)) {
10986 err = snd_hda_attach_beep_device(codec, 0x1);
10993 if (board_config != ALC882_AUTO)
10994 setup_preset(codec, &alc882_presets[board_config]);
10996 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10997 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10998 /* FIXME: setup DAC5 */
10999 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11000 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11002 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11003 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11005 if (!spec->adc_nids && spec->input_mux) {
11007 spec->num_adc_nids = 0;
11008 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11009 const struct hda_input_mux *imux = spec->input_mux;
11011 hda_nid_t items[16];
11012 hda_nid_t nid = alc882_adc_nids[i];
11013 unsigned int wcap = get_wcaps(codec, nid);
11015 wcap = get_wcaps_type(wcap);
11016 if (wcap != AC_WID_AUD_IN)
11018 spec->private_adc_nids[spec->num_adc_nids] = nid;
11019 err = snd_hda_get_connections(codec, nid, &cap, 1);
11022 err = snd_hda_get_connections(codec, cap, items,
11023 ARRAY_SIZE(items));
11026 for (j = 0; j < imux->num_items; j++)
11027 if (imux->items[j].index >= err)
11029 if (j < imux->num_items)
11031 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11032 spec->num_adc_nids++;
11034 spec->adc_nids = spec->private_adc_nids;
11035 spec->capsrc_nids = spec->private_capsrc_nids;
11038 set_capture_mixer(codec);
11040 if (has_cdefine_beep(codec))
11041 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11043 if (board_config == ALC882_AUTO)
11044 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
11046 spec->vmaster_nid = 0x0c;
11048 codec->patch_ops = alc_patch_ops;
11049 if (board_config == ALC882_AUTO)
11050 spec->init_hook = alc882_auto_init;
11052 alc_init_jacks(codec);
11053 #ifdef CONFIG_SND_HDA_POWER_SAVE
11054 if (!spec->loopback.amplist)
11055 spec->loopback.amplist = alc882_loopbacks;
11066 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11067 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11069 #define alc262_dac_nids alc260_dac_nids
11070 #define alc262_adc_nids alc882_adc_nids
11071 #define alc262_adc_nids_alt alc882_adc_nids_alt
11072 #define alc262_capsrc_nids alc882_capsrc_nids
11073 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11075 #define alc262_modes alc260_modes
11076 #define alc262_capture_source alc882_capture_source
11078 static hda_nid_t alc262_dmic_adc_nids[1] = {
11083 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11085 static struct snd_kcontrol_new alc262_base_mixer[] = {
11086 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11087 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11088 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11089 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11090 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11091 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11092 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11093 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11094 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11095 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11096 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11097 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11099 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11100 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11101 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11105 /* update HP, line and mono-out pins according to the master switch */
11106 static void alc262_hp_master_update(struct hda_codec *codec)
11108 struct alc_spec *spec = codec->spec;
11109 int val = spec->master_sw;
11111 /* HP & line-out */
11112 snd_hda_codec_write_cache(codec, 0x1b, 0,
11113 AC_VERB_SET_PIN_WIDGET_CONTROL,
11115 snd_hda_codec_write_cache(codec, 0x15, 0,
11116 AC_VERB_SET_PIN_WIDGET_CONTROL,
11118 /* mono (speaker) depending on the HP jack sense */
11119 val = val && !spec->jack_present;
11120 snd_hda_codec_write_cache(codec, 0x16, 0,
11121 AC_VERB_SET_PIN_WIDGET_CONTROL,
11122 val ? PIN_OUT : 0);
11125 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11127 struct alc_spec *spec = codec->spec;
11129 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11130 alc262_hp_master_update(codec);
11133 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11135 if ((res >> 26) != ALC880_HP_EVENT)
11137 alc262_hp_bpc_automute(codec);
11140 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11142 struct alc_spec *spec = codec->spec;
11144 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11145 alc262_hp_master_update(codec);
11148 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11151 if ((res >> 26) != ALC880_HP_EVENT)
11153 alc262_hp_wildwest_automute(codec);
11156 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11158 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11159 struct snd_ctl_elem_value *ucontrol)
11161 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11162 struct alc_spec *spec = codec->spec;
11163 int val = !!*ucontrol->value.integer.value;
11165 if (val == spec->master_sw)
11167 spec->master_sw = val;
11168 alc262_hp_master_update(codec);
11172 #define ALC262_HP_MASTER_SWITCH \
11174 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11175 .name = "Master Playback Switch", \
11176 .info = snd_ctl_boolean_mono_info, \
11177 .get = alc262_hp_master_sw_get, \
11178 .put = alc262_hp_master_sw_put, \
11181 .iface = NID_MAPPING, \
11182 .name = "Master Playback Switch", \
11183 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11187 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11188 ALC262_HP_MASTER_SWITCH,
11189 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11190 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11191 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11192 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11194 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11198 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11199 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11200 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11201 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11202 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11203 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11204 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11205 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11206 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11207 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11211 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11212 ALC262_HP_MASTER_SWITCH,
11213 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11214 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11215 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11216 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11217 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11219 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11221 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11222 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11223 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
11224 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11225 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11226 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11227 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11231 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11232 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11233 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11234 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
11238 /* mute/unmute internal speaker according to the hp jack and mute state */
11239 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11241 struct alc_spec *spec = codec->spec;
11243 spec->autocfg.hp_pins[0] = 0x15;
11244 spec->autocfg.speaker_pins[0] = 0x14;
11247 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11248 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11249 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11250 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11251 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11254 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11258 static struct hda_verb alc262_hp_t5735_verbs[] = {
11259 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11260 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11262 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11266 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11267 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11269 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11270 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11271 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11272 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11276 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11277 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11278 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11279 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11280 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11281 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11282 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11284 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11285 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11286 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11290 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11297 /* bind hp and internal speaker mute (with plug check) as master switch */
11298 static void alc262_hippo_master_update(struct hda_codec *codec)
11300 struct alc_spec *spec = codec->spec;
11301 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11302 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11303 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11307 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11308 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11309 HDA_AMP_MUTE, mute);
11310 /* mute internal speaker per jack sense */
11311 if (spec->jack_present)
11312 mute = HDA_AMP_MUTE;
11314 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11315 HDA_AMP_MUTE, mute);
11316 if (speaker_nid && speaker_nid != line_nid)
11317 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11318 HDA_AMP_MUTE, mute);
11321 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11323 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11324 struct snd_ctl_elem_value *ucontrol)
11326 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11327 struct alc_spec *spec = codec->spec;
11328 int val = !!*ucontrol->value.integer.value;
11330 if (val == spec->master_sw)
11332 spec->master_sw = val;
11333 alc262_hippo_master_update(codec);
11337 #define ALC262_HIPPO_MASTER_SWITCH \
11339 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11340 .name = "Master Playback Switch", \
11341 .info = snd_ctl_boolean_mono_info, \
11342 .get = alc262_hippo_master_sw_get, \
11343 .put = alc262_hippo_master_sw_put, \
11346 .iface = NID_MAPPING, \
11347 .name = "Master Playback Switch", \
11348 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11349 (SUBDEV_SPEAKER(0) << 16), \
11352 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11353 ALC262_HIPPO_MASTER_SWITCH,
11354 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11355 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11356 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, 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),
11365 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11369 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11370 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11371 ALC262_HIPPO_MASTER_SWITCH,
11372 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11373 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11374 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11375 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11378 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11379 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11380 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11381 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11385 /* mute/unmute internal speaker according to the hp jack and mute state */
11386 static void alc262_hippo_automute(struct hda_codec *codec)
11388 struct alc_spec *spec = codec->spec;
11389 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11391 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11392 alc262_hippo_master_update(codec);
11395 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11397 if ((res >> 26) != ALC880_HP_EVENT)
11399 alc262_hippo_automute(codec);
11402 static void alc262_hippo_setup(struct hda_codec *codec)
11404 struct alc_spec *spec = codec->spec;
11406 spec->autocfg.hp_pins[0] = 0x15;
11407 spec->autocfg.speaker_pins[0] = 0x14;
11410 static void alc262_hippo1_setup(struct hda_codec *codec)
11412 struct alc_spec *spec = codec->spec;
11414 spec->autocfg.hp_pins[0] = 0x1b;
11415 spec->autocfg.speaker_pins[0] = 0x14;
11419 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11420 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11421 ALC262_HIPPO_MASTER_SWITCH,
11422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11423 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11424 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11425 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11429 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11430 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11431 ALC262_HIPPO_MASTER_SWITCH,
11432 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11435 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11436 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11440 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11441 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11442 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11443 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11444 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11445 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11446 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11448 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11449 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11450 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11451 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11452 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11456 static struct hda_verb alc262_tyan_verbs[] = {
11457 /* Headphone automute */
11458 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11459 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11460 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11462 /* P11 AUX_IN, white 4-pin connector */
11463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11464 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11465 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11466 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11471 /* unsolicited event for HP jack sensing */
11472 static void alc262_tyan_setup(struct hda_codec *codec)
11474 struct alc_spec *spec = codec->spec;
11476 spec->autocfg.hp_pins[0] = 0x1b;
11477 spec->autocfg.speaker_pins[0] = 0x15;
11481 #define alc262_capture_mixer alc882_capture_mixer
11482 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11485 * generic initialization of ADC, input mixers and output mixers
11487 static struct hda_verb alc262_init_verbs[] = {
11489 * Unmute ADC0-2 and set the default input to mic-in
11491 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11492 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11493 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11494 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11495 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11496 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11498 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11500 * Note: PASD motherboards uses the Line In 2 as the input for
11501 * front panel mic (mic 2)
11503 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11511 * Set up output mixers (0x0c - 0x0e)
11513 /* set vol=0 to output mixers */
11514 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11515 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11516 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11517 /* set up input amps for analog loopback */
11518 /* Amp Indices: DAC = 0, mixer = 1 */
11519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11520 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11521 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11522 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11523 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11524 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11527 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11528 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11529 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11530 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11531 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11533 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11534 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11535 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11536 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11537 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11539 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11540 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11542 /* FIXME: use matrix-type input source selection */
11543 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11544 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11545 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11546 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11547 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11548 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11550 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11551 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11552 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11553 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11556 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11557 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11558 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11563 static struct hda_verb alc262_eapd_verbs[] = {
11564 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11565 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11569 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11570 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11571 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11572 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11574 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11575 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11579 static struct hda_verb alc262_sony_unsol_verbs[] = {
11580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11581 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11582 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11584 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11585 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11589 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11590 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11591 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11592 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11593 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11594 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11598 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11599 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11602 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11603 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11604 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11605 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11606 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11610 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11612 struct alc_spec *spec = codec->spec;
11614 spec->autocfg.hp_pins[0] = 0x15;
11615 spec->autocfg.speaker_pins[0] = 0x14;
11616 spec->ext_mic.pin = 0x18;
11617 spec->ext_mic.mux_idx = 0;
11618 spec->int_mic.pin = 0x12;
11619 spec->int_mic.mux_idx = 9;
11620 spec->auto_mic = 1;
11626 * 0x16 = internal speaker
11627 * 0x18 = external mic
11630 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11631 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11632 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11634 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11635 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11636 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11638 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11639 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11643 static struct hda_verb alc262_nec_verbs[] = {
11644 /* Unmute Speaker */
11645 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11648 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11651 /* External mic to headphone */
11652 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11653 /* External mic to speaker */
11654 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11660 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11661 * 0x1b = port replicator headphone out
11664 #define ALC_HP_EVENT 0x37
11666 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11667 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11668 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11669 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11670 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11674 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11675 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11676 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11680 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11681 /* Front Mic pin: input vref at 50% */
11682 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11683 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11687 static struct hda_input_mux alc262_fujitsu_capture_source = {
11691 { "Int Mic", 0x1 },
11696 static struct hda_input_mux alc262_HP_capture_source = {
11700 { "Front Mic", 0x1 },
11707 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11711 { "Front Mic", 0x2 },
11717 /* mute/unmute internal speaker according to the hp jacks and mute state */
11718 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11720 struct alc_spec *spec = codec->spec;
11723 if (force || !spec->sense_updated) {
11724 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11725 snd_hda_jack_detect(codec, 0x1b);
11726 spec->sense_updated = 1;
11728 /* unmute internal speaker only if both HPs are unplugged and
11729 * master switch is on
11731 if (spec->jack_present)
11732 mute = HDA_AMP_MUTE;
11734 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11735 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11736 HDA_AMP_MUTE, mute);
11739 /* unsolicited event for HP jack sensing */
11740 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11743 if ((res >> 26) != ALC_HP_EVENT)
11745 alc262_fujitsu_automute(codec, 1);
11748 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11750 alc262_fujitsu_automute(codec, 1);
11753 /* bind volumes of both NID 0x0c and 0x0d */
11754 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11755 .ops = &snd_hda_bind_vol,
11757 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11758 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11763 /* mute/unmute internal speaker according to the hp jack and mute state */
11764 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11766 struct alc_spec *spec = codec->spec;
11769 if (force || !spec->sense_updated) {
11770 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11771 spec->sense_updated = 1;
11773 if (spec->jack_present) {
11774 /* mute internal speaker */
11775 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11776 HDA_AMP_MUTE, HDA_AMP_MUTE);
11777 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11778 HDA_AMP_MUTE, HDA_AMP_MUTE);
11780 /* unmute internal speaker if necessary */
11781 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11782 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11783 HDA_AMP_MUTE, mute);
11784 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11785 HDA_AMP_MUTE, mute);
11789 /* unsolicited event for HP jack sensing */
11790 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11793 if ((res >> 26) != ALC_HP_EVENT)
11795 alc262_lenovo_3000_automute(codec, 1);
11798 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11799 int dir, int idx, long *valp)
11803 for (i = 0; i < 2; i++, valp++)
11804 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11806 *valp ? 0 : HDA_AMP_MUTE);
11810 /* bind hp and internal speaker mute (with plug check) */
11811 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11812 struct snd_ctl_elem_value *ucontrol)
11814 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11815 long *valp = ucontrol->value.integer.value;
11818 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11819 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11821 alc262_fujitsu_automute(codec, 0);
11825 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11826 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11828 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11829 .name = "Master Playback Switch",
11830 .subdevice = HDA_SUBDEV_AMP_FLAG,
11831 .info = snd_hda_mixer_amp_switch_info,
11832 .get = snd_hda_mixer_amp_switch_get,
11833 .put = alc262_fujitsu_master_sw_put,
11834 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11837 .iface = NID_MAPPING,
11838 .name = "Master Playback Switch",
11839 .private_value = 0x1b,
11841 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11842 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11843 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11844 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11845 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11846 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11847 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11848 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11852 /* bind hp and internal speaker mute (with plug check) */
11853 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11854 struct snd_ctl_elem_value *ucontrol)
11856 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11857 long *valp = ucontrol->value.integer.value;
11860 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11862 alc262_lenovo_3000_automute(codec, 0);
11866 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11867 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11869 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11870 .name = "Master Playback Switch",
11871 .subdevice = HDA_SUBDEV_AMP_FLAG,
11872 .info = snd_hda_mixer_amp_switch_info,
11873 .get = snd_hda_mixer_amp_switch_get,
11874 .put = alc262_lenovo_3000_master_sw_put,
11875 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11877 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11878 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11879 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11880 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11881 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11882 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11883 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11884 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11888 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11889 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11890 ALC262_HIPPO_MASTER_SWITCH,
11891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11893 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11894 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11895 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11896 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11900 /* additional init verbs for Benq laptops */
11901 static struct hda_verb alc262_EAPD_verbs[] = {
11902 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11903 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11907 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11908 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11909 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11911 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11912 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11916 /* Samsung Q1 Ultra Vista model setup */
11917 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11918 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11919 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11922 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11923 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11927 static struct hda_verb alc262_ultra_verbs[] = {
11929 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11930 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11931 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11933 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11934 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11935 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11936 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11938 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11939 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11940 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11941 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11944 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11946 /* ADC, choose mic */
11947 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11948 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11949 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11950 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11951 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11952 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11953 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11954 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11955 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11956 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11960 /* mute/unmute internal speaker according to the hp jack and mute state */
11961 static void alc262_ultra_automute(struct hda_codec *codec)
11963 struct alc_spec *spec = codec->spec;
11967 /* auto-mute only when HP is used as HP */
11968 if (!spec->cur_mux[0]) {
11969 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11970 if (spec->jack_present)
11971 mute = HDA_AMP_MUTE;
11973 /* mute/unmute internal speaker */
11974 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11975 HDA_AMP_MUTE, mute);
11976 /* mute/unmute HP */
11977 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11978 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11981 /* unsolicited event for HP jack sensing */
11982 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11985 if ((res >> 26) != ALC880_HP_EVENT)
11987 alc262_ultra_automute(codec);
11990 static struct hda_input_mux alc262_ultra_capture_source = {
11994 { "Headphone", 0x7 },
11998 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11999 struct snd_ctl_elem_value *ucontrol)
12001 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12002 struct alc_spec *spec = codec->spec;
12005 ret = alc_mux_enum_put(kcontrol, ucontrol);
12008 /* reprogram the HP pin as mic or HP according to the input source */
12009 snd_hda_codec_write_cache(codec, 0x15, 0,
12010 AC_VERB_SET_PIN_WIDGET_CONTROL,
12011 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12012 alc262_ultra_automute(codec); /* mute/unmute HP */
12016 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12017 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12018 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12021 .name = "Capture Source",
12022 .info = alc_mux_enum_info,
12023 .get = alc_mux_enum_get,
12024 .put = alc262_ultra_mux_enum_put,
12027 .iface = NID_MAPPING,
12028 .name = "Capture Source",
12029 .private_value = 0x15,
12034 /* We use two mixers depending on the output pin; 0x16 is a mono output
12035 * and thus it's bound with a different mixer.
12036 * This function returns which mixer amp should be used.
12038 static int alc262_check_volbit(hda_nid_t nid)
12042 else if (nid == 0x16)
12048 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12049 const char *pfx, int *vbits, int idx)
12054 vbit = alc262_check_volbit(nid);
12057 if (*vbits & vbit) /* a volume control for this mixer already there */
12061 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12063 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12064 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12067 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12068 const char *pfx, int idx)
12075 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12077 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12078 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12081 /* add playback controls from the parsed DAC table */
12082 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12083 const struct auto_pin_cfg *cfg)
12089 spec->multiout.num_dacs = 1; /* only use one dac */
12090 spec->multiout.dac_nids = spec->private_dac_nids;
12091 spec->multiout.dac_nids[0] = 2;
12093 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
12095 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12097 else if (cfg->line_out_type == AUTO_PIN_HP_OUT)
12101 for (i = 0; i < 2; i++) {
12102 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12105 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12106 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12111 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12112 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12119 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12120 alc262_check_volbit(cfg->speaker_pins[0]) |
12121 alc262_check_volbit(cfg->hp_pins[0]);
12122 if (vbits == 1 || vbits == 2)
12123 pfx = "Master"; /* only one mixer is used */
12125 for (i = 0; i < 2; i++) {
12126 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12130 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12131 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12132 "Speaker", &vbits, i);
12136 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12137 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12138 "Headphone", &vbits, i);
12146 #define alc262_auto_create_input_ctls \
12147 alc882_auto_create_input_ctls
12150 * generic initialization of ADC, input mixers and output mixers
12152 static struct hda_verb alc262_volume_init_verbs[] = {
12154 * Unmute ADC0-2 and set the default input to mic-in
12156 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12158 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12159 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12160 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12161 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12163 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12165 * Note: PASD motherboards uses the Line In 2 as the input for
12166 * front panel mic (mic 2)
12168 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12169 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12170 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12171 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12172 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12173 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12176 * Set up output mixers (0x0c - 0x0f)
12178 /* set vol=0 to output mixers */
12179 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12180 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12181 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12183 /* set up input amps for analog loopback */
12184 /* Amp Indices: DAC = 0, mixer = 1 */
12185 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12186 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12187 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12188 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12189 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12190 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12192 /* FIXME: use matrix-type input source selection */
12193 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12194 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12200 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12201 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12202 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12203 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12206 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12207 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12208 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12213 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12215 * Unmute ADC0-2 and set the default input to mic-in
12217 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12218 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12219 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12220 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12221 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12222 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12224 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12226 * Note: PASD motherboards uses the Line In 2 as the input for
12227 * front panel mic (mic 2)
12229 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12233 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12239 * Set up output mixers (0x0c - 0x0e)
12241 /* set vol=0 to output mixers */
12242 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12243 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12246 /* set up input amps for analog loopback */
12247 /* Amp Indices: DAC = 0, mixer = 1 */
12248 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12250 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12251 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12252 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12255 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12257 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12259 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12260 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12262 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12263 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12265 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12266 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12268 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12269 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12271 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12272 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12273 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12274 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12275 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12276 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12279 /* FIXME: use matrix-type input source selection */
12280 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12281 /* Input mixer1: only unmute Mic */
12282 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12283 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12284 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12285 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12286 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12287 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12288 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12289 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12290 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12293 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12295 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12296 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12297 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12299 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12300 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12303 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12305 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12306 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12307 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12312 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12317 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12319 * Unmute ADC0-2 and set the default input to mic-in
12321 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12322 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12323 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12324 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12325 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12326 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12328 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12330 * Note: PASD motherboards uses the Line In 2 as the input for front
12331 * panel mic (mic 2)
12333 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12334 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12335 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12343 * Set up output mixers (0x0c - 0x0e)
12345 /* set vol=0 to output mixers */
12346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12350 /* set up input amps for analog loopback */
12351 /* Amp Indices: DAC = 0, mixer = 1 */
12352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12354 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12361 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12362 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12363 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12364 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12365 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12366 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12368 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12371 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12372 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12374 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12375 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12376 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12377 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12378 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12379 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12381 /* FIXME: use matrix-type input source selection */
12382 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12383 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12389 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12390 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12392 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12395 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12396 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12397 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12405 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12408 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12413 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12415 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12416 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12417 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12419 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12420 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12421 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12422 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12424 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12425 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12426 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12437 static const struct alc_fixup alc262_fixups[] = {
12438 [PINFIX_FSC_H270] = {
12439 .pins = (const struct alc_pincfg[]) {
12440 { 0x14, 0x99130110 }, /* speaker */
12441 { 0x15, 0x0221142f }, /* front HP */
12442 { 0x1b, 0x0121141f }, /* rear HP */
12446 [PINFIX_PB_M5210] = {
12447 .verbs = (const struct hda_verb[]) {
12448 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
12454 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12455 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12460 #ifdef CONFIG_SND_HDA_POWER_SAVE
12461 #define alc262_loopbacks alc880_loopbacks
12464 /* pcm configuration: identical with ALC880 */
12465 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12466 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12467 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12468 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12471 * BIOS auto configuration
12473 static int alc262_parse_auto_config(struct hda_codec *codec)
12475 struct alc_spec *spec = codec->spec;
12477 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12479 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12483 if (!spec->autocfg.line_outs) {
12484 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12485 spec->multiout.max_channels = 2;
12486 spec->no_analog = 1;
12489 return 0; /* can't find valid BIOS pin config */
12491 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12494 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12498 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12501 alc_auto_parse_digital(codec);
12503 if (spec->kctls.list)
12504 add_mixer(spec, spec->kctls.list);
12506 add_verb(spec, alc262_volume_init_verbs);
12507 spec->num_mux_defs = 1;
12508 spec->input_mux = &spec->private_imux[0];
12510 err = alc_auto_add_mic_boost(codec);
12514 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12519 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12520 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12521 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12522 #define alc262_auto_init_input_src alc882_auto_init_input_src
12525 /* init callback for auto-configuration model -- overriding the default init */
12526 static void alc262_auto_init(struct hda_codec *codec)
12528 struct alc_spec *spec = codec->spec;
12529 alc262_auto_init_multi_out(codec);
12530 alc262_auto_init_hp_out(codec);
12531 alc262_auto_init_analog_input(codec);
12532 alc262_auto_init_input_src(codec);
12533 alc_auto_init_digital(codec);
12534 if (spec->unsol_event)
12535 alc_inithook(codec);
12539 * configuration and preset
12541 static const char *alc262_models[ALC262_MODEL_LAST] = {
12542 [ALC262_BASIC] = "basic",
12543 [ALC262_HIPPO] = "hippo",
12544 [ALC262_HIPPO_1] = "hippo_1",
12545 [ALC262_FUJITSU] = "fujitsu",
12546 [ALC262_HP_BPC] = "hp-bpc",
12547 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12548 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12549 [ALC262_HP_RP5700] = "hp-rp5700",
12550 [ALC262_BENQ_ED8] = "benq",
12551 [ALC262_BENQ_T31] = "benq-t31",
12552 [ALC262_SONY_ASSAMD] = "sony-assamd",
12553 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12554 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12555 [ALC262_ULTRA] = "ultra",
12556 [ALC262_LENOVO_3000] = "lenovo-3000",
12557 [ALC262_NEC] = "nec",
12558 [ALC262_TYAN] = "tyan",
12559 [ALC262_AUTO] = "auto",
12562 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12563 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12564 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12565 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12567 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12569 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12571 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12572 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12573 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12574 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12575 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12576 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12577 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12578 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12579 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12580 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12581 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12582 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12583 ALC262_HP_TC_T5735),
12584 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12585 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12586 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12587 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12588 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12589 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12590 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12591 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12592 #if 0 /* disable the quirk since model=auto works better in recent versions */
12593 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12594 ALC262_SONY_ASSAMD),
12596 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12597 ALC262_TOSHIBA_RX1),
12598 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12599 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12600 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12601 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12602 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12604 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12605 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12606 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12607 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12608 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12612 static struct alc_config_preset alc262_presets[] = {
12614 .mixers = { alc262_base_mixer },
12615 .init_verbs = { alc262_init_verbs },
12616 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12617 .dac_nids = alc262_dac_nids,
12619 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12620 .channel_mode = alc262_modes,
12621 .input_mux = &alc262_capture_source,
12624 .mixers = { alc262_hippo_mixer },
12625 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12626 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12627 .dac_nids = alc262_dac_nids,
12629 .dig_out_nid = ALC262_DIGOUT_NID,
12630 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12631 .channel_mode = alc262_modes,
12632 .input_mux = &alc262_capture_source,
12633 .unsol_event = alc262_hippo_unsol_event,
12634 .setup = alc262_hippo_setup,
12635 .init_hook = alc262_hippo_automute,
12637 [ALC262_HIPPO_1] = {
12638 .mixers = { alc262_hippo1_mixer },
12639 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12640 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12641 .dac_nids = alc262_dac_nids,
12643 .dig_out_nid = ALC262_DIGOUT_NID,
12644 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12645 .channel_mode = alc262_modes,
12646 .input_mux = &alc262_capture_source,
12647 .unsol_event = alc262_hippo_unsol_event,
12648 .setup = alc262_hippo1_setup,
12649 .init_hook = alc262_hippo_automute,
12651 [ALC262_FUJITSU] = {
12652 .mixers = { alc262_fujitsu_mixer },
12653 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12654 alc262_fujitsu_unsol_verbs },
12655 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12656 .dac_nids = alc262_dac_nids,
12658 .dig_out_nid = ALC262_DIGOUT_NID,
12659 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12660 .channel_mode = alc262_modes,
12661 .input_mux = &alc262_fujitsu_capture_source,
12662 .unsol_event = alc262_fujitsu_unsol_event,
12663 .init_hook = alc262_fujitsu_init_hook,
12665 [ALC262_HP_BPC] = {
12666 .mixers = { alc262_HP_BPC_mixer },
12667 .init_verbs = { alc262_HP_BPC_init_verbs },
12668 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12669 .dac_nids = alc262_dac_nids,
12671 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12672 .channel_mode = alc262_modes,
12673 .input_mux = &alc262_HP_capture_source,
12674 .unsol_event = alc262_hp_bpc_unsol_event,
12675 .init_hook = alc262_hp_bpc_automute,
12677 [ALC262_HP_BPC_D7000_WF] = {
12678 .mixers = { alc262_HP_BPC_WildWest_mixer },
12679 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12680 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12681 .dac_nids = alc262_dac_nids,
12683 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12684 .channel_mode = alc262_modes,
12685 .input_mux = &alc262_HP_D7000_capture_source,
12686 .unsol_event = alc262_hp_wildwest_unsol_event,
12687 .init_hook = alc262_hp_wildwest_automute,
12689 [ALC262_HP_BPC_D7000_WL] = {
12690 .mixers = { alc262_HP_BPC_WildWest_mixer,
12691 alc262_HP_BPC_WildWest_option_mixer },
12692 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12693 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12694 .dac_nids = alc262_dac_nids,
12696 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12697 .channel_mode = alc262_modes,
12698 .input_mux = &alc262_HP_D7000_capture_source,
12699 .unsol_event = alc262_hp_wildwest_unsol_event,
12700 .init_hook = alc262_hp_wildwest_automute,
12702 [ALC262_HP_TC_T5735] = {
12703 .mixers = { alc262_hp_t5735_mixer },
12704 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_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,
12711 .unsol_event = alc_sku_unsol_event,
12712 .setup = alc262_hp_t5735_setup,
12713 .init_hook = alc_inithook,
12715 [ALC262_HP_RP5700] = {
12716 .mixers = { alc262_hp_rp5700_mixer },
12717 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12718 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12719 .dac_nids = alc262_dac_nids,
12720 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12721 .channel_mode = alc262_modes,
12722 .input_mux = &alc262_hp_rp5700_capture_source,
12724 [ALC262_BENQ_ED8] = {
12725 .mixers = { alc262_base_mixer },
12726 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12727 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12728 .dac_nids = alc262_dac_nids,
12730 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12731 .channel_mode = alc262_modes,
12732 .input_mux = &alc262_capture_source,
12734 [ALC262_SONY_ASSAMD] = {
12735 .mixers = { alc262_sony_mixer },
12736 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12737 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12738 .dac_nids = alc262_dac_nids,
12740 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12741 .channel_mode = alc262_modes,
12742 .input_mux = &alc262_capture_source,
12743 .unsol_event = alc262_hippo_unsol_event,
12744 .setup = alc262_hippo_setup,
12745 .init_hook = alc262_hippo_automute,
12747 [ALC262_BENQ_T31] = {
12748 .mixers = { alc262_benq_t31_mixer },
12749 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12750 alc_hp15_unsol_verbs },
12751 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12752 .dac_nids = alc262_dac_nids,
12754 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12755 .channel_mode = alc262_modes,
12756 .input_mux = &alc262_capture_source,
12757 .unsol_event = alc262_hippo_unsol_event,
12758 .setup = alc262_hippo_setup,
12759 .init_hook = alc262_hippo_automute,
12762 .mixers = { alc262_ultra_mixer },
12763 .cap_mixer = alc262_ultra_capture_mixer,
12764 .init_verbs = { alc262_ultra_verbs },
12765 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12766 .dac_nids = alc262_dac_nids,
12767 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12768 .channel_mode = alc262_modes,
12769 .input_mux = &alc262_ultra_capture_source,
12770 .adc_nids = alc262_adc_nids, /* ADC0 */
12771 .capsrc_nids = alc262_capsrc_nids,
12772 .num_adc_nids = 1, /* single ADC */
12773 .unsol_event = alc262_ultra_unsol_event,
12774 .init_hook = alc262_ultra_automute,
12776 [ALC262_LENOVO_3000] = {
12777 .mixers = { alc262_lenovo_3000_mixer },
12778 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12779 alc262_lenovo_3000_unsol_verbs,
12780 alc262_lenovo_3000_init_verbs },
12781 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12782 .dac_nids = alc262_dac_nids,
12784 .dig_out_nid = ALC262_DIGOUT_NID,
12785 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12786 .channel_mode = alc262_modes,
12787 .input_mux = &alc262_fujitsu_capture_source,
12788 .unsol_event = alc262_lenovo_3000_unsol_event,
12791 .mixers = { alc262_nec_mixer },
12792 .init_verbs = { alc262_nec_verbs },
12793 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12794 .dac_nids = alc262_dac_nids,
12796 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12797 .channel_mode = alc262_modes,
12798 .input_mux = &alc262_capture_source,
12800 [ALC262_TOSHIBA_S06] = {
12801 .mixers = { alc262_toshiba_s06_mixer },
12802 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12803 alc262_eapd_verbs },
12804 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12805 .capsrc_nids = alc262_dmic_capsrc_nids,
12806 .dac_nids = alc262_dac_nids,
12807 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12808 .num_adc_nids = 1, /* single ADC */
12809 .dig_out_nid = ALC262_DIGOUT_NID,
12810 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12811 .channel_mode = alc262_modes,
12812 .unsol_event = alc_sku_unsol_event,
12813 .setup = alc262_toshiba_s06_setup,
12814 .init_hook = alc_inithook,
12816 [ALC262_TOSHIBA_RX1] = {
12817 .mixers = { alc262_toshiba_rx1_mixer },
12818 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12819 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12820 .dac_nids = alc262_dac_nids,
12822 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12823 .channel_mode = alc262_modes,
12824 .input_mux = &alc262_capture_source,
12825 .unsol_event = alc262_hippo_unsol_event,
12826 .setup = alc262_hippo_setup,
12827 .init_hook = alc262_hippo_automute,
12830 .mixers = { alc262_tyan_mixer },
12831 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12832 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12833 .dac_nids = alc262_dac_nids,
12835 .dig_out_nid = ALC262_DIGOUT_NID,
12836 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12837 .channel_mode = alc262_modes,
12838 .input_mux = &alc262_capture_source,
12839 .unsol_event = alc_automute_amp_unsol_event,
12840 .setup = alc262_tyan_setup,
12841 .init_hook = alc_automute_amp,
12845 static int patch_alc262(struct hda_codec *codec)
12847 struct alc_spec *spec;
12851 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12855 codec->spec = spec;
12857 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12862 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12863 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12864 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12865 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12868 alc_auto_parse_customize_define(codec);
12870 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12872 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12876 if (board_config < 0) {
12877 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12879 board_config = ALC262_AUTO;
12882 if (board_config == ALC262_AUTO)
12883 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1);
12885 if (board_config == ALC262_AUTO) {
12886 /* automatic parse from the BIOS config */
12887 err = alc262_parse_auto_config(codec);
12893 "hda_codec: Cannot set up configuration "
12894 "from BIOS. Using base mode...\n");
12895 board_config = ALC262_BASIC;
12899 if (!spec->no_analog && has_cdefine_beep(codec)) {
12900 err = snd_hda_attach_beep_device(codec, 0x1);
12907 if (board_config != ALC262_AUTO)
12908 setup_preset(codec, &alc262_presets[board_config]);
12910 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12911 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12913 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12914 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12916 if (!spec->adc_nids && spec->input_mux) {
12918 /* check whether the digital-mic has to be supported */
12919 for (i = 0; i < spec->input_mux->num_items; i++) {
12920 if (spec->input_mux->items[i].index >= 9)
12923 if (i < spec->input_mux->num_items) {
12924 /* use only ADC0 */
12925 spec->adc_nids = alc262_dmic_adc_nids;
12926 spec->num_adc_nids = 1;
12927 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12929 /* all analog inputs */
12930 /* check whether NID 0x07 is valid */
12931 unsigned int wcap = get_wcaps(codec, 0x07);
12934 wcap = get_wcaps_type(wcap);
12935 if (wcap != AC_WID_AUD_IN) {
12936 spec->adc_nids = alc262_adc_nids_alt;
12937 spec->num_adc_nids =
12938 ARRAY_SIZE(alc262_adc_nids_alt);
12939 spec->capsrc_nids = alc262_capsrc_nids_alt;
12941 spec->adc_nids = alc262_adc_nids;
12942 spec->num_adc_nids =
12943 ARRAY_SIZE(alc262_adc_nids);
12944 spec->capsrc_nids = alc262_capsrc_nids;
12948 if (!spec->cap_mixer && !spec->no_analog)
12949 set_capture_mixer(codec);
12950 if (!spec->no_analog && has_cdefine_beep(codec))
12951 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12953 if (board_config == ALC262_AUTO)
12954 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
12956 spec->vmaster_nid = 0x0c;
12958 codec->patch_ops = alc_patch_ops;
12959 if (board_config == ALC262_AUTO)
12960 spec->init_hook = alc262_auto_init;
12962 alc_init_jacks(codec);
12963 #ifdef CONFIG_SND_HDA_POWER_SAVE
12964 if (!spec->loopback.amplist)
12965 spec->loopback.amplist = alc262_loopbacks;
12972 * ALC268 channel source setting (2 channel)
12974 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12975 #define alc268_modes alc260_modes
12977 static hda_nid_t alc268_dac_nids[2] = {
12982 static hda_nid_t alc268_adc_nids[2] = {
12987 static hda_nid_t alc268_adc_nids_alt[1] = {
12992 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12994 static struct snd_kcontrol_new alc268_base_mixer[] = {
12995 /* output mixer control */
12996 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12997 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12998 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12999 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13000 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13001 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13002 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13006 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13007 /* output mixer control */
13008 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13009 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13010 ALC262_HIPPO_MASTER_SWITCH,
13011 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13012 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13013 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13017 /* bind Beep switches of both NID 0x0f and 0x10 */
13018 static struct hda_bind_ctls alc268_bind_beep_sw = {
13019 .ops = &snd_hda_bind_sw,
13021 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13022 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13027 static struct snd_kcontrol_new alc268_beep_mixer[] = {
13028 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13029 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13033 static struct hda_verb alc268_eapd_verbs[] = {
13034 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13035 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13039 /* Toshiba specific */
13040 static struct hda_verb alc268_toshiba_verbs[] = {
13041 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13045 /* Acer specific */
13046 /* bind volumes of both NID 0x02 and 0x03 */
13047 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13048 .ops = &snd_hda_bind_vol,
13050 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13051 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13056 /* mute/unmute internal speaker according to the hp jack and mute state */
13057 static void alc268_acer_automute(struct hda_codec *codec, int force)
13059 struct alc_spec *spec = codec->spec;
13062 if (force || !spec->sense_updated) {
13063 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13064 spec->sense_updated = 1;
13066 if (spec->jack_present)
13067 mute = HDA_AMP_MUTE; /* mute internal speaker */
13068 else /* unmute internal speaker if necessary */
13069 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13070 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13071 HDA_AMP_MUTE, mute);
13075 /* bind hp and internal speaker mute (with plug check) */
13076 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13077 struct snd_ctl_elem_value *ucontrol)
13079 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13080 long *valp = ucontrol->value.integer.value;
13083 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13085 alc268_acer_automute(codec, 0);
13089 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13090 /* output mixer control */
13091 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13093 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13094 .name = "Master Playback Switch",
13095 .subdevice = HDA_SUBDEV_AMP_FLAG,
13096 .info = snd_hda_mixer_amp_switch_info,
13097 .get = snd_hda_mixer_amp_switch_get,
13098 .put = alc268_acer_master_sw_put,
13099 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13101 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13105 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13106 /* output mixer control */
13107 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13109 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13110 .name = "Master Playback Switch",
13111 .subdevice = HDA_SUBDEV_AMP_FLAG,
13112 .info = snd_hda_mixer_amp_switch_info,
13113 .get = snd_hda_mixer_amp_switch_get,
13114 .put = alc268_acer_master_sw_put,
13115 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13117 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13118 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13119 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13123 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13124 /* output mixer control */
13125 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13127 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13128 .name = "Master Playback Switch",
13129 .subdevice = HDA_SUBDEV_AMP_FLAG,
13130 .info = snd_hda_mixer_amp_switch_info,
13131 .get = snd_hda_mixer_amp_switch_get,
13132 .put = alc268_acer_master_sw_put,
13133 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13136 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13140 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13141 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13143 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13144 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13145 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13146 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13150 static struct hda_verb alc268_acer_verbs[] = {
13151 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13152 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13153 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13154 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13155 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13156 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13157 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13161 /* unsolicited event for HP jack sensing */
13162 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13163 #define alc268_toshiba_setup alc262_hippo_setup
13164 #define alc268_toshiba_automute alc262_hippo_automute
13166 static void alc268_acer_unsol_event(struct hda_codec *codec,
13169 if ((res >> 26) != ALC880_HP_EVENT)
13171 alc268_acer_automute(codec, 1);
13174 static void alc268_acer_init_hook(struct hda_codec *codec)
13176 alc268_acer_automute(codec, 1);
13179 /* toggle speaker-output according to the hp-jack state */
13180 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13182 unsigned int present;
13183 unsigned char bits;
13185 present = snd_hda_jack_detect(codec, 0x15);
13186 bits = present ? HDA_AMP_MUTE : 0;
13187 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13188 HDA_AMP_MUTE, bits);
13189 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13190 HDA_AMP_MUTE, bits);
13193 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13196 switch (res >> 26) {
13197 case ALC880_HP_EVENT:
13198 alc268_aspire_one_speaker_automute(codec);
13200 case ALC880_MIC_EVENT:
13201 alc_mic_automute(codec);
13206 static void alc268_acer_lc_setup(struct hda_codec *codec)
13208 struct alc_spec *spec = codec->spec;
13209 spec->ext_mic.pin = 0x18;
13210 spec->ext_mic.mux_idx = 0;
13211 spec->int_mic.pin = 0x12;
13212 spec->int_mic.mux_idx = 6;
13213 spec->auto_mic = 1;
13216 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13218 alc268_aspire_one_speaker_automute(codec);
13219 alc_mic_automute(codec);
13222 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13223 /* output mixer control */
13224 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13225 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13228 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13229 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13233 static struct hda_verb alc268_dell_verbs[] = {
13234 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13236 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13237 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13241 /* mute/unmute internal speaker according to the hp jack and mute state */
13242 static void alc268_dell_setup(struct hda_codec *codec)
13244 struct alc_spec *spec = codec->spec;
13246 spec->autocfg.hp_pins[0] = 0x15;
13247 spec->autocfg.speaker_pins[0] = 0x14;
13248 spec->ext_mic.pin = 0x18;
13249 spec->ext_mic.mux_idx = 0;
13250 spec->int_mic.pin = 0x19;
13251 spec->int_mic.mux_idx = 1;
13252 spec->auto_mic = 1;
13255 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13256 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13257 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13258 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13259 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13260 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13261 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13262 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13263 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13267 static struct hda_verb alc267_quanta_il1_verbs[] = {
13268 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13269 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13273 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13275 struct alc_spec *spec = codec->spec;
13276 spec->autocfg.hp_pins[0] = 0x15;
13277 spec->autocfg.speaker_pins[0] = 0x14;
13278 spec->ext_mic.pin = 0x18;
13279 spec->ext_mic.mux_idx = 0;
13280 spec->int_mic.pin = 0x19;
13281 spec->int_mic.mux_idx = 1;
13282 spec->auto_mic = 1;
13286 * generic initialization of ADC, input mixers and output mixers
13288 static struct hda_verb alc268_base_init_verbs[] = {
13289 /* Unmute DAC0-1 and set vol = 0 */
13290 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13291 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13294 * Set up output mixers (0x0c - 0x0e)
13296 /* set vol=0 to output mixers */
13297 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13298 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13300 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13301 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13304 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13305 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13306 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13307 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13308 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13309 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13310 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13312 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13313 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13314 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13315 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13316 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13318 /* set PCBEEP vol = 0, mute connections */
13319 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13320 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13321 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13323 /* Unmute Selector 23h,24h and set the default input to mic-in */
13325 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13326 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13327 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13328 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13334 * generic initialization of ADC, input mixers and output mixers
13336 static struct hda_verb alc268_volume_init_verbs[] = {
13337 /* set output DAC */
13338 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13339 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13341 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13342 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13343 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13344 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13345 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13348 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13349 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13351 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13352 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13354 /* set PCBEEP vol = 0, mute connections */
13355 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13356 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13357 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13362 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13363 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13364 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13368 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13369 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13370 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13375 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13376 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13377 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13378 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13379 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13384 static struct hda_input_mux alc268_capture_source = {
13388 { "Front Mic", 0x1 },
13394 static struct hda_input_mux alc268_acer_capture_source = {
13398 { "Internal Mic", 0x1 },
13403 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13407 { "Internal Mic", 0x6 },
13412 #ifdef CONFIG_SND_DEBUG
13413 static struct snd_kcontrol_new alc268_test_mixer[] = {
13414 /* Volume widgets */
13415 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13416 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13417 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13418 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13419 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13420 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13421 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13422 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13423 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13424 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13425 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13426 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13427 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13428 /* The below appears problematic on some hardwares */
13429 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13430 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13431 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13432 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13433 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13435 /* Modes for retasking pin widgets */
13436 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13437 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13438 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13439 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13441 /* Controls for GPIO pins, assuming they are configured as outputs */
13442 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13443 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13444 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13445 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13447 /* Switches to allow the digital SPDIF output pin to be enabled.
13448 * The ALC268 does not have an SPDIF input.
13450 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13452 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13453 * this output to turn on an external amplifier.
13455 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13456 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13462 /* create input playback/capture controls for the given pin */
13463 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13464 const char *ctlname, int idx)
13475 case 0x1a: /* ALC259/269 only */
13476 case 0x1b: /* ALC259/269 only */
13477 case 0x21: /* ALC269vb has this pin, too */
13481 snd_printd(KERN_WARNING "hda_codec: "
13482 "ignoring pin 0x%x as unknown\n", nid);
13485 if (spec->multiout.dac_nids[0] != dac &&
13486 spec->multiout.dac_nids[1] != dac) {
13487 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13488 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13492 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13496 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13497 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13499 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13500 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13506 /* add playback controls from the parsed DAC table */
13507 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13508 const struct auto_pin_cfg *cfg)
13513 spec->multiout.dac_nids = spec->private_dac_nids;
13515 nid = cfg->line_out_pins[0];
13518 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13522 err = alc268_new_analog_output(spec, nid, name, 0);
13527 nid = cfg->speaker_pins[0];
13529 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13530 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13534 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13538 nid = cfg->hp_pins[0];
13540 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13545 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13547 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13548 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13555 /* create playback/capture controls for input pins */
13556 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13557 const struct auto_pin_cfg *cfg)
13559 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13562 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13563 hda_nid_t nid, int pin_type)
13567 alc_set_pin_output(codec, nid, pin_type);
13568 if (nid == 0x14 || nid == 0x16)
13572 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13575 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13577 struct alc_spec *spec = codec->spec;
13580 for (i = 0; i < spec->autocfg.line_outs; i++) {
13581 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13582 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13583 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13587 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13589 struct alc_spec *spec = codec->spec;
13593 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13594 pin = spec->autocfg.hp_pins[i];
13595 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13597 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13598 pin = spec->autocfg.speaker_pins[i];
13599 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13601 if (spec->autocfg.mono_out_pin)
13602 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13603 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13606 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13608 struct alc_spec *spec = codec->spec;
13609 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13610 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13611 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13612 unsigned int dac_vol1, dac_vol2;
13614 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13615 snd_hda_codec_write(codec, speaker_nid, 0,
13616 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13617 /* mute mixer inputs from 0x1d */
13618 snd_hda_codec_write(codec, 0x0f, 0,
13619 AC_VERB_SET_AMP_GAIN_MUTE,
13621 snd_hda_codec_write(codec, 0x10, 0,
13622 AC_VERB_SET_AMP_GAIN_MUTE,
13625 /* unmute mixer inputs from 0x1d */
13626 snd_hda_codec_write(codec, 0x0f, 0,
13627 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13628 snd_hda_codec_write(codec, 0x10, 0,
13629 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13632 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13633 if (line_nid == 0x14)
13634 dac_vol2 = AMP_OUT_ZERO;
13635 else if (line_nid == 0x15)
13636 dac_vol1 = AMP_OUT_ZERO;
13637 if (hp_nid == 0x14)
13638 dac_vol2 = AMP_OUT_ZERO;
13639 else if (hp_nid == 0x15)
13640 dac_vol1 = AMP_OUT_ZERO;
13641 if (line_nid != 0x16 || hp_nid != 0x16 ||
13642 spec->autocfg.line_out_pins[1] != 0x16 ||
13643 spec->autocfg.line_out_pins[2] != 0x16)
13644 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13646 snd_hda_codec_write(codec, 0x02, 0,
13647 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13648 snd_hda_codec_write(codec, 0x03, 0,
13649 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13652 /* pcm configuration: identical with ALC880 */
13653 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13654 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13655 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13656 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13659 * BIOS auto configuration
13661 static int alc268_parse_auto_config(struct hda_codec *codec)
13663 struct alc_spec *spec = codec->spec;
13665 static hda_nid_t alc268_ignore[] = { 0 };
13667 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13671 if (!spec->autocfg.line_outs) {
13672 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13673 spec->multiout.max_channels = 2;
13674 spec->no_analog = 1;
13677 return 0; /* can't find valid BIOS pin config */
13679 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13682 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13686 spec->multiout.max_channels = 2;
13689 /* digital only support output */
13690 alc_auto_parse_digital(codec);
13691 if (spec->kctls.list)
13692 add_mixer(spec, spec->kctls.list);
13694 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13695 add_mixer(spec, alc268_beep_mixer);
13697 add_verb(spec, alc268_volume_init_verbs);
13698 spec->num_mux_defs = 2;
13699 spec->input_mux = &spec->private_imux[0];
13701 err = alc_auto_add_mic_boost(codec);
13705 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13710 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13712 /* init callback for auto-configuration model -- overriding the default init */
13713 static void alc268_auto_init(struct hda_codec *codec)
13715 struct alc_spec *spec = codec->spec;
13716 alc268_auto_init_multi_out(codec);
13717 alc268_auto_init_hp_out(codec);
13718 alc268_auto_init_mono_speaker_out(codec);
13719 alc268_auto_init_analog_input(codec);
13720 alc_auto_init_digital(codec);
13721 if (spec->unsol_event)
13722 alc_inithook(codec);
13726 * configuration and preset
13728 static const char *alc268_models[ALC268_MODEL_LAST] = {
13729 [ALC267_QUANTA_IL1] = "quanta-il1",
13730 [ALC268_3ST] = "3stack",
13731 [ALC268_TOSHIBA] = "toshiba",
13732 [ALC268_ACER] = "acer",
13733 [ALC268_ACER_DMIC] = "acer-dmic",
13734 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13735 [ALC268_DELL] = "dell",
13736 [ALC268_ZEPTO] = "zepto",
13737 #ifdef CONFIG_SND_DEBUG
13738 [ALC268_TEST] = "test",
13740 [ALC268_AUTO] = "auto",
13743 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13744 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13745 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13746 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13747 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13748 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13749 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13750 ALC268_ACER_ASPIRE_ONE),
13751 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13752 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13753 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13754 /* almost compatible with toshiba but with optional digital outs;
13755 * auto-probing seems working fine
13757 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13759 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13760 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13761 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13762 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13763 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13767 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13768 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13769 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13770 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13771 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13776 static struct alc_config_preset alc268_presets[] = {
13777 [ALC267_QUANTA_IL1] = {
13778 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13779 alc268_capture_nosrc_mixer },
13780 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13781 alc267_quanta_il1_verbs },
13782 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13783 .dac_nids = alc268_dac_nids,
13784 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13785 .adc_nids = alc268_adc_nids_alt,
13787 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13788 .channel_mode = alc268_modes,
13789 .unsol_event = alc_sku_unsol_event,
13790 .setup = alc267_quanta_il1_setup,
13791 .init_hook = alc_inithook,
13794 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13795 alc268_beep_mixer },
13796 .init_verbs = { alc268_base_init_verbs },
13797 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13798 .dac_nids = alc268_dac_nids,
13799 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13800 .adc_nids = alc268_adc_nids_alt,
13801 .capsrc_nids = alc268_capsrc_nids,
13803 .dig_out_nid = ALC268_DIGOUT_NID,
13804 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13805 .channel_mode = alc268_modes,
13806 .input_mux = &alc268_capture_source,
13808 [ALC268_TOSHIBA] = {
13809 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13810 alc268_beep_mixer },
13811 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13812 alc268_toshiba_verbs },
13813 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13814 .dac_nids = alc268_dac_nids,
13815 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13816 .adc_nids = alc268_adc_nids_alt,
13817 .capsrc_nids = alc268_capsrc_nids,
13819 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13820 .channel_mode = alc268_modes,
13821 .input_mux = &alc268_capture_source,
13822 .unsol_event = alc268_toshiba_unsol_event,
13823 .setup = alc268_toshiba_setup,
13824 .init_hook = alc268_toshiba_automute,
13827 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13828 alc268_beep_mixer },
13829 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13830 alc268_acer_verbs },
13831 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13832 .dac_nids = alc268_dac_nids,
13833 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13834 .adc_nids = alc268_adc_nids_alt,
13835 .capsrc_nids = alc268_capsrc_nids,
13837 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13838 .channel_mode = alc268_modes,
13839 .input_mux = &alc268_acer_capture_source,
13840 .unsol_event = alc268_acer_unsol_event,
13841 .init_hook = alc268_acer_init_hook,
13843 [ALC268_ACER_DMIC] = {
13844 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13845 alc268_beep_mixer },
13846 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13847 alc268_acer_verbs },
13848 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13849 .dac_nids = alc268_dac_nids,
13850 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13851 .adc_nids = alc268_adc_nids_alt,
13852 .capsrc_nids = alc268_capsrc_nids,
13854 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13855 .channel_mode = alc268_modes,
13856 .input_mux = &alc268_acer_dmic_capture_source,
13857 .unsol_event = alc268_acer_unsol_event,
13858 .init_hook = alc268_acer_init_hook,
13860 [ALC268_ACER_ASPIRE_ONE] = {
13861 .mixers = { alc268_acer_aspire_one_mixer,
13863 alc268_capture_nosrc_mixer },
13864 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13865 alc268_acer_aspire_one_verbs },
13866 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13867 .dac_nids = alc268_dac_nids,
13868 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13869 .adc_nids = alc268_adc_nids_alt,
13870 .capsrc_nids = alc268_capsrc_nids,
13872 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13873 .channel_mode = alc268_modes,
13874 .unsol_event = alc268_acer_lc_unsol_event,
13875 .setup = alc268_acer_lc_setup,
13876 .init_hook = alc268_acer_lc_init_hook,
13879 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13880 alc268_capture_nosrc_mixer },
13881 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13882 alc268_dell_verbs },
13883 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13884 .dac_nids = alc268_dac_nids,
13885 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13886 .adc_nids = alc268_adc_nids_alt,
13887 .capsrc_nids = alc268_capsrc_nids,
13889 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13890 .channel_mode = alc268_modes,
13891 .unsol_event = alc_sku_unsol_event,
13892 .setup = alc268_dell_setup,
13893 .init_hook = alc_inithook,
13896 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13897 alc268_beep_mixer },
13898 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13899 alc268_toshiba_verbs },
13900 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13901 .dac_nids = alc268_dac_nids,
13902 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13903 .adc_nids = alc268_adc_nids_alt,
13904 .capsrc_nids = alc268_capsrc_nids,
13906 .dig_out_nid = ALC268_DIGOUT_NID,
13907 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13908 .channel_mode = alc268_modes,
13909 .input_mux = &alc268_capture_source,
13910 .setup = alc268_toshiba_setup,
13911 .init_hook = alc268_toshiba_automute,
13913 #ifdef CONFIG_SND_DEBUG
13915 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13916 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13917 alc268_volume_init_verbs },
13918 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13919 .dac_nids = alc268_dac_nids,
13920 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13921 .adc_nids = alc268_adc_nids_alt,
13922 .capsrc_nids = alc268_capsrc_nids,
13924 .dig_out_nid = ALC268_DIGOUT_NID,
13925 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13926 .channel_mode = alc268_modes,
13927 .input_mux = &alc268_capture_source,
13932 static int patch_alc268(struct hda_codec *codec)
13934 struct alc_spec *spec;
13936 int i, has_beep, err;
13938 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13942 codec->spec = spec;
13944 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13948 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13949 board_config = snd_hda_check_board_codec_sid_config(codec,
13950 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13952 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13953 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13955 board_config = ALC268_AUTO;
13958 if (board_config == ALC268_AUTO) {
13959 /* automatic parse from the BIOS config */
13960 err = alc268_parse_auto_config(codec);
13966 "hda_codec: Cannot set up configuration "
13967 "from BIOS. Using base mode...\n");
13968 board_config = ALC268_3ST;
13972 if (board_config != ALC268_AUTO)
13973 setup_preset(codec, &alc268_presets[board_config]);
13975 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13976 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13977 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13979 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13982 for (i = 0; i < spec->num_mixers; i++) {
13983 if (spec->mixers[i] == alc268_beep_mixer) {
13990 err = snd_hda_attach_beep_device(codec, 0x1);
13995 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13996 /* override the amp caps for beep generator */
13997 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13998 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13999 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14000 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14001 (0 << AC_AMPCAP_MUTE_SHIFT));
14004 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14005 /* check whether NID 0x07 is valid */
14006 unsigned int wcap = get_wcaps(codec, 0x07);
14009 spec->capsrc_nids = alc268_capsrc_nids;
14011 wcap = get_wcaps_type(wcap);
14012 if (spec->auto_mic ||
14013 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14014 spec->adc_nids = alc268_adc_nids_alt;
14015 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14016 if (spec->auto_mic)
14017 fixup_automic_adc(codec);
14018 if (spec->auto_mic || spec->input_mux->num_items == 1)
14019 add_mixer(spec, alc268_capture_nosrc_mixer);
14021 add_mixer(spec, alc268_capture_alt_mixer);
14023 spec->adc_nids = alc268_adc_nids;
14024 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14025 add_mixer(spec, alc268_capture_mixer);
14027 /* set default input source */
14028 for (i = 0; i < spec->num_adc_nids; i++)
14029 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
14030 0, AC_VERB_SET_CONNECT_SEL,
14031 i < spec->num_mux_defs ?
14032 spec->input_mux[i].items[0].index :
14033 spec->input_mux->items[0].index);
14036 spec->vmaster_nid = 0x02;
14038 codec->patch_ops = alc_patch_ops;
14039 if (board_config == ALC268_AUTO)
14040 spec->init_hook = alc268_auto_init;
14042 alc_init_jacks(codec);
14048 * ALC269 channel source setting (2 channel)
14050 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14052 #define alc269_dac_nids alc260_dac_nids
14054 static hda_nid_t alc269_adc_nids[1] = {
14059 static hda_nid_t alc269_capsrc_nids[1] = {
14063 static hda_nid_t alc269vb_adc_nids[1] = {
14068 static hda_nid_t alc269vb_capsrc_nids[1] = {
14072 static hda_nid_t alc269_adc_candidates[] = {
14076 #define alc269_modes alc260_modes
14077 #define alc269_capture_source alc880_lg_lw_capture_source
14079 static struct snd_kcontrol_new alc269_base_mixer[] = {
14080 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14081 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14082 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14083 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14084 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14085 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14086 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14087 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14088 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14089 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14091 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14095 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14096 /* output mixer control */
14097 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14099 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14100 .name = "Master Playback Switch",
14101 .subdevice = HDA_SUBDEV_AMP_FLAG,
14102 .info = snd_hda_mixer_amp_switch_info,
14103 .get = snd_hda_mixer_amp_switch_get,
14104 .put = alc268_acer_master_sw_put,
14105 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14109 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14110 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14111 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14112 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
14116 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14117 /* output mixer control */
14118 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14120 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14121 .name = "Master Playback Switch",
14122 .subdevice = HDA_SUBDEV_AMP_FLAG,
14123 .info = snd_hda_mixer_amp_switch_info,
14124 .get = snd_hda_mixer_amp_switch_get,
14125 .put = alc268_acer_master_sw_put,
14126 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14130 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14131 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14132 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14133 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
14134 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14135 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14136 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
14140 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14141 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14142 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14143 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14144 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14148 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14149 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14150 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14151 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14152 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14156 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14157 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14158 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14162 /* capture mixer elements */
14163 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14164 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14165 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14166 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14167 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
14171 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14172 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14173 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14174 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14178 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14179 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14180 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14181 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14182 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
14186 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14187 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14188 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14189 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14194 #define alc269_fujitsu_mixer alc269_laptop_mixer
14196 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14197 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14198 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14200 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14201 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14202 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14206 static struct hda_verb alc269_lifebook_verbs[] = {
14207 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14208 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14209 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14210 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14211 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14212 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14213 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14214 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14215 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14216 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14220 /* toggle speaker-output according to the hp-jack state */
14221 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14223 unsigned int present;
14224 unsigned char bits;
14226 present = snd_hda_jack_detect(codec, 0x15);
14227 bits = present ? HDA_AMP_MUTE : 0;
14228 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14229 HDA_AMP_MUTE, bits);
14230 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14231 HDA_AMP_MUTE, bits);
14233 snd_hda_codec_write(codec, 0x20, 0,
14234 AC_VERB_SET_COEF_INDEX, 0x0c);
14235 snd_hda_codec_write(codec, 0x20, 0,
14236 AC_VERB_SET_PROC_COEF, 0x680);
14238 snd_hda_codec_write(codec, 0x20, 0,
14239 AC_VERB_SET_COEF_INDEX, 0x0c);
14240 snd_hda_codec_write(codec, 0x20, 0,
14241 AC_VERB_SET_PROC_COEF, 0x480);
14244 /* toggle speaker-output according to the hp-jacks state */
14245 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14247 unsigned int present;
14248 unsigned char bits;
14250 /* Check laptop headphone socket */
14251 present = snd_hda_jack_detect(codec, 0x15);
14253 /* Check port replicator headphone socket */
14254 present |= snd_hda_jack_detect(codec, 0x1a);
14256 bits = present ? HDA_AMP_MUTE : 0;
14257 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14258 HDA_AMP_MUTE, bits);
14259 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14260 HDA_AMP_MUTE, bits);
14262 snd_hda_codec_write(codec, 0x20, 0,
14263 AC_VERB_SET_COEF_INDEX, 0x0c);
14264 snd_hda_codec_write(codec, 0x20, 0,
14265 AC_VERB_SET_PROC_COEF, 0x680);
14267 snd_hda_codec_write(codec, 0x20, 0,
14268 AC_VERB_SET_COEF_INDEX, 0x0c);
14269 snd_hda_codec_write(codec, 0x20, 0,
14270 AC_VERB_SET_PROC_COEF, 0x480);
14273 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14275 unsigned int present_laptop;
14276 unsigned int present_dock;
14278 present_laptop = snd_hda_jack_detect(codec, 0x18);
14279 present_dock = snd_hda_jack_detect(codec, 0x1b);
14281 /* Laptop mic port overrides dock mic port, design decision */
14283 snd_hda_codec_write(codec, 0x23, 0,
14284 AC_VERB_SET_CONNECT_SEL, 0x3);
14285 if (present_laptop)
14286 snd_hda_codec_write(codec, 0x23, 0,
14287 AC_VERB_SET_CONNECT_SEL, 0x0);
14288 if (!present_dock && !present_laptop)
14289 snd_hda_codec_write(codec, 0x23, 0,
14290 AC_VERB_SET_CONNECT_SEL, 0x1);
14293 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14296 switch (res >> 26) {
14297 case ALC880_HP_EVENT:
14298 alc269_quanta_fl1_speaker_automute(codec);
14300 case ALC880_MIC_EVENT:
14301 alc_mic_automute(codec);
14306 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14309 if ((res >> 26) == ALC880_HP_EVENT)
14310 alc269_lifebook_speaker_automute(codec);
14311 if ((res >> 26) == ALC880_MIC_EVENT)
14312 alc269_lifebook_mic_autoswitch(codec);
14315 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14317 struct alc_spec *spec = codec->spec;
14318 spec->autocfg.hp_pins[0] = 0x15;
14319 spec->autocfg.speaker_pins[0] = 0x14;
14320 spec->ext_mic.pin = 0x18;
14321 spec->ext_mic.mux_idx = 0;
14322 spec->int_mic.pin = 0x19;
14323 spec->int_mic.mux_idx = 1;
14324 spec->auto_mic = 1;
14327 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14329 alc269_quanta_fl1_speaker_automute(codec);
14330 alc_mic_automute(codec);
14333 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14335 alc269_lifebook_speaker_automute(codec);
14336 alc269_lifebook_mic_autoswitch(codec);
14339 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14340 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14341 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14342 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14343 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14344 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14345 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14346 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14350 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14351 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14352 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14353 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14354 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14355 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14356 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14360 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14361 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14362 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14363 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14364 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14365 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14366 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14367 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14371 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14372 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14373 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14374 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14375 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14376 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14377 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14378 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14382 static struct hda_verb alc271_acer_dmic_verbs[] = {
14383 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14384 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14385 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14387 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14388 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14389 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14390 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14391 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14392 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14396 /* toggle speaker-output according to the hp-jack state */
14397 static void alc269_speaker_automute(struct hda_codec *codec)
14399 struct alc_spec *spec = codec->spec;
14400 unsigned int nid = spec->autocfg.hp_pins[0];
14401 unsigned int present;
14402 unsigned char bits;
14404 present = snd_hda_jack_detect(codec, nid);
14405 bits = present ? HDA_AMP_MUTE : 0;
14406 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14407 HDA_AMP_MUTE, bits);
14408 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14409 HDA_AMP_MUTE, bits);
14410 alc_report_jack(codec, nid);
14413 /* unsolicited event for HP jack sensing */
14414 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14417 switch (res >> 26) {
14418 case ALC880_HP_EVENT:
14419 alc269_speaker_automute(codec);
14421 case ALC880_MIC_EVENT:
14422 alc_mic_automute(codec);
14427 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14429 struct alc_spec *spec = codec->spec;
14430 spec->autocfg.hp_pins[0] = 0x15;
14431 spec->autocfg.speaker_pins[0] = 0x14;
14432 spec->ext_mic.pin = 0x18;
14433 spec->ext_mic.mux_idx = 0;
14434 spec->int_mic.pin = 0x19;
14435 spec->int_mic.mux_idx = 1;
14436 spec->auto_mic = 1;
14439 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14441 struct alc_spec *spec = codec->spec;
14442 spec->autocfg.hp_pins[0] = 0x15;
14443 spec->autocfg.speaker_pins[0] = 0x14;
14444 spec->ext_mic.pin = 0x18;
14445 spec->ext_mic.mux_idx = 0;
14446 spec->int_mic.pin = 0x12;
14447 spec->int_mic.mux_idx = 5;
14448 spec->auto_mic = 1;
14451 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14453 struct alc_spec *spec = codec->spec;
14454 spec->autocfg.hp_pins[0] = 0x21;
14455 spec->autocfg.speaker_pins[0] = 0x14;
14456 spec->ext_mic.pin = 0x18;
14457 spec->ext_mic.mux_idx = 0;
14458 spec->int_mic.pin = 0x19;
14459 spec->int_mic.mux_idx = 1;
14460 spec->auto_mic = 1;
14463 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14465 struct alc_spec *spec = codec->spec;
14466 spec->autocfg.hp_pins[0] = 0x21;
14467 spec->autocfg.speaker_pins[0] = 0x14;
14468 spec->ext_mic.pin = 0x18;
14469 spec->ext_mic.mux_idx = 0;
14470 spec->int_mic.pin = 0x12;
14471 spec->int_mic.mux_idx = 6;
14472 spec->auto_mic = 1;
14475 static void alc269_laptop_inithook(struct hda_codec *codec)
14477 alc269_speaker_automute(codec);
14478 alc_mic_automute(codec);
14482 * generic initialization of ADC, input mixers and output mixers
14484 static struct hda_verb alc269_init_verbs[] = {
14486 * Unmute ADC0 and set the default input to mic-in
14488 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14491 * Set up output mixers (0x02 - 0x03)
14493 /* set vol=0 to output mixers */
14494 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14495 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14497 /* set up input amps for analog loopback */
14498 /* Amp Indices: DAC = 0, mixer = 1 */
14499 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14501 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14502 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14503 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14504 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14506 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14507 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14508 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14509 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14510 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14511 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14512 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14514 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14515 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14517 /* FIXME: use Mux-type input source selection */
14518 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14519 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14520 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14523 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14527 static struct hda_verb alc269vb_init_verbs[] = {
14529 * Unmute ADC0 and set the default input to mic-in
14531 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14534 * Set up output mixers (0x02 - 0x03)
14536 /* set vol=0 to output mixers */
14537 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14538 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14540 /* set up input amps for analog loopback */
14541 /* Amp Indices: DAC = 0, mixer = 1 */
14542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14544 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14545 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14546 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14547 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14549 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14550 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14551 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14552 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14553 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14554 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14555 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14557 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14558 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14560 /* FIXME: use Mux-type input source selection */
14561 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14562 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14563 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14566 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14570 #define alc269_auto_create_multi_out_ctls \
14571 alc268_auto_create_multi_out_ctls
14572 #define alc269_auto_create_input_ctls \
14573 alc268_auto_create_input_ctls
14575 #ifdef CONFIG_SND_HDA_POWER_SAVE
14576 #define alc269_loopbacks alc880_loopbacks
14579 /* pcm configuration: identical with ALC880 */
14580 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14581 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14582 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14583 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14585 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14589 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14590 /* NID is set in alc_build_pcms */
14592 .open = alc880_playback_pcm_open,
14593 .prepare = alc880_playback_pcm_prepare,
14594 .cleanup = alc880_playback_pcm_cleanup
14598 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14602 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14603 /* NID is set in alc_build_pcms */
14606 #ifdef CONFIG_SND_HDA_POWER_SAVE
14607 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14609 switch (codec->subsystem_id) {
14616 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14618 /* update mute-LED according to the speaker mute state */
14619 if (nid == 0x01 || nid == 0x14) {
14621 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14626 /* mic2 vref pin is used for mute LED control */
14627 snd_hda_codec_update_cache(codec, 0x19, 0,
14628 AC_VERB_SET_PIN_WIDGET_CONTROL,
14631 return alc_check_power_status(codec, nid);
14633 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14635 static int alc275_setup_dual_adc(struct hda_codec *codec)
14637 struct alc_spec *spec = codec->spec;
14639 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14641 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14642 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14643 if (spec->ext_mic.pin <= 0x12) {
14644 spec->private_adc_nids[0] = 0x08;
14645 spec->private_adc_nids[1] = 0x11;
14646 spec->private_capsrc_nids[0] = 0x23;
14647 spec->private_capsrc_nids[1] = 0x22;
14649 spec->private_adc_nids[0] = 0x11;
14650 spec->private_adc_nids[1] = 0x08;
14651 spec->private_capsrc_nids[0] = 0x22;
14652 spec->private_capsrc_nids[1] = 0x23;
14654 spec->adc_nids = spec->private_adc_nids;
14655 spec->capsrc_nids = spec->private_capsrc_nids;
14656 spec->num_adc_nids = 2;
14657 spec->dual_adc_switch = 1;
14658 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14659 spec->adc_nids[0], spec->adc_nids[1]);
14665 /* different alc269-variants */
14667 ALC269_TYPE_NORMAL,
14668 ALC269_TYPE_ALC258,
14669 ALC269_TYPE_ALC259,
14670 ALC269_TYPE_ALC269VB,
14671 ALC269_TYPE_ALC270,
14672 ALC269_TYPE_ALC271X,
14676 * BIOS auto configuration
14678 static int alc269_parse_auto_config(struct hda_codec *codec)
14680 struct alc_spec *spec = codec->spec;
14682 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14684 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14689 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14692 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14693 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14695 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14700 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14702 alc_auto_parse_digital(codec);
14704 if (spec->kctls.list)
14705 add_mixer(spec, spec->kctls.list);
14707 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14708 add_verb(spec, alc269vb_init_verbs);
14709 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14711 add_verb(spec, alc269_init_verbs);
14712 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14715 spec->num_mux_defs = 1;
14716 spec->input_mux = &spec->private_imux[0];
14718 if (!alc275_setup_dual_adc(codec))
14719 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14720 sizeof(alc269_adc_candidates));
14722 /* set default input source */
14723 if (!spec->dual_adc_switch)
14724 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14725 spec->input_mux->items[0].index);
14727 err = alc_auto_add_mic_boost(codec);
14731 if (!spec->cap_mixer && !spec->no_analog)
14732 set_capture_mixer(codec);
14737 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14738 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14739 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14742 /* init callback for auto-configuration model -- overriding the default init */
14743 static void alc269_auto_init(struct hda_codec *codec)
14745 struct alc_spec *spec = codec->spec;
14746 alc269_auto_init_multi_out(codec);
14747 alc269_auto_init_hp_out(codec);
14748 alc269_auto_init_analog_input(codec);
14749 alc_auto_init_digital(codec);
14750 if (spec->unsol_event)
14751 alc_inithook(codec);
14754 #ifdef SND_HDA_NEEDS_RESUME
14755 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14757 int val = alc_read_coef_idx(codec, 0x04);
14762 alc_write_coef_idx(codec, 0x04, val);
14765 #ifdef CONFIG_SND_HDA_POWER_SAVE
14766 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14768 struct alc_spec *spec = codec->spec;
14770 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14771 alc269_toggle_power_output(codec, 0);
14772 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14773 alc269_toggle_power_output(codec, 0);
14778 if (spec && spec->power_hook)
14779 spec->power_hook(codec);
14782 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14784 static int alc269_resume(struct hda_codec *codec)
14786 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14787 alc269_toggle_power_output(codec, 0);
14791 codec->patch_ops.init(codec);
14793 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14794 alc269_toggle_power_output(codec, 1);
14798 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14799 alc269_toggle_power_output(codec, 1);
14801 snd_hda_codec_resume_amp(codec);
14802 snd_hda_codec_resume_cache(codec);
14803 hda_call_check_power_status(codec, 0x01);
14806 #endif /* SND_HDA_NEEDS_RESUME */
14809 ALC269_FIXUP_SONY_VAIO,
14810 ALC269_FIXUP_DELL_M101Z,
14813 static const struct alc_fixup alc269_fixups[] = {
14814 [ALC269_FIXUP_SONY_VAIO] = {
14815 .verbs = (const struct hda_verb[]) {
14816 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14820 [ALC269_FIXUP_DELL_M101Z] = {
14821 .verbs = (const struct hda_verb[]) {
14822 /* Enables internal speaker */
14823 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14824 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14830 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14831 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14832 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14838 * configuration and preset
14840 static const char *alc269_models[ALC269_MODEL_LAST] = {
14841 [ALC269_BASIC] = "basic",
14842 [ALC269_QUANTA_FL1] = "quanta",
14843 [ALC269_AMIC] = "laptop-amic",
14844 [ALC269_DMIC] = "laptop-dmic",
14845 [ALC269_FUJITSU] = "fujitsu",
14846 [ALC269_LIFEBOOK] = "lifebook",
14847 [ALC269_AUTO] = "auto",
14850 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14851 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14852 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14853 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14855 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14856 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14857 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14858 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14859 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14860 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14861 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14862 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14863 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14864 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14865 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14866 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14867 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14868 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14869 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14870 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14871 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14872 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14873 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14874 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14875 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14876 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14877 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14878 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14879 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14880 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14881 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14882 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14883 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14884 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14885 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14886 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14887 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14888 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14889 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14890 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14891 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14893 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14895 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14896 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14897 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14898 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14899 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14900 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14901 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14902 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14903 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14904 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14908 static struct alc_config_preset alc269_presets[] = {
14910 .mixers = { alc269_base_mixer },
14911 .init_verbs = { alc269_init_verbs },
14912 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14913 .dac_nids = alc269_dac_nids,
14915 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14916 .channel_mode = alc269_modes,
14917 .input_mux = &alc269_capture_source,
14919 [ALC269_QUANTA_FL1] = {
14920 .mixers = { alc269_quanta_fl1_mixer },
14921 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14922 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14923 .dac_nids = alc269_dac_nids,
14925 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14926 .channel_mode = alc269_modes,
14927 .input_mux = &alc269_capture_source,
14928 .unsol_event = alc269_quanta_fl1_unsol_event,
14929 .setup = alc269_quanta_fl1_setup,
14930 .init_hook = alc269_quanta_fl1_init_hook,
14933 .mixers = { alc269_laptop_mixer },
14934 .cap_mixer = alc269_laptop_analog_capture_mixer,
14935 .init_verbs = { alc269_init_verbs,
14936 alc269_laptop_amic_init_verbs },
14937 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14938 .dac_nids = alc269_dac_nids,
14940 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14941 .channel_mode = alc269_modes,
14942 .unsol_event = alc269_laptop_unsol_event,
14943 .setup = alc269_laptop_amic_setup,
14944 .init_hook = alc269_laptop_inithook,
14947 .mixers = { alc269_laptop_mixer },
14948 .cap_mixer = alc269_laptop_digital_capture_mixer,
14949 .init_verbs = { alc269_init_verbs,
14950 alc269_laptop_dmic_init_verbs },
14951 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14952 .dac_nids = alc269_dac_nids,
14954 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14955 .channel_mode = alc269_modes,
14956 .unsol_event = alc269_laptop_unsol_event,
14957 .setup = alc269_laptop_dmic_setup,
14958 .init_hook = alc269_laptop_inithook,
14960 [ALC269VB_AMIC] = {
14961 .mixers = { alc269vb_laptop_mixer },
14962 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14963 .init_verbs = { alc269vb_init_verbs,
14964 alc269vb_laptop_amic_init_verbs },
14965 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14966 .dac_nids = alc269_dac_nids,
14968 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14969 .channel_mode = alc269_modes,
14970 .unsol_event = alc269_laptop_unsol_event,
14971 .setup = alc269vb_laptop_amic_setup,
14972 .init_hook = alc269_laptop_inithook,
14974 [ALC269VB_DMIC] = {
14975 .mixers = { alc269vb_laptop_mixer },
14976 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14977 .init_verbs = { alc269vb_init_verbs,
14978 alc269vb_laptop_dmic_init_verbs },
14979 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14980 .dac_nids = alc269_dac_nids,
14982 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14983 .channel_mode = alc269_modes,
14984 .unsol_event = alc269_laptop_unsol_event,
14985 .setup = alc269vb_laptop_dmic_setup,
14986 .init_hook = alc269_laptop_inithook,
14988 [ALC269_FUJITSU] = {
14989 .mixers = { alc269_fujitsu_mixer },
14990 .cap_mixer = alc269_laptop_digital_capture_mixer,
14991 .init_verbs = { alc269_init_verbs,
14992 alc269_laptop_dmic_init_verbs },
14993 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14994 .dac_nids = alc269_dac_nids,
14996 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14997 .channel_mode = alc269_modes,
14998 .unsol_event = alc269_laptop_unsol_event,
14999 .setup = alc269_laptop_dmic_setup,
15000 .init_hook = alc269_laptop_inithook,
15002 [ALC269_LIFEBOOK] = {
15003 .mixers = { alc269_lifebook_mixer },
15004 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15005 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15006 .dac_nids = alc269_dac_nids,
15008 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15009 .channel_mode = alc269_modes,
15010 .input_mux = &alc269_capture_source,
15011 .unsol_event = alc269_lifebook_unsol_event,
15012 .init_hook = alc269_lifebook_init_hook,
15015 .mixers = { alc269_asus_mixer },
15016 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15017 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15018 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15019 .dac_nids = alc269_dac_nids,
15020 .adc_nids = alc262_dmic_adc_nids,
15021 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15022 .capsrc_nids = alc262_dmic_capsrc_nids,
15023 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15024 .channel_mode = alc269_modes,
15025 .input_mux = &alc269_capture_source,
15026 .dig_out_nid = ALC880_DIGOUT_NID,
15027 .unsol_event = alc_sku_unsol_event,
15028 .setup = alc269vb_laptop_dmic_setup,
15029 .init_hook = alc_inithook,
15033 static int alc269_fill_coef(struct hda_codec *codec)
15037 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15038 alc_write_coef_idx(codec, 0xf, 0x960b);
15039 alc_write_coef_idx(codec, 0xe, 0x8817);
15042 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15043 alc_write_coef_idx(codec, 0xf, 0x960b);
15044 alc_write_coef_idx(codec, 0xe, 0x8814);
15047 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15048 val = alc_read_coef_idx(codec, 0x04);
15049 /* Power up output pin */
15050 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15053 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15054 val = alc_read_coef_idx(codec, 0xd);
15055 if ((val & 0x0c00) >> 10 != 0x1) {
15056 /* Capless ramp up clock control */
15057 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15059 val = alc_read_coef_idx(codec, 0x17);
15060 if ((val & 0x01c0) >> 6 != 0x4) {
15061 /* Class D power on reset */
15062 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15068 static int patch_alc269(struct hda_codec *codec)
15070 struct alc_spec *spec;
15071 int board_config, coef;
15074 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15078 codec->spec = spec;
15080 alc_auto_parse_customize_define(codec);
15082 coef = alc_read_coef_idx(codec, 0);
15083 if ((coef & 0x00f0) == 0x0010) {
15084 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15085 spec->cdefine.platform_type == 1) {
15086 alc_codec_rename(codec, "ALC271X");
15087 spec->codec_variant = ALC269_TYPE_ALC271X;
15088 } else if ((coef & 0xf000) == 0x1000) {
15089 spec->codec_variant = ALC269_TYPE_ALC270;
15090 } else if ((coef & 0xf000) == 0x2000) {
15091 alc_codec_rename(codec, "ALC259");
15092 spec->codec_variant = ALC269_TYPE_ALC259;
15093 } else if ((coef & 0xf000) == 0x3000) {
15094 alc_codec_rename(codec, "ALC258");
15095 spec->codec_variant = ALC269_TYPE_ALC258;
15097 alc_codec_rename(codec, "ALC269VB");
15098 spec->codec_variant = ALC269_TYPE_ALC269VB;
15101 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15103 alc269_fill_coef(codec);
15105 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15109 if (board_config < 0) {
15110 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15112 board_config = ALC269_AUTO;
15115 if (board_config == ALC269_AUTO)
15116 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
15118 if (board_config == ALC269_AUTO) {
15119 /* automatic parse from the BIOS config */
15120 err = alc269_parse_auto_config(codec);
15126 "hda_codec: Cannot set up configuration "
15127 "from BIOS. Using base mode...\n");
15128 board_config = ALC269_BASIC;
15132 if (has_cdefine_beep(codec)) {
15133 err = snd_hda_attach_beep_device(codec, 0x1);
15140 if (board_config != ALC269_AUTO)
15141 setup_preset(codec, &alc269_presets[board_config]);
15143 if (board_config == ALC269_QUANTA_FL1) {
15144 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15145 * fix the sample rate of analog I/O to 44.1kHz
15147 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15148 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15149 } else if (spec->dual_adc_switch) {
15150 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15151 /* switch ADC dynamically */
15152 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15154 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15155 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15157 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15158 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15160 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15161 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15162 spec->adc_nids = alc269_adc_nids;
15163 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15164 spec->capsrc_nids = alc269_capsrc_nids;
15166 spec->adc_nids = alc269vb_adc_nids;
15167 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15168 spec->capsrc_nids = alc269vb_capsrc_nids;
15172 if (!spec->cap_mixer)
15173 set_capture_mixer(codec);
15174 if (has_cdefine_beep(codec))
15175 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15177 if (board_config == ALC269_AUTO)
15178 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
15180 spec->vmaster_nid = 0x02;
15182 codec->patch_ops = alc_patch_ops;
15183 #ifdef CONFIG_SND_HDA_POWER_SAVE
15184 codec->patch_ops.suspend = alc269_suspend;
15186 #ifdef SND_HDA_NEEDS_RESUME
15187 codec->patch_ops.resume = alc269_resume;
15189 if (board_config == ALC269_AUTO)
15190 spec->init_hook = alc269_auto_init;
15192 alc_init_jacks(codec);
15193 #ifdef CONFIG_SND_HDA_POWER_SAVE
15194 if (!spec->loopback.amplist)
15195 spec->loopback.amplist = alc269_loopbacks;
15196 if (alc269_mic2_for_mute_led(codec))
15197 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15204 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15208 * set the path ways for 2 channel output
15209 * need to set the codec line out and mic 1 pin widgets to inputs
15211 static struct hda_verb alc861_threestack_ch2_init[] = {
15212 /* set pin widget 1Ah (line in) for input */
15213 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15214 /* set pin widget 18h (mic1/2) for input, for mic also enable
15217 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15219 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15221 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15222 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15228 * need to set the codec line out and mic 1 pin widgets to outputs
15230 static struct hda_verb alc861_threestack_ch6_init[] = {
15231 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15232 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15233 /* set pin widget 18h (mic1) for output (CLFE)*/
15234 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15236 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15237 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15239 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15241 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15242 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15247 static struct hda_channel_mode alc861_threestack_modes[2] = {
15248 { 2, alc861_threestack_ch2_init },
15249 { 6, alc861_threestack_ch6_init },
15251 /* Set mic1 as input and unmute the mixer */
15252 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15253 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15254 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15257 /* Set mic1 as output and mute mixer */
15258 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15259 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15260 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15264 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15265 { 2, alc861_uniwill_m31_ch2_init },
15266 { 4, alc861_uniwill_m31_ch4_init },
15269 /* Set mic1 and line-in as input and unmute the mixer */
15270 static struct hda_verb alc861_asus_ch2_init[] = {
15271 /* set pin widget 1Ah (line in) for input */
15272 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15273 /* set pin widget 18h (mic1/2) for input, for mic also enable
15276 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15278 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15280 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15281 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15285 /* Set mic1 nad line-in as output and mute mixer */
15286 static struct hda_verb alc861_asus_ch6_init[] = {
15287 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15288 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15289 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15290 /* set pin widget 18h (mic1) for output (CLFE)*/
15291 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15292 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15293 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15294 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15296 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15298 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15299 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15304 static struct hda_channel_mode alc861_asus_modes[2] = {
15305 { 2, alc861_asus_ch2_init },
15306 { 6, alc861_asus_ch6_init },
15311 static struct snd_kcontrol_new alc861_base_mixer[] = {
15312 /* output mixer control */
15313 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15314 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15315 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15316 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15317 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15319 /*Input mixer control */
15320 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15321 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15322 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15323 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15324 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15325 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15327 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15328 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15329 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15334 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15335 /* output mixer control */
15336 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15337 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15338 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15339 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15340 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15342 /* Input mixer control */
15343 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15344 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15345 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15346 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15347 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15348 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15350 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15351 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15352 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15355 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15356 .name = "Channel Mode",
15357 .info = alc_ch_mode_info,
15358 .get = alc_ch_mode_get,
15359 .put = alc_ch_mode_put,
15360 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15365 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15366 /* output mixer control */
15367 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15369 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15374 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15375 /* output mixer control */
15376 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15377 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15378 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15379 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15380 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15382 /* Input mixer control */
15383 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15384 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15385 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15386 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15387 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15388 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15390 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15391 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15392 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15395 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15396 .name = "Channel Mode",
15397 .info = alc_ch_mode_info,
15398 .get = alc_ch_mode_get,
15399 .put = alc_ch_mode_put,
15400 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15405 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15406 /* output mixer control */
15407 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15408 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15409 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15410 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15411 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15413 /* Input mixer control */
15414 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15415 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15416 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15417 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15418 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15419 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15421 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15422 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15423 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15426 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15427 .name = "Channel Mode",
15428 .info = alc_ch_mode_info,
15429 .get = alc_ch_mode_get,
15430 .put = alc_ch_mode_put,
15431 .private_value = ARRAY_SIZE(alc861_asus_modes),
15436 /* additional mixer */
15437 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15438 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15439 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15444 * generic initialization of ADC, input mixers and output mixers
15446 static struct hda_verb alc861_base_init_verbs[] = {
15448 * Unmute ADC0 and set the default input to mic-in
15450 /* port-A for surround (rear panel) */
15451 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15452 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15453 /* port-B for mic-in (rear panel) with vref */
15454 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15455 /* port-C for line-in (rear panel) */
15456 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15457 /* port-D for Front */
15458 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15459 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15460 /* port-E for HP out (front panel) */
15461 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15462 /* route front PCM to HP */
15463 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15464 /* port-F for mic-in (front panel) with vref */
15465 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15466 /* port-G for CLFE (rear panel) */
15467 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15468 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15469 /* port-H for side (rear panel) */
15470 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15471 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15473 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15474 /* route front mic to ADC1*/
15475 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15476 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15478 /* Unmute DAC0~3 & spdif out*/
15479 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15480 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15481 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15482 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15483 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15485 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15486 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15487 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15488 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15489 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15491 /* Unmute Stereo Mixer 15 */
15492 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15493 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15494 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15495 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15497 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15498 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15499 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15500 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15501 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15502 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15503 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15504 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15505 /* hp used DAC 3 (Front) */
15506 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15507 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15512 static struct hda_verb alc861_threestack_init_verbs[] = {
15514 * Unmute ADC0 and set the default input to mic-in
15516 /* port-A for surround (rear panel) */
15517 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15518 /* port-B for mic-in (rear panel) with vref */
15519 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15520 /* port-C for line-in (rear panel) */
15521 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15522 /* port-D for Front */
15523 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15524 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15525 /* port-E for HP out (front panel) */
15526 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15527 /* route front PCM to HP */
15528 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15529 /* port-F for mic-in (front panel) with vref */
15530 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15531 /* port-G for CLFE (rear panel) */
15532 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15533 /* port-H for side (rear panel) */
15534 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15536 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15537 /* route front mic to ADC1*/
15538 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15539 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15540 /* Unmute DAC0~3 & spdif out*/
15541 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15542 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15543 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15544 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15547 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15548 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15549 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15550 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15551 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15553 /* Unmute Stereo Mixer 15 */
15554 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15555 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15556 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15557 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15559 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15560 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15561 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15562 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15563 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15564 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15565 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15566 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15567 /* hp used DAC 3 (Front) */
15568 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15569 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15573 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15575 * Unmute ADC0 and set the default input to mic-in
15577 /* port-A for surround (rear panel) */
15578 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15579 /* port-B for mic-in (rear panel) with vref */
15580 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15581 /* port-C for line-in (rear panel) */
15582 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15583 /* port-D for Front */
15584 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15585 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15586 /* port-E for HP out (front panel) */
15587 /* this has to be set to VREF80 */
15588 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15589 /* route front PCM to HP */
15590 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15591 /* port-F for mic-in (front panel) with vref */
15592 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15593 /* port-G for CLFE (rear panel) */
15594 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15595 /* port-H for side (rear panel) */
15596 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15598 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15599 /* route front mic to ADC1*/
15600 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15601 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15602 /* Unmute DAC0~3 & spdif out*/
15603 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15604 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15605 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15606 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15607 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15609 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15610 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15611 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15612 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15613 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15615 /* Unmute Stereo Mixer 15 */
15616 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15617 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15618 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15619 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15621 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15622 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15623 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15624 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15625 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15626 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15627 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15628 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15629 /* hp used DAC 3 (Front) */
15630 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15631 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15635 static struct hda_verb alc861_asus_init_verbs[] = {
15637 * Unmute ADC0 and set the default input to mic-in
15639 /* port-A for surround (rear panel)
15640 * according to codec#0 this is the HP jack
15642 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15643 /* route front PCM to HP */
15644 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15645 /* port-B for mic-in (rear panel) with vref */
15646 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15647 /* port-C for line-in (rear panel) */
15648 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15649 /* port-D for Front */
15650 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15651 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15652 /* port-E for HP out (front panel) */
15653 /* this has to be set to VREF80 */
15654 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15655 /* route front PCM to HP */
15656 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15657 /* port-F for mic-in (front panel) with vref */
15658 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15659 /* port-G for CLFE (rear panel) */
15660 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15661 /* port-H for side (rear panel) */
15662 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15664 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15665 /* route front mic to ADC1*/
15666 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15667 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15668 /* Unmute DAC0~3 & spdif out*/
15669 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15670 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15671 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15672 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15673 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15674 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15675 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15676 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15677 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15678 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15680 /* Unmute Stereo Mixer 15 */
15681 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15682 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15683 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15684 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15686 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15687 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15688 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15689 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15690 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15691 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15692 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15693 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15694 /* hp used DAC 3 (Front) */
15695 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15696 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15700 /* additional init verbs for ASUS laptops */
15701 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15702 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15703 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15708 * generic initialization of ADC, input mixers and output mixers
15710 static struct hda_verb alc861_auto_init_verbs[] = {
15712 * Unmute ADC0 and set the default input to mic-in
15714 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15715 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15717 /* Unmute DAC0~3 & spdif out*/
15718 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15719 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15720 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15721 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15724 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15725 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15726 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15727 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15728 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15730 /* Unmute Stereo Mixer 15 */
15731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15733 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15734 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15736 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15737 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15738 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15739 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15741 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15745 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15746 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15747 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15748 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15749 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15750 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15751 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15752 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15754 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15759 static struct hda_verb alc861_toshiba_init_verbs[] = {
15760 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15765 /* toggle speaker-output according to the hp-jack state */
15766 static void alc861_toshiba_automute(struct hda_codec *codec)
15768 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15770 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15771 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15772 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15773 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15776 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15779 if ((res >> 26) == ALC880_HP_EVENT)
15780 alc861_toshiba_automute(codec);
15783 /* pcm configuration: identical with ALC880 */
15784 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15785 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15786 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15787 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15790 #define ALC861_DIGOUT_NID 0x07
15792 static struct hda_channel_mode alc861_8ch_modes[1] = {
15796 static hda_nid_t alc861_dac_nids[4] = {
15797 /* front, surround, clfe, side */
15798 0x03, 0x06, 0x05, 0x04
15801 static hda_nid_t alc660_dac_nids[3] = {
15802 /* front, clfe, surround */
15806 static hda_nid_t alc861_adc_nids[1] = {
15811 static struct hda_input_mux alc861_capture_source = {
15815 { "Front Mic", 0x3 },
15822 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15824 struct alc_spec *spec = codec->spec;
15825 hda_nid_t mix, srcs[5];
15828 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15830 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15833 for (i = 0; i < num; i++) {
15835 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15836 if (type != AC_WID_AUD_OUT)
15838 for (j = 0; j < spec->multiout.num_dacs; j++)
15839 if (spec->multiout.dac_nids[j] == srcs[i])
15841 if (j >= spec->multiout.num_dacs)
15847 /* fill in the dac_nids table from the parsed pin configuration */
15848 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15849 const struct auto_pin_cfg *cfg)
15851 struct alc_spec *spec = codec->spec;
15853 hda_nid_t nid, dac;
15855 spec->multiout.dac_nids = spec->private_dac_nids;
15856 for (i = 0; i < cfg->line_outs; i++) {
15857 nid = cfg->line_out_pins[i];
15858 dac = alc861_look_for_dac(codec, nid);
15861 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15866 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15867 hda_nid_t nid, unsigned int chs)
15869 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15870 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15873 /* add playback controls from the parsed DAC table */
15874 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15875 const struct auto_pin_cfg *cfg)
15877 struct alc_spec *spec = codec->spec;
15878 static const char *chname[4] = {
15879 "Front", "Surround", NULL /*CLFE*/, "Side"
15884 if (cfg->line_outs == 1) {
15885 const char *pfx = NULL;
15888 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15891 nid = spec->multiout.dac_nids[0];
15892 return alc861_create_out_sw(codec, pfx, nid, 3);
15896 for (i = 0; i < cfg->line_outs; i++) {
15897 nid = spec->multiout.dac_nids[i];
15902 err = alc861_create_out_sw(codec, "Center", nid, 1);
15905 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15909 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15917 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15919 struct alc_spec *spec = codec->spec;
15926 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15927 nid = alc861_look_for_dac(codec, pin);
15929 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15932 spec->multiout.hp_nid = nid;
15938 /* create playback/capture controls for input pins */
15939 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15940 const struct auto_pin_cfg *cfg)
15942 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15945 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15947 int pin_type, hda_nid_t dac)
15949 hda_nid_t mix, srcs[5];
15952 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15954 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15956 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15958 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15961 for (i = 0; i < num; i++) {
15963 if (srcs[i] == dac || srcs[i] == 0x15)
15964 mute = AMP_IN_UNMUTE(i);
15966 mute = AMP_IN_MUTE(i);
15967 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15972 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15974 struct alc_spec *spec = codec->spec;
15977 for (i = 0; i < spec->autocfg.line_outs; i++) {
15978 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15979 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15981 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15982 spec->multiout.dac_nids[i]);
15986 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15988 struct alc_spec *spec = codec->spec;
15990 if (spec->autocfg.hp_outs)
15991 alc861_auto_set_output_and_unmute(codec,
15992 spec->autocfg.hp_pins[0],
15994 spec->multiout.hp_nid);
15995 if (spec->autocfg.speaker_outs)
15996 alc861_auto_set_output_and_unmute(codec,
15997 spec->autocfg.speaker_pins[0],
15999 spec->multiout.dac_nids[0]);
16002 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16004 struct alc_spec *spec = codec->spec;
16005 struct auto_pin_cfg *cfg = &spec->autocfg;
16008 for (i = 0; i < cfg->num_inputs; i++) {
16009 hda_nid_t nid = cfg->inputs[i].pin;
16010 if (nid >= 0x0c && nid <= 0x11)
16011 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16015 /* parse the BIOS configuration and set up the alc_spec */
16016 /* return 1 if successful, 0 if the proper config is not found,
16017 * or a negative error code
16019 static int alc861_parse_auto_config(struct hda_codec *codec)
16021 struct alc_spec *spec = codec->spec;
16023 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16025 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16029 if (!spec->autocfg.line_outs)
16030 return 0; /* can't find valid BIOS pin config */
16032 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16035 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16038 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16041 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16045 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16047 alc_auto_parse_digital(codec);
16049 if (spec->kctls.list)
16050 add_mixer(spec, spec->kctls.list);
16052 add_verb(spec, alc861_auto_init_verbs);
16054 spec->num_mux_defs = 1;
16055 spec->input_mux = &spec->private_imux[0];
16057 spec->adc_nids = alc861_adc_nids;
16058 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16059 set_capture_mixer(codec);
16061 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16066 /* additional initialization for auto-configuration model */
16067 static void alc861_auto_init(struct hda_codec *codec)
16069 struct alc_spec *spec = codec->spec;
16070 alc861_auto_init_multi_out(codec);
16071 alc861_auto_init_hp_out(codec);
16072 alc861_auto_init_analog_input(codec);
16073 alc_auto_init_digital(codec);
16074 if (spec->unsol_event)
16075 alc_inithook(codec);
16078 #ifdef CONFIG_SND_HDA_POWER_SAVE
16079 static struct hda_amp_list alc861_loopbacks[] = {
16080 { 0x15, HDA_INPUT, 0 },
16081 { 0x15, HDA_INPUT, 1 },
16082 { 0x15, HDA_INPUT, 2 },
16083 { 0x15, HDA_INPUT, 3 },
16090 * configuration and preset
16092 static const char *alc861_models[ALC861_MODEL_LAST] = {
16093 [ALC861_3ST] = "3stack",
16094 [ALC660_3ST] = "3stack-660",
16095 [ALC861_3ST_DIG] = "3stack-dig",
16096 [ALC861_6ST_DIG] = "6stack-dig",
16097 [ALC861_UNIWILL_M31] = "uniwill-m31",
16098 [ALC861_TOSHIBA] = "toshiba",
16099 [ALC861_ASUS] = "asus",
16100 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16101 [ALC861_AUTO] = "auto",
16104 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16105 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16106 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16107 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16108 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16109 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16110 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16111 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16112 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16113 * Any other models that need this preset?
16115 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16116 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16117 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16118 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16119 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16120 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16121 /* FIXME: the below seems conflict */
16122 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16123 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16124 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16128 static struct alc_config_preset alc861_presets[] = {
16130 .mixers = { alc861_3ST_mixer },
16131 .init_verbs = { alc861_threestack_init_verbs },
16132 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16133 .dac_nids = alc861_dac_nids,
16134 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16135 .channel_mode = alc861_threestack_modes,
16137 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16138 .adc_nids = alc861_adc_nids,
16139 .input_mux = &alc861_capture_source,
16141 [ALC861_3ST_DIG] = {
16142 .mixers = { alc861_base_mixer },
16143 .init_verbs = { alc861_threestack_init_verbs },
16144 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16145 .dac_nids = alc861_dac_nids,
16146 .dig_out_nid = ALC861_DIGOUT_NID,
16147 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16148 .channel_mode = alc861_threestack_modes,
16150 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16151 .adc_nids = alc861_adc_nids,
16152 .input_mux = &alc861_capture_source,
16154 [ALC861_6ST_DIG] = {
16155 .mixers = { alc861_base_mixer },
16156 .init_verbs = { alc861_base_init_verbs },
16157 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16158 .dac_nids = alc861_dac_nids,
16159 .dig_out_nid = ALC861_DIGOUT_NID,
16160 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16161 .channel_mode = alc861_8ch_modes,
16162 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16163 .adc_nids = alc861_adc_nids,
16164 .input_mux = &alc861_capture_source,
16167 .mixers = { alc861_3ST_mixer },
16168 .init_verbs = { alc861_threestack_init_verbs },
16169 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16170 .dac_nids = alc660_dac_nids,
16171 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16172 .channel_mode = alc861_threestack_modes,
16174 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16175 .adc_nids = alc861_adc_nids,
16176 .input_mux = &alc861_capture_source,
16178 [ALC861_UNIWILL_M31] = {
16179 .mixers = { alc861_uniwill_m31_mixer },
16180 .init_verbs = { alc861_uniwill_m31_init_verbs },
16181 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16182 .dac_nids = alc861_dac_nids,
16183 .dig_out_nid = ALC861_DIGOUT_NID,
16184 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16185 .channel_mode = alc861_uniwill_m31_modes,
16187 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16188 .adc_nids = alc861_adc_nids,
16189 .input_mux = &alc861_capture_source,
16191 [ALC861_TOSHIBA] = {
16192 .mixers = { alc861_toshiba_mixer },
16193 .init_verbs = { alc861_base_init_verbs,
16194 alc861_toshiba_init_verbs },
16195 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16196 .dac_nids = alc861_dac_nids,
16197 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16198 .channel_mode = alc883_3ST_2ch_modes,
16199 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16200 .adc_nids = alc861_adc_nids,
16201 .input_mux = &alc861_capture_source,
16202 .unsol_event = alc861_toshiba_unsol_event,
16203 .init_hook = alc861_toshiba_automute,
16206 .mixers = { alc861_asus_mixer },
16207 .init_verbs = { alc861_asus_init_verbs },
16208 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16209 .dac_nids = alc861_dac_nids,
16210 .dig_out_nid = ALC861_DIGOUT_NID,
16211 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16212 .channel_mode = alc861_asus_modes,
16215 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16216 .adc_nids = alc861_adc_nids,
16217 .input_mux = &alc861_capture_source,
16219 [ALC861_ASUS_LAPTOP] = {
16220 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16221 .init_verbs = { alc861_asus_init_verbs,
16222 alc861_asus_laptop_init_verbs },
16223 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16224 .dac_nids = alc861_dac_nids,
16225 .dig_out_nid = ALC861_DIGOUT_NID,
16226 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16227 .channel_mode = alc883_3ST_2ch_modes,
16229 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16230 .adc_nids = alc861_adc_nids,
16231 .input_mux = &alc861_capture_source,
16235 /* Pin config fixes */
16237 PINFIX_FSC_AMILO_PI1505,
16240 static const struct alc_fixup alc861_fixups[] = {
16241 [PINFIX_FSC_AMILO_PI1505] = {
16242 .pins = (const struct alc_pincfg[]) {
16243 { 0x0b, 0x0221101f }, /* HP */
16244 { 0x0f, 0x90170310 }, /* speaker */
16250 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16251 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16255 static int patch_alc861(struct hda_codec *codec)
16257 struct alc_spec *spec;
16261 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16265 codec->spec = spec;
16267 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16271 if (board_config < 0) {
16272 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16274 board_config = ALC861_AUTO;
16277 if (board_config == ALC861_AUTO)
16278 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
16280 if (board_config == ALC861_AUTO) {
16281 /* automatic parse from the BIOS config */
16282 err = alc861_parse_auto_config(codec);
16288 "hda_codec: Cannot set up configuration "
16289 "from BIOS. Using base mode...\n");
16290 board_config = ALC861_3ST_DIG;
16294 err = snd_hda_attach_beep_device(codec, 0x23);
16300 if (board_config != ALC861_AUTO)
16301 setup_preset(codec, &alc861_presets[board_config]);
16303 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16304 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16306 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16307 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16309 if (!spec->cap_mixer)
16310 set_capture_mixer(codec);
16311 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16313 spec->vmaster_nid = 0x03;
16315 if (board_config == ALC861_AUTO)
16316 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
16318 codec->patch_ops = alc_patch_ops;
16319 if (board_config == ALC861_AUTO) {
16320 spec->init_hook = alc861_auto_init;
16321 #ifdef CONFIG_SND_HDA_POWER_SAVE
16322 spec->power_hook = alc_power_eapd;
16325 #ifdef CONFIG_SND_HDA_POWER_SAVE
16326 if (!spec->loopback.amplist)
16327 spec->loopback.amplist = alc861_loopbacks;
16334 * ALC861-VD support
16338 * In addition, an independent DAC
16340 #define ALC861VD_DIGOUT_NID 0x06
16342 static hda_nid_t alc861vd_dac_nids[4] = {
16343 /* front, surr, clfe, side surr */
16344 0x02, 0x03, 0x04, 0x05
16347 /* dac_nids for ALC660vd are in a different order - according to
16348 * Realtek's driver.
16349 * This should probably result in a different mixer for 6stack models
16350 * of ALC660vd codecs, but for now there is only 3stack mixer
16351 * - and it is the same as in 861vd.
16352 * adc_nids in ALC660vd are (is) the same as in 861vd
16354 static hda_nid_t alc660vd_dac_nids[3] = {
16355 /* front, rear, clfe, rear_surr */
16359 static hda_nid_t alc861vd_adc_nids[1] = {
16364 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16367 /* FIXME: should be a matrix-type input source selection */
16368 static struct hda_input_mux alc861vd_capture_source = {
16372 { "Front Mic", 0x1 },
16378 static struct hda_input_mux alc861vd_dallas_capture_source = {
16381 { "Ext Mic", 0x0 },
16382 { "Int Mic", 0x1 },
16386 static struct hda_input_mux alc861vd_hp_capture_source = {
16389 { "Front Mic", 0x0 },
16390 { "ATAPI Mic", 0x1 },
16397 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16404 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16405 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16406 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16407 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16408 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16415 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16416 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16417 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16418 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16419 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16423 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16424 { 6, alc861vd_6stack_ch6_init },
16425 { 8, alc861vd_6stack_ch8_init },
16428 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16430 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16431 .name = "Channel Mode",
16432 .info = alc_ch_mode_info,
16433 .get = alc_ch_mode_get,
16434 .put = alc_ch_mode_put,
16439 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16440 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16442 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16443 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16444 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16446 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16447 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16449 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16451 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16453 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16454 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16456 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16457 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16461 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16463 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16465 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16466 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16467 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16469 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16470 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16472 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16473 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16478 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16479 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16480 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16482 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16484 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16486 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16488 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16489 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16490 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16492 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16493 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16495 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16496 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16501 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16502 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16503 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16504 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16506 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16508 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16510 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16512 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16513 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16514 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16516 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16517 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16522 /* Pin assignment: Speaker=0x14, HP = 0x15,
16523 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16525 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16526 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16527 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16528 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16529 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16530 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16531 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16532 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16533 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16534 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16535 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16539 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16540 * Front Mic=0x18, ATAPI Mic = 0x19,
16542 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16543 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16544 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16545 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16546 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16547 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16548 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16549 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16550 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16556 * generic initialization of ADC, input mixers and output mixers
16558 static struct hda_verb alc861vd_volume_init_verbs[] = {
16560 * Unmute ADC0 and set the default input to mic-in
16562 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16563 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16565 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16566 * the analog-loopback mixer widget
16568 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16572 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16575 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16576 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16577 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16578 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16579 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16582 * Set up output mixers (0x02 - 0x05)
16584 /* set vol=0 to output mixers */
16585 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16586 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16587 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16588 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16590 /* set up input amps for analog loopback */
16591 /* Amp Indices: DAC = 0, mixer = 1 */
16592 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16593 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16594 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16595 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16596 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16597 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16598 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16599 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16605 * 3-stack pin configuration:
16606 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16608 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16610 * Set pin mode and muting
16612 /* set front pin widgets 0x14 for output */
16613 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16614 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16615 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16617 /* Mic (rear) pin: input vref at 80% */
16618 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16619 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16620 /* Front Mic pin: input vref at 80% */
16621 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16622 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16623 /* Line In pin: input */
16624 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16625 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16626 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16628 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16629 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16630 /* CD pin widget for input */
16631 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16637 * 6-stack pin configuration:
16639 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16641 * Set pin mode and muting
16643 /* set front pin widgets 0x14 for output */
16644 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16645 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16646 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16648 /* Rear Pin: output 1 (0x0d) */
16649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16650 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16651 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16652 /* CLFE Pin: output 2 (0x0e) */
16653 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16654 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16655 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16656 /* Side Pin: output 3 (0x0f) */
16657 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16658 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16659 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16661 /* Mic (rear) pin: input vref at 80% */
16662 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16663 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16664 /* Front Mic pin: input vref at 80% */
16665 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16666 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16667 /* Line In pin: input */
16668 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16669 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16670 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16671 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16672 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16673 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16674 /* CD pin widget for input */
16675 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16680 static struct hda_verb alc861vd_eapd_verbs[] = {
16681 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16685 static struct hda_verb alc660vd_eapd_verbs[] = {
16686 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16687 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16691 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16692 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16694 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16695 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16696 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16700 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16702 unsigned int present;
16703 unsigned char bits;
16705 present = snd_hda_jack_detect(codec, 0x18);
16706 bits = present ? HDA_AMP_MUTE : 0;
16708 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16709 HDA_AMP_MUTE, bits);
16712 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16714 struct alc_spec *spec = codec->spec;
16715 spec->autocfg.hp_pins[0] = 0x1b;
16716 spec->autocfg.speaker_pins[0] = 0x14;
16719 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16721 alc_automute_amp(codec);
16722 alc861vd_lenovo_mic_automute(codec);
16725 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16728 switch (res >> 26) {
16729 case ALC880_MIC_EVENT:
16730 alc861vd_lenovo_mic_automute(codec);
16733 alc_automute_amp_unsol_event(codec, res);
16738 static struct hda_verb alc861vd_dallas_verbs[] = {
16739 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16740 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16741 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16742 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16746 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16749 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16750 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16751 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16753 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16756 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16757 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16758 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16759 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16760 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16762 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16763 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16765 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16766 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16767 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16768 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16769 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16776 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16777 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16778 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16783 /* toggle speaker-output according to the hp-jack state */
16784 static void alc861vd_dallas_setup(struct hda_codec *codec)
16786 struct alc_spec *spec = codec->spec;
16788 spec->autocfg.hp_pins[0] = 0x15;
16789 spec->autocfg.speaker_pins[0] = 0x14;
16792 #ifdef CONFIG_SND_HDA_POWER_SAVE
16793 #define alc861vd_loopbacks alc880_loopbacks
16796 /* pcm configuration: identical with ALC880 */
16797 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16798 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16799 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16800 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16803 * configuration and preset
16805 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16806 [ALC660VD_3ST] = "3stack-660",
16807 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16808 [ALC660VD_ASUS_V1S] = "asus-v1s",
16809 [ALC861VD_3ST] = "3stack",
16810 [ALC861VD_3ST_DIG] = "3stack-digout",
16811 [ALC861VD_6ST_DIG] = "6stack-digout",
16812 [ALC861VD_LENOVO] = "lenovo",
16813 [ALC861VD_DALLAS] = "dallas",
16814 [ALC861VD_HP] = "hp",
16815 [ALC861VD_AUTO] = "auto",
16818 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16819 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16820 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16821 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16822 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16823 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16824 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16825 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16826 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16827 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16828 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16829 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16830 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16831 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16832 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16833 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16837 static struct alc_config_preset alc861vd_presets[] = {
16839 .mixers = { alc861vd_3st_mixer },
16840 .init_verbs = { alc861vd_volume_init_verbs,
16841 alc861vd_3stack_init_verbs },
16842 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16843 .dac_nids = alc660vd_dac_nids,
16844 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16845 .channel_mode = alc861vd_3stack_2ch_modes,
16846 .input_mux = &alc861vd_capture_source,
16848 [ALC660VD_3ST_DIG] = {
16849 .mixers = { alc861vd_3st_mixer },
16850 .init_verbs = { alc861vd_volume_init_verbs,
16851 alc861vd_3stack_init_verbs },
16852 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16853 .dac_nids = alc660vd_dac_nids,
16854 .dig_out_nid = ALC861VD_DIGOUT_NID,
16855 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16856 .channel_mode = alc861vd_3stack_2ch_modes,
16857 .input_mux = &alc861vd_capture_source,
16860 .mixers = { alc861vd_3st_mixer },
16861 .init_verbs = { alc861vd_volume_init_verbs,
16862 alc861vd_3stack_init_verbs },
16863 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16864 .dac_nids = alc861vd_dac_nids,
16865 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16866 .channel_mode = alc861vd_3stack_2ch_modes,
16867 .input_mux = &alc861vd_capture_source,
16869 [ALC861VD_3ST_DIG] = {
16870 .mixers = { alc861vd_3st_mixer },
16871 .init_verbs = { alc861vd_volume_init_verbs,
16872 alc861vd_3stack_init_verbs },
16873 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16874 .dac_nids = alc861vd_dac_nids,
16875 .dig_out_nid = ALC861VD_DIGOUT_NID,
16876 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16877 .channel_mode = alc861vd_3stack_2ch_modes,
16878 .input_mux = &alc861vd_capture_source,
16880 [ALC861VD_6ST_DIG] = {
16881 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16882 .init_verbs = { alc861vd_volume_init_verbs,
16883 alc861vd_6stack_init_verbs },
16884 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16885 .dac_nids = alc861vd_dac_nids,
16886 .dig_out_nid = ALC861VD_DIGOUT_NID,
16887 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16888 .channel_mode = alc861vd_6stack_modes,
16889 .input_mux = &alc861vd_capture_source,
16891 [ALC861VD_LENOVO] = {
16892 .mixers = { alc861vd_lenovo_mixer },
16893 .init_verbs = { alc861vd_volume_init_verbs,
16894 alc861vd_3stack_init_verbs,
16895 alc861vd_eapd_verbs,
16896 alc861vd_lenovo_unsol_verbs },
16897 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16898 .dac_nids = alc660vd_dac_nids,
16899 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16900 .channel_mode = alc861vd_3stack_2ch_modes,
16901 .input_mux = &alc861vd_capture_source,
16902 .unsol_event = alc861vd_lenovo_unsol_event,
16903 .setup = alc861vd_lenovo_setup,
16904 .init_hook = alc861vd_lenovo_init_hook,
16906 [ALC861VD_DALLAS] = {
16907 .mixers = { alc861vd_dallas_mixer },
16908 .init_verbs = { alc861vd_dallas_verbs },
16909 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16910 .dac_nids = alc861vd_dac_nids,
16911 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16912 .channel_mode = alc861vd_3stack_2ch_modes,
16913 .input_mux = &alc861vd_dallas_capture_source,
16914 .unsol_event = alc_automute_amp_unsol_event,
16915 .setup = alc861vd_dallas_setup,
16916 .init_hook = alc_automute_amp,
16919 .mixers = { alc861vd_hp_mixer },
16920 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16921 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16922 .dac_nids = alc861vd_dac_nids,
16923 .dig_out_nid = ALC861VD_DIGOUT_NID,
16924 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16925 .channel_mode = alc861vd_3stack_2ch_modes,
16926 .input_mux = &alc861vd_hp_capture_source,
16927 .unsol_event = alc_automute_amp_unsol_event,
16928 .setup = alc861vd_dallas_setup,
16929 .init_hook = alc_automute_amp,
16931 [ALC660VD_ASUS_V1S] = {
16932 .mixers = { alc861vd_lenovo_mixer },
16933 .init_verbs = { alc861vd_volume_init_verbs,
16934 alc861vd_3stack_init_verbs,
16935 alc861vd_eapd_verbs,
16936 alc861vd_lenovo_unsol_verbs },
16937 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16938 .dac_nids = alc660vd_dac_nids,
16939 .dig_out_nid = ALC861VD_DIGOUT_NID,
16940 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16941 .channel_mode = alc861vd_3stack_2ch_modes,
16942 .input_mux = &alc861vd_capture_source,
16943 .unsol_event = alc861vd_lenovo_unsol_event,
16944 .setup = alc861vd_lenovo_setup,
16945 .init_hook = alc861vd_lenovo_init_hook,
16950 * BIOS auto configuration
16952 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16953 const struct auto_pin_cfg *cfg)
16955 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
16959 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16960 hda_nid_t nid, int pin_type, int dac_idx)
16962 alc_set_pin_output(codec, nid, pin_type);
16965 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16967 struct alc_spec *spec = codec->spec;
16970 for (i = 0; i <= HDA_SIDE; i++) {
16971 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16972 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16974 alc861vd_auto_set_output_and_unmute(codec, nid,
16980 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16982 struct alc_spec *spec = codec->spec;
16985 pin = spec->autocfg.hp_pins[0];
16986 if (pin) /* connect to front and use dac 0 */
16987 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16988 pin = spec->autocfg.speaker_pins[0];
16990 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16993 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16995 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16997 struct alc_spec *spec = codec->spec;
16998 struct auto_pin_cfg *cfg = &spec->autocfg;
17001 for (i = 0; i < cfg->num_inputs; i++) {
17002 hda_nid_t nid = cfg->inputs[i].pin;
17003 if (alc_is_input_pin(codec, nid)) {
17004 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17005 if (nid != ALC861VD_PIN_CD_NID &&
17006 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17007 snd_hda_codec_write(codec, nid, 0,
17008 AC_VERB_SET_AMP_GAIN_MUTE,
17014 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17016 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17017 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17019 /* add playback controls from the parsed DAC table */
17020 /* Based on ALC880 version. But ALC861VD has separate,
17021 * different NIDs for mute/unmute switch and volume control */
17022 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17023 const struct auto_pin_cfg *cfg)
17025 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
17026 hda_nid_t nid_v, nid_s;
17029 for (i = 0; i < cfg->line_outs; i++) {
17030 if (!spec->multiout.dac_nids[i])
17032 nid_v = alc861vd_idx_to_mixer_vol(
17034 spec->multiout.dac_nids[i]));
17035 nid_s = alc861vd_idx_to_mixer_switch(
17037 spec->multiout.dac_nids[i]));
17041 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17043 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17047 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17049 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17053 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17055 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17059 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17061 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17067 if (cfg->line_outs == 1 &&
17068 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17075 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17076 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17080 if (cfg->line_outs == 1 &&
17081 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17083 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17084 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17093 /* add playback controls for speaker and HP outputs */
17094 /* Based on ALC880 version. But ALC861VD has separate,
17095 * different NIDs for mute/unmute switch and volume control */
17096 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17097 hda_nid_t pin, const char *pfx)
17099 hda_nid_t nid_v, nid_s;
17105 if (alc880_is_fixed_pin(pin)) {
17106 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17107 /* specify the DAC as the extra output */
17108 if (!spec->multiout.hp_nid)
17109 spec->multiout.hp_nid = nid_v;
17111 spec->multiout.extra_out_nid[0] = nid_v;
17112 /* control HP volume/switch on the output mixer amp */
17113 nid_v = alc861vd_idx_to_mixer_vol(
17114 alc880_fixed_pin_idx(pin));
17115 nid_s = alc861vd_idx_to_mixer_switch(
17116 alc880_fixed_pin_idx(pin));
17118 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17119 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17122 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17123 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17126 } else if (alc880_is_multi_pin(pin)) {
17127 /* set manual connection */
17128 /* we have only a switch on HP-out PIN */
17129 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17130 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17137 /* parse the BIOS configuration and set up the alc_spec
17138 * return 1 if successful, 0 if the proper config is not found,
17139 * or a negative error code
17140 * Based on ALC880 version - had to change it to override
17141 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17142 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17144 struct alc_spec *spec = codec->spec;
17146 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17148 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17152 if (!spec->autocfg.line_outs)
17153 return 0; /* can't find valid BIOS pin config */
17155 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17158 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17161 err = alc861vd_auto_create_extra_out(spec,
17162 spec->autocfg.speaker_pins[0],
17166 err = alc861vd_auto_create_extra_out(spec,
17167 spec->autocfg.hp_pins[0],
17171 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17175 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17177 alc_auto_parse_digital(codec);
17179 if (spec->kctls.list)
17180 add_mixer(spec, spec->kctls.list);
17182 add_verb(spec, alc861vd_volume_init_verbs);
17184 spec->num_mux_defs = 1;
17185 spec->input_mux = &spec->private_imux[0];
17187 err = alc_auto_add_mic_boost(codec);
17191 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17196 /* additional initialization for auto-configuration model */
17197 static void alc861vd_auto_init(struct hda_codec *codec)
17199 struct alc_spec *spec = codec->spec;
17200 alc861vd_auto_init_multi_out(codec);
17201 alc861vd_auto_init_hp_out(codec);
17202 alc861vd_auto_init_analog_input(codec);
17203 alc861vd_auto_init_input_src(codec);
17204 alc_auto_init_digital(codec);
17205 if (spec->unsol_event)
17206 alc_inithook(codec);
17210 ALC660VD_FIX_ASUS_GPIO1
17214 static const struct alc_fixup alc861vd_fixups[] = {
17215 [ALC660VD_FIX_ASUS_GPIO1] = {
17216 .verbs = (const struct hda_verb[]) {
17217 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17218 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17219 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17225 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17226 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17230 static int patch_alc861vd(struct hda_codec *codec)
17232 struct alc_spec *spec;
17233 int err, board_config;
17235 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17239 codec->spec = spec;
17241 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17245 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17246 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17248 board_config = ALC861VD_AUTO;
17251 if (board_config == ALC861VD_AUTO)
17252 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
17254 if (board_config == ALC861VD_AUTO) {
17255 /* automatic parse from the BIOS config */
17256 err = alc861vd_parse_auto_config(codec);
17262 "hda_codec: Cannot set up configuration "
17263 "from BIOS. Using base mode...\n");
17264 board_config = ALC861VD_3ST;
17268 err = snd_hda_attach_beep_device(codec, 0x23);
17274 if (board_config != ALC861VD_AUTO)
17275 setup_preset(codec, &alc861vd_presets[board_config]);
17277 if (codec->vendor_id == 0x10ec0660) {
17278 /* always turn on EAPD */
17279 add_verb(spec, alc660vd_eapd_verbs);
17282 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17283 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17285 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17286 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17288 if (!spec->adc_nids) {
17289 spec->adc_nids = alc861vd_adc_nids;
17290 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17292 if (!spec->capsrc_nids)
17293 spec->capsrc_nids = alc861vd_capsrc_nids;
17295 set_capture_mixer(codec);
17296 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17298 spec->vmaster_nid = 0x02;
17300 if (board_config == ALC861VD_AUTO)
17301 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
17303 codec->patch_ops = alc_patch_ops;
17305 if (board_config == ALC861VD_AUTO)
17306 spec->init_hook = alc861vd_auto_init;
17307 #ifdef CONFIG_SND_HDA_POWER_SAVE
17308 if (!spec->loopback.amplist)
17309 spec->loopback.amplist = alc861vd_loopbacks;
17318 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17319 * configuration. Each pin widget can choose any input DACs and a mixer.
17320 * Each ADC is connected from a mixer of all inputs. This makes possible
17321 * 6-channel independent captures.
17323 * In addition, an independent DAC for the multi-playback (not used in this
17326 #define ALC662_DIGOUT_NID 0x06
17327 #define ALC662_DIGIN_NID 0x0a
17329 static hda_nid_t alc662_dac_nids[4] = {
17330 /* front, rear, clfe, rear_surr */
17334 static hda_nid_t alc272_dac_nids[2] = {
17338 static hda_nid_t alc662_adc_nids[2] = {
17343 static hda_nid_t alc272_adc_nids[1] = {
17348 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17349 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17353 /* FIXME: should be a matrix-type input source selection */
17354 static struct hda_input_mux alc662_capture_source = {
17358 { "Front Mic", 0x1 },
17364 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17372 static struct hda_input_mux alc663_capture_source = {
17376 { "Front Mic", 0x1 },
17381 #if 0 /* set to 1 for testing other input sources below */
17382 static struct hda_input_mux alc272_nc10_capture_source = {
17385 { "Autoselect Mic", 0x0 },
17386 { "Internal Mic", 0x1 },
17387 { "In-0x02", 0x2 },
17388 { "In-0x03", 0x3 },
17389 { "In-0x04", 0x4 },
17390 { "In-0x05", 0x5 },
17391 { "In-0x06", 0x6 },
17392 { "In-0x07", 0x7 },
17393 { "In-0x08", 0x8 },
17394 { "In-0x09", 0x9 },
17395 { "In-0x0a", 0x0a },
17396 { "In-0x0b", 0x0b },
17397 { "In-0x0c", 0x0c },
17398 { "In-0x0d", 0x0d },
17399 { "In-0x0e", 0x0e },
17400 { "In-0x0f", 0x0f },
17408 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17415 static struct hda_verb alc662_3ST_ch2_init[] = {
17416 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17417 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17418 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17419 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17426 static struct hda_verb alc662_3ST_ch6_init[] = {
17427 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17428 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17429 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17430 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17431 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17432 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17436 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17437 { 2, alc662_3ST_ch2_init },
17438 { 6, alc662_3ST_ch6_init },
17444 static struct hda_verb alc662_sixstack_ch6_init[] = {
17445 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17446 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17447 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17454 static struct hda_verb alc662_sixstack_ch8_init[] = {
17455 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17456 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17457 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17461 static struct hda_channel_mode alc662_5stack_modes[2] = {
17462 { 2, alc662_sixstack_ch6_init },
17463 { 6, alc662_sixstack_ch8_init },
17466 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17467 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17470 static struct snd_kcontrol_new alc662_base_mixer[] = {
17471 /* output mixer control */
17472 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17473 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17474 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17475 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17476 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17477 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17478 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17479 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17480 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17482 /*Input mixer control */
17483 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17484 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17485 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17486 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17487 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17488 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17489 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17490 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17494 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17495 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17496 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17497 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17498 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17499 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17500 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17501 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17502 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17503 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17504 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17505 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17509 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17510 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17511 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17512 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17513 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17514 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17515 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17516 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17517 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17518 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17519 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17520 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17521 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17522 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17523 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17524 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17525 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17526 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17530 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17531 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17532 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17533 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17534 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17535 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17536 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17537 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17538 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17539 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17543 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17544 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17545 ALC262_HIPPO_MASTER_SWITCH,
17547 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
17548 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17549 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17551 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17552 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17553 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17557 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17558 ALC262_HIPPO_MASTER_SWITCH,
17559 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17560 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17561 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17562 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17563 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17564 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17565 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
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 hda_bind_ctls alc663_asus_bind_master_vol = {
17572 .ops = &snd_hda_bind_vol,
17574 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17575 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17580 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17581 .ops = &snd_hda_bind_sw,
17583 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17584 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17589 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17590 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17591 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17592 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17593 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17597 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17598 .ops = &snd_hda_bind_sw,
17600 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17601 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17602 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17607 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17608 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17609 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17610 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17611 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17612 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17613 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17618 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17619 .ops = &snd_hda_bind_sw,
17621 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17622 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17623 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17628 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17629 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17630 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17632 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17633 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17634 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17638 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17639 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17640 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17641 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17644 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17645 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17649 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17650 .ops = &snd_hda_bind_vol,
17652 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17653 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17658 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17659 .ops = &snd_hda_bind_sw,
17661 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17662 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17667 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17668 HDA_BIND_VOL("Master Playback Volume",
17669 &alc663_asus_two_bind_master_vol),
17670 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17671 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17672 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17673 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17674 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17678 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17679 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17680 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17681 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17682 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17683 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17684 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17688 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17689 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17690 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17691 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17692 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17693 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17697 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17698 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17702 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17703 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17704 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17705 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17709 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17710 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17711 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17712 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17716 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17717 .ops = &snd_hda_bind_sw,
17719 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17720 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17721 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17722 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17723 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17728 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17729 .ops = &snd_hda_bind_sw,
17731 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17732 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17737 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17738 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17739 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17740 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17741 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17742 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17743 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17744 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17745 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17746 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17750 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17751 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17752 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17753 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17754 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17755 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17756 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17757 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17762 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17764 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17765 .name = "Channel Mode",
17766 .info = alc_ch_mode_info,
17767 .get = alc_ch_mode_get,
17768 .put = alc_ch_mode_put,
17773 static struct hda_verb alc662_init_verbs[] = {
17774 /* ADC: mute amp left and right */
17775 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17776 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17779 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17780 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17781 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17782 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17783 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17785 /* Front Pin: output 0 (0x0c) */
17786 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17787 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17789 /* Rear Pin: output 1 (0x0d) */
17790 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17791 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17793 /* CLFE Pin: output 2 (0x0e) */
17794 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17795 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17797 /* Mic (rear) pin: input vref at 80% */
17798 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17800 /* Front Mic pin: input vref at 80% */
17801 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17802 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17803 /* Line In pin: input */
17804 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17805 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17806 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17807 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17808 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17809 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17810 /* CD pin widget for input */
17811 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17813 /* FIXME: use matrix-type input source selection */
17814 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17816 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17817 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17819 /* always trun on EAPD */
17820 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17821 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17826 static struct hda_verb alc663_init_verbs[] = {
17827 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17828 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17829 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17830 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17831 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17832 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17836 static struct hda_verb alc272_init_verbs[] = {
17837 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17838 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17839 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17840 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17841 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17842 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17843 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17844 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17848 static struct hda_verb alc662_sue_init_verbs[] = {
17849 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17850 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17854 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17855 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17856 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17860 /* Set Unsolicited Event*/
17861 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17862 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17863 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17867 static struct hda_verb alc663_m51va_init_verbs[] = {
17868 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17869 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17870 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17871 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17872 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17873 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17874 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17875 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17876 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17880 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17881 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17882 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17883 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17884 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17885 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17886 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17887 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17891 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17892 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17893 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17894 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17895 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17896 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17897 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17898 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17899 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17903 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17904 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17906 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17907 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17908 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17909 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17910 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17914 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17915 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17916 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17917 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17918 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17919 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17920 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17921 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17922 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17923 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17924 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17925 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17926 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17930 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17931 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17932 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17933 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17934 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17935 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17937 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17939 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17940 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17941 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17946 static struct hda_verb alc663_g71v_init_verbs[] = {
17947 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17948 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17949 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17951 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17952 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17953 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17955 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17956 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17957 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17961 static struct hda_verb alc663_g50v_init_verbs[] = {
17962 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17963 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17964 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17966 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17967 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17971 static struct hda_verb alc662_ecs_init_verbs[] = {
17972 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17973 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17974 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17975 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17979 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17980 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17981 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17982 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17983 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17984 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17985 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17986 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17987 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17988 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17989 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17990 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17994 static struct hda_verb alc272_dell_init_verbs[] = {
17995 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17996 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17997 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17998 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17999 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18000 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18001 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18002 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18003 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18004 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18005 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18009 static struct hda_verb alc663_mode7_init_verbs[] = {
18010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18011 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18012 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18013 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18014 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18015 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18016 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18017 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18018 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18019 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18022 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18023 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18024 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18028 static struct hda_verb alc663_mode8_init_verbs[] = {
18029 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18030 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18031 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18032 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18033 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18034 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18035 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18036 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18037 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18038 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18039 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18042 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18043 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18044 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18048 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18049 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18050 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18054 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18055 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18056 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18060 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18062 unsigned int present;
18063 unsigned char bits;
18065 present = snd_hda_jack_detect(codec, 0x14);
18066 bits = present ? HDA_AMP_MUTE : 0;
18068 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18069 HDA_AMP_MUTE, bits);
18072 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18074 unsigned int present;
18075 unsigned char bits;
18077 present = snd_hda_jack_detect(codec, 0x1b);
18078 bits = present ? HDA_AMP_MUTE : 0;
18080 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18081 HDA_AMP_MUTE, bits);
18082 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18083 HDA_AMP_MUTE, bits);
18086 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18089 if ((res >> 26) == ALC880_HP_EVENT)
18090 alc662_lenovo_101e_all_automute(codec);
18091 if ((res >> 26) == ALC880_FRONT_EVENT)
18092 alc662_lenovo_101e_ispeaker_automute(codec);
18095 /* unsolicited event for HP jack sensing */
18096 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18099 if ((res >> 26) == ALC880_MIC_EVENT)
18100 alc_mic_automute(codec);
18102 alc262_hippo_unsol_event(codec, res);
18105 static void alc662_eeepc_setup(struct hda_codec *codec)
18107 struct alc_spec *spec = codec->spec;
18109 alc262_hippo1_setup(codec);
18110 spec->ext_mic.pin = 0x18;
18111 spec->ext_mic.mux_idx = 0;
18112 spec->int_mic.pin = 0x19;
18113 spec->int_mic.mux_idx = 1;
18114 spec->auto_mic = 1;
18117 static void alc662_eeepc_inithook(struct hda_codec *codec)
18119 alc262_hippo_automute(codec);
18120 alc_mic_automute(codec);
18123 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18125 struct alc_spec *spec = codec->spec;
18127 spec->autocfg.hp_pins[0] = 0x14;
18128 spec->autocfg.speaker_pins[0] = 0x1b;
18131 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18133 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18135 unsigned int present;
18136 unsigned char bits;
18138 present = snd_hda_jack_detect(codec, 0x21);
18139 bits = present ? HDA_AMP_MUTE : 0;
18140 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18141 HDA_AMP_MUTE, bits);
18142 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18143 HDA_AMP_MUTE, bits);
18146 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18148 unsigned int present;
18149 unsigned char bits;
18151 present = snd_hda_jack_detect(codec, 0x21);
18152 bits = present ? HDA_AMP_MUTE : 0;
18153 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18154 HDA_AMP_MUTE, bits);
18155 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18156 HDA_AMP_MUTE, bits);
18157 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18158 HDA_AMP_MUTE, bits);
18159 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18160 HDA_AMP_MUTE, bits);
18163 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18165 unsigned int present;
18166 unsigned char bits;
18168 present = snd_hda_jack_detect(codec, 0x15);
18169 bits = present ? HDA_AMP_MUTE : 0;
18170 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18171 HDA_AMP_MUTE, bits);
18172 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18173 HDA_AMP_MUTE, bits);
18174 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18175 HDA_AMP_MUTE, bits);
18176 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18177 HDA_AMP_MUTE, bits);
18180 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18182 unsigned int present;
18183 unsigned char bits;
18185 present = snd_hda_jack_detect(codec, 0x1b);
18186 bits = present ? 0 : PIN_OUT;
18187 snd_hda_codec_write(codec, 0x14, 0,
18188 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18191 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18193 unsigned int present1, present2;
18195 present1 = snd_hda_jack_detect(codec, 0x21);
18196 present2 = snd_hda_jack_detect(codec, 0x15);
18198 if (present1 || present2) {
18199 snd_hda_codec_write_cache(codec, 0x14, 0,
18200 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18202 snd_hda_codec_write_cache(codec, 0x14, 0,
18203 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18207 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18209 unsigned int present1, present2;
18211 present1 = snd_hda_jack_detect(codec, 0x1b);
18212 present2 = snd_hda_jack_detect(codec, 0x15);
18214 if (present1 || present2) {
18215 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18216 HDA_AMP_MUTE, HDA_AMP_MUTE);
18217 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18218 HDA_AMP_MUTE, HDA_AMP_MUTE);
18220 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18222 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18227 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18229 unsigned int present1, present2;
18231 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18232 AC_VERB_GET_PIN_SENSE, 0)
18233 & AC_PINSENSE_PRESENCE;
18234 present2 = snd_hda_codec_read(codec, 0x21, 0,
18235 AC_VERB_GET_PIN_SENSE, 0)
18236 & AC_PINSENSE_PRESENCE;
18238 if (present1 || present2) {
18239 snd_hda_codec_write_cache(codec, 0x14, 0,
18240 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18241 snd_hda_codec_write_cache(codec, 0x17, 0,
18242 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18244 snd_hda_codec_write_cache(codec, 0x14, 0,
18245 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18246 snd_hda_codec_write_cache(codec, 0x17, 0,
18247 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18251 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18253 unsigned int present1, present2;
18255 present1 = snd_hda_codec_read(codec, 0x21, 0,
18256 AC_VERB_GET_PIN_SENSE, 0)
18257 & AC_PINSENSE_PRESENCE;
18258 present2 = snd_hda_codec_read(codec, 0x15, 0,
18259 AC_VERB_GET_PIN_SENSE, 0)
18260 & AC_PINSENSE_PRESENCE;
18262 if (present1 || present2) {
18263 snd_hda_codec_write_cache(codec, 0x14, 0,
18264 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18265 snd_hda_codec_write_cache(codec, 0x17, 0,
18266 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18268 snd_hda_codec_write_cache(codec, 0x14, 0,
18269 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18270 snd_hda_codec_write_cache(codec, 0x17, 0,
18271 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18275 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18278 switch (res >> 26) {
18279 case ALC880_HP_EVENT:
18280 alc663_m51va_speaker_automute(codec);
18282 case ALC880_MIC_EVENT:
18283 alc_mic_automute(codec);
18288 static void alc663_m51va_setup(struct hda_codec *codec)
18290 struct alc_spec *spec = codec->spec;
18291 spec->ext_mic.pin = 0x18;
18292 spec->ext_mic.mux_idx = 0;
18293 spec->int_mic.pin = 0x12;
18294 spec->int_mic.mux_idx = 9;
18295 spec->auto_mic = 1;
18298 static void alc663_m51va_inithook(struct hda_codec *codec)
18300 alc663_m51va_speaker_automute(codec);
18301 alc_mic_automute(codec);
18304 /* ***************** Mode1 ******************************/
18305 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18307 static void alc663_mode1_setup(struct hda_codec *codec)
18309 struct alc_spec *spec = codec->spec;
18310 spec->ext_mic.pin = 0x18;
18311 spec->ext_mic.mux_idx = 0;
18312 spec->int_mic.pin = 0x19;
18313 spec->int_mic.mux_idx = 1;
18314 spec->auto_mic = 1;
18317 #define alc663_mode1_inithook alc663_m51va_inithook
18319 /* ***************** Mode2 ******************************/
18320 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18323 switch (res >> 26) {
18324 case ALC880_HP_EVENT:
18325 alc662_f5z_speaker_automute(codec);
18327 case ALC880_MIC_EVENT:
18328 alc_mic_automute(codec);
18333 #define alc662_mode2_setup alc663_mode1_setup
18335 static void alc662_mode2_inithook(struct hda_codec *codec)
18337 alc662_f5z_speaker_automute(codec);
18338 alc_mic_automute(codec);
18340 /* ***************** Mode3 ******************************/
18341 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18344 switch (res >> 26) {
18345 case ALC880_HP_EVENT:
18346 alc663_two_hp_m1_speaker_automute(codec);
18348 case ALC880_MIC_EVENT:
18349 alc_mic_automute(codec);
18354 #define alc663_mode3_setup alc663_mode1_setup
18356 static void alc663_mode3_inithook(struct hda_codec *codec)
18358 alc663_two_hp_m1_speaker_automute(codec);
18359 alc_mic_automute(codec);
18361 /* ***************** Mode4 ******************************/
18362 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18365 switch (res >> 26) {
18366 case ALC880_HP_EVENT:
18367 alc663_21jd_two_speaker_automute(codec);
18369 case ALC880_MIC_EVENT:
18370 alc_mic_automute(codec);
18375 #define alc663_mode4_setup alc663_mode1_setup
18377 static void alc663_mode4_inithook(struct hda_codec *codec)
18379 alc663_21jd_two_speaker_automute(codec);
18380 alc_mic_automute(codec);
18382 /* ***************** Mode5 ******************************/
18383 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18386 switch (res >> 26) {
18387 case ALC880_HP_EVENT:
18388 alc663_15jd_two_speaker_automute(codec);
18390 case ALC880_MIC_EVENT:
18391 alc_mic_automute(codec);
18396 #define alc663_mode5_setup alc663_mode1_setup
18398 static void alc663_mode5_inithook(struct hda_codec *codec)
18400 alc663_15jd_two_speaker_automute(codec);
18401 alc_mic_automute(codec);
18403 /* ***************** Mode6 ******************************/
18404 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18407 switch (res >> 26) {
18408 case ALC880_HP_EVENT:
18409 alc663_two_hp_m2_speaker_automute(codec);
18411 case ALC880_MIC_EVENT:
18412 alc_mic_automute(codec);
18417 #define alc663_mode6_setup alc663_mode1_setup
18419 static void alc663_mode6_inithook(struct hda_codec *codec)
18421 alc663_two_hp_m2_speaker_automute(codec);
18422 alc_mic_automute(codec);
18425 /* ***************** Mode7 ******************************/
18426 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18429 switch (res >> 26) {
18430 case ALC880_HP_EVENT:
18431 alc663_two_hp_m7_speaker_automute(codec);
18433 case ALC880_MIC_EVENT:
18434 alc_mic_automute(codec);
18439 #define alc663_mode7_setup alc663_mode1_setup
18441 static void alc663_mode7_inithook(struct hda_codec *codec)
18443 alc663_two_hp_m7_speaker_automute(codec);
18444 alc_mic_automute(codec);
18447 /* ***************** Mode8 ******************************/
18448 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18451 switch (res >> 26) {
18452 case ALC880_HP_EVENT:
18453 alc663_two_hp_m8_speaker_automute(codec);
18455 case ALC880_MIC_EVENT:
18456 alc_mic_automute(codec);
18461 #define alc663_mode8_setup alc663_m51va_setup
18463 static void alc663_mode8_inithook(struct hda_codec *codec)
18465 alc663_two_hp_m8_speaker_automute(codec);
18466 alc_mic_automute(codec);
18469 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18471 unsigned int present;
18472 unsigned char bits;
18474 present = snd_hda_jack_detect(codec, 0x21);
18475 bits = present ? HDA_AMP_MUTE : 0;
18476 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18477 HDA_AMP_MUTE, bits);
18478 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18479 HDA_AMP_MUTE, bits);
18482 static void alc663_g71v_front_automute(struct hda_codec *codec)
18484 unsigned int present;
18485 unsigned char bits;
18487 present = snd_hda_jack_detect(codec, 0x15);
18488 bits = present ? HDA_AMP_MUTE : 0;
18489 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18490 HDA_AMP_MUTE, bits);
18493 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18496 switch (res >> 26) {
18497 case ALC880_HP_EVENT:
18498 alc663_g71v_hp_automute(codec);
18500 case ALC880_FRONT_EVENT:
18501 alc663_g71v_front_automute(codec);
18503 case ALC880_MIC_EVENT:
18504 alc_mic_automute(codec);
18509 #define alc663_g71v_setup alc663_m51va_setup
18511 static void alc663_g71v_inithook(struct hda_codec *codec)
18513 alc663_g71v_front_automute(codec);
18514 alc663_g71v_hp_automute(codec);
18515 alc_mic_automute(codec);
18518 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18521 switch (res >> 26) {
18522 case ALC880_HP_EVENT:
18523 alc663_m51va_speaker_automute(codec);
18525 case ALC880_MIC_EVENT:
18526 alc_mic_automute(codec);
18531 #define alc663_g50v_setup alc663_m51va_setup
18533 static void alc663_g50v_inithook(struct hda_codec *codec)
18535 alc663_m51va_speaker_automute(codec);
18536 alc_mic_automute(codec);
18539 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18540 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18541 ALC262_HIPPO_MASTER_SWITCH,
18543 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
18544 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18545 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18547 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
18548 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18549 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18553 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18554 /* Master Playback automatically created from Speaker and Headphone */
18555 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18556 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18557 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18558 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18560 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18561 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18562 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
18564 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18565 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18566 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
18570 #ifdef CONFIG_SND_HDA_POWER_SAVE
18571 #define alc662_loopbacks alc880_loopbacks
18575 /* pcm configuration: identical with ALC880 */
18576 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18577 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18578 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18579 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18582 * configuration and preset
18584 static const char *alc662_models[ALC662_MODEL_LAST] = {
18585 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18586 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18587 [ALC662_3ST_6ch] = "3stack-6ch",
18588 [ALC662_5ST_DIG] = "6stack-dig",
18589 [ALC662_LENOVO_101E] = "lenovo-101e",
18590 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18591 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18592 [ALC662_ECS] = "ecs",
18593 [ALC663_ASUS_M51VA] = "m51va",
18594 [ALC663_ASUS_G71V] = "g71v",
18595 [ALC663_ASUS_H13] = "h13",
18596 [ALC663_ASUS_G50V] = "g50v",
18597 [ALC663_ASUS_MODE1] = "asus-mode1",
18598 [ALC662_ASUS_MODE2] = "asus-mode2",
18599 [ALC663_ASUS_MODE3] = "asus-mode3",
18600 [ALC663_ASUS_MODE4] = "asus-mode4",
18601 [ALC663_ASUS_MODE5] = "asus-mode5",
18602 [ALC663_ASUS_MODE6] = "asus-mode6",
18603 [ALC663_ASUS_MODE7] = "asus-mode7",
18604 [ALC663_ASUS_MODE8] = "asus-mode8",
18605 [ALC272_DELL] = "dell",
18606 [ALC272_DELL_ZM1] = "dell-zm1",
18607 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18608 [ALC662_AUTO] = "auto",
18611 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18612 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18613 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18614 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18615 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18616 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18617 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18618 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18619 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18620 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18621 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18622 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18623 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18624 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18625 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18626 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18627 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18628 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18629 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18630 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18631 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18632 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18633 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18634 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18635 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18636 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18637 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18638 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18639 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18640 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18641 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18642 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18643 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18644 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18645 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18646 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18647 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18648 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18649 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18650 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18651 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18652 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18653 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18654 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18655 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18656 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18657 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18658 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18659 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18660 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18661 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18662 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18663 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18664 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18665 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18666 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18667 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18668 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18669 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18670 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18671 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18672 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18673 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18674 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18675 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18676 ALC662_3ST_6ch_DIG),
18677 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18678 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18679 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18680 ALC662_3ST_6ch_DIG),
18681 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18682 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18683 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18684 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18685 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18686 ALC662_3ST_6ch_DIG),
18687 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18692 static struct alc_config_preset alc662_presets[] = {
18693 [ALC662_3ST_2ch_DIG] = {
18694 .mixers = { alc662_3ST_2ch_mixer },
18695 .init_verbs = { alc662_init_verbs },
18696 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18697 .dac_nids = alc662_dac_nids,
18698 .dig_out_nid = ALC662_DIGOUT_NID,
18699 .dig_in_nid = ALC662_DIGIN_NID,
18700 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18701 .channel_mode = alc662_3ST_2ch_modes,
18702 .input_mux = &alc662_capture_source,
18704 [ALC662_3ST_6ch_DIG] = {
18705 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18706 .init_verbs = { alc662_init_verbs },
18707 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18708 .dac_nids = alc662_dac_nids,
18709 .dig_out_nid = ALC662_DIGOUT_NID,
18710 .dig_in_nid = ALC662_DIGIN_NID,
18711 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18712 .channel_mode = alc662_3ST_6ch_modes,
18714 .input_mux = &alc662_capture_source,
18716 [ALC662_3ST_6ch] = {
18717 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18718 .init_verbs = { alc662_init_verbs },
18719 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18720 .dac_nids = alc662_dac_nids,
18721 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18722 .channel_mode = alc662_3ST_6ch_modes,
18724 .input_mux = &alc662_capture_source,
18726 [ALC662_5ST_DIG] = {
18727 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18728 .init_verbs = { alc662_init_verbs },
18729 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18730 .dac_nids = alc662_dac_nids,
18731 .dig_out_nid = ALC662_DIGOUT_NID,
18732 .dig_in_nid = ALC662_DIGIN_NID,
18733 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18734 .channel_mode = alc662_5stack_modes,
18735 .input_mux = &alc662_capture_source,
18737 [ALC662_LENOVO_101E] = {
18738 .mixers = { alc662_lenovo_101e_mixer },
18739 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18740 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18741 .dac_nids = alc662_dac_nids,
18742 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18743 .channel_mode = alc662_3ST_2ch_modes,
18744 .input_mux = &alc662_lenovo_101e_capture_source,
18745 .unsol_event = alc662_lenovo_101e_unsol_event,
18746 .init_hook = alc662_lenovo_101e_all_automute,
18748 [ALC662_ASUS_EEEPC_P701] = {
18749 .mixers = { alc662_eeepc_p701_mixer },
18750 .init_verbs = { alc662_init_verbs,
18751 alc662_eeepc_sue_init_verbs },
18752 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18753 .dac_nids = alc662_dac_nids,
18754 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18755 .channel_mode = alc662_3ST_2ch_modes,
18756 .unsol_event = alc662_eeepc_unsol_event,
18757 .setup = alc662_eeepc_setup,
18758 .init_hook = alc662_eeepc_inithook,
18760 [ALC662_ASUS_EEEPC_EP20] = {
18761 .mixers = { alc662_eeepc_ep20_mixer,
18762 alc662_chmode_mixer },
18763 .init_verbs = { alc662_init_verbs,
18764 alc662_eeepc_ep20_sue_init_verbs },
18765 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18766 .dac_nids = alc662_dac_nids,
18767 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18768 .channel_mode = alc662_3ST_6ch_modes,
18769 .input_mux = &alc662_lenovo_101e_capture_source,
18770 .unsol_event = alc662_eeepc_unsol_event,
18771 .setup = alc662_eeepc_ep20_setup,
18772 .init_hook = alc662_eeepc_ep20_inithook,
18775 .mixers = { alc662_ecs_mixer },
18776 .init_verbs = { alc662_init_verbs,
18777 alc662_ecs_init_verbs },
18778 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18779 .dac_nids = alc662_dac_nids,
18780 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18781 .channel_mode = alc662_3ST_2ch_modes,
18782 .unsol_event = alc662_eeepc_unsol_event,
18783 .setup = alc662_eeepc_setup,
18784 .init_hook = alc662_eeepc_inithook,
18786 [ALC663_ASUS_M51VA] = {
18787 .mixers = { alc663_m51va_mixer },
18788 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18789 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18790 .dac_nids = alc662_dac_nids,
18791 .dig_out_nid = ALC662_DIGOUT_NID,
18792 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18793 .channel_mode = alc662_3ST_2ch_modes,
18794 .unsol_event = alc663_m51va_unsol_event,
18795 .setup = alc663_m51va_setup,
18796 .init_hook = alc663_m51va_inithook,
18798 [ALC663_ASUS_G71V] = {
18799 .mixers = { alc663_g71v_mixer },
18800 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18801 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18802 .dac_nids = alc662_dac_nids,
18803 .dig_out_nid = ALC662_DIGOUT_NID,
18804 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18805 .channel_mode = alc662_3ST_2ch_modes,
18806 .unsol_event = alc663_g71v_unsol_event,
18807 .setup = alc663_g71v_setup,
18808 .init_hook = alc663_g71v_inithook,
18810 [ALC663_ASUS_H13] = {
18811 .mixers = { alc663_m51va_mixer },
18812 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18813 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18814 .dac_nids = alc662_dac_nids,
18815 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18816 .channel_mode = alc662_3ST_2ch_modes,
18817 .unsol_event = alc663_m51va_unsol_event,
18818 .init_hook = alc663_m51va_inithook,
18820 [ALC663_ASUS_G50V] = {
18821 .mixers = { alc663_g50v_mixer },
18822 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18823 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18824 .dac_nids = alc662_dac_nids,
18825 .dig_out_nid = ALC662_DIGOUT_NID,
18826 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18827 .channel_mode = alc662_3ST_6ch_modes,
18828 .input_mux = &alc663_capture_source,
18829 .unsol_event = alc663_g50v_unsol_event,
18830 .setup = alc663_g50v_setup,
18831 .init_hook = alc663_g50v_inithook,
18833 [ALC663_ASUS_MODE1] = {
18834 .mixers = { alc663_m51va_mixer },
18835 .cap_mixer = alc662_auto_capture_mixer,
18836 .init_verbs = { alc662_init_verbs,
18837 alc663_21jd_amic_init_verbs },
18838 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18840 .dac_nids = alc662_dac_nids,
18841 .dig_out_nid = ALC662_DIGOUT_NID,
18842 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18843 .channel_mode = alc662_3ST_2ch_modes,
18844 .unsol_event = alc663_mode1_unsol_event,
18845 .setup = alc663_mode1_setup,
18846 .init_hook = alc663_mode1_inithook,
18848 [ALC662_ASUS_MODE2] = {
18849 .mixers = { alc662_1bjd_mixer },
18850 .cap_mixer = alc662_auto_capture_mixer,
18851 .init_verbs = { alc662_init_verbs,
18852 alc662_1bjd_amic_init_verbs },
18853 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18854 .dac_nids = alc662_dac_nids,
18855 .dig_out_nid = ALC662_DIGOUT_NID,
18856 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18857 .channel_mode = alc662_3ST_2ch_modes,
18858 .unsol_event = alc662_mode2_unsol_event,
18859 .setup = alc662_mode2_setup,
18860 .init_hook = alc662_mode2_inithook,
18862 [ALC663_ASUS_MODE3] = {
18863 .mixers = { alc663_two_hp_m1_mixer },
18864 .cap_mixer = alc662_auto_capture_mixer,
18865 .init_verbs = { alc662_init_verbs,
18866 alc663_two_hp_amic_m1_init_verbs },
18867 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18869 .dac_nids = alc662_dac_nids,
18870 .dig_out_nid = ALC662_DIGOUT_NID,
18871 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18872 .channel_mode = alc662_3ST_2ch_modes,
18873 .unsol_event = alc663_mode3_unsol_event,
18874 .setup = alc663_mode3_setup,
18875 .init_hook = alc663_mode3_inithook,
18877 [ALC663_ASUS_MODE4] = {
18878 .mixers = { alc663_asus_21jd_clfe_mixer },
18879 .cap_mixer = alc662_auto_capture_mixer,
18880 .init_verbs = { alc662_init_verbs,
18881 alc663_21jd_amic_init_verbs},
18882 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18884 .dac_nids = alc662_dac_nids,
18885 .dig_out_nid = ALC662_DIGOUT_NID,
18886 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18887 .channel_mode = alc662_3ST_2ch_modes,
18888 .unsol_event = alc663_mode4_unsol_event,
18889 .setup = alc663_mode4_setup,
18890 .init_hook = alc663_mode4_inithook,
18892 [ALC663_ASUS_MODE5] = {
18893 .mixers = { alc663_asus_15jd_clfe_mixer },
18894 .cap_mixer = alc662_auto_capture_mixer,
18895 .init_verbs = { alc662_init_verbs,
18896 alc663_15jd_amic_init_verbs },
18897 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18899 .dac_nids = alc662_dac_nids,
18900 .dig_out_nid = ALC662_DIGOUT_NID,
18901 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18902 .channel_mode = alc662_3ST_2ch_modes,
18903 .unsol_event = alc663_mode5_unsol_event,
18904 .setup = alc663_mode5_setup,
18905 .init_hook = alc663_mode5_inithook,
18907 [ALC663_ASUS_MODE6] = {
18908 .mixers = { alc663_two_hp_m2_mixer },
18909 .cap_mixer = alc662_auto_capture_mixer,
18910 .init_verbs = { alc662_init_verbs,
18911 alc663_two_hp_amic_m2_init_verbs },
18912 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18914 .dac_nids = alc662_dac_nids,
18915 .dig_out_nid = ALC662_DIGOUT_NID,
18916 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18917 .channel_mode = alc662_3ST_2ch_modes,
18918 .unsol_event = alc663_mode6_unsol_event,
18919 .setup = alc663_mode6_setup,
18920 .init_hook = alc663_mode6_inithook,
18922 [ALC663_ASUS_MODE7] = {
18923 .mixers = { alc663_mode7_mixer },
18924 .cap_mixer = alc662_auto_capture_mixer,
18925 .init_verbs = { alc662_init_verbs,
18926 alc663_mode7_init_verbs },
18927 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18929 .dac_nids = alc662_dac_nids,
18930 .dig_out_nid = ALC662_DIGOUT_NID,
18931 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18932 .channel_mode = alc662_3ST_2ch_modes,
18933 .unsol_event = alc663_mode7_unsol_event,
18934 .setup = alc663_mode7_setup,
18935 .init_hook = alc663_mode7_inithook,
18937 [ALC663_ASUS_MODE8] = {
18938 .mixers = { alc663_mode8_mixer },
18939 .cap_mixer = alc662_auto_capture_mixer,
18940 .init_verbs = { alc662_init_verbs,
18941 alc663_mode8_init_verbs },
18942 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18944 .dac_nids = alc662_dac_nids,
18945 .dig_out_nid = ALC662_DIGOUT_NID,
18946 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18947 .channel_mode = alc662_3ST_2ch_modes,
18948 .unsol_event = alc663_mode8_unsol_event,
18949 .setup = alc663_mode8_setup,
18950 .init_hook = alc663_mode8_inithook,
18953 .mixers = { alc663_m51va_mixer },
18954 .cap_mixer = alc272_auto_capture_mixer,
18955 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18956 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18957 .dac_nids = alc662_dac_nids,
18958 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18959 .adc_nids = alc272_adc_nids,
18960 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18961 .capsrc_nids = alc272_capsrc_nids,
18962 .channel_mode = alc662_3ST_2ch_modes,
18963 .unsol_event = alc663_m51va_unsol_event,
18964 .setup = alc663_m51va_setup,
18965 .init_hook = alc663_m51va_inithook,
18967 [ALC272_DELL_ZM1] = {
18968 .mixers = { alc663_m51va_mixer },
18969 .cap_mixer = alc662_auto_capture_mixer,
18970 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18971 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18972 .dac_nids = alc662_dac_nids,
18973 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18974 .adc_nids = alc662_adc_nids,
18976 .capsrc_nids = alc662_capsrc_nids,
18977 .channel_mode = alc662_3ST_2ch_modes,
18978 .unsol_event = alc663_m51va_unsol_event,
18979 .setup = alc663_m51va_setup,
18980 .init_hook = alc663_m51va_inithook,
18982 [ALC272_SAMSUNG_NC10] = {
18983 .mixers = { alc272_nc10_mixer },
18984 .init_verbs = { alc662_init_verbs,
18985 alc663_21jd_amic_init_verbs },
18986 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18987 .dac_nids = alc272_dac_nids,
18988 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18989 .channel_mode = alc662_3ST_2ch_modes,
18990 /*.input_mux = &alc272_nc10_capture_source,*/
18991 .unsol_event = alc663_mode4_unsol_event,
18992 .setup = alc663_mode4_setup,
18993 .init_hook = alc663_mode4_inithook,
18999 * BIOS auto configuration
19002 /* convert from MIX nid to DAC */
19003 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19007 else if (nid >= 0x0c && nid <= 0x0e)
19008 return nid - 0x0c + 0x02;
19009 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19015 /* get MIX nid connected to the given pin targeted to DAC */
19016 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19022 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19023 for (i = 0; i < num; i++) {
19024 if (alc662_mix_to_dac(mix[i]) == dac)
19030 /* look for an empty DAC slot */
19031 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19033 struct alc_spec *spec = codec->spec;
19037 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19040 for (i = 0; i < num; i++) {
19041 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19044 for (j = 0; j < spec->multiout.num_dacs; j++)
19045 if (spec->multiout.dac_nids[j] == nid)
19047 if (j >= spec->multiout.num_dacs)
19053 /* fill in the dac_nids table from the parsed pin configuration */
19054 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19055 const struct auto_pin_cfg *cfg)
19057 struct alc_spec *spec = codec->spec;
19061 spec->multiout.dac_nids = spec->private_dac_nids;
19062 for (i = 0; i < cfg->line_outs; i++) {
19063 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19066 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19071 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19072 hda_nid_t nid, unsigned int chs)
19074 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
19075 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19078 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19079 hda_nid_t nid, unsigned int chs)
19081 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19082 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19085 #define alc662_add_stereo_vol(spec, pfx, nid) \
19086 alc662_add_vol_ctl(spec, pfx, nid, 3)
19087 #define alc662_add_stereo_sw(spec, pfx, nid) \
19088 alc662_add_sw_ctl(spec, pfx, nid, 3)
19090 /* add playback controls from the parsed DAC table */
19091 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19092 const struct auto_pin_cfg *cfg)
19094 struct alc_spec *spec = codec->spec;
19095 static const char *chname[4] = {
19096 "Front", "Surround", NULL /*CLFE*/, "Side"
19098 hda_nid_t nid, mix;
19101 for (i = 0; i < cfg->line_outs; i++) {
19102 nid = spec->multiout.dac_nids[i];
19105 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19110 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19113 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19116 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19119 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19124 if (cfg->line_outs == 1 &&
19125 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
19132 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19135 if (cfg->line_outs == 1 &&
19136 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19138 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19146 /* add playback controls for speaker and HP outputs */
19147 /* return DAC nid if any new DAC is assigned */
19148 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19151 struct alc_spec *spec = codec->spec;
19152 hda_nid_t nid, mix;
19157 nid = alc662_look_for_dac(codec, pin);
19159 /* the corresponding DAC is already occupied */
19160 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19161 return 0; /* no way */
19162 /* create a switch only */
19163 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19164 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19167 mix = alc662_dac_to_mix(codec, pin, nid);
19170 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19173 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19179 /* create playback/capture controls for input pins */
19180 #define alc662_auto_create_input_ctls \
19181 alc882_auto_create_input_ctls
19183 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19184 hda_nid_t nid, int pin_type,
19188 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19190 alc_set_pin_output(codec, nid, pin_type);
19191 /* need the manual connection? */
19192 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19195 for (i = 0; i < num; i++) {
19196 if (alc662_mix_to_dac(srcs[i]) != dac)
19198 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19203 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19205 struct alc_spec *spec = codec->spec;
19206 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19209 for (i = 0; i <= HDA_SIDE; i++) {
19210 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19212 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19213 spec->multiout.dac_nids[i]);
19217 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19219 struct alc_spec *spec = codec->spec;
19222 pin = spec->autocfg.hp_pins[0];
19224 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19225 spec->multiout.hp_nid);
19226 pin = spec->autocfg.speaker_pins[0];
19228 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19229 spec->multiout.extra_out_nid[0]);
19232 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19234 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19236 struct alc_spec *spec = codec->spec;
19237 struct auto_pin_cfg *cfg = &spec->autocfg;
19240 for (i = 0; i < cfg->num_inputs; i++) {
19241 hda_nid_t nid = cfg->inputs[i].pin;
19242 if (alc_is_input_pin(codec, nid)) {
19243 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19244 if (nid != ALC662_PIN_CD_NID &&
19245 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19246 snd_hda_codec_write(codec, nid, 0,
19247 AC_VERB_SET_AMP_GAIN_MUTE,
19253 #define alc662_auto_init_input_src alc882_auto_init_input_src
19255 static int alc662_parse_auto_config(struct hda_codec *codec)
19257 struct alc_spec *spec = codec->spec;
19259 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19261 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19265 if (!spec->autocfg.line_outs)
19266 return 0; /* can't find valid BIOS pin config */
19268 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19271 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19274 err = alc662_auto_create_extra_out(codec,
19275 spec->autocfg.speaker_pins[0],
19280 spec->multiout.extra_out_nid[0] = err;
19281 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19286 spec->multiout.hp_nid = err;
19287 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19291 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19293 alc_auto_parse_digital(codec);
19295 if (spec->kctls.list)
19296 add_mixer(spec, spec->kctls.list);
19298 spec->num_mux_defs = 1;
19299 spec->input_mux = &spec->private_imux[0];
19301 add_verb(spec, alc662_init_verbs);
19302 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19303 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19304 add_verb(spec, alc663_init_verbs);
19306 if (codec->vendor_id == 0x10ec0272)
19307 add_verb(spec, alc272_init_verbs);
19309 err = alc_auto_add_mic_boost(codec);
19313 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19314 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19315 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19317 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19322 /* additional initialization for auto-configuration model */
19323 static void alc662_auto_init(struct hda_codec *codec)
19325 struct alc_spec *spec = codec->spec;
19326 alc662_auto_init_multi_out(codec);
19327 alc662_auto_init_hp_out(codec);
19328 alc662_auto_init_analog_input(codec);
19329 alc662_auto_init_input_src(codec);
19330 alc_auto_init_digital(codec);
19331 if (spec->unsol_event)
19332 alc_inithook(codec);
19335 static void alc272_fixup_mario(struct hda_codec *codec,
19336 const struct alc_fixup *fix, int pre_init) {
19337 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19338 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19339 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19340 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19341 (0 << AC_AMPCAP_MUTE_SHIFT)))
19342 printk(KERN_WARNING
19343 "hda_codec: failed to override amp caps for NID 0x2\n");
19347 ALC662_FIXUP_ASPIRE,
19348 ALC662_FIXUP_IDEAPAD,
19349 ALC272_FIXUP_MARIO,
19352 static const struct alc_fixup alc662_fixups[] = {
19353 [ALC662_FIXUP_ASPIRE] = {
19354 .pins = (const struct alc_pincfg[]) {
19355 { 0x15, 0x99130112 }, /* subwoofer */
19359 [ALC662_FIXUP_IDEAPAD] = {
19360 .pins = (const struct alc_pincfg[]) {
19361 { 0x17, 0x99130112 }, /* subwoofer */
19365 [ALC272_FIXUP_MARIO] = {
19366 .func = alc272_fixup_mario,
19370 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19371 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19372 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19373 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19374 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19378 static const struct alc_model_fixup alc662_fixup_models[] = {
19379 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19384 static int patch_alc662(struct hda_codec *codec)
19386 struct alc_spec *spec;
19387 int err, board_config;
19390 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19394 codec->spec = spec;
19396 alc_auto_parse_customize_define(codec);
19398 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19400 coef = alc_read_coef_idx(codec, 0);
19401 if (coef == 0x8020 || coef == 0x8011)
19402 alc_codec_rename(codec, "ALC661");
19403 else if (coef & (1 << 14) &&
19404 codec->bus->pci->subsystem_vendor == 0x1025 &&
19405 spec->cdefine.platform_type == 1)
19406 alc_codec_rename(codec, "ALC272X");
19407 else if (coef == 0x4011)
19408 alc_codec_rename(codec, "ALC656");
19410 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19413 if (board_config < 0) {
19414 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19416 board_config = ALC662_AUTO;
19419 if (board_config == ALC662_AUTO) {
19420 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1);
19421 /* automatic parse from the BIOS config */
19422 err = alc662_parse_auto_config(codec);
19428 "hda_codec: Cannot set up configuration "
19429 "from BIOS. Using base mode...\n");
19430 board_config = ALC662_3ST_2ch_DIG;
19434 if (has_cdefine_beep(codec)) {
19435 err = snd_hda_attach_beep_device(codec, 0x1);
19442 if (board_config != ALC662_AUTO)
19443 setup_preset(codec, &alc662_presets[board_config]);
19445 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19446 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19448 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19449 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19451 if (!spec->adc_nids) {
19452 spec->adc_nids = alc662_adc_nids;
19453 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19455 if (!spec->capsrc_nids)
19456 spec->capsrc_nids = alc662_capsrc_nids;
19458 if (!spec->cap_mixer)
19459 set_capture_mixer(codec);
19461 if (has_cdefine_beep(codec)) {
19462 switch (codec->vendor_id) {
19464 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19469 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19472 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19476 spec->vmaster_nid = 0x02;
19478 codec->patch_ops = alc_patch_ops;
19479 if (board_config == ALC662_AUTO) {
19480 spec->init_hook = alc662_auto_init;
19481 alc_pick_fixup_model(codec, alc662_fixup_models,
19482 alc662_fixup_tbl, alc662_fixups, 0);
19485 alc_init_jacks(codec);
19487 #ifdef CONFIG_SND_HDA_POWER_SAVE
19488 if (!spec->loopback.amplist)
19489 spec->loopback.amplist = alc662_loopbacks;
19495 static int patch_alc888(struct hda_codec *codec)
19497 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19498 kfree(codec->chip_name);
19499 if (codec->vendor_id == 0x10ec0887)
19500 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19502 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19503 if (!codec->chip_name) {
19507 return patch_alc662(codec);
19509 return patch_alc882(codec);
19515 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19516 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19517 #define alc680_modes alc260_modes
19519 static hda_nid_t alc680_dac_nids[3] = {
19520 /* Lout1, Lout2, hp */
19524 static hda_nid_t alc680_adc_nids[3] = {
19526 /* DMIC, MIC, Line-in*/
19531 * Analog capture ADC cgange
19533 static void alc680_rec_autoswitch(struct hda_codec *codec)
19535 struct alc_spec *spec = codec->spec;
19536 struct auto_pin_cfg *cfg = &spec->autocfg;
19538 int type_found = AUTO_PIN_LAST;
19542 for (i = 0; i < cfg->num_inputs; i++) {
19543 nid = cfg->inputs[i].pin;
19544 if (!(snd_hda_query_pin_caps(codec, nid) &
19545 AC_PINCAP_PRES_DETECT))
19547 if (snd_hda_jack_detect(codec, nid)) {
19548 if (cfg->inputs[i].type < type_found) {
19549 type_found = cfg->inputs[i].type;
19557 snd_hda_get_connections(codec, pin_found, &nid, 1);
19559 if (nid != spec->cur_adc)
19560 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19561 spec->cur_adc = nid;
19562 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19563 spec->cur_adc_format);
19566 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19567 struct hda_codec *codec,
19568 unsigned int stream_tag,
19569 unsigned int format,
19570 struct snd_pcm_substream *substream)
19572 struct alc_spec *spec = codec->spec;
19574 spec->cur_adc = 0x07;
19575 spec->cur_adc_stream_tag = stream_tag;
19576 spec->cur_adc_format = format;
19578 alc680_rec_autoswitch(codec);
19582 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19583 struct hda_codec *codec,
19584 struct snd_pcm_substream *substream)
19586 snd_hda_codec_cleanup_stream(codec, 0x07);
19587 snd_hda_codec_cleanup_stream(codec, 0x08);
19588 snd_hda_codec_cleanup_stream(codec, 0x09);
19592 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19593 .substreams = 1, /* can be overridden */
19596 /* NID is set in alc_build_pcms */
19598 .prepare = alc680_capture_pcm_prepare,
19599 .cleanup = alc680_capture_pcm_cleanup
19603 static struct snd_kcontrol_new alc680_base_mixer[] = {
19604 /* output mixer control */
19605 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19606 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19607 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19608 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19609 HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT),
19610 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
19611 HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT),
19615 static struct hda_bind_ctls alc680_bind_cap_vol = {
19616 .ops = &snd_hda_bind_vol,
19618 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19619 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19620 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19625 static struct hda_bind_ctls alc680_bind_cap_switch = {
19626 .ops = &snd_hda_bind_sw,
19628 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19629 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19630 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19635 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19636 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19637 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19642 * generic initialization of ADC, input mixers and output mixers
19644 static struct hda_verb alc680_init_verbs[] = {
19645 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19646 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19647 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19649 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19650 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19651 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19652 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19653 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19654 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19656 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19657 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19658 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19659 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19660 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19662 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19663 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19664 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19669 /* toggle speaker-output according to the hp-jack state */
19670 static void alc680_base_setup(struct hda_codec *codec)
19672 struct alc_spec *spec = codec->spec;
19674 spec->autocfg.hp_pins[0] = 0x16;
19675 spec->autocfg.speaker_pins[0] = 0x14;
19676 spec->autocfg.speaker_pins[1] = 0x15;
19677 spec->autocfg.num_inputs = 2;
19678 spec->autocfg.inputs[0].pin = 0x18;
19679 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19680 spec->autocfg.inputs[1].pin = 0x19;
19681 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19684 static void alc680_unsol_event(struct hda_codec *codec,
19687 if ((res >> 26) == ALC880_HP_EVENT)
19688 alc_automute_amp(codec);
19689 if ((res >> 26) == ALC880_MIC_EVENT)
19690 alc680_rec_autoswitch(codec);
19693 static void alc680_inithook(struct hda_codec *codec)
19695 alc_automute_amp(codec);
19696 alc680_rec_autoswitch(codec);
19699 /* create input playback/capture controls for the given pin */
19700 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19701 const char *ctlname, int idx)
19719 if (spec->multiout.dac_nids[0] != dac &&
19720 spec->multiout.dac_nids[1] != dac) {
19721 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19722 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19727 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19728 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19732 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19738 /* add playback controls from the parsed DAC table */
19739 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19740 const struct auto_pin_cfg *cfg)
19745 spec->multiout.dac_nids = spec->private_dac_nids;
19747 nid = cfg->line_out_pins[0];
19750 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19754 err = alc680_new_analog_output(spec, nid, name, 0);
19759 nid = cfg->speaker_pins[0];
19761 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19765 nid = cfg->hp_pins[0];
19767 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19775 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19776 hda_nid_t nid, int pin_type)
19778 alc_set_pin_output(codec, nid, pin_type);
19781 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19783 struct alc_spec *spec = codec->spec;
19784 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19786 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19787 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19791 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19793 struct alc_spec *spec = codec->spec;
19796 pin = spec->autocfg.hp_pins[0];
19798 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19799 pin = spec->autocfg.speaker_pins[0];
19801 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19804 /* pcm configuration: identical with ALC880 */
19805 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19806 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19807 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19808 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19809 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19812 * BIOS auto configuration
19814 static int alc680_parse_auto_config(struct hda_codec *codec)
19816 struct alc_spec *spec = codec->spec;
19818 static hda_nid_t alc680_ignore[] = { 0 };
19820 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19825 if (!spec->autocfg.line_outs) {
19826 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19827 spec->multiout.max_channels = 2;
19828 spec->no_analog = 1;
19831 return 0; /* can't find valid BIOS pin config */
19833 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19837 spec->multiout.max_channels = 2;
19840 /* digital only support output */
19841 alc_auto_parse_digital(codec);
19842 if (spec->kctls.list)
19843 add_mixer(spec, spec->kctls.list);
19845 add_verb(spec, alc680_init_verbs);
19847 err = alc_auto_add_mic_boost(codec);
19854 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19856 /* init callback for auto-configuration model -- overriding the default init */
19857 static void alc680_auto_init(struct hda_codec *codec)
19859 struct alc_spec *spec = codec->spec;
19860 alc680_auto_init_multi_out(codec);
19861 alc680_auto_init_hp_out(codec);
19862 alc680_auto_init_analog_input(codec);
19863 alc_auto_init_digital(codec);
19864 if (spec->unsol_event)
19865 alc_inithook(codec);
19869 * configuration and preset
19871 static const char *alc680_models[ALC680_MODEL_LAST] = {
19872 [ALC680_BASE] = "base",
19873 [ALC680_AUTO] = "auto",
19876 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19877 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19881 static struct alc_config_preset alc680_presets[] = {
19883 .mixers = { alc680_base_mixer },
19884 .cap_mixer = alc680_master_capture_mixer,
19885 .init_verbs = { alc680_init_verbs },
19886 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19887 .dac_nids = alc680_dac_nids,
19888 .dig_out_nid = ALC680_DIGOUT_NID,
19889 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19890 .channel_mode = alc680_modes,
19891 .unsol_event = alc680_unsol_event,
19892 .setup = alc680_base_setup,
19893 .init_hook = alc680_inithook,
19898 static int patch_alc680(struct hda_codec *codec)
19900 struct alc_spec *spec;
19904 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19908 codec->spec = spec;
19910 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19914 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19915 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19917 board_config = ALC680_AUTO;
19920 if (board_config == ALC680_AUTO) {
19921 /* automatic parse from the BIOS config */
19922 err = alc680_parse_auto_config(codec);
19928 "hda_codec: Cannot set up configuration "
19929 "from BIOS. Using base mode...\n");
19930 board_config = ALC680_BASE;
19934 if (board_config != ALC680_AUTO)
19935 setup_preset(codec, &alc680_presets[board_config]);
19937 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19938 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19939 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19940 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19942 if (!spec->adc_nids) {
19943 spec->adc_nids = alc680_adc_nids;
19944 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19947 if (!spec->cap_mixer)
19948 set_capture_mixer(codec);
19950 spec->vmaster_nid = 0x02;
19952 codec->patch_ops = alc_patch_ops;
19953 if (board_config == ALC680_AUTO)
19954 spec->init_hook = alc680_auto_init;
19962 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19963 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19964 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19965 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19966 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19967 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19968 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19969 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19970 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19971 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19972 .patch = patch_alc861 },
19973 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19974 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19975 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19976 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19977 .patch = patch_alc882 },
19978 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19979 .patch = patch_alc662 },
19980 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19981 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19982 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19983 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19984 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19985 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19986 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19987 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19988 .patch = patch_alc882 },
19989 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19990 .patch = patch_alc882 },
19991 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19992 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
19993 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19994 .patch = patch_alc882 },
19995 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19996 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19997 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19998 {} /* terminator */
20001 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20003 MODULE_LICENSE("GPL");
20004 MODULE_DESCRIPTION("Realtek HD-audio codec");
20006 static struct hda_codec_preset_list realtek_list = {
20007 .preset = snd_hda_preset_realtek,
20008 .owner = THIS_MODULE,
20011 static int __init patch_realtek_init(void)
20013 return snd_hda_add_codec_preset(&realtek_list);
20016 static void __exit patch_realtek_exit(void)
20018 snd_hda_delete_codec_preset(&realtek_list);
20021 module_init(patch_realtek_init)
20022 module_exit(patch_realtek_exit)