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 },
2172 { "Internal Mic", 0xb },
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 Volume", 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 Volume", 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("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2845 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2846 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2847 HDA_CODEC_MUTE("Internal 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 alc88x_simple_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 alc88x_simple_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 alc88x_simple_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 static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5074 if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5077 switch (cfg->line_out_type) {
5078 case AUTO_PIN_SPEAKER_OUT:
5080 case AUTO_PIN_HP_OUT:
5083 if (cfg->line_outs == 1)
5090 /* add playback controls from the parsed DAC table */
5091 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5092 const struct auto_pin_cfg *cfg)
5094 static const char *chname[4] = {
5095 "Front", "Surround", NULL /*CLFE*/, "Side"
5097 const char *pfx = alc_get_line_out_pfx(cfg, false);
5101 for (i = 0; i < cfg->line_outs; i++) {
5102 if (!spec->multiout.dac_nids[i])
5104 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5105 if (!pfx && i == 2) {
5107 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5109 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5113 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5115 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5119 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5121 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5125 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5127 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5132 const char *name = pfx;
5135 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5137 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5141 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5143 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5152 /* add playback controls for speaker and HP outputs */
5153 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5162 if (alc880_is_fixed_pin(pin)) {
5163 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5164 /* specify the DAC as the extra output */
5165 if (!spec->multiout.hp_nid)
5166 spec->multiout.hp_nid = nid;
5168 spec->multiout.extra_out_nid[0] = nid;
5169 /* control HP volume/switch on the output mixer amp */
5170 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5171 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5172 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5175 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5176 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5179 } else if (alc880_is_multi_pin(pin)) {
5180 /* set manual connection */
5181 /* we have only a switch on HP-out PIN */
5182 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5183 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5190 /* create input playback/capture controls for the given pin */
5191 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5192 const char *ctlname, int ctlidx,
5193 int idx, hda_nid_t mix_nid)
5197 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5198 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5201 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5202 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5208 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5210 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5211 return (pincap & AC_PINCAP_IN) != 0;
5214 /* create playback/capture controls for input pins */
5215 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5216 const struct auto_pin_cfg *cfg,
5218 hda_nid_t cap1, hda_nid_t cap2)
5220 struct alc_spec *spec = codec->spec;
5221 struct hda_input_mux *imux = &spec->private_imux[0];
5222 int i, err, idx, type_idx = 0;
5223 const char *prev_label = NULL;
5225 for (i = 0; i < cfg->num_inputs; i++) {
5229 pin = cfg->inputs[i].pin;
5230 if (!alc_is_input_pin(codec, pin))
5233 label = hda_get_autocfg_input_label(codec, cfg, i);
5234 if (prev_label && !strcmp(label, prev_label))
5241 idx = get_connection_index(codec, mixer, pin);
5243 err = new_analog_input(spec, pin,
5253 idx = get_connection_index(codec, cap1, pin);
5254 if (idx < 0 && cap2)
5255 idx = get_connection_index(codec, cap2, pin);
5257 snd_hda_add_imux_item(imux, label, idx, NULL);
5262 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5263 const struct auto_pin_cfg *cfg)
5265 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5268 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5269 unsigned int pin_type)
5271 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5274 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5278 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5279 hda_nid_t nid, int pin_type,
5282 alc_set_pin_output(codec, nid, pin_type);
5283 /* need the manual connection? */
5284 if (alc880_is_multi_pin(nid)) {
5285 struct alc_spec *spec = codec->spec;
5286 int idx = alc880_multi_pin_idx(nid);
5287 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5288 AC_VERB_SET_CONNECT_SEL,
5289 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5293 static int get_pin_type(int line_out_type)
5295 if (line_out_type == AUTO_PIN_HP_OUT)
5301 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5303 struct alc_spec *spec = codec->spec;
5306 for (i = 0; i < spec->autocfg.line_outs; i++) {
5307 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5308 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5309 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5313 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5315 struct alc_spec *spec = codec->spec;
5318 pin = spec->autocfg.speaker_pins[0];
5319 if (pin) /* connect to front */
5320 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5321 pin = spec->autocfg.hp_pins[0];
5322 if (pin) /* connect to front */
5323 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5326 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5328 struct alc_spec *spec = codec->spec;
5329 struct auto_pin_cfg *cfg = &spec->autocfg;
5332 for (i = 0; i < cfg->num_inputs; i++) {
5333 hda_nid_t nid = cfg->inputs[i].pin;
5334 if (alc_is_input_pin(codec, nid)) {
5335 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5336 if (nid != ALC880_PIN_CD_NID &&
5337 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5338 snd_hda_codec_write(codec, nid, 0,
5339 AC_VERB_SET_AMP_GAIN_MUTE,
5345 static void alc880_auto_init_input_src(struct hda_codec *codec)
5347 struct alc_spec *spec = codec->spec;
5350 for (c = 0; c < spec->num_adc_nids; c++) {
5351 unsigned int mux_idx;
5352 const struct hda_input_mux *imux;
5353 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5354 imux = &spec->input_mux[mux_idx];
5355 if (!imux->num_items && mux_idx > 0)
5356 imux = &spec->input_mux[0];
5358 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5359 AC_VERB_SET_CONNECT_SEL,
5360 imux->items[0].index);
5364 /* parse the BIOS configuration and set up the alc_spec */
5365 /* return 1 if successful, 0 if the proper config is not found,
5366 * or a negative error code
5368 static int alc880_parse_auto_config(struct hda_codec *codec)
5370 struct alc_spec *spec = codec->spec;
5372 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5374 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5378 if (!spec->autocfg.line_outs)
5379 return 0; /* can't find valid BIOS pin config */
5381 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5384 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5387 err = alc880_auto_create_extra_out(spec,
5388 spec->autocfg.speaker_pins[0],
5392 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5396 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5400 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5402 alc_auto_parse_digital(codec);
5404 if (spec->kctls.list)
5405 add_mixer(spec, spec->kctls.list);
5407 add_verb(spec, alc880_volume_init_verbs);
5409 spec->num_mux_defs = 1;
5410 spec->input_mux = &spec->private_imux[0];
5412 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5417 /* additional initialization for auto-configuration model */
5418 static void alc880_auto_init(struct hda_codec *codec)
5420 struct alc_spec *spec = codec->spec;
5421 alc880_auto_init_multi_out(codec);
5422 alc880_auto_init_extra_out(codec);
5423 alc880_auto_init_analog_input(codec);
5424 alc880_auto_init_input_src(codec);
5425 alc_auto_init_digital(codec);
5426 if (spec->unsol_event)
5427 alc_inithook(codec);
5430 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5431 * one of two digital mic pins, e.g. on ALC272
5433 static void fixup_automic_adc(struct hda_codec *codec)
5435 struct alc_spec *spec = codec->spec;
5438 for (i = 0; i < spec->num_adc_nids; i++) {
5439 hda_nid_t cap = spec->capsrc_nids ?
5440 spec->capsrc_nids[i] : spec->adc_nids[i];
5443 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5446 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5449 spec->int_mic.mux_idx = iidx;
5450 spec->ext_mic.mux_idx = eidx;
5451 if (spec->capsrc_nids)
5452 spec->capsrc_nids += i;
5453 spec->adc_nids += i;
5454 spec->num_adc_nids = 1;
5457 snd_printd(KERN_INFO "hda_codec: %s: "
5458 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5459 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5460 spec->auto_mic = 0; /* disable auto-mic to be sure */
5463 /* select or unmute the given capsrc route */
5464 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5467 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5468 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5471 snd_hda_codec_write_cache(codec, cap, 0,
5472 AC_VERB_SET_CONNECT_SEL, idx);
5476 /* set the default connection to that pin */
5477 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5479 struct alc_spec *spec = codec->spec;
5482 for (i = 0; i < spec->num_adc_nids; i++) {
5483 hda_nid_t cap = spec->capsrc_nids ?
5484 spec->capsrc_nids[i] : spec->adc_nids[i];
5487 idx = get_connection_index(codec, cap, pin);
5490 select_or_unmute_capsrc(codec, cap, idx);
5491 return i; /* return the found index */
5493 return -1; /* not found */
5496 /* choose the ADC/MUX containing the input pin and initialize the setup */
5497 static void fixup_single_adc(struct hda_codec *codec)
5499 struct alc_spec *spec = codec->spec;
5500 struct auto_pin_cfg *cfg = &spec->autocfg;
5503 /* search for the input pin; there must be only one */
5504 if (cfg->num_inputs != 1)
5506 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5508 /* use only this ADC */
5509 if (spec->capsrc_nids)
5510 spec->capsrc_nids += i;
5511 spec->adc_nids += i;
5512 spec->num_adc_nids = 1;
5516 /* initialize dual adcs */
5517 static void fixup_dual_adc_switch(struct hda_codec *codec)
5519 struct alc_spec *spec = codec->spec;
5520 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5521 init_capsrc_for_pin(codec, spec->int_mic.pin);
5524 static void set_capture_mixer(struct hda_codec *codec)
5526 struct alc_spec *spec = codec->spec;
5527 static struct snd_kcontrol_new *caps[2][3] = {
5528 { alc_capture_mixer_nosrc1,
5529 alc_capture_mixer_nosrc2,
5530 alc_capture_mixer_nosrc3 },
5531 { alc_capture_mixer1,
5533 alc_capture_mixer3 },
5535 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5537 int num_adcs = spec->num_adc_nids;
5538 if (spec->dual_adc_switch)
5539 fixup_dual_adc_switch(codec);
5540 else if (spec->auto_mic)
5541 fixup_automic_adc(codec);
5542 else if (spec->input_mux) {
5543 if (spec->input_mux->num_items > 1)
5545 else if (spec->input_mux->num_items == 1)
5546 fixup_single_adc(codec);
5548 if (spec->dual_adc_switch)
5550 spec->cap_mixer = caps[mux][num_adcs - 1];
5554 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5555 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5558 struct alc_spec *spec = codec->spec;
5559 struct auto_pin_cfg *cfg = &spec->autocfg;
5561 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5563 for (n = 0; n < num_nids; n++) {
5565 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5569 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5572 nconns = snd_hda_get_connections(codec, cap, conn,
5576 nconns = snd_hda_get_connections(codec, cap, conn,
5581 if (!fallback_adc) {
5585 for (i = 0; i < cfg->num_inputs; i++) {
5586 hda_nid_t nid = cfg->inputs[i].pin;
5587 for (j = 0; j < nconns; j++) {
5594 if (i >= cfg->num_inputs) {
5595 int num_adcs = spec->num_adc_nids;
5596 spec->private_adc_nids[num_adcs] = adc;
5597 spec->private_capsrc_nids[num_adcs] = cap;
5598 spec->num_adc_nids++;
5599 spec->adc_nids = spec->private_adc_nids;
5601 spec->capsrc_nids = spec->private_capsrc_nids;
5604 if (!spec->num_adc_nids) {
5605 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5606 " using fallback 0x%x\n",
5607 codec->chip_name, fallback_adc);
5608 spec->private_adc_nids[0] = fallback_adc;
5609 spec->adc_nids = spec->private_adc_nids;
5610 if (fallback_adc != fallback_cap) {
5611 spec->private_capsrc_nids[0] = fallback_cap;
5612 spec->capsrc_nids = spec->private_adc_nids;
5617 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5618 #define set_beep_amp(spec, nid, idx, dir) \
5619 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5621 static struct snd_pci_quirk beep_white_list[] = {
5622 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5623 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5624 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5628 static inline int has_cdefine_beep(struct hda_codec *codec)
5630 struct alc_spec *spec = codec->spec;
5631 const struct snd_pci_quirk *q;
5632 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5635 return spec->cdefine.enable_pcbeep;
5638 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5639 #define has_cdefine_beep(codec) 0
5643 * OK, here we have finally the patch for ALC880
5646 static int patch_alc880(struct hda_codec *codec)
5648 struct alc_spec *spec;
5652 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5658 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5661 if (board_config < 0) {
5662 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5664 board_config = ALC880_AUTO;
5667 if (board_config == ALC880_AUTO) {
5668 /* automatic parse from the BIOS config */
5669 err = alc880_parse_auto_config(codec);
5675 "hda_codec: Cannot set up configuration "
5676 "from BIOS. Using 3-stack mode...\n");
5677 board_config = ALC880_3ST;
5681 err = snd_hda_attach_beep_device(codec, 0x1);
5687 if (board_config != ALC880_AUTO)
5688 setup_preset(codec, &alc880_presets[board_config]);
5690 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5691 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5692 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5694 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5695 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5697 if (!spec->adc_nids && spec->input_mux) {
5698 /* check whether NID 0x07 is valid */
5699 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5701 wcap = get_wcaps_type(wcap);
5702 if (wcap != AC_WID_AUD_IN) {
5703 spec->adc_nids = alc880_adc_nids_alt;
5704 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5706 spec->adc_nids = alc880_adc_nids;
5707 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5710 set_capture_mixer(codec);
5711 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5713 spec->vmaster_nid = 0x0c;
5715 codec->patch_ops = alc_patch_ops;
5716 if (board_config == ALC880_AUTO)
5717 spec->init_hook = alc880_auto_init;
5718 #ifdef CONFIG_SND_HDA_POWER_SAVE
5719 if (!spec->loopback.amplist)
5720 spec->loopback.amplist = alc880_loopbacks;
5731 static hda_nid_t alc260_dac_nids[1] = {
5736 static hda_nid_t alc260_adc_nids[1] = {
5741 static hda_nid_t alc260_adc_nids_alt[1] = {
5746 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5747 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5749 static hda_nid_t alc260_dual_adc_nids[2] = {
5754 #define ALC260_DIGOUT_NID 0x03
5755 #define ALC260_DIGIN_NID 0x06
5757 static struct hda_input_mux alc260_capture_source = {
5761 { "Front Mic", 0x1 },
5767 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5768 * headphone jack and the internal CD lines since these are the only pins at
5769 * which audio can appear. For flexibility, also allow the option of
5770 * recording the mixer output on the second ADC (ADC0 doesn't have a
5771 * connection to the mixer output).
5773 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5777 { "Mic/Line", 0x0 },
5779 { "Headphone", 0x2 },
5785 { "Mic/Line", 0x0 },
5787 { "Headphone", 0x2 },
5794 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5795 * the Fujitsu S702x, but jacks are marked differently.
5797 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5804 { "Headphone", 0x5 },
5813 { "Headphone", 0x6 },
5819 /* Maxdata Favorit 100XS */
5820 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5824 { "Line/Mic", 0x0 },
5831 { "Line/Mic", 0x0 },
5839 * This is just place-holder, so there's something for alc_build_pcms to look
5840 * at when it calculates the maximum number of channels. ALC260 has no mixer
5841 * element which allows changing the channel mode, so the verb list is
5844 static struct hda_channel_mode alc260_modes[1] = {
5849 /* Mixer combinations
5851 * basic: base_output + input + pc_beep + capture
5852 * HP: base_output + input + capture_alt
5853 * HP_3013: hp_3013 + input + capture
5854 * fujitsu: fujitsu + capture
5855 * acer: acer + capture
5858 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5859 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5860 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5861 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5862 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5863 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5864 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5868 static struct snd_kcontrol_new alc260_input_mixer[] = {
5869 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5870 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5871 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5872 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5874 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5875 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5876 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5880 /* update HP, line and mono out pins according to the master switch */
5881 static void alc260_hp_master_update(struct hda_codec *codec,
5882 hda_nid_t hp, hda_nid_t line,
5885 struct alc_spec *spec = codec->spec;
5886 unsigned int val = spec->master_sw ? PIN_HP : 0;
5887 /* change HP and line-out pins */
5888 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5890 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5892 /* mono (speaker) depending on the HP jack sense */
5893 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5894 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5898 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5899 struct snd_ctl_elem_value *ucontrol)
5901 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5902 struct alc_spec *spec = codec->spec;
5903 *ucontrol->value.integer.value = spec->master_sw;
5907 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5908 struct snd_ctl_elem_value *ucontrol)
5910 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5911 struct alc_spec *spec = codec->spec;
5912 int val = !!*ucontrol->value.integer.value;
5913 hda_nid_t hp, line, mono;
5915 if (val == spec->master_sw)
5917 spec->master_sw = val;
5918 hp = (kcontrol->private_value >> 16) & 0xff;
5919 line = (kcontrol->private_value >> 8) & 0xff;
5920 mono = kcontrol->private_value & 0xff;
5921 alc260_hp_master_update(codec, hp, line, mono);
5925 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5927 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5928 .name = "Master Playback Switch",
5929 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5930 .info = snd_ctl_boolean_mono_info,
5931 .get = alc260_hp_master_sw_get,
5932 .put = alc260_hp_master_sw_put,
5933 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5935 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5936 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5937 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5938 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5939 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5941 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5945 static struct hda_verb alc260_hp_unsol_verbs[] = {
5946 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5950 static void alc260_hp_automute(struct hda_codec *codec)
5952 struct alc_spec *spec = codec->spec;
5954 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5955 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5958 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5960 if ((res >> 26) == ALC880_HP_EVENT)
5961 alc260_hp_automute(codec);
5964 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5966 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5967 .name = "Master Playback Switch",
5968 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5969 .info = snd_ctl_boolean_mono_info,
5970 .get = alc260_hp_master_sw_get,
5971 .put = alc260_hp_master_sw_put,
5972 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5974 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5975 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5976 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5977 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5978 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5979 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5980 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5981 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5985 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5986 .ops = &snd_hda_bind_vol,
5988 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5989 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5990 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5995 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5996 .ops = &snd_hda_bind_sw,
5998 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5999 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
6004 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6005 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6006 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6007 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
6008 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6012 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6013 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6017 static void alc260_hp_3013_automute(struct hda_codec *codec)
6019 struct alc_spec *spec = codec->spec;
6021 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
6022 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
6025 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
6028 if ((res >> 26) == ALC880_HP_EVENT)
6029 alc260_hp_3013_automute(codec);
6032 static void alc260_hp_3012_automute(struct hda_codec *codec)
6034 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6036 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6038 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6040 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6044 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6047 if ((res >> 26) == ALC880_HP_EVENT)
6048 alc260_hp_3012_automute(codec);
6051 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6052 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6054 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6055 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6056 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6057 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6058 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6059 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6060 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6061 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6062 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6063 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6064 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6068 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6069 * versions of the ALC260 don't act on requests to enable mic bias from NID
6070 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6071 * datasheet doesn't mention this restriction. At this stage it's not clear
6072 * whether this behaviour is intentional or is a hardware bug in chip
6073 * revisions available in early 2006. Therefore for now allow the
6074 * "Headphone Jack Mode" control to span all choices, but if it turns out
6075 * that the lack of mic bias for this NID is intentional we could change the
6076 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6078 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6079 * don't appear to make the mic bias available from the "line" jack, even
6080 * though the NID used for this jack (0x14) can supply it. The theory is
6081 * that perhaps Acer have included blocking capacitors between the ALC260
6082 * and the output jack. If this turns out to be the case for all such
6083 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6084 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6086 * The C20x Tablet series have a mono internal speaker which is controlled
6087 * via the chip's Mono sum widget and pin complex, so include the necessary
6088 * controls for such models. On models without a "mono speaker" the control
6089 * won't do anything.
6091 static struct snd_kcontrol_new alc260_acer_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("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6095 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6097 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6099 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6100 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6102 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6103 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6104 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6105 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6106 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6110 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6112 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6113 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6114 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6115 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6116 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6117 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6118 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6122 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6123 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6125 static struct snd_kcontrol_new alc260_will_mixer[] = {
6126 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6127 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6129 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6130 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6131 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6132 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6133 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6134 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6135 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6139 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6140 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6142 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6143 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6144 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6146 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6147 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6148 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6149 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6150 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6151 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6152 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6157 * initialization verbs
6159 static struct hda_verb alc260_init_verbs[] = {
6160 /* Line In pin widget for input */
6161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6162 /* CD pin widget for input */
6163 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6164 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6165 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6166 /* Mic2 (front panel) pin widget for input and vref at 80% */
6167 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6168 /* LINE-2 is used for line-out in rear */
6169 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6170 /* select line-out */
6171 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6173 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6175 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6177 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6178 /* mute capture amp left and right */
6179 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6180 /* set connection select to line in (default select for this ADC) */
6181 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6182 /* mute capture amp left and right */
6183 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6184 /* set connection select to line in (default select for this ADC) */
6185 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6186 /* set vol=0 Line-Out mixer amp left and right */
6187 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6188 /* unmute pin widget amp left and right (no gain on this amp) */
6189 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6190 /* set vol=0 HP mixer amp left and right */
6191 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6192 /* unmute pin widget amp left and right (no gain on this amp) */
6193 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6194 /* set vol=0 Mono mixer amp left and right */
6195 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6196 /* unmute pin widget amp left and right (no gain on this amp) */
6197 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6198 /* unmute LINE-2 out pin */
6199 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6200 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6203 /* mute analog inputs */
6204 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6205 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6206 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6207 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6208 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6209 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6210 /* mute Front out path */
6211 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6212 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6213 /* mute Headphone out path */
6214 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6215 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6216 /* mute Mono out path */
6217 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6218 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6222 #if 0 /* should be identical with alc260_init_verbs? */
6223 static struct hda_verb alc260_hp_init_verbs[] = {
6224 /* Headphone and output */
6225 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6227 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6228 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6229 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6230 /* Mic2 (front panel) pin widget for input and vref at 80% */
6231 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6232 /* Line In pin widget for input */
6233 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6234 /* Line-2 pin widget for output */
6235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6236 /* CD pin widget for input */
6237 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6238 /* unmute amp left and right */
6239 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6240 /* set connection select to line in (default select for this ADC) */
6241 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6242 /* unmute Line-Out mixer amp left and right (volume = 0) */
6243 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6244 /* mute pin widget amp left and right (no gain on this amp) */
6245 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6246 /* unmute HP mixer amp left and right (volume = 0) */
6247 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6248 /* mute pin widget amp left and right (no gain on this amp) */
6249 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6250 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6253 /* mute analog inputs */
6254 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6255 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6256 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6257 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6258 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6259 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6260 /* Unmute Front out path */
6261 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6262 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6263 /* Unmute Headphone out path */
6264 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6265 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6266 /* Unmute Mono out path */
6267 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6268 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6273 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6274 /* Line out and output */
6275 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6277 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6278 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6279 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6280 /* Mic2 (front panel) pin widget for input and vref at 80% */
6281 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6282 /* Line In pin widget for input */
6283 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6284 /* Headphone pin widget for output */
6285 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6286 /* CD pin widget for input */
6287 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6288 /* unmute amp left and right */
6289 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6290 /* set connection select to line in (default select for this ADC) */
6291 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6292 /* unmute Line-Out mixer amp left and right (volume = 0) */
6293 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6294 /* mute pin widget amp left and right (no gain on this amp) */
6295 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6296 /* unmute HP mixer amp left and right (volume = 0) */
6297 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6298 /* mute pin widget amp left and right (no gain on this amp) */
6299 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6300 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6303 /* mute analog inputs */
6304 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6305 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6306 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6307 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6308 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6309 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6310 /* Unmute Front out path */
6311 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6312 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6313 /* Unmute Headphone out path */
6314 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6315 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6316 /* Unmute Mono out path */
6317 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6318 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6322 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6323 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6324 * audio = 0x16, internal speaker = 0x10.
6326 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6327 /* Disable all GPIOs */
6328 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6329 /* Internal speaker is connected to headphone pin */
6330 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6331 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6332 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6333 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6334 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6335 /* Ensure all other unused pins are disabled and muted. */
6336 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6337 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6338 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6339 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6340 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6341 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6343 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6345 /* Disable digital (SPDIF) pins */
6346 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6347 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6349 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6350 * when acting as an output.
6352 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6354 /* Start with output sum widgets muted and their output gains at min */
6355 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6356 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6357 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6358 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6359 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6360 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6361 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6362 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6363 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6365 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6366 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6367 /* Unmute Line1 pin widget output buffer since it starts as an output.
6368 * If the pin mode is changed by the user the pin mode control will
6369 * take care of enabling the pin's input/output buffers as needed.
6370 * Therefore there's no need to enable the input buffer at this
6373 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6374 /* Unmute input buffer of pin widget used for Line-in (no equiv
6377 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6379 /* Mute capture amp left and right */
6380 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6381 /* Set ADC connection select to match default mixer setting - line
6384 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6386 /* Do the same for the second ADC: mute capture input amp and
6387 * set ADC connection to line in (on mic1 pin)
6389 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6390 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6392 /* Mute all inputs to mixer widget (even unconnected ones) */
6393 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6394 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6395 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6396 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6405 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6406 * similar laptops (adapted from Fujitsu init verbs).
6408 static struct hda_verb alc260_acer_init_verbs[] = {
6409 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6410 * the headphone jack. Turn this on and rely on the standard mute
6411 * methods whenever the user wants to turn these outputs off.
6413 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6414 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6415 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6416 /* Internal speaker/Headphone jack is connected to Line-out pin */
6417 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6418 /* Internal microphone/Mic jack is connected to Mic1 pin */
6419 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6420 /* Line In jack is connected to Line1 pin */
6421 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6422 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6423 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6424 /* Ensure all other unused pins are disabled and muted. */
6425 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6426 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6427 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6428 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6429 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6430 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6431 /* Disable digital (SPDIF) pins */
6432 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6433 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6435 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6436 * bus when acting as outputs.
6438 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6439 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6441 /* Start with output sum widgets muted and their output gains at min */
6442 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6444 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6445 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6446 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6447 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6448 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6449 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6450 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6452 /* Unmute Line-out pin widget amp left and right
6453 * (no equiv mixer ctrl)
6455 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6456 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6457 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6458 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6459 * inputs. If the pin mode is changed by the user the pin mode control
6460 * will take care of enabling the pin's input/output buffers as needed.
6461 * Therefore there's no need to enable the input buffer at this
6464 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6465 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6467 /* Mute capture amp left and right */
6468 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6469 /* Set ADC connection select to match default mixer setting - mic
6472 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6474 /* Do similar with the second ADC: mute capture input amp and
6475 * set ADC connection to mic to match ALSA's default state.
6477 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6478 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6480 /* Mute all inputs to mixer widget (even unconnected ones) */
6481 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6482 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6483 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6484 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6485 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6493 /* Initialisation sequence for Maxdata Favorit 100XS
6494 * (adapted from Acer init verbs).
6496 static struct hda_verb alc260_favorit100_init_verbs[] = {
6497 /* GPIO 0 enables the output jack.
6498 * Turn this on and rely on the standard mute
6499 * methods whenever the user wants to turn these outputs off.
6501 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6502 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6503 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6504 /* Line/Mic input jack is connected to Mic1 pin */
6505 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6506 /* Ensure all other unused pins are disabled and muted. */
6507 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6508 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6509 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6510 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6511 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6512 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6513 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6514 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6515 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6517 /* Disable digital (SPDIF) pins */
6518 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6519 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6521 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6522 * bus when acting as outputs.
6524 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6525 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6527 /* Start with output sum widgets muted and their output gains at min */
6528 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6529 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6530 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6531 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6532 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6533 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6534 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6535 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6536 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6538 /* Unmute Line-out pin widget amp left and right
6539 * (no equiv mixer ctrl)
6541 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6542 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6543 * inputs. If the pin mode is changed by the user the pin mode control
6544 * will take care of enabling the pin's input/output buffers as needed.
6545 * Therefore there's no need to enable the input buffer at this
6548 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6550 /* Mute capture amp left and right */
6551 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6552 /* Set ADC connection select to match default mixer setting - mic
6555 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6557 /* Do similar with the second ADC: mute capture input amp and
6558 * set ADC connection to mic to match ALSA's default state.
6560 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6561 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6563 /* Mute all inputs to mixer widget (even unconnected ones) */
6564 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6565 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6566 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6567 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6569 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6570 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6571 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6576 static struct hda_verb alc260_will_verbs[] = {
6577 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6578 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6579 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6580 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6581 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6582 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6586 static struct hda_verb alc260_replacer_672v_verbs[] = {
6587 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6588 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6589 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6591 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6592 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6593 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6595 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6599 /* toggle speaker-output according to the hp-jack state */
6600 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6602 unsigned int present;
6604 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6605 present = snd_hda_jack_detect(codec, 0x0f);
6607 snd_hda_codec_write_cache(codec, 0x01, 0,
6608 AC_VERB_SET_GPIO_DATA, 1);
6609 snd_hda_codec_write_cache(codec, 0x0f, 0,
6610 AC_VERB_SET_PIN_WIDGET_CONTROL,
6613 snd_hda_codec_write_cache(codec, 0x01, 0,
6614 AC_VERB_SET_GPIO_DATA, 0);
6615 snd_hda_codec_write_cache(codec, 0x0f, 0,
6616 AC_VERB_SET_PIN_WIDGET_CONTROL,
6621 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6624 if ((res >> 26) == ALC880_HP_EVENT)
6625 alc260_replacer_672v_automute(codec);
6628 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6629 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6630 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6631 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6632 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6633 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6634 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6635 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6636 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6637 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6638 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6642 /* Test configuration for debugging, modelled after the ALC880 test
6645 #ifdef CONFIG_SND_DEBUG
6646 static hda_nid_t alc260_test_dac_nids[1] = {
6649 static hda_nid_t alc260_test_adc_nids[2] = {
6652 /* For testing the ALC260, each input MUX needs its own definition since
6653 * the signal assignments are different. This assumes that the first ADC
6656 static struct hda_input_mux alc260_test_capture_sources[2] = {
6660 { "MIC1 pin", 0x0 },
6661 { "MIC2 pin", 0x1 },
6662 { "LINE1 pin", 0x2 },
6663 { "LINE2 pin", 0x3 },
6665 { "LINE-OUT pin", 0x5 },
6666 { "HP-OUT pin", 0x6 },
6672 { "MIC1 pin", 0x0 },
6673 { "MIC2 pin", 0x1 },
6674 { "LINE1 pin", 0x2 },
6675 { "LINE2 pin", 0x3 },
6678 { "LINE-OUT pin", 0x6 },
6679 { "HP-OUT pin", 0x7 },
6683 static struct snd_kcontrol_new alc260_test_mixer[] = {
6684 /* Output driver widgets */
6685 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6686 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6687 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6688 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6689 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6690 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6692 /* Modes for retasking pin widgets
6693 * Note: the ALC260 doesn't seem to act on requests to enable mic
6694 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6695 * mention this restriction. At this stage it's not clear whether
6696 * this behaviour is intentional or is a hardware bug in chip
6697 * revisions available at least up until early 2006. Therefore for
6698 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6699 * choices, but if it turns out that the lack of mic bias for these
6700 * NIDs is intentional we could change their modes from
6701 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6703 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6704 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6705 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6706 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6707 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6708 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6710 /* Loopback mixer controls */
6711 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6712 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6713 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6714 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6715 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6716 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6717 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6718 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6719 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6720 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6721 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6722 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6723 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6724 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6726 /* Controls for GPIO pins, assuming they are configured as outputs */
6727 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6728 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6729 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6730 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6732 /* Switches to allow the digital IO pins to be enabled. The datasheet
6733 * is ambigious as to which NID is which; testing on laptops which
6734 * make this output available should provide clarification.
6736 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6737 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6739 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6740 * this output to turn on an external amplifier.
6742 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6743 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6747 static struct hda_verb alc260_test_init_verbs[] = {
6748 /* Enable all GPIOs as outputs with an initial value of 0 */
6749 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6750 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6751 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6753 /* Enable retasking pins as output, initially without power amp */
6754 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6755 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6756 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6757 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6758 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6759 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6761 /* Disable digital (SPDIF) pins initially, but users can enable
6762 * them via a mixer switch. In the case of SPDIF-out, this initverb
6763 * payload also sets the generation to 0, output to be in "consumer"
6764 * PCM format, copyright asserted, no pre-emphasis and no validity
6767 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6768 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6770 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6771 * OUT1 sum bus when acting as an output.
6773 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6774 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6775 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6776 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6778 /* Start with output sum widgets muted and their output gains at min */
6779 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6780 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6781 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6782 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6783 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6784 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6785 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6786 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6787 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6789 /* Unmute retasking pin widget output buffers since the default
6790 * state appears to be output. As the pin mode is changed by the
6791 * user the pin mode control will take care of enabling the pin's
6792 * input/output buffers as needed.
6794 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6795 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6796 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6797 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6798 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6799 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6800 /* Also unmute the mono-out pin widget */
6801 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6803 /* Mute capture amp left and right */
6804 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6805 /* Set ADC connection select to match default mixer setting (mic1
6808 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6810 /* Do the same for the second ADC: mute capture input amp and
6811 * set ADC connection to mic1 pin
6813 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6814 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6816 /* Mute all inputs to mixer widget (even unconnected ones) */
6817 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6818 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6819 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6820 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6821 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6822 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6823 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6830 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6831 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6833 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6834 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6837 * for BIOS auto-configuration
6840 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6841 const char *pfx, int *vol_bits)
6844 unsigned long vol_val, sw_val;
6847 if (nid >= 0x0f && nid < 0x11) {
6848 nid_vol = nid - 0x7;
6849 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6850 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6851 } else if (nid == 0x11) {
6852 nid_vol = nid - 0x7;
6853 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6854 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6855 } else if (nid >= 0x12 && nid <= 0x15) {
6857 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6858 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6862 if (!(*vol_bits & (1 << nid_vol))) {
6863 /* first control for the volume widget */
6864 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6867 *vol_bits |= (1 << nid_vol);
6869 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6875 /* add playback controls from the parsed DAC table */
6876 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6877 const struct auto_pin_cfg *cfg)
6883 spec->multiout.num_dacs = 1;
6884 spec->multiout.dac_nids = spec->private_dac_nids;
6885 spec->multiout.dac_nids[0] = 0x02;
6887 nid = cfg->line_out_pins[0];
6890 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6892 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6896 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6901 nid = cfg->speaker_pins[0];
6903 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6908 nid = cfg->hp_pins[0];
6910 err = alc260_add_playback_controls(spec, nid, "Headphone",
6918 /* create playback/capture controls for input pins */
6919 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6920 const struct auto_pin_cfg *cfg)
6922 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6925 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6926 hda_nid_t nid, int pin_type,
6929 alc_set_pin_output(codec, nid, pin_type);
6930 /* need the manual connection? */
6932 int idx = nid - 0x12;
6933 snd_hda_codec_write(codec, idx + 0x0b, 0,
6934 AC_VERB_SET_CONNECT_SEL, sel_idx);
6938 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6940 struct alc_spec *spec = codec->spec;
6943 nid = spec->autocfg.line_out_pins[0];
6945 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6946 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6949 nid = spec->autocfg.speaker_pins[0];
6951 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6953 nid = spec->autocfg.hp_pins[0];
6955 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6958 #define ALC260_PIN_CD_NID 0x16
6959 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6961 struct alc_spec *spec = codec->spec;
6962 struct auto_pin_cfg *cfg = &spec->autocfg;
6965 for (i = 0; i < cfg->num_inputs; i++) {
6966 hda_nid_t nid = cfg->inputs[i].pin;
6968 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
6969 if (nid != ALC260_PIN_CD_NID &&
6970 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6971 snd_hda_codec_write(codec, nid, 0,
6972 AC_VERB_SET_AMP_GAIN_MUTE,
6978 #define alc260_auto_init_input_src alc880_auto_init_input_src
6981 * generic initialization of ADC, input mixers and output mixers
6983 static struct hda_verb alc260_volume_init_verbs[] = {
6985 * Unmute ADC0-1 and set the default input to mic-in
6987 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6988 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6989 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6990 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6992 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6994 * Note: PASD motherboards uses the Line In 2 as the input for
6995 * front panel mic (mic 2)
6997 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6998 /* mute analog inputs */
6999 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7000 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7001 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7002 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7003 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7006 * Set up output mixers (0x08 - 0x0a)
7008 /* set vol=0 to output mixers */
7009 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7010 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7011 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7012 /* set up input amps for analog loopback */
7013 /* Amp Indices: DAC = 0, mixer = 1 */
7014 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7015 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7016 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7017 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7018 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7019 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7024 static int alc260_parse_auto_config(struct hda_codec *codec)
7026 struct alc_spec *spec = codec->spec;
7028 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
7030 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7034 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7037 if (!spec->kctls.list)
7038 return 0; /* can't find valid BIOS pin config */
7039 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7043 spec->multiout.max_channels = 2;
7045 if (spec->autocfg.dig_outs)
7046 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7047 if (spec->kctls.list)
7048 add_mixer(spec, spec->kctls.list);
7050 add_verb(spec, alc260_volume_init_verbs);
7052 spec->num_mux_defs = 1;
7053 spec->input_mux = &spec->private_imux[0];
7055 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7060 /* additional initialization for auto-configuration model */
7061 static void alc260_auto_init(struct hda_codec *codec)
7063 struct alc_spec *spec = codec->spec;
7064 alc260_auto_init_multi_out(codec);
7065 alc260_auto_init_analog_input(codec);
7066 alc260_auto_init_input_src(codec);
7067 alc_auto_init_digital(codec);
7068 if (spec->unsol_event)
7069 alc_inithook(codec);
7072 #ifdef CONFIG_SND_HDA_POWER_SAVE
7073 static struct hda_amp_list alc260_loopbacks[] = {
7074 { 0x07, HDA_INPUT, 0 },
7075 { 0x07, HDA_INPUT, 1 },
7076 { 0x07, HDA_INPUT, 2 },
7077 { 0x07, HDA_INPUT, 3 },
7078 { 0x07, HDA_INPUT, 4 },
7090 static const struct alc_fixup alc260_fixups[] = {
7091 [PINFIX_HP_DC5750] = {
7092 .pins = (const struct alc_pincfg[]) {
7093 { 0x11, 0x90130110 }, /* speaker */
7099 static struct snd_pci_quirk alc260_fixup_tbl[] = {
7100 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7105 * ALC260 configurations
7107 static const char *alc260_models[ALC260_MODEL_LAST] = {
7108 [ALC260_BASIC] = "basic",
7110 [ALC260_HP_3013] = "hp-3013",
7111 [ALC260_HP_DC7600] = "hp-dc7600",
7112 [ALC260_FUJITSU_S702X] = "fujitsu",
7113 [ALC260_ACER] = "acer",
7114 [ALC260_WILL] = "will",
7115 [ALC260_REPLACER_672V] = "replacer",
7116 [ALC260_FAVORIT100] = "favorit100",
7117 #ifdef CONFIG_SND_DEBUG
7118 [ALC260_TEST] = "test",
7120 [ALC260_AUTO] = "auto",
7123 static struct snd_pci_quirk alc260_cfg_tbl[] = {
7124 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7125 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7126 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7127 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7128 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7129 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7130 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7131 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7132 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7133 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7134 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7135 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7136 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7137 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7138 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7139 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7140 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7141 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7142 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7143 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7147 static struct alc_config_preset alc260_presets[] = {
7149 .mixers = { alc260_base_output_mixer,
7150 alc260_input_mixer },
7151 .init_verbs = { alc260_init_verbs },
7152 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7153 .dac_nids = alc260_dac_nids,
7154 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7155 .adc_nids = alc260_dual_adc_nids,
7156 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7157 .channel_mode = alc260_modes,
7158 .input_mux = &alc260_capture_source,
7161 .mixers = { alc260_hp_output_mixer,
7162 alc260_input_mixer },
7163 .init_verbs = { alc260_init_verbs,
7164 alc260_hp_unsol_verbs },
7165 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7166 .dac_nids = alc260_dac_nids,
7167 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7168 .adc_nids = alc260_adc_nids_alt,
7169 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7170 .channel_mode = alc260_modes,
7171 .input_mux = &alc260_capture_source,
7172 .unsol_event = alc260_hp_unsol_event,
7173 .init_hook = alc260_hp_automute,
7175 [ALC260_HP_DC7600] = {
7176 .mixers = { alc260_hp_dc7600_mixer,
7177 alc260_input_mixer },
7178 .init_verbs = { alc260_init_verbs,
7179 alc260_hp_dc7600_verbs },
7180 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7181 .dac_nids = alc260_dac_nids,
7182 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7183 .adc_nids = alc260_adc_nids_alt,
7184 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7185 .channel_mode = alc260_modes,
7186 .input_mux = &alc260_capture_source,
7187 .unsol_event = alc260_hp_3012_unsol_event,
7188 .init_hook = alc260_hp_3012_automute,
7190 [ALC260_HP_3013] = {
7191 .mixers = { alc260_hp_3013_mixer,
7192 alc260_input_mixer },
7193 .init_verbs = { alc260_hp_3013_init_verbs,
7194 alc260_hp_3013_unsol_verbs },
7195 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7196 .dac_nids = alc260_dac_nids,
7197 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7198 .adc_nids = alc260_adc_nids_alt,
7199 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7200 .channel_mode = alc260_modes,
7201 .input_mux = &alc260_capture_source,
7202 .unsol_event = alc260_hp_3013_unsol_event,
7203 .init_hook = alc260_hp_3013_automute,
7205 [ALC260_FUJITSU_S702X] = {
7206 .mixers = { alc260_fujitsu_mixer },
7207 .init_verbs = { alc260_fujitsu_init_verbs },
7208 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7209 .dac_nids = alc260_dac_nids,
7210 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7211 .adc_nids = alc260_dual_adc_nids,
7212 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7213 .channel_mode = alc260_modes,
7214 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7215 .input_mux = alc260_fujitsu_capture_sources,
7218 .mixers = { alc260_acer_mixer },
7219 .init_verbs = { alc260_acer_init_verbs },
7220 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7221 .dac_nids = alc260_dac_nids,
7222 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7223 .adc_nids = alc260_dual_adc_nids,
7224 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7225 .channel_mode = alc260_modes,
7226 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7227 .input_mux = alc260_acer_capture_sources,
7229 [ALC260_FAVORIT100] = {
7230 .mixers = { alc260_favorit100_mixer },
7231 .init_verbs = { alc260_favorit100_init_verbs },
7232 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7233 .dac_nids = alc260_dac_nids,
7234 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7235 .adc_nids = alc260_dual_adc_nids,
7236 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7237 .channel_mode = alc260_modes,
7238 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7239 .input_mux = alc260_favorit100_capture_sources,
7242 .mixers = { alc260_will_mixer },
7243 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7244 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7245 .dac_nids = alc260_dac_nids,
7246 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7247 .adc_nids = alc260_adc_nids,
7248 .dig_out_nid = ALC260_DIGOUT_NID,
7249 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7250 .channel_mode = alc260_modes,
7251 .input_mux = &alc260_capture_source,
7253 [ALC260_REPLACER_672V] = {
7254 .mixers = { alc260_replacer_672v_mixer },
7255 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7256 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7257 .dac_nids = alc260_dac_nids,
7258 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7259 .adc_nids = alc260_adc_nids,
7260 .dig_out_nid = ALC260_DIGOUT_NID,
7261 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7262 .channel_mode = alc260_modes,
7263 .input_mux = &alc260_capture_source,
7264 .unsol_event = alc260_replacer_672v_unsol_event,
7265 .init_hook = alc260_replacer_672v_automute,
7267 #ifdef CONFIG_SND_DEBUG
7269 .mixers = { alc260_test_mixer },
7270 .init_verbs = { alc260_test_init_verbs },
7271 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7272 .dac_nids = alc260_test_dac_nids,
7273 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7274 .adc_nids = alc260_test_adc_nids,
7275 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7276 .channel_mode = alc260_modes,
7277 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7278 .input_mux = alc260_test_capture_sources,
7283 static int patch_alc260(struct hda_codec *codec)
7285 struct alc_spec *spec;
7286 int err, board_config;
7288 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7294 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7297 if (board_config < 0) {
7298 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7300 board_config = ALC260_AUTO;
7303 if (board_config == ALC260_AUTO)
7304 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1);
7306 if (board_config == ALC260_AUTO) {
7307 /* automatic parse from the BIOS config */
7308 err = alc260_parse_auto_config(codec);
7314 "hda_codec: Cannot set up configuration "
7315 "from BIOS. Using base mode...\n");
7316 board_config = ALC260_BASIC;
7320 err = snd_hda_attach_beep_device(codec, 0x1);
7326 if (board_config != ALC260_AUTO)
7327 setup_preset(codec, &alc260_presets[board_config]);
7329 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7330 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7331 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7333 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7334 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7336 if (!spec->adc_nids && spec->input_mux) {
7337 /* check whether NID 0x04 is valid */
7338 unsigned int wcap = get_wcaps(codec, 0x04);
7339 wcap = get_wcaps_type(wcap);
7341 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7342 spec->adc_nids = alc260_adc_nids_alt;
7343 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7345 spec->adc_nids = alc260_adc_nids;
7346 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7349 set_capture_mixer(codec);
7350 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7352 if (board_config == ALC260_AUTO)
7353 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7355 spec->vmaster_nid = 0x08;
7357 codec->patch_ops = alc_patch_ops;
7358 if (board_config == ALC260_AUTO)
7359 spec->init_hook = alc260_auto_init;
7360 #ifdef CONFIG_SND_HDA_POWER_SAVE
7361 if (!spec->loopback.amplist)
7362 spec->loopback.amplist = alc260_loopbacks;
7370 * ALC882/883/885/888/889 support
7372 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7373 * configuration. Each pin widget can choose any input DACs and a mixer.
7374 * Each ADC is connected from a mixer of all inputs. This makes possible
7375 * 6-channel independent captures.
7377 * In addition, an independent DAC for the multi-playback (not used in this
7380 #define ALC882_DIGOUT_NID 0x06
7381 #define ALC882_DIGIN_NID 0x0a
7382 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7383 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7384 #define ALC1200_DIGOUT_NID 0x10
7387 static struct hda_channel_mode alc882_ch_modes[1] = {
7392 static hda_nid_t alc882_dac_nids[4] = {
7393 /* front, rear, clfe, rear_surr */
7394 0x02, 0x03, 0x04, 0x05
7396 #define alc883_dac_nids alc882_dac_nids
7399 #define alc882_adc_nids alc880_adc_nids
7400 #define alc882_adc_nids_alt alc880_adc_nids_alt
7401 #define alc883_adc_nids alc882_adc_nids_alt
7402 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7403 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7404 #define alc889_adc_nids alc880_adc_nids
7406 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7407 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7408 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7409 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7410 #define alc889_capsrc_nids alc882_capsrc_nids
7413 /* FIXME: should be a matrix-type input source selection */
7415 static struct hda_input_mux alc882_capture_source = {
7419 { "Front Mic", 0x1 },
7425 #define alc883_capture_source alc882_capture_source
7427 static struct hda_input_mux alc889_capture_source = {
7430 { "Front Mic", 0x0 },
7436 static struct hda_input_mux mb5_capture_source = {
7445 static struct hda_input_mux macmini3_capture_source = {
7453 static struct hda_input_mux alc883_3stack_6ch_intel = {
7457 { "Front Mic", 0x0 },
7463 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7471 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7475 { "Internal Mic", 0x1 },
7481 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7485 { "Internal Mic", 0x1 },
7489 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7493 { "Front Mic", 0x1 },
7498 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7506 static struct hda_input_mux alc889A_mb31_capture_source = {
7510 /* Front Mic (0x01) unused */
7512 /* Line 2 (0x03) unused */
7513 /* CD (0x04) unused? */
7517 static struct hda_input_mux alc889A_imac91_capture_source = {
7521 { "Line", 0x2 }, /* Not sure! */
7528 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7535 static struct hda_verb alc882_3ST_ch2_init[] = {
7536 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7537 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7538 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7539 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7546 static struct hda_verb alc882_3ST_ch4_init[] = {
7547 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7548 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7549 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7550 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7551 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7558 static struct hda_verb alc882_3ST_ch6_init[] = {
7559 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7560 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7561 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7562 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7563 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7564 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7568 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7569 { 2, alc882_3ST_ch2_init },
7570 { 4, alc882_3ST_ch4_init },
7571 { 6, alc882_3ST_ch6_init },
7574 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7579 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7580 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7581 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7582 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7583 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7584 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7591 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7592 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7593 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7594 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7595 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7596 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7597 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7604 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7605 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7606 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7607 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7608 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7609 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7610 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7611 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7615 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7616 { 2, alc883_3ST_ch2_clevo_init },
7617 { 4, alc883_3ST_ch4_clevo_init },
7618 { 6, alc883_3ST_ch6_clevo_init },
7625 static struct hda_verb alc882_sixstack_ch6_init[] = {
7626 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7627 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7628 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7629 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7636 static struct hda_verb alc882_sixstack_ch8_init[] = {
7637 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7638 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7639 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7640 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7644 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7645 { 6, alc882_sixstack_ch6_init },
7646 { 8, alc882_sixstack_ch8_init },
7650 /* Macbook Air 2,1 */
7652 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7657 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7663 static struct hda_verb alc885_mbp_ch2_init[] = {
7664 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7665 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7666 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7673 static struct hda_verb alc885_mbp_ch4_init[] = {
7674 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7675 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7676 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7677 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7678 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7682 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7683 { 2, alc885_mbp_ch2_init },
7684 { 4, alc885_mbp_ch4_init },
7689 * Speakers/Woofer/HP = Front
7692 static struct hda_verb alc885_mb5_ch2_init[] = {
7693 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7694 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7700 * Speakers/HP = Front
7704 static struct hda_verb alc885_mb5_ch6_init[] = {
7705 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7706 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7707 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7711 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7712 { 2, alc885_mb5_ch2_init },
7713 { 6, alc885_mb5_ch6_init },
7716 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7721 static struct hda_verb alc883_4ST_ch2_init[] = {
7722 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7723 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7724 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7725 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7726 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7727 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7734 static struct hda_verb alc883_4ST_ch4_init[] = {
7735 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7736 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7737 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7738 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7739 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7740 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7741 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7748 static struct hda_verb alc883_4ST_ch6_init[] = {
7749 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7750 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7751 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7752 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7753 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7754 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7755 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7756 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7763 static struct hda_verb alc883_4ST_ch8_init[] = {
7764 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7765 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7766 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7767 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7768 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7769 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7770 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7771 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7772 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7776 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7777 { 2, alc883_4ST_ch2_init },
7778 { 4, alc883_4ST_ch4_init },
7779 { 6, alc883_4ST_ch6_init },
7780 { 8, alc883_4ST_ch8_init },
7787 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7788 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7789 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7790 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7791 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7798 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7799 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7800 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7801 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7802 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7803 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7810 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7811 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7812 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7813 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7814 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7815 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7816 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7820 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7821 { 2, alc883_3ST_ch2_intel_init },
7822 { 4, alc883_3ST_ch4_intel_init },
7823 { 6, alc883_3ST_ch6_intel_init },
7829 static struct hda_verb alc889_ch2_intel_init[] = {
7830 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7831 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7832 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7833 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7834 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7835 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7842 static struct hda_verb alc889_ch6_intel_init[] = {
7843 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7844 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7845 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7846 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7847 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7848 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7855 static struct hda_verb alc889_ch8_intel_init[] = {
7856 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7857 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7858 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7859 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7860 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7861 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7862 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7866 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7867 { 2, alc889_ch2_intel_init },
7868 { 6, alc889_ch6_intel_init },
7869 { 8, alc889_ch8_intel_init },
7875 static struct hda_verb alc883_sixstack_ch6_init[] = {
7876 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7877 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7878 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7879 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7886 static struct hda_verb alc883_sixstack_ch8_init[] = {
7887 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7888 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7889 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7890 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7894 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7895 { 6, alc883_sixstack_ch6_init },
7896 { 8, alc883_sixstack_ch8_init },
7900 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7901 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7903 static struct snd_kcontrol_new alc882_base_mixer[] = {
7904 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7905 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7906 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7907 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7908 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7909 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7910 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7911 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7912 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7913 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7914 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7915 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7916 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7917 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7918 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7919 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7920 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
7921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7922 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7923 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
7924 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7928 /* Macbook Air 2,1 same control for HP and internal Speaker */
7930 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7931 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7932 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7937 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7938 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7939 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7940 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7941 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7942 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7943 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7944 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7945 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7946 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7947 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
7948 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
7952 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7953 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7954 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7955 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7956 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7957 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7958 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7959 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7960 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7961 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7962 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7963 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7964 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7965 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
7966 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
7970 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7971 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7972 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7973 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7974 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7975 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7976 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7977 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7978 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7979 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7980 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7981 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
7985 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7986 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7987 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7992 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7993 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7994 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7995 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7996 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7997 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7998 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7999 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8000 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8001 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8005 static struct snd_kcontrol_new alc882_targa_mixer[] = {
8006 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8007 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8008 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 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("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8014 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8015 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8016 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8017 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8018 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8022 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8023 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8025 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8026 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8027 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8028 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8029 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8030 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8031 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8032 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8033 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8034 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8035 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8036 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8037 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8038 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8042 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8043 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8044 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8045 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8046 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8047 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8048 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8049 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8050 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8051 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8052 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8056 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8058 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8059 .name = "Channel Mode",
8060 .info = alc_ch_mode_info,
8061 .get = alc_ch_mode_get,
8062 .put = alc_ch_mode_put,
8067 static struct hda_verb alc882_base_init_verbs[] = {
8068 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8069 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8070 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8072 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8073 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8075 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8076 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8078 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8079 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8081 /* Front Pin: output 0 (0x0c) */
8082 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8083 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8084 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8085 /* Rear Pin: output 1 (0x0d) */
8086 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8087 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8088 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8089 /* CLFE Pin: output 2 (0x0e) */
8090 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8091 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8092 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8093 /* Side Pin: output 3 (0x0f) */
8094 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8095 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8096 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8097 /* Mic (rear) pin: input vref at 80% */
8098 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8099 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8100 /* Front Mic pin: input vref at 80% */
8101 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8102 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8103 /* Line In pin: input */
8104 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8105 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8106 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8107 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8108 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8109 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8110 /* CD pin widget for input */
8111 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8113 /* FIXME: use matrix-type input source selection */
8114 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8116 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8119 /* ADC2: mute amp left and right */
8120 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8121 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8122 /* ADC3: mute amp left and right */
8123 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8124 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8129 static struct hda_verb alc882_adc1_init_verbs[] = {
8130 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8131 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8132 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8133 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8134 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8135 /* ADC1: mute amp left and right */
8136 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8137 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8141 static struct hda_verb alc882_eapd_verbs[] = {
8142 /* change to EAPD mode */
8143 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8144 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8148 static struct hda_verb alc889_eapd_verbs[] = {
8149 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8150 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8154 static struct hda_verb alc_hp15_unsol_verbs[] = {
8155 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8156 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8160 static struct hda_verb alc885_init_verbs[] = {
8161 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8165 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8166 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8168 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8169 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8171 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8172 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8174 /* Front HP Pin: output 0 (0x0c) */
8175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8176 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8177 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8178 /* Front Pin: output 0 (0x0c) */
8179 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8180 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8181 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8182 /* Rear Pin: output 1 (0x0d) */
8183 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8184 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8185 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8186 /* CLFE Pin: output 2 (0x0e) */
8187 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8188 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8189 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8190 /* Side Pin: output 3 (0x0f) */
8191 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8192 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8193 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8194 /* Mic (rear) pin: input vref at 80% */
8195 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8196 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8197 /* Front Mic pin: input vref at 80% */
8198 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8199 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8200 /* Line In pin: input */
8201 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8202 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8204 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8206 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8208 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8210 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8211 /* ADC2: mute amp left and right */
8212 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8213 /* ADC3: mute amp left and right */
8214 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8219 static struct hda_verb alc885_init_input_verbs[] = {
8220 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8221 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8222 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8227 /* Unmute Selector 24h and set the default input to front mic */
8228 static struct hda_verb alc889_init_input_verbs[] = {
8229 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8235 #define alc883_init_verbs alc882_base_init_verbs
8238 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8239 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8240 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8241 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8242 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8243 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8244 /* FIXME: this looks suspicious...
8245 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8246 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8251 static struct hda_verb alc882_macpro_init_verbs[] = {
8252 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8253 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8256 /* Front Pin: output 0 (0x0c) */
8257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8258 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8259 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8260 /* Front Mic pin: input vref at 80% */
8261 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8262 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8263 /* Speaker: output */
8264 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8265 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8266 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8267 /* Headphone output (output 0 - 0x0c) */
8268 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8269 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8270 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8272 /* FIXME: use matrix-type input source selection */
8273 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8274 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8275 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8280 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8285 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8289 /* ADC1: mute amp left and right */
8290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8291 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8292 /* ADC2: mute amp left and right */
8293 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8294 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8295 /* ADC3: mute amp left and right */
8296 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8297 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8303 static struct hda_verb alc885_mb5_init_verbs[] = {
8305 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8306 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8307 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8308 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8310 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8313 /* Surround mixer */
8314 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8315 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8316 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8318 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8320 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8322 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8323 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8325 /* Front Pin (0x0c) */
8326 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8327 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8328 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8329 /* LFE Pin (0x0e) */
8330 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8331 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8332 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8334 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8335 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8336 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8337 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8338 /* Front Mic pin: input vref at 80% */
8339 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8340 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8343 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8345 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8346 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8347 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8352 static struct hda_verb alc885_macmini3_init_verbs[] = {
8354 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8355 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8356 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8357 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8359 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8360 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8361 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8362 /* Surround mixer */
8363 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8364 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8365 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8367 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8368 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8371 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8372 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8373 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8374 /* Front Pin (0x0c) */
8375 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8376 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8377 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8378 /* LFE Pin (0x0e) */
8379 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8380 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8381 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8383 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8384 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8385 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8386 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8388 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8389 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8391 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8392 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8393 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8399 static struct hda_verb alc885_mba21_init_verbs[] = {
8400 /*Internal and HP Speaker Mixer*/
8401 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8404 /*Internal Speaker Pin (0x0c)*/
8405 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8406 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8407 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8408 /* HP Pin: output 0 (0x0e) */
8409 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8410 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8411 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8412 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8413 /* Line in (is hp when jack connected)*/
8414 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8415 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8421 /* Macbook Pro rev3 */
8422 static struct hda_verb alc885_mbp3_init_verbs[] = {
8423 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8424 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8428 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8429 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8430 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8432 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8433 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8434 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8435 /* Front Pin: output 0 (0x0c) */
8436 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8437 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8438 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8439 /* HP Pin: output 0 (0x0e) */
8440 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8441 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8442 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8443 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8444 /* Mic (rear) pin: input vref at 80% */
8445 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8446 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8447 /* Front Mic pin: input vref at 80% */
8448 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8449 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8450 /* Line In pin: use output 1 when in LineOut mode */
8451 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8452 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8453 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8455 /* FIXME: use matrix-type input source selection */
8456 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8457 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8458 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8461 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8472 /* ADC1: mute amp left and right */
8473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8474 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8475 /* ADC2: mute amp left and right */
8476 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8477 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8478 /* ADC3: mute amp left and right */
8479 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8480 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8486 static struct hda_verb alc885_imac91_init_verbs[] = {
8487 /* Internal Speaker Pin (0x0c) */
8488 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8489 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8490 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8491 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8492 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8493 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8497 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8498 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8500 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8501 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8502 /* Front Mic pin: input vref at 80% */
8503 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8504 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8506 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8507 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8508 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8509 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8510 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8513 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8514 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8515 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8516 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8518 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8519 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8520 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8522 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8523 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8524 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8525 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8528 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8529 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8530 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8531 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8532 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8533 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8534 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8535 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8536 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8540 /* iMac 24 mixer. */
8541 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8542 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8543 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8547 /* iMac 24 init verbs. */
8548 static struct hda_verb alc885_imac24_init_verbs[] = {
8549 /* Internal speakers: output 0 (0x0c) */
8550 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8551 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8552 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8553 /* Internal speakers: output 0 (0x0c) */
8554 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8555 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8556 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8557 /* Headphone: output 0 (0x0c) */
8558 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8559 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8560 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8561 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8562 /* Front Mic: input vref at 80% */
8563 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8564 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8568 /* Toggle speaker-output according to the hp-jack state */
8569 static void alc885_imac24_setup(struct hda_codec *codec)
8571 struct alc_spec *spec = codec->spec;
8573 spec->autocfg.hp_pins[0] = 0x14;
8574 spec->autocfg.speaker_pins[0] = 0x18;
8575 spec->autocfg.speaker_pins[1] = 0x1a;
8578 #define alc885_mb5_setup alc885_imac24_setup
8579 #define alc885_macmini3_setup alc885_imac24_setup
8581 /* Macbook Air 2,1 */
8582 static void alc885_mba21_setup(struct hda_codec *codec)
8584 struct alc_spec *spec = codec->spec;
8586 spec->autocfg.hp_pins[0] = 0x14;
8587 spec->autocfg.speaker_pins[0] = 0x18;
8592 static void alc885_mbp3_setup(struct hda_codec *codec)
8594 struct alc_spec *spec = codec->spec;
8596 spec->autocfg.hp_pins[0] = 0x15;
8597 spec->autocfg.speaker_pins[0] = 0x14;
8600 static void alc885_imac91_setup(struct hda_codec *codec)
8602 struct alc_spec *spec = codec->spec;
8604 spec->autocfg.hp_pins[0] = 0x14;
8605 spec->autocfg.speaker_pins[0] = 0x18;
8606 spec->autocfg.speaker_pins[1] = 0x1a;
8609 static struct hda_verb alc882_targa_verbs[] = {
8610 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8611 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8613 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8614 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8616 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8617 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8618 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8620 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8624 /* toggle speaker-output according to the hp-jack state */
8625 static void alc882_targa_automute(struct hda_codec *codec)
8627 struct alc_spec *spec = codec->spec;
8628 alc_automute_amp(codec);
8629 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8630 spec->jack_present ? 1 : 3);
8633 static void alc882_targa_setup(struct hda_codec *codec)
8635 struct alc_spec *spec = codec->spec;
8637 spec->autocfg.hp_pins[0] = 0x14;
8638 spec->autocfg.speaker_pins[0] = 0x1b;
8641 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8643 if ((res >> 26) == ALC880_HP_EVENT)
8644 alc882_targa_automute(codec);
8647 static struct hda_verb alc882_asus_a7j_verbs[] = {
8648 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8649 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8651 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8652 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8653 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8655 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8656 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8657 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8659 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8660 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8661 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8665 static struct hda_verb alc882_asus_a7m_verbs[] = {
8666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8670 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8671 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8673 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8674 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8675 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8677 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8678 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8679 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8683 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8685 unsigned int gpiostate, gpiomask, gpiodir;
8687 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8688 AC_VERB_GET_GPIO_DATA, 0);
8691 gpiostate |= (1 << pin);
8693 gpiostate &= ~(1 << pin);
8695 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8696 AC_VERB_GET_GPIO_MASK, 0);
8697 gpiomask |= (1 << pin);
8699 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8700 AC_VERB_GET_GPIO_DIRECTION, 0);
8701 gpiodir |= (1 << pin);
8704 snd_hda_codec_write(codec, codec->afg, 0,
8705 AC_VERB_SET_GPIO_MASK, gpiomask);
8706 snd_hda_codec_write(codec, codec->afg, 0,
8707 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8711 snd_hda_codec_write(codec, codec->afg, 0,
8712 AC_VERB_SET_GPIO_DATA, gpiostate);
8715 /* set up GPIO at initialization */
8716 static void alc885_macpro_init_hook(struct hda_codec *codec)
8718 alc882_gpio_mute(codec, 0, 0);
8719 alc882_gpio_mute(codec, 1, 0);
8722 /* set up GPIO and update auto-muting at initialization */
8723 static void alc885_imac24_init_hook(struct hda_codec *codec)
8725 alc885_macpro_init_hook(codec);
8726 alc_automute_amp(codec);
8730 * generic initialization of ADC, input mixers and output mixers
8732 static struct hda_verb alc883_auto_init_verbs[] = {
8734 * Unmute ADC0-2 and set the default input to mic-in
8736 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8737 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8738 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8739 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8742 * Set up output mixers (0x0c - 0x0f)
8744 /* set vol=0 to output mixers */
8745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8746 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8747 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8748 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8749 /* set up input amps for analog loopback */
8750 /* Amp Indices: DAC = 0, mixer = 1 */
8751 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8753 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8754 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8755 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8756 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8757 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8758 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8759 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8760 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8762 /* FIXME: use matrix-type input source selection */
8763 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8765 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8767 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8771 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8772 static struct hda_verb alc889A_mb31_ch2_init[] = {
8773 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8774 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8775 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8776 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8780 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8781 static struct hda_verb alc889A_mb31_ch4_init[] = {
8782 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8783 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8784 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8785 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8789 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8790 static struct hda_verb alc889A_mb31_ch5_init[] = {
8791 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8792 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8793 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8794 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8798 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8799 static struct hda_verb alc889A_mb31_ch6_init[] = {
8800 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8801 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8802 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8803 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8807 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8808 { 2, alc889A_mb31_ch2_init },
8809 { 4, alc889A_mb31_ch4_init },
8810 { 5, alc889A_mb31_ch5_init },
8811 { 6, alc889A_mb31_ch6_init },
8814 static struct hda_verb alc883_medion_eapd_verbs[] = {
8815 /* eanable EAPD on medion laptop */
8816 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8817 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8821 #define alc883_base_mixer alc882_base_mixer
8823 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8824 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8825 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8826 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8827 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8828 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8829 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8830 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8832 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8833 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8834 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8835 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8836 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8840 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8841 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8842 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8843 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8844 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8845 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8846 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8847 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8848 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8849 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8850 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8854 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8855 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8856 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8857 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8858 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8860 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8861 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8862 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8863 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8864 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8868 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8869 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8870 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8871 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8872 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8873 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8874 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8875 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8876 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8877 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8878 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8879 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8880 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8881 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8885 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8886 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8887 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8888 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8889 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8890 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8891 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8892 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8893 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8894 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8895 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8896 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8897 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8898 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8899 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8900 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8901 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8902 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8903 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8904 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8908 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8909 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8910 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8911 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8912 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8913 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8915 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8916 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8917 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8918 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8919 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8920 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8921 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8922 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8923 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8924 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
8925 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8926 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8927 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
8928 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8932 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8933 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8934 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8935 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8936 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8937 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8939 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8940 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8941 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8942 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8943 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8944 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8945 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8946 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8948 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
8949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8950 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8951 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
8952 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8956 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8957 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8958 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8959 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8960 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8961 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8962 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8963 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8964 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8965 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8966 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8967 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8968 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8969 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8970 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8971 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8972 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8973 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8974 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8975 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8979 static struct snd_kcontrol_new alc883_targa_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("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8985 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8986 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8987 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8988 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8989 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8990 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8991 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8992 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8993 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8995 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9000 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9001 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9002 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9003 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9004 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9005 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9006 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9007 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9008 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9009 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9010 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9011 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9012 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9016 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9017 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9018 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9019 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9020 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9021 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9025 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9026 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9027 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9028 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9029 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9032 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9037 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9038 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9039 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9040 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9041 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9042 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9045 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9046 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9050 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9051 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9052 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9053 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9054 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9055 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9056 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9060 static struct hda_verb alc883_medion_wim2160_verbs[] = {
9061 /* Unmute front mixer */
9062 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9063 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9065 /* Set speaker pin to front mixer */
9066 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9068 /* Init headphone pin */
9069 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9070 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9071 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9072 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9077 /* toggle speaker-output according to the hp-jack state */
9078 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9080 struct alc_spec *spec = codec->spec;
9082 spec->autocfg.hp_pins[0] = 0x1a;
9083 spec->autocfg.speaker_pins[0] = 0x15;
9086 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9087 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9088 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9089 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9090 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9091 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9092 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9093 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9094 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9098 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9099 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9100 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9101 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9102 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9103 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9104 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9106 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9107 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9111 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9112 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9113 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9114 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9115 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9116 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9117 0x0d, 1, 0x0, HDA_OUTPUT),
9118 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9119 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9120 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9121 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9122 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9123 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9124 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9125 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9126 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9127 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9128 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9130 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9131 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9132 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9136 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9138 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9139 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9140 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9141 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9142 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9144 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9145 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9146 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9147 /* Output switches */
9148 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9149 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9150 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9152 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
9153 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
9155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9156 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9157 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9158 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9162 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9163 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9164 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9167 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9168 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9172 static struct hda_bind_ctls alc883_bind_cap_vol = {
9173 .ops = &snd_hda_bind_vol,
9175 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9176 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9181 static struct hda_bind_ctls alc883_bind_cap_switch = {
9182 .ops = &snd_hda_bind_sw,
9184 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9185 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9190 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9191 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9192 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9193 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9194 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9195 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9197 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9202 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9203 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9204 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9206 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9207 /* .name = "Capture Source", */
9208 .name = "Input Source",
9210 .info = alc_mux_enum_info,
9211 .get = alc_mux_enum_get,
9212 .put = alc_mux_enum_put,
9217 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9219 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9220 .name = "Channel Mode",
9221 .info = alc_ch_mode_info,
9222 .get = alc_ch_mode_get,
9223 .put = alc_ch_mode_put,
9228 /* toggle speaker-output according to the hp-jack state */
9229 static void alc883_mitac_setup(struct hda_codec *codec)
9231 struct alc_spec *spec = codec->spec;
9233 spec->autocfg.hp_pins[0] = 0x15;
9234 spec->autocfg.speaker_pins[0] = 0x14;
9235 spec->autocfg.speaker_pins[1] = 0x17;
9238 static struct hda_verb alc883_mitac_verbs[] = {
9240 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9241 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9243 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9244 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9246 /* enable unsolicited event */
9247 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9248 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9253 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9255 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9258 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9260 /* enable unsolicited event */
9262 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9263 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9269 static struct hda_verb alc883_clevo_m720_verbs[] = {
9271 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9272 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9274 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9275 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9277 /* enable unsolicited event */
9278 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9279 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9284 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9286 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9287 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9289 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9292 /* enable unsolicited event */
9293 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9298 static struct hda_verb alc883_targa_verbs[] = {
9299 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9300 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9302 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9303 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9305 /* Connect Line-Out side jack (SPDIF) to Side */
9306 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9307 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9308 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9309 /* Connect Mic jack to CLFE */
9310 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9311 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9312 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9313 /* Connect Line-in jack to Surround */
9314 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9315 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9316 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9317 /* Connect HP out jack to Front */
9318 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9319 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9320 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9322 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9327 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9328 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9329 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9330 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9334 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9335 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9336 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9337 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9342 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9343 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9345 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9346 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9347 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9351 static struct hda_verb alc883_haier_w66_verbs[] = {
9352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9355 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9357 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9358 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9359 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9360 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9364 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9367 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9368 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9369 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9370 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9371 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9372 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9376 static struct hda_verb alc888_6st_dell_verbs[] = {
9377 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9381 static struct hda_verb alc883_vaiott_verbs[] = {
9383 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9384 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9386 /* enable unsolicited event */
9387 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9392 static void alc888_3st_hp_setup(struct hda_codec *codec)
9394 struct alc_spec *spec = codec->spec;
9396 spec->autocfg.hp_pins[0] = 0x1b;
9397 spec->autocfg.speaker_pins[0] = 0x14;
9398 spec->autocfg.speaker_pins[1] = 0x16;
9399 spec->autocfg.speaker_pins[2] = 0x18;
9402 static struct hda_verb alc888_3st_hp_verbs[] = {
9403 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9404 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9405 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9406 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9413 static struct hda_verb alc888_3st_hp_2ch_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_IN },
9417 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9424 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9425 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9426 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9427 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9428 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9429 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9436 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9437 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9438 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9439 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9440 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9441 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9442 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9446 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9447 { 2, alc888_3st_hp_2ch_init },
9448 { 4, alc888_3st_hp_4ch_init },
9449 { 6, alc888_3st_hp_6ch_init },
9452 /* toggle front-jack and RCA according to the hp-jack state */
9453 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9455 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9457 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9458 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9459 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9460 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9463 /* toggle RCA according to the front-jack state */
9464 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9466 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9468 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9469 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9472 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9475 if ((res >> 26) == ALC880_HP_EVENT)
9476 alc888_lenovo_ms7195_front_automute(codec);
9477 if ((res >> 26) == ALC880_FRONT_EVENT)
9478 alc888_lenovo_ms7195_rca_automute(codec);
9481 /* toggle speaker-output according to the hp-jack state */
9482 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9484 struct alc_spec *spec = codec->spec;
9486 spec->autocfg.hp_pins[0] = 0x14;
9487 spec->autocfg.speaker_pins[0] = 0x15;
9490 /* toggle speaker-output according to the hp-jack state */
9491 #define alc883_targa_init_hook alc882_targa_init_hook
9492 #define alc883_targa_unsol_event alc882_targa_unsol_event
9494 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9496 struct alc_spec *spec = codec->spec;
9498 spec->autocfg.hp_pins[0] = 0x15;
9499 spec->autocfg.speaker_pins[0] = 0x14;
9502 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9504 alc_automute_amp(codec);
9505 alc88x_simple_mic_automute(codec);
9508 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9511 switch (res >> 26) {
9512 case ALC880_MIC_EVENT:
9513 alc88x_simple_mic_automute(codec);
9516 alc_automute_amp_unsol_event(codec, res);
9521 /* toggle speaker-output according to the hp-jack state */
9522 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9524 struct alc_spec *spec = codec->spec;
9526 spec->autocfg.hp_pins[0] = 0x14;
9527 spec->autocfg.speaker_pins[0] = 0x15;
9530 static void alc883_haier_w66_setup(struct hda_codec *codec)
9532 struct alc_spec *spec = codec->spec;
9534 spec->autocfg.hp_pins[0] = 0x1b;
9535 spec->autocfg.speaker_pins[0] = 0x14;
9538 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9540 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9542 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9543 HDA_AMP_MUTE, bits);
9546 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9548 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9550 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9551 HDA_AMP_MUTE, bits);
9552 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9553 HDA_AMP_MUTE, bits);
9556 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9559 if ((res >> 26) == ALC880_HP_EVENT)
9560 alc883_lenovo_101e_all_automute(codec);
9561 if ((res >> 26) == ALC880_FRONT_EVENT)
9562 alc883_lenovo_101e_ispeaker_automute(codec);
9565 /* toggle speaker-output according to the hp-jack state */
9566 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9568 struct alc_spec *spec = codec->spec;
9570 spec->autocfg.hp_pins[0] = 0x14;
9571 spec->autocfg.speaker_pins[0] = 0x15;
9572 spec->autocfg.speaker_pins[1] = 0x16;
9575 static struct hda_verb alc883_acer_eapd_verbs[] = {
9576 /* HP Pin: output 0 (0x0c) */
9577 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9578 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9579 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9580 /* Front Pin: output 0 (0x0c) */
9581 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9582 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9583 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9584 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9585 /* eanable EAPD on medion laptop */
9586 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9587 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9588 /* enable unsolicited event */
9589 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9593 static void alc888_6st_dell_setup(struct hda_codec *codec)
9595 struct alc_spec *spec = codec->spec;
9597 spec->autocfg.hp_pins[0] = 0x1b;
9598 spec->autocfg.speaker_pins[0] = 0x14;
9599 spec->autocfg.speaker_pins[1] = 0x15;
9600 spec->autocfg.speaker_pins[2] = 0x16;
9601 spec->autocfg.speaker_pins[3] = 0x17;
9604 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9606 struct alc_spec *spec = codec->spec;
9608 spec->autocfg.hp_pins[0] = 0x1b;
9609 spec->autocfg.speaker_pins[0] = 0x14;
9610 spec->autocfg.speaker_pins[1] = 0x15;
9611 spec->autocfg.speaker_pins[2] = 0x16;
9612 spec->autocfg.speaker_pins[3] = 0x17;
9613 spec->autocfg.speaker_pins[4] = 0x1a;
9616 static void alc883_vaiott_setup(struct hda_codec *codec)
9618 struct alc_spec *spec = codec->spec;
9620 spec->autocfg.hp_pins[0] = 0x15;
9621 spec->autocfg.speaker_pins[0] = 0x14;
9622 spec->autocfg.speaker_pins[1] = 0x17;
9625 static struct hda_verb alc888_asus_m90v_verbs[] = {
9626 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9627 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9628 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9629 /* enable unsolicited event */
9630 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9631 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9635 static void alc883_mode2_setup(struct hda_codec *codec)
9637 struct alc_spec *spec = codec->spec;
9639 spec->autocfg.hp_pins[0] = 0x1b;
9640 spec->autocfg.speaker_pins[0] = 0x14;
9641 spec->autocfg.speaker_pins[1] = 0x15;
9642 spec->autocfg.speaker_pins[2] = 0x16;
9643 spec->ext_mic.pin = 0x18;
9644 spec->int_mic.pin = 0x19;
9645 spec->ext_mic.mux_idx = 0;
9646 spec->int_mic.mux_idx = 1;
9650 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9651 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9652 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9656 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9657 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9658 /* enable unsolicited event */
9659 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9663 static void alc883_eee1601_inithook(struct hda_codec *codec)
9665 struct alc_spec *spec = codec->spec;
9667 spec->autocfg.hp_pins[0] = 0x14;
9668 spec->autocfg.speaker_pins[0] = 0x1b;
9669 alc_automute_pin(codec);
9672 static struct hda_verb alc889A_mb31_verbs[] = {
9673 /* Init rear pin (used as headphone output) */
9674 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9675 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9676 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9677 /* Init line pin (used as output in 4ch and 6ch mode) */
9678 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9679 /* Init line 2 pin (used as headphone out by default) */
9680 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9681 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9685 /* Mute speakers according to the headphone jack state */
9686 static void alc889A_mb31_automute(struct hda_codec *codec)
9688 unsigned int present;
9690 /* Mute only in 2ch or 4ch mode */
9691 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9693 present = snd_hda_jack_detect(codec, 0x15);
9694 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9695 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9696 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9697 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9701 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9703 if ((res >> 26) == ALC880_HP_EVENT)
9704 alc889A_mb31_automute(codec);
9708 #ifdef CONFIG_SND_HDA_POWER_SAVE
9709 #define alc882_loopbacks alc880_loopbacks
9712 /* pcm configuration: identical with ALC880 */
9713 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9714 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9715 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9716 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9718 static hda_nid_t alc883_slave_dig_outs[] = {
9719 ALC1200_DIGOUT_NID, 0,
9722 static hda_nid_t alc1200_slave_dig_outs[] = {
9723 ALC883_DIGOUT_NID, 0,
9727 * configuration and preset
9729 static const char *alc882_models[ALC882_MODEL_LAST] = {
9730 [ALC882_3ST_DIG] = "3stack-dig",
9731 [ALC882_6ST_DIG] = "6stack-dig",
9732 [ALC882_ARIMA] = "arima",
9733 [ALC882_W2JC] = "w2jc",
9734 [ALC882_TARGA] = "targa",
9735 [ALC882_ASUS_A7J] = "asus-a7j",
9736 [ALC882_ASUS_A7M] = "asus-a7m",
9737 [ALC885_MACPRO] = "macpro",
9738 [ALC885_MB5] = "mb5",
9739 [ALC885_MACMINI3] = "macmini3",
9740 [ALC885_MBA21] = "mba21",
9741 [ALC885_MBP3] = "mbp3",
9742 [ALC885_IMAC24] = "imac24",
9743 [ALC885_IMAC91] = "imac91",
9744 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9745 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9746 [ALC883_3ST_6ch] = "3stack-6ch",
9747 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9748 [ALC883_TARGA_DIG] = "targa-dig",
9749 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9750 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9751 [ALC883_ACER] = "acer",
9752 [ALC883_ACER_ASPIRE] = "acer-aspire",
9753 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9754 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9755 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9756 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9757 [ALC883_MEDION] = "medion",
9758 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9759 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9760 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9761 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9762 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9763 [ALC888_LENOVO_SKY] = "lenovo-sky",
9764 [ALC883_HAIER_W66] = "haier-w66",
9765 [ALC888_3ST_HP] = "3stack-hp",
9766 [ALC888_6ST_DELL] = "6stack-dell",
9767 [ALC883_MITAC] = "mitac",
9768 [ALC883_CLEVO_M540R] = "clevo-m540r",
9769 [ALC883_CLEVO_M720] = "clevo-m720",
9770 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9771 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9772 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9773 [ALC889A_INTEL] = "intel-alc889a",
9774 [ALC889_INTEL] = "intel-x58",
9775 [ALC1200_ASUS_P5Q] = "asus-p5q",
9776 [ALC889A_MB31] = "mb31",
9777 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9778 [ALC882_AUTO] = "auto",
9781 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9782 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9784 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9785 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9786 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9787 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9788 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9789 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9790 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9791 ALC888_ACER_ASPIRE_4930G),
9792 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9793 ALC888_ACER_ASPIRE_4930G),
9794 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9795 ALC888_ACER_ASPIRE_8930G),
9796 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9797 ALC888_ACER_ASPIRE_8930G),
9798 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9799 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9800 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9801 ALC888_ACER_ASPIRE_6530G),
9802 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9803 ALC888_ACER_ASPIRE_6530G),
9804 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9805 ALC888_ACER_ASPIRE_7730G),
9806 /* default Acer -- disabled as it causes more problems.
9807 * model=auto should work fine now
9809 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9811 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9813 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9814 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9815 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9816 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9817 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9818 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9820 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9821 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9822 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9823 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9824 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9825 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9826 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9827 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9828 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9829 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9830 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9832 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9833 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9834 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9835 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9836 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9837 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9838 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9839 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9840 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9842 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9843 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9844 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9845 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9846 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9847 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9848 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9849 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9850 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9851 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9852 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9853 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9854 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9855 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9856 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9857 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9858 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9859 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9860 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9861 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9862 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9863 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9864 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9865 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9866 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9867 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9868 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9869 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9870 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9871 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9872 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9874 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9875 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9876 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9877 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9878 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9879 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9880 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9881 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9882 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9883 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9884 ALC883_FUJITSU_PI2515),
9885 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9886 ALC888_FUJITSU_XA3530),
9887 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9888 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9889 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9890 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9891 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9892 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9893 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9894 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9896 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9897 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9898 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9899 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9900 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9901 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9902 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9907 /* codec SSID table for Intel Mac */
9908 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9909 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9910 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9911 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9912 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9913 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9914 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9915 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9916 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9917 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9918 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9919 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9920 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9921 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9922 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9923 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9924 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9925 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9926 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9927 * so apparently no perfect solution yet
9929 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9930 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9931 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9935 static struct alc_config_preset alc882_presets[] = {
9936 [ALC882_3ST_DIG] = {
9937 .mixers = { alc882_base_mixer },
9938 .init_verbs = { alc882_base_init_verbs,
9939 alc882_adc1_init_verbs },
9940 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9941 .dac_nids = alc882_dac_nids,
9942 .dig_out_nid = ALC882_DIGOUT_NID,
9943 .dig_in_nid = ALC882_DIGIN_NID,
9944 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9945 .channel_mode = alc882_ch_modes,
9947 .input_mux = &alc882_capture_source,
9949 [ALC882_6ST_DIG] = {
9950 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9951 .init_verbs = { alc882_base_init_verbs,
9952 alc882_adc1_init_verbs },
9953 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9954 .dac_nids = alc882_dac_nids,
9955 .dig_out_nid = ALC882_DIGOUT_NID,
9956 .dig_in_nid = ALC882_DIGIN_NID,
9957 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9958 .channel_mode = alc882_sixstack_modes,
9959 .input_mux = &alc882_capture_source,
9962 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9963 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9964 alc882_eapd_verbs },
9965 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9966 .dac_nids = alc882_dac_nids,
9967 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9968 .channel_mode = alc882_sixstack_modes,
9969 .input_mux = &alc882_capture_source,
9972 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9973 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9974 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9975 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9976 .dac_nids = alc882_dac_nids,
9977 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9978 .channel_mode = alc880_threestack_modes,
9980 .input_mux = &alc882_capture_source,
9981 .dig_out_nid = ALC882_DIGOUT_NID,
9984 .mixers = { alc885_mba21_mixer },
9985 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9987 .dac_nids = alc882_dac_nids,
9988 .channel_mode = alc885_mba21_ch_modes,
9989 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9990 .input_mux = &alc882_capture_source,
9991 .unsol_event = alc_automute_amp_unsol_event,
9992 .setup = alc885_mba21_setup,
9993 .init_hook = alc_automute_amp,
9996 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9997 .init_verbs = { alc885_mbp3_init_verbs,
9998 alc880_gpio1_init_verbs },
10000 .dac_nids = alc882_dac_nids,
10002 .channel_mode = alc885_mbp_4ch_modes,
10003 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10004 .input_mux = &alc882_capture_source,
10005 .dig_out_nid = ALC882_DIGOUT_NID,
10006 .dig_in_nid = ALC882_DIGIN_NID,
10007 .unsol_event = alc_automute_amp_unsol_event,
10008 .setup = alc885_mbp3_setup,
10009 .init_hook = alc_automute_amp,
10012 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10013 .init_verbs = { alc885_mb5_init_verbs,
10014 alc880_gpio1_init_verbs },
10015 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10016 .dac_nids = alc882_dac_nids,
10017 .channel_mode = alc885_mb5_6ch_modes,
10018 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10019 .input_mux = &mb5_capture_source,
10020 .dig_out_nid = ALC882_DIGOUT_NID,
10021 .dig_in_nid = ALC882_DIGIN_NID,
10022 .unsol_event = alc_automute_amp_unsol_event,
10023 .setup = alc885_mb5_setup,
10024 .init_hook = alc_automute_amp,
10026 [ALC885_MACMINI3] = {
10027 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10028 .init_verbs = { alc885_macmini3_init_verbs,
10029 alc880_gpio1_init_verbs },
10030 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10031 .dac_nids = alc882_dac_nids,
10032 .channel_mode = alc885_macmini3_6ch_modes,
10033 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10034 .input_mux = &macmini3_capture_source,
10035 .dig_out_nid = ALC882_DIGOUT_NID,
10036 .dig_in_nid = ALC882_DIGIN_NID,
10037 .unsol_event = alc_automute_amp_unsol_event,
10038 .setup = alc885_macmini3_setup,
10039 .init_hook = alc_automute_amp,
10041 [ALC885_MACPRO] = {
10042 .mixers = { alc882_macpro_mixer },
10043 .init_verbs = { alc882_macpro_init_verbs },
10044 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10045 .dac_nids = alc882_dac_nids,
10046 .dig_out_nid = ALC882_DIGOUT_NID,
10047 .dig_in_nid = ALC882_DIGIN_NID,
10048 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10049 .channel_mode = alc882_ch_modes,
10050 .input_mux = &alc882_capture_source,
10051 .init_hook = alc885_macpro_init_hook,
10053 [ALC885_IMAC24] = {
10054 .mixers = { alc885_imac24_mixer },
10055 .init_verbs = { alc885_imac24_init_verbs },
10056 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10057 .dac_nids = alc882_dac_nids,
10058 .dig_out_nid = ALC882_DIGOUT_NID,
10059 .dig_in_nid = ALC882_DIGIN_NID,
10060 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10061 .channel_mode = alc882_ch_modes,
10062 .input_mux = &alc882_capture_source,
10063 .unsol_event = alc_automute_amp_unsol_event,
10064 .setup = alc885_imac24_setup,
10065 .init_hook = alc885_imac24_init_hook,
10067 [ALC885_IMAC91] = {
10068 .mixers = {alc885_imac91_mixer},
10069 .init_verbs = { alc885_imac91_init_verbs,
10070 alc880_gpio1_init_verbs },
10071 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10072 .dac_nids = alc882_dac_nids,
10073 .channel_mode = alc885_mba21_ch_modes,
10074 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10075 .input_mux = &alc889A_imac91_capture_source,
10076 .dig_out_nid = ALC882_DIGOUT_NID,
10077 .dig_in_nid = ALC882_DIGIN_NID,
10078 .unsol_event = alc_automute_amp_unsol_event,
10079 .setup = alc885_imac91_setup,
10080 .init_hook = alc_automute_amp,
10083 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10084 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10085 alc880_gpio3_init_verbs, alc882_targa_verbs},
10086 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10087 .dac_nids = alc882_dac_nids,
10088 .dig_out_nid = ALC882_DIGOUT_NID,
10089 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10090 .adc_nids = alc882_adc_nids,
10091 .capsrc_nids = alc882_capsrc_nids,
10092 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10093 .channel_mode = alc882_3ST_6ch_modes,
10095 .input_mux = &alc882_capture_source,
10096 .unsol_event = alc882_targa_unsol_event,
10097 .setup = alc882_targa_setup,
10098 .init_hook = alc882_targa_automute,
10100 [ALC882_ASUS_A7J] = {
10101 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10102 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10103 alc882_asus_a7j_verbs},
10104 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10105 .dac_nids = alc882_dac_nids,
10106 .dig_out_nid = ALC882_DIGOUT_NID,
10107 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10108 .adc_nids = alc882_adc_nids,
10109 .capsrc_nids = alc882_capsrc_nids,
10110 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10111 .channel_mode = alc882_3ST_6ch_modes,
10113 .input_mux = &alc882_capture_source,
10115 [ALC882_ASUS_A7M] = {
10116 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10117 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10118 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10119 alc882_asus_a7m_verbs },
10120 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10121 .dac_nids = alc882_dac_nids,
10122 .dig_out_nid = ALC882_DIGOUT_NID,
10123 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10124 .channel_mode = alc880_threestack_modes,
10126 .input_mux = &alc882_capture_source,
10128 [ALC883_3ST_2ch_DIG] = {
10129 .mixers = { alc883_3ST_2ch_mixer },
10130 .init_verbs = { alc883_init_verbs },
10131 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10132 .dac_nids = alc883_dac_nids,
10133 .dig_out_nid = ALC883_DIGOUT_NID,
10134 .dig_in_nid = ALC883_DIGIN_NID,
10135 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10136 .channel_mode = alc883_3ST_2ch_modes,
10137 .input_mux = &alc883_capture_source,
10139 [ALC883_3ST_6ch_DIG] = {
10140 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10141 .init_verbs = { alc883_init_verbs },
10142 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10143 .dac_nids = alc883_dac_nids,
10144 .dig_out_nid = ALC883_DIGOUT_NID,
10145 .dig_in_nid = ALC883_DIGIN_NID,
10146 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10147 .channel_mode = alc883_3ST_6ch_modes,
10149 .input_mux = &alc883_capture_source,
10151 [ALC883_3ST_6ch] = {
10152 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10153 .init_verbs = { alc883_init_verbs },
10154 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10155 .dac_nids = alc883_dac_nids,
10156 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10157 .channel_mode = alc883_3ST_6ch_modes,
10159 .input_mux = &alc883_capture_source,
10161 [ALC883_3ST_6ch_INTEL] = {
10162 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10163 .init_verbs = { alc883_init_verbs },
10164 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10165 .dac_nids = alc883_dac_nids,
10166 .dig_out_nid = ALC883_DIGOUT_NID,
10167 .dig_in_nid = ALC883_DIGIN_NID,
10168 .slave_dig_outs = alc883_slave_dig_outs,
10169 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10170 .channel_mode = alc883_3ST_6ch_intel_modes,
10172 .input_mux = &alc883_3stack_6ch_intel,
10174 [ALC889A_INTEL] = {
10175 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10176 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10177 alc_hp15_unsol_verbs },
10178 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10179 .dac_nids = alc883_dac_nids,
10180 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10181 .adc_nids = alc889_adc_nids,
10182 .dig_out_nid = ALC883_DIGOUT_NID,
10183 .dig_in_nid = ALC883_DIGIN_NID,
10184 .slave_dig_outs = alc883_slave_dig_outs,
10185 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10186 .channel_mode = alc889_8ch_intel_modes,
10187 .capsrc_nids = alc889_capsrc_nids,
10188 .input_mux = &alc889_capture_source,
10189 .setup = alc889_automute_setup,
10190 .init_hook = alc_automute_amp,
10191 .unsol_event = alc_automute_amp_unsol_event,
10195 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10196 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10197 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10198 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10199 .dac_nids = alc883_dac_nids,
10200 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10201 .adc_nids = alc889_adc_nids,
10202 .dig_out_nid = ALC883_DIGOUT_NID,
10203 .dig_in_nid = ALC883_DIGIN_NID,
10204 .slave_dig_outs = alc883_slave_dig_outs,
10205 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10206 .channel_mode = alc889_8ch_intel_modes,
10207 .capsrc_nids = alc889_capsrc_nids,
10208 .input_mux = &alc889_capture_source,
10209 .setup = alc889_automute_setup,
10210 .init_hook = alc889_intel_init_hook,
10211 .unsol_event = alc_automute_amp_unsol_event,
10214 [ALC883_6ST_DIG] = {
10215 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10216 .init_verbs = { alc883_init_verbs },
10217 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10218 .dac_nids = alc883_dac_nids,
10219 .dig_out_nid = ALC883_DIGOUT_NID,
10220 .dig_in_nid = ALC883_DIGIN_NID,
10221 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10222 .channel_mode = alc883_sixstack_modes,
10223 .input_mux = &alc883_capture_source,
10225 [ALC883_TARGA_DIG] = {
10226 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10227 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10228 alc883_targa_verbs},
10229 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10230 .dac_nids = alc883_dac_nids,
10231 .dig_out_nid = ALC883_DIGOUT_NID,
10232 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10233 .channel_mode = alc883_3ST_6ch_modes,
10235 .input_mux = &alc883_capture_source,
10236 .unsol_event = alc883_targa_unsol_event,
10237 .setup = alc882_targa_setup,
10238 .init_hook = alc882_targa_automute,
10240 [ALC883_TARGA_2ch_DIG] = {
10241 .mixers = { alc883_targa_2ch_mixer},
10242 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10243 alc883_targa_verbs},
10244 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10245 .dac_nids = alc883_dac_nids,
10246 .adc_nids = alc883_adc_nids_alt,
10247 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10248 .capsrc_nids = alc883_capsrc_nids,
10249 .dig_out_nid = ALC883_DIGOUT_NID,
10250 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10251 .channel_mode = alc883_3ST_2ch_modes,
10252 .input_mux = &alc883_capture_source,
10253 .unsol_event = alc883_targa_unsol_event,
10254 .setup = alc882_targa_setup,
10255 .init_hook = alc882_targa_automute,
10257 [ALC883_TARGA_8ch_DIG] = {
10258 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10259 alc883_chmode_mixer },
10260 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10261 alc883_targa_verbs },
10262 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10263 .dac_nids = alc883_dac_nids,
10264 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10265 .adc_nids = alc883_adc_nids_rev,
10266 .capsrc_nids = alc883_capsrc_nids_rev,
10267 .dig_out_nid = ALC883_DIGOUT_NID,
10268 .dig_in_nid = ALC883_DIGIN_NID,
10269 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10270 .channel_mode = alc883_4ST_8ch_modes,
10272 .input_mux = &alc883_capture_source,
10273 .unsol_event = alc883_targa_unsol_event,
10274 .setup = alc882_targa_setup,
10275 .init_hook = alc882_targa_automute,
10278 .mixers = { alc883_base_mixer },
10279 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10280 * and the headphone jack. Turn this on and rely on the
10281 * standard mute methods whenever the user wants to turn
10282 * these outputs off.
10284 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10285 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10286 .dac_nids = alc883_dac_nids,
10287 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10288 .channel_mode = alc883_3ST_2ch_modes,
10289 .input_mux = &alc883_capture_source,
10291 [ALC883_ACER_ASPIRE] = {
10292 .mixers = { alc883_acer_aspire_mixer },
10293 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10294 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10295 .dac_nids = alc883_dac_nids,
10296 .dig_out_nid = ALC883_DIGOUT_NID,
10297 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10298 .channel_mode = alc883_3ST_2ch_modes,
10299 .input_mux = &alc883_capture_source,
10300 .unsol_event = alc_automute_amp_unsol_event,
10301 .setup = alc883_acer_aspire_setup,
10302 .init_hook = alc_automute_amp,
10304 [ALC888_ACER_ASPIRE_4930G] = {
10305 .mixers = { alc888_base_mixer,
10306 alc883_chmode_mixer },
10307 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10308 alc888_acer_aspire_4930g_verbs },
10309 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10310 .dac_nids = alc883_dac_nids,
10311 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10312 .adc_nids = alc883_adc_nids_rev,
10313 .capsrc_nids = alc883_capsrc_nids_rev,
10314 .dig_out_nid = ALC883_DIGOUT_NID,
10315 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10316 .channel_mode = alc883_3ST_6ch_modes,
10318 .const_channel_count = 6,
10320 ARRAY_SIZE(alc888_2_capture_sources),
10321 .input_mux = alc888_2_capture_sources,
10322 .unsol_event = alc_automute_amp_unsol_event,
10323 .setup = alc888_acer_aspire_4930g_setup,
10324 .init_hook = alc_automute_amp,
10326 [ALC888_ACER_ASPIRE_6530G] = {
10327 .mixers = { alc888_acer_aspire_6530_mixer },
10328 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10329 alc888_acer_aspire_6530g_verbs },
10330 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10331 .dac_nids = alc883_dac_nids,
10332 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10333 .adc_nids = alc883_adc_nids_rev,
10334 .capsrc_nids = alc883_capsrc_nids_rev,
10335 .dig_out_nid = ALC883_DIGOUT_NID,
10336 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10337 .channel_mode = alc883_3ST_2ch_modes,
10339 ARRAY_SIZE(alc888_2_capture_sources),
10340 .input_mux = alc888_acer_aspire_6530_sources,
10341 .unsol_event = alc_automute_amp_unsol_event,
10342 .setup = alc888_acer_aspire_6530g_setup,
10343 .init_hook = alc_automute_amp,
10345 [ALC888_ACER_ASPIRE_8930G] = {
10346 .mixers = { alc889_acer_aspire_8930g_mixer,
10347 alc883_chmode_mixer },
10348 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10349 alc889_acer_aspire_8930g_verbs,
10350 alc889_eapd_verbs},
10351 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10352 .dac_nids = alc883_dac_nids,
10353 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10354 .adc_nids = alc889_adc_nids,
10355 .capsrc_nids = alc889_capsrc_nids,
10356 .dig_out_nid = ALC883_DIGOUT_NID,
10357 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10358 .channel_mode = alc883_3ST_6ch_modes,
10360 .const_channel_count = 6,
10362 ARRAY_SIZE(alc889_capture_sources),
10363 .input_mux = alc889_capture_sources,
10364 .unsol_event = alc_automute_amp_unsol_event,
10365 .setup = alc889_acer_aspire_8930g_setup,
10366 .init_hook = alc_automute_amp,
10367 #ifdef CONFIG_SND_HDA_POWER_SAVE
10368 .power_hook = alc_power_eapd,
10371 [ALC888_ACER_ASPIRE_7730G] = {
10372 .mixers = { alc883_3ST_6ch_mixer,
10373 alc883_chmode_mixer },
10374 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10375 alc888_acer_aspire_7730G_verbs },
10376 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10377 .dac_nids = alc883_dac_nids,
10378 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10379 .adc_nids = alc883_adc_nids_rev,
10380 .capsrc_nids = alc883_capsrc_nids_rev,
10381 .dig_out_nid = ALC883_DIGOUT_NID,
10382 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10383 .channel_mode = alc883_3ST_6ch_modes,
10385 .const_channel_count = 6,
10386 .input_mux = &alc883_capture_source,
10387 .unsol_event = alc_automute_amp_unsol_event,
10388 .setup = alc888_acer_aspire_7730g_setup,
10389 .init_hook = alc_automute_amp,
10391 [ALC883_MEDION] = {
10392 .mixers = { alc883_fivestack_mixer,
10393 alc883_chmode_mixer },
10394 .init_verbs = { alc883_init_verbs,
10395 alc883_medion_eapd_verbs },
10396 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10397 .dac_nids = alc883_dac_nids,
10398 .adc_nids = alc883_adc_nids_alt,
10399 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10400 .capsrc_nids = alc883_capsrc_nids,
10401 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10402 .channel_mode = alc883_sixstack_modes,
10403 .input_mux = &alc883_capture_source,
10405 [ALC883_MEDION_WIM2160] = {
10406 .mixers = { alc883_medion_wim2160_mixer },
10407 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10408 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10409 .dac_nids = alc883_dac_nids,
10410 .dig_out_nid = ALC883_DIGOUT_NID,
10411 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10412 .adc_nids = alc883_adc_nids,
10413 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10414 .channel_mode = alc883_3ST_2ch_modes,
10415 .input_mux = &alc883_capture_source,
10416 .unsol_event = alc_automute_amp_unsol_event,
10417 .setup = alc883_medion_wim2160_setup,
10418 .init_hook = alc_automute_amp,
10420 [ALC883_LAPTOP_EAPD] = {
10421 .mixers = { alc883_base_mixer },
10422 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10423 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10424 .dac_nids = alc883_dac_nids,
10425 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10426 .channel_mode = alc883_3ST_2ch_modes,
10427 .input_mux = &alc883_capture_source,
10429 [ALC883_CLEVO_M540R] = {
10430 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10431 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10432 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10433 .dac_nids = alc883_dac_nids,
10434 .dig_out_nid = ALC883_DIGOUT_NID,
10435 .dig_in_nid = ALC883_DIGIN_NID,
10436 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10437 .channel_mode = alc883_3ST_6ch_clevo_modes,
10439 .input_mux = &alc883_capture_source,
10440 /* This machine has the hardware HP auto-muting, thus
10441 * we need no software mute via unsol event
10444 [ALC883_CLEVO_M720] = {
10445 .mixers = { alc883_clevo_m720_mixer },
10446 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10447 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10448 .dac_nids = alc883_dac_nids,
10449 .dig_out_nid = ALC883_DIGOUT_NID,
10450 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10451 .channel_mode = alc883_3ST_2ch_modes,
10452 .input_mux = &alc883_capture_source,
10453 .unsol_event = alc883_clevo_m720_unsol_event,
10454 .setup = alc883_clevo_m720_setup,
10455 .init_hook = alc883_clevo_m720_init_hook,
10457 [ALC883_LENOVO_101E_2ch] = {
10458 .mixers = { alc883_lenovo_101e_2ch_mixer},
10459 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10460 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10461 .dac_nids = alc883_dac_nids,
10462 .adc_nids = alc883_adc_nids_alt,
10463 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10464 .capsrc_nids = alc883_capsrc_nids,
10465 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10466 .channel_mode = alc883_3ST_2ch_modes,
10467 .input_mux = &alc883_lenovo_101e_capture_source,
10468 .unsol_event = alc883_lenovo_101e_unsol_event,
10469 .init_hook = alc883_lenovo_101e_all_automute,
10471 [ALC883_LENOVO_NB0763] = {
10472 .mixers = { alc883_lenovo_nb0763_mixer },
10473 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10474 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10475 .dac_nids = alc883_dac_nids,
10476 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10477 .channel_mode = alc883_3ST_2ch_modes,
10479 .input_mux = &alc883_lenovo_nb0763_capture_source,
10480 .unsol_event = alc_automute_amp_unsol_event,
10481 .setup = alc883_lenovo_nb0763_setup,
10482 .init_hook = alc_automute_amp,
10484 [ALC888_LENOVO_MS7195_DIG] = {
10485 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10486 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10487 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10488 .dac_nids = alc883_dac_nids,
10489 .dig_out_nid = ALC883_DIGOUT_NID,
10490 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10491 .channel_mode = alc883_3ST_6ch_modes,
10493 .input_mux = &alc883_capture_source,
10494 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10495 .init_hook = alc888_lenovo_ms7195_front_automute,
10497 [ALC883_HAIER_W66] = {
10498 .mixers = { alc883_targa_2ch_mixer},
10499 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10500 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10501 .dac_nids = alc883_dac_nids,
10502 .dig_out_nid = ALC883_DIGOUT_NID,
10503 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10504 .channel_mode = alc883_3ST_2ch_modes,
10505 .input_mux = &alc883_capture_source,
10506 .unsol_event = alc_automute_amp_unsol_event,
10507 .setup = alc883_haier_w66_setup,
10508 .init_hook = alc_automute_amp,
10510 [ALC888_3ST_HP] = {
10511 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10512 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10513 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10514 .dac_nids = alc883_dac_nids,
10515 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10516 .channel_mode = alc888_3st_hp_modes,
10518 .input_mux = &alc883_capture_source,
10519 .unsol_event = alc_automute_amp_unsol_event,
10520 .setup = alc888_3st_hp_setup,
10521 .init_hook = alc_automute_amp,
10523 [ALC888_6ST_DELL] = {
10524 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10525 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10526 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10527 .dac_nids = alc883_dac_nids,
10528 .dig_out_nid = ALC883_DIGOUT_NID,
10529 .dig_in_nid = ALC883_DIGIN_NID,
10530 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10531 .channel_mode = alc883_sixstack_modes,
10532 .input_mux = &alc883_capture_source,
10533 .unsol_event = alc_automute_amp_unsol_event,
10534 .setup = alc888_6st_dell_setup,
10535 .init_hook = alc_automute_amp,
10538 .mixers = { alc883_mitac_mixer },
10539 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10540 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10541 .dac_nids = alc883_dac_nids,
10542 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10543 .channel_mode = alc883_3ST_2ch_modes,
10544 .input_mux = &alc883_capture_source,
10545 .unsol_event = alc_automute_amp_unsol_event,
10546 .setup = alc883_mitac_setup,
10547 .init_hook = alc_automute_amp,
10549 [ALC883_FUJITSU_PI2515] = {
10550 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10551 .init_verbs = { alc883_init_verbs,
10552 alc883_2ch_fujitsu_pi2515_verbs},
10553 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10554 .dac_nids = alc883_dac_nids,
10555 .dig_out_nid = ALC883_DIGOUT_NID,
10556 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10557 .channel_mode = alc883_3ST_2ch_modes,
10558 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10559 .unsol_event = alc_automute_amp_unsol_event,
10560 .setup = alc883_2ch_fujitsu_pi2515_setup,
10561 .init_hook = alc_automute_amp,
10563 [ALC888_FUJITSU_XA3530] = {
10564 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10565 .init_verbs = { alc883_init_verbs,
10566 alc888_fujitsu_xa3530_verbs },
10567 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10568 .dac_nids = alc883_dac_nids,
10569 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10570 .adc_nids = alc883_adc_nids_rev,
10571 .capsrc_nids = alc883_capsrc_nids_rev,
10572 .dig_out_nid = ALC883_DIGOUT_NID,
10573 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10574 .channel_mode = alc888_4ST_8ch_intel_modes,
10576 ARRAY_SIZE(alc888_2_capture_sources),
10577 .input_mux = alc888_2_capture_sources,
10578 .unsol_event = alc_automute_amp_unsol_event,
10579 .setup = alc888_fujitsu_xa3530_setup,
10580 .init_hook = alc_automute_amp,
10582 [ALC888_LENOVO_SKY] = {
10583 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10584 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10585 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10586 .dac_nids = alc883_dac_nids,
10587 .dig_out_nid = ALC883_DIGOUT_NID,
10588 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10589 .channel_mode = alc883_sixstack_modes,
10591 .input_mux = &alc883_lenovo_sky_capture_source,
10592 .unsol_event = alc_automute_amp_unsol_event,
10593 .setup = alc888_lenovo_sky_setup,
10594 .init_hook = alc_automute_amp,
10596 [ALC888_ASUS_M90V] = {
10597 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10598 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10599 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10600 .dac_nids = alc883_dac_nids,
10601 .dig_out_nid = ALC883_DIGOUT_NID,
10602 .dig_in_nid = ALC883_DIGIN_NID,
10603 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10604 .channel_mode = alc883_3ST_6ch_modes,
10606 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10607 .unsol_event = alc_sku_unsol_event,
10608 .setup = alc883_mode2_setup,
10609 .init_hook = alc_inithook,
10611 [ALC888_ASUS_EEE1601] = {
10612 .mixers = { alc883_asus_eee1601_mixer },
10613 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10614 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10615 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10616 .dac_nids = alc883_dac_nids,
10617 .dig_out_nid = ALC883_DIGOUT_NID,
10618 .dig_in_nid = ALC883_DIGIN_NID,
10619 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10620 .channel_mode = alc883_3ST_2ch_modes,
10622 .input_mux = &alc883_asus_eee1601_capture_source,
10623 .unsol_event = alc_sku_unsol_event,
10624 .init_hook = alc883_eee1601_inithook,
10626 [ALC1200_ASUS_P5Q] = {
10627 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10628 .init_verbs = { alc883_init_verbs },
10629 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10630 .dac_nids = alc883_dac_nids,
10631 .dig_out_nid = ALC1200_DIGOUT_NID,
10632 .dig_in_nid = ALC883_DIGIN_NID,
10633 .slave_dig_outs = alc1200_slave_dig_outs,
10634 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10635 .channel_mode = alc883_sixstack_modes,
10636 .input_mux = &alc883_capture_source,
10639 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10640 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10641 alc880_gpio1_init_verbs },
10642 .adc_nids = alc883_adc_nids,
10643 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10644 .capsrc_nids = alc883_capsrc_nids,
10645 .dac_nids = alc883_dac_nids,
10646 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10647 .channel_mode = alc889A_mb31_6ch_modes,
10648 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10649 .input_mux = &alc889A_mb31_capture_source,
10650 .dig_out_nid = ALC883_DIGOUT_NID,
10651 .unsol_event = alc889A_mb31_unsol_event,
10652 .init_hook = alc889A_mb31_automute,
10654 [ALC883_SONY_VAIO_TT] = {
10655 .mixers = { alc883_vaiott_mixer },
10656 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10657 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10658 .dac_nids = alc883_dac_nids,
10659 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10660 .channel_mode = alc883_3ST_2ch_modes,
10661 .input_mux = &alc883_capture_source,
10662 .unsol_event = alc_automute_amp_unsol_event,
10663 .setup = alc883_vaiott_setup,
10664 .init_hook = alc_automute_amp,
10673 PINFIX_ABIT_AW9D_MAX,
10675 PINFIX_ACER_ASPIRE_7736,
10678 static const struct alc_fixup alc882_fixups[] = {
10679 [PINFIX_ABIT_AW9D_MAX] = {
10680 .pins = (const struct alc_pincfg[]) {
10681 { 0x15, 0x01080104 }, /* side */
10682 { 0x16, 0x01011012 }, /* rear */
10683 { 0x17, 0x01016011 }, /* clfe */
10687 [PINFIX_PB_M5210] = {
10688 .verbs = (const struct hda_verb[]) {
10689 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10693 [PINFIX_ACER_ASPIRE_7736] = {
10694 .sku = ALC_FIXUP_SKU_IGNORE,
10698 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10699 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10700 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10701 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10706 * BIOS auto configuration
10708 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10709 const struct auto_pin_cfg *cfg)
10711 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10714 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10715 hda_nid_t nid, int pin_type,
10720 /* set as output */
10721 alc_set_pin_output(codec, nid, pin_type);
10725 else if (dac >= 0x02 && dac <= 0x05)
10729 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10732 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10734 struct alc_spec *spec = codec->spec;
10737 for (i = 0; i <= HDA_SIDE; i++) {
10738 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10739 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10741 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10742 spec->multiout.dac_nids[i]);
10746 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10748 struct alc_spec *spec = codec->spec;
10749 hda_nid_t pin, dac;
10752 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10753 pin = spec->autocfg.hp_pins[i];
10756 dac = spec->multiout.hp_nid;
10758 dac = spec->multiout.dac_nids[0]; /* to front */
10759 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10761 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10762 pin = spec->autocfg.speaker_pins[i];
10765 dac = spec->multiout.extra_out_nid[0];
10767 dac = spec->multiout.dac_nids[0]; /* to front */
10768 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10772 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10774 struct alc_spec *spec = codec->spec;
10775 struct auto_pin_cfg *cfg = &spec->autocfg;
10778 for (i = 0; i < cfg->num_inputs; i++) {
10779 hda_nid_t nid = cfg->inputs[i].pin;
10780 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10781 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10782 snd_hda_codec_write(codec, nid, 0,
10783 AC_VERB_SET_AMP_GAIN_MUTE,
10788 static void alc882_auto_init_input_src(struct hda_codec *codec)
10790 struct alc_spec *spec = codec->spec;
10793 for (c = 0; c < spec->num_adc_nids; c++) {
10794 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10795 hda_nid_t nid = spec->capsrc_nids[c];
10796 unsigned int mux_idx;
10797 const struct hda_input_mux *imux;
10798 int conns, mute, idx, item;
10800 conns = snd_hda_get_connections(codec, nid, conn_list,
10801 ARRAY_SIZE(conn_list));
10804 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10805 imux = &spec->input_mux[mux_idx];
10806 if (!imux->num_items && mux_idx > 0)
10807 imux = &spec->input_mux[0];
10808 for (idx = 0; idx < conns; idx++) {
10809 /* if the current connection is the selected one,
10810 * unmute it as default - otherwise mute it
10812 mute = AMP_IN_MUTE(idx);
10813 for (item = 0; item < imux->num_items; item++) {
10814 if (imux->items[item].index == idx) {
10815 if (spec->cur_mux[c] == item)
10816 mute = AMP_IN_UNMUTE(idx);
10820 /* check if we have a selector or mixer
10821 * we could check for the widget type instead, but
10822 * just check for Amp-In presence (in case of mixer
10823 * without amp-in there is something wrong, this
10824 * function shouldn't be used or capsrc nid is wrong)
10826 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10827 snd_hda_codec_write(codec, nid, 0,
10828 AC_VERB_SET_AMP_GAIN_MUTE,
10830 else if (mute != AMP_IN_MUTE(idx))
10831 snd_hda_codec_write(codec, nid, 0,
10832 AC_VERB_SET_CONNECT_SEL,
10838 /* add mic boosts if needed */
10839 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10841 struct alc_spec *spec = codec->spec;
10842 struct auto_pin_cfg *cfg = &spec->autocfg;
10846 const char *prev_label = NULL;
10848 for (i = 0; i < cfg->num_inputs; i++) {
10849 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10851 nid = cfg->inputs[i].pin;
10852 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10854 char boost_label[32];
10856 label = hda_get_autocfg_input_label(codec, cfg, i);
10857 if (prev_label && !strcmp(label, prev_label))
10861 prev_label = label;
10863 snprintf(boost_label, sizeof(boost_label),
10864 "%s Boost Volume", label);
10865 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10866 boost_label, type_idx,
10867 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10875 /* almost identical with ALC880 parser... */
10876 static int alc882_parse_auto_config(struct hda_codec *codec)
10878 struct alc_spec *spec = codec->spec;
10879 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10882 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10886 if (!spec->autocfg.line_outs)
10887 return 0; /* can't find valid BIOS pin config */
10889 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10892 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10895 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10899 err = alc880_auto_create_extra_out(spec,
10900 spec->autocfg.speaker_pins[0],
10904 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10908 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10910 alc_auto_parse_digital(codec);
10912 if (spec->kctls.list)
10913 add_mixer(spec, spec->kctls.list);
10915 add_verb(spec, alc883_auto_init_verbs);
10916 /* if ADC 0x07 is available, initialize it, too */
10917 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10918 add_verb(spec, alc882_adc1_init_verbs);
10920 spec->num_mux_defs = 1;
10921 spec->input_mux = &spec->private_imux[0];
10923 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10925 err = alc_auto_add_mic_boost(codec);
10929 return 1; /* config found */
10932 /* additional initialization for auto-configuration model */
10933 static void alc882_auto_init(struct hda_codec *codec)
10935 struct alc_spec *spec = codec->spec;
10936 alc882_auto_init_multi_out(codec);
10937 alc882_auto_init_hp_out(codec);
10938 alc882_auto_init_analog_input(codec);
10939 alc882_auto_init_input_src(codec);
10940 alc_auto_init_digital(codec);
10941 if (spec->unsol_event)
10942 alc_inithook(codec);
10945 static int patch_alc882(struct hda_codec *codec)
10947 struct alc_spec *spec;
10948 int err, board_config;
10950 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10954 codec->spec = spec;
10956 switch (codec->vendor_id) {
10961 /* ALC883 and variants */
10962 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10966 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10970 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10971 board_config = snd_hda_check_board_codec_sid_config(codec,
10972 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10974 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10975 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10977 board_config = ALC882_AUTO;
10980 if (board_config == ALC882_AUTO)
10981 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10983 alc_auto_parse_customize_define(codec);
10985 if (board_config == ALC882_AUTO) {
10986 /* automatic parse from the BIOS config */
10987 err = alc882_parse_auto_config(codec);
10993 "hda_codec: Cannot set up configuration "
10994 "from BIOS. Using base mode...\n");
10995 board_config = ALC882_3ST_DIG;
10999 if (has_cdefine_beep(codec)) {
11000 err = snd_hda_attach_beep_device(codec, 0x1);
11007 if (board_config != ALC882_AUTO)
11008 setup_preset(codec, &alc882_presets[board_config]);
11010 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11011 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11012 /* FIXME: setup DAC5 */
11013 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11014 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11016 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11017 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11019 if (!spec->adc_nids && spec->input_mux) {
11021 spec->num_adc_nids = 0;
11022 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11023 const struct hda_input_mux *imux = spec->input_mux;
11025 hda_nid_t items[16];
11026 hda_nid_t nid = alc882_adc_nids[i];
11027 unsigned int wcap = get_wcaps(codec, nid);
11029 wcap = get_wcaps_type(wcap);
11030 if (wcap != AC_WID_AUD_IN)
11032 spec->private_adc_nids[spec->num_adc_nids] = nid;
11033 err = snd_hda_get_connections(codec, nid, &cap, 1);
11036 err = snd_hda_get_connections(codec, cap, items,
11037 ARRAY_SIZE(items));
11040 for (j = 0; j < imux->num_items; j++)
11041 if (imux->items[j].index >= err)
11043 if (j < imux->num_items)
11045 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11046 spec->num_adc_nids++;
11048 spec->adc_nids = spec->private_adc_nids;
11049 spec->capsrc_nids = spec->private_capsrc_nids;
11052 set_capture_mixer(codec);
11054 if (has_cdefine_beep(codec))
11055 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11057 if (board_config == ALC882_AUTO)
11058 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
11060 spec->vmaster_nid = 0x0c;
11062 codec->patch_ops = alc_patch_ops;
11063 if (board_config == ALC882_AUTO)
11064 spec->init_hook = alc882_auto_init;
11066 alc_init_jacks(codec);
11067 #ifdef CONFIG_SND_HDA_POWER_SAVE
11068 if (!spec->loopback.amplist)
11069 spec->loopback.amplist = alc882_loopbacks;
11080 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11081 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11083 #define alc262_dac_nids alc260_dac_nids
11084 #define alc262_adc_nids alc882_adc_nids
11085 #define alc262_adc_nids_alt alc882_adc_nids_alt
11086 #define alc262_capsrc_nids alc882_capsrc_nids
11087 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11089 #define alc262_modes alc260_modes
11090 #define alc262_capture_source alc882_capture_source
11092 static hda_nid_t alc262_dmic_adc_nids[1] = {
11097 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11099 static struct snd_kcontrol_new alc262_base_mixer[] = {
11100 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11101 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11102 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11103 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11104 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11105 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11106 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11107 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11108 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11109 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11110 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11111 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11112 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11113 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11114 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11115 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11119 /* update HP, line and mono-out pins according to the master switch */
11120 static void alc262_hp_master_update(struct hda_codec *codec)
11122 struct alc_spec *spec = codec->spec;
11123 int val = spec->master_sw;
11125 /* HP & line-out */
11126 snd_hda_codec_write_cache(codec, 0x1b, 0,
11127 AC_VERB_SET_PIN_WIDGET_CONTROL,
11129 snd_hda_codec_write_cache(codec, 0x15, 0,
11130 AC_VERB_SET_PIN_WIDGET_CONTROL,
11132 /* mono (speaker) depending on the HP jack sense */
11133 val = val && !spec->jack_present;
11134 snd_hda_codec_write_cache(codec, 0x16, 0,
11135 AC_VERB_SET_PIN_WIDGET_CONTROL,
11136 val ? PIN_OUT : 0);
11139 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11141 struct alc_spec *spec = codec->spec;
11143 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11144 alc262_hp_master_update(codec);
11147 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11149 if ((res >> 26) != ALC880_HP_EVENT)
11151 alc262_hp_bpc_automute(codec);
11154 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11156 struct alc_spec *spec = codec->spec;
11158 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11159 alc262_hp_master_update(codec);
11162 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11165 if ((res >> 26) != ALC880_HP_EVENT)
11167 alc262_hp_wildwest_automute(codec);
11170 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11172 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11173 struct snd_ctl_elem_value *ucontrol)
11175 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11176 struct alc_spec *spec = codec->spec;
11177 int val = !!*ucontrol->value.integer.value;
11179 if (val == spec->master_sw)
11181 spec->master_sw = val;
11182 alc262_hp_master_update(codec);
11186 #define ALC262_HP_MASTER_SWITCH \
11188 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11189 .name = "Master Playback Switch", \
11190 .info = snd_ctl_boolean_mono_info, \
11191 .get = alc262_hp_master_sw_get, \
11192 .put = alc262_hp_master_sw_put, \
11195 .iface = NID_MAPPING, \
11196 .name = "Master Playback Switch", \
11197 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11201 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11202 ALC262_HP_MASTER_SWITCH,
11203 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11204 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11205 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11206 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11208 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11210 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11211 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11212 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11213 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11214 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11215 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11216 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11217 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11218 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11219 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11220 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11221 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11225 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11226 ALC262_HP_MASTER_SWITCH,
11227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11228 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11229 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11231 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11233 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11235 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11236 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11237 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11238 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11239 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11240 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11241 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11245 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11246 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11247 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11248 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11252 /* mute/unmute internal speaker according to the hp jack and mute state */
11253 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11255 struct alc_spec *spec = codec->spec;
11257 spec->autocfg.hp_pins[0] = 0x15;
11258 spec->autocfg.speaker_pins[0] = 0x14;
11261 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11262 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11263 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11264 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11265 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11266 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11267 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11268 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11272 static struct hda_verb alc262_hp_t5735_verbs[] = {
11273 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11274 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11276 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11280 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11281 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11282 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11283 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11284 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11285 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11286 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11290 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11291 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11292 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11293 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11294 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11295 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11296 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11297 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11298 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11299 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11304 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11311 /* bind hp and internal speaker mute (with plug check) as master switch */
11312 static void alc262_hippo_master_update(struct hda_codec *codec)
11314 struct alc_spec *spec = codec->spec;
11315 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11316 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11317 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11321 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11322 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11323 HDA_AMP_MUTE, mute);
11324 /* mute internal speaker per jack sense */
11325 if (spec->jack_present)
11326 mute = HDA_AMP_MUTE;
11328 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11329 HDA_AMP_MUTE, mute);
11330 if (speaker_nid && speaker_nid != line_nid)
11331 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11332 HDA_AMP_MUTE, mute);
11335 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11337 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11338 struct snd_ctl_elem_value *ucontrol)
11340 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11341 struct alc_spec *spec = codec->spec;
11342 int val = !!*ucontrol->value.integer.value;
11344 if (val == spec->master_sw)
11346 spec->master_sw = val;
11347 alc262_hippo_master_update(codec);
11351 #define ALC262_HIPPO_MASTER_SWITCH \
11353 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11354 .name = "Master Playback Switch", \
11355 .info = snd_ctl_boolean_mono_info, \
11356 .get = alc262_hippo_master_sw_get, \
11357 .put = alc262_hippo_master_sw_put, \
11360 .iface = NID_MAPPING, \
11361 .name = "Master Playback Switch", \
11362 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11363 (SUBDEV_SPEAKER(0) << 16), \
11366 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11367 ALC262_HIPPO_MASTER_SWITCH,
11368 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11369 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11370 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11371 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11372 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11373 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11374 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11375 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11376 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11377 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11378 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11379 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11383 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11384 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11385 ALC262_HIPPO_MASTER_SWITCH,
11386 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11387 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11388 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11389 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11390 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11391 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11392 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11393 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11394 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11395 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11399 /* mute/unmute internal speaker according to the hp jack and mute state */
11400 static void alc262_hippo_automute(struct hda_codec *codec)
11402 struct alc_spec *spec = codec->spec;
11403 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11405 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11406 alc262_hippo_master_update(codec);
11409 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11411 if ((res >> 26) != ALC880_HP_EVENT)
11413 alc262_hippo_automute(codec);
11416 static void alc262_hippo_setup(struct hda_codec *codec)
11418 struct alc_spec *spec = codec->spec;
11420 spec->autocfg.hp_pins[0] = 0x15;
11421 spec->autocfg.speaker_pins[0] = 0x14;
11424 static void alc262_hippo1_setup(struct hda_codec *codec)
11426 struct alc_spec *spec = codec->spec;
11428 spec->autocfg.hp_pins[0] = 0x1b;
11429 spec->autocfg.speaker_pins[0] = 0x14;
11433 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11434 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11435 ALC262_HIPPO_MASTER_SWITCH,
11436 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11437 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11438 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11439 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11443 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11444 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11445 ALC262_HIPPO_MASTER_SWITCH,
11446 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
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("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11450 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11454 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11455 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11456 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11457 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11458 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11459 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11460 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11461 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11462 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11463 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11464 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11465 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11466 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11470 static struct hda_verb alc262_tyan_verbs[] = {
11471 /* Headphone automute */
11472 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11473 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11474 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11476 /* P11 AUX_IN, white 4-pin connector */
11477 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11478 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11479 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11480 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11485 /* unsolicited event for HP jack sensing */
11486 static void alc262_tyan_setup(struct hda_codec *codec)
11488 struct alc_spec *spec = codec->spec;
11490 spec->autocfg.hp_pins[0] = 0x1b;
11491 spec->autocfg.speaker_pins[0] = 0x15;
11495 #define alc262_capture_mixer alc882_capture_mixer
11496 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11499 * generic initialization of ADC, input mixers and output mixers
11501 static struct hda_verb alc262_init_verbs[] = {
11503 * Unmute ADC0-2 and set the default input to mic-in
11505 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11506 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11507 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11509 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11512 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11514 * Note: PASD motherboards uses the Line In 2 as the input for
11515 * front panel mic (mic 2)
11517 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11525 * Set up output mixers (0x0c - 0x0e)
11527 /* set vol=0 to output mixers */
11528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11529 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11530 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11531 /* set up input amps for analog loopback */
11532 /* Amp Indices: DAC = 0, mixer = 1 */
11533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11534 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11535 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11536 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11537 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11538 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11540 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11541 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11542 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11543 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11544 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11545 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11548 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11549 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11550 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11551 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11553 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11554 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11556 /* FIXME: use matrix-type input source selection */
11557 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11558 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11559 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11560 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11561 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11562 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11567 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11577 static struct hda_verb alc262_eapd_verbs[] = {
11578 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11579 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11583 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11584 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11585 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11586 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11588 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11589 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11593 static struct hda_verb alc262_sony_unsol_verbs[] = {
11594 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11595 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11596 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11598 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11599 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11603 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11604 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11605 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11606 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11607 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11608 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11612 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11613 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11614 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11615 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11616 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11617 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11618 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11619 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11620 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11624 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11626 struct alc_spec *spec = codec->spec;
11628 spec->autocfg.hp_pins[0] = 0x15;
11629 spec->autocfg.speaker_pins[0] = 0x14;
11630 spec->ext_mic.pin = 0x18;
11631 spec->ext_mic.mux_idx = 0;
11632 spec->int_mic.pin = 0x12;
11633 spec->int_mic.mux_idx = 9;
11634 spec->auto_mic = 1;
11640 * 0x16 = internal speaker
11641 * 0x18 = external mic
11644 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11645 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11646 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11648 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11649 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11650 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11652 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11653 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11657 static struct hda_verb alc262_nec_verbs[] = {
11658 /* Unmute Speaker */
11659 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11662 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11663 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11665 /* External mic to headphone */
11666 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11667 /* External mic to speaker */
11668 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11674 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11675 * 0x1b = port replicator headphone out
11678 #define ALC_HP_EVENT 0x37
11680 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11681 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11682 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11683 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11684 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11688 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11689 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11690 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11694 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11695 /* Front Mic pin: input vref at 50% */
11696 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11697 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11701 static struct hda_input_mux alc262_fujitsu_capture_source = {
11705 { "Internal Mic", 0x1 },
11710 static struct hda_input_mux alc262_HP_capture_source = {
11714 { "Front Mic", 0x1 },
11721 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11725 { "Front Mic", 0x2 },
11731 /* mute/unmute internal speaker according to the hp jacks and mute state */
11732 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11734 struct alc_spec *spec = codec->spec;
11737 if (force || !spec->sense_updated) {
11738 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11739 snd_hda_jack_detect(codec, 0x1b);
11740 spec->sense_updated = 1;
11742 /* unmute internal speaker only if both HPs are unplugged and
11743 * master switch is on
11745 if (spec->jack_present)
11746 mute = HDA_AMP_MUTE;
11748 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11749 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11750 HDA_AMP_MUTE, mute);
11753 /* unsolicited event for HP jack sensing */
11754 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11757 if ((res >> 26) != ALC_HP_EVENT)
11759 alc262_fujitsu_automute(codec, 1);
11762 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11764 alc262_fujitsu_automute(codec, 1);
11767 /* bind volumes of both NID 0x0c and 0x0d */
11768 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11769 .ops = &snd_hda_bind_vol,
11771 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11772 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11777 /* mute/unmute internal speaker according to the hp jack and mute state */
11778 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11780 struct alc_spec *spec = codec->spec;
11783 if (force || !spec->sense_updated) {
11784 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11785 spec->sense_updated = 1;
11787 if (spec->jack_present) {
11788 /* mute internal speaker */
11789 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11790 HDA_AMP_MUTE, HDA_AMP_MUTE);
11791 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11792 HDA_AMP_MUTE, HDA_AMP_MUTE);
11794 /* unmute internal speaker if necessary */
11795 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11796 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11797 HDA_AMP_MUTE, mute);
11798 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11799 HDA_AMP_MUTE, mute);
11803 /* unsolicited event for HP jack sensing */
11804 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11807 if ((res >> 26) != ALC_HP_EVENT)
11809 alc262_lenovo_3000_automute(codec, 1);
11812 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11813 int dir, int idx, long *valp)
11817 for (i = 0; i < 2; i++, valp++)
11818 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11820 *valp ? 0 : HDA_AMP_MUTE);
11824 /* bind hp and internal speaker mute (with plug check) */
11825 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11826 struct snd_ctl_elem_value *ucontrol)
11828 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11829 long *valp = ucontrol->value.integer.value;
11832 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11833 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11835 alc262_fujitsu_automute(codec, 0);
11839 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11840 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11842 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11843 .name = "Master Playback Switch",
11844 .subdevice = HDA_SUBDEV_AMP_FLAG,
11845 .info = snd_hda_mixer_amp_switch_info,
11846 .get = snd_hda_mixer_amp_switch_get,
11847 .put = alc262_fujitsu_master_sw_put,
11848 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11851 .iface = NID_MAPPING,
11852 .name = "Master Playback Switch",
11853 .private_value = 0x1b,
11855 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11856 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11857 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11858 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11859 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11860 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11861 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11862 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11866 /* bind hp and internal speaker mute (with plug check) */
11867 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11868 struct snd_ctl_elem_value *ucontrol)
11870 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11871 long *valp = ucontrol->value.integer.value;
11874 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11876 alc262_lenovo_3000_automute(codec, 0);
11880 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11881 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11883 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11884 .name = "Master Playback Switch",
11885 .subdevice = HDA_SUBDEV_AMP_FLAG,
11886 .info = snd_hda_mixer_amp_switch_info,
11887 .get = snd_hda_mixer_amp_switch_get,
11888 .put = alc262_lenovo_3000_master_sw_put,
11889 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11891 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11892 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11893 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11894 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11895 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11896 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11897 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11898 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11902 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11903 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11904 ALC262_HIPPO_MASTER_SWITCH,
11905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11906 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11907 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11908 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11909 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11910 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11914 /* additional init verbs for Benq laptops */
11915 static struct hda_verb alc262_EAPD_verbs[] = {
11916 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11917 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11921 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11922 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11923 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11925 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11926 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11930 /* Samsung Q1 Ultra Vista model setup */
11931 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11932 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11933 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11934 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11935 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11936 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
11937 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
11941 static struct hda_verb alc262_ultra_verbs[] = {
11943 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11947 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11948 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11949 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11950 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11952 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11953 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11954 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11955 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11956 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11958 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11959 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11960 /* ADC, choose mic */
11961 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11962 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11963 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11964 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11965 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11966 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11967 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11968 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11969 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11970 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11974 /* mute/unmute internal speaker according to the hp jack and mute state */
11975 static void alc262_ultra_automute(struct hda_codec *codec)
11977 struct alc_spec *spec = codec->spec;
11981 /* auto-mute only when HP is used as HP */
11982 if (!spec->cur_mux[0]) {
11983 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11984 if (spec->jack_present)
11985 mute = HDA_AMP_MUTE;
11987 /* mute/unmute internal speaker */
11988 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11989 HDA_AMP_MUTE, mute);
11990 /* mute/unmute HP */
11991 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11992 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11995 /* unsolicited event for HP jack sensing */
11996 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11999 if ((res >> 26) != ALC880_HP_EVENT)
12001 alc262_ultra_automute(codec);
12004 static struct hda_input_mux alc262_ultra_capture_source = {
12008 { "Headphone", 0x7 },
12012 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12013 struct snd_ctl_elem_value *ucontrol)
12015 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12016 struct alc_spec *spec = codec->spec;
12019 ret = alc_mux_enum_put(kcontrol, ucontrol);
12022 /* reprogram the HP pin as mic or HP according to the input source */
12023 snd_hda_codec_write_cache(codec, 0x15, 0,
12024 AC_VERB_SET_PIN_WIDGET_CONTROL,
12025 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12026 alc262_ultra_automute(codec); /* mute/unmute HP */
12030 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12031 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12032 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12034 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12035 .name = "Capture Source",
12036 .info = alc_mux_enum_info,
12037 .get = alc_mux_enum_get,
12038 .put = alc262_ultra_mux_enum_put,
12041 .iface = NID_MAPPING,
12042 .name = "Capture Source",
12043 .private_value = 0x15,
12048 /* We use two mixers depending on the output pin; 0x16 is a mono output
12049 * and thus it's bound with a different mixer.
12050 * This function returns which mixer amp should be used.
12052 static int alc262_check_volbit(hda_nid_t nid)
12056 else if (nid == 0x16)
12062 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12063 const char *pfx, int *vbits, int idx)
12068 vbit = alc262_check_volbit(nid);
12071 if (*vbits & vbit) /* a volume control for this mixer already there */
12075 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12077 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12078 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12081 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12082 const char *pfx, int idx)
12089 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12091 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12092 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12095 /* add playback controls from the parsed DAC table */
12096 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12097 const struct auto_pin_cfg *cfg)
12103 spec->multiout.num_dacs = 1; /* only use one dac */
12104 spec->multiout.dac_nids = spec->private_dac_nids;
12105 spec->multiout.dac_nids[0] = 2;
12107 pfx = alc_get_line_out_pfx(cfg, true);
12110 for (i = 0; i < 2; i++) {
12111 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12114 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12115 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12120 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12121 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12128 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12129 alc262_check_volbit(cfg->speaker_pins[0]) |
12130 alc262_check_volbit(cfg->hp_pins[0]);
12131 if (vbits == 1 || vbits == 2)
12132 pfx = "Master"; /* only one mixer is used */
12134 for (i = 0; i < 2; i++) {
12135 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12139 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12140 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12141 "Speaker", &vbits, i);
12145 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12146 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12147 "Headphone", &vbits, i);
12155 #define alc262_auto_create_input_ctls \
12156 alc882_auto_create_input_ctls
12159 * generic initialization of ADC, input mixers and output mixers
12161 static struct hda_verb alc262_volume_init_verbs[] = {
12163 * Unmute ADC0-2 and set the default input to mic-in
12165 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12166 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12167 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12168 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12169 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12170 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12172 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12174 * Note: PASD motherboards uses the Line In 2 as the input for
12175 * front panel mic (mic 2)
12177 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12178 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12179 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12180 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12181 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12185 * Set up output mixers (0x0c - 0x0f)
12187 /* set vol=0 to output mixers */
12188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12189 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12190 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12192 /* set up input amps for analog loopback */
12193 /* Amp Indices: DAC = 0, mixer = 1 */
12194 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12195 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12196 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12197 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12198 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12199 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12201 /* FIXME: use matrix-type input source selection */
12202 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12203 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12204 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12205 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12206 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12209 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12210 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12212 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12214 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12222 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12224 * Unmute ADC0-2 and set the default input to mic-in
12226 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12227 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12228 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12229 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12230 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12231 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12233 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12235 * Note: PASD motherboards uses the Line In 2 as the input for
12236 * front panel mic (mic 2)
12238 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12239 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12240 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12241 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12242 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12243 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12244 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12248 * Set up output mixers (0x0c - 0x0e)
12250 /* set vol=0 to output mixers */
12251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12252 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12255 /* set up input amps for analog loopback */
12256 /* Amp Indices: DAC = 0, mixer = 1 */
12257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12259 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12260 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12261 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12262 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12264 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12265 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12266 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12268 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12269 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12271 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12272 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12275 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12276 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12277 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12278 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12280 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12281 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12282 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12283 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12284 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12285 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12288 /* FIXME: use matrix-type input source selection */
12289 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12290 /* Input mixer1: only unmute Mic */
12291 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12292 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12293 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12294 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12295 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12296 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12297 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12298 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12301 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12302 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12318 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12319 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12321 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12326 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12328 * Unmute ADC0-2 and set the default input to mic-in
12330 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12332 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12333 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12334 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12335 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12337 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12339 * Note: PASD motherboards uses the Line In 2 as the input for front
12340 * panel mic (mic 2)
12342 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12343 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12344 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12345 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12346 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12347 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12348 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12349 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12350 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12352 * Set up output mixers (0x0c - 0x0e)
12354 /* set vol=0 to output mixers */
12355 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12356 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12359 /* set up input amps for analog loopback */
12360 /* Amp Indices: DAC = 0, mixer = 1 */
12361 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12363 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12364 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12365 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12366 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12369 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12370 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12371 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12372 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12373 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12374 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12375 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12377 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12378 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12380 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12381 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12383 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12384 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12385 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12386 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12387 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12388 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12390 /* FIXME: use matrix-type input source selection */
12391 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12392 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12393 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12395 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12396 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12398 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12401 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12402 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12403 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12404 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12406 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12407 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12409 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12413 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12414 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12417 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12422 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12424 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12425 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12426 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12428 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12429 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12430 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12431 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12433 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12434 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12435 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12446 static const struct alc_fixup alc262_fixups[] = {
12447 [PINFIX_FSC_H270] = {
12448 .pins = (const struct alc_pincfg[]) {
12449 { 0x14, 0x99130110 }, /* speaker */
12450 { 0x15, 0x0221142f }, /* front HP */
12451 { 0x1b, 0x0121141f }, /* rear HP */
12455 [PINFIX_PB_M5210] = {
12456 .verbs = (const struct hda_verb[]) {
12457 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
12463 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12464 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12469 #ifdef CONFIG_SND_HDA_POWER_SAVE
12470 #define alc262_loopbacks alc880_loopbacks
12473 /* pcm configuration: identical with ALC880 */
12474 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12475 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12476 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12477 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12480 * BIOS auto configuration
12482 static int alc262_parse_auto_config(struct hda_codec *codec)
12484 struct alc_spec *spec = codec->spec;
12486 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12488 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12492 if (!spec->autocfg.line_outs) {
12493 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12494 spec->multiout.max_channels = 2;
12495 spec->no_analog = 1;
12498 return 0; /* can't find valid BIOS pin config */
12500 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12503 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12507 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12510 alc_auto_parse_digital(codec);
12512 if (spec->kctls.list)
12513 add_mixer(spec, spec->kctls.list);
12515 add_verb(spec, alc262_volume_init_verbs);
12516 spec->num_mux_defs = 1;
12517 spec->input_mux = &spec->private_imux[0];
12519 err = alc_auto_add_mic_boost(codec);
12523 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12528 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12529 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12530 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12531 #define alc262_auto_init_input_src alc882_auto_init_input_src
12534 /* init callback for auto-configuration model -- overriding the default init */
12535 static void alc262_auto_init(struct hda_codec *codec)
12537 struct alc_spec *spec = codec->spec;
12538 alc262_auto_init_multi_out(codec);
12539 alc262_auto_init_hp_out(codec);
12540 alc262_auto_init_analog_input(codec);
12541 alc262_auto_init_input_src(codec);
12542 alc_auto_init_digital(codec);
12543 if (spec->unsol_event)
12544 alc_inithook(codec);
12548 * configuration and preset
12550 static const char *alc262_models[ALC262_MODEL_LAST] = {
12551 [ALC262_BASIC] = "basic",
12552 [ALC262_HIPPO] = "hippo",
12553 [ALC262_HIPPO_1] = "hippo_1",
12554 [ALC262_FUJITSU] = "fujitsu",
12555 [ALC262_HP_BPC] = "hp-bpc",
12556 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12557 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12558 [ALC262_HP_RP5700] = "hp-rp5700",
12559 [ALC262_BENQ_ED8] = "benq",
12560 [ALC262_BENQ_T31] = "benq-t31",
12561 [ALC262_SONY_ASSAMD] = "sony-assamd",
12562 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12563 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12564 [ALC262_ULTRA] = "ultra",
12565 [ALC262_LENOVO_3000] = "lenovo-3000",
12566 [ALC262_NEC] = "nec",
12567 [ALC262_TYAN] = "tyan",
12568 [ALC262_AUTO] = "auto",
12571 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12572 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12573 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12574 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12576 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12578 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12580 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12581 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12582 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12583 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12584 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12585 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12586 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12587 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12588 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12589 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12590 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12591 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12592 ALC262_HP_TC_T5735),
12593 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12594 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12595 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12596 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12597 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12598 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12599 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12600 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12601 #if 0 /* disable the quirk since model=auto works better in recent versions */
12602 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12603 ALC262_SONY_ASSAMD),
12605 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12606 ALC262_TOSHIBA_RX1),
12607 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12608 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12609 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12610 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12611 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12613 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12614 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12615 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12616 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12617 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12621 static struct alc_config_preset alc262_presets[] = {
12623 .mixers = { alc262_base_mixer },
12624 .init_verbs = { alc262_init_verbs },
12625 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12626 .dac_nids = alc262_dac_nids,
12628 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12629 .channel_mode = alc262_modes,
12630 .input_mux = &alc262_capture_source,
12633 .mixers = { alc262_hippo_mixer },
12634 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12635 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12636 .dac_nids = alc262_dac_nids,
12638 .dig_out_nid = ALC262_DIGOUT_NID,
12639 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12640 .channel_mode = alc262_modes,
12641 .input_mux = &alc262_capture_source,
12642 .unsol_event = alc262_hippo_unsol_event,
12643 .setup = alc262_hippo_setup,
12644 .init_hook = alc262_hippo_automute,
12646 [ALC262_HIPPO_1] = {
12647 .mixers = { alc262_hippo1_mixer },
12648 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12649 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12650 .dac_nids = alc262_dac_nids,
12652 .dig_out_nid = ALC262_DIGOUT_NID,
12653 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12654 .channel_mode = alc262_modes,
12655 .input_mux = &alc262_capture_source,
12656 .unsol_event = alc262_hippo_unsol_event,
12657 .setup = alc262_hippo1_setup,
12658 .init_hook = alc262_hippo_automute,
12660 [ALC262_FUJITSU] = {
12661 .mixers = { alc262_fujitsu_mixer },
12662 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12663 alc262_fujitsu_unsol_verbs },
12664 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12665 .dac_nids = alc262_dac_nids,
12667 .dig_out_nid = ALC262_DIGOUT_NID,
12668 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12669 .channel_mode = alc262_modes,
12670 .input_mux = &alc262_fujitsu_capture_source,
12671 .unsol_event = alc262_fujitsu_unsol_event,
12672 .init_hook = alc262_fujitsu_init_hook,
12674 [ALC262_HP_BPC] = {
12675 .mixers = { alc262_HP_BPC_mixer },
12676 .init_verbs = { alc262_HP_BPC_init_verbs },
12677 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12678 .dac_nids = alc262_dac_nids,
12680 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12681 .channel_mode = alc262_modes,
12682 .input_mux = &alc262_HP_capture_source,
12683 .unsol_event = alc262_hp_bpc_unsol_event,
12684 .init_hook = alc262_hp_bpc_automute,
12686 [ALC262_HP_BPC_D7000_WF] = {
12687 .mixers = { alc262_HP_BPC_WildWest_mixer },
12688 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12689 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12690 .dac_nids = alc262_dac_nids,
12692 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12693 .channel_mode = alc262_modes,
12694 .input_mux = &alc262_HP_D7000_capture_source,
12695 .unsol_event = alc262_hp_wildwest_unsol_event,
12696 .init_hook = alc262_hp_wildwest_automute,
12698 [ALC262_HP_BPC_D7000_WL] = {
12699 .mixers = { alc262_HP_BPC_WildWest_mixer,
12700 alc262_HP_BPC_WildWest_option_mixer },
12701 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12702 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12703 .dac_nids = alc262_dac_nids,
12705 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12706 .channel_mode = alc262_modes,
12707 .input_mux = &alc262_HP_D7000_capture_source,
12708 .unsol_event = alc262_hp_wildwest_unsol_event,
12709 .init_hook = alc262_hp_wildwest_automute,
12711 [ALC262_HP_TC_T5735] = {
12712 .mixers = { alc262_hp_t5735_mixer },
12713 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12714 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12715 .dac_nids = alc262_dac_nids,
12717 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12718 .channel_mode = alc262_modes,
12719 .input_mux = &alc262_capture_source,
12720 .unsol_event = alc_sku_unsol_event,
12721 .setup = alc262_hp_t5735_setup,
12722 .init_hook = alc_inithook,
12724 [ALC262_HP_RP5700] = {
12725 .mixers = { alc262_hp_rp5700_mixer },
12726 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12727 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12728 .dac_nids = alc262_dac_nids,
12729 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12730 .channel_mode = alc262_modes,
12731 .input_mux = &alc262_hp_rp5700_capture_source,
12733 [ALC262_BENQ_ED8] = {
12734 .mixers = { alc262_base_mixer },
12735 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12736 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12737 .dac_nids = alc262_dac_nids,
12739 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12740 .channel_mode = alc262_modes,
12741 .input_mux = &alc262_capture_source,
12743 [ALC262_SONY_ASSAMD] = {
12744 .mixers = { alc262_sony_mixer },
12745 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12746 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12747 .dac_nids = alc262_dac_nids,
12749 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12750 .channel_mode = alc262_modes,
12751 .input_mux = &alc262_capture_source,
12752 .unsol_event = alc262_hippo_unsol_event,
12753 .setup = alc262_hippo_setup,
12754 .init_hook = alc262_hippo_automute,
12756 [ALC262_BENQ_T31] = {
12757 .mixers = { alc262_benq_t31_mixer },
12758 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12759 alc_hp15_unsol_verbs },
12760 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12761 .dac_nids = alc262_dac_nids,
12763 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12764 .channel_mode = alc262_modes,
12765 .input_mux = &alc262_capture_source,
12766 .unsol_event = alc262_hippo_unsol_event,
12767 .setup = alc262_hippo_setup,
12768 .init_hook = alc262_hippo_automute,
12771 .mixers = { alc262_ultra_mixer },
12772 .cap_mixer = alc262_ultra_capture_mixer,
12773 .init_verbs = { alc262_ultra_verbs },
12774 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12775 .dac_nids = alc262_dac_nids,
12776 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12777 .channel_mode = alc262_modes,
12778 .input_mux = &alc262_ultra_capture_source,
12779 .adc_nids = alc262_adc_nids, /* ADC0 */
12780 .capsrc_nids = alc262_capsrc_nids,
12781 .num_adc_nids = 1, /* single ADC */
12782 .unsol_event = alc262_ultra_unsol_event,
12783 .init_hook = alc262_ultra_automute,
12785 [ALC262_LENOVO_3000] = {
12786 .mixers = { alc262_lenovo_3000_mixer },
12787 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12788 alc262_lenovo_3000_unsol_verbs,
12789 alc262_lenovo_3000_init_verbs },
12790 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12791 .dac_nids = alc262_dac_nids,
12793 .dig_out_nid = ALC262_DIGOUT_NID,
12794 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12795 .channel_mode = alc262_modes,
12796 .input_mux = &alc262_fujitsu_capture_source,
12797 .unsol_event = alc262_lenovo_3000_unsol_event,
12800 .mixers = { alc262_nec_mixer },
12801 .init_verbs = { alc262_nec_verbs },
12802 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12803 .dac_nids = alc262_dac_nids,
12805 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12806 .channel_mode = alc262_modes,
12807 .input_mux = &alc262_capture_source,
12809 [ALC262_TOSHIBA_S06] = {
12810 .mixers = { alc262_toshiba_s06_mixer },
12811 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12812 alc262_eapd_verbs },
12813 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12814 .capsrc_nids = alc262_dmic_capsrc_nids,
12815 .dac_nids = alc262_dac_nids,
12816 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12817 .num_adc_nids = 1, /* single ADC */
12818 .dig_out_nid = ALC262_DIGOUT_NID,
12819 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12820 .channel_mode = alc262_modes,
12821 .unsol_event = alc_sku_unsol_event,
12822 .setup = alc262_toshiba_s06_setup,
12823 .init_hook = alc_inithook,
12825 [ALC262_TOSHIBA_RX1] = {
12826 .mixers = { alc262_toshiba_rx1_mixer },
12827 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12828 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12829 .dac_nids = alc262_dac_nids,
12831 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12832 .channel_mode = alc262_modes,
12833 .input_mux = &alc262_capture_source,
12834 .unsol_event = alc262_hippo_unsol_event,
12835 .setup = alc262_hippo_setup,
12836 .init_hook = alc262_hippo_automute,
12839 .mixers = { alc262_tyan_mixer },
12840 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12841 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12842 .dac_nids = alc262_dac_nids,
12844 .dig_out_nid = ALC262_DIGOUT_NID,
12845 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12846 .channel_mode = alc262_modes,
12847 .input_mux = &alc262_capture_source,
12848 .unsol_event = alc_automute_amp_unsol_event,
12849 .setup = alc262_tyan_setup,
12850 .init_hook = alc_automute_amp,
12854 static int patch_alc262(struct hda_codec *codec)
12856 struct alc_spec *spec;
12860 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12864 codec->spec = spec;
12866 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12871 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12872 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12873 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12874 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12877 alc_auto_parse_customize_define(codec);
12879 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12881 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12885 if (board_config < 0) {
12886 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12888 board_config = ALC262_AUTO;
12891 if (board_config == ALC262_AUTO)
12892 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1);
12894 if (board_config == ALC262_AUTO) {
12895 /* automatic parse from the BIOS config */
12896 err = alc262_parse_auto_config(codec);
12902 "hda_codec: Cannot set up configuration "
12903 "from BIOS. Using base mode...\n");
12904 board_config = ALC262_BASIC;
12908 if (!spec->no_analog && has_cdefine_beep(codec)) {
12909 err = snd_hda_attach_beep_device(codec, 0x1);
12916 if (board_config != ALC262_AUTO)
12917 setup_preset(codec, &alc262_presets[board_config]);
12919 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12920 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12922 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12923 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12925 if (!spec->adc_nids && spec->input_mux) {
12927 /* check whether the digital-mic has to be supported */
12928 for (i = 0; i < spec->input_mux->num_items; i++) {
12929 if (spec->input_mux->items[i].index >= 9)
12932 if (i < spec->input_mux->num_items) {
12933 /* use only ADC0 */
12934 spec->adc_nids = alc262_dmic_adc_nids;
12935 spec->num_adc_nids = 1;
12936 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12938 /* all analog inputs */
12939 /* check whether NID 0x07 is valid */
12940 unsigned int wcap = get_wcaps(codec, 0x07);
12943 wcap = get_wcaps_type(wcap);
12944 if (wcap != AC_WID_AUD_IN) {
12945 spec->adc_nids = alc262_adc_nids_alt;
12946 spec->num_adc_nids =
12947 ARRAY_SIZE(alc262_adc_nids_alt);
12948 spec->capsrc_nids = alc262_capsrc_nids_alt;
12950 spec->adc_nids = alc262_adc_nids;
12951 spec->num_adc_nids =
12952 ARRAY_SIZE(alc262_adc_nids);
12953 spec->capsrc_nids = alc262_capsrc_nids;
12957 if (!spec->cap_mixer && !spec->no_analog)
12958 set_capture_mixer(codec);
12959 if (!spec->no_analog && has_cdefine_beep(codec))
12960 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12962 if (board_config == ALC262_AUTO)
12963 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
12965 spec->vmaster_nid = 0x0c;
12967 codec->patch_ops = alc_patch_ops;
12968 if (board_config == ALC262_AUTO)
12969 spec->init_hook = alc262_auto_init;
12971 alc_init_jacks(codec);
12972 #ifdef CONFIG_SND_HDA_POWER_SAVE
12973 if (!spec->loopback.amplist)
12974 spec->loopback.amplist = alc262_loopbacks;
12981 * ALC268 channel source setting (2 channel)
12983 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12984 #define alc268_modes alc260_modes
12986 static hda_nid_t alc268_dac_nids[2] = {
12991 static hda_nid_t alc268_adc_nids[2] = {
12996 static hda_nid_t alc268_adc_nids_alt[1] = {
13001 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13003 static struct snd_kcontrol_new alc268_base_mixer[] = {
13004 /* output mixer control */
13005 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13006 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13007 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13008 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13009 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13010 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13011 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13015 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13016 /* output mixer control */
13017 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13018 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13019 ALC262_HIPPO_MASTER_SWITCH,
13020 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13021 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13022 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13026 /* bind Beep switches of both NID 0x0f and 0x10 */
13027 static struct hda_bind_ctls alc268_bind_beep_sw = {
13028 .ops = &snd_hda_bind_sw,
13030 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13031 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13036 static struct snd_kcontrol_new alc268_beep_mixer[] = {
13037 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13038 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13042 static struct hda_verb alc268_eapd_verbs[] = {
13043 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13044 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13048 /* Toshiba specific */
13049 static struct hda_verb alc268_toshiba_verbs[] = {
13050 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13054 /* Acer specific */
13055 /* bind volumes of both NID 0x02 and 0x03 */
13056 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13057 .ops = &snd_hda_bind_vol,
13059 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13060 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13065 /* mute/unmute internal speaker according to the hp jack and mute state */
13066 static void alc268_acer_automute(struct hda_codec *codec, int force)
13068 struct alc_spec *spec = codec->spec;
13071 if (force || !spec->sense_updated) {
13072 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13073 spec->sense_updated = 1;
13075 if (spec->jack_present)
13076 mute = HDA_AMP_MUTE; /* mute internal speaker */
13077 else /* unmute internal speaker if necessary */
13078 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13079 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13080 HDA_AMP_MUTE, mute);
13084 /* bind hp and internal speaker mute (with plug check) */
13085 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13086 struct snd_ctl_elem_value *ucontrol)
13088 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13089 long *valp = ucontrol->value.integer.value;
13092 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13094 alc268_acer_automute(codec, 0);
13098 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13099 /* output mixer control */
13100 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13102 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13103 .name = "Master Playback Switch",
13104 .subdevice = HDA_SUBDEV_AMP_FLAG,
13105 .info = snd_hda_mixer_amp_switch_info,
13106 .get = snd_hda_mixer_amp_switch_get,
13107 .put = alc268_acer_master_sw_put,
13108 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13110 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13114 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13115 /* output mixer control */
13116 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13118 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13119 .name = "Master Playback Switch",
13120 .subdevice = HDA_SUBDEV_AMP_FLAG,
13121 .info = snd_hda_mixer_amp_switch_info,
13122 .get = snd_hda_mixer_amp_switch_get,
13123 .put = alc268_acer_master_sw_put,
13124 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13126 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13127 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13128 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13132 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13133 /* output mixer control */
13134 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13136 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13137 .name = "Master Playback Switch",
13138 .subdevice = HDA_SUBDEV_AMP_FLAG,
13139 .info = snd_hda_mixer_amp_switch_info,
13140 .get = snd_hda_mixer_amp_switch_get,
13141 .put = alc268_acer_master_sw_put,
13142 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13144 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13145 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13149 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13150 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13151 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13152 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13153 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13154 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13155 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13159 static struct hda_verb alc268_acer_verbs[] = {
13160 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13161 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13162 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13163 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13164 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13165 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13166 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13170 /* unsolicited event for HP jack sensing */
13171 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13172 #define alc268_toshiba_setup alc262_hippo_setup
13173 #define alc268_toshiba_automute alc262_hippo_automute
13175 static void alc268_acer_unsol_event(struct hda_codec *codec,
13178 if ((res >> 26) != ALC880_HP_EVENT)
13180 alc268_acer_automute(codec, 1);
13183 static void alc268_acer_init_hook(struct hda_codec *codec)
13185 alc268_acer_automute(codec, 1);
13188 /* toggle speaker-output according to the hp-jack state */
13189 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13191 unsigned int present;
13192 unsigned char bits;
13194 present = snd_hda_jack_detect(codec, 0x15);
13195 bits = present ? HDA_AMP_MUTE : 0;
13196 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13197 HDA_AMP_MUTE, bits);
13198 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13199 HDA_AMP_MUTE, bits);
13202 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13205 switch (res >> 26) {
13206 case ALC880_HP_EVENT:
13207 alc268_aspire_one_speaker_automute(codec);
13209 case ALC880_MIC_EVENT:
13210 alc_mic_automute(codec);
13215 static void alc268_acer_lc_setup(struct hda_codec *codec)
13217 struct alc_spec *spec = codec->spec;
13218 spec->ext_mic.pin = 0x18;
13219 spec->ext_mic.mux_idx = 0;
13220 spec->int_mic.pin = 0x12;
13221 spec->int_mic.mux_idx = 6;
13222 spec->auto_mic = 1;
13225 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13227 alc268_aspire_one_speaker_automute(codec);
13228 alc_mic_automute(codec);
13231 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13232 /* output mixer control */
13233 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13234 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13235 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13236 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13237 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13238 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13242 static struct hda_verb alc268_dell_verbs[] = {
13243 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13244 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13245 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13246 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13250 /* mute/unmute internal speaker according to the hp jack and mute state */
13251 static void alc268_dell_setup(struct hda_codec *codec)
13253 struct alc_spec *spec = codec->spec;
13255 spec->autocfg.hp_pins[0] = 0x15;
13256 spec->autocfg.speaker_pins[0] = 0x14;
13257 spec->ext_mic.pin = 0x18;
13258 spec->ext_mic.mux_idx = 0;
13259 spec->int_mic.pin = 0x19;
13260 spec->int_mic.mux_idx = 1;
13261 spec->auto_mic = 1;
13264 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13265 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13266 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13267 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13269 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13270 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13271 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13272 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13276 static struct hda_verb alc267_quanta_il1_verbs[] = {
13277 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13278 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13282 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13284 struct alc_spec *spec = codec->spec;
13285 spec->autocfg.hp_pins[0] = 0x15;
13286 spec->autocfg.speaker_pins[0] = 0x14;
13287 spec->ext_mic.pin = 0x18;
13288 spec->ext_mic.mux_idx = 0;
13289 spec->int_mic.pin = 0x19;
13290 spec->int_mic.mux_idx = 1;
13291 spec->auto_mic = 1;
13295 * generic initialization of ADC, input mixers and output mixers
13297 static struct hda_verb alc268_base_init_verbs[] = {
13298 /* Unmute DAC0-1 and set vol = 0 */
13299 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13300 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13303 * Set up output mixers (0x0c - 0x0e)
13305 /* set vol=0 to output mixers */
13306 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13307 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13309 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13310 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13313 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13314 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13315 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13316 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13317 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13318 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13319 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13321 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13322 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13323 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13324 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13325 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13327 /* set PCBEEP vol = 0, mute connections */
13328 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13329 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13330 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13332 /* Unmute Selector 23h,24h and set the default input to mic-in */
13334 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13335 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13336 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13337 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13343 * generic initialization of ADC, input mixers and output mixers
13345 static struct hda_verb alc268_volume_init_verbs[] = {
13346 /* set output DAC */
13347 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13348 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13350 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13351 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13352 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13353 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13354 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13357 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13358 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13360 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13361 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13363 /* set PCBEEP vol = 0, mute connections */
13364 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13365 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13366 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13371 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13372 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13373 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13377 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13378 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13379 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13384 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13385 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13386 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13387 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13388 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13393 static struct hda_input_mux alc268_capture_source = {
13397 { "Front Mic", 0x1 },
13403 static struct hda_input_mux alc268_acer_capture_source = {
13407 { "Internal Mic", 0x1 },
13412 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13416 { "Internal Mic", 0x6 },
13421 #ifdef CONFIG_SND_DEBUG
13422 static struct snd_kcontrol_new alc268_test_mixer[] = {
13423 /* Volume widgets */
13424 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13425 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13426 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13427 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13428 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13429 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13430 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13431 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13432 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13433 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13434 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13435 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13436 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13437 /* The below appears problematic on some hardwares */
13438 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13439 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13440 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13441 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13442 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13444 /* Modes for retasking pin widgets */
13445 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13446 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13447 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13448 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13450 /* Controls for GPIO pins, assuming they are configured as outputs */
13451 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13452 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13453 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13454 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13456 /* Switches to allow the digital SPDIF output pin to be enabled.
13457 * The ALC268 does not have an SPDIF input.
13459 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13461 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13462 * this output to turn on an external amplifier.
13464 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13465 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13471 /* create input playback/capture controls for the given pin */
13472 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13473 const char *ctlname, int idx)
13484 case 0x1a: /* ALC259/269 only */
13485 case 0x1b: /* ALC259/269 only */
13486 case 0x21: /* ALC269vb has this pin, too */
13490 snd_printd(KERN_WARNING "hda_codec: "
13491 "ignoring pin 0x%x as unknown\n", nid);
13494 if (spec->multiout.dac_nids[0] != dac &&
13495 spec->multiout.dac_nids[1] != dac) {
13496 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13497 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13501 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13505 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13506 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13508 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13509 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13515 /* add playback controls from the parsed DAC table */
13516 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13517 const struct auto_pin_cfg *cfg)
13522 spec->multiout.dac_nids = spec->private_dac_nids;
13524 nid = cfg->line_out_pins[0];
13527 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13531 err = alc268_new_analog_output(spec, nid, name, 0);
13536 nid = cfg->speaker_pins[0];
13538 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13539 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13543 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13547 nid = cfg->hp_pins[0];
13549 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13554 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13556 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13557 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13564 /* create playback/capture controls for input pins */
13565 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13566 const struct auto_pin_cfg *cfg)
13568 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13571 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13572 hda_nid_t nid, int pin_type)
13576 alc_set_pin_output(codec, nid, pin_type);
13577 if (nid == 0x14 || nid == 0x16)
13581 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13584 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13586 struct alc_spec *spec = codec->spec;
13589 for (i = 0; i < spec->autocfg.line_outs; i++) {
13590 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13591 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13592 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13596 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13598 struct alc_spec *spec = codec->spec;
13602 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13603 pin = spec->autocfg.hp_pins[i];
13604 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13606 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13607 pin = spec->autocfg.speaker_pins[i];
13608 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13610 if (spec->autocfg.mono_out_pin)
13611 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13612 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13615 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13617 struct alc_spec *spec = codec->spec;
13618 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13619 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13620 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13621 unsigned int dac_vol1, dac_vol2;
13623 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13624 snd_hda_codec_write(codec, speaker_nid, 0,
13625 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13626 /* mute mixer inputs from 0x1d */
13627 snd_hda_codec_write(codec, 0x0f, 0,
13628 AC_VERB_SET_AMP_GAIN_MUTE,
13630 snd_hda_codec_write(codec, 0x10, 0,
13631 AC_VERB_SET_AMP_GAIN_MUTE,
13634 /* unmute mixer inputs from 0x1d */
13635 snd_hda_codec_write(codec, 0x0f, 0,
13636 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13637 snd_hda_codec_write(codec, 0x10, 0,
13638 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13641 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13642 if (line_nid == 0x14)
13643 dac_vol2 = AMP_OUT_ZERO;
13644 else if (line_nid == 0x15)
13645 dac_vol1 = AMP_OUT_ZERO;
13646 if (hp_nid == 0x14)
13647 dac_vol2 = AMP_OUT_ZERO;
13648 else if (hp_nid == 0x15)
13649 dac_vol1 = AMP_OUT_ZERO;
13650 if (line_nid != 0x16 || hp_nid != 0x16 ||
13651 spec->autocfg.line_out_pins[1] != 0x16 ||
13652 spec->autocfg.line_out_pins[2] != 0x16)
13653 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13655 snd_hda_codec_write(codec, 0x02, 0,
13656 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13657 snd_hda_codec_write(codec, 0x03, 0,
13658 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13661 /* pcm configuration: identical with ALC880 */
13662 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13663 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13664 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13665 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13668 * BIOS auto configuration
13670 static int alc268_parse_auto_config(struct hda_codec *codec)
13672 struct alc_spec *spec = codec->spec;
13674 static hda_nid_t alc268_ignore[] = { 0 };
13676 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13680 if (!spec->autocfg.line_outs) {
13681 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13682 spec->multiout.max_channels = 2;
13683 spec->no_analog = 1;
13686 return 0; /* can't find valid BIOS pin config */
13688 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13691 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13695 spec->multiout.max_channels = 2;
13698 /* digital only support output */
13699 alc_auto_parse_digital(codec);
13700 if (spec->kctls.list)
13701 add_mixer(spec, spec->kctls.list);
13703 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13704 add_mixer(spec, alc268_beep_mixer);
13706 add_verb(spec, alc268_volume_init_verbs);
13707 spec->num_mux_defs = 2;
13708 spec->input_mux = &spec->private_imux[0];
13710 err = alc_auto_add_mic_boost(codec);
13714 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13719 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13721 /* init callback for auto-configuration model -- overriding the default init */
13722 static void alc268_auto_init(struct hda_codec *codec)
13724 struct alc_spec *spec = codec->spec;
13725 alc268_auto_init_multi_out(codec);
13726 alc268_auto_init_hp_out(codec);
13727 alc268_auto_init_mono_speaker_out(codec);
13728 alc268_auto_init_analog_input(codec);
13729 alc_auto_init_digital(codec);
13730 if (spec->unsol_event)
13731 alc_inithook(codec);
13735 * configuration and preset
13737 static const char *alc268_models[ALC268_MODEL_LAST] = {
13738 [ALC267_QUANTA_IL1] = "quanta-il1",
13739 [ALC268_3ST] = "3stack",
13740 [ALC268_TOSHIBA] = "toshiba",
13741 [ALC268_ACER] = "acer",
13742 [ALC268_ACER_DMIC] = "acer-dmic",
13743 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13744 [ALC268_DELL] = "dell",
13745 [ALC268_ZEPTO] = "zepto",
13746 #ifdef CONFIG_SND_DEBUG
13747 [ALC268_TEST] = "test",
13749 [ALC268_AUTO] = "auto",
13752 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13753 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13754 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13755 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13756 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13757 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13758 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13759 ALC268_ACER_ASPIRE_ONE),
13760 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13761 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13762 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13763 /* almost compatible with toshiba but with optional digital outs;
13764 * auto-probing seems working fine
13766 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13768 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13769 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13770 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13771 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13772 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13776 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13777 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13778 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13779 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13780 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13785 static struct alc_config_preset alc268_presets[] = {
13786 [ALC267_QUANTA_IL1] = {
13787 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13788 alc268_capture_nosrc_mixer },
13789 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13790 alc267_quanta_il1_verbs },
13791 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13792 .dac_nids = alc268_dac_nids,
13793 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13794 .adc_nids = alc268_adc_nids_alt,
13796 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13797 .channel_mode = alc268_modes,
13798 .unsol_event = alc_sku_unsol_event,
13799 .setup = alc267_quanta_il1_setup,
13800 .init_hook = alc_inithook,
13803 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13804 alc268_beep_mixer },
13805 .init_verbs = { alc268_base_init_verbs },
13806 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13807 .dac_nids = alc268_dac_nids,
13808 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13809 .adc_nids = alc268_adc_nids_alt,
13810 .capsrc_nids = alc268_capsrc_nids,
13812 .dig_out_nid = ALC268_DIGOUT_NID,
13813 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13814 .channel_mode = alc268_modes,
13815 .input_mux = &alc268_capture_source,
13817 [ALC268_TOSHIBA] = {
13818 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13819 alc268_beep_mixer },
13820 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13821 alc268_toshiba_verbs },
13822 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13823 .dac_nids = alc268_dac_nids,
13824 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13825 .adc_nids = alc268_adc_nids_alt,
13826 .capsrc_nids = alc268_capsrc_nids,
13828 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13829 .channel_mode = alc268_modes,
13830 .input_mux = &alc268_capture_source,
13831 .unsol_event = alc268_toshiba_unsol_event,
13832 .setup = alc268_toshiba_setup,
13833 .init_hook = alc268_toshiba_automute,
13836 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13837 alc268_beep_mixer },
13838 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13839 alc268_acer_verbs },
13840 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13841 .dac_nids = alc268_dac_nids,
13842 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13843 .adc_nids = alc268_adc_nids_alt,
13844 .capsrc_nids = alc268_capsrc_nids,
13846 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13847 .channel_mode = alc268_modes,
13848 .input_mux = &alc268_acer_capture_source,
13849 .unsol_event = alc268_acer_unsol_event,
13850 .init_hook = alc268_acer_init_hook,
13852 [ALC268_ACER_DMIC] = {
13853 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13854 alc268_beep_mixer },
13855 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13856 alc268_acer_verbs },
13857 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13858 .dac_nids = alc268_dac_nids,
13859 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13860 .adc_nids = alc268_adc_nids_alt,
13861 .capsrc_nids = alc268_capsrc_nids,
13863 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13864 .channel_mode = alc268_modes,
13865 .input_mux = &alc268_acer_dmic_capture_source,
13866 .unsol_event = alc268_acer_unsol_event,
13867 .init_hook = alc268_acer_init_hook,
13869 [ALC268_ACER_ASPIRE_ONE] = {
13870 .mixers = { alc268_acer_aspire_one_mixer,
13872 alc268_capture_nosrc_mixer },
13873 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13874 alc268_acer_aspire_one_verbs },
13875 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13876 .dac_nids = alc268_dac_nids,
13877 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13878 .adc_nids = alc268_adc_nids_alt,
13879 .capsrc_nids = alc268_capsrc_nids,
13881 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13882 .channel_mode = alc268_modes,
13883 .unsol_event = alc268_acer_lc_unsol_event,
13884 .setup = alc268_acer_lc_setup,
13885 .init_hook = alc268_acer_lc_init_hook,
13888 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13889 alc268_capture_nosrc_mixer },
13890 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13891 alc268_dell_verbs },
13892 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13893 .dac_nids = alc268_dac_nids,
13894 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13895 .adc_nids = alc268_adc_nids_alt,
13896 .capsrc_nids = alc268_capsrc_nids,
13898 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13899 .channel_mode = alc268_modes,
13900 .unsol_event = alc_sku_unsol_event,
13901 .setup = alc268_dell_setup,
13902 .init_hook = alc_inithook,
13905 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13906 alc268_beep_mixer },
13907 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13908 alc268_toshiba_verbs },
13909 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13910 .dac_nids = alc268_dac_nids,
13911 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13912 .adc_nids = alc268_adc_nids_alt,
13913 .capsrc_nids = alc268_capsrc_nids,
13915 .dig_out_nid = ALC268_DIGOUT_NID,
13916 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13917 .channel_mode = alc268_modes,
13918 .input_mux = &alc268_capture_source,
13919 .setup = alc268_toshiba_setup,
13920 .init_hook = alc268_toshiba_automute,
13922 #ifdef CONFIG_SND_DEBUG
13924 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13925 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13926 alc268_volume_init_verbs },
13927 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13928 .dac_nids = alc268_dac_nids,
13929 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13930 .adc_nids = alc268_adc_nids_alt,
13931 .capsrc_nids = alc268_capsrc_nids,
13933 .dig_out_nid = ALC268_DIGOUT_NID,
13934 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13935 .channel_mode = alc268_modes,
13936 .input_mux = &alc268_capture_source,
13941 static int patch_alc268(struct hda_codec *codec)
13943 struct alc_spec *spec;
13945 int i, has_beep, err;
13947 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13951 codec->spec = spec;
13953 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13957 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13958 board_config = snd_hda_check_board_codec_sid_config(codec,
13959 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13961 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13962 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13964 board_config = ALC268_AUTO;
13967 if (board_config == ALC268_AUTO) {
13968 /* automatic parse from the BIOS config */
13969 err = alc268_parse_auto_config(codec);
13975 "hda_codec: Cannot set up configuration "
13976 "from BIOS. Using base mode...\n");
13977 board_config = ALC268_3ST;
13981 if (board_config != ALC268_AUTO)
13982 setup_preset(codec, &alc268_presets[board_config]);
13984 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13985 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13986 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13988 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13991 for (i = 0; i < spec->num_mixers; i++) {
13992 if (spec->mixers[i] == alc268_beep_mixer) {
13999 err = snd_hda_attach_beep_device(codec, 0x1);
14004 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14005 /* override the amp caps for beep generator */
14006 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14007 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14008 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14009 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14010 (0 << AC_AMPCAP_MUTE_SHIFT));
14013 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14014 /* check whether NID 0x07 is valid */
14015 unsigned int wcap = get_wcaps(codec, 0x07);
14018 spec->capsrc_nids = alc268_capsrc_nids;
14020 wcap = get_wcaps_type(wcap);
14021 if (spec->auto_mic ||
14022 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14023 spec->adc_nids = alc268_adc_nids_alt;
14024 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14025 if (spec->auto_mic)
14026 fixup_automic_adc(codec);
14027 if (spec->auto_mic || spec->input_mux->num_items == 1)
14028 add_mixer(spec, alc268_capture_nosrc_mixer);
14030 add_mixer(spec, alc268_capture_alt_mixer);
14032 spec->adc_nids = alc268_adc_nids;
14033 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14034 add_mixer(spec, alc268_capture_mixer);
14036 /* set default input source */
14037 for (i = 0; i < spec->num_adc_nids; i++)
14038 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
14039 0, AC_VERB_SET_CONNECT_SEL,
14040 i < spec->num_mux_defs ?
14041 spec->input_mux[i].items[0].index :
14042 spec->input_mux->items[0].index);
14045 spec->vmaster_nid = 0x02;
14047 codec->patch_ops = alc_patch_ops;
14048 if (board_config == ALC268_AUTO)
14049 spec->init_hook = alc268_auto_init;
14051 alc_init_jacks(codec);
14057 * ALC269 channel source setting (2 channel)
14059 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14061 #define alc269_dac_nids alc260_dac_nids
14063 static hda_nid_t alc269_adc_nids[1] = {
14068 static hda_nid_t alc269_capsrc_nids[1] = {
14072 static hda_nid_t alc269vb_adc_nids[1] = {
14077 static hda_nid_t alc269vb_capsrc_nids[1] = {
14081 static hda_nid_t alc269_adc_candidates[] = {
14085 #define alc269_modes alc260_modes
14086 #define alc269_capture_source alc880_lg_lw_capture_source
14088 static struct snd_kcontrol_new alc269_base_mixer[] = {
14089 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14090 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14091 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14092 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14093 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14094 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14095 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14096 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14097 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14098 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14099 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14100 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14104 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14105 /* output mixer control */
14106 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14108 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14109 .name = "Master Playback Switch",
14110 .subdevice = HDA_SUBDEV_AMP_FLAG,
14111 .info = snd_hda_mixer_amp_switch_info,
14112 .get = snd_hda_mixer_amp_switch_get,
14113 .put = alc268_acer_master_sw_put,
14114 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14117 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14118 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14119 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14120 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14121 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14125 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14126 /* output mixer control */
14127 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14129 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14130 .name = "Master Playback Switch",
14131 .subdevice = HDA_SUBDEV_AMP_FLAG,
14132 .info = snd_hda_mixer_amp_switch_info,
14133 .get = snd_hda_mixer_amp_switch_get,
14134 .put = alc268_acer_master_sw_put,
14135 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14137 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14138 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14139 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14140 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14141 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14142 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14143 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14144 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14145 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14149 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14150 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14151 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14152 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14153 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14157 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14158 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14159 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14161 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14165 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14166 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14167 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14171 /* capture mixer elements */
14172 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14173 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14174 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14175 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14176 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14180 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14181 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14182 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14183 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14187 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14188 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14189 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14190 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14191 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14195 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14196 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14197 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14198 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14203 #define alc269_fujitsu_mixer alc269_laptop_mixer
14205 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14206 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14207 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14208 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14209 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14210 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14211 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14215 static struct hda_verb alc269_lifebook_verbs[] = {
14216 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14217 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14218 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14219 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14220 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14221 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14222 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14223 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14224 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14225 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14229 /* toggle speaker-output according to the hp-jack state */
14230 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14232 unsigned int present;
14233 unsigned char bits;
14235 present = snd_hda_jack_detect(codec, 0x15);
14236 bits = present ? HDA_AMP_MUTE : 0;
14237 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14238 HDA_AMP_MUTE, bits);
14239 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14240 HDA_AMP_MUTE, bits);
14242 snd_hda_codec_write(codec, 0x20, 0,
14243 AC_VERB_SET_COEF_INDEX, 0x0c);
14244 snd_hda_codec_write(codec, 0x20, 0,
14245 AC_VERB_SET_PROC_COEF, 0x680);
14247 snd_hda_codec_write(codec, 0x20, 0,
14248 AC_VERB_SET_COEF_INDEX, 0x0c);
14249 snd_hda_codec_write(codec, 0x20, 0,
14250 AC_VERB_SET_PROC_COEF, 0x480);
14253 /* toggle speaker-output according to the hp-jacks state */
14254 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14256 unsigned int present;
14257 unsigned char bits;
14259 /* Check laptop headphone socket */
14260 present = snd_hda_jack_detect(codec, 0x15);
14262 /* Check port replicator headphone socket */
14263 present |= snd_hda_jack_detect(codec, 0x1a);
14265 bits = present ? HDA_AMP_MUTE : 0;
14266 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14267 HDA_AMP_MUTE, bits);
14268 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14269 HDA_AMP_MUTE, bits);
14271 snd_hda_codec_write(codec, 0x20, 0,
14272 AC_VERB_SET_COEF_INDEX, 0x0c);
14273 snd_hda_codec_write(codec, 0x20, 0,
14274 AC_VERB_SET_PROC_COEF, 0x680);
14276 snd_hda_codec_write(codec, 0x20, 0,
14277 AC_VERB_SET_COEF_INDEX, 0x0c);
14278 snd_hda_codec_write(codec, 0x20, 0,
14279 AC_VERB_SET_PROC_COEF, 0x480);
14282 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14284 unsigned int present_laptop;
14285 unsigned int present_dock;
14287 present_laptop = snd_hda_jack_detect(codec, 0x18);
14288 present_dock = snd_hda_jack_detect(codec, 0x1b);
14290 /* Laptop mic port overrides dock mic port, design decision */
14292 snd_hda_codec_write(codec, 0x23, 0,
14293 AC_VERB_SET_CONNECT_SEL, 0x3);
14294 if (present_laptop)
14295 snd_hda_codec_write(codec, 0x23, 0,
14296 AC_VERB_SET_CONNECT_SEL, 0x0);
14297 if (!present_dock && !present_laptop)
14298 snd_hda_codec_write(codec, 0x23, 0,
14299 AC_VERB_SET_CONNECT_SEL, 0x1);
14302 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14305 switch (res >> 26) {
14306 case ALC880_HP_EVENT:
14307 alc269_quanta_fl1_speaker_automute(codec);
14309 case ALC880_MIC_EVENT:
14310 alc_mic_automute(codec);
14315 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14318 if ((res >> 26) == ALC880_HP_EVENT)
14319 alc269_lifebook_speaker_automute(codec);
14320 if ((res >> 26) == ALC880_MIC_EVENT)
14321 alc269_lifebook_mic_autoswitch(codec);
14324 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14326 struct alc_spec *spec = codec->spec;
14327 spec->autocfg.hp_pins[0] = 0x15;
14328 spec->autocfg.speaker_pins[0] = 0x14;
14329 spec->ext_mic.pin = 0x18;
14330 spec->ext_mic.mux_idx = 0;
14331 spec->int_mic.pin = 0x19;
14332 spec->int_mic.mux_idx = 1;
14333 spec->auto_mic = 1;
14336 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14338 alc269_quanta_fl1_speaker_automute(codec);
14339 alc_mic_automute(codec);
14342 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14344 alc269_lifebook_speaker_automute(codec);
14345 alc269_lifebook_mic_autoswitch(codec);
14348 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14349 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14350 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14351 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14352 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14353 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14354 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14355 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14359 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14360 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14361 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14362 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14363 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14364 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14365 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14369 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14370 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14371 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14372 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14373 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14374 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14375 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14376 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14380 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14381 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14382 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14383 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14384 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14385 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14386 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14387 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14391 static struct hda_verb alc271_acer_dmic_verbs[] = {
14392 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14393 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14394 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14395 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14396 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14397 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14398 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14399 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14400 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14401 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14405 /* toggle speaker-output according to the hp-jack state */
14406 static void alc269_speaker_automute(struct hda_codec *codec)
14408 struct alc_spec *spec = codec->spec;
14409 unsigned int nid = spec->autocfg.hp_pins[0];
14410 unsigned int present;
14411 unsigned char bits;
14413 present = snd_hda_jack_detect(codec, nid);
14414 bits = present ? HDA_AMP_MUTE : 0;
14415 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14416 HDA_AMP_MUTE, bits);
14417 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14418 HDA_AMP_MUTE, bits);
14419 alc_report_jack(codec, nid);
14422 /* unsolicited event for HP jack sensing */
14423 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14426 switch (res >> 26) {
14427 case ALC880_HP_EVENT:
14428 alc269_speaker_automute(codec);
14430 case ALC880_MIC_EVENT:
14431 alc_mic_automute(codec);
14436 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14438 struct alc_spec *spec = codec->spec;
14439 spec->autocfg.hp_pins[0] = 0x15;
14440 spec->autocfg.speaker_pins[0] = 0x14;
14441 spec->ext_mic.pin = 0x18;
14442 spec->ext_mic.mux_idx = 0;
14443 spec->int_mic.pin = 0x19;
14444 spec->int_mic.mux_idx = 1;
14445 spec->auto_mic = 1;
14448 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14450 struct alc_spec *spec = codec->spec;
14451 spec->autocfg.hp_pins[0] = 0x15;
14452 spec->autocfg.speaker_pins[0] = 0x14;
14453 spec->ext_mic.pin = 0x18;
14454 spec->ext_mic.mux_idx = 0;
14455 spec->int_mic.pin = 0x12;
14456 spec->int_mic.mux_idx = 5;
14457 spec->auto_mic = 1;
14460 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14462 struct alc_spec *spec = codec->spec;
14463 spec->autocfg.hp_pins[0] = 0x21;
14464 spec->autocfg.speaker_pins[0] = 0x14;
14465 spec->ext_mic.pin = 0x18;
14466 spec->ext_mic.mux_idx = 0;
14467 spec->int_mic.pin = 0x19;
14468 spec->int_mic.mux_idx = 1;
14469 spec->auto_mic = 1;
14472 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14474 struct alc_spec *spec = codec->spec;
14475 spec->autocfg.hp_pins[0] = 0x21;
14476 spec->autocfg.speaker_pins[0] = 0x14;
14477 spec->ext_mic.pin = 0x18;
14478 spec->ext_mic.mux_idx = 0;
14479 spec->int_mic.pin = 0x12;
14480 spec->int_mic.mux_idx = 6;
14481 spec->auto_mic = 1;
14484 static void alc269_laptop_inithook(struct hda_codec *codec)
14486 alc269_speaker_automute(codec);
14487 alc_mic_automute(codec);
14491 * generic initialization of ADC, input mixers and output mixers
14493 static struct hda_verb alc269_init_verbs[] = {
14495 * Unmute ADC0 and set the default input to mic-in
14497 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14500 * Set up output mixers (0x02 - 0x03)
14502 /* set vol=0 to output mixers */
14503 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14504 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14506 /* set up input amps for analog loopback */
14507 /* Amp Indices: DAC = 0, mixer = 1 */
14508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14509 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14510 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14511 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14512 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14513 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14515 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14516 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14517 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14518 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14519 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14520 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14521 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14523 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14524 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14526 /* FIXME: use Mux-type input source selection */
14527 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14528 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14529 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14532 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14536 static struct hda_verb alc269vb_init_verbs[] = {
14538 * Unmute ADC0 and set the default input to mic-in
14540 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14543 * Set up output mixers (0x02 - 0x03)
14545 /* set vol=0 to output mixers */
14546 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14547 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14549 /* set up input amps for analog loopback */
14550 /* Amp Indices: DAC = 0, mixer = 1 */
14551 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14553 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14554 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14555 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14556 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14558 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14559 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14560 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14561 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14562 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14563 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14564 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14566 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14567 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14569 /* FIXME: use Mux-type input source selection */
14570 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14571 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14572 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14575 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14579 #define alc269_auto_create_multi_out_ctls \
14580 alc268_auto_create_multi_out_ctls
14581 #define alc269_auto_create_input_ctls \
14582 alc268_auto_create_input_ctls
14584 #ifdef CONFIG_SND_HDA_POWER_SAVE
14585 #define alc269_loopbacks alc880_loopbacks
14588 /* pcm configuration: identical with ALC880 */
14589 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14590 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14591 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14592 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14594 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14598 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14599 /* NID is set in alc_build_pcms */
14601 .open = alc880_playback_pcm_open,
14602 .prepare = alc880_playback_pcm_prepare,
14603 .cleanup = alc880_playback_pcm_cleanup
14607 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14611 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14612 /* NID is set in alc_build_pcms */
14615 #ifdef CONFIG_SND_HDA_POWER_SAVE
14616 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14618 switch (codec->subsystem_id) {
14625 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14627 /* update mute-LED according to the speaker mute state */
14628 if (nid == 0x01 || nid == 0x14) {
14630 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14635 /* mic2 vref pin is used for mute LED control */
14636 snd_hda_codec_update_cache(codec, 0x19, 0,
14637 AC_VERB_SET_PIN_WIDGET_CONTROL,
14640 return alc_check_power_status(codec, nid);
14642 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14644 static int alc275_setup_dual_adc(struct hda_codec *codec)
14646 struct alc_spec *spec = codec->spec;
14648 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14650 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14651 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14652 if (spec->ext_mic.pin <= 0x12) {
14653 spec->private_adc_nids[0] = 0x08;
14654 spec->private_adc_nids[1] = 0x11;
14655 spec->private_capsrc_nids[0] = 0x23;
14656 spec->private_capsrc_nids[1] = 0x22;
14658 spec->private_adc_nids[0] = 0x11;
14659 spec->private_adc_nids[1] = 0x08;
14660 spec->private_capsrc_nids[0] = 0x22;
14661 spec->private_capsrc_nids[1] = 0x23;
14663 spec->adc_nids = spec->private_adc_nids;
14664 spec->capsrc_nids = spec->private_capsrc_nids;
14665 spec->num_adc_nids = 2;
14666 spec->dual_adc_switch = 1;
14667 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14668 spec->adc_nids[0], spec->adc_nids[1]);
14674 /* different alc269-variants */
14676 ALC269_TYPE_NORMAL,
14677 ALC269_TYPE_ALC258,
14678 ALC269_TYPE_ALC259,
14679 ALC269_TYPE_ALC269VB,
14680 ALC269_TYPE_ALC270,
14681 ALC269_TYPE_ALC271X,
14685 * BIOS auto configuration
14687 static int alc269_parse_auto_config(struct hda_codec *codec)
14689 struct alc_spec *spec = codec->spec;
14691 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14693 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14698 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14701 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14702 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14704 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14709 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14711 alc_auto_parse_digital(codec);
14713 if (spec->kctls.list)
14714 add_mixer(spec, spec->kctls.list);
14716 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14717 add_verb(spec, alc269vb_init_verbs);
14718 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14720 add_verb(spec, alc269_init_verbs);
14721 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14724 spec->num_mux_defs = 1;
14725 spec->input_mux = &spec->private_imux[0];
14727 if (!alc275_setup_dual_adc(codec))
14728 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14729 sizeof(alc269_adc_candidates));
14731 /* set default input source */
14732 if (!spec->dual_adc_switch)
14733 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14734 spec->input_mux->items[0].index);
14736 err = alc_auto_add_mic_boost(codec);
14740 if (!spec->cap_mixer && !spec->no_analog)
14741 set_capture_mixer(codec);
14746 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14747 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14748 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14751 /* init callback for auto-configuration model -- overriding the default init */
14752 static void alc269_auto_init(struct hda_codec *codec)
14754 struct alc_spec *spec = codec->spec;
14755 alc269_auto_init_multi_out(codec);
14756 alc269_auto_init_hp_out(codec);
14757 alc269_auto_init_analog_input(codec);
14758 alc_auto_init_digital(codec);
14759 if (spec->unsol_event)
14760 alc_inithook(codec);
14763 #ifdef SND_HDA_NEEDS_RESUME
14764 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14766 int val = alc_read_coef_idx(codec, 0x04);
14771 alc_write_coef_idx(codec, 0x04, val);
14774 #ifdef CONFIG_SND_HDA_POWER_SAVE
14775 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14777 struct alc_spec *spec = codec->spec;
14779 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14780 alc269_toggle_power_output(codec, 0);
14781 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14782 alc269_toggle_power_output(codec, 0);
14787 if (spec && spec->power_hook)
14788 spec->power_hook(codec);
14791 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14793 static int alc269_resume(struct hda_codec *codec)
14795 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14796 alc269_toggle_power_output(codec, 0);
14800 codec->patch_ops.init(codec);
14802 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14803 alc269_toggle_power_output(codec, 1);
14807 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14808 alc269_toggle_power_output(codec, 1);
14810 snd_hda_codec_resume_amp(codec);
14811 snd_hda_codec_resume_cache(codec);
14812 hda_call_check_power_status(codec, 0x01);
14815 #endif /* SND_HDA_NEEDS_RESUME */
14818 ALC269_FIXUP_SONY_VAIO,
14819 ALC275_FIX_SONY_VAIO_GPIO2,
14820 ALC269_FIXUP_DELL_M101Z,
14821 ALC269_FIXUP_SKU_IGNORE,
14822 ALC269_FIXUP_ASUS_G73JW,
14825 static const struct alc_fixup alc269_fixups[] = {
14826 [ALC269_FIXUP_SONY_VAIO] = {
14827 .verbs = (const struct hda_verb[]) {
14828 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14832 [ALC275_FIX_SONY_VAIO_GPIO2] = {
14833 .verbs = (const struct hda_verb[]) {
14834 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14835 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14836 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14840 [ALC269_FIXUP_DELL_M101Z] = {
14841 .verbs = (const struct hda_verb[]) {
14842 /* Enables internal speaker */
14843 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14844 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14848 [ALC269_FIXUP_SKU_IGNORE] = {
14849 .sku = ALC_FIXUP_SKU_IGNORE,
14851 [ALC269_FIXUP_ASUS_G73JW] = {
14852 .pins = (const struct alc_pincfg[]) {
14853 { 0x17, 0x99130111 }, /* subwoofer */
14859 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14860 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2),
14861 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2),
14862 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2),
14863 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14864 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14865 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14866 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14867 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14873 * configuration and preset
14875 static const char *alc269_models[ALC269_MODEL_LAST] = {
14876 [ALC269_BASIC] = "basic",
14877 [ALC269_QUANTA_FL1] = "quanta",
14878 [ALC269_AMIC] = "laptop-amic",
14879 [ALC269_DMIC] = "laptop-dmic",
14880 [ALC269_FUJITSU] = "fujitsu",
14881 [ALC269_LIFEBOOK] = "lifebook",
14882 [ALC269_AUTO] = "auto",
14885 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14886 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14887 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14888 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14890 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14891 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14892 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14893 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14894 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14895 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14896 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14897 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14898 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14899 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14900 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14901 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14902 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14903 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14904 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14905 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14906 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14907 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14908 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14909 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14910 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14911 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14912 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14913 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14914 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14915 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14916 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14917 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14918 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14919 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14920 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14921 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14922 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14923 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14924 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14925 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14926 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14928 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14930 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14931 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14932 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14933 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14934 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14935 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14936 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14937 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14938 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14939 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14943 static struct alc_config_preset alc269_presets[] = {
14945 .mixers = { alc269_base_mixer },
14946 .init_verbs = { alc269_init_verbs },
14947 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14948 .dac_nids = alc269_dac_nids,
14950 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14951 .channel_mode = alc269_modes,
14952 .input_mux = &alc269_capture_source,
14954 [ALC269_QUANTA_FL1] = {
14955 .mixers = { alc269_quanta_fl1_mixer },
14956 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14957 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14958 .dac_nids = alc269_dac_nids,
14960 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14961 .channel_mode = alc269_modes,
14962 .input_mux = &alc269_capture_source,
14963 .unsol_event = alc269_quanta_fl1_unsol_event,
14964 .setup = alc269_quanta_fl1_setup,
14965 .init_hook = alc269_quanta_fl1_init_hook,
14968 .mixers = { alc269_laptop_mixer },
14969 .cap_mixer = alc269_laptop_analog_capture_mixer,
14970 .init_verbs = { alc269_init_verbs,
14971 alc269_laptop_amic_init_verbs },
14972 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14973 .dac_nids = alc269_dac_nids,
14975 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14976 .channel_mode = alc269_modes,
14977 .unsol_event = alc269_laptop_unsol_event,
14978 .setup = alc269_laptop_amic_setup,
14979 .init_hook = alc269_laptop_inithook,
14982 .mixers = { alc269_laptop_mixer },
14983 .cap_mixer = alc269_laptop_digital_capture_mixer,
14984 .init_verbs = { alc269_init_verbs,
14985 alc269_laptop_dmic_init_verbs },
14986 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14987 .dac_nids = alc269_dac_nids,
14989 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14990 .channel_mode = alc269_modes,
14991 .unsol_event = alc269_laptop_unsol_event,
14992 .setup = alc269_laptop_dmic_setup,
14993 .init_hook = alc269_laptop_inithook,
14995 [ALC269VB_AMIC] = {
14996 .mixers = { alc269vb_laptop_mixer },
14997 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14998 .init_verbs = { alc269vb_init_verbs,
14999 alc269vb_laptop_amic_init_verbs },
15000 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15001 .dac_nids = alc269_dac_nids,
15003 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15004 .channel_mode = alc269_modes,
15005 .unsol_event = alc269_laptop_unsol_event,
15006 .setup = alc269vb_laptop_amic_setup,
15007 .init_hook = alc269_laptop_inithook,
15009 [ALC269VB_DMIC] = {
15010 .mixers = { alc269vb_laptop_mixer },
15011 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15012 .init_verbs = { alc269vb_init_verbs,
15013 alc269vb_laptop_dmic_init_verbs },
15014 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15015 .dac_nids = alc269_dac_nids,
15017 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15018 .channel_mode = alc269_modes,
15019 .unsol_event = alc269_laptop_unsol_event,
15020 .setup = alc269vb_laptop_dmic_setup,
15021 .init_hook = alc269_laptop_inithook,
15023 [ALC269_FUJITSU] = {
15024 .mixers = { alc269_fujitsu_mixer },
15025 .cap_mixer = alc269_laptop_digital_capture_mixer,
15026 .init_verbs = { alc269_init_verbs,
15027 alc269_laptop_dmic_init_verbs },
15028 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15029 .dac_nids = alc269_dac_nids,
15031 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15032 .channel_mode = alc269_modes,
15033 .unsol_event = alc269_laptop_unsol_event,
15034 .setup = alc269_laptop_dmic_setup,
15035 .init_hook = alc269_laptop_inithook,
15037 [ALC269_LIFEBOOK] = {
15038 .mixers = { alc269_lifebook_mixer },
15039 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15040 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15041 .dac_nids = alc269_dac_nids,
15043 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15044 .channel_mode = alc269_modes,
15045 .input_mux = &alc269_capture_source,
15046 .unsol_event = alc269_lifebook_unsol_event,
15047 .init_hook = alc269_lifebook_init_hook,
15050 .mixers = { alc269_asus_mixer },
15051 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15052 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15053 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15054 .dac_nids = alc269_dac_nids,
15055 .adc_nids = alc262_dmic_adc_nids,
15056 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15057 .capsrc_nids = alc262_dmic_capsrc_nids,
15058 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15059 .channel_mode = alc269_modes,
15060 .input_mux = &alc269_capture_source,
15061 .dig_out_nid = ALC880_DIGOUT_NID,
15062 .unsol_event = alc_sku_unsol_event,
15063 .setup = alc269vb_laptop_dmic_setup,
15064 .init_hook = alc_inithook,
15068 static int alc269_fill_coef(struct hda_codec *codec)
15072 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15073 alc_write_coef_idx(codec, 0xf, 0x960b);
15074 alc_write_coef_idx(codec, 0xe, 0x8817);
15077 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15078 alc_write_coef_idx(codec, 0xf, 0x960b);
15079 alc_write_coef_idx(codec, 0xe, 0x8814);
15082 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15083 val = alc_read_coef_idx(codec, 0x04);
15084 /* Power up output pin */
15085 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15088 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15089 val = alc_read_coef_idx(codec, 0xd);
15090 if ((val & 0x0c00) >> 10 != 0x1) {
15091 /* Capless ramp up clock control */
15092 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15094 val = alc_read_coef_idx(codec, 0x17);
15095 if ((val & 0x01c0) >> 6 != 0x4) {
15096 /* Class D power on reset */
15097 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15103 static int patch_alc269(struct hda_codec *codec)
15105 struct alc_spec *spec;
15106 int board_config, coef;
15109 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15113 codec->spec = spec;
15115 alc_auto_parse_customize_define(codec);
15117 if (codec->vendor_id == 0x10ec0269) {
15118 coef = alc_read_coef_idx(codec, 0);
15119 if ((coef & 0x00f0) == 0x0010) {
15120 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15121 spec->cdefine.platform_type == 1) {
15122 alc_codec_rename(codec, "ALC271X");
15123 spec->codec_variant = ALC269_TYPE_ALC271X;
15124 } else if ((coef & 0xf000) == 0x1000) {
15125 spec->codec_variant = ALC269_TYPE_ALC270;
15126 } else if ((coef & 0xf000) == 0x2000) {
15127 alc_codec_rename(codec, "ALC259");
15128 spec->codec_variant = ALC269_TYPE_ALC259;
15129 } else if ((coef & 0xf000) == 0x3000) {
15130 alc_codec_rename(codec, "ALC258");
15131 spec->codec_variant = ALC269_TYPE_ALC258;
15133 alc_codec_rename(codec, "ALC269VB");
15134 spec->codec_variant = ALC269_TYPE_ALC269VB;
15137 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15138 alc269_fill_coef(codec);
15141 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15145 if (board_config < 0) {
15146 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15148 board_config = ALC269_AUTO;
15151 if (board_config == ALC269_AUTO)
15152 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
15154 if (board_config == ALC269_AUTO) {
15155 /* automatic parse from the BIOS config */
15156 err = alc269_parse_auto_config(codec);
15162 "hda_codec: Cannot set up configuration "
15163 "from BIOS. Using base mode...\n");
15164 board_config = ALC269_BASIC;
15168 if (has_cdefine_beep(codec)) {
15169 err = snd_hda_attach_beep_device(codec, 0x1);
15176 if (board_config != ALC269_AUTO)
15177 setup_preset(codec, &alc269_presets[board_config]);
15179 if (board_config == ALC269_QUANTA_FL1) {
15180 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15181 * fix the sample rate of analog I/O to 44.1kHz
15183 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15184 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15185 } else if (spec->dual_adc_switch) {
15186 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15187 /* switch ADC dynamically */
15188 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15190 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15191 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15193 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15194 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15196 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15197 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15198 spec->adc_nids = alc269_adc_nids;
15199 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15200 spec->capsrc_nids = alc269_capsrc_nids;
15202 spec->adc_nids = alc269vb_adc_nids;
15203 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15204 spec->capsrc_nids = alc269vb_capsrc_nids;
15208 if (!spec->cap_mixer)
15209 set_capture_mixer(codec);
15210 if (has_cdefine_beep(codec))
15211 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15213 if (board_config == ALC269_AUTO)
15214 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
15216 spec->vmaster_nid = 0x02;
15218 codec->patch_ops = alc_patch_ops;
15219 #ifdef CONFIG_SND_HDA_POWER_SAVE
15220 codec->patch_ops.suspend = alc269_suspend;
15222 #ifdef SND_HDA_NEEDS_RESUME
15223 codec->patch_ops.resume = alc269_resume;
15225 if (board_config == ALC269_AUTO)
15226 spec->init_hook = alc269_auto_init;
15228 alc_init_jacks(codec);
15229 #ifdef CONFIG_SND_HDA_POWER_SAVE
15230 if (!spec->loopback.amplist)
15231 spec->loopback.amplist = alc269_loopbacks;
15232 if (alc269_mic2_for_mute_led(codec))
15233 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15240 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15244 * set the path ways for 2 channel output
15245 * need to set the codec line out and mic 1 pin widgets to inputs
15247 static struct hda_verb alc861_threestack_ch2_init[] = {
15248 /* set pin widget 1Ah (line in) for input */
15249 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15250 /* set pin widget 18h (mic1/2) for input, for mic also enable
15253 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15255 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15257 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15258 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15264 * need to set the codec line out and mic 1 pin widgets to outputs
15266 static struct hda_verb alc861_threestack_ch6_init[] = {
15267 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15268 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15269 /* set pin widget 18h (mic1) for output (CLFE)*/
15270 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15272 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15273 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15275 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15277 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15278 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15283 static struct hda_channel_mode alc861_threestack_modes[2] = {
15284 { 2, alc861_threestack_ch2_init },
15285 { 6, alc861_threestack_ch6_init },
15287 /* Set mic1 as input and unmute the mixer */
15288 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15289 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15290 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15293 /* Set mic1 as output and mute mixer */
15294 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15295 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15296 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15300 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15301 { 2, alc861_uniwill_m31_ch2_init },
15302 { 4, alc861_uniwill_m31_ch4_init },
15305 /* Set mic1 and line-in as input and unmute the mixer */
15306 static struct hda_verb alc861_asus_ch2_init[] = {
15307 /* set pin widget 1Ah (line in) for input */
15308 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15309 /* set pin widget 18h (mic1/2) for input, for mic also enable
15312 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15314 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15316 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15317 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15321 /* Set mic1 nad line-in as output and mute mixer */
15322 static struct hda_verb alc861_asus_ch6_init[] = {
15323 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15324 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15325 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15326 /* set pin widget 18h (mic1) for output (CLFE)*/
15327 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15328 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15329 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15330 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15332 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15334 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15335 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15340 static struct hda_channel_mode alc861_asus_modes[2] = {
15341 { 2, alc861_asus_ch2_init },
15342 { 6, alc861_asus_ch6_init },
15347 static struct snd_kcontrol_new alc861_base_mixer[] = {
15348 /* output mixer control */
15349 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15350 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15351 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15352 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15353 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15355 /*Input mixer control */
15356 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15357 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15358 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15359 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15360 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15361 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15362 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15363 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15364 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15365 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15370 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15371 /* output mixer control */
15372 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15373 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15374 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15375 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15376 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15378 /* Input mixer control */
15379 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15380 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15381 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15382 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15383 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15384 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15386 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15387 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15388 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15391 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15392 .name = "Channel Mode",
15393 .info = alc_ch_mode_info,
15394 .get = alc_ch_mode_get,
15395 .put = alc_ch_mode_put,
15396 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15401 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15402 /* output mixer control */
15403 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15404 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15405 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15410 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15411 /* output mixer control */
15412 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15413 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15414 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15415 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15416 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15418 /* Input mixer control */
15419 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15420 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15421 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15422 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15423 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15424 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15425 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15426 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15427 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15428 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15431 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15432 .name = "Channel Mode",
15433 .info = alc_ch_mode_info,
15434 .get = alc_ch_mode_get,
15435 .put = alc_ch_mode_put,
15436 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15441 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15442 /* output mixer control */
15443 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15444 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15445 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15446 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15447 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15449 /* Input mixer control */
15450 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15451 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15452 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15453 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15454 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15455 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15456 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15457 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15458 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15462 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15463 .name = "Channel Mode",
15464 .info = alc_ch_mode_info,
15465 .get = alc_ch_mode_get,
15466 .put = alc_ch_mode_put,
15467 .private_value = ARRAY_SIZE(alc861_asus_modes),
15472 /* additional mixer */
15473 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15474 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15475 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15480 * generic initialization of ADC, input mixers and output mixers
15482 static struct hda_verb alc861_base_init_verbs[] = {
15484 * Unmute ADC0 and set the default input to mic-in
15486 /* port-A for surround (rear panel) */
15487 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15488 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15489 /* port-B for mic-in (rear panel) with vref */
15490 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15491 /* port-C for line-in (rear panel) */
15492 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15493 /* port-D for Front */
15494 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15495 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15496 /* port-E for HP out (front panel) */
15497 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15498 /* route front PCM to HP */
15499 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15500 /* port-F for mic-in (front panel) with vref */
15501 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15502 /* port-G for CLFE (rear panel) */
15503 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15504 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15505 /* port-H for side (rear panel) */
15506 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15507 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15509 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15510 /* route front mic to ADC1*/
15511 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15512 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15514 /* Unmute DAC0~3 & spdif out*/
15515 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15516 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15517 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15518 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15519 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15521 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15522 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15523 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15524 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15525 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15527 /* Unmute Stereo Mixer 15 */
15528 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15529 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15530 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15531 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15533 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15534 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15535 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15536 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15537 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15538 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15539 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15540 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15541 /* hp used DAC 3 (Front) */
15542 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15543 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15548 static struct hda_verb alc861_threestack_init_verbs[] = {
15550 * Unmute ADC0 and set the default input to mic-in
15552 /* port-A for surround (rear panel) */
15553 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15554 /* port-B for mic-in (rear panel) with vref */
15555 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15556 /* port-C for line-in (rear panel) */
15557 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15558 /* port-D for Front */
15559 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15560 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15561 /* port-E for HP out (front panel) */
15562 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15563 /* route front PCM to HP */
15564 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15565 /* port-F for mic-in (front panel) with vref */
15566 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15567 /* port-G for CLFE (rear panel) */
15568 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15569 /* port-H for side (rear panel) */
15570 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15572 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15573 /* route front mic to ADC1*/
15574 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15575 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15576 /* Unmute DAC0~3 & spdif out*/
15577 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15578 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15579 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15580 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15583 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15584 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15585 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15586 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15587 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15589 /* Unmute Stereo Mixer 15 */
15590 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15591 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15592 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15593 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15595 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15596 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15597 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15598 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15599 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15600 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15601 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15602 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15603 /* hp used DAC 3 (Front) */
15604 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15605 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15609 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15611 * Unmute ADC0 and set the default input to mic-in
15613 /* port-A for surround (rear panel) */
15614 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15615 /* port-B for mic-in (rear panel) with vref */
15616 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15617 /* port-C for line-in (rear panel) */
15618 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15619 /* port-D for Front */
15620 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15621 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15622 /* port-E for HP out (front panel) */
15623 /* this has to be set to VREF80 */
15624 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15625 /* route front PCM to HP */
15626 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15627 /* port-F for mic-in (front panel) with vref */
15628 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15629 /* port-G for CLFE (rear panel) */
15630 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15631 /* port-H for side (rear panel) */
15632 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15634 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15635 /* route front mic to ADC1*/
15636 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15637 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15638 /* Unmute DAC0~3 & spdif out*/
15639 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15640 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15641 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15642 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15643 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15645 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15646 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15647 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15648 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15649 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15651 /* Unmute Stereo Mixer 15 */
15652 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15653 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15654 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15655 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15657 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15658 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15659 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15660 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15661 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15662 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15663 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15664 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15665 /* hp used DAC 3 (Front) */
15666 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15667 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15671 static struct hda_verb alc861_asus_init_verbs[] = {
15673 * Unmute ADC0 and set the default input to mic-in
15675 /* port-A for surround (rear panel)
15676 * according to codec#0 this is the HP jack
15678 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15679 /* route front PCM to HP */
15680 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15681 /* port-B for mic-in (rear panel) with vref */
15682 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15683 /* port-C for line-in (rear panel) */
15684 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15685 /* port-D for Front */
15686 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15687 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15688 /* port-E for HP out (front panel) */
15689 /* this has to be set to VREF80 */
15690 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15691 /* route front PCM to HP */
15692 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15693 /* port-F for mic-in (front panel) with vref */
15694 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15695 /* port-G for CLFE (rear panel) */
15696 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15697 /* port-H for side (rear panel) */
15698 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15700 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15701 /* route front mic to ADC1*/
15702 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15703 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15704 /* Unmute DAC0~3 & spdif out*/
15705 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15706 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15707 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15708 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15709 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15710 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15711 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15712 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15713 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15714 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15716 /* Unmute Stereo Mixer 15 */
15717 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15718 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15719 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15720 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15722 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15723 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15724 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15725 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15726 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15727 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15728 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15729 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15730 /* hp used DAC 3 (Front) */
15731 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15732 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15736 /* additional init verbs for ASUS laptops */
15737 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15738 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15739 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15744 * generic initialization of ADC, input mixers and output mixers
15746 static struct hda_verb alc861_auto_init_verbs[] = {
15748 * Unmute ADC0 and set the default input to mic-in
15750 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15751 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15753 /* Unmute DAC0~3 & spdif out*/
15754 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15755 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15756 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15757 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15758 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15760 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15761 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15762 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15763 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15764 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15766 /* Unmute Stereo Mixer 15 */
15767 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15769 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15772 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15773 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15774 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15775 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15776 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15777 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15778 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15779 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15781 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15782 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15783 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15784 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15785 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15786 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15787 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15788 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15790 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15795 static struct hda_verb alc861_toshiba_init_verbs[] = {
15796 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15801 /* toggle speaker-output according to the hp-jack state */
15802 static void alc861_toshiba_automute(struct hda_codec *codec)
15804 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15806 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15807 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15808 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15809 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15812 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15815 if ((res >> 26) == ALC880_HP_EVENT)
15816 alc861_toshiba_automute(codec);
15819 /* pcm configuration: identical with ALC880 */
15820 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15821 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15822 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15823 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15826 #define ALC861_DIGOUT_NID 0x07
15828 static struct hda_channel_mode alc861_8ch_modes[1] = {
15832 static hda_nid_t alc861_dac_nids[4] = {
15833 /* front, surround, clfe, side */
15834 0x03, 0x06, 0x05, 0x04
15837 static hda_nid_t alc660_dac_nids[3] = {
15838 /* front, clfe, surround */
15842 static hda_nid_t alc861_adc_nids[1] = {
15847 static struct hda_input_mux alc861_capture_source = {
15851 { "Front Mic", 0x3 },
15858 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15860 struct alc_spec *spec = codec->spec;
15861 hda_nid_t mix, srcs[5];
15864 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15866 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15869 for (i = 0; i < num; i++) {
15871 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15872 if (type != AC_WID_AUD_OUT)
15874 for (j = 0; j < spec->multiout.num_dacs; j++)
15875 if (spec->multiout.dac_nids[j] == srcs[i])
15877 if (j >= spec->multiout.num_dacs)
15883 /* fill in the dac_nids table from the parsed pin configuration */
15884 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15885 const struct auto_pin_cfg *cfg)
15887 struct alc_spec *spec = codec->spec;
15889 hda_nid_t nid, dac;
15891 spec->multiout.dac_nids = spec->private_dac_nids;
15892 for (i = 0; i < cfg->line_outs; i++) {
15893 nid = cfg->line_out_pins[i];
15894 dac = alc861_look_for_dac(codec, nid);
15897 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15902 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15903 hda_nid_t nid, int idx, unsigned int chs)
15905 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
15906 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15909 #define alc861_create_out_sw(codec, pfx, nid, chs) \
15910 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
15912 /* add playback controls from the parsed DAC table */
15913 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15914 const struct auto_pin_cfg *cfg)
15916 struct alc_spec *spec = codec->spec;
15917 static const char *chname[4] = {
15918 "Front", "Surround", NULL /*CLFE*/, "Side"
15920 const char *pfx = alc_get_line_out_pfx(cfg, true);
15924 for (i = 0; i < cfg->line_outs; i++) {
15925 nid = spec->multiout.dac_nids[i];
15928 if (!pfx && i == 2) {
15930 err = alc861_create_out_sw(codec, "Center", nid, 1);
15933 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15937 const char *name = pfx;
15940 err = __alc861_create_out_sw(codec, name, nid, i, 3);
15948 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15950 struct alc_spec *spec = codec->spec;
15957 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15958 nid = alc861_look_for_dac(codec, pin);
15960 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15963 spec->multiout.hp_nid = nid;
15969 /* create playback/capture controls for input pins */
15970 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15971 const struct auto_pin_cfg *cfg)
15973 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15976 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15978 int pin_type, hda_nid_t dac)
15980 hda_nid_t mix, srcs[5];
15983 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15985 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15987 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15989 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15992 for (i = 0; i < num; i++) {
15994 if (srcs[i] == dac || srcs[i] == 0x15)
15995 mute = AMP_IN_UNMUTE(i);
15997 mute = AMP_IN_MUTE(i);
15998 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16003 static void alc861_auto_init_multi_out(struct hda_codec *codec)
16005 struct alc_spec *spec = codec->spec;
16008 for (i = 0; i < spec->autocfg.line_outs; i++) {
16009 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16010 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16012 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
16013 spec->multiout.dac_nids[i]);
16017 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16019 struct alc_spec *spec = codec->spec;
16021 if (spec->autocfg.hp_outs)
16022 alc861_auto_set_output_and_unmute(codec,
16023 spec->autocfg.hp_pins[0],
16025 spec->multiout.hp_nid);
16026 if (spec->autocfg.speaker_outs)
16027 alc861_auto_set_output_and_unmute(codec,
16028 spec->autocfg.speaker_pins[0],
16030 spec->multiout.dac_nids[0]);
16033 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16035 struct alc_spec *spec = codec->spec;
16036 struct auto_pin_cfg *cfg = &spec->autocfg;
16039 for (i = 0; i < cfg->num_inputs; i++) {
16040 hda_nid_t nid = cfg->inputs[i].pin;
16041 if (nid >= 0x0c && nid <= 0x11)
16042 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16046 /* parse the BIOS configuration and set up the alc_spec */
16047 /* return 1 if successful, 0 if the proper config is not found,
16048 * or a negative error code
16050 static int alc861_parse_auto_config(struct hda_codec *codec)
16052 struct alc_spec *spec = codec->spec;
16054 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16056 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16060 if (!spec->autocfg.line_outs)
16061 return 0; /* can't find valid BIOS pin config */
16063 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16066 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16069 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16072 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16076 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16078 alc_auto_parse_digital(codec);
16080 if (spec->kctls.list)
16081 add_mixer(spec, spec->kctls.list);
16083 add_verb(spec, alc861_auto_init_verbs);
16085 spec->num_mux_defs = 1;
16086 spec->input_mux = &spec->private_imux[0];
16088 spec->adc_nids = alc861_adc_nids;
16089 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16090 set_capture_mixer(codec);
16092 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16097 /* additional initialization for auto-configuration model */
16098 static void alc861_auto_init(struct hda_codec *codec)
16100 struct alc_spec *spec = codec->spec;
16101 alc861_auto_init_multi_out(codec);
16102 alc861_auto_init_hp_out(codec);
16103 alc861_auto_init_analog_input(codec);
16104 alc_auto_init_digital(codec);
16105 if (spec->unsol_event)
16106 alc_inithook(codec);
16109 #ifdef CONFIG_SND_HDA_POWER_SAVE
16110 static struct hda_amp_list alc861_loopbacks[] = {
16111 { 0x15, HDA_INPUT, 0 },
16112 { 0x15, HDA_INPUT, 1 },
16113 { 0x15, HDA_INPUT, 2 },
16114 { 0x15, HDA_INPUT, 3 },
16121 * configuration and preset
16123 static const char *alc861_models[ALC861_MODEL_LAST] = {
16124 [ALC861_3ST] = "3stack",
16125 [ALC660_3ST] = "3stack-660",
16126 [ALC861_3ST_DIG] = "3stack-dig",
16127 [ALC861_6ST_DIG] = "6stack-dig",
16128 [ALC861_UNIWILL_M31] = "uniwill-m31",
16129 [ALC861_TOSHIBA] = "toshiba",
16130 [ALC861_ASUS] = "asus",
16131 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16132 [ALC861_AUTO] = "auto",
16135 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16136 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16137 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16138 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16139 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16140 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16141 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16142 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16143 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16144 * Any other models that need this preset?
16146 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16147 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16148 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16149 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16150 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16151 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16152 /* FIXME: the below seems conflict */
16153 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16154 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16155 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16159 static struct alc_config_preset alc861_presets[] = {
16161 .mixers = { alc861_3ST_mixer },
16162 .init_verbs = { alc861_threestack_init_verbs },
16163 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16164 .dac_nids = alc861_dac_nids,
16165 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16166 .channel_mode = alc861_threestack_modes,
16168 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16169 .adc_nids = alc861_adc_nids,
16170 .input_mux = &alc861_capture_source,
16172 [ALC861_3ST_DIG] = {
16173 .mixers = { alc861_base_mixer },
16174 .init_verbs = { alc861_threestack_init_verbs },
16175 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16176 .dac_nids = alc861_dac_nids,
16177 .dig_out_nid = ALC861_DIGOUT_NID,
16178 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16179 .channel_mode = alc861_threestack_modes,
16181 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16182 .adc_nids = alc861_adc_nids,
16183 .input_mux = &alc861_capture_source,
16185 [ALC861_6ST_DIG] = {
16186 .mixers = { alc861_base_mixer },
16187 .init_verbs = { alc861_base_init_verbs },
16188 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16189 .dac_nids = alc861_dac_nids,
16190 .dig_out_nid = ALC861_DIGOUT_NID,
16191 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16192 .channel_mode = alc861_8ch_modes,
16193 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16194 .adc_nids = alc861_adc_nids,
16195 .input_mux = &alc861_capture_source,
16198 .mixers = { alc861_3ST_mixer },
16199 .init_verbs = { alc861_threestack_init_verbs },
16200 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16201 .dac_nids = alc660_dac_nids,
16202 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16203 .channel_mode = alc861_threestack_modes,
16205 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16206 .adc_nids = alc861_adc_nids,
16207 .input_mux = &alc861_capture_source,
16209 [ALC861_UNIWILL_M31] = {
16210 .mixers = { alc861_uniwill_m31_mixer },
16211 .init_verbs = { alc861_uniwill_m31_init_verbs },
16212 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16213 .dac_nids = alc861_dac_nids,
16214 .dig_out_nid = ALC861_DIGOUT_NID,
16215 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16216 .channel_mode = alc861_uniwill_m31_modes,
16218 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16219 .adc_nids = alc861_adc_nids,
16220 .input_mux = &alc861_capture_source,
16222 [ALC861_TOSHIBA] = {
16223 .mixers = { alc861_toshiba_mixer },
16224 .init_verbs = { alc861_base_init_verbs,
16225 alc861_toshiba_init_verbs },
16226 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16227 .dac_nids = alc861_dac_nids,
16228 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16229 .channel_mode = alc883_3ST_2ch_modes,
16230 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16231 .adc_nids = alc861_adc_nids,
16232 .input_mux = &alc861_capture_source,
16233 .unsol_event = alc861_toshiba_unsol_event,
16234 .init_hook = alc861_toshiba_automute,
16237 .mixers = { alc861_asus_mixer },
16238 .init_verbs = { alc861_asus_init_verbs },
16239 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16240 .dac_nids = alc861_dac_nids,
16241 .dig_out_nid = ALC861_DIGOUT_NID,
16242 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16243 .channel_mode = alc861_asus_modes,
16246 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16247 .adc_nids = alc861_adc_nids,
16248 .input_mux = &alc861_capture_source,
16250 [ALC861_ASUS_LAPTOP] = {
16251 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16252 .init_verbs = { alc861_asus_init_verbs,
16253 alc861_asus_laptop_init_verbs },
16254 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16255 .dac_nids = alc861_dac_nids,
16256 .dig_out_nid = ALC861_DIGOUT_NID,
16257 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16258 .channel_mode = alc883_3ST_2ch_modes,
16260 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16261 .adc_nids = alc861_adc_nids,
16262 .input_mux = &alc861_capture_source,
16266 /* Pin config fixes */
16268 PINFIX_FSC_AMILO_PI1505,
16271 static const struct alc_fixup alc861_fixups[] = {
16272 [PINFIX_FSC_AMILO_PI1505] = {
16273 .pins = (const struct alc_pincfg[]) {
16274 { 0x0b, 0x0221101f }, /* HP */
16275 { 0x0f, 0x90170310 }, /* speaker */
16281 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16282 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16286 static int patch_alc861(struct hda_codec *codec)
16288 struct alc_spec *spec;
16292 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16296 codec->spec = spec;
16298 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16302 if (board_config < 0) {
16303 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16305 board_config = ALC861_AUTO;
16308 if (board_config == ALC861_AUTO)
16309 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
16311 if (board_config == ALC861_AUTO) {
16312 /* automatic parse from the BIOS config */
16313 err = alc861_parse_auto_config(codec);
16319 "hda_codec: Cannot set up configuration "
16320 "from BIOS. Using base mode...\n");
16321 board_config = ALC861_3ST_DIG;
16325 err = snd_hda_attach_beep_device(codec, 0x23);
16331 if (board_config != ALC861_AUTO)
16332 setup_preset(codec, &alc861_presets[board_config]);
16334 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16335 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16337 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16338 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16340 if (!spec->cap_mixer)
16341 set_capture_mixer(codec);
16342 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16344 spec->vmaster_nid = 0x03;
16346 if (board_config == ALC861_AUTO)
16347 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
16349 codec->patch_ops = alc_patch_ops;
16350 if (board_config == ALC861_AUTO) {
16351 spec->init_hook = alc861_auto_init;
16352 #ifdef CONFIG_SND_HDA_POWER_SAVE
16353 spec->power_hook = alc_power_eapd;
16356 #ifdef CONFIG_SND_HDA_POWER_SAVE
16357 if (!spec->loopback.amplist)
16358 spec->loopback.amplist = alc861_loopbacks;
16365 * ALC861-VD support
16369 * In addition, an independent DAC
16371 #define ALC861VD_DIGOUT_NID 0x06
16373 static hda_nid_t alc861vd_dac_nids[4] = {
16374 /* front, surr, clfe, side surr */
16375 0x02, 0x03, 0x04, 0x05
16378 /* dac_nids for ALC660vd are in a different order - according to
16379 * Realtek's driver.
16380 * This should probably result in a different mixer for 6stack models
16381 * of ALC660vd codecs, but for now there is only 3stack mixer
16382 * - and it is the same as in 861vd.
16383 * adc_nids in ALC660vd are (is) the same as in 861vd
16385 static hda_nid_t alc660vd_dac_nids[3] = {
16386 /* front, rear, clfe, rear_surr */
16390 static hda_nid_t alc861vd_adc_nids[1] = {
16395 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16398 /* FIXME: should be a matrix-type input source selection */
16399 static struct hda_input_mux alc861vd_capture_source = {
16403 { "Front Mic", 0x1 },
16409 static struct hda_input_mux alc861vd_dallas_capture_source = {
16413 { "Internal Mic", 0x1 },
16417 static struct hda_input_mux alc861vd_hp_capture_source = {
16420 { "Front Mic", 0x0 },
16421 { "ATAPI Mic", 0x1 },
16428 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16435 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16436 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16437 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16438 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16439 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16446 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16447 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16448 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16449 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16450 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16454 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16455 { 6, alc861vd_6stack_ch6_init },
16456 { 8, alc861vd_6stack_ch8_init },
16459 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16461 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16462 .name = "Channel Mode",
16463 .info = alc_ch_mode_info,
16464 .get = alc_ch_mode_get,
16465 .put = alc_ch_mode_put,
16470 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16471 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16473 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16474 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16475 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16477 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16478 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16480 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16482 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16484 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16485 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16487 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16488 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16490 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16492 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16493 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16494 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16496 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16497 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16498 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16500 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16501 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16503 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16504 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16509 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16510 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16511 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16513 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16515 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16516 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16517 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16519 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16520 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16521 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16523 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16524 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16526 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16527 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16532 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16533 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16534 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16535 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16537 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16539 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16540 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16541 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16543 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16544 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16545 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16547 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16548 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16553 /* Pin assignment: Speaker=0x14, HP = 0x15,
16554 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16556 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16557 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16558 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16559 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16560 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16561 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16562 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16563 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16564 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16565 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16566 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16570 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16571 * Front Mic=0x18, ATAPI Mic = 0x19,
16573 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16574 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16575 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16576 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16577 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16578 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16579 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16580 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16581 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16587 * generic initialization of ADC, input mixers and output mixers
16589 static struct hda_verb alc861vd_volume_init_verbs[] = {
16591 * Unmute ADC0 and set the default input to mic-in
16593 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16594 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16596 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16597 * the analog-loopback mixer widget
16599 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16600 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16601 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16602 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16603 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16604 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16606 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16607 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16608 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16610 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16613 * Set up output mixers (0x02 - 0x05)
16615 /* set vol=0 to output mixers */
16616 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16617 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16618 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16619 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16621 /* set up input amps for analog loopback */
16622 /* Amp Indices: DAC = 0, mixer = 1 */
16623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16625 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16626 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16627 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16628 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16629 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16630 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16636 * 3-stack pin configuration:
16637 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16639 static struct hda_verb alc861vd_3stack_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 /* Mic (rear) pin: input vref at 80% */
16649 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16650 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16651 /* Front Mic pin: input vref at 80% */
16652 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16653 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16654 /* Line In pin: input */
16655 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16656 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16657 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16658 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16659 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16660 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16661 /* CD pin widget for input */
16662 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16668 * 6-stack pin configuration:
16670 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16672 * Set pin mode and muting
16674 /* set front pin widgets 0x14 for output */
16675 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16676 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16677 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16679 /* Rear Pin: output 1 (0x0d) */
16680 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16681 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16682 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16683 /* CLFE Pin: output 2 (0x0e) */
16684 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16685 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16686 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16687 /* Side Pin: output 3 (0x0f) */
16688 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16689 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16690 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16692 /* Mic (rear) pin: input vref at 80% */
16693 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16694 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16695 /* Front Mic pin: input vref at 80% */
16696 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16697 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16698 /* Line In pin: input */
16699 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16700 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16701 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16702 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16703 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16704 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16705 /* CD pin widget for input */
16706 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16711 static struct hda_verb alc861vd_eapd_verbs[] = {
16712 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16716 static struct hda_verb alc660vd_eapd_verbs[] = {
16717 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16718 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16722 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16723 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16726 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16727 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16731 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16733 struct alc_spec *spec = codec->spec;
16734 spec->autocfg.hp_pins[0] = 0x1b;
16735 spec->autocfg.speaker_pins[0] = 0x14;
16738 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16740 alc_automute_amp(codec);
16741 alc88x_simple_mic_automute(codec);
16744 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16747 switch (res >> 26) {
16748 case ALC880_MIC_EVENT:
16749 alc88x_simple_mic_automute(codec);
16752 alc_automute_amp_unsol_event(codec, res);
16757 static struct hda_verb alc861vd_dallas_verbs[] = {
16758 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16759 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16760 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16761 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16763 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16764 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16765 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16766 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16767 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16768 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16769 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16770 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16772 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16774 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16776 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16777 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16778 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16779 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16781 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16782 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16783 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16784 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16785 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16786 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16787 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16788 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16791 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16792 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16793 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16795 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16796 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16797 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16802 /* toggle speaker-output according to the hp-jack state */
16803 static void alc861vd_dallas_setup(struct hda_codec *codec)
16805 struct alc_spec *spec = codec->spec;
16807 spec->autocfg.hp_pins[0] = 0x15;
16808 spec->autocfg.speaker_pins[0] = 0x14;
16811 #ifdef CONFIG_SND_HDA_POWER_SAVE
16812 #define alc861vd_loopbacks alc880_loopbacks
16815 /* pcm configuration: identical with ALC880 */
16816 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16817 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16818 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16819 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16822 * configuration and preset
16824 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16825 [ALC660VD_3ST] = "3stack-660",
16826 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16827 [ALC660VD_ASUS_V1S] = "asus-v1s",
16828 [ALC861VD_3ST] = "3stack",
16829 [ALC861VD_3ST_DIG] = "3stack-digout",
16830 [ALC861VD_6ST_DIG] = "6stack-digout",
16831 [ALC861VD_LENOVO] = "lenovo",
16832 [ALC861VD_DALLAS] = "dallas",
16833 [ALC861VD_HP] = "hp",
16834 [ALC861VD_AUTO] = "auto",
16837 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16838 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16839 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16840 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16841 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16842 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16843 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16844 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16845 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16846 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16847 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16848 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16849 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16850 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16851 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16852 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16856 static struct alc_config_preset alc861vd_presets[] = {
16858 .mixers = { alc861vd_3st_mixer },
16859 .init_verbs = { alc861vd_volume_init_verbs,
16860 alc861vd_3stack_init_verbs },
16861 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16862 .dac_nids = alc660vd_dac_nids,
16863 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16864 .channel_mode = alc861vd_3stack_2ch_modes,
16865 .input_mux = &alc861vd_capture_source,
16867 [ALC660VD_3ST_DIG] = {
16868 .mixers = { alc861vd_3st_mixer },
16869 .init_verbs = { alc861vd_volume_init_verbs,
16870 alc861vd_3stack_init_verbs },
16871 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16872 .dac_nids = alc660vd_dac_nids,
16873 .dig_out_nid = ALC861VD_DIGOUT_NID,
16874 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16875 .channel_mode = alc861vd_3stack_2ch_modes,
16876 .input_mux = &alc861vd_capture_source,
16879 .mixers = { alc861vd_3st_mixer },
16880 .init_verbs = { alc861vd_volume_init_verbs,
16881 alc861vd_3stack_init_verbs },
16882 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16883 .dac_nids = alc861vd_dac_nids,
16884 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16885 .channel_mode = alc861vd_3stack_2ch_modes,
16886 .input_mux = &alc861vd_capture_source,
16888 [ALC861VD_3ST_DIG] = {
16889 .mixers = { alc861vd_3st_mixer },
16890 .init_verbs = { alc861vd_volume_init_verbs,
16891 alc861vd_3stack_init_verbs },
16892 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16893 .dac_nids = alc861vd_dac_nids,
16894 .dig_out_nid = ALC861VD_DIGOUT_NID,
16895 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16896 .channel_mode = alc861vd_3stack_2ch_modes,
16897 .input_mux = &alc861vd_capture_source,
16899 [ALC861VD_6ST_DIG] = {
16900 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16901 .init_verbs = { alc861vd_volume_init_verbs,
16902 alc861vd_6stack_init_verbs },
16903 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16904 .dac_nids = alc861vd_dac_nids,
16905 .dig_out_nid = ALC861VD_DIGOUT_NID,
16906 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16907 .channel_mode = alc861vd_6stack_modes,
16908 .input_mux = &alc861vd_capture_source,
16910 [ALC861VD_LENOVO] = {
16911 .mixers = { alc861vd_lenovo_mixer },
16912 .init_verbs = { alc861vd_volume_init_verbs,
16913 alc861vd_3stack_init_verbs,
16914 alc861vd_eapd_verbs,
16915 alc861vd_lenovo_unsol_verbs },
16916 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16917 .dac_nids = alc660vd_dac_nids,
16918 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16919 .channel_mode = alc861vd_3stack_2ch_modes,
16920 .input_mux = &alc861vd_capture_source,
16921 .unsol_event = alc861vd_lenovo_unsol_event,
16922 .setup = alc861vd_lenovo_setup,
16923 .init_hook = alc861vd_lenovo_init_hook,
16925 [ALC861VD_DALLAS] = {
16926 .mixers = { alc861vd_dallas_mixer },
16927 .init_verbs = { alc861vd_dallas_verbs },
16928 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16929 .dac_nids = alc861vd_dac_nids,
16930 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16931 .channel_mode = alc861vd_3stack_2ch_modes,
16932 .input_mux = &alc861vd_dallas_capture_source,
16933 .unsol_event = alc_automute_amp_unsol_event,
16934 .setup = alc861vd_dallas_setup,
16935 .init_hook = alc_automute_amp,
16938 .mixers = { alc861vd_hp_mixer },
16939 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16940 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16941 .dac_nids = alc861vd_dac_nids,
16942 .dig_out_nid = ALC861VD_DIGOUT_NID,
16943 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16944 .channel_mode = alc861vd_3stack_2ch_modes,
16945 .input_mux = &alc861vd_hp_capture_source,
16946 .unsol_event = alc_automute_amp_unsol_event,
16947 .setup = alc861vd_dallas_setup,
16948 .init_hook = alc_automute_amp,
16950 [ALC660VD_ASUS_V1S] = {
16951 .mixers = { alc861vd_lenovo_mixer },
16952 .init_verbs = { alc861vd_volume_init_verbs,
16953 alc861vd_3stack_init_verbs,
16954 alc861vd_eapd_verbs,
16955 alc861vd_lenovo_unsol_verbs },
16956 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16957 .dac_nids = alc660vd_dac_nids,
16958 .dig_out_nid = ALC861VD_DIGOUT_NID,
16959 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16960 .channel_mode = alc861vd_3stack_2ch_modes,
16961 .input_mux = &alc861vd_capture_source,
16962 .unsol_event = alc861vd_lenovo_unsol_event,
16963 .setup = alc861vd_lenovo_setup,
16964 .init_hook = alc861vd_lenovo_init_hook,
16969 * BIOS auto configuration
16971 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16972 const struct auto_pin_cfg *cfg)
16974 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
16978 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16979 hda_nid_t nid, int pin_type, int dac_idx)
16981 alc_set_pin_output(codec, nid, pin_type);
16984 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16986 struct alc_spec *spec = codec->spec;
16989 for (i = 0; i <= HDA_SIDE; i++) {
16990 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16991 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16993 alc861vd_auto_set_output_and_unmute(codec, nid,
16999 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
17001 struct alc_spec *spec = codec->spec;
17004 pin = spec->autocfg.hp_pins[0];
17005 if (pin) /* connect to front and use dac 0 */
17006 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17007 pin = spec->autocfg.speaker_pins[0];
17009 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17012 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17014 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17016 struct alc_spec *spec = codec->spec;
17017 struct auto_pin_cfg *cfg = &spec->autocfg;
17020 for (i = 0; i < cfg->num_inputs; i++) {
17021 hda_nid_t nid = cfg->inputs[i].pin;
17022 if (alc_is_input_pin(codec, nid)) {
17023 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17024 if (nid != ALC861VD_PIN_CD_NID &&
17025 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17026 snd_hda_codec_write(codec, nid, 0,
17027 AC_VERB_SET_AMP_GAIN_MUTE,
17033 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17035 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17036 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17038 /* add playback controls from the parsed DAC table */
17039 /* Based on ALC880 version. But ALC861VD has separate,
17040 * different NIDs for mute/unmute switch and volume control */
17041 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17042 const struct auto_pin_cfg *cfg)
17044 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
17045 const char *pfx = alc_get_line_out_pfx(cfg, true);
17046 hda_nid_t nid_v, nid_s;
17049 for (i = 0; i < cfg->line_outs; i++) {
17050 if (!spec->multiout.dac_nids[i])
17052 nid_v = alc861vd_idx_to_mixer_vol(
17054 spec->multiout.dac_nids[i]));
17055 nid_s = alc861vd_idx_to_mixer_switch(
17057 spec->multiout.dac_nids[i]));
17059 if (!pfx && i == 2) {
17061 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17063 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17067 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17069 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17073 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17075 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17079 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17081 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17086 const char *name = pfx;
17089 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17091 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17095 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17097 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17106 /* add playback controls for speaker and HP outputs */
17107 /* Based on ALC880 version. But ALC861VD has separate,
17108 * different NIDs for mute/unmute switch and volume control */
17109 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17110 hda_nid_t pin, const char *pfx)
17112 hda_nid_t nid_v, nid_s;
17118 if (alc880_is_fixed_pin(pin)) {
17119 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17120 /* specify the DAC as the extra output */
17121 if (!spec->multiout.hp_nid)
17122 spec->multiout.hp_nid = nid_v;
17124 spec->multiout.extra_out_nid[0] = nid_v;
17125 /* control HP volume/switch on the output mixer amp */
17126 nid_v = alc861vd_idx_to_mixer_vol(
17127 alc880_fixed_pin_idx(pin));
17128 nid_s = alc861vd_idx_to_mixer_switch(
17129 alc880_fixed_pin_idx(pin));
17131 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17132 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17135 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17136 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17139 } else if (alc880_is_multi_pin(pin)) {
17140 /* set manual connection */
17141 /* we have only a switch on HP-out PIN */
17142 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17143 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17150 /* parse the BIOS configuration and set up the alc_spec
17151 * return 1 if successful, 0 if the proper config is not found,
17152 * or a negative error code
17153 * Based on ALC880 version - had to change it to override
17154 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17155 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17157 struct alc_spec *spec = codec->spec;
17159 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17161 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17165 if (!spec->autocfg.line_outs)
17166 return 0; /* can't find valid BIOS pin config */
17168 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17171 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17174 err = alc861vd_auto_create_extra_out(spec,
17175 spec->autocfg.speaker_pins[0],
17179 err = alc861vd_auto_create_extra_out(spec,
17180 spec->autocfg.hp_pins[0],
17184 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17188 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17190 alc_auto_parse_digital(codec);
17192 if (spec->kctls.list)
17193 add_mixer(spec, spec->kctls.list);
17195 add_verb(spec, alc861vd_volume_init_verbs);
17197 spec->num_mux_defs = 1;
17198 spec->input_mux = &spec->private_imux[0];
17200 err = alc_auto_add_mic_boost(codec);
17204 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17209 /* additional initialization for auto-configuration model */
17210 static void alc861vd_auto_init(struct hda_codec *codec)
17212 struct alc_spec *spec = codec->spec;
17213 alc861vd_auto_init_multi_out(codec);
17214 alc861vd_auto_init_hp_out(codec);
17215 alc861vd_auto_init_analog_input(codec);
17216 alc861vd_auto_init_input_src(codec);
17217 alc_auto_init_digital(codec);
17218 if (spec->unsol_event)
17219 alc_inithook(codec);
17223 ALC660VD_FIX_ASUS_GPIO1
17227 static const struct alc_fixup alc861vd_fixups[] = {
17228 [ALC660VD_FIX_ASUS_GPIO1] = {
17229 .verbs = (const struct hda_verb[]) {
17230 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17231 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17232 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17238 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17239 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17243 static int patch_alc861vd(struct hda_codec *codec)
17245 struct alc_spec *spec;
17246 int err, board_config;
17248 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17252 codec->spec = spec;
17254 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17258 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17259 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17261 board_config = ALC861VD_AUTO;
17264 if (board_config == ALC861VD_AUTO)
17265 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
17267 if (board_config == ALC861VD_AUTO) {
17268 /* automatic parse from the BIOS config */
17269 err = alc861vd_parse_auto_config(codec);
17275 "hda_codec: Cannot set up configuration "
17276 "from BIOS. Using base mode...\n");
17277 board_config = ALC861VD_3ST;
17281 err = snd_hda_attach_beep_device(codec, 0x23);
17287 if (board_config != ALC861VD_AUTO)
17288 setup_preset(codec, &alc861vd_presets[board_config]);
17290 if (codec->vendor_id == 0x10ec0660) {
17291 /* always turn on EAPD */
17292 add_verb(spec, alc660vd_eapd_verbs);
17295 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17296 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17298 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17299 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17301 if (!spec->adc_nids) {
17302 spec->adc_nids = alc861vd_adc_nids;
17303 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17305 if (!spec->capsrc_nids)
17306 spec->capsrc_nids = alc861vd_capsrc_nids;
17308 set_capture_mixer(codec);
17309 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17311 spec->vmaster_nid = 0x02;
17313 if (board_config == ALC861VD_AUTO)
17314 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
17316 codec->patch_ops = alc_patch_ops;
17318 if (board_config == ALC861VD_AUTO)
17319 spec->init_hook = alc861vd_auto_init;
17320 #ifdef CONFIG_SND_HDA_POWER_SAVE
17321 if (!spec->loopback.amplist)
17322 spec->loopback.amplist = alc861vd_loopbacks;
17331 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17332 * configuration. Each pin widget can choose any input DACs and a mixer.
17333 * Each ADC is connected from a mixer of all inputs. This makes possible
17334 * 6-channel independent captures.
17336 * In addition, an independent DAC for the multi-playback (not used in this
17339 #define ALC662_DIGOUT_NID 0x06
17340 #define ALC662_DIGIN_NID 0x0a
17342 static hda_nid_t alc662_dac_nids[4] = {
17343 /* front, rear, clfe, rear_surr */
17347 static hda_nid_t alc272_dac_nids[2] = {
17351 static hda_nid_t alc662_adc_nids[2] = {
17356 static hda_nid_t alc272_adc_nids[1] = {
17361 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17362 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17366 /* FIXME: should be a matrix-type input source selection */
17367 static struct hda_input_mux alc662_capture_source = {
17371 { "Front Mic", 0x1 },
17377 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17385 static struct hda_input_mux alc663_capture_source = {
17389 { "Front Mic", 0x1 },
17394 #if 0 /* set to 1 for testing other input sources below */
17395 static struct hda_input_mux alc272_nc10_capture_source = {
17398 { "Autoselect Mic", 0x0 },
17399 { "Internal Mic", 0x1 },
17400 { "In-0x02", 0x2 },
17401 { "In-0x03", 0x3 },
17402 { "In-0x04", 0x4 },
17403 { "In-0x05", 0x5 },
17404 { "In-0x06", 0x6 },
17405 { "In-0x07", 0x7 },
17406 { "In-0x08", 0x8 },
17407 { "In-0x09", 0x9 },
17408 { "In-0x0a", 0x0a },
17409 { "In-0x0b", 0x0b },
17410 { "In-0x0c", 0x0c },
17411 { "In-0x0d", 0x0d },
17412 { "In-0x0e", 0x0e },
17413 { "In-0x0f", 0x0f },
17421 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17428 static struct hda_verb alc662_3ST_ch2_init[] = {
17429 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17430 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17431 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17432 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17439 static struct hda_verb alc662_3ST_ch6_init[] = {
17440 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17441 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17442 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17443 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17444 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17445 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17449 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17450 { 2, alc662_3ST_ch2_init },
17451 { 6, alc662_3ST_ch6_init },
17457 static struct hda_verb alc662_sixstack_ch6_init[] = {
17458 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17459 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17460 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17467 static struct hda_verb alc662_sixstack_ch8_init[] = {
17468 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17469 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17470 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17474 static struct hda_channel_mode alc662_5stack_modes[2] = {
17475 { 2, alc662_sixstack_ch6_init },
17476 { 6, alc662_sixstack_ch8_init },
17479 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17480 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17483 static struct snd_kcontrol_new alc662_base_mixer[] = {
17484 /* output mixer control */
17485 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17486 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17487 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17488 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17489 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17490 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17491 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17492 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17493 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17495 /*Input mixer control */
17496 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17497 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17498 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17499 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17500 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17501 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17502 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17503 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17507 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17508 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17509 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17510 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17511 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17512 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17513 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17514 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17515 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17516 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17517 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17518 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17522 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17523 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17524 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17525 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17526 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17527 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17528 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17529 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17530 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17531 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17532 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17533 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17534 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17535 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17537 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17538 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17539 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17543 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17544 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17545 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17546 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17547 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17548 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17549 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17550 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17551 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17552 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17556 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17557 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17558 ALC262_HIPPO_MASTER_SWITCH,
17560 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17561 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17562 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17564 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17565 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17566 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17570 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17571 ALC262_HIPPO_MASTER_SWITCH,
17572 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17573 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17574 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17575 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17576 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17577 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17578 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17579 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17580 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17584 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17585 .ops = &snd_hda_bind_vol,
17587 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17588 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17593 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17594 .ops = &snd_hda_bind_sw,
17596 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17597 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17602 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17603 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17604 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17605 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17606 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17610 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17611 .ops = &snd_hda_bind_sw,
17613 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17614 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17615 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17620 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17621 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17622 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17623 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17624 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17625 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17626 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17631 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17632 .ops = &snd_hda_bind_sw,
17634 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17635 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17636 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17641 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17642 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17643 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17644 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17645 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17646 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17647 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17651 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17652 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17653 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17654 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17657 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17658 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17662 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17663 .ops = &snd_hda_bind_vol,
17665 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17666 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17671 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17672 .ops = &snd_hda_bind_sw,
17674 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17675 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17680 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17681 HDA_BIND_VOL("Master Playback Volume",
17682 &alc663_asus_two_bind_master_vol),
17683 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17684 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17685 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17687 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17691 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17692 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17693 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17694 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17695 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17697 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17701 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17702 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17703 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17704 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17705 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17706 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17710 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17711 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17715 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17716 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17717 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17718 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17720 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17721 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17722 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17723 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17724 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17725 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17729 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17730 .ops = &snd_hda_bind_sw,
17732 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17733 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17734 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17735 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17736 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17741 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17742 .ops = &snd_hda_bind_sw,
17744 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17745 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17750 static struct snd_kcontrol_new alc663_mode7_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", 0x1b, 0x0, HDA_OUTPUT),
17755 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17756 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17757 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17758 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17759 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17763 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17764 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17765 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17766 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17767 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17768 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17775 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17777 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17778 .name = "Channel Mode",
17779 .info = alc_ch_mode_info,
17780 .get = alc_ch_mode_get,
17781 .put = alc_ch_mode_put,
17786 static struct hda_verb alc662_init_verbs[] = {
17787 /* ADC: mute amp left and right */
17788 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17789 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17791 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17792 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17793 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17794 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17795 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17796 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17798 /* Front Pin: output 0 (0x0c) */
17799 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17800 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17802 /* Rear Pin: output 1 (0x0d) */
17803 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17804 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17806 /* CLFE Pin: output 2 (0x0e) */
17807 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17808 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17810 /* Mic (rear) pin: input vref at 80% */
17811 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17812 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17813 /* Front Mic pin: input vref at 80% */
17814 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17815 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17816 /* Line In pin: input */
17817 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17818 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17819 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17820 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17821 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17822 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17823 /* CD pin widget for input */
17824 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17826 /* FIXME: use matrix-type input source selection */
17827 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17830 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17832 /* always trun on EAPD */
17833 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17834 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17839 static struct hda_verb alc663_init_verbs[] = {
17840 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17841 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17842 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17843 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17844 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17845 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17849 static struct hda_verb alc272_init_verbs[] = {
17850 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17851 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17852 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17853 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17854 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17855 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17856 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17857 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17861 static struct hda_verb alc662_sue_init_verbs[] = {
17862 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17863 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17867 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17868 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17869 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17873 /* Set Unsolicited Event*/
17874 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17875 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17876 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17880 static struct hda_verb alc663_m51va_init_verbs[] = {
17881 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17882 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17883 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17884 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17885 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17886 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17887 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17888 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17889 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17893 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17894 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17895 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17896 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17897 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17898 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17899 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17900 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17904 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17905 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17906 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17907 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17908 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17909 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17910 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17911 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17912 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17916 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17917 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17918 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17919 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17920 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17921 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17922 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17923 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17927 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17928 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17929 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17930 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17931 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17932 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17933 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17934 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17935 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17936 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17937 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17938 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17939 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17943 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17944 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17945 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17946 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17947 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17948 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17949 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17950 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17951 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17952 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17953 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17954 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17955 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17959 static struct hda_verb alc663_g71v_init_verbs[] = {
17960 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17961 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17962 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17964 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17965 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17966 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17968 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17969 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17970 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17974 static struct hda_verb alc663_g50v_init_verbs[] = {
17975 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17976 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17977 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17979 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17980 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17984 static struct hda_verb alc662_ecs_init_verbs[] = {
17985 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17986 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17987 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17988 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17992 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17993 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17994 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17995 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17996 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17997 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17998 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17999 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18000 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18001 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18002 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18003 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18007 static struct hda_verb alc272_dell_init_verbs[] = {
18008 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18009 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18011 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18012 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18013 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18014 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18015 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18016 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18017 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18018 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18022 static struct hda_verb alc663_mode7_init_verbs[] = {
18023 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18024 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18025 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18026 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18027 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18028 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18029 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18030 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18031 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18032 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18033 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18034 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18035 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18036 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18037 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18041 static struct hda_verb alc663_mode8_init_verbs[] = {
18042 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18043 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18044 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18045 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18046 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18047 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18048 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18049 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18050 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18051 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18052 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18053 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18054 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18055 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18056 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18057 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18061 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18062 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18063 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18067 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18068 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18069 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18073 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18075 unsigned int present;
18076 unsigned char bits;
18078 present = snd_hda_jack_detect(codec, 0x14);
18079 bits = present ? HDA_AMP_MUTE : 0;
18081 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18082 HDA_AMP_MUTE, bits);
18085 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18087 unsigned int present;
18088 unsigned char bits;
18090 present = snd_hda_jack_detect(codec, 0x1b);
18091 bits = present ? HDA_AMP_MUTE : 0;
18093 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18094 HDA_AMP_MUTE, bits);
18095 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18096 HDA_AMP_MUTE, bits);
18099 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18102 if ((res >> 26) == ALC880_HP_EVENT)
18103 alc662_lenovo_101e_all_automute(codec);
18104 if ((res >> 26) == ALC880_FRONT_EVENT)
18105 alc662_lenovo_101e_ispeaker_automute(codec);
18108 /* unsolicited event for HP jack sensing */
18109 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18112 if ((res >> 26) == ALC880_MIC_EVENT)
18113 alc_mic_automute(codec);
18115 alc262_hippo_unsol_event(codec, res);
18118 static void alc662_eeepc_setup(struct hda_codec *codec)
18120 struct alc_spec *spec = codec->spec;
18122 alc262_hippo1_setup(codec);
18123 spec->ext_mic.pin = 0x18;
18124 spec->ext_mic.mux_idx = 0;
18125 spec->int_mic.pin = 0x19;
18126 spec->int_mic.mux_idx = 1;
18127 spec->auto_mic = 1;
18130 static void alc662_eeepc_inithook(struct hda_codec *codec)
18132 alc262_hippo_automute(codec);
18133 alc_mic_automute(codec);
18136 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18138 struct alc_spec *spec = codec->spec;
18140 spec->autocfg.hp_pins[0] = 0x14;
18141 spec->autocfg.speaker_pins[0] = 0x1b;
18144 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18146 static void alc663_m51va_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);
18159 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18161 unsigned int present;
18162 unsigned char bits;
18164 present = snd_hda_jack_detect(codec, 0x21);
18165 bits = present ? HDA_AMP_MUTE : 0;
18166 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18167 HDA_AMP_MUTE, bits);
18168 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18169 HDA_AMP_MUTE, bits);
18170 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18171 HDA_AMP_MUTE, bits);
18172 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18173 HDA_AMP_MUTE, bits);
18176 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18178 unsigned int present;
18179 unsigned char bits;
18181 present = snd_hda_jack_detect(codec, 0x15);
18182 bits = present ? HDA_AMP_MUTE : 0;
18183 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18184 HDA_AMP_MUTE, bits);
18185 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18186 HDA_AMP_MUTE, bits);
18187 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18188 HDA_AMP_MUTE, bits);
18189 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18190 HDA_AMP_MUTE, bits);
18193 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18195 unsigned int present;
18196 unsigned char bits;
18198 present = snd_hda_jack_detect(codec, 0x1b);
18199 bits = present ? 0 : PIN_OUT;
18200 snd_hda_codec_write(codec, 0x14, 0,
18201 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18204 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18206 unsigned int present1, present2;
18208 present1 = snd_hda_jack_detect(codec, 0x21);
18209 present2 = snd_hda_jack_detect(codec, 0x15);
18211 if (present1 || present2) {
18212 snd_hda_codec_write_cache(codec, 0x14, 0,
18213 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18215 snd_hda_codec_write_cache(codec, 0x14, 0,
18216 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18220 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18222 unsigned int present1, present2;
18224 present1 = snd_hda_jack_detect(codec, 0x1b);
18225 present2 = snd_hda_jack_detect(codec, 0x15);
18227 if (present1 || present2) {
18228 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18229 HDA_AMP_MUTE, HDA_AMP_MUTE);
18230 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18231 HDA_AMP_MUTE, HDA_AMP_MUTE);
18233 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18235 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18240 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18242 unsigned int present1, present2;
18244 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18245 AC_VERB_GET_PIN_SENSE, 0)
18246 & AC_PINSENSE_PRESENCE;
18247 present2 = snd_hda_codec_read(codec, 0x21, 0,
18248 AC_VERB_GET_PIN_SENSE, 0)
18249 & AC_PINSENSE_PRESENCE;
18251 if (present1 || present2) {
18252 snd_hda_codec_write_cache(codec, 0x14, 0,
18253 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18254 snd_hda_codec_write_cache(codec, 0x17, 0,
18255 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18257 snd_hda_codec_write_cache(codec, 0x14, 0,
18258 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18259 snd_hda_codec_write_cache(codec, 0x17, 0,
18260 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18264 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18266 unsigned int present1, present2;
18268 present1 = snd_hda_codec_read(codec, 0x21, 0,
18269 AC_VERB_GET_PIN_SENSE, 0)
18270 & AC_PINSENSE_PRESENCE;
18271 present2 = snd_hda_codec_read(codec, 0x15, 0,
18272 AC_VERB_GET_PIN_SENSE, 0)
18273 & AC_PINSENSE_PRESENCE;
18275 if (present1 || present2) {
18276 snd_hda_codec_write_cache(codec, 0x14, 0,
18277 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18278 snd_hda_codec_write_cache(codec, 0x17, 0,
18279 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18281 snd_hda_codec_write_cache(codec, 0x14, 0,
18282 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18283 snd_hda_codec_write_cache(codec, 0x17, 0,
18284 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18288 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18291 switch (res >> 26) {
18292 case ALC880_HP_EVENT:
18293 alc663_m51va_speaker_automute(codec);
18295 case ALC880_MIC_EVENT:
18296 alc_mic_automute(codec);
18301 static void alc663_m51va_setup(struct hda_codec *codec)
18303 struct alc_spec *spec = codec->spec;
18304 spec->ext_mic.pin = 0x18;
18305 spec->ext_mic.mux_idx = 0;
18306 spec->int_mic.pin = 0x12;
18307 spec->int_mic.mux_idx = 9;
18308 spec->auto_mic = 1;
18311 static void alc663_m51va_inithook(struct hda_codec *codec)
18313 alc663_m51va_speaker_automute(codec);
18314 alc_mic_automute(codec);
18317 /* ***************** Mode1 ******************************/
18318 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18320 static void alc663_mode1_setup(struct hda_codec *codec)
18322 struct alc_spec *spec = codec->spec;
18323 spec->ext_mic.pin = 0x18;
18324 spec->ext_mic.mux_idx = 0;
18325 spec->int_mic.pin = 0x19;
18326 spec->int_mic.mux_idx = 1;
18327 spec->auto_mic = 1;
18330 #define alc663_mode1_inithook alc663_m51va_inithook
18332 /* ***************** Mode2 ******************************/
18333 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18336 switch (res >> 26) {
18337 case ALC880_HP_EVENT:
18338 alc662_f5z_speaker_automute(codec);
18340 case ALC880_MIC_EVENT:
18341 alc_mic_automute(codec);
18346 #define alc662_mode2_setup alc663_mode1_setup
18348 static void alc662_mode2_inithook(struct hda_codec *codec)
18350 alc662_f5z_speaker_automute(codec);
18351 alc_mic_automute(codec);
18353 /* ***************** Mode3 ******************************/
18354 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18357 switch (res >> 26) {
18358 case ALC880_HP_EVENT:
18359 alc663_two_hp_m1_speaker_automute(codec);
18361 case ALC880_MIC_EVENT:
18362 alc_mic_automute(codec);
18367 #define alc663_mode3_setup alc663_mode1_setup
18369 static void alc663_mode3_inithook(struct hda_codec *codec)
18371 alc663_two_hp_m1_speaker_automute(codec);
18372 alc_mic_automute(codec);
18374 /* ***************** Mode4 ******************************/
18375 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18378 switch (res >> 26) {
18379 case ALC880_HP_EVENT:
18380 alc663_21jd_two_speaker_automute(codec);
18382 case ALC880_MIC_EVENT:
18383 alc_mic_automute(codec);
18388 #define alc663_mode4_setup alc663_mode1_setup
18390 static void alc663_mode4_inithook(struct hda_codec *codec)
18392 alc663_21jd_two_speaker_automute(codec);
18393 alc_mic_automute(codec);
18395 /* ***************** Mode5 ******************************/
18396 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18399 switch (res >> 26) {
18400 case ALC880_HP_EVENT:
18401 alc663_15jd_two_speaker_automute(codec);
18403 case ALC880_MIC_EVENT:
18404 alc_mic_automute(codec);
18409 #define alc663_mode5_setup alc663_mode1_setup
18411 static void alc663_mode5_inithook(struct hda_codec *codec)
18413 alc663_15jd_two_speaker_automute(codec);
18414 alc_mic_automute(codec);
18416 /* ***************** Mode6 ******************************/
18417 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18420 switch (res >> 26) {
18421 case ALC880_HP_EVENT:
18422 alc663_two_hp_m2_speaker_automute(codec);
18424 case ALC880_MIC_EVENT:
18425 alc_mic_automute(codec);
18430 #define alc663_mode6_setup alc663_mode1_setup
18432 static void alc663_mode6_inithook(struct hda_codec *codec)
18434 alc663_two_hp_m2_speaker_automute(codec);
18435 alc_mic_automute(codec);
18438 /* ***************** Mode7 ******************************/
18439 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18442 switch (res >> 26) {
18443 case ALC880_HP_EVENT:
18444 alc663_two_hp_m7_speaker_automute(codec);
18446 case ALC880_MIC_EVENT:
18447 alc_mic_automute(codec);
18452 #define alc663_mode7_setup alc663_mode1_setup
18454 static void alc663_mode7_inithook(struct hda_codec *codec)
18456 alc663_two_hp_m7_speaker_automute(codec);
18457 alc_mic_automute(codec);
18460 /* ***************** Mode8 ******************************/
18461 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18464 switch (res >> 26) {
18465 case ALC880_HP_EVENT:
18466 alc663_two_hp_m8_speaker_automute(codec);
18468 case ALC880_MIC_EVENT:
18469 alc_mic_automute(codec);
18474 #define alc663_mode8_setup alc663_m51va_setup
18476 static void alc663_mode8_inithook(struct hda_codec *codec)
18478 alc663_two_hp_m8_speaker_automute(codec);
18479 alc_mic_automute(codec);
18482 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18484 unsigned int present;
18485 unsigned char bits;
18487 present = snd_hda_jack_detect(codec, 0x21);
18488 bits = present ? HDA_AMP_MUTE : 0;
18489 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18490 HDA_AMP_MUTE, bits);
18491 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18492 HDA_AMP_MUTE, bits);
18495 static void alc663_g71v_front_automute(struct hda_codec *codec)
18497 unsigned int present;
18498 unsigned char bits;
18500 present = snd_hda_jack_detect(codec, 0x15);
18501 bits = present ? HDA_AMP_MUTE : 0;
18502 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18503 HDA_AMP_MUTE, bits);
18506 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18509 switch (res >> 26) {
18510 case ALC880_HP_EVENT:
18511 alc663_g71v_hp_automute(codec);
18513 case ALC880_FRONT_EVENT:
18514 alc663_g71v_front_automute(codec);
18516 case ALC880_MIC_EVENT:
18517 alc_mic_automute(codec);
18522 #define alc663_g71v_setup alc663_m51va_setup
18524 static void alc663_g71v_inithook(struct hda_codec *codec)
18526 alc663_g71v_front_automute(codec);
18527 alc663_g71v_hp_automute(codec);
18528 alc_mic_automute(codec);
18531 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18534 switch (res >> 26) {
18535 case ALC880_HP_EVENT:
18536 alc663_m51va_speaker_automute(codec);
18538 case ALC880_MIC_EVENT:
18539 alc_mic_automute(codec);
18544 #define alc663_g50v_setup alc663_m51va_setup
18546 static void alc663_g50v_inithook(struct hda_codec *codec)
18548 alc663_m51va_speaker_automute(codec);
18549 alc_mic_automute(codec);
18552 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18553 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18554 ALC262_HIPPO_MASTER_SWITCH,
18556 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18557 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18558 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18560 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18561 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18562 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18566 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18567 /* Master Playback automatically created from Speaker and Headphone */
18568 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18569 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18570 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18571 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18573 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18574 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18575 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18577 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18578 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18579 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18583 #ifdef CONFIG_SND_HDA_POWER_SAVE
18584 #define alc662_loopbacks alc880_loopbacks
18588 /* pcm configuration: identical with ALC880 */
18589 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18590 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18591 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18592 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18595 * configuration and preset
18597 static const char *alc662_models[ALC662_MODEL_LAST] = {
18598 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18599 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18600 [ALC662_3ST_6ch] = "3stack-6ch",
18601 [ALC662_5ST_DIG] = "6stack-dig",
18602 [ALC662_LENOVO_101E] = "lenovo-101e",
18603 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18604 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18605 [ALC662_ECS] = "ecs",
18606 [ALC663_ASUS_M51VA] = "m51va",
18607 [ALC663_ASUS_G71V] = "g71v",
18608 [ALC663_ASUS_H13] = "h13",
18609 [ALC663_ASUS_G50V] = "g50v",
18610 [ALC663_ASUS_MODE1] = "asus-mode1",
18611 [ALC662_ASUS_MODE2] = "asus-mode2",
18612 [ALC663_ASUS_MODE3] = "asus-mode3",
18613 [ALC663_ASUS_MODE4] = "asus-mode4",
18614 [ALC663_ASUS_MODE5] = "asus-mode5",
18615 [ALC663_ASUS_MODE6] = "asus-mode6",
18616 [ALC663_ASUS_MODE7] = "asus-mode7",
18617 [ALC663_ASUS_MODE8] = "asus-mode8",
18618 [ALC272_DELL] = "dell",
18619 [ALC272_DELL_ZM1] = "dell-zm1",
18620 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18621 [ALC662_AUTO] = "auto",
18624 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18625 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18626 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18627 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18628 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18629 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18630 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18631 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18632 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18633 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18634 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18635 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18636 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18637 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18638 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18639 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18640 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18641 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18642 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18643 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18644 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18645 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18646 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18647 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18648 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18649 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18650 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18651 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18652 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18653 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18654 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18655 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18656 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18657 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18658 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18659 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18660 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18661 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18662 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18663 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18664 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18665 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18666 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18667 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18668 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18669 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18670 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18671 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18672 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18673 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18674 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18675 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18676 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18677 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18678 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18679 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18680 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18681 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18682 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18683 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18684 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18685 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18686 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18687 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18688 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18689 ALC662_3ST_6ch_DIG),
18690 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18691 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18692 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18693 ALC662_3ST_6ch_DIG),
18694 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18695 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18696 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18697 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18698 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18699 ALC662_3ST_6ch_DIG),
18700 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18705 static struct alc_config_preset alc662_presets[] = {
18706 [ALC662_3ST_2ch_DIG] = {
18707 .mixers = { alc662_3ST_2ch_mixer },
18708 .init_verbs = { alc662_init_verbs },
18709 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18710 .dac_nids = alc662_dac_nids,
18711 .dig_out_nid = ALC662_DIGOUT_NID,
18712 .dig_in_nid = ALC662_DIGIN_NID,
18713 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18714 .channel_mode = alc662_3ST_2ch_modes,
18715 .input_mux = &alc662_capture_source,
18717 [ALC662_3ST_6ch_DIG] = {
18718 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18719 .init_verbs = { alc662_init_verbs },
18720 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18721 .dac_nids = alc662_dac_nids,
18722 .dig_out_nid = ALC662_DIGOUT_NID,
18723 .dig_in_nid = ALC662_DIGIN_NID,
18724 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18725 .channel_mode = alc662_3ST_6ch_modes,
18727 .input_mux = &alc662_capture_source,
18729 [ALC662_3ST_6ch] = {
18730 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18731 .init_verbs = { alc662_init_verbs },
18732 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18733 .dac_nids = alc662_dac_nids,
18734 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18735 .channel_mode = alc662_3ST_6ch_modes,
18737 .input_mux = &alc662_capture_source,
18739 [ALC662_5ST_DIG] = {
18740 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18741 .init_verbs = { alc662_init_verbs },
18742 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18743 .dac_nids = alc662_dac_nids,
18744 .dig_out_nid = ALC662_DIGOUT_NID,
18745 .dig_in_nid = ALC662_DIGIN_NID,
18746 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18747 .channel_mode = alc662_5stack_modes,
18748 .input_mux = &alc662_capture_source,
18750 [ALC662_LENOVO_101E] = {
18751 .mixers = { alc662_lenovo_101e_mixer },
18752 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18753 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18754 .dac_nids = alc662_dac_nids,
18755 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18756 .channel_mode = alc662_3ST_2ch_modes,
18757 .input_mux = &alc662_lenovo_101e_capture_source,
18758 .unsol_event = alc662_lenovo_101e_unsol_event,
18759 .init_hook = alc662_lenovo_101e_all_automute,
18761 [ALC662_ASUS_EEEPC_P701] = {
18762 .mixers = { alc662_eeepc_p701_mixer },
18763 .init_verbs = { alc662_init_verbs,
18764 alc662_eeepc_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_2ch_modes),
18768 .channel_mode = alc662_3ST_2ch_modes,
18769 .unsol_event = alc662_eeepc_unsol_event,
18770 .setup = alc662_eeepc_setup,
18771 .init_hook = alc662_eeepc_inithook,
18773 [ALC662_ASUS_EEEPC_EP20] = {
18774 .mixers = { alc662_eeepc_ep20_mixer,
18775 alc662_chmode_mixer },
18776 .init_verbs = { alc662_init_verbs,
18777 alc662_eeepc_ep20_sue_init_verbs },
18778 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18779 .dac_nids = alc662_dac_nids,
18780 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18781 .channel_mode = alc662_3ST_6ch_modes,
18782 .input_mux = &alc662_lenovo_101e_capture_source,
18783 .unsol_event = alc662_eeepc_unsol_event,
18784 .setup = alc662_eeepc_ep20_setup,
18785 .init_hook = alc662_eeepc_ep20_inithook,
18788 .mixers = { alc662_ecs_mixer },
18789 .init_verbs = { alc662_init_verbs,
18790 alc662_ecs_init_verbs },
18791 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18792 .dac_nids = alc662_dac_nids,
18793 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18794 .channel_mode = alc662_3ST_2ch_modes,
18795 .unsol_event = alc662_eeepc_unsol_event,
18796 .setup = alc662_eeepc_setup,
18797 .init_hook = alc662_eeepc_inithook,
18799 [ALC663_ASUS_M51VA] = {
18800 .mixers = { alc663_m51va_mixer },
18801 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18802 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18803 .dac_nids = alc662_dac_nids,
18804 .dig_out_nid = ALC662_DIGOUT_NID,
18805 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18806 .channel_mode = alc662_3ST_2ch_modes,
18807 .unsol_event = alc663_m51va_unsol_event,
18808 .setup = alc663_m51va_setup,
18809 .init_hook = alc663_m51va_inithook,
18811 [ALC663_ASUS_G71V] = {
18812 .mixers = { alc663_g71v_mixer },
18813 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18814 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18815 .dac_nids = alc662_dac_nids,
18816 .dig_out_nid = ALC662_DIGOUT_NID,
18817 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18818 .channel_mode = alc662_3ST_2ch_modes,
18819 .unsol_event = alc663_g71v_unsol_event,
18820 .setup = alc663_g71v_setup,
18821 .init_hook = alc663_g71v_inithook,
18823 [ALC663_ASUS_H13] = {
18824 .mixers = { alc663_m51va_mixer },
18825 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18826 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18827 .dac_nids = alc662_dac_nids,
18828 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18829 .channel_mode = alc662_3ST_2ch_modes,
18830 .unsol_event = alc663_m51va_unsol_event,
18831 .init_hook = alc663_m51va_inithook,
18833 [ALC663_ASUS_G50V] = {
18834 .mixers = { alc663_g50v_mixer },
18835 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18836 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18837 .dac_nids = alc662_dac_nids,
18838 .dig_out_nid = ALC662_DIGOUT_NID,
18839 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18840 .channel_mode = alc662_3ST_6ch_modes,
18841 .input_mux = &alc663_capture_source,
18842 .unsol_event = alc663_g50v_unsol_event,
18843 .setup = alc663_g50v_setup,
18844 .init_hook = alc663_g50v_inithook,
18846 [ALC663_ASUS_MODE1] = {
18847 .mixers = { alc663_m51va_mixer },
18848 .cap_mixer = alc662_auto_capture_mixer,
18849 .init_verbs = { alc662_init_verbs,
18850 alc663_21jd_amic_init_verbs },
18851 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18853 .dac_nids = alc662_dac_nids,
18854 .dig_out_nid = ALC662_DIGOUT_NID,
18855 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18856 .channel_mode = alc662_3ST_2ch_modes,
18857 .unsol_event = alc663_mode1_unsol_event,
18858 .setup = alc663_mode1_setup,
18859 .init_hook = alc663_mode1_inithook,
18861 [ALC662_ASUS_MODE2] = {
18862 .mixers = { alc662_1bjd_mixer },
18863 .cap_mixer = alc662_auto_capture_mixer,
18864 .init_verbs = { alc662_init_verbs,
18865 alc662_1bjd_amic_init_verbs },
18866 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18867 .dac_nids = alc662_dac_nids,
18868 .dig_out_nid = ALC662_DIGOUT_NID,
18869 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18870 .channel_mode = alc662_3ST_2ch_modes,
18871 .unsol_event = alc662_mode2_unsol_event,
18872 .setup = alc662_mode2_setup,
18873 .init_hook = alc662_mode2_inithook,
18875 [ALC663_ASUS_MODE3] = {
18876 .mixers = { alc663_two_hp_m1_mixer },
18877 .cap_mixer = alc662_auto_capture_mixer,
18878 .init_verbs = { alc662_init_verbs,
18879 alc663_two_hp_amic_m1_init_verbs },
18880 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18882 .dac_nids = alc662_dac_nids,
18883 .dig_out_nid = ALC662_DIGOUT_NID,
18884 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18885 .channel_mode = alc662_3ST_2ch_modes,
18886 .unsol_event = alc663_mode3_unsol_event,
18887 .setup = alc663_mode3_setup,
18888 .init_hook = alc663_mode3_inithook,
18890 [ALC663_ASUS_MODE4] = {
18891 .mixers = { alc663_asus_21jd_clfe_mixer },
18892 .cap_mixer = alc662_auto_capture_mixer,
18893 .init_verbs = { alc662_init_verbs,
18894 alc663_21jd_amic_init_verbs},
18895 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18897 .dac_nids = alc662_dac_nids,
18898 .dig_out_nid = ALC662_DIGOUT_NID,
18899 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18900 .channel_mode = alc662_3ST_2ch_modes,
18901 .unsol_event = alc663_mode4_unsol_event,
18902 .setup = alc663_mode4_setup,
18903 .init_hook = alc663_mode4_inithook,
18905 [ALC663_ASUS_MODE5] = {
18906 .mixers = { alc663_asus_15jd_clfe_mixer },
18907 .cap_mixer = alc662_auto_capture_mixer,
18908 .init_verbs = { alc662_init_verbs,
18909 alc663_15jd_amic_init_verbs },
18910 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18912 .dac_nids = alc662_dac_nids,
18913 .dig_out_nid = ALC662_DIGOUT_NID,
18914 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18915 .channel_mode = alc662_3ST_2ch_modes,
18916 .unsol_event = alc663_mode5_unsol_event,
18917 .setup = alc663_mode5_setup,
18918 .init_hook = alc663_mode5_inithook,
18920 [ALC663_ASUS_MODE6] = {
18921 .mixers = { alc663_two_hp_m2_mixer },
18922 .cap_mixer = alc662_auto_capture_mixer,
18923 .init_verbs = { alc662_init_verbs,
18924 alc663_two_hp_amic_m2_init_verbs },
18925 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18927 .dac_nids = alc662_dac_nids,
18928 .dig_out_nid = ALC662_DIGOUT_NID,
18929 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18930 .channel_mode = alc662_3ST_2ch_modes,
18931 .unsol_event = alc663_mode6_unsol_event,
18932 .setup = alc663_mode6_setup,
18933 .init_hook = alc663_mode6_inithook,
18935 [ALC663_ASUS_MODE7] = {
18936 .mixers = { alc663_mode7_mixer },
18937 .cap_mixer = alc662_auto_capture_mixer,
18938 .init_verbs = { alc662_init_verbs,
18939 alc663_mode7_init_verbs },
18940 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18942 .dac_nids = alc662_dac_nids,
18943 .dig_out_nid = ALC662_DIGOUT_NID,
18944 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18945 .channel_mode = alc662_3ST_2ch_modes,
18946 .unsol_event = alc663_mode7_unsol_event,
18947 .setup = alc663_mode7_setup,
18948 .init_hook = alc663_mode7_inithook,
18950 [ALC663_ASUS_MODE8] = {
18951 .mixers = { alc663_mode8_mixer },
18952 .cap_mixer = alc662_auto_capture_mixer,
18953 .init_verbs = { alc662_init_verbs,
18954 alc663_mode8_init_verbs },
18955 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18957 .dac_nids = alc662_dac_nids,
18958 .dig_out_nid = ALC662_DIGOUT_NID,
18959 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18960 .channel_mode = alc662_3ST_2ch_modes,
18961 .unsol_event = alc663_mode8_unsol_event,
18962 .setup = alc663_mode8_setup,
18963 .init_hook = alc663_mode8_inithook,
18966 .mixers = { alc663_m51va_mixer },
18967 .cap_mixer = alc272_auto_capture_mixer,
18968 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18969 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18970 .dac_nids = alc662_dac_nids,
18971 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18972 .adc_nids = alc272_adc_nids,
18973 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18974 .capsrc_nids = alc272_capsrc_nids,
18975 .channel_mode = alc662_3ST_2ch_modes,
18976 .unsol_event = alc663_m51va_unsol_event,
18977 .setup = alc663_m51va_setup,
18978 .init_hook = alc663_m51va_inithook,
18980 [ALC272_DELL_ZM1] = {
18981 .mixers = { alc663_m51va_mixer },
18982 .cap_mixer = alc662_auto_capture_mixer,
18983 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18984 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18985 .dac_nids = alc662_dac_nids,
18986 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18987 .adc_nids = alc662_adc_nids,
18989 .capsrc_nids = alc662_capsrc_nids,
18990 .channel_mode = alc662_3ST_2ch_modes,
18991 .unsol_event = alc663_m51va_unsol_event,
18992 .setup = alc663_m51va_setup,
18993 .init_hook = alc663_m51va_inithook,
18995 [ALC272_SAMSUNG_NC10] = {
18996 .mixers = { alc272_nc10_mixer },
18997 .init_verbs = { alc662_init_verbs,
18998 alc663_21jd_amic_init_verbs },
18999 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19000 .dac_nids = alc272_dac_nids,
19001 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19002 .channel_mode = alc662_3ST_2ch_modes,
19003 /*.input_mux = &alc272_nc10_capture_source,*/
19004 .unsol_event = alc663_mode4_unsol_event,
19005 .setup = alc663_mode4_setup,
19006 .init_hook = alc663_mode4_inithook,
19012 * BIOS auto configuration
19015 /* convert from MIX nid to DAC */
19016 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19020 else if (nid >= 0x0c && nid <= 0x0e)
19021 return nid - 0x0c + 0x02;
19022 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19028 /* get MIX nid connected to the given pin targeted to DAC */
19029 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19035 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19036 for (i = 0; i < num; i++) {
19037 if (alc662_mix_to_dac(mix[i]) == dac)
19043 /* look for an empty DAC slot */
19044 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19046 struct alc_spec *spec = codec->spec;
19050 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19053 for (i = 0; i < num; i++) {
19054 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19057 for (j = 0; j < spec->multiout.num_dacs; j++)
19058 if (spec->multiout.dac_nids[j] == nid)
19060 if (j >= spec->multiout.num_dacs)
19066 /* fill in the dac_nids table from the parsed pin configuration */
19067 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19068 const struct auto_pin_cfg *cfg)
19070 struct alc_spec *spec = codec->spec;
19074 spec->multiout.dac_nids = spec->private_dac_nids;
19075 for (i = 0; i < cfg->line_outs; i++) {
19076 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19079 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19084 static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19085 hda_nid_t nid, int idx, unsigned int chs)
19087 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx,
19088 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19091 static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19092 hda_nid_t nid, int idx, unsigned int chs)
19094 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
19095 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19098 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19099 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19100 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19101 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19102 #define alc662_add_stereo_vol(spec, pfx, nid) \
19103 alc662_add_vol_ctl(spec, pfx, nid, 3)
19104 #define alc662_add_stereo_sw(spec, pfx, nid) \
19105 alc662_add_sw_ctl(spec, pfx, nid, 3)
19107 /* add playback controls from the parsed DAC table */
19108 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19109 const struct auto_pin_cfg *cfg)
19111 struct alc_spec *spec = codec->spec;
19112 static const char *chname[4] = {
19113 "Front", "Surround", NULL /*CLFE*/, "Side"
19115 const char *pfx = alc_get_line_out_pfx(cfg, true);
19116 hda_nid_t nid, mix;
19119 for (i = 0; i < cfg->line_outs; i++) {
19120 nid = spec->multiout.dac_nids[i];
19123 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19126 if (!pfx && i == 2) {
19128 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19131 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19134 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19137 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19141 const char *name = pfx;
19144 err = __alc662_add_vol_ctl(spec, name, nid, i, 3);
19147 err = __alc662_add_sw_ctl(spec, name, mix, i, 3);
19155 /* add playback controls for speaker and HP outputs */
19156 /* return DAC nid if any new DAC is assigned */
19157 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19160 struct alc_spec *spec = codec->spec;
19161 hda_nid_t nid, mix;
19166 nid = alc662_look_for_dac(codec, pin);
19168 /* the corresponding DAC is already occupied */
19169 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19170 return 0; /* no way */
19171 /* create a switch only */
19172 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19173 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19176 mix = alc662_dac_to_mix(codec, pin, nid);
19179 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19182 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19188 /* create playback/capture controls for input pins */
19189 #define alc662_auto_create_input_ctls \
19190 alc882_auto_create_input_ctls
19192 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19193 hda_nid_t nid, int pin_type,
19197 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19199 alc_set_pin_output(codec, nid, pin_type);
19200 /* need the manual connection? */
19201 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19204 for (i = 0; i < num; i++) {
19205 if (alc662_mix_to_dac(srcs[i]) != dac)
19207 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19212 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19214 struct alc_spec *spec = codec->spec;
19215 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19218 for (i = 0; i <= HDA_SIDE; i++) {
19219 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19221 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19222 spec->multiout.dac_nids[i]);
19226 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19228 struct alc_spec *spec = codec->spec;
19231 pin = spec->autocfg.hp_pins[0];
19233 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19234 spec->multiout.hp_nid);
19235 pin = spec->autocfg.speaker_pins[0];
19237 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19238 spec->multiout.extra_out_nid[0]);
19241 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19243 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19245 struct alc_spec *spec = codec->spec;
19246 struct auto_pin_cfg *cfg = &spec->autocfg;
19249 for (i = 0; i < cfg->num_inputs; i++) {
19250 hda_nid_t nid = cfg->inputs[i].pin;
19251 if (alc_is_input_pin(codec, nid)) {
19252 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19253 if (nid != ALC662_PIN_CD_NID &&
19254 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19255 snd_hda_codec_write(codec, nid, 0,
19256 AC_VERB_SET_AMP_GAIN_MUTE,
19262 #define alc662_auto_init_input_src alc882_auto_init_input_src
19264 static int alc662_parse_auto_config(struct hda_codec *codec)
19266 struct alc_spec *spec = codec->spec;
19268 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19270 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19274 if (!spec->autocfg.line_outs)
19275 return 0; /* can't find valid BIOS pin config */
19277 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19280 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19283 err = alc662_auto_create_extra_out(codec,
19284 spec->autocfg.speaker_pins[0],
19289 spec->multiout.extra_out_nid[0] = err;
19290 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19295 spec->multiout.hp_nid = err;
19296 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19300 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19302 alc_auto_parse_digital(codec);
19304 if (spec->kctls.list)
19305 add_mixer(spec, spec->kctls.list);
19307 spec->num_mux_defs = 1;
19308 spec->input_mux = &spec->private_imux[0];
19310 add_verb(spec, alc662_init_verbs);
19311 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19312 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19313 add_verb(spec, alc663_init_verbs);
19315 if (codec->vendor_id == 0x10ec0272)
19316 add_verb(spec, alc272_init_verbs);
19318 err = alc_auto_add_mic_boost(codec);
19322 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19323 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19324 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19326 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19331 /* additional initialization for auto-configuration model */
19332 static void alc662_auto_init(struct hda_codec *codec)
19334 struct alc_spec *spec = codec->spec;
19335 alc662_auto_init_multi_out(codec);
19336 alc662_auto_init_hp_out(codec);
19337 alc662_auto_init_analog_input(codec);
19338 alc662_auto_init_input_src(codec);
19339 alc_auto_init_digital(codec);
19340 if (spec->unsol_event)
19341 alc_inithook(codec);
19344 static void alc272_fixup_mario(struct hda_codec *codec,
19345 const struct alc_fixup *fix, int pre_init) {
19346 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19347 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19348 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19349 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19350 (0 << AC_AMPCAP_MUTE_SHIFT)))
19351 printk(KERN_WARNING
19352 "hda_codec: failed to override amp caps for NID 0x2\n");
19356 ALC662_FIXUP_ASPIRE,
19357 ALC662_FIXUP_IDEAPAD,
19358 ALC272_FIXUP_MARIO,
19361 static const struct alc_fixup alc662_fixups[] = {
19362 [ALC662_FIXUP_ASPIRE] = {
19363 .pins = (const struct alc_pincfg[]) {
19364 { 0x15, 0x99130112 }, /* subwoofer */
19368 [ALC662_FIXUP_IDEAPAD] = {
19369 .pins = (const struct alc_pincfg[]) {
19370 { 0x17, 0x99130112 }, /* subwoofer */
19374 [ALC272_FIXUP_MARIO] = {
19375 .func = alc272_fixup_mario,
19379 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19380 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19381 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19382 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19383 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19387 static const struct alc_model_fixup alc662_fixup_models[] = {
19388 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19393 static int patch_alc662(struct hda_codec *codec)
19395 struct alc_spec *spec;
19396 int err, board_config;
19399 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19403 codec->spec = spec;
19405 alc_auto_parse_customize_define(codec);
19407 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19409 coef = alc_read_coef_idx(codec, 0);
19410 if (coef == 0x8020 || coef == 0x8011)
19411 alc_codec_rename(codec, "ALC661");
19412 else if (coef & (1 << 14) &&
19413 codec->bus->pci->subsystem_vendor == 0x1025 &&
19414 spec->cdefine.platform_type == 1)
19415 alc_codec_rename(codec, "ALC272X");
19416 else if (coef == 0x4011)
19417 alc_codec_rename(codec, "ALC656");
19419 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19422 if (board_config < 0) {
19423 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19425 board_config = ALC662_AUTO;
19428 if (board_config == ALC662_AUTO) {
19429 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1);
19430 /* automatic parse from the BIOS config */
19431 err = alc662_parse_auto_config(codec);
19437 "hda_codec: Cannot set up configuration "
19438 "from BIOS. Using base mode...\n");
19439 board_config = ALC662_3ST_2ch_DIG;
19443 if (has_cdefine_beep(codec)) {
19444 err = snd_hda_attach_beep_device(codec, 0x1);
19451 if (board_config != ALC662_AUTO)
19452 setup_preset(codec, &alc662_presets[board_config]);
19454 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19455 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19457 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19458 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19460 if (!spec->adc_nids) {
19461 spec->adc_nids = alc662_adc_nids;
19462 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19464 if (!spec->capsrc_nids)
19465 spec->capsrc_nids = alc662_capsrc_nids;
19467 if (!spec->cap_mixer)
19468 set_capture_mixer(codec);
19470 if (has_cdefine_beep(codec)) {
19471 switch (codec->vendor_id) {
19473 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19478 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19481 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19485 spec->vmaster_nid = 0x02;
19487 codec->patch_ops = alc_patch_ops;
19488 if (board_config == ALC662_AUTO) {
19489 spec->init_hook = alc662_auto_init;
19490 alc_pick_fixup_model(codec, alc662_fixup_models,
19491 alc662_fixup_tbl, alc662_fixups, 0);
19494 alc_init_jacks(codec);
19496 #ifdef CONFIG_SND_HDA_POWER_SAVE
19497 if (!spec->loopback.amplist)
19498 spec->loopback.amplist = alc662_loopbacks;
19504 static int patch_alc888(struct hda_codec *codec)
19506 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19507 kfree(codec->chip_name);
19508 if (codec->vendor_id == 0x10ec0887)
19509 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19511 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19512 if (!codec->chip_name) {
19516 return patch_alc662(codec);
19518 return patch_alc882(codec);
19524 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19525 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19526 #define alc680_modes alc260_modes
19528 static hda_nid_t alc680_dac_nids[3] = {
19529 /* Lout1, Lout2, hp */
19533 static hda_nid_t alc680_adc_nids[3] = {
19535 /* DMIC, MIC, Line-in*/
19540 * Analog capture ADC cgange
19542 static void alc680_rec_autoswitch(struct hda_codec *codec)
19544 struct alc_spec *spec = codec->spec;
19545 struct auto_pin_cfg *cfg = &spec->autocfg;
19547 int type_found = AUTO_PIN_LAST;
19551 for (i = 0; i < cfg->num_inputs; i++) {
19552 nid = cfg->inputs[i].pin;
19553 if (!(snd_hda_query_pin_caps(codec, nid) &
19554 AC_PINCAP_PRES_DETECT))
19556 if (snd_hda_jack_detect(codec, nid)) {
19557 if (cfg->inputs[i].type < type_found) {
19558 type_found = cfg->inputs[i].type;
19566 snd_hda_get_connections(codec, pin_found, &nid, 1);
19568 if (nid != spec->cur_adc)
19569 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19570 spec->cur_adc = nid;
19571 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19572 spec->cur_adc_format);
19575 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19576 struct hda_codec *codec,
19577 unsigned int stream_tag,
19578 unsigned int format,
19579 struct snd_pcm_substream *substream)
19581 struct alc_spec *spec = codec->spec;
19583 spec->cur_adc = 0x07;
19584 spec->cur_adc_stream_tag = stream_tag;
19585 spec->cur_adc_format = format;
19587 alc680_rec_autoswitch(codec);
19591 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19592 struct hda_codec *codec,
19593 struct snd_pcm_substream *substream)
19595 snd_hda_codec_cleanup_stream(codec, 0x07);
19596 snd_hda_codec_cleanup_stream(codec, 0x08);
19597 snd_hda_codec_cleanup_stream(codec, 0x09);
19601 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19602 .substreams = 1, /* can be overridden */
19605 /* NID is set in alc_build_pcms */
19607 .prepare = alc680_capture_pcm_prepare,
19608 .cleanup = alc680_capture_pcm_cleanup
19612 static struct snd_kcontrol_new alc680_base_mixer[] = {
19613 /* output mixer control */
19614 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19615 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19616 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19617 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19618 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19619 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19620 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19624 static struct hda_bind_ctls alc680_bind_cap_vol = {
19625 .ops = &snd_hda_bind_vol,
19627 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19628 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19629 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19634 static struct hda_bind_ctls alc680_bind_cap_switch = {
19635 .ops = &snd_hda_bind_sw,
19637 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19638 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19639 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19644 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19645 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19646 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19651 * generic initialization of ADC, input mixers and output mixers
19653 static struct hda_verb alc680_init_verbs[] = {
19654 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19655 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19656 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19658 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19659 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19661 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19662 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19663 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19665 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19666 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19667 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19668 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19669 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19671 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19672 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19673 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19678 /* toggle speaker-output according to the hp-jack state */
19679 static void alc680_base_setup(struct hda_codec *codec)
19681 struct alc_spec *spec = codec->spec;
19683 spec->autocfg.hp_pins[0] = 0x16;
19684 spec->autocfg.speaker_pins[0] = 0x14;
19685 spec->autocfg.speaker_pins[1] = 0x15;
19686 spec->autocfg.num_inputs = 2;
19687 spec->autocfg.inputs[0].pin = 0x18;
19688 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19689 spec->autocfg.inputs[1].pin = 0x19;
19690 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19693 static void alc680_unsol_event(struct hda_codec *codec,
19696 if ((res >> 26) == ALC880_HP_EVENT)
19697 alc_automute_amp(codec);
19698 if ((res >> 26) == ALC880_MIC_EVENT)
19699 alc680_rec_autoswitch(codec);
19702 static void alc680_inithook(struct hda_codec *codec)
19704 alc_automute_amp(codec);
19705 alc680_rec_autoswitch(codec);
19708 /* create input playback/capture controls for the given pin */
19709 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19710 const char *ctlname, int idx)
19728 if (spec->multiout.dac_nids[0] != dac &&
19729 spec->multiout.dac_nids[1] != dac) {
19730 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19731 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19736 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19737 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19741 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19747 /* add playback controls from the parsed DAC table */
19748 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19749 const struct auto_pin_cfg *cfg)
19754 spec->multiout.dac_nids = spec->private_dac_nids;
19756 nid = cfg->line_out_pins[0];
19759 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19763 err = alc680_new_analog_output(spec, nid, name, 0);
19768 nid = cfg->speaker_pins[0];
19770 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19774 nid = cfg->hp_pins[0];
19776 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19784 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19785 hda_nid_t nid, int pin_type)
19787 alc_set_pin_output(codec, nid, pin_type);
19790 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19792 struct alc_spec *spec = codec->spec;
19793 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19795 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19796 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19800 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19802 struct alc_spec *spec = codec->spec;
19805 pin = spec->autocfg.hp_pins[0];
19807 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19808 pin = spec->autocfg.speaker_pins[0];
19810 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19813 /* pcm configuration: identical with ALC880 */
19814 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19815 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19816 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19817 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19818 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19821 * BIOS auto configuration
19823 static int alc680_parse_auto_config(struct hda_codec *codec)
19825 struct alc_spec *spec = codec->spec;
19827 static hda_nid_t alc680_ignore[] = { 0 };
19829 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19834 if (!spec->autocfg.line_outs) {
19835 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19836 spec->multiout.max_channels = 2;
19837 spec->no_analog = 1;
19840 return 0; /* can't find valid BIOS pin config */
19842 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19846 spec->multiout.max_channels = 2;
19849 /* digital only support output */
19850 alc_auto_parse_digital(codec);
19851 if (spec->kctls.list)
19852 add_mixer(spec, spec->kctls.list);
19854 add_verb(spec, alc680_init_verbs);
19856 err = alc_auto_add_mic_boost(codec);
19863 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19865 /* init callback for auto-configuration model -- overriding the default init */
19866 static void alc680_auto_init(struct hda_codec *codec)
19868 struct alc_spec *spec = codec->spec;
19869 alc680_auto_init_multi_out(codec);
19870 alc680_auto_init_hp_out(codec);
19871 alc680_auto_init_analog_input(codec);
19872 alc_auto_init_digital(codec);
19873 if (spec->unsol_event)
19874 alc_inithook(codec);
19878 * configuration and preset
19880 static const char *alc680_models[ALC680_MODEL_LAST] = {
19881 [ALC680_BASE] = "base",
19882 [ALC680_AUTO] = "auto",
19885 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19886 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19890 static struct alc_config_preset alc680_presets[] = {
19892 .mixers = { alc680_base_mixer },
19893 .cap_mixer = alc680_master_capture_mixer,
19894 .init_verbs = { alc680_init_verbs },
19895 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19896 .dac_nids = alc680_dac_nids,
19897 .dig_out_nid = ALC680_DIGOUT_NID,
19898 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19899 .channel_mode = alc680_modes,
19900 .unsol_event = alc680_unsol_event,
19901 .setup = alc680_base_setup,
19902 .init_hook = alc680_inithook,
19907 static int patch_alc680(struct hda_codec *codec)
19909 struct alc_spec *spec;
19913 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19917 codec->spec = spec;
19919 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19923 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19924 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19926 board_config = ALC680_AUTO;
19929 if (board_config == ALC680_AUTO) {
19930 /* automatic parse from the BIOS config */
19931 err = alc680_parse_auto_config(codec);
19937 "hda_codec: Cannot set up configuration "
19938 "from BIOS. Using base mode...\n");
19939 board_config = ALC680_BASE;
19943 if (board_config != ALC680_AUTO)
19944 setup_preset(codec, &alc680_presets[board_config]);
19946 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19947 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19948 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19949 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19951 if (!spec->adc_nids) {
19952 spec->adc_nids = alc680_adc_nids;
19953 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19956 if (!spec->cap_mixer)
19957 set_capture_mixer(codec);
19959 spec->vmaster_nid = 0x02;
19961 codec->patch_ops = alc_patch_ops;
19962 if (board_config == ALC680_AUTO)
19963 spec->init_hook = alc680_auto_init;
19971 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19972 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19973 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19974 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19975 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19976 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19977 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19978 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19979 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19980 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19981 .patch = patch_alc861 },
19982 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19983 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19984 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19985 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19986 .patch = patch_alc882 },
19987 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19988 .patch = patch_alc662 },
19989 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19990 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19991 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19992 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19993 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19994 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19995 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19996 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19997 .patch = patch_alc882 },
19998 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19999 .patch = patch_alc882 },
20000 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
20001 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
20002 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
20003 .patch = patch_alc882 },
20004 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20005 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20006 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20007 {} /* terminator */
20010 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20012 MODULE_LICENSE("GPL");
20013 MODULE_DESCRIPTION("Realtek HD-audio codec");
20015 static struct hda_codec_preset_list realtek_list = {
20016 .preset = snd_hda_preset_realtek,
20017 .owner = THIS_MODULE,
20020 static int __init patch_realtek_init(void)
20022 return snd_hda_add_codec_preset(&realtek_list);
20025 static void __exit patch_realtek_exit(void)
20027 snd_hda_delete_codec_preset(&realtek_list);
20030 module_init(patch_realtek_init)
20031 module_exit(patch_realtek_exit)