2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include <sound/jack.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
36 #define ALC880_FRONT_EVENT 0x01
37 #define ALC880_DCVOL_EVENT 0x02
38 #define ALC880_HP_EVENT 0x04
39 #define ALC880_MIC_EVENT 0x08
41 /* ALC880 board config type */
65 #ifdef CONFIG_SND_DEBUG
69 ALC880_MODEL_LAST /* last tag */
83 #ifdef CONFIG_SND_DEBUG
87 ALC260_MODEL_LAST /* last tag */
97 ALC262_HP_BPC_D7000_WL,
98 ALC262_HP_BPC_D7000_WF,
111 ALC262_MODEL_LAST /* last tag */
121 ALC268_ACER_ASPIRE_ONE,
124 #ifdef CONFIG_SND_DEBUG
128 ALC268_MODEL_LAST /* last tag */
143 ALC269_MODEL_LAST /* last tag */
160 /* ALC861-VD models */
182 ALC662_ASUS_EEEPC_P701,
183 ALC662_ASUS_EEEPC_EP20,
225 ALC883_TARGA_2ch_DIG,
226 ALC883_TARGA_8ch_DIG,
229 ALC888_ACER_ASPIRE_4930G,
230 ALC888_ACER_ASPIRE_6530G,
231 ALC888_ACER_ASPIRE_8930G,
232 ALC888_ACER_ASPIRE_7730G,
235 ALC883_MEDION_WIM2160,
237 ALC883_LENOVO_101E_2ch,
238 ALC883_LENOVO_NB0763,
239 ALC888_LENOVO_MS7195_DIG,
247 ALC883_FUJITSU_PI2515,
248 ALC888_FUJITSU_XA3530,
249 ALC883_3ST_6ch_INTEL,
269 #define GPIO_MASK 0x03
271 /* extra amp-initialization sequence types */
280 struct alc_mic_route {
282 unsigned char mux_idx;
283 unsigned char amix_idx;
289 struct snd_jack *jack;
292 #define MUX_IDX_UNDEF ((unsigned char)-1)
294 struct alc_customize_define {
295 unsigned int sku_cfg;
296 unsigned char port_connectivity;
297 unsigned char check_sum;
298 unsigned char customization;
299 unsigned char external_amp;
300 unsigned int enable_pcbeep:1;
301 unsigned int platform_type:1;
303 unsigned int override:1;
307 /* codec parameterization */
308 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
309 unsigned int num_mixers;
310 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
311 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
313 const struct hda_verb *init_verbs[10]; /* initialization verbs
317 unsigned int num_init_verbs;
319 char stream_name_analog[32]; /* analog PCM stream */
320 struct hda_pcm_stream *stream_analog_playback;
321 struct hda_pcm_stream *stream_analog_capture;
322 struct hda_pcm_stream *stream_analog_alt_playback;
323 struct hda_pcm_stream *stream_analog_alt_capture;
325 char stream_name_digital[32]; /* digital PCM stream */
326 struct hda_pcm_stream *stream_digital_playback;
327 struct hda_pcm_stream *stream_digital_capture;
330 struct hda_multi_out multiout; /* playback set-up
331 * max_channels, dacs must be set
332 * dig_out_nid and hp_nid are optional
334 hda_nid_t alt_dac_nid;
335 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
339 unsigned int num_adc_nids;
341 hda_nid_t *capsrc_nids;
342 hda_nid_t dig_in_nid; /* digital-in NID; optional */
344 /* capture setup for dynamic dual-adc switch */
345 unsigned int cur_adc_idx;
347 unsigned int cur_adc_stream_tag;
348 unsigned int cur_adc_format;
351 unsigned int num_mux_defs;
352 const struct hda_input_mux *input_mux;
353 unsigned int cur_mux[3];
354 struct alc_mic_route ext_mic;
355 struct alc_mic_route int_mic;
358 const struct hda_channel_mode *channel_mode;
359 int num_channel_mode;
361 int const_channel_count;
362 int ext_channel_count;
364 /* PCM information */
365 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
368 struct snd_array jacks;
370 /* dynamic controls, init_verbs and input_mux */
371 struct auto_pin_cfg autocfg;
372 struct alc_customize_define cdefine;
373 struct snd_array kctls;
374 struct hda_input_mux private_imux[3];
375 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
376 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
377 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
380 void (*init_hook)(struct hda_codec *codec);
381 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
382 #ifdef CONFIG_SND_HDA_POWER_SAVE
383 void (*power_hook)(struct hda_codec *codec);
386 /* for pin sensing */
387 unsigned int sense_updated: 1;
388 unsigned int jack_present: 1;
389 unsigned int master_sw: 1;
390 unsigned int auto_mic:1;
393 unsigned int no_analog :1; /* digital I/O only */
394 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
397 /* for virtual master */
398 hda_nid_t vmaster_nid;
399 #ifdef CONFIG_SND_HDA_POWER_SAVE
400 struct hda_loopback_check loopback;
405 unsigned int pll_coef_idx, pll_coef_bit;
409 * configuration template - to be copied to the spec instance
411 struct alc_config_preset {
412 struct snd_kcontrol_new *mixers[5]; /* should be identical size
415 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
416 const struct hda_verb *init_verbs[5];
417 unsigned int num_dacs;
419 hda_nid_t dig_out_nid; /* optional */
420 hda_nid_t hp_nid; /* optional */
421 hda_nid_t *slave_dig_outs;
422 unsigned int num_adc_nids;
424 hda_nid_t *capsrc_nids;
425 hda_nid_t dig_in_nid;
426 unsigned int num_channel_mode;
427 const struct hda_channel_mode *channel_mode;
429 int const_channel_count;
430 unsigned int num_mux_defs;
431 const struct hda_input_mux *input_mux;
432 void (*unsol_event)(struct hda_codec *, unsigned int);
433 void (*setup)(struct hda_codec *);
434 void (*init_hook)(struct hda_codec *);
435 #ifdef CONFIG_SND_HDA_POWER_SAVE
436 struct hda_amp_list *loopbacks;
437 void (*power_hook)(struct hda_codec *codec);
445 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
446 struct snd_ctl_elem_info *uinfo)
448 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
449 struct alc_spec *spec = codec->spec;
450 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
451 if (mux_idx >= spec->num_mux_defs)
453 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
455 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
458 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
459 struct snd_ctl_elem_value *ucontrol)
461 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
462 struct alc_spec *spec = codec->spec;
463 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
465 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
469 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
470 struct snd_ctl_elem_value *ucontrol)
472 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
473 struct alc_spec *spec = codec->spec;
474 const struct hda_input_mux *imux;
475 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
476 unsigned int mux_idx;
477 hda_nid_t nid = spec->capsrc_nids ?
478 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
481 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
482 imux = &spec->input_mux[mux_idx];
483 if (!imux->num_items && mux_idx > 0)
484 imux = &spec->input_mux[0];
486 type = get_wcaps_type(get_wcaps(codec, nid));
487 if (type == AC_WID_AUD_MIX) {
488 /* Matrix-mixer style (e.g. ALC882) */
489 unsigned int *cur_val = &spec->cur_mux[adc_idx];
492 idx = ucontrol->value.enumerated.item[0];
493 if (idx >= imux->num_items)
494 idx = imux->num_items - 1;
497 for (i = 0; i < imux->num_items; i++) {
498 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
499 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
500 imux->items[i].index,
506 /* MUX style (e.g. ALC880) */
507 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
508 &spec->cur_mux[adc_idx]);
513 * channel mode setting
515 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
516 struct snd_ctl_elem_info *uinfo)
518 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
519 struct alc_spec *spec = codec->spec;
520 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
521 spec->num_channel_mode);
524 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
525 struct snd_ctl_elem_value *ucontrol)
527 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
528 struct alc_spec *spec = codec->spec;
529 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
530 spec->num_channel_mode,
531 spec->ext_channel_count);
534 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
535 struct snd_ctl_elem_value *ucontrol)
537 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
538 struct alc_spec *spec = codec->spec;
539 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
540 spec->num_channel_mode,
541 &spec->ext_channel_count);
542 if (err >= 0 && !spec->const_channel_count) {
543 spec->multiout.max_channels = spec->ext_channel_count;
544 if (spec->need_dac_fix)
545 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
551 * Control the mode of pin widget settings via the mixer. "pc" is used
552 * instead of "%" to avoid consequences of accidently treating the % as
553 * being part of a format specifier. Maximum allowed length of a value is
554 * 63 characters plus NULL terminator.
556 * Note: some retasking pin complexes seem to ignore requests for input
557 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
558 * are requested. Therefore order this list so that this behaviour will not
559 * cause problems when mixer clients move through the enum sequentially.
560 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
563 static char *alc_pin_mode_names[] = {
564 "Mic 50pc bias", "Mic 80pc bias",
565 "Line in", "Line out", "Headphone out",
567 static unsigned char alc_pin_mode_values[] = {
568 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
570 /* The control can present all 5 options, or it can limit the options based
571 * in the pin being assumed to be exclusively an input or an output pin. In
572 * addition, "input" pins may or may not process the mic bias option
573 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
574 * accept requests for bias as of chip versions up to March 2006) and/or
575 * wiring in the computer.
577 #define ALC_PIN_DIR_IN 0x00
578 #define ALC_PIN_DIR_OUT 0x01
579 #define ALC_PIN_DIR_INOUT 0x02
580 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
581 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
583 /* Info about the pin modes supported by the different pin direction modes.
584 * For each direction the minimum and maximum values are given.
586 static signed char alc_pin_mode_dir_info[5][2] = {
587 { 0, 2 }, /* ALC_PIN_DIR_IN */
588 { 3, 4 }, /* ALC_PIN_DIR_OUT */
589 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
590 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
591 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
593 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
594 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
595 #define alc_pin_mode_n_items(_dir) \
596 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
598 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
599 struct snd_ctl_elem_info *uinfo)
601 unsigned int item_num = uinfo->value.enumerated.item;
602 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
604 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
606 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
608 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
609 item_num = alc_pin_mode_min(dir);
610 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
614 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
615 struct snd_ctl_elem_value *ucontrol)
618 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
619 hda_nid_t nid = kcontrol->private_value & 0xffff;
620 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
621 long *valp = ucontrol->value.integer.value;
622 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
623 AC_VERB_GET_PIN_WIDGET_CONTROL,
626 /* Find enumerated value for current pinctl setting */
627 i = alc_pin_mode_min(dir);
628 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
630 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
634 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
635 struct snd_ctl_elem_value *ucontrol)
638 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
639 hda_nid_t nid = kcontrol->private_value & 0xffff;
640 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
641 long val = *ucontrol->value.integer.value;
642 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
643 AC_VERB_GET_PIN_WIDGET_CONTROL,
646 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
647 val = alc_pin_mode_min(dir);
649 change = pinctl != alc_pin_mode_values[val];
651 /* Set pin mode to that requested */
652 snd_hda_codec_write_cache(codec, nid, 0,
653 AC_VERB_SET_PIN_WIDGET_CONTROL,
654 alc_pin_mode_values[val]);
656 /* Also enable the retasking pin's input/output as required
657 * for the requested pin mode. Enum values of 2 or less are
660 * Dynamically switching the input/output buffers probably
661 * reduces noise slightly (particularly on input) so we'll
662 * do it. However, having both input and output buffers
663 * enabled simultaneously doesn't seem to be problematic if
664 * this turns out to be necessary in the future.
667 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
668 HDA_AMP_MUTE, HDA_AMP_MUTE);
669 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
672 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
673 HDA_AMP_MUTE, HDA_AMP_MUTE);
674 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
681 #define ALC_PIN_MODE(xname, nid, dir) \
682 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
683 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
684 .info = alc_pin_mode_info, \
685 .get = alc_pin_mode_get, \
686 .put = alc_pin_mode_put, \
687 .private_value = nid | (dir<<16) }
689 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
690 * together using a mask with more than one bit set. This control is
691 * currently used only by the ALC260 test model. At this stage they are not
692 * needed for any "production" models.
694 #ifdef CONFIG_SND_DEBUG
695 #define alc_gpio_data_info snd_ctl_boolean_mono_info
697 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
698 struct snd_ctl_elem_value *ucontrol)
700 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
701 hda_nid_t nid = kcontrol->private_value & 0xffff;
702 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
703 long *valp = ucontrol->value.integer.value;
704 unsigned int val = snd_hda_codec_read(codec, nid, 0,
705 AC_VERB_GET_GPIO_DATA, 0x00);
707 *valp = (val & mask) != 0;
710 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
711 struct snd_ctl_elem_value *ucontrol)
714 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
715 hda_nid_t nid = kcontrol->private_value & 0xffff;
716 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
717 long val = *ucontrol->value.integer.value;
718 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
719 AC_VERB_GET_GPIO_DATA,
722 /* Set/unset the masked GPIO bit(s) as needed */
723 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
728 snd_hda_codec_write_cache(codec, nid, 0,
729 AC_VERB_SET_GPIO_DATA, gpio_data);
733 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
734 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
735 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
736 .info = alc_gpio_data_info, \
737 .get = alc_gpio_data_get, \
738 .put = alc_gpio_data_put, \
739 .private_value = nid | (mask<<16) }
740 #endif /* CONFIG_SND_DEBUG */
742 /* A switch control to allow the enabling of the digital IO pins on the
743 * ALC260. This is incredibly simplistic; the intention of this control is
744 * to provide something in the test model allowing digital outputs to be
745 * identified if present. If models are found which can utilise these
746 * outputs a more complete mixer control can be devised for those models if
749 #ifdef CONFIG_SND_DEBUG
750 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
752 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
753 struct snd_ctl_elem_value *ucontrol)
755 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
756 hda_nid_t nid = kcontrol->private_value & 0xffff;
757 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
758 long *valp = ucontrol->value.integer.value;
759 unsigned int val = snd_hda_codec_read(codec, nid, 0,
760 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
762 *valp = (val & mask) != 0;
765 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
766 struct snd_ctl_elem_value *ucontrol)
769 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
770 hda_nid_t nid = kcontrol->private_value & 0xffff;
771 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
772 long val = *ucontrol->value.integer.value;
773 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
774 AC_VERB_GET_DIGI_CONVERT_1,
777 /* Set/unset the masked control bit(s) as needed */
778 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
783 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
788 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
789 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
790 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
791 .info = alc_spdif_ctrl_info, \
792 .get = alc_spdif_ctrl_get, \
793 .put = alc_spdif_ctrl_put, \
794 .private_value = nid | (mask<<16) }
795 #endif /* CONFIG_SND_DEBUG */
797 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
798 * Again, this is only used in the ALC26x test models to help identify when
799 * the EAPD line must be asserted for features to work.
801 #ifdef CONFIG_SND_DEBUG
802 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
804 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
805 struct snd_ctl_elem_value *ucontrol)
807 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
808 hda_nid_t nid = kcontrol->private_value & 0xffff;
809 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
810 long *valp = ucontrol->value.integer.value;
811 unsigned int val = snd_hda_codec_read(codec, nid, 0,
812 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
814 *valp = (val & mask) != 0;
818 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
819 struct snd_ctl_elem_value *ucontrol)
822 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
823 hda_nid_t nid = kcontrol->private_value & 0xffff;
824 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
825 long val = *ucontrol->value.integer.value;
826 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
827 AC_VERB_GET_EAPD_BTLENABLE,
830 /* Set/unset the masked control bit(s) as needed */
831 change = (!val ? 0 : mask) != (ctrl_data & mask);
836 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
842 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
843 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
844 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
845 .info = alc_eapd_ctrl_info, \
846 .get = alc_eapd_ctrl_get, \
847 .put = alc_eapd_ctrl_put, \
848 .private_value = nid | (mask<<16) }
849 #endif /* CONFIG_SND_DEBUG */
852 * set up the input pin config (depending on the given auto-pin type)
854 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
857 unsigned int val = PIN_IN;
859 if (auto_pin_type == AUTO_PIN_MIC) {
862 oldval = snd_hda_codec_read(codec, nid, 0,
863 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
864 pincap = snd_hda_query_pin_caps(codec, nid);
865 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
866 /* if the default pin setup is vref50, we give it priority */
867 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
869 else if (pincap & AC_PINCAP_VREF_50)
871 else if (pincap & AC_PINCAP_VREF_100)
873 else if (pincap & AC_PINCAP_VREF_GRD)
876 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
879 static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
881 struct alc_spec *spec = codec->spec;
882 struct auto_pin_cfg *cfg = &spec->autocfg;
884 if (!cfg->line_outs) {
885 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
886 cfg->line_out_pins[cfg->line_outs])
889 if (!cfg->speaker_outs) {
890 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
891 cfg->speaker_pins[cfg->speaker_outs])
895 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
896 cfg->hp_pins[cfg->hp_outs])
903 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
905 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
907 spec->mixers[spec->num_mixers++] = mix;
910 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
912 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
914 spec->init_verbs[spec->num_init_verbs++] = verb;
918 * set up from the preset table
920 static void setup_preset(struct hda_codec *codec,
921 const struct alc_config_preset *preset)
923 struct alc_spec *spec = codec->spec;
926 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
927 add_mixer(spec, preset->mixers[i]);
928 spec->cap_mixer = preset->cap_mixer;
929 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
931 add_verb(spec, preset->init_verbs[i]);
933 spec->channel_mode = preset->channel_mode;
934 spec->num_channel_mode = preset->num_channel_mode;
935 spec->need_dac_fix = preset->need_dac_fix;
936 spec->const_channel_count = preset->const_channel_count;
938 if (preset->const_channel_count)
939 spec->multiout.max_channels = preset->const_channel_count;
941 spec->multiout.max_channels = spec->channel_mode[0].channels;
942 spec->ext_channel_count = spec->channel_mode[0].channels;
944 spec->multiout.num_dacs = preset->num_dacs;
945 spec->multiout.dac_nids = preset->dac_nids;
946 spec->multiout.dig_out_nid = preset->dig_out_nid;
947 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
948 spec->multiout.hp_nid = preset->hp_nid;
950 spec->num_mux_defs = preset->num_mux_defs;
951 if (!spec->num_mux_defs)
952 spec->num_mux_defs = 1;
953 spec->input_mux = preset->input_mux;
955 spec->num_adc_nids = preset->num_adc_nids;
956 spec->adc_nids = preset->adc_nids;
957 spec->capsrc_nids = preset->capsrc_nids;
958 spec->dig_in_nid = preset->dig_in_nid;
960 spec->unsol_event = preset->unsol_event;
961 spec->init_hook = preset->init_hook;
962 #ifdef CONFIG_SND_HDA_POWER_SAVE
963 spec->power_hook = preset->power_hook;
964 spec->loopback.amplist = preset->loopbacks;
968 preset->setup(codec);
970 alc_fixup_autocfg_pin_nums(codec);
973 /* Enable GPIO mask and set output */
974 static struct hda_verb alc_gpio1_init_verbs[] = {
975 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
976 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
977 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
981 static struct hda_verb alc_gpio2_init_verbs[] = {
982 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
983 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
984 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
988 static struct hda_verb alc_gpio3_init_verbs[] = {
989 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
990 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
991 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
996 * Fix hardware PLL issue
997 * On some codecs, the analog PLL gating control must be off while
998 * the default value is 1.
1000 static void alc_fix_pll(struct hda_codec *codec)
1002 struct alc_spec *spec = codec->spec;
1007 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1008 spec->pll_coef_idx);
1009 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1010 AC_VERB_GET_PROC_COEF, 0);
1011 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1012 spec->pll_coef_idx);
1013 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1014 val & ~(1 << spec->pll_coef_bit));
1017 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
1018 unsigned int coef_idx, unsigned int coef_bit)
1020 struct alc_spec *spec = codec->spec;
1021 spec->pll_nid = nid;
1022 spec->pll_coef_idx = coef_idx;
1023 spec->pll_coef_bit = coef_bit;
1027 #ifdef CONFIG_SND_HDA_INPUT_JACK
1028 static void alc_free_jack_priv(struct snd_jack *jack)
1030 struct alc_jack *jacks = jack->private_data;
1035 static int alc_add_jack(struct hda_codec *codec,
1036 hda_nid_t nid, int type)
1038 struct alc_spec *spec;
1039 struct alc_jack *jack;
1044 snd_array_init(&spec->jacks, sizeof(*jack), 32);
1045 jack = snd_array_new(&spec->jacks);
1051 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;
1053 err = snd_jack_new(codec->bus->card, name, type, &jack->jack);
1056 jack->jack->private_data = jack;
1057 jack->jack->private_free = alc_free_jack_priv;
1061 static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1063 struct alc_spec *spec = codec->spec;
1064 struct alc_jack *jacks = spec->jacks.list;
1068 for (i = 0; i < spec->jacks.used; i++) {
1069 if (jacks->nid == nid) {
1070 unsigned int present;
1071 present = snd_hda_jack_detect(codec, nid);
1073 present = (present) ? jacks->type : 0;
1075 snd_jack_report(jacks->jack, present);
1082 static int alc_init_jacks(struct hda_codec *codec)
1084 struct alc_spec *spec = codec->spec;
1086 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1087 unsigned int mic_nid = spec->ext_mic.pin;
1089 err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE);
1092 alc_report_jack(codec, hp_nid);
1094 err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE);
1097 alc_report_jack(codec, mic_nid);
1102 static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1106 static inline int alc_init_jacks(struct hda_codec *codec)
1112 static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1114 struct alc_spec *spec = codec->spec;
1119 spec->jack_present = 0;
1120 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1121 nid = spec->autocfg.hp_pins[i];
1124 if (snd_hda_jack_detect(codec, nid)) {
1125 spec->jack_present = 1;
1128 alc_report_jack(codec, spec->autocfg.hp_pins[i]);
1131 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1132 /* Toggle internal speakers muting */
1133 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1134 nid = spec->autocfg.speaker_pins[i];
1138 snd_hda_codec_write(codec, nid, 0,
1139 AC_VERB_SET_PIN_WIDGET_CONTROL,
1140 spec->jack_present ? 0 : PIN_OUT);
1142 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1143 HDA_AMP_MUTE, mute);
1148 static void alc_automute_pin(struct hda_codec *codec)
1150 alc_automute_speaker(codec, 1);
1153 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1156 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1159 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1160 for (i = 0; i < nums; i++)
1166 /* switch the current ADC according to the jack state */
1167 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1169 struct alc_spec *spec = codec->spec;
1170 unsigned int present;
1173 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1175 spec->cur_adc_idx = 1;
1177 spec->cur_adc_idx = 0;
1178 new_adc = spec->adc_nids[spec->cur_adc_idx];
1179 if (spec->cur_adc && spec->cur_adc != new_adc) {
1180 /* stream is running, let's swap the current ADC */
1181 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1182 spec->cur_adc = new_adc;
1183 snd_hda_codec_setup_stream(codec, new_adc,
1184 spec->cur_adc_stream_tag, 0,
1185 spec->cur_adc_format);
1189 static void alc_mic_automute(struct hda_codec *codec)
1191 struct alc_spec *spec = codec->spec;
1192 struct alc_mic_route *dead, *alive;
1193 unsigned int present, type;
1196 if (!spec->auto_mic)
1198 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1200 if (snd_BUG_ON(!spec->adc_nids))
1203 if (spec->dual_adc_switch) {
1204 alc_dual_mic_adc_auto_switch(codec);
1208 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1210 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1212 alive = &spec->ext_mic;
1213 dead = &spec->int_mic;
1215 alive = &spec->int_mic;
1216 dead = &spec->ext_mic;
1219 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1220 if (type == AC_WID_AUD_MIX) {
1221 /* Matrix-mixer style (e.g. ALC882) */
1222 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1225 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1227 HDA_AMP_MUTE, HDA_AMP_MUTE);
1229 /* MUX style (e.g. ALC880) */
1230 snd_hda_codec_write_cache(codec, cap_nid, 0,
1231 AC_VERB_SET_CONNECT_SEL,
1234 alc_report_jack(codec, spec->ext_mic.pin);
1236 /* FIXME: analog mixer */
1239 /* unsolicited event for HP jack sensing */
1240 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1242 if (codec->vendor_id == 0x10ec0880)
1247 case ALC880_HP_EVENT:
1248 alc_automute_pin(codec);
1250 case ALC880_MIC_EVENT:
1251 alc_mic_automute(codec);
1256 static void alc_inithook(struct hda_codec *codec)
1258 alc_automute_pin(codec);
1259 alc_mic_automute(codec);
1262 /* additional initialization for ALC888 variants */
1263 static void alc888_coef_init(struct hda_codec *codec)
1267 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1268 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1269 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1270 if ((tmp & 0xf0) == 0x20)
1272 snd_hda_codec_read(codec, 0x20, 0,
1273 AC_VERB_SET_PROC_COEF, 0x830);
1276 snd_hda_codec_read(codec, 0x20, 0,
1277 AC_VERB_SET_PROC_COEF, 0x3030);
1280 static void alc889_coef_init(struct hda_codec *codec)
1284 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1285 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1286 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1287 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1290 /* turn on/off EAPD control (only if available) */
1291 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1293 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1295 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1296 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1300 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1305 case ALC_INIT_GPIO1:
1306 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1308 case ALC_INIT_GPIO2:
1309 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1311 case ALC_INIT_GPIO3:
1312 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1314 case ALC_INIT_DEFAULT:
1315 switch (codec->vendor_id) {
1317 set_eapd(codec, 0x0f, 1);
1318 set_eapd(codec, 0x10, 1);
1331 set_eapd(codec, 0x14, 1);
1332 set_eapd(codec, 0x15, 1);
1335 switch (codec->vendor_id) {
1337 snd_hda_codec_write(codec, 0x1a, 0,
1338 AC_VERB_SET_COEF_INDEX, 7);
1339 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1340 AC_VERB_GET_PROC_COEF, 0);
1341 snd_hda_codec_write(codec, 0x1a, 0,
1342 AC_VERB_SET_COEF_INDEX, 7);
1343 snd_hda_codec_write(codec, 0x1a, 0,
1344 AC_VERB_SET_PROC_COEF,
1354 alc889_coef_init(codec);
1357 alc888_coef_init(codec);
1359 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1362 snd_hda_codec_write(codec, 0x20, 0,
1363 AC_VERB_SET_COEF_INDEX, 7);
1364 tmp = snd_hda_codec_read(codec, 0x20, 0,
1365 AC_VERB_GET_PROC_COEF, 0);
1366 snd_hda_codec_write(codec, 0x20, 0,
1367 AC_VERB_SET_COEF_INDEX, 7);
1368 snd_hda_codec_write(codec, 0x20, 0,
1369 AC_VERB_SET_PROC_COEF,
1378 static void alc_init_auto_hp(struct hda_codec *codec)
1380 struct alc_spec *spec = codec->spec;
1381 struct auto_pin_cfg *cfg = &spec->autocfg;
1384 if (!cfg->hp_pins[0]) {
1385 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1389 if (!cfg->speaker_pins[0]) {
1390 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1392 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1393 sizeof(cfg->speaker_pins));
1394 cfg->speaker_outs = cfg->line_outs;
1397 if (!cfg->hp_pins[0]) {
1398 memcpy(cfg->hp_pins, cfg->line_out_pins,
1399 sizeof(cfg->hp_pins));
1400 cfg->hp_outs = cfg->line_outs;
1403 for (i = 0; i < cfg->hp_outs; i++) {
1404 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1406 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1407 AC_VERB_SET_UNSOLICITED_ENABLE,
1408 AC_USRSP_EN | ALC880_HP_EVENT);
1410 spec->unsol_event = alc_sku_unsol_event;
1413 static void alc_init_auto_mic(struct hda_codec *codec)
1415 struct alc_spec *spec = codec->spec;
1416 struct auto_pin_cfg *cfg = &spec->autocfg;
1417 hda_nid_t fixed, ext;
1420 /* there must be only two mic inputs exclusively */
1421 for (i = 0; i < cfg->num_inputs; i++)
1422 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1426 for (i = 0; i < cfg->num_inputs; i++) {
1427 hda_nid_t nid = cfg->inputs[i].pin;
1428 unsigned int defcfg;
1429 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1430 switch (snd_hda_get_input_pin_attr(defcfg)) {
1431 case INPUT_PIN_ATTR_INT:
1433 return; /* already occupied */
1436 case INPUT_PIN_ATTR_UNUSED:
1437 return; /* invalid entry */
1440 return; /* already occupied */
1447 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1448 return; /* no unsol support */
1449 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1451 spec->ext_mic.pin = ext;
1452 spec->int_mic.pin = fixed;
1453 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1454 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1456 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1457 AC_VERB_SET_UNSOLICITED_ENABLE,
1458 AC_USRSP_EN | ALC880_MIC_EVENT);
1459 spec->unsol_event = alc_sku_unsol_event;
1462 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1464 unsigned int ass, tmp, i;
1466 struct alc_spec *spec = codec->spec;
1468 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1470 ass = codec->subsystem_id & 0xffff;
1471 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1475 if (codec->vendor_id == 0x10ec0260)
1477 ass = snd_hda_codec_get_pincfg(codec, nid);
1480 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1481 codec->chip_name, ass);
1487 for (i = 1; i < 16; i++) {
1491 if (((ass >> 16) & 0xf) != tmp)
1494 spec->cdefine.port_connectivity = ass >> 30;
1495 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1496 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1497 spec->cdefine.customization = ass >> 8;
1499 spec->cdefine.sku_cfg = ass;
1500 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1501 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1502 spec->cdefine.swap = (ass & 0x2) >> 1;
1503 spec->cdefine.override = ass & 0x1;
1505 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1506 nid, spec->cdefine.sku_cfg);
1507 snd_printd("SKU: port_connectivity=0x%x\n",
1508 spec->cdefine.port_connectivity);
1509 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1510 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1511 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1512 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1513 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1514 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1515 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1520 /* check subsystem ID and set up device-specific initialization;
1521 * return 1 if initialized, 0 if invalid SSID
1523 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1524 * 31 ~ 16 : Manufacture ID
1526 * 7 ~ 0 : Assembly ID
1527 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1529 static int alc_subsystem_id(struct hda_codec *codec,
1530 hda_nid_t porta, hda_nid_t porte,
1531 hda_nid_t portd, hda_nid_t porti)
1533 unsigned int ass, tmp, i;
1535 struct alc_spec *spec = codec->spec;
1537 ass = codec->subsystem_id & 0xffff;
1538 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1541 /* invalid SSID, check the special NID pin defcfg instead */
1543 * 31~30 : port connectivity
1546 * 19~16 : Check sum (15:1)
1551 if (codec->vendor_id == 0x10ec0260)
1553 ass = snd_hda_codec_get_pincfg(codec, nid);
1554 snd_printd("realtek: No valid SSID, "
1555 "checking pincfg 0x%08x for NID 0x%x\n",
1559 if ((ass >> 30) != 1) /* no physical connection */
1564 for (i = 1; i < 16; i++) {
1568 if (((ass >> 16) & 0xf) != tmp)
1571 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1572 ass & 0xffff, codec->vendor_id);
1576 * 2 : 0 --> Desktop, 1 --> Laptop
1577 * 3~5 : External Amplifier control
1580 tmp = (ass & 0x38) >> 3; /* external Amp control */
1583 spec->init_amp = ALC_INIT_GPIO1;
1586 spec->init_amp = ALC_INIT_GPIO2;
1589 spec->init_amp = ALC_INIT_GPIO3;
1592 spec->init_amp = ALC_INIT_DEFAULT;
1596 /* is laptop or Desktop and enable the function "Mute internal speaker
1597 * when the external headphone out jack is plugged"
1599 if (!(ass & 0x8000))
1602 * 10~8 : Jack location
1603 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1605 * 15 : 1 --> enable the function "Mute internal speaker
1606 * when the external headphone out jack is plugged"
1608 if (!spec->autocfg.hp_pins[0]) {
1610 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1621 for (i = 0; i < spec->autocfg.line_outs; i++)
1622 if (spec->autocfg.line_out_pins[i] == nid)
1624 spec->autocfg.hp_pins[0] = nid;
1627 alc_init_auto_hp(codec);
1628 alc_init_auto_mic(codec);
1632 static void alc_ssid_check(struct hda_codec *codec,
1633 hda_nid_t porta, hda_nid_t porte,
1634 hda_nid_t portd, hda_nid_t porti)
1636 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1637 struct alc_spec *spec = codec->spec;
1638 snd_printd("realtek: "
1639 "Enable default setup for auto mode as fallback\n");
1640 spec->init_amp = ALC_INIT_DEFAULT;
1641 alc_init_auto_hp(codec);
1642 alc_init_auto_mic(codec);
1647 * Fix-up pin default configurations and add default verbs
1656 const struct alc_pincfg *pins;
1657 const struct hda_verb *verbs;
1660 static void alc_pick_fixup(struct hda_codec *codec,
1661 const struct snd_pci_quirk *quirk,
1662 const struct alc_fixup *fix,
1665 const struct alc_pincfg *cfg;
1667 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1670 fix += quirk->value;
1672 if (pre_init && cfg) {
1673 #ifdef CONFIG_SND_DEBUG_VERBOSE
1674 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1675 codec->chip_name, quirk->name);
1677 for (; cfg->nid; cfg++)
1678 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1680 if (!pre_init && fix->verbs) {
1681 #ifdef CONFIG_SND_DEBUG_VERBOSE
1682 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1683 codec->chip_name, quirk->name);
1685 add_verb(codec->spec, fix->verbs);
1689 static int alc_read_coef_idx(struct hda_codec *codec,
1690 unsigned int coef_idx)
1693 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1695 val = snd_hda_codec_read(codec, 0x20, 0,
1696 AC_VERB_GET_PROC_COEF, 0);
1700 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
1701 unsigned int coef_val)
1703 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1705 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
1709 /* set right pin controls for digital I/O */
1710 static void alc_auto_init_digital(struct hda_codec *codec)
1712 struct alc_spec *spec = codec->spec;
1716 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1717 pin = spec->autocfg.dig_out_pins[i];
1719 snd_hda_codec_write(codec, pin, 0,
1720 AC_VERB_SET_PIN_WIDGET_CONTROL,
1724 pin = spec->autocfg.dig_in_pin;
1726 snd_hda_codec_write(codec, pin, 0,
1727 AC_VERB_SET_PIN_WIDGET_CONTROL,
1731 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1732 static void alc_auto_parse_digital(struct hda_codec *codec)
1734 struct alc_spec *spec = codec->spec;
1738 /* support multiple SPDIFs; the secondary is set up as a slave */
1739 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1740 err = snd_hda_get_connections(codec,
1741 spec->autocfg.dig_out_pins[i],
1746 spec->multiout.dig_out_nid = dig_nid;
1747 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1749 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1750 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1752 spec->slave_dig_outs[i - 1] = dig_nid;
1756 if (spec->autocfg.dig_in_pin) {
1758 err = snd_hda_get_connections(codec,
1759 spec->autocfg.dig_in_pin,
1762 spec->dig_in_nid = dig_nid;
1773 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1774 /* Mic-in jack as mic in */
1775 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1776 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1777 /* Line-in jack as Line in */
1778 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1779 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1780 /* Line-Out as Front */
1781 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1788 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1789 /* Mic-in jack as mic in */
1790 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1791 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1792 /* Line-in jack as Surround */
1793 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1794 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1795 /* Line-Out as Front */
1796 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1803 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1804 /* Mic-in jack as CLFE */
1805 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1806 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1807 /* Line-in jack as Surround */
1808 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1809 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1810 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1811 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1818 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1819 /* Mic-in jack as CLFE */
1820 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1821 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1822 /* Line-in jack as Surround */
1823 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1824 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1825 /* Line-Out as Side */
1826 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1830 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1831 { 2, alc888_4ST_ch2_intel_init },
1832 { 4, alc888_4ST_ch4_intel_init },
1833 { 6, alc888_4ST_ch6_intel_init },
1834 { 8, alc888_4ST_ch8_intel_init },
1838 * ALC888 Fujitsu Siemens Amillo xa3530
1841 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1842 /* Front Mic: set to PIN_IN (empty by default) */
1843 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1844 /* Connect Internal HP to Front */
1845 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1846 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1847 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1848 /* Connect Bass HP to Front */
1849 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1850 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1851 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1852 /* Connect Line-Out side jack (SPDIF) to Side */
1853 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1854 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1855 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1856 /* Connect Mic jack to CLFE */
1857 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1858 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1859 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1860 /* Connect Line-in jack to Surround */
1861 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1862 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1863 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1864 /* Connect HP out jack to Front */
1865 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1866 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1867 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1868 /* Enable unsolicited event for HP jack and Line-out jack */
1869 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1870 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1874 static void alc_automute_amp(struct hda_codec *codec)
1876 alc_automute_speaker(codec, 0);
1879 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1882 if (codec->vendor_id == 0x10ec0880)
1886 if (res == ALC880_HP_EVENT)
1887 alc_automute_amp(codec);
1890 static void alc889_automute_setup(struct hda_codec *codec)
1892 struct alc_spec *spec = codec->spec;
1894 spec->autocfg.hp_pins[0] = 0x15;
1895 spec->autocfg.speaker_pins[0] = 0x14;
1896 spec->autocfg.speaker_pins[1] = 0x16;
1897 spec->autocfg.speaker_pins[2] = 0x17;
1898 spec->autocfg.speaker_pins[3] = 0x19;
1899 spec->autocfg.speaker_pins[4] = 0x1a;
1902 static void alc889_intel_init_hook(struct hda_codec *codec)
1904 alc889_coef_init(codec);
1905 alc_automute_amp(codec);
1908 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1910 struct alc_spec *spec = codec->spec;
1912 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1913 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1914 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1915 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1919 * ALC888 Acer Aspire 4930G model
1922 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1923 /* Front Mic: set to PIN_IN (empty by default) */
1924 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1925 /* Unselect Front Mic by default in input mixer 3 */
1926 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1927 /* Enable unsolicited event for HP jack */
1928 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1929 /* Connect Internal HP to front */
1930 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1931 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1932 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1933 /* Connect HP out to front */
1934 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1935 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1936 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1941 * ALC888 Acer Aspire 6530G model
1944 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1945 /* Route to built-in subwoofer as well as speakers */
1946 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1947 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1948 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1949 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1950 /* Bias voltage on for external mic port */
1951 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1952 /* Front Mic: set to PIN_IN (empty by default) */
1953 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1954 /* Unselect Front Mic by default in input mixer 3 */
1955 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1956 /* Enable unsolicited event for HP jack */
1957 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1958 /* Enable speaker output */
1959 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1960 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1961 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1962 /* Enable headphone output */
1963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1964 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1965 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1966 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1971 * ALC889 Acer Aspire 8930G model
1974 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1975 /* Front Mic: set to PIN_IN (empty by default) */
1976 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1977 /* Unselect Front Mic by default in input mixer 3 */
1978 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1979 /* Enable unsolicited event for HP jack */
1980 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1981 /* Connect Internal Front to Front */
1982 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1983 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1984 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1985 /* Connect Internal Rear to Rear */
1986 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1987 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1988 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1989 /* Connect Internal CLFE to CLFE */
1990 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1991 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1992 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1993 /* Connect HP out to Front */
1994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1996 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1997 /* Enable all DACs */
1998 /* DAC DISABLE/MUTE 1? */
1999 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2000 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2001 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2002 /* DAC DISABLE/MUTE 2? */
2003 /* some bit here disables the other DACs. Init=0x4900 */
2004 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2005 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2007 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2008 * which makes the stereo useless. However, either the mic or the ALC889
2009 * makes the signal become a difference/sum signal instead of standard
2010 * stereo, which is annoying. So instead we flip this bit which makes the
2011 * codec replicate the sum signal to both channels, turning it into a
2014 /* DMIC_CONTROL? Init value = 0x0001 */
2015 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2016 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2020 static struct hda_input_mux alc888_2_capture_sources[2] = {
2021 /* Front mic only available on one ADC */
2028 { "Front Mic", 0xb },
2041 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2042 /* Interal mic only available on one ADC */
2049 { "Input Mix", 0xa },
2059 { "Input Mix", 0xa },
2064 static struct hda_input_mux alc889_capture_sources[3] = {
2065 /* Digital mic only available on first "ADC" */
2072 { "Front Mic", 0xb },
2073 { "Input Mix", 0xa },
2082 { "Input Mix", 0xa },
2091 { "Input Mix", 0xa },
2096 static struct snd_kcontrol_new alc888_base_mixer[] = {
2097 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2098 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2099 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2100 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2101 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2103 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2104 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2105 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2106 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2107 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2108 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2109 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2110 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2111 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2113 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
2114 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2118 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2119 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2120 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2121 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2122 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2123 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2125 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2126 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2127 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2128 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2129 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2130 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2131 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
2132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2137 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2139 struct alc_spec *spec = codec->spec;
2141 spec->autocfg.hp_pins[0] = 0x15;
2142 spec->autocfg.speaker_pins[0] = 0x14;
2143 spec->autocfg.speaker_pins[1] = 0x16;
2144 spec->autocfg.speaker_pins[2] = 0x17;
2147 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2149 struct alc_spec *spec = codec->spec;
2151 spec->autocfg.hp_pins[0] = 0x15;
2152 spec->autocfg.speaker_pins[0] = 0x14;
2153 spec->autocfg.speaker_pins[1] = 0x16;
2154 spec->autocfg.speaker_pins[2] = 0x17;
2157 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2159 struct alc_spec *spec = codec->spec;
2161 spec->autocfg.hp_pins[0] = 0x15;
2162 spec->autocfg.speaker_pins[0] = 0x14;
2163 spec->autocfg.speaker_pins[1] = 0x16;
2164 spec->autocfg.speaker_pins[2] = 0x1b;
2168 * ALC880 3-stack model
2170 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2171 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2172 * F-Mic = 0x1b, HP = 0x19
2175 static hda_nid_t alc880_dac_nids[4] = {
2176 /* front, rear, clfe, rear_surr */
2177 0x02, 0x05, 0x04, 0x03
2180 static hda_nid_t alc880_adc_nids[3] = {
2185 /* The datasheet says the node 0x07 is connected from inputs,
2186 * but it shows zero connection in the real implementation on some devices.
2187 * Note: this is a 915GAV bug, fixed on 915GLV
2189 static hda_nid_t alc880_adc_nids_alt[2] = {
2194 #define ALC880_DIGOUT_NID 0x06
2195 #define ALC880_DIGIN_NID 0x0a
2197 static struct hda_input_mux alc880_capture_source = {
2201 { "Front Mic", 0x3 },
2207 /* channel source setting (2/6 channel selection for 3-stack) */
2209 static struct hda_verb alc880_threestack_ch2_init[] = {
2210 /* set line-in to input, mute it */
2211 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2212 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2213 /* set mic-in to input vref 80%, mute it */
2214 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2215 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2220 static struct hda_verb alc880_threestack_ch6_init[] = {
2221 /* set line-in to output, unmute it */
2222 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2223 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2224 /* set mic-in to output, unmute it */
2225 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2226 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2230 static struct hda_channel_mode alc880_threestack_modes[2] = {
2231 { 2, alc880_threestack_ch2_init },
2232 { 6, alc880_threestack_ch6_init },
2235 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2236 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2237 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2238 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2239 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2240 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2241 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2242 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2243 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2244 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2245 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2246 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2247 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2249 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2250 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2251 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2252 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2254 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2255 .name = "Channel Mode",
2256 .info = alc_ch_mode_info,
2257 .get = alc_ch_mode_get,
2258 .put = alc_ch_mode_put,
2263 /* capture mixer elements */
2264 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2265 struct snd_ctl_elem_info *uinfo)
2267 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2268 struct alc_spec *spec = codec->spec;
2271 mutex_lock(&codec->control_mutex);
2272 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2274 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2275 mutex_unlock(&codec->control_mutex);
2279 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2280 unsigned int size, unsigned int __user *tlv)
2282 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2283 struct alc_spec *spec = codec->spec;
2286 mutex_lock(&codec->control_mutex);
2287 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2289 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2290 mutex_unlock(&codec->control_mutex);
2294 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2295 struct snd_ctl_elem_value *ucontrol);
2297 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2298 struct snd_ctl_elem_value *ucontrol,
2301 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2302 struct alc_spec *spec = codec->spec;
2303 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2306 mutex_lock(&codec->control_mutex);
2307 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2309 err = func(kcontrol, ucontrol);
2310 mutex_unlock(&codec->control_mutex);
2314 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2315 struct snd_ctl_elem_value *ucontrol)
2317 return alc_cap_getput_caller(kcontrol, ucontrol,
2318 snd_hda_mixer_amp_volume_get);
2321 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2322 struct snd_ctl_elem_value *ucontrol)
2324 return alc_cap_getput_caller(kcontrol, ucontrol,
2325 snd_hda_mixer_amp_volume_put);
2328 /* capture mixer elements */
2329 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2331 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2332 struct snd_ctl_elem_value *ucontrol)
2334 return alc_cap_getput_caller(kcontrol, ucontrol,
2335 snd_hda_mixer_amp_switch_get);
2338 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2339 struct snd_ctl_elem_value *ucontrol)
2341 return alc_cap_getput_caller(kcontrol, ucontrol,
2342 snd_hda_mixer_amp_switch_put);
2345 #define _DEFINE_CAPMIX(num) \
2347 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2348 .name = "Capture Switch", \
2349 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2351 .info = alc_cap_sw_info, \
2352 .get = alc_cap_sw_get, \
2353 .put = alc_cap_sw_put, \
2356 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2357 .name = "Capture Volume", \
2358 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2359 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2360 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2362 .info = alc_cap_vol_info, \
2363 .get = alc_cap_vol_get, \
2364 .put = alc_cap_vol_put, \
2365 .tlv = { .c = alc_cap_vol_tlv }, \
2368 #define _DEFINE_CAPSRC(num) \
2370 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2371 /* .name = "Capture Source", */ \
2372 .name = "Input Source", \
2374 .info = alc_mux_enum_info, \
2375 .get = alc_mux_enum_get, \
2376 .put = alc_mux_enum_put, \
2379 #define DEFINE_CAPMIX(num) \
2380 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2381 _DEFINE_CAPMIX(num), \
2382 _DEFINE_CAPSRC(num), \
2386 #define DEFINE_CAPMIX_NOSRC(num) \
2387 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2388 _DEFINE_CAPMIX(num), \
2392 /* up to three ADCs */
2396 DEFINE_CAPMIX_NOSRC(1);
2397 DEFINE_CAPMIX_NOSRC(2);
2398 DEFINE_CAPMIX_NOSRC(3);
2401 * ALC880 5-stack model
2403 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2405 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2406 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2409 /* additional mixers to alc880_three_stack_mixer */
2410 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2411 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2412 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2416 /* channel source setting (6/8 channel selection for 5-stack) */
2418 static struct hda_verb alc880_fivestack_ch6_init[] = {
2419 /* set line-in to input, mute it */
2420 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2421 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2426 static struct hda_verb alc880_fivestack_ch8_init[] = {
2427 /* set line-in to output, unmute it */
2428 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2429 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2433 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2434 { 6, alc880_fivestack_ch6_init },
2435 { 8, alc880_fivestack_ch8_init },
2440 * ALC880 6-stack model
2442 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2443 * Side = 0x05 (0x0f)
2444 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2445 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2448 static hda_nid_t alc880_6st_dac_nids[4] = {
2449 /* front, rear, clfe, rear_surr */
2450 0x02, 0x03, 0x04, 0x05
2453 static struct hda_input_mux alc880_6stack_capture_source = {
2457 { "Front Mic", 0x1 },
2463 /* fixed 8-channels */
2464 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2468 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2469 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2470 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2471 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2472 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2473 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2474 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2475 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2476 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2477 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2478 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2479 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2480 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2481 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2482 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2483 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2484 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2485 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2486 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2488 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2489 .name = "Channel Mode",
2490 .info = alc_ch_mode_info,
2491 .get = alc_ch_mode_get,
2492 .put = alc_ch_mode_put,
2501 * W810 has rear IO for:
2504 * Center/LFE (DAC 04)
2507 * The system also has a pair of internal speakers, and a headphone jack.
2508 * These are both connected to Line2 on the codec, hence to DAC 02.
2510 * There is a variable resistor to control the speaker or headphone
2511 * volume. This is a hardware-only device without a software API.
2513 * Plugging headphones in will disable the internal speakers. This is
2514 * implemented in hardware, not via the driver using jack sense. In
2515 * a similar fashion, plugging into the rear socket marked "front" will
2516 * disable both the speakers and headphones.
2518 * For input, there's a microphone jack, and an "audio in" jack.
2519 * These may not do anything useful with this driver yet, because I
2520 * haven't setup any initialization verbs for these yet...
2523 static hda_nid_t alc880_w810_dac_nids[3] = {
2524 /* front, rear/surround, clfe */
2528 /* fixed 6 channels */
2529 static struct hda_channel_mode alc880_w810_modes[1] = {
2533 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2534 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2535 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2536 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2537 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2538 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2539 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2540 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2541 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2542 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2543 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2551 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2552 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2556 static hda_nid_t alc880_z71v_dac_nids[1] = {
2559 #define ALC880_Z71V_HP_DAC 0x03
2561 /* fixed 2 channels */
2562 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2566 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2567 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2568 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2569 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2570 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2571 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2572 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2573 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2574 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2580 * ALC880 F1734 model
2582 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2583 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2586 static hda_nid_t alc880_f1734_dac_nids[1] = {
2589 #define ALC880_F1734_HP_DAC 0x02
2591 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2592 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2593 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2594 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2595 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2596 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2597 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2598 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2599 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2603 static struct hda_input_mux alc880_f1734_capture_source = {
2615 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2616 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2617 * Mic = 0x18, Line = 0x1a
2620 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2621 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2623 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2624 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2625 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2626 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2627 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2628 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2629 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2630 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2631 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2632 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2633 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2634 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2635 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2636 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2637 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2639 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2640 .name = "Channel Mode",
2641 .info = alc_ch_mode_info,
2642 .get = alc_ch_mode_get,
2643 .put = alc_ch_mode_put,
2649 * ALC880 ASUS W1V model
2651 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2652 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2653 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2656 /* additional mixers to alc880_asus_mixer */
2657 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2658 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2659 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2664 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2665 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2666 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2667 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2668 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2669 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2671 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2672 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2673 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2678 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2679 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2680 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2681 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2682 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2683 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2684 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2685 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2686 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2687 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2688 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2689 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2690 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2693 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2694 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2696 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2697 .name = "Channel Mode",
2698 .info = alc_ch_mode_info,
2699 .get = alc_ch_mode_get,
2700 .put = alc_ch_mode_put,
2705 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2706 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2707 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2708 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2709 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2710 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2711 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2712 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2713 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2714 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2715 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2719 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2720 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2721 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2722 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2723 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2724 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2725 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2730 * virtual master controls
2734 * slave controls for virtual master
2736 static const char *alc_slave_vols[] = {
2737 "Front Playback Volume",
2738 "Surround Playback Volume",
2739 "Center Playback Volume",
2740 "LFE Playback Volume",
2741 "Side Playback Volume",
2742 "Headphone Playback Volume",
2743 "Speaker Playback Volume",
2744 "Mono Playback Volume",
2745 "Line-Out Playback Volume",
2746 "PCM Playback Volume",
2750 static const char *alc_slave_sws[] = {
2751 "Front Playback Switch",
2752 "Surround Playback Switch",
2753 "Center Playback Switch",
2754 "LFE Playback Switch",
2755 "Side Playback Switch",
2756 "Headphone Playback Switch",
2757 "Speaker Playback Switch",
2758 "Mono Playback Switch",
2759 "IEC958 Playback Switch",
2760 "Line-Out Playback Switch",
2761 "PCM Playback Switch",
2766 * build control elements
2769 #define NID_MAPPING (-1)
2771 #define SUBDEV_SPEAKER_ (0 << 6)
2772 #define SUBDEV_HP_ (1 << 6)
2773 #define SUBDEV_LINE_ (2 << 6)
2774 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2775 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2776 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2778 static void alc_free_kctls(struct hda_codec *codec);
2780 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2781 /* additional beep mixers; the actual parameters are overwritten at build */
2782 static struct snd_kcontrol_new alc_beep_mixer[] = {
2783 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2784 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2789 static int alc_build_controls(struct hda_codec *codec)
2791 struct alc_spec *spec = codec->spec;
2792 struct snd_kcontrol *kctl = NULL;
2793 struct snd_kcontrol_new *knew;
2798 for (i = 0; i < spec->num_mixers; i++) {
2799 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2803 if (spec->cap_mixer) {
2804 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2808 if (spec->multiout.dig_out_nid) {
2809 err = snd_hda_create_spdif_out_ctls(codec,
2810 spec->multiout.dig_out_nid);
2813 if (!spec->no_analog) {
2814 err = snd_hda_create_spdif_share_sw(codec,
2818 spec->multiout.share_spdif = 1;
2821 if (spec->dig_in_nid) {
2822 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2827 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2828 /* create beep controls if needed */
2829 if (spec->beep_amp) {
2830 struct snd_kcontrol_new *knew;
2831 for (knew = alc_beep_mixer; knew->name; knew++) {
2832 struct snd_kcontrol *kctl;
2833 kctl = snd_ctl_new1(knew, codec);
2836 kctl->private_value = spec->beep_amp;
2837 err = snd_hda_ctl_add(codec, 0, kctl);
2844 /* if we have no master control, let's create it */
2845 if (!spec->no_analog &&
2846 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2847 unsigned int vmaster_tlv[4];
2848 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2849 HDA_OUTPUT, vmaster_tlv);
2850 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2851 vmaster_tlv, alc_slave_vols);
2855 if (!spec->no_analog &&
2856 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2857 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2858 NULL, alc_slave_sws);
2863 /* assign Capture Source enums to NID */
2864 if (spec->capsrc_nids || spec->adc_nids) {
2865 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2867 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2868 for (i = 0; kctl && i < kctl->count; i++) {
2869 hda_nid_t *nids = spec->capsrc_nids;
2871 nids = spec->adc_nids;
2872 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2877 if (spec->cap_mixer) {
2878 const char *kname = kctl ? kctl->id.name : NULL;
2879 for (knew = spec->cap_mixer; knew->name; knew++) {
2880 if (kname && strcmp(knew->name, kname) == 0)
2882 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2883 for (i = 0; kctl && i < kctl->count; i++) {
2884 err = snd_hda_add_nid(codec, kctl, i,
2892 /* other nid->control mapping */
2893 for (i = 0; i < spec->num_mixers; i++) {
2894 for (knew = spec->mixers[i]; knew->name; knew++) {
2895 if (knew->iface != NID_MAPPING)
2897 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2900 u = knew->subdevice;
2901 for (j = 0; j < 4; j++, u >>= 8) {
2906 case SUBDEV_SPEAKER_:
2907 nid = spec->autocfg.speaker_pins[nid];
2910 nid = spec->autocfg.line_out_pins[nid];
2913 nid = spec->autocfg.hp_pins[nid];
2918 err = snd_hda_add_nid(codec, kctl, 0, nid);
2922 u = knew->private_value;
2923 for (j = 0; j < 4; j++, u >>= 8) {
2927 err = snd_hda_add_nid(codec, kctl, 0, nid);
2934 alc_free_kctls(codec); /* no longer needed */
2941 * initialize the codec volumes, etc
2945 * generic initialization of ADC, input mixers and output mixers
2947 static struct hda_verb alc880_volume_init_verbs[] = {
2949 * Unmute ADC0-2 and set the default input to mic-in
2951 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2952 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2953 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2954 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2955 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2956 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2958 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2960 * Note: PASD motherboards uses the Line In 2 as the input for front
2963 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2964 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2965 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2966 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2967 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2968 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2969 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2970 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2973 * Set up output mixers (0x0c - 0x0f)
2975 /* set vol=0 to output mixers */
2976 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2977 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2978 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2979 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2980 /* set up input amps for analog loopback */
2981 /* Amp Indices: DAC = 0, mixer = 1 */
2982 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2983 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2984 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2985 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2986 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2987 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2988 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2989 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2995 * 3-stack pin configuration:
2996 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2998 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3000 * preset connection lists of input pins
3001 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3003 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3004 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3005 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3008 * Set pin mode and muting
3010 /* set front pin widgets 0x14 for output */
3011 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3012 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3013 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3014 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3015 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3016 /* Mic2 (as headphone out) for HP output */
3017 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3018 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3019 /* Line In pin widget for input */
3020 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3021 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3022 /* Line2 (as front mic) pin widget for input and vref at 80% */
3023 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3024 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3025 /* CD pin widget for input */
3026 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3032 * 5-stack pin configuration:
3033 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3034 * line-in/side = 0x1a, f-mic = 0x1b
3036 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3038 * preset connection lists of input pins
3039 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3041 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3042 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3045 * Set pin mode and muting
3047 /* set pin widgets 0x14-0x17 for output */
3048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3049 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3050 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3051 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3052 /* unmute pins for output (no gain on this amp) */
3053 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3054 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3055 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3056 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3058 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3059 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3060 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3061 /* Mic2 (as headphone out) for HP output */
3062 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3063 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3064 /* Line In pin widget for input */
3065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3066 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3067 /* Line2 (as front mic) pin widget for input and vref at 80% */
3068 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3069 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3070 /* CD pin widget for input */
3071 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3077 * W810 pin configuration:
3078 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3080 static struct hda_verb alc880_pin_w810_init_verbs[] = {
3081 /* hphone/speaker input selector: front DAC */
3082 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3084 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3085 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3086 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3087 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3088 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3089 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3091 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3092 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3098 * Z71V pin configuration:
3099 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3101 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3102 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3103 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3104 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3105 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3107 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3108 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3109 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3110 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3116 * 6-stack pin configuration:
3117 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3118 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3120 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3121 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3123 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3124 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3125 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3126 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3127 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3128 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3129 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3130 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3132 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3133 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3134 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3135 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3136 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3137 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3138 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3139 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3140 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3146 * Uniwill pin configuration:
3147 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3150 static struct hda_verb alc880_uniwill_init_verbs[] = {
3151 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3153 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3154 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3155 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3156 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3157 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3158 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3159 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3160 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3161 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3163 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3164 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3165 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3166 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3168 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3169 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3170 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3171 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3172 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3173 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3174 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3175 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3176 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3178 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3179 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3186 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3188 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3189 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3191 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3192 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3193 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3194 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3195 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3196 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3197 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3198 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3199 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3200 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3201 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3202 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3204 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3205 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3206 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3207 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3208 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3209 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3211 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3212 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3217 static struct hda_verb alc880_beep_init_verbs[] = {
3218 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3222 /* auto-toggle front mic */
3223 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
3225 unsigned int present;
3228 present = snd_hda_jack_detect(codec, 0x18);
3229 bits = present ? HDA_AMP_MUTE : 0;
3230 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3233 static void alc880_uniwill_setup(struct hda_codec *codec)
3235 struct alc_spec *spec = codec->spec;
3237 spec->autocfg.hp_pins[0] = 0x14;
3238 spec->autocfg.speaker_pins[0] = 0x15;
3239 spec->autocfg.speaker_pins[0] = 0x16;
3242 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3244 alc_automute_amp(codec);
3245 alc880_uniwill_mic_automute(codec);
3248 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3251 /* Looks like the unsol event is incompatible with the standard
3252 * definition. 4bit tag is placed at 28 bit!
3254 switch (res >> 28) {
3255 case ALC880_MIC_EVENT:
3256 alc880_uniwill_mic_automute(codec);
3259 alc_automute_amp_unsol_event(codec, res);
3264 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3266 struct alc_spec *spec = codec->spec;
3268 spec->autocfg.hp_pins[0] = 0x14;
3269 spec->autocfg.speaker_pins[0] = 0x15;
3272 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3274 unsigned int present;
3276 present = snd_hda_codec_read(codec, 0x21, 0,
3277 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3278 present &= HDA_AMP_VOLMASK;
3279 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3280 HDA_AMP_VOLMASK, present);
3281 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3282 HDA_AMP_VOLMASK, present);
3285 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3288 /* Looks like the unsol event is incompatible with the standard
3289 * definition. 4bit tag is placed at 28 bit!
3291 if ((res >> 28) == ALC880_DCVOL_EVENT)
3292 alc880_uniwill_p53_dcvol_automute(codec);
3294 alc_automute_amp_unsol_event(codec, res);
3298 * F1734 pin configuration:
3299 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3301 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3302 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3303 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3304 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3305 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3306 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3309 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3310 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3311 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3313 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3314 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3315 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3316 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3317 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3318 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3319 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3320 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3321 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3323 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3324 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3330 * ASUS pin configuration:
3331 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3333 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3334 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3335 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3336 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3337 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3339 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3340 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3341 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3342 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3343 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3344 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3345 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3346 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3348 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3349 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3350 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3351 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3352 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3353 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3354 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3355 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3356 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3361 /* Enable GPIO mask and set output */
3362 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3363 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3364 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3366 /* Clevo m520g init */
3367 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3368 /* headphone output */
3369 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3371 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3372 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3374 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3375 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3377 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3378 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3379 /* Mic1 (rear panel) */
3380 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3381 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3382 /* Mic2 (front panel) */
3383 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3384 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3386 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3387 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3388 /* change to EAPD mode */
3389 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3390 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3395 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3396 /* change to EAPD mode */
3397 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3398 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3400 /* Headphone output */
3401 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3403 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3404 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3406 /* Line In pin widget for input */
3407 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3408 /* CD pin widget for input */
3409 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3410 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3411 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3413 /* change to EAPD mode */
3414 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3415 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3421 * LG m1 express dual
3424 * Rear Line-In/Out (blue): 0x14
3425 * Build-in Mic-In: 0x15
3427 * HP-Out (green): 0x1b
3428 * Mic-In/Out (red): 0x19
3432 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3433 static hda_nid_t alc880_lg_dac_nids[3] = {
3437 /* seems analog CD is not working */
3438 static struct hda_input_mux alc880_lg_capture_source = {
3443 { "Internal Mic", 0x6 },
3447 /* 2,4,6 channel modes */
3448 static struct hda_verb alc880_lg_ch2_init[] = {
3449 /* set line-in and mic-in to input */
3450 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3451 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3455 static struct hda_verb alc880_lg_ch4_init[] = {
3456 /* set line-in to out and mic-in to input */
3457 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3458 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3462 static struct hda_verb alc880_lg_ch6_init[] = {
3463 /* set line-in and mic-in to output */
3464 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3465 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3469 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3470 { 2, alc880_lg_ch2_init },
3471 { 4, alc880_lg_ch4_init },
3472 { 6, alc880_lg_ch6_init },
3475 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3476 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3477 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3478 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3479 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3480 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3481 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3482 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3483 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3485 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3486 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3487 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3488 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3489 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3491 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3492 .name = "Channel Mode",
3493 .info = alc_ch_mode_info,
3494 .get = alc_ch_mode_get,
3495 .put = alc_ch_mode_put,
3500 static struct hda_verb alc880_lg_init_verbs[] = {
3501 /* set capture source to mic-in */
3502 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3503 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3504 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3505 /* mute all amp mixer inputs */
3506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3509 /* line-in to input */
3510 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3511 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3513 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3514 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3516 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3517 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3518 /* mic-in to input */
3519 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3520 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3521 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3523 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3524 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3525 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3527 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3531 /* toggle speaker-output according to the hp-jack state */
3532 static void alc880_lg_setup(struct hda_codec *codec)
3534 struct alc_spec *spec = codec->spec;
3536 spec->autocfg.hp_pins[0] = 0x1b;
3537 spec->autocfg.speaker_pins[0] = 0x17;
3546 * Built-in Mic-In: 0x19
3552 static struct hda_input_mux alc880_lg_lw_capture_source = {
3556 { "Internal Mic", 0x1 },
3561 #define alc880_lg_lw_modes alc880_threestack_modes
3563 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3564 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3565 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3566 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3567 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3568 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3569 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3570 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3571 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3572 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3573 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3574 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3575 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3576 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3577 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3579 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3580 .name = "Channel Mode",
3581 .info = alc_ch_mode_info,
3582 .get = alc_ch_mode_get,
3583 .put = alc_ch_mode_put,
3588 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3589 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3590 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3591 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3593 /* set capture source to mic-in */
3594 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3597 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3599 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3602 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3603 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3604 /* mic-in to input */
3605 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3606 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3608 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3609 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3611 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3615 /* toggle speaker-output according to the hp-jack state */
3616 static void alc880_lg_lw_setup(struct hda_codec *codec)
3618 struct alc_spec *spec = codec->spec;
3620 spec->autocfg.hp_pins[0] = 0x1b;
3621 spec->autocfg.speaker_pins[0] = 0x14;
3624 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3625 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3626 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3627 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3628 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3629 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3630 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3634 static struct hda_input_mux alc880_medion_rim_capture_source = {
3638 { "Internal Mic", 0x1 },
3642 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3643 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3645 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3646 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3648 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3649 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3650 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3651 /* Mic2 (as headphone out) for HP output */
3652 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3653 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3654 /* Internal Speaker */
3655 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3656 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3658 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3659 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3661 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3665 /* toggle speaker-output according to the hp-jack state */
3666 static void alc880_medion_rim_automute(struct hda_codec *codec)
3668 struct alc_spec *spec = codec->spec;
3669 alc_automute_amp(codec);
3671 if (spec->jack_present)
3672 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3674 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3677 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3680 /* Looks like the unsol event is incompatible with the standard
3681 * definition. 4bit tag is placed at 28 bit!
3683 if ((res >> 28) == ALC880_HP_EVENT)
3684 alc880_medion_rim_automute(codec);
3687 static void alc880_medion_rim_setup(struct hda_codec *codec)
3689 struct alc_spec *spec = codec->spec;
3691 spec->autocfg.hp_pins[0] = 0x14;
3692 spec->autocfg.speaker_pins[0] = 0x1b;
3695 #ifdef CONFIG_SND_HDA_POWER_SAVE
3696 static struct hda_amp_list alc880_loopbacks[] = {
3697 { 0x0b, HDA_INPUT, 0 },
3698 { 0x0b, HDA_INPUT, 1 },
3699 { 0x0b, HDA_INPUT, 2 },
3700 { 0x0b, HDA_INPUT, 3 },
3701 { 0x0b, HDA_INPUT, 4 },
3705 static struct hda_amp_list alc880_lg_loopbacks[] = {
3706 { 0x0b, HDA_INPUT, 1 },
3707 { 0x0b, HDA_INPUT, 6 },
3708 { 0x0b, HDA_INPUT, 7 },
3717 static int alc_init(struct hda_codec *codec)
3719 struct alc_spec *spec = codec->spec;
3723 alc_auto_init_amp(codec, spec->init_amp);
3725 for (i = 0; i < spec->num_init_verbs; i++)
3726 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3728 if (spec->init_hook)
3729 spec->init_hook(codec);
3731 #ifdef CONFIG_SND_HDA_POWER_SAVE
3732 if (codec->patch_ops.check_power_status)
3733 codec->patch_ops.check_power_status(codec, 0x01);
3738 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3740 struct alc_spec *spec = codec->spec;
3742 if (spec->unsol_event)
3743 spec->unsol_event(codec, res);
3746 #ifdef CONFIG_SND_HDA_POWER_SAVE
3747 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3749 struct alc_spec *spec = codec->spec;
3750 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3755 * Analog playback callbacks
3757 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3758 struct hda_codec *codec,
3759 struct snd_pcm_substream *substream)
3761 struct alc_spec *spec = codec->spec;
3762 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3766 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3767 struct hda_codec *codec,
3768 unsigned int stream_tag,
3769 unsigned int format,
3770 struct snd_pcm_substream *substream)
3772 struct alc_spec *spec = codec->spec;
3773 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3774 stream_tag, format, substream);
3777 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3778 struct hda_codec *codec,
3779 struct snd_pcm_substream *substream)
3781 struct alc_spec *spec = codec->spec;
3782 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3788 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3789 struct hda_codec *codec,
3790 struct snd_pcm_substream *substream)
3792 struct alc_spec *spec = codec->spec;
3793 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3796 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3797 struct hda_codec *codec,
3798 unsigned int stream_tag,
3799 unsigned int format,
3800 struct snd_pcm_substream *substream)
3802 struct alc_spec *spec = codec->spec;
3803 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3804 stream_tag, format, substream);
3807 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3808 struct hda_codec *codec,
3809 struct snd_pcm_substream *substream)
3811 struct alc_spec *spec = codec->spec;
3812 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3815 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3816 struct hda_codec *codec,
3817 struct snd_pcm_substream *substream)
3819 struct alc_spec *spec = codec->spec;
3820 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3826 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3827 struct hda_codec *codec,
3828 unsigned int stream_tag,
3829 unsigned int format,
3830 struct snd_pcm_substream *substream)
3832 struct alc_spec *spec = codec->spec;
3834 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3835 stream_tag, 0, format);
3839 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3840 struct hda_codec *codec,
3841 struct snd_pcm_substream *substream)
3843 struct alc_spec *spec = codec->spec;
3845 snd_hda_codec_cleanup_stream(codec,
3846 spec->adc_nids[substream->number + 1]);
3850 /* analog capture with dynamic dual-adc changes */
3851 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3852 struct hda_codec *codec,
3853 unsigned int stream_tag,
3854 unsigned int format,
3855 struct snd_pcm_substream *substream)
3857 struct alc_spec *spec = codec->spec;
3858 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
3859 spec->cur_adc_stream_tag = stream_tag;
3860 spec->cur_adc_format = format;
3861 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
3865 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3866 struct hda_codec *codec,
3867 struct snd_pcm_substream *substream)
3869 struct alc_spec *spec = codec->spec;
3870 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
3875 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
3879 .nid = 0, /* fill later */
3881 .prepare = dualmic_capture_pcm_prepare,
3882 .cleanup = dualmic_capture_pcm_cleanup
3888 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3892 /* NID is set in alc_build_pcms */
3894 .open = alc880_playback_pcm_open,
3895 .prepare = alc880_playback_pcm_prepare,
3896 .cleanup = alc880_playback_pcm_cleanup
3900 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3904 /* NID is set in alc_build_pcms */
3907 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3911 /* NID is set in alc_build_pcms */
3914 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3915 .substreams = 2, /* can be overridden */
3918 /* NID is set in alc_build_pcms */
3920 .prepare = alc880_alt_capture_pcm_prepare,
3921 .cleanup = alc880_alt_capture_pcm_cleanup
3925 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3929 /* NID is set in alc_build_pcms */
3931 .open = alc880_dig_playback_pcm_open,
3932 .close = alc880_dig_playback_pcm_close,
3933 .prepare = alc880_dig_playback_pcm_prepare,
3934 .cleanup = alc880_dig_playback_pcm_cleanup
3938 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3942 /* NID is set in alc_build_pcms */
3945 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3946 static struct hda_pcm_stream alc_pcm_null_stream = {
3952 static int alc_build_pcms(struct hda_codec *codec)
3954 struct alc_spec *spec = codec->spec;
3955 struct hda_pcm *info = spec->pcm_rec;
3958 codec->num_pcms = 1;
3959 codec->pcm_info = info;
3961 if (spec->no_analog)
3964 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3965 "%s Analog", codec->chip_name);
3966 info->name = spec->stream_name_analog;
3968 if (spec->stream_analog_playback) {
3969 if (snd_BUG_ON(!spec->multiout.dac_nids))
3971 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3972 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3974 if (spec->stream_analog_capture) {
3975 if (snd_BUG_ON(!spec->adc_nids))
3977 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3978 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3981 if (spec->channel_mode) {
3982 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3983 for (i = 0; i < spec->num_channel_mode; i++) {
3984 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3985 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3991 /* SPDIF for stream index #1 */
3992 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3993 snprintf(spec->stream_name_digital,
3994 sizeof(spec->stream_name_digital),
3995 "%s Digital", codec->chip_name);
3996 codec->num_pcms = 2;
3997 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3998 info = spec->pcm_rec + 1;
3999 info->name = spec->stream_name_digital;
4000 if (spec->dig_out_type)
4001 info->pcm_type = spec->dig_out_type;
4003 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4004 if (spec->multiout.dig_out_nid &&
4005 spec->stream_digital_playback) {
4006 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4007 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4009 if (spec->dig_in_nid &&
4010 spec->stream_digital_capture) {
4011 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4012 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4014 /* FIXME: do we need this for all Realtek codec models? */
4015 codec->spdif_status_reset = 1;
4018 if (spec->no_analog)
4021 /* If the use of more than one ADC is requested for the current
4022 * model, configure a second analog capture-only PCM.
4024 /* Additional Analaog capture for index #2 */
4025 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4026 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4027 codec->num_pcms = 3;
4028 info = spec->pcm_rec + 2;
4029 info->name = spec->stream_name_analog;
4030 if (spec->alt_dac_nid) {
4031 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4032 *spec->stream_analog_alt_playback;
4033 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4036 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4037 alc_pcm_null_stream;
4038 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4040 if (spec->num_adc_nids > 1) {
4041 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4042 *spec->stream_analog_alt_capture;
4043 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4045 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4046 spec->num_adc_nids - 1;
4048 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4049 alc_pcm_null_stream;
4050 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4057 static inline void alc_shutup(struct hda_codec *codec)
4059 snd_hda_shutup_pins(codec);
4062 static void alc_free_kctls(struct hda_codec *codec)
4064 struct alc_spec *spec = codec->spec;
4066 if (spec->kctls.list) {
4067 struct snd_kcontrol_new *kctl = spec->kctls.list;
4069 for (i = 0; i < spec->kctls.used; i++)
4070 kfree(kctl[i].name);
4072 snd_array_free(&spec->kctls);
4075 static void alc_free(struct hda_codec *codec)
4077 struct alc_spec *spec = codec->spec;
4083 alc_free_kctls(codec);
4085 snd_hda_detach_beep_device(codec);
4088 #ifdef CONFIG_SND_HDA_POWER_SAVE
4089 static void alc_power_eapd(struct hda_codec *codec)
4091 /* We currently only handle front, HP */
4092 switch (codec->vendor_id) {
4094 set_eapd(codec, 0x0f, 0);
4095 set_eapd(codec, 0x10, 0);
4108 set_eapd(codec, 0x14, 0);
4109 set_eapd(codec, 0x15, 0);
4114 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4116 struct alc_spec *spec = codec->spec;
4118 if (spec && spec->power_hook)
4119 spec->power_hook(codec);
4124 #ifdef SND_HDA_NEEDS_RESUME
4125 static int alc_resume(struct hda_codec *codec)
4127 codec->patch_ops.init(codec);
4128 snd_hda_codec_resume_amp(codec);
4129 snd_hda_codec_resume_cache(codec);
4130 #ifdef CONFIG_SND_HDA_POWER_SAVE
4131 if (codec->patch_ops.check_power_status)
4132 codec->patch_ops.check_power_status(codec, 0x01);
4140 static struct hda_codec_ops alc_patch_ops = {
4141 .build_controls = alc_build_controls,
4142 .build_pcms = alc_build_pcms,
4145 .unsol_event = alc_unsol_event,
4146 #ifdef SND_HDA_NEEDS_RESUME
4147 .resume = alc_resume,
4149 #ifdef CONFIG_SND_HDA_POWER_SAVE
4150 .suspend = alc_suspend,
4151 .check_power_status = alc_check_power_status,
4153 .reboot_notify = alc_shutup,
4156 /* replace the codec chip_name with the given string */
4157 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4159 kfree(codec->chip_name);
4160 codec->chip_name = kstrdup(name, GFP_KERNEL);
4161 if (!codec->chip_name) {
4169 * Test configuration for debugging
4171 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4174 #ifdef CONFIG_SND_DEBUG
4175 static hda_nid_t alc880_test_dac_nids[4] = {
4176 0x02, 0x03, 0x04, 0x05
4179 static struct hda_input_mux alc880_test_capture_source = {
4188 { "Surround", 0x6 },
4192 static struct hda_channel_mode alc880_test_modes[4] = {
4199 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4200 struct snd_ctl_elem_info *uinfo)
4202 static char *texts[] = {
4203 "N/A", "Line Out", "HP Out",
4204 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4206 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4208 uinfo->value.enumerated.items = 8;
4209 if (uinfo->value.enumerated.item >= 8)
4210 uinfo->value.enumerated.item = 7;
4211 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4215 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4216 struct snd_ctl_elem_value *ucontrol)
4218 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4219 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4220 unsigned int pin_ctl, item = 0;
4222 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4223 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4224 if (pin_ctl & AC_PINCTL_OUT_EN) {
4225 if (pin_ctl & AC_PINCTL_HP_EN)
4229 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4230 switch (pin_ctl & AC_PINCTL_VREFEN) {
4231 case AC_PINCTL_VREF_HIZ: item = 3; break;
4232 case AC_PINCTL_VREF_50: item = 4; break;
4233 case AC_PINCTL_VREF_GRD: item = 5; break;
4234 case AC_PINCTL_VREF_80: item = 6; break;
4235 case AC_PINCTL_VREF_100: item = 7; break;
4238 ucontrol->value.enumerated.item[0] = item;
4242 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4243 struct snd_ctl_elem_value *ucontrol)
4245 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4246 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4247 static unsigned int ctls[] = {
4248 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4249 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4250 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4251 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4252 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4253 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4255 unsigned int old_ctl, new_ctl;
4257 old_ctl = snd_hda_codec_read(codec, nid, 0,
4258 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4259 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4260 if (old_ctl != new_ctl) {
4262 snd_hda_codec_write_cache(codec, nid, 0,
4263 AC_VERB_SET_PIN_WIDGET_CONTROL,
4265 val = ucontrol->value.enumerated.item[0] >= 3 ?
4267 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4274 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4275 struct snd_ctl_elem_info *uinfo)
4277 static char *texts[] = {
4278 "Front", "Surround", "CLFE", "Side"
4280 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4282 uinfo->value.enumerated.items = 4;
4283 if (uinfo->value.enumerated.item >= 4)
4284 uinfo->value.enumerated.item = 3;
4285 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4289 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4290 struct snd_ctl_elem_value *ucontrol)
4292 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4293 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4296 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4297 ucontrol->value.enumerated.item[0] = sel & 3;
4301 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4302 struct snd_ctl_elem_value *ucontrol)
4304 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4305 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4308 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4309 if (ucontrol->value.enumerated.item[0] != sel) {
4310 sel = ucontrol->value.enumerated.item[0] & 3;
4311 snd_hda_codec_write_cache(codec, nid, 0,
4312 AC_VERB_SET_CONNECT_SEL, sel);
4318 #define PIN_CTL_TEST(xname,nid) { \
4319 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4321 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4322 .info = alc_test_pin_ctl_info, \
4323 .get = alc_test_pin_ctl_get, \
4324 .put = alc_test_pin_ctl_put, \
4325 .private_value = nid \
4328 #define PIN_SRC_TEST(xname,nid) { \
4329 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4331 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4332 .info = alc_test_pin_src_info, \
4333 .get = alc_test_pin_src_get, \
4334 .put = alc_test_pin_src_put, \
4335 .private_value = nid \
4338 static struct snd_kcontrol_new alc880_test_mixer[] = {
4339 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4340 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4341 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4342 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4343 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4344 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4345 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4346 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4347 PIN_CTL_TEST("Front Pin Mode", 0x14),
4348 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4349 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4350 PIN_CTL_TEST("Side Pin Mode", 0x17),
4351 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4352 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4353 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4354 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4355 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4356 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4357 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4358 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4359 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4360 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4361 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4362 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4363 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4364 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4365 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4366 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4367 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4368 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4370 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4371 .name = "Channel Mode",
4372 .info = alc_ch_mode_info,
4373 .get = alc_ch_mode_get,
4374 .put = alc_ch_mode_put,
4379 static struct hda_verb alc880_test_init_verbs[] = {
4380 /* Unmute inputs of 0x0c - 0x0f */
4381 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4383 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4384 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4385 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4386 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4387 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4388 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4389 /* Vol output for 0x0c-0x0f */
4390 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4391 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4392 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4393 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4394 /* Set output pins 0x14-0x17 */
4395 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4396 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4397 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4398 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4399 /* Unmute output pins 0x14-0x17 */
4400 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4401 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4402 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4403 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4404 /* Set input pins 0x18-0x1c */
4405 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4406 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4407 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4408 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4409 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4410 /* Mute input pins 0x18-0x1b */
4411 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4412 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4413 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4414 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4416 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4417 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4418 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4419 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4420 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4421 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4422 /* Analog input/passthru */
4423 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4424 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4425 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4426 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4427 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4435 static const char *alc880_models[ALC880_MODEL_LAST] = {
4436 [ALC880_3ST] = "3stack",
4437 [ALC880_TCL_S700] = "tcl",
4438 [ALC880_3ST_DIG] = "3stack-digout",
4439 [ALC880_CLEVO] = "clevo",
4440 [ALC880_5ST] = "5stack",
4441 [ALC880_5ST_DIG] = "5stack-digout",
4442 [ALC880_W810] = "w810",
4443 [ALC880_Z71V] = "z71v",
4444 [ALC880_6ST] = "6stack",
4445 [ALC880_6ST_DIG] = "6stack-digout",
4446 [ALC880_ASUS] = "asus",
4447 [ALC880_ASUS_W1V] = "asus-w1v",
4448 [ALC880_ASUS_DIG] = "asus-dig",
4449 [ALC880_ASUS_DIG2] = "asus-dig2",
4450 [ALC880_UNIWILL_DIG] = "uniwill",
4451 [ALC880_UNIWILL_P53] = "uniwill-p53",
4452 [ALC880_FUJITSU] = "fujitsu",
4453 [ALC880_F1734] = "F1734",
4455 [ALC880_LG_LW] = "lg-lw",
4456 [ALC880_MEDION_RIM] = "medion",
4457 #ifdef CONFIG_SND_DEBUG
4458 [ALC880_TEST] = "test",
4460 [ALC880_AUTO] = "auto",
4463 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4464 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4465 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4466 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4467 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4468 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4469 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4470 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4471 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4472 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4473 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4474 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4475 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4476 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4477 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4478 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4479 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4480 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4481 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4482 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4483 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4484 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4485 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4486 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4487 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4488 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4489 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4490 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4491 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4492 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4493 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4494 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4495 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4496 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4497 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4498 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4499 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4500 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4501 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4502 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4503 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4504 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4505 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4506 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4507 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4508 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4509 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4510 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4511 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4512 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4513 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4514 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4515 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4516 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4517 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4518 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4519 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4520 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4521 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4522 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4523 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4524 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4525 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4526 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4527 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4528 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4529 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4530 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4531 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4533 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4534 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4535 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4540 * ALC880 codec presets
4542 static struct alc_config_preset alc880_presets[] = {
4544 .mixers = { alc880_three_stack_mixer },
4545 .init_verbs = { alc880_volume_init_verbs,
4546 alc880_pin_3stack_init_verbs },
4547 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4548 .dac_nids = alc880_dac_nids,
4549 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4550 .channel_mode = alc880_threestack_modes,
4552 .input_mux = &alc880_capture_source,
4554 [ALC880_3ST_DIG] = {
4555 .mixers = { alc880_three_stack_mixer },
4556 .init_verbs = { alc880_volume_init_verbs,
4557 alc880_pin_3stack_init_verbs },
4558 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4559 .dac_nids = alc880_dac_nids,
4560 .dig_out_nid = ALC880_DIGOUT_NID,
4561 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4562 .channel_mode = alc880_threestack_modes,
4564 .input_mux = &alc880_capture_source,
4566 [ALC880_TCL_S700] = {
4567 .mixers = { alc880_tcl_s700_mixer },
4568 .init_verbs = { alc880_volume_init_verbs,
4569 alc880_pin_tcl_S700_init_verbs,
4570 alc880_gpio2_init_verbs },
4571 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4572 .dac_nids = alc880_dac_nids,
4573 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4574 .num_adc_nids = 1, /* single ADC */
4576 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4577 .channel_mode = alc880_2_jack_modes,
4578 .input_mux = &alc880_capture_source,
4581 .mixers = { alc880_three_stack_mixer,
4582 alc880_five_stack_mixer},
4583 .init_verbs = { alc880_volume_init_verbs,
4584 alc880_pin_5stack_init_verbs },
4585 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4586 .dac_nids = alc880_dac_nids,
4587 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4588 .channel_mode = alc880_fivestack_modes,
4589 .input_mux = &alc880_capture_source,
4591 [ALC880_5ST_DIG] = {
4592 .mixers = { alc880_three_stack_mixer,
4593 alc880_five_stack_mixer },
4594 .init_verbs = { alc880_volume_init_verbs,
4595 alc880_pin_5stack_init_verbs },
4596 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4597 .dac_nids = alc880_dac_nids,
4598 .dig_out_nid = ALC880_DIGOUT_NID,
4599 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4600 .channel_mode = alc880_fivestack_modes,
4601 .input_mux = &alc880_capture_source,
4604 .mixers = { alc880_six_stack_mixer },
4605 .init_verbs = { alc880_volume_init_verbs,
4606 alc880_pin_6stack_init_verbs },
4607 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4608 .dac_nids = alc880_6st_dac_nids,
4609 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4610 .channel_mode = alc880_sixstack_modes,
4611 .input_mux = &alc880_6stack_capture_source,
4613 [ALC880_6ST_DIG] = {
4614 .mixers = { alc880_six_stack_mixer },
4615 .init_verbs = { alc880_volume_init_verbs,
4616 alc880_pin_6stack_init_verbs },
4617 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4618 .dac_nids = alc880_6st_dac_nids,
4619 .dig_out_nid = ALC880_DIGOUT_NID,
4620 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4621 .channel_mode = alc880_sixstack_modes,
4622 .input_mux = &alc880_6stack_capture_source,
4625 .mixers = { alc880_w810_base_mixer },
4626 .init_verbs = { alc880_volume_init_verbs,
4627 alc880_pin_w810_init_verbs,
4628 alc880_gpio2_init_verbs },
4629 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4630 .dac_nids = alc880_w810_dac_nids,
4631 .dig_out_nid = ALC880_DIGOUT_NID,
4632 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4633 .channel_mode = alc880_w810_modes,
4634 .input_mux = &alc880_capture_source,
4637 .mixers = { alc880_z71v_mixer },
4638 .init_verbs = { alc880_volume_init_verbs,
4639 alc880_pin_z71v_init_verbs },
4640 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4641 .dac_nids = alc880_z71v_dac_nids,
4642 .dig_out_nid = ALC880_DIGOUT_NID,
4644 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4645 .channel_mode = alc880_2_jack_modes,
4646 .input_mux = &alc880_capture_source,
4649 .mixers = { alc880_f1734_mixer },
4650 .init_verbs = { alc880_volume_init_verbs,
4651 alc880_pin_f1734_init_verbs },
4652 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4653 .dac_nids = alc880_f1734_dac_nids,
4655 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4656 .channel_mode = alc880_2_jack_modes,
4657 .input_mux = &alc880_f1734_capture_source,
4658 .unsol_event = alc880_uniwill_p53_unsol_event,
4659 .setup = alc880_uniwill_p53_setup,
4660 .init_hook = alc_automute_amp,
4663 .mixers = { alc880_asus_mixer },
4664 .init_verbs = { alc880_volume_init_verbs,
4665 alc880_pin_asus_init_verbs,
4666 alc880_gpio1_init_verbs },
4667 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4668 .dac_nids = alc880_asus_dac_nids,
4669 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4670 .channel_mode = alc880_asus_modes,
4672 .input_mux = &alc880_capture_source,
4674 [ALC880_ASUS_DIG] = {
4675 .mixers = { alc880_asus_mixer },
4676 .init_verbs = { alc880_volume_init_verbs,
4677 alc880_pin_asus_init_verbs,
4678 alc880_gpio1_init_verbs },
4679 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4680 .dac_nids = alc880_asus_dac_nids,
4681 .dig_out_nid = ALC880_DIGOUT_NID,
4682 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4683 .channel_mode = alc880_asus_modes,
4685 .input_mux = &alc880_capture_source,
4687 [ALC880_ASUS_DIG2] = {
4688 .mixers = { alc880_asus_mixer },
4689 .init_verbs = { alc880_volume_init_verbs,
4690 alc880_pin_asus_init_verbs,
4691 alc880_gpio2_init_verbs }, /* use GPIO2 */
4692 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4693 .dac_nids = alc880_asus_dac_nids,
4694 .dig_out_nid = ALC880_DIGOUT_NID,
4695 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4696 .channel_mode = alc880_asus_modes,
4698 .input_mux = &alc880_capture_source,
4700 [ALC880_ASUS_W1V] = {
4701 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4702 .init_verbs = { alc880_volume_init_verbs,
4703 alc880_pin_asus_init_verbs,
4704 alc880_gpio1_init_verbs },
4705 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4706 .dac_nids = alc880_asus_dac_nids,
4707 .dig_out_nid = ALC880_DIGOUT_NID,
4708 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4709 .channel_mode = alc880_asus_modes,
4711 .input_mux = &alc880_capture_source,
4713 [ALC880_UNIWILL_DIG] = {
4714 .mixers = { alc880_asus_mixer },
4715 .init_verbs = { alc880_volume_init_verbs,
4716 alc880_pin_asus_init_verbs },
4717 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4718 .dac_nids = alc880_asus_dac_nids,
4719 .dig_out_nid = ALC880_DIGOUT_NID,
4720 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4721 .channel_mode = alc880_asus_modes,
4723 .input_mux = &alc880_capture_source,
4725 [ALC880_UNIWILL] = {
4726 .mixers = { alc880_uniwill_mixer },
4727 .init_verbs = { alc880_volume_init_verbs,
4728 alc880_uniwill_init_verbs },
4729 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4730 .dac_nids = alc880_asus_dac_nids,
4731 .dig_out_nid = ALC880_DIGOUT_NID,
4732 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4733 .channel_mode = alc880_threestack_modes,
4735 .input_mux = &alc880_capture_source,
4736 .unsol_event = alc880_uniwill_unsol_event,
4737 .setup = alc880_uniwill_setup,
4738 .init_hook = alc880_uniwill_init_hook,
4740 [ALC880_UNIWILL_P53] = {
4741 .mixers = { alc880_uniwill_p53_mixer },
4742 .init_verbs = { alc880_volume_init_verbs,
4743 alc880_uniwill_p53_init_verbs },
4744 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4745 .dac_nids = alc880_asus_dac_nids,
4746 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4747 .channel_mode = alc880_threestack_modes,
4748 .input_mux = &alc880_capture_source,
4749 .unsol_event = alc880_uniwill_p53_unsol_event,
4750 .setup = alc880_uniwill_p53_setup,
4751 .init_hook = alc_automute_amp,
4753 [ALC880_FUJITSU] = {
4754 .mixers = { alc880_fujitsu_mixer },
4755 .init_verbs = { alc880_volume_init_verbs,
4756 alc880_uniwill_p53_init_verbs,
4757 alc880_beep_init_verbs },
4758 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4759 .dac_nids = alc880_dac_nids,
4760 .dig_out_nid = ALC880_DIGOUT_NID,
4761 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4762 .channel_mode = alc880_2_jack_modes,
4763 .input_mux = &alc880_capture_source,
4764 .unsol_event = alc880_uniwill_p53_unsol_event,
4765 .setup = alc880_uniwill_p53_setup,
4766 .init_hook = alc_automute_amp,
4769 .mixers = { alc880_three_stack_mixer },
4770 .init_verbs = { alc880_volume_init_verbs,
4771 alc880_pin_clevo_init_verbs },
4772 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4773 .dac_nids = alc880_dac_nids,
4775 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4776 .channel_mode = alc880_threestack_modes,
4778 .input_mux = &alc880_capture_source,
4781 .mixers = { alc880_lg_mixer },
4782 .init_verbs = { alc880_volume_init_verbs,
4783 alc880_lg_init_verbs },
4784 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4785 .dac_nids = alc880_lg_dac_nids,
4786 .dig_out_nid = ALC880_DIGOUT_NID,
4787 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4788 .channel_mode = alc880_lg_ch_modes,
4790 .input_mux = &alc880_lg_capture_source,
4791 .unsol_event = alc_automute_amp_unsol_event,
4792 .setup = alc880_lg_setup,
4793 .init_hook = alc_automute_amp,
4794 #ifdef CONFIG_SND_HDA_POWER_SAVE
4795 .loopbacks = alc880_lg_loopbacks,
4799 .mixers = { alc880_lg_lw_mixer },
4800 .init_verbs = { alc880_volume_init_verbs,
4801 alc880_lg_lw_init_verbs },
4802 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4803 .dac_nids = alc880_dac_nids,
4804 .dig_out_nid = ALC880_DIGOUT_NID,
4805 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4806 .channel_mode = alc880_lg_lw_modes,
4807 .input_mux = &alc880_lg_lw_capture_source,
4808 .unsol_event = alc_automute_amp_unsol_event,
4809 .setup = alc880_lg_lw_setup,
4810 .init_hook = alc_automute_amp,
4812 [ALC880_MEDION_RIM] = {
4813 .mixers = { alc880_medion_rim_mixer },
4814 .init_verbs = { alc880_volume_init_verbs,
4815 alc880_medion_rim_init_verbs,
4816 alc_gpio2_init_verbs },
4817 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4818 .dac_nids = alc880_dac_nids,
4819 .dig_out_nid = ALC880_DIGOUT_NID,
4820 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4821 .channel_mode = alc880_2_jack_modes,
4822 .input_mux = &alc880_medion_rim_capture_source,
4823 .unsol_event = alc880_medion_rim_unsol_event,
4824 .setup = alc880_medion_rim_setup,
4825 .init_hook = alc880_medion_rim_automute,
4827 #ifdef CONFIG_SND_DEBUG
4829 .mixers = { alc880_test_mixer },
4830 .init_verbs = { alc880_test_init_verbs },
4831 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4832 .dac_nids = alc880_test_dac_nids,
4833 .dig_out_nid = ALC880_DIGOUT_NID,
4834 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4835 .channel_mode = alc880_test_modes,
4836 .input_mux = &alc880_test_capture_source,
4842 * Automatic parse of I/O pins from the BIOS configuration
4847 ALC_CTL_WIDGET_MUTE,
4850 static struct snd_kcontrol_new alc880_control_templates[] = {
4851 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4852 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4853 HDA_BIND_MUTE(NULL, 0, 0, 0),
4856 /* add dynamic controls */
4857 static int add_control(struct alc_spec *spec, int type, const char *name,
4858 int cidx, unsigned long val)
4860 struct snd_kcontrol_new *knew;
4862 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4863 knew = snd_array_new(&spec->kctls);
4866 *knew = alc880_control_templates[type];
4867 knew->name = kstrdup(name, GFP_KERNEL);
4871 if (get_amp_nid_(val))
4872 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4873 knew->private_value = val;
4877 static int add_control_with_pfx(struct alc_spec *spec, int type,
4878 const char *pfx, const char *dir,
4879 const char *sfx, int cidx, unsigned long val)
4882 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4883 return add_control(spec, type, name, cidx, val);
4886 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4887 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
4888 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4889 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
4890 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
4891 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
4892 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
4893 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
4895 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4896 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4897 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4898 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4899 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4900 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4901 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4902 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4903 #define ALC880_PIN_CD_NID 0x1c
4905 /* fill in the dac_nids table from the parsed pin configuration */
4906 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4907 const struct auto_pin_cfg *cfg)
4913 memset(assigned, 0, sizeof(assigned));
4914 spec->multiout.dac_nids = spec->private_dac_nids;
4916 /* check the pins hardwired to audio widget */
4917 for (i = 0; i < cfg->line_outs; i++) {
4918 nid = cfg->line_out_pins[i];
4919 if (alc880_is_fixed_pin(nid)) {
4920 int idx = alc880_fixed_pin_idx(nid);
4921 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4925 /* left pins can be connect to any audio widget */
4926 for (i = 0; i < cfg->line_outs; i++) {
4927 nid = cfg->line_out_pins[i];
4928 if (alc880_is_fixed_pin(nid))
4930 /* search for an empty channel */
4931 for (j = 0; j < cfg->line_outs; j++) {
4933 spec->multiout.dac_nids[i] =
4934 alc880_idx_to_dac(j);
4940 spec->multiout.num_dacs = cfg->line_outs;
4944 /* add playback controls from the parsed DAC table */
4945 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4946 const struct auto_pin_cfg *cfg)
4948 static const char *chname[4] = {
4949 "Front", "Surround", NULL /*CLFE*/, "Side"
4954 for (i = 0; i < cfg->line_outs; i++) {
4955 if (!spec->multiout.dac_nids[i])
4957 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4960 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4962 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4966 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4968 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4972 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4974 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4978 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4980 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4986 if (cfg->line_outs == 1 &&
4987 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4991 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4992 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4996 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4997 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5006 /* add playback controls for speaker and HP outputs */
5007 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5016 if (alc880_is_fixed_pin(pin)) {
5017 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5018 /* specify the DAC as the extra output */
5019 if (!spec->multiout.hp_nid)
5020 spec->multiout.hp_nid = nid;
5022 spec->multiout.extra_out_nid[0] = nid;
5023 /* control HP volume/switch on the output mixer amp */
5024 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5025 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5026 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5029 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5030 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5033 } else if (alc880_is_multi_pin(pin)) {
5034 /* set manual connection */
5035 /* we have only a switch on HP-out PIN */
5036 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5037 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5044 /* create input playback/capture controls for the given pin */
5045 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5046 const char *ctlname, int ctlidx,
5047 int idx, hda_nid_t mix_nid)
5051 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5052 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5055 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5056 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5062 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5064 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5065 return (pincap & AC_PINCAP_IN) != 0;
5068 /* create playback/capture controls for input pins */
5069 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5070 const struct auto_pin_cfg *cfg,
5072 hda_nid_t cap1, hda_nid_t cap2)
5074 struct alc_spec *spec = codec->spec;
5075 struct hda_input_mux *imux = &spec->private_imux[0];
5076 int i, err, idx, type, type_idx = 0;
5078 for (i = 0; i < cfg->num_inputs; i++) {
5082 pin = cfg->inputs[i].pin;
5083 if (!alc_is_input_pin(codec, pin))
5086 type = cfg->inputs[i].type;
5087 if (i > 0 && type == cfg->inputs[i - 1].type)
5091 label = hda_get_autocfg_input_label(codec, cfg, i);
5093 idx = get_connection_index(codec, mixer, pin);
5095 err = new_analog_input(spec, pin,
5105 idx = get_connection_index(codec, cap1, pin);
5106 if (idx < 0 && cap2)
5107 idx = get_connection_index(codec, cap2, pin);
5109 snd_hda_add_imux_item(imux, label, idx, NULL);
5114 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5115 const struct auto_pin_cfg *cfg)
5117 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5120 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5121 unsigned int pin_type)
5123 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5126 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5130 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5131 hda_nid_t nid, int pin_type,
5134 alc_set_pin_output(codec, nid, pin_type);
5135 /* need the manual connection? */
5136 if (alc880_is_multi_pin(nid)) {
5137 struct alc_spec *spec = codec->spec;
5138 int idx = alc880_multi_pin_idx(nid);
5139 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5140 AC_VERB_SET_CONNECT_SEL,
5141 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5145 static int get_pin_type(int line_out_type)
5147 if (line_out_type == AUTO_PIN_HP_OUT)
5153 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5155 struct alc_spec *spec = codec->spec;
5158 for (i = 0; i < spec->autocfg.line_outs; i++) {
5159 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5160 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5161 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5165 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5167 struct alc_spec *spec = codec->spec;
5170 pin = spec->autocfg.speaker_pins[0];
5171 if (pin) /* connect to front */
5172 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5173 pin = spec->autocfg.hp_pins[0];
5174 if (pin) /* connect to front */
5175 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5178 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5180 struct alc_spec *spec = codec->spec;
5181 struct auto_pin_cfg *cfg = &spec->autocfg;
5184 for (i = 0; i < cfg->num_inputs; i++) {
5185 hda_nid_t nid = cfg->inputs[i].pin;
5186 if (alc_is_input_pin(codec, nid)) {
5187 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5188 if (nid != ALC880_PIN_CD_NID &&
5189 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5190 snd_hda_codec_write(codec, nid, 0,
5191 AC_VERB_SET_AMP_GAIN_MUTE,
5197 static void alc880_auto_init_input_src(struct hda_codec *codec)
5199 struct alc_spec *spec = codec->spec;
5202 for (c = 0; c < spec->num_adc_nids; c++) {
5203 unsigned int mux_idx;
5204 const struct hda_input_mux *imux;
5205 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5206 imux = &spec->input_mux[mux_idx];
5207 if (!imux->num_items && mux_idx > 0)
5208 imux = &spec->input_mux[0];
5210 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5211 AC_VERB_SET_CONNECT_SEL,
5212 imux->items[0].index);
5216 /* parse the BIOS configuration and set up the alc_spec */
5217 /* return 1 if successful, 0 if the proper config is not found,
5218 * or a negative error code
5220 static int alc880_parse_auto_config(struct hda_codec *codec)
5222 struct alc_spec *spec = codec->spec;
5224 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5226 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5230 if (!spec->autocfg.line_outs)
5231 return 0; /* can't find valid BIOS pin config */
5233 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5236 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5239 err = alc880_auto_create_extra_out(spec,
5240 spec->autocfg.speaker_pins[0],
5244 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5248 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5252 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5254 alc_auto_parse_digital(codec);
5256 if (spec->kctls.list)
5257 add_mixer(spec, spec->kctls.list);
5259 add_verb(spec, alc880_volume_init_verbs);
5261 spec->num_mux_defs = 1;
5262 spec->input_mux = &spec->private_imux[0];
5264 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5269 /* additional initialization for auto-configuration model */
5270 static void alc880_auto_init(struct hda_codec *codec)
5272 struct alc_spec *spec = codec->spec;
5273 alc880_auto_init_multi_out(codec);
5274 alc880_auto_init_extra_out(codec);
5275 alc880_auto_init_analog_input(codec);
5276 alc880_auto_init_input_src(codec);
5277 alc_auto_init_digital(codec);
5278 if (spec->unsol_event)
5279 alc_inithook(codec);
5282 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5283 * one of two digital mic pins, e.g. on ALC272
5285 static void fixup_automic_adc(struct hda_codec *codec)
5287 struct alc_spec *spec = codec->spec;
5290 for (i = 0; i < spec->num_adc_nids; i++) {
5291 hda_nid_t cap = spec->capsrc_nids ?
5292 spec->capsrc_nids[i] : spec->adc_nids[i];
5295 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5298 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5301 spec->int_mic.mux_idx = iidx;
5302 spec->ext_mic.mux_idx = eidx;
5303 if (spec->capsrc_nids)
5304 spec->capsrc_nids += i;
5305 spec->adc_nids += i;
5306 spec->num_adc_nids = 1;
5309 snd_printd(KERN_INFO "hda_codec: %s: "
5310 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5311 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5312 spec->auto_mic = 0; /* disable auto-mic to be sure */
5315 /* select or unmute the given capsrc route */
5316 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5319 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5320 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5323 snd_hda_codec_write_cache(codec, cap, 0,
5324 AC_VERB_SET_CONNECT_SEL, idx);
5328 /* set the default connection to that pin */
5329 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5331 struct alc_spec *spec = codec->spec;
5334 for (i = 0; i < spec->num_adc_nids; i++) {
5335 hda_nid_t cap = spec->capsrc_nids ?
5336 spec->capsrc_nids[i] : spec->adc_nids[i];
5339 idx = get_connection_index(codec, cap, pin);
5342 select_or_unmute_capsrc(codec, cap, idx);
5343 return i; /* return the found index */
5345 return -1; /* not found */
5348 /* choose the ADC/MUX containing the input pin and initialize the setup */
5349 static void fixup_single_adc(struct hda_codec *codec)
5351 struct alc_spec *spec = codec->spec;
5352 struct auto_pin_cfg *cfg = &spec->autocfg;
5355 /* search for the input pin; there must be only one */
5356 if (cfg->num_inputs != 1)
5358 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5360 /* use only this ADC */
5361 if (spec->capsrc_nids)
5362 spec->capsrc_nids += i;
5363 spec->adc_nids += i;
5364 spec->num_adc_nids = 1;
5368 /* initialize dual adcs */
5369 static void fixup_dual_adc_switch(struct hda_codec *codec)
5371 struct alc_spec *spec = codec->spec;
5372 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5373 init_capsrc_for_pin(codec, spec->int_mic.pin);
5376 static void set_capture_mixer(struct hda_codec *codec)
5378 struct alc_spec *spec = codec->spec;
5379 static struct snd_kcontrol_new *caps[2][3] = {
5380 { alc_capture_mixer_nosrc1,
5381 alc_capture_mixer_nosrc2,
5382 alc_capture_mixer_nosrc3 },
5383 { alc_capture_mixer1,
5385 alc_capture_mixer3 },
5387 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5389 int num_adcs = spec->num_adc_nids;
5390 if (spec->dual_adc_switch)
5391 fixup_dual_adc_switch(codec);
5392 else if (spec->auto_mic)
5393 fixup_automic_adc(codec);
5394 else if (spec->input_mux) {
5395 if (spec->input_mux->num_items > 1)
5397 else if (spec->input_mux->num_items == 1)
5398 fixup_single_adc(codec);
5400 if (spec->dual_adc_switch)
5402 spec->cap_mixer = caps[mux][num_adcs - 1];
5406 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5407 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5410 struct alc_spec *spec = codec->spec;
5411 struct auto_pin_cfg *cfg = &spec->autocfg;
5413 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5415 for (n = 0; n < num_nids; n++) {
5417 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5421 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5424 nconns = snd_hda_get_connections(codec, cap, conn,
5428 nconns = snd_hda_get_connections(codec, cap, conn,
5433 if (!fallback_adc) {
5437 for (i = 0; i < cfg->num_inputs; i++) {
5438 hda_nid_t nid = cfg->inputs[i].pin;
5439 for (j = 0; j < nconns; j++) {
5446 if (i >= cfg->num_inputs) {
5447 int num_adcs = spec->num_adc_nids;
5448 spec->private_adc_nids[num_adcs] = adc;
5449 spec->private_capsrc_nids[num_adcs] = cap;
5450 spec->num_adc_nids++;
5451 spec->adc_nids = spec->private_adc_nids;
5453 spec->capsrc_nids = spec->private_capsrc_nids;
5456 if (!spec->num_adc_nids) {
5457 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5458 " using fallback 0x%x\n",
5459 codec->chip_name, fallback_adc);
5460 spec->private_adc_nids[0] = fallback_adc;
5461 spec->adc_nids = spec->private_adc_nids;
5462 if (fallback_adc != fallback_cap) {
5463 spec->private_capsrc_nids[0] = fallback_cap;
5464 spec->capsrc_nids = spec->private_adc_nids;
5469 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5470 #define set_beep_amp(spec, nid, idx, dir) \
5471 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5473 static struct snd_pci_quirk beep_white_list[] = {
5474 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5475 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5476 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5480 static inline int has_cdefine_beep(struct hda_codec *codec)
5482 struct alc_spec *spec = codec->spec;
5483 const struct snd_pci_quirk *q;
5484 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5487 return spec->cdefine.enable_pcbeep;
5490 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5491 #define has_cdefine_beep(codec) 0
5495 * OK, here we have finally the patch for ALC880
5498 static int patch_alc880(struct hda_codec *codec)
5500 struct alc_spec *spec;
5504 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5510 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5513 if (board_config < 0) {
5514 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5516 board_config = ALC880_AUTO;
5519 if (board_config == ALC880_AUTO) {
5520 /* automatic parse from the BIOS config */
5521 err = alc880_parse_auto_config(codec);
5527 "hda_codec: Cannot set up configuration "
5528 "from BIOS. Using 3-stack mode...\n");
5529 board_config = ALC880_3ST;
5533 err = snd_hda_attach_beep_device(codec, 0x1);
5539 if (board_config != ALC880_AUTO)
5540 setup_preset(codec, &alc880_presets[board_config]);
5542 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5543 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5544 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5546 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5547 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5549 if (!spec->adc_nids && spec->input_mux) {
5550 /* check whether NID 0x07 is valid */
5551 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5553 wcap = get_wcaps_type(wcap);
5554 if (wcap != AC_WID_AUD_IN) {
5555 spec->adc_nids = alc880_adc_nids_alt;
5556 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5558 spec->adc_nids = alc880_adc_nids;
5559 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5562 set_capture_mixer(codec);
5563 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5565 spec->vmaster_nid = 0x0c;
5567 codec->patch_ops = alc_patch_ops;
5568 if (board_config == ALC880_AUTO)
5569 spec->init_hook = alc880_auto_init;
5570 #ifdef CONFIG_SND_HDA_POWER_SAVE
5571 if (!spec->loopback.amplist)
5572 spec->loopback.amplist = alc880_loopbacks;
5583 static hda_nid_t alc260_dac_nids[1] = {
5588 static hda_nid_t alc260_adc_nids[1] = {
5593 static hda_nid_t alc260_adc_nids_alt[1] = {
5598 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5599 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5601 static hda_nid_t alc260_dual_adc_nids[2] = {
5606 #define ALC260_DIGOUT_NID 0x03
5607 #define ALC260_DIGIN_NID 0x06
5609 static struct hda_input_mux alc260_capture_source = {
5613 { "Front Mic", 0x1 },
5619 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5620 * headphone jack and the internal CD lines since these are the only pins at
5621 * which audio can appear. For flexibility, also allow the option of
5622 * recording the mixer output on the second ADC (ADC0 doesn't have a
5623 * connection to the mixer output).
5625 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5629 { "Mic/Line", 0x0 },
5631 { "Headphone", 0x2 },
5637 { "Mic/Line", 0x0 },
5639 { "Headphone", 0x2 },
5646 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5647 * the Fujitsu S702x, but jacks are marked differently.
5649 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5656 { "Headphone", 0x5 },
5665 { "Headphone", 0x6 },
5671 /* Maxdata Favorit 100XS */
5672 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5676 { "Line/Mic", 0x0 },
5683 { "Line/Mic", 0x0 },
5691 * This is just place-holder, so there's something for alc_build_pcms to look
5692 * at when it calculates the maximum number of channels. ALC260 has no mixer
5693 * element which allows changing the channel mode, so the verb list is
5696 static struct hda_channel_mode alc260_modes[1] = {
5701 /* Mixer combinations
5703 * basic: base_output + input + pc_beep + capture
5704 * HP: base_output + input + capture_alt
5705 * HP_3013: hp_3013 + input + capture
5706 * fujitsu: fujitsu + capture
5707 * acer: acer + capture
5710 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5711 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5712 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5713 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5714 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5715 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5716 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5720 static struct snd_kcontrol_new alc260_input_mixer[] = {
5721 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5722 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5723 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5724 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5725 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5726 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5727 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5728 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5732 /* update HP, line and mono out pins according to the master switch */
5733 static void alc260_hp_master_update(struct hda_codec *codec,
5734 hda_nid_t hp, hda_nid_t line,
5737 struct alc_spec *spec = codec->spec;
5738 unsigned int val = spec->master_sw ? PIN_HP : 0;
5739 /* change HP and line-out pins */
5740 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5742 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5744 /* mono (speaker) depending on the HP jack sense */
5745 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5746 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5750 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5751 struct snd_ctl_elem_value *ucontrol)
5753 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5754 struct alc_spec *spec = codec->spec;
5755 *ucontrol->value.integer.value = spec->master_sw;
5759 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5760 struct snd_ctl_elem_value *ucontrol)
5762 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5763 struct alc_spec *spec = codec->spec;
5764 int val = !!*ucontrol->value.integer.value;
5765 hda_nid_t hp, line, mono;
5767 if (val == spec->master_sw)
5769 spec->master_sw = val;
5770 hp = (kcontrol->private_value >> 16) & 0xff;
5771 line = (kcontrol->private_value >> 8) & 0xff;
5772 mono = kcontrol->private_value & 0xff;
5773 alc260_hp_master_update(codec, hp, line, mono);
5777 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5779 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5780 .name = "Master Playback Switch",
5781 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5782 .info = snd_ctl_boolean_mono_info,
5783 .get = alc260_hp_master_sw_get,
5784 .put = alc260_hp_master_sw_put,
5785 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5787 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5788 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5789 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5790 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5791 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5793 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5797 static struct hda_verb alc260_hp_unsol_verbs[] = {
5798 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5802 static void alc260_hp_automute(struct hda_codec *codec)
5804 struct alc_spec *spec = codec->spec;
5806 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5807 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5810 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5812 if ((res >> 26) == ALC880_HP_EVENT)
5813 alc260_hp_automute(codec);
5816 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5818 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5819 .name = "Master Playback Switch",
5820 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5821 .info = snd_ctl_boolean_mono_info,
5822 .get = alc260_hp_master_sw_get,
5823 .put = alc260_hp_master_sw_put,
5824 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5826 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5827 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5828 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5829 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5830 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5831 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5832 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5833 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5837 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5838 .ops = &snd_hda_bind_vol,
5840 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5841 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5842 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5847 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5848 .ops = &snd_hda_bind_sw,
5850 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5851 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5856 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5857 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5858 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5859 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5860 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5864 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5865 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5869 static void alc260_hp_3013_automute(struct hda_codec *codec)
5871 struct alc_spec *spec = codec->spec;
5873 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5874 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5877 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5880 if ((res >> 26) == ALC880_HP_EVENT)
5881 alc260_hp_3013_automute(codec);
5884 static void alc260_hp_3012_automute(struct hda_codec *codec)
5886 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5888 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5890 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5892 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5896 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5899 if ((res >> 26) == ALC880_HP_EVENT)
5900 alc260_hp_3012_automute(codec);
5903 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5904 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5906 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5907 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5908 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5909 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5910 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5911 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5912 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5913 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5914 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5915 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5916 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5920 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5921 * versions of the ALC260 don't act on requests to enable mic bias from NID
5922 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5923 * datasheet doesn't mention this restriction. At this stage it's not clear
5924 * whether this behaviour is intentional or is a hardware bug in chip
5925 * revisions available in early 2006. Therefore for now allow the
5926 * "Headphone Jack Mode" control to span all choices, but if it turns out
5927 * that the lack of mic bias for this NID is intentional we could change the
5928 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5930 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5931 * don't appear to make the mic bias available from the "line" jack, even
5932 * though the NID used for this jack (0x14) can supply it. The theory is
5933 * that perhaps Acer have included blocking capacitors between the ALC260
5934 * and the output jack. If this turns out to be the case for all such
5935 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5936 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5938 * The C20x Tablet series have a mono internal speaker which is controlled
5939 * via the chip's Mono sum widget and pin complex, so include the necessary
5940 * controls for such models. On models without a "mono speaker" the control
5941 * won't do anything.
5943 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5944 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5945 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5946 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5947 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5949 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5951 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5952 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5954 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5955 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5956 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5957 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5958 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5962 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5964 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5965 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5966 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5967 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5968 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5969 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5970 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5974 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5975 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5977 static struct snd_kcontrol_new alc260_will_mixer[] = {
5978 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5979 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5981 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5982 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5983 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5984 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5985 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5986 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5987 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5991 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5992 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5994 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5995 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5996 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5998 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5999 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6000 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6001 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6002 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6003 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6004 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6009 * initialization verbs
6011 static struct hda_verb alc260_init_verbs[] = {
6012 /* Line In pin widget for input */
6013 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6014 /* CD pin widget for input */
6015 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6016 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6017 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6018 /* Mic2 (front panel) pin widget for input and vref at 80% */
6019 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6020 /* LINE-2 is used for line-out in rear */
6021 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6022 /* select line-out */
6023 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6025 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6027 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6029 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6030 /* mute capture amp left and right */
6031 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6032 /* set connection select to line in (default select for this ADC) */
6033 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6034 /* mute capture amp left and right */
6035 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6036 /* set connection select to line in (default select for this ADC) */
6037 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6038 /* set vol=0 Line-Out mixer amp left and right */
6039 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6040 /* unmute pin widget amp left and right (no gain on this amp) */
6041 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6042 /* set vol=0 HP mixer amp left and right */
6043 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6044 /* unmute pin widget amp left and right (no gain on this amp) */
6045 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6046 /* set vol=0 Mono mixer amp left and right */
6047 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6048 /* unmute pin widget amp left and right (no gain on this amp) */
6049 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6050 /* unmute LINE-2 out pin */
6051 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6052 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6055 /* mute analog inputs */
6056 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6058 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6059 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6061 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6062 /* mute Front out path */
6063 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6064 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6065 /* mute Headphone out path */
6066 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6067 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6068 /* mute Mono out path */
6069 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6070 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6074 #if 0 /* should be identical with alc260_init_verbs? */
6075 static struct hda_verb alc260_hp_init_verbs[] = {
6076 /* Headphone and output */
6077 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6079 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6080 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6081 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6082 /* Mic2 (front panel) pin widget for input and vref at 80% */
6083 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6084 /* Line In pin widget for input */
6085 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6086 /* Line-2 pin widget for output */
6087 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6088 /* CD pin widget for input */
6089 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6090 /* unmute amp left and right */
6091 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6092 /* set connection select to line in (default select for this ADC) */
6093 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6094 /* unmute Line-Out mixer amp left and right (volume = 0) */
6095 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6096 /* mute pin widget amp left and right (no gain on this amp) */
6097 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6098 /* unmute HP mixer amp left and right (volume = 0) */
6099 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6100 /* mute pin widget amp left and right (no gain on this amp) */
6101 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6102 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6105 /* mute analog inputs */
6106 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6111 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6112 /* Unmute Front out path */
6113 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6114 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6115 /* Unmute Headphone out path */
6116 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6117 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6118 /* Unmute Mono out path */
6119 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6120 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6125 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6126 /* Line out and output */
6127 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6129 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6130 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6131 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6132 /* Mic2 (front panel) pin widget for input and vref at 80% */
6133 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6134 /* Line In pin widget for input */
6135 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6136 /* Headphone pin widget for output */
6137 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6138 /* CD pin widget for input */
6139 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6140 /* unmute amp left and right */
6141 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6142 /* set connection select to line in (default select for this ADC) */
6143 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6144 /* unmute Line-Out mixer amp left and right (volume = 0) */
6145 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6146 /* mute pin widget amp left and right (no gain on this amp) */
6147 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6148 /* unmute HP mixer amp left and right (volume = 0) */
6149 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6150 /* mute pin widget amp left and right (no gain on this amp) */
6151 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6152 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6155 /* mute analog inputs */
6156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6159 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6161 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6162 /* Unmute Front out path */
6163 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6164 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6165 /* Unmute Headphone out path */
6166 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6167 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6168 /* Unmute Mono out path */
6169 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6170 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6174 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6175 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6176 * audio = 0x16, internal speaker = 0x10.
6178 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6179 /* Disable all GPIOs */
6180 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6181 /* Internal speaker is connected to headphone pin */
6182 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6183 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6184 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6185 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6186 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6187 /* Ensure all other unused pins are disabled and muted. */
6188 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6189 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6190 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6191 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6192 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6193 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6194 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6195 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6197 /* Disable digital (SPDIF) pins */
6198 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6199 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6201 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6202 * when acting as an output.
6204 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6206 /* Start with output sum widgets muted and their output gains at min */
6207 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6208 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6209 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6210 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6211 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6212 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6213 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6214 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6215 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6217 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6218 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6219 /* Unmute Line1 pin widget output buffer since it starts as an output.
6220 * If the pin mode is changed by the user the pin mode control will
6221 * take care of enabling the pin's input/output buffers as needed.
6222 * Therefore there's no need to enable the input buffer at this
6225 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6226 /* Unmute input buffer of pin widget used for Line-in (no equiv
6229 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6231 /* Mute capture amp left and right */
6232 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6233 /* Set ADC connection select to match default mixer setting - line
6236 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6238 /* Do the same for the second ADC: mute capture input amp and
6239 * set ADC connection to line in (on mic1 pin)
6241 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6242 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6244 /* Mute all inputs to mixer widget (even unconnected ones) */
6245 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6246 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6247 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6248 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6249 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6250 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6251 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6252 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6257 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6258 * similar laptops (adapted from Fujitsu init verbs).
6260 static struct hda_verb alc260_acer_init_verbs[] = {
6261 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6262 * the headphone jack. Turn this on and rely on the standard mute
6263 * methods whenever the user wants to turn these outputs off.
6265 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6266 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6267 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6268 /* Internal speaker/Headphone jack is connected to Line-out pin */
6269 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6270 /* Internal microphone/Mic jack is connected to Mic1 pin */
6271 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6272 /* Line In jack is connected to Line1 pin */
6273 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6274 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6275 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6276 /* Ensure all other unused pins are disabled and muted. */
6277 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6278 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6279 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6280 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6281 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6282 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6283 /* Disable digital (SPDIF) pins */
6284 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6285 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6287 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6288 * bus when acting as outputs.
6290 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6291 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6293 /* Start with output sum widgets muted and their output gains at min */
6294 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6295 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6296 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6297 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6298 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6299 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6300 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6301 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6302 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6304 /* Unmute Line-out pin widget amp left and right
6305 * (no equiv mixer ctrl)
6307 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6308 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6309 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6310 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6311 * inputs. If the pin mode is changed by the user the pin mode control
6312 * will take care of enabling the pin's input/output buffers as needed.
6313 * Therefore there's no need to enable the input buffer at this
6316 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6317 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6319 /* Mute capture amp left and right */
6320 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6321 /* Set ADC connection select to match default mixer setting - mic
6324 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6326 /* Do similar with the second ADC: mute capture input amp and
6327 * set ADC connection to mic to match ALSA's default state.
6329 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6330 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6332 /* Mute all inputs to mixer widget (even unconnected ones) */
6333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6336 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6337 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6345 /* Initialisation sequence for Maxdata Favorit 100XS
6346 * (adapted from Acer init verbs).
6348 static struct hda_verb alc260_favorit100_init_verbs[] = {
6349 /* GPIO 0 enables the output jack.
6350 * Turn this on and rely on the standard mute
6351 * methods whenever the user wants to turn these outputs off.
6353 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6354 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6355 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6356 /* Line/Mic input jack is connected to Mic1 pin */
6357 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6358 /* Ensure all other unused pins are disabled and muted. */
6359 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6360 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6361 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6362 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6363 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6364 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6365 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6366 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6367 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6369 /* Disable digital (SPDIF) pins */
6370 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6371 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6373 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6374 * bus when acting as outputs.
6376 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6377 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6379 /* Start with output sum widgets muted and their output gains at min */
6380 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6381 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6382 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6383 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6384 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6385 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6386 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6387 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6388 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6390 /* Unmute Line-out pin widget amp left and right
6391 * (no equiv mixer ctrl)
6393 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6394 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6395 * inputs. If the pin mode is changed by the user the pin mode control
6396 * will take care of enabling the pin's input/output buffers as needed.
6397 * Therefore there's no need to enable the input buffer at this
6400 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6402 /* Mute capture amp left and right */
6403 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6404 /* Set ADC connection select to match default mixer setting - mic
6407 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6409 /* Do similar with the second ADC: mute capture input amp and
6410 * set ADC connection to mic to match ALSA's default state.
6412 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6413 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6415 /* Mute all inputs to mixer widget (even unconnected ones) */
6416 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6420 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6421 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6422 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6423 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6428 static struct hda_verb alc260_will_verbs[] = {
6429 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6430 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6431 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6432 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6433 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6434 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6438 static struct hda_verb alc260_replacer_672v_verbs[] = {
6439 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6440 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6441 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6443 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6444 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6445 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6447 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6451 /* toggle speaker-output according to the hp-jack state */
6452 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6454 unsigned int present;
6456 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6457 present = snd_hda_jack_detect(codec, 0x0f);
6459 snd_hda_codec_write_cache(codec, 0x01, 0,
6460 AC_VERB_SET_GPIO_DATA, 1);
6461 snd_hda_codec_write_cache(codec, 0x0f, 0,
6462 AC_VERB_SET_PIN_WIDGET_CONTROL,
6465 snd_hda_codec_write_cache(codec, 0x01, 0,
6466 AC_VERB_SET_GPIO_DATA, 0);
6467 snd_hda_codec_write_cache(codec, 0x0f, 0,
6468 AC_VERB_SET_PIN_WIDGET_CONTROL,
6473 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6476 if ((res >> 26) == ALC880_HP_EVENT)
6477 alc260_replacer_672v_automute(codec);
6480 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6481 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6482 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6483 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6484 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6485 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6486 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6487 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6488 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6489 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6490 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6494 /* Test configuration for debugging, modelled after the ALC880 test
6497 #ifdef CONFIG_SND_DEBUG
6498 static hda_nid_t alc260_test_dac_nids[1] = {
6501 static hda_nid_t alc260_test_adc_nids[2] = {
6504 /* For testing the ALC260, each input MUX needs its own definition since
6505 * the signal assignments are different. This assumes that the first ADC
6508 static struct hda_input_mux alc260_test_capture_sources[2] = {
6512 { "MIC1 pin", 0x0 },
6513 { "MIC2 pin", 0x1 },
6514 { "LINE1 pin", 0x2 },
6515 { "LINE2 pin", 0x3 },
6517 { "LINE-OUT pin", 0x5 },
6518 { "HP-OUT pin", 0x6 },
6524 { "MIC1 pin", 0x0 },
6525 { "MIC2 pin", 0x1 },
6526 { "LINE1 pin", 0x2 },
6527 { "LINE2 pin", 0x3 },
6530 { "LINE-OUT pin", 0x6 },
6531 { "HP-OUT pin", 0x7 },
6535 static struct snd_kcontrol_new alc260_test_mixer[] = {
6536 /* Output driver widgets */
6537 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6538 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6539 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6540 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6541 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6542 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6544 /* Modes for retasking pin widgets
6545 * Note: the ALC260 doesn't seem to act on requests to enable mic
6546 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6547 * mention this restriction. At this stage it's not clear whether
6548 * this behaviour is intentional or is a hardware bug in chip
6549 * revisions available at least up until early 2006. Therefore for
6550 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6551 * choices, but if it turns out that the lack of mic bias for these
6552 * NIDs is intentional we could change their modes from
6553 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6555 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6556 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6557 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6558 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6559 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6560 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6562 /* Loopback mixer controls */
6563 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6564 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6565 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6566 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6567 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6568 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6569 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6570 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6571 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6572 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6573 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6574 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6575 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6576 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6578 /* Controls for GPIO pins, assuming they are configured as outputs */
6579 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6580 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6581 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6582 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6584 /* Switches to allow the digital IO pins to be enabled. The datasheet
6585 * is ambigious as to which NID is which; testing on laptops which
6586 * make this output available should provide clarification.
6588 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6589 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6591 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6592 * this output to turn on an external amplifier.
6594 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6595 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6599 static struct hda_verb alc260_test_init_verbs[] = {
6600 /* Enable all GPIOs as outputs with an initial value of 0 */
6601 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6602 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6603 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6605 /* Enable retasking pins as output, initially without power amp */
6606 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6607 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6608 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6609 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6610 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6611 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6613 /* Disable digital (SPDIF) pins initially, but users can enable
6614 * them via a mixer switch. In the case of SPDIF-out, this initverb
6615 * payload also sets the generation to 0, output to be in "consumer"
6616 * PCM format, copyright asserted, no pre-emphasis and no validity
6619 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6620 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6622 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6623 * OUT1 sum bus when acting as an output.
6625 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6626 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6627 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6628 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6630 /* Start with output sum widgets muted and their output gains at min */
6631 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6632 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6633 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6634 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6635 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6636 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6637 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6638 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6639 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6641 /* Unmute retasking pin widget output buffers since the default
6642 * state appears to be output. As the pin mode is changed by the
6643 * user the pin mode control will take care of enabling the pin's
6644 * input/output buffers as needed.
6646 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6648 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6649 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6650 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6651 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6652 /* Also unmute the mono-out pin widget */
6653 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6655 /* Mute capture amp left and right */
6656 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6657 /* Set ADC connection select to match default mixer setting (mic1
6660 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6662 /* Do the same for the second ADC: mute capture input amp and
6663 * set ADC connection to mic1 pin
6665 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6666 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6668 /* Mute all inputs to mixer widget (even unconnected ones) */
6669 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6670 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6671 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6673 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6674 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6675 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6676 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6682 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6683 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6685 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6686 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6689 * for BIOS auto-configuration
6692 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6693 const char *pfx, int *vol_bits)
6696 unsigned long vol_val, sw_val;
6699 if (nid >= 0x0f && nid < 0x11) {
6700 nid_vol = nid - 0x7;
6701 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6702 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6703 } else if (nid == 0x11) {
6704 nid_vol = nid - 0x7;
6705 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6706 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6707 } else if (nid >= 0x12 && nid <= 0x15) {
6709 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6710 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6714 if (!(*vol_bits & (1 << nid_vol))) {
6715 /* first control for the volume widget */
6716 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6719 *vol_bits |= (1 << nid_vol);
6721 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6727 /* add playback controls from the parsed DAC table */
6728 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6729 const struct auto_pin_cfg *cfg)
6735 spec->multiout.num_dacs = 1;
6736 spec->multiout.dac_nids = spec->private_dac_nids;
6737 spec->multiout.dac_nids[0] = 0x02;
6739 nid = cfg->line_out_pins[0];
6742 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6744 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6748 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6753 nid = cfg->speaker_pins[0];
6755 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6760 nid = cfg->hp_pins[0];
6762 err = alc260_add_playback_controls(spec, nid, "Headphone",
6770 /* create playback/capture controls for input pins */
6771 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6772 const struct auto_pin_cfg *cfg)
6774 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6777 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6778 hda_nid_t nid, int pin_type,
6781 alc_set_pin_output(codec, nid, pin_type);
6782 /* need the manual connection? */
6784 int idx = nid - 0x12;
6785 snd_hda_codec_write(codec, idx + 0x0b, 0,
6786 AC_VERB_SET_CONNECT_SEL, sel_idx);
6790 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6792 struct alc_spec *spec = codec->spec;
6795 nid = spec->autocfg.line_out_pins[0];
6797 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6798 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6801 nid = spec->autocfg.speaker_pins[0];
6803 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6805 nid = spec->autocfg.hp_pins[0];
6807 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6810 #define ALC260_PIN_CD_NID 0x16
6811 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6813 struct alc_spec *spec = codec->spec;
6814 struct auto_pin_cfg *cfg = &spec->autocfg;
6817 for (i = 0; i < cfg->num_inputs; i++) {
6818 hda_nid_t nid = cfg->inputs[i].pin;
6820 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
6821 if (nid != ALC260_PIN_CD_NID &&
6822 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6823 snd_hda_codec_write(codec, nid, 0,
6824 AC_VERB_SET_AMP_GAIN_MUTE,
6830 #define alc260_auto_init_input_src alc880_auto_init_input_src
6833 * generic initialization of ADC, input mixers and output mixers
6835 static struct hda_verb alc260_volume_init_verbs[] = {
6837 * Unmute ADC0-1 and set the default input to mic-in
6839 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6840 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6841 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6842 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6844 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6846 * Note: PASD motherboards uses the Line In 2 as the input for
6847 * front panel mic (mic 2)
6849 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6850 /* mute analog inputs */
6851 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6854 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6855 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6858 * Set up output mixers (0x08 - 0x0a)
6860 /* set vol=0 to output mixers */
6861 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6862 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6863 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6864 /* set up input amps for analog loopback */
6865 /* Amp Indices: DAC = 0, mixer = 1 */
6866 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6867 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6868 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6869 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6870 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6871 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6876 static int alc260_parse_auto_config(struct hda_codec *codec)
6878 struct alc_spec *spec = codec->spec;
6880 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6882 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6886 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6889 if (!spec->kctls.list)
6890 return 0; /* can't find valid BIOS pin config */
6891 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6895 spec->multiout.max_channels = 2;
6897 if (spec->autocfg.dig_outs)
6898 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6899 if (spec->kctls.list)
6900 add_mixer(spec, spec->kctls.list);
6902 add_verb(spec, alc260_volume_init_verbs);
6904 spec->num_mux_defs = 1;
6905 spec->input_mux = &spec->private_imux[0];
6907 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6912 /* additional initialization for auto-configuration model */
6913 static void alc260_auto_init(struct hda_codec *codec)
6915 struct alc_spec *spec = codec->spec;
6916 alc260_auto_init_multi_out(codec);
6917 alc260_auto_init_analog_input(codec);
6918 alc260_auto_init_input_src(codec);
6919 alc_auto_init_digital(codec);
6920 if (spec->unsol_event)
6921 alc_inithook(codec);
6924 #ifdef CONFIG_SND_HDA_POWER_SAVE
6925 static struct hda_amp_list alc260_loopbacks[] = {
6926 { 0x07, HDA_INPUT, 0 },
6927 { 0x07, HDA_INPUT, 1 },
6928 { 0x07, HDA_INPUT, 2 },
6929 { 0x07, HDA_INPUT, 3 },
6930 { 0x07, HDA_INPUT, 4 },
6942 static const struct alc_fixup alc260_fixups[] = {
6943 [PINFIX_HP_DC5750] = {
6944 .pins = (const struct alc_pincfg[]) {
6945 { 0x11, 0x90130110 }, /* speaker */
6951 static struct snd_pci_quirk alc260_fixup_tbl[] = {
6952 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
6957 * ALC260 configurations
6959 static const char *alc260_models[ALC260_MODEL_LAST] = {
6960 [ALC260_BASIC] = "basic",
6962 [ALC260_HP_3013] = "hp-3013",
6963 [ALC260_HP_DC7600] = "hp-dc7600",
6964 [ALC260_FUJITSU_S702X] = "fujitsu",
6965 [ALC260_ACER] = "acer",
6966 [ALC260_WILL] = "will",
6967 [ALC260_REPLACER_672V] = "replacer",
6968 [ALC260_FAVORIT100] = "favorit100",
6969 #ifdef CONFIG_SND_DEBUG
6970 [ALC260_TEST] = "test",
6972 [ALC260_AUTO] = "auto",
6975 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6976 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6977 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6978 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6979 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6980 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6981 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6982 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6983 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6984 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6985 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6986 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6987 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6988 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6989 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6990 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6991 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6992 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6993 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6994 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6995 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6999 static struct alc_config_preset alc260_presets[] = {
7001 .mixers = { alc260_base_output_mixer,
7002 alc260_input_mixer },
7003 .init_verbs = { alc260_init_verbs },
7004 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7005 .dac_nids = alc260_dac_nids,
7006 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7007 .adc_nids = alc260_dual_adc_nids,
7008 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7009 .channel_mode = alc260_modes,
7010 .input_mux = &alc260_capture_source,
7013 .mixers = { alc260_hp_output_mixer,
7014 alc260_input_mixer },
7015 .init_verbs = { alc260_init_verbs,
7016 alc260_hp_unsol_verbs },
7017 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7018 .dac_nids = alc260_dac_nids,
7019 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7020 .adc_nids = alc260_adc_nids_alt,
7021 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7022 .channel_mode = alc260_modes,
7023 .input_mux = &alc260_capture_source,
7024 .unsol_event = alc260_hp_unsol_event,
7025 .init_hook = alc260_hp_automute,
7027 [ALC260_HP_DC7600] = {
7028 .mixers = { alc260_hp_dc7600_mixer,
7029 alc260_input_mixer },
7030 .init_verbs = { alc260_init_verbs,
7031 alc260_hp_dc7600_verbs },
7032 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7033 .dac_nids = alc260_dac_nids,
7034 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7035 .adc_nids = alc260_adc_nids_alt,
7036 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7037 .channel_mode = alc260_modes,
7038 .input_mux = &alc260_capture_source,
7039 .unsol_event = alc260_hp_3012_unsol_event,
7040 .init_hook = alc260_hp_3012_automute,
7042 [ALC260_HP_3013] = {
7043 .mixers = { alc260_hp_3013_mixer,
7044 alc260_input_mixer },
7045 .init_verbs = { alc260_hp_3013_init_verbs,
7046 alc260_hp_3013_unsol_verbs },
7047 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7048 .dac_nids = alc260_dac_nids,
7049 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7050 .adc_nids = alc260_adc_nids_alt,
7051 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7052 .channel_mode = alc260_modes,
7053 .input_mux = &alc260_capture_source,
7054 .unsol_event = alc260_hp_3013_unsol_event,
7055 .init_hook = alc260_hp_3013_automute,
7057 [ALC260_FUJITSU_S702X] = {
7058 .mixers = { alc260_fujitsu_mixer },
7059 .init_verbs = { alc260_fujitsu_init_verbs },
7060 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7061 .dac_nids = alc260_dac_nids,
7062 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7063 .adc_nids = alc260_dual_adc_nids,
7064 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7065 .channel_mode = alc260_modes,
7066 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7067 .input_mux = alc260_fujitsu_capture_sources,
7070 .mixers = { alc260_acer_mixer },
7071 .init_verbs = { alc260_acer_init_verbs },
7072 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7073 .dac_nids = alc260_dac_nids,
7074 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7075 .adc_nids = alc260_dual_adc_nids,
7076 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7077 .channel_mode = alc260_modes,
7078 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7079 .input_mux = alc260_acer_capture_sources,
7081 [ALC260_FAVORIT100] = {
7082 .mixers = { alc260_favorit100_mixer },
7083 .init_verbs = { alc260_favorit100_init_verbs },
7084 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7085 .dac_nids = alc260_dac_nids,
7086 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7087 .adc_nids = alc260_dual_adc_nids,
7088 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7089 .channel_mode = alc260_modes,
7090 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7091 .input_mux = alc260_favorit100_capture_sources,
7094 .mixers = { alc260_will_mixer },
7095 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7096 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7097 .dac_nids = alc260_dac_nids,
7098 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7099 .adc_nids = alc260_adc_nids,
7100 .dig_out_nid = ALC260_DIGOUT_NID,
7101 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7102 .channel_mode = alc260_modes,
7103 .input_mux = &alc260_capture_source,
7105 [ALC260_REPLACER_672V] = {
7106 .mixers = { alc260_replacer_672v_mixer },
7107 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7108 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7109 .dac_nids = alc260_dac_nids,
7110 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7111 .adc_nids = alc260_adc_nids,
7112 .dig_out_nid = ALC260_DIGOUT_NID,
7113 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7114 .channel_mode = alc260_modes,
7115 .input_mux = &alc260_capture_source,
7116 .unsol_event = alc260_replacer_672v_unsol_event,
7117 .init_hook = alc260_replacer_672v_automute,
7119 #ifdef CONFIG_SND_DEBUG
7121 .mixers = { alc260_test_mixer },
7122 .init_verbs = { alc260_test_init_verbs },
7123 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7124 .dac_nids = alc260_test_dac_nids,
7125 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7126 .adc_nids = alc260_test_adc_nids,
7127 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7128 .channel_mode = alc260_modes,
7129 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7130 .input_mux = alc260_test_capture_sources,
7135 static int patch_alc260(struct hda_codec *codec)
7137 struct alc_spec *spec;
7138 int err, board_config;
7140 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7146 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7149 if (board_config < 0) {
7150 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7152 board_config = ALC260_AUTO;
7155 if (board_config == ALC260_AUTO)
7156 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1);
7158 if (board_config == ALC260_AUTO) {
7159 /* automatic parse from the BIOS config */
7160 err = alc260_parse_auto_config(codec);
7166 "hda_codec: Cannot set up configuration "
7167 "from BIOS. Using base mode...\n");
7168 board_config = ALC260_BASIC;
7172 err = snd_hda_attach_beep_device(codec, 0x1);
7178 if (board_config != ALC260_AUTO)
7179 setup_preset(codec, &alc260_presets[board_config]);
7181 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7182 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7183 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7185 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7186 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7188 if (!spec->adc_nids && spec->input_mux) {
7189 /* check whether NID 0x04 is valid */
7190 unsigned int wcap = get_wcaps(codec, 0x04);
7191 wcap = get_wcaps_type(wcap);
7193 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7194 spec->adc_nids = alc260_adc_nids_alt;
7195 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7197 spec->adc_nids = alc260_adc_nids;
7198 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7201 set_capture_mixer(codec);
7202 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7204 if (board_config == ALC260_AUTO)
7205 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7207 spec->vmaster_nid = 0x08;
7209 codec->patch_ops = alc_patch_ops;
7210 if (board_config == ALC260_AUTO)
7211 spec->init_hook = alc260_auto_init;
7212 #ifdef CONFIG_SND_HDA_POWER_SAVE
7213 if (!spec->loopback.amplist)
7214 spec->loopback.amplist = alc260_loopbacks;
7222 * ALC882/883/885/888/889 support
7224 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7225 * configuration. Each pin widget can choose any input DACs and a mixer.
7226 * Each ADC is connected from a mixer of all inputs. This makes possible
7227 * 6-channel independent captures.
7229 * In addition, an independent DAC for the multi-playback (not used in this
7232 #define ALC882_DIGOUT_NID 0x06
7233 #define ALC882_DIGIN_NID 0x0a
7234 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7235 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7236 #define ALC1200_DIGOUT_NID 0x10
7239 static struct hda_channel_mode alc882_ch_modes[1] = {
7244 static hda_nid_t alc882_dac_nids[4] = {
7245 /* front, rear, clfe, rear_surr */
7246 0x02, 0x03, 0x04, 0x05
7248 #define alc883_dac_nids alc882_dac_nids
7251 #define alc882_adc_nids alc880_adc_nids
7252 #define alc882_adc_nids_alt alc880_adc_nids_alt
7253 #define alc883_adc_nids alc882_adc_nids_alt
7254 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7255 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7256 #define alc889_adc_nids alc880_adc_nids
7258 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7259 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7260 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7261 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7262 #define alc889_capsrc_nids alc882_capsrc_nids
7265 /* FIXME: should be a matrix-type input source selection */
7267 static struct hda_input_mux alc882_capture_source = {
7271 { "Front Mic", 0x1 },
7277 #define alc883_capture_source alc882_capture_source
7279 static struct hda_input_mux alc889_capture_source = {
7282 { "Front Mic", 0x0 },
7288 static struct hda_input_mux mb5_capture_source = {
7297 static struct hda_input_mux macmini3_capture_source = {
7305 static struct hda_input_mux alc883_3stack_6ch_intel = {
7309 { "Front Mic", 0x0 },
7315 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7323 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7333 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7341 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7345 { "Front Mic", 0x1 },
7350 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7358 static struct hda_input_mux alc889A_mb31_capture_source = {
7362 /* Front Mic (0x01) unused */
7364 /* Line 2 (0x03) unused */
7365 /* CD (0x04) unused? */
7369 static struct hda_input_mux alc889A_imac91_capture_source = {
7373 { "Line", 0x2 }, /* Not sure! */
7380 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7387 static struct hda_verb alc882_3ST_ch2_init[] = {
7388 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7389 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7390 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7391 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7398 static struct hda_verb alc882_3ST_ch4_init[] = {
7399 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7400 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7401 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7402 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7403 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7410 static struct hda_verb alc882_3ST_ch6_init[] = {
7411 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7412 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7413 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7414 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7415 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7416 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7420 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7421 { 2, alc882_3ST_ch2_init },
7422 { 4, alc882_3ST_ch4_init },
7423 { 6, alc882_3ST_ch6_init },
7426 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7431 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7432 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7433 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7434 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7435 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7436 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7443 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7444 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7445 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7446 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7447 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7448 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7449 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7456 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7457 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7458 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7459 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7460 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7461 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7462 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7463 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7467 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7468 { 2, alc883_3ST_ch2_clevo_init },
7469 { 4, alc883_3ST_ch4_clevo_init },
7470 { 6, alc883_3ST_ch6_clevo_init },
7477 static struct hda_verb alc882_sixstack_ch6_init[] = {
7478 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7479 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7480 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7481 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7488 static struct hda_verb alc882_sixstack_ch8_init[] = {
7489 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7490 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7491 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7492 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7496 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7497 { 6, alc882_sixstack_ch6_init },
7498 { 8, alc882_sixstack_ch8_init },
7502 /* Macbook Air 2,1 */
7504 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7509 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7515 static struct hda_verb alc885_mbp_ch2_init[] = {
7516 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7517 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7518 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7525 static struct hda_verb alc885_mbp_ch4_init[] = {
7526 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7527 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7528 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7529 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7530 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7534 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7535 { 2, alc885_mbp_ch2_init },
7536 { 4, alc885_mbp_ch4_init },
7541 * Speakers/Woofer/HP = Front
7544 static struct hda_verb alc885_mb5_ch2_init[] = {
7545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7546 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7552 * Speakers/HP = Front
7556 static struct hda_verb alc885_mb5_ch6_init[] = {
7557 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7559 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7563 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7564 { 2, alc885_mb5_ch2_init },
7565 { 6, alc885_mb5_ch6_init },
7568 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7573 static struct hda_verb alc883_4ST_ch2_init[] = {
7574 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7575 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7576 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7577 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7578 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7579 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7586 static struct hda_verb alc883_4ST_ch4_init[] = {
7587 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7588 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7589 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7590 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7591 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7592 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7593 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7600 static struct hda_verb alc883_4ST_ch6_init[] = {
7601 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7602 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7603 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7604 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7605 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7606 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7607 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7608 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7615 static struct hda_verb alc883_4ST_ch8_init[] = {
7616 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7617 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7618 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7619 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7620 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7621 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7622 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7623 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7624 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7628 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7629 { 2, alc883_4ST_ch2_init },
7630 { 4, alc883_4ST_ch4_init },
7631 { 6, alc883_4ST_ch6_init },
7632 { 8, alc883_4ST_ch8_init },
7639 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7640 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7641 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7642 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7643 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7650 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7651 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7652 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7653 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7654 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7655 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7662 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7663 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7664 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7665 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7666 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7667 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7668 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7672 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7673 { 2, alc883_3ST_ch2_intel_init },
7674 { 4, alc883_3ST_ch4_intel_init },
7675 { 6, alc883_3ST_ch6_intel_init },
7681 static struct hda_verb alc889_ch2_intel_init[] = {
7682 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7683 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7684 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7685 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7686 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7687 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7694 static struct hda_verb alc889_ch6_intel_init[] = {
7695 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7696 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7697 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7698 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7699 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7700 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7707 static struct hda_verb alc889_ch8_intel_init[] = {
7708 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7709 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7710 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7711 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7712 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7713 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7714 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7718 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7719 { 2, alc889_ch2_intel_init },
7720 { 6, alc889_ch6_intel_init },
7721 { 8, alc889_ch8_intel_init },
7727 static struct hda_verb alc883_sixstack_ch6_init[] = {
7728 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7729 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7730 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7731 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7738 static struct hda_verb alc883_sixstack_ch8_init[] = {
7739 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7740 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7741 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7742 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7746 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7747 { 6, alc883_sixstack_ch6_init },
7748 { 8, alc883_sixstack_ch8_init },
7752 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7753 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7755 static struct snd_kcontrol_new alc882_base_mixer[] = {
7756 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7757 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7758 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7759 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7760 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7761 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7762 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7763 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7764 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7765 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7766 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7767 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7768 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7769 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7770 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7772 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7773 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7774 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7775 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7776 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7780 /* Macbook Air 2,1 same control for HP and internal Speaker */
7782 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7783 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7784 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7789 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7790 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7791 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7792 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7793 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7794 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7795 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7796 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7798 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7799 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7800 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7804 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7805 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7806 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7807 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7808 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7809 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7810 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7811 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7812 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7813 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7814 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7815 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7816 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7817 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7818 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7822 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7823 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7824 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7825 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7826 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7827 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7828 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7829 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7830 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7831 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7832 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7833 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7837 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7838 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7839 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7844 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7845 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7846 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7847 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7848 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7849 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7850 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7851 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7852 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7853 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7857 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7858 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7859 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7860 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7861 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7862 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7863 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7864 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7865 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7866 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7867 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7868 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7869 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7870 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7874 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7875 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7877 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7878 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7879 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7880 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7881 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7882 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7883 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7884 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7885 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7886 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7887 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7888 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7889 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7890 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7894 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7895 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7896 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7897 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7898 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7899 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7900 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7901 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7903 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7904 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7908 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7910 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7911 .name = "Channel Mode",
7912 .info = alc_ch_mode_info,
7913 .get = alc_ch_mode_get,
7914 .put = alc_ch_mode_put,
7919 static struct hda_verb alc882_base_init_verbs[] = {
7920 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7921 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7922 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7924 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7925 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7927 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7928 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7930 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7931 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7933 /* Front Pin: output 0 (0x0c) */
7934 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7935 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7936 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7937 /* Rear Pin: output 1 (0x0d) */
7938 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7939 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7940 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7941 /* CLFE Pin: output 2 (0x0e) */
7942 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7943 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7944 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7945 /* Side Pin: output 3 (0x0f) */
7946 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7947 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7948 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7949 /* Mic (rear) pin: input vref at 80% */
7950 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7951 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7952 /* Front Mic pin: input vref at 80% */
7953 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7954 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7955 /* Line In pin: input */
7956 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7957 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7958 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7959 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7960 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7961 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7962 /* CD pin widget for input */
7963 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7965 /* FIXME: use matrix-type input source selection */
7966 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7968 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7970 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7971 /* ADC2: mute amp left and right */
7972 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7973 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7974 /* ADC3: mute amp left and right */
7975 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7976 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7981 static struct hda_verb alc882_adc1_init_verbs[] = {
7982 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7983 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7984 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7985 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7986 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7987 /* ADC1: mute amp left and right */
7988 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7989 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7993 static struct hda_verb alc882_eapd_verbs[] = {
7994 /* change to EAPD mode */
7995 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7996 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8000 static struct hda_verb alc889_eapd_verbs[] = {
8001 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8002 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8006 static struct hda_verb alc_hp15_unsol_verbs[] = {
8007 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8008 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8012 static struct hda_verb alc885_init_verbs[] = {
8013 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8014 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8015 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8017 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8018 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8020 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8021 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8023 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8024 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8026 /* Front HP Pin: output 0 (0x0c) */
8027 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8028 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8029 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8030 /* Front Pin: output 0 (0x0c) */
8031 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8032 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8033 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8034 /* Rear Pin: output 1 (0x0d) */
8035 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8036 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8037 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8038 /* CLFE Pin: output 2 (0x0e) */
8039 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8040 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8041 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8042 /* Side Pin: output 3 (0x0f) */
8043 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8044 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8045 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8046 /* Mic (rear) pin: input vref at 80% */
8047 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8048 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8049 /* Front Mic pin: input vref at 80% */
8050 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8051 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8052 /* Line In pin: input */
8053 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8054 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8056 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8058 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8060 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8063 /* ADC2: mute amp left and right */
8064 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8065 /* ADC3: mute amp left and right */
8066 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8071 static struct hda_verb alc885_init_input_verbs[] = {
8072 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8073 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8074 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8079 /* Unmute Selector 24h and set the default input to front mic */
8080 static struct hda_verb alc889_init_input_verbs[] = {
8081 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8087 #define alc883_init_verbs alc882_base_init_verbs
8090 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8091 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8092 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8093 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8094 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8095 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8096 /* FIXME: this looks suspicious...
8097 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8098 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8103 static struct hda_verb alc882_macpro_init_verbs[] = {
8104 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8105 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8106 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8107 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8108 /* Front Pin: output 0 (0x0c) */
8109 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8110 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8111 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8112 /* Front Mic pin: input vref at 80% */
8113 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8114 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8115 /* Speaker: output */
8116 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8117 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8118 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8119 /* Headphone output (output 0 - 0x0c) */
8120 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8121 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8122 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8124 /* FIXME: use matrix-type input source selection */
8125 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8126 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8127 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8128 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8129 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8130 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8132 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8133 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8134 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8135 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8137 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8138 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8139 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8140 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8141 /* ADC1: mute amp left and right */
8142 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8143 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8144 /* ADC2: mute amp left and right */
8145 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8146 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8147 /* ADC3: mute amp left and right */
8148 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8149 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8155 static struct hda_verb alc885_mb5_init_verbs[] = {
8157 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8158 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8159 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8160 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8165 /* Surround mixer */
8166 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8167 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8168 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8170 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8172 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8174 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8175 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8176 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8177 /* Front Pin (0x0c) */
8178 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8179 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8180 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8181 /* LFE Pin (0x0e) */
8182 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8183 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8184 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8186 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8187 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8188 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8189 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8190 /* Front Mic pin: input vref at 80% */
8191 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8192 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8194 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8195 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8204 static struct hda_verb alc885_macmini3_init_verbs[] = {
8206 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8207 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8208 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8209 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8211 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8212 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8213 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8214 /* Surround mixer */
8215 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8216 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8217 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8219 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8220 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8221 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8223 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8224 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8225 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8226 /* Front Pin (0x0c) */
8227 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8228 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8229 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8230 /* LFE Pin (0x0e) */
8231 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8232 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8233 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8236 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8237 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8238 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8240 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8241 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8243 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8244 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8245 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8246 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8251 static struct hda_verb alc885_mba21_init_verbs[] = {
8252 /*Internal and HP Speaker Mixer*/
8253 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8256 /*Internal Speaker Pin (0x0c)*/
8257 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8258 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8259 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8260 /* HP Pin: output 0 (0x0e) */
8261 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8262 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8263 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8264 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8265 /* Line in (is hp when jack connected)*/
8266 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8267 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8273 /* Macbook Pro rev3 */
8274 static struct hda_verb alc885_mbp3_init_verbs[] = {
8275 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8276 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8277 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8278 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8280 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8281 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8282 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8284 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8285 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8286 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8287 /* Front Pin: output 0 (0x0c) */
8288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8289 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8290 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8291 /* HP Pin: output 0 (0x0e) */
8292 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8293 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8294 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8295 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8296 /* Mic (rear) pin: input vref at 80% */
8297 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8298 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8299 /* Front Mic pin: input vref at 80% */
8300 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8301 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8302 /* Line In pin: use output 1 when in LineOut mode */
8303 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8304 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8305 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8307 /* FIXME: use matrix-type input source selection */
8308 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8309 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8310 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8311 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8312 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8315 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8320 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8324 /* ADC1: mute amp left and right */
8325 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8326 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8327 /* ADC2: mute amp left and right */
8328 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8329 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8330 /* ADC3: mute amp left and right */
8331 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8332 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8338 static struct hda_verb alc885_imac91_init_verbs[] = {
8339 /* Internal Speaker Pin (0x0c) */
8340 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8341 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8342 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8343 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8344 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8345 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8347 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8348 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8349 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8350 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8352 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8353 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8354 /* Front Mic pin: input vref at 80% */
8355 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8356 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8358 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8359 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8360 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8361 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8363 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8364 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8365 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8370 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8371 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8372 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8373 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8374 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8375 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8376 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8377 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8378 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8379 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8380 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8381 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8382 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8383 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8384 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8385 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8386 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8387 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8388 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8392 /* iMac 24 mixer. */
8393 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8394 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8395 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8399 /* iMac 24 init verbs. */
8400 static struct hda_verb alc885_imac24_init_verbs[] = {
8401 /* Internal speakers: output 0 (0x0c) */
8402 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8403 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8404 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8405 /* Internal speakers: output 0 (0x0c) */
8406 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8407 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8408 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8409 /* Headphone: output 0 (0x0c) */
8410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8411 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8412 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8413 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8414 /* Front Mic: input vref at 80% */
8415 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8416 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8420 /* Toggle speaker-output according to the hp-jack state */
8421 static void alc885_imac24_setup(struct hda_codec *codec)
8423 struct alc_spec *spec = codec->spec;
8425 spec->autocfg.hp_pins[0] = 0x14;
8426 spec->autocfg.speaker_pins[0] = 0x18;
8427 spec->autocfg.speaker_pins[1] = 0x1a;
8430 #define alc885_mb5_setup alc885_imac24_setup
8431 #define alc885_macmini3_setup alc885_imac24_setup
8433 /* Macbook Air 2,1 */
8434 static void alc885_mba21_setup(struct hda_codec *codec)
8436 struct alc_spec *spec = codec->spec;
8438 spec->autocfg.hp_pins[0] = 0x14;
8439 spec->autocfg.speaker_pins[0] = 0x18;
8444 static void alc885_mbp3_setup(struct hda_codec *codec)
8446 struct alc_spec *spec = codec->spec;
8448 spec->autocfg.hp_pins[0] = 0x15;
8449 spec->autocfg.speaker_pins[0] = 0x14;
8452 static void alc885_imac91_setup(struct hda_codec *codec)
8454 struct alc_spec *spec = codec->spec;
8456 spec->autocfg.hp_pins[0] = 0x14;
8457 spec->autocfg.speaker_pins[0] = 0x18;
8458 spec->autocfg.speaker_pins[1] = 0x1a;
8461 static struct hda_verb alc882_targa_verbs[] = {
8462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8466 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8468 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8469 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8470 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8472 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8476 /* toggle speaker-output according to the hp-jack state */
8477 static void alc882_targa_automute(struct hda_codec *codec)
8479 struct alc_spec *spec = codec->spec;
8480 alc_automute_amp(codec);
8481 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8482 spec->jack_present ? 1 : 3);
8485 static void alc882_targa_setup(struct hda_codec *codec)
8487 struct alc_spec *spec = codec->spec;
8489 spec->autocfg.hp_pins[0] = 0x14;
8490 spec->autocfg.speaker_pins[0] = 0x1b;
8493 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8495 if ((res >> 26) == ALC880_HP_EVENT)
8496 alc882_targa_automute(codec);
8499 static struct hda_verb alc882_asus_a7j_verbs[] = {
8500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8505 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8507 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8508 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8509 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8511 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8512 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8513 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8517 static struct hda_verb alc882_asus_a7m_verbs[] = {
8518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8521 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8522 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8523 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8525 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8526 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8527 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8529 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8530 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8531 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8535 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8537 unsigned int gpiostate, gpiomask, gpiodir;
8539 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8540 AC_VERB_GET_GPIO_DATA, 0);
8543 gpiostate |= (1 << pin);
8545 gpiostate &= ~(1 << pin);
8547 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8548 AC_VERB_GET_GPIO_MASK, 0);
8549 gpiomask |= (1 << pin);
8551 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8552 AC_VERB_GET_GPIO_DIRECTION, 0);
8553 gpiodir |= (1 << pin);
8556 snd_hda_codec_write(codec, codec->afg, 0,
8557 AC_VERB_SET_GPIO_MASK, gpiomask);
8558 snd_hda_codec_write(codec, codec->afg, 0,
8559 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8563 snd_hda_codec_write(codec, codec->afg, 0,
8564 AC_VERB_SET_GPIO_DATA, gpiostate);
8567 /* set up GPIO at initialization */
8568 static void alc885_macpro_init_hook(struct hda_codec *codec)
8570 alc882_gpio_mute(codec, 0, 0);
8571 alc882_gpio_mute(codec, 1, 0);
8574 /* set up GPIO and update auto-muting at initialization */
8575 static void alc885_imac24_init_hook(struct hda_codec *codec)
8577 alc885_macpro_init_hook(codec);
8578 alc_automute_amp(codec);
8582 * generic initialization of ADC, input mixers and output mixers
8584 static struct hda_verb alc883_auto_init_verbs[] = {
8586 * Unmute ADC0-2 and set the default input to mic-in
8588 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8589 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8590 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8591 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8594 * Set up output mixers (0x0c - 0x0f)
8596 /* set vol=0 to output mixers */
8597 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8598 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8599 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8600 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8601 /* set up input amps for analog loopback */
8602 /* Amp Indices: DAC = 0, mixer = 1 */
8603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8605 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8606 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8607 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8608 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8609 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8610 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8611 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8612 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8614 /* FIXME: use matrix-type input source selection */
8615 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8623 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8624 static struct hda_verb alc889A_mb31_ch2_init[] = {
8625 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8626 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8627 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8628 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8632 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8633 static struct hda_verb alc889A_mb31_ch4_init[] = {
8634 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8635 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8636 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8637 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8641 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8642 static struct hda_verb alc889A_mb31_ch5_init[] = {
8643 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8644 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8645 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8646 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8650 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8651 static struct hda_verb alc889A_mb31_ch6_init[] = {
8652 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8653 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8654 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8655 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8659 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8660 { 2, alc889A_mb31_ch2_init },
8661 { 4, alc889A_mb31_ch4_init },
8662 { 5, alc889A_mb31_ch5_init },
8663 { 6, alc889A_mb31_ch6_init },
8666 static struct hda_verb alc883_medion_eapd_verbs[] = {
8667 /* eanable EAPD on medion laptop */
8668 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8669 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8673 #define alc883_base_mixer alc882_base_mixer
8675 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8676 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8677 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8678 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8679 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8680 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8681 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8682 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8683 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8684 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8685 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8686 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8687 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8688 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8692 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8693 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8694 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8695 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8696 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8697 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8698 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8699 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8700 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8701 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8702 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8706 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8707 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8708 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8709 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8710 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8711 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8712 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8713 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8714 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8715 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8716 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8720 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8721 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8722 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8723 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8724 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8725 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8726 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8727 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8728 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8729 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8730 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8731 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8732 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8733 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8737 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8738 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8739 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8740 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8741 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8742 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8743 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8744 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8745 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8746 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8747 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8748 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8749 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8750 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8751 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8752 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8753 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8754 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8755 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8756 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8760 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8761 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8762 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8763 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8764 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8765 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8767 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8768 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8769 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8770 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8771 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8772 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8773 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8774 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8776 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8777 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8778 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8779 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8780 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8784 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8785 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8786 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8787 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8788 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8789 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8791 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8792 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8793 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8794 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8795 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8796 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8797 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8798 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8800 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8801 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8802 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8803 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8804 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8808 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8809 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8810 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8811 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8812 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8813 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8814 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8815 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8816 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8817 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8818 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8819 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8820 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8821 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8822 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8823 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8824 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8825 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8826 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8827 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8831 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8832 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8833 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8834 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8835 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8836 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8837 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8838 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8839 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8840 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8841 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8842 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8843 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8844 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8845 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8847 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8852 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8853 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8854 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8855 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8856 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8857 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8858 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8860 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8861 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8862 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8863 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8864 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8868 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8869 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8870 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8871 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8872 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8873 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8877 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8878 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8879 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8880 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8881 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8883 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8884 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8885 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8889 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8890 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8891 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8892 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8893 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8894 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8897 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8898 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8902 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8903 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8904 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8905 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8906 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8907 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8908 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8909 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8910 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8911 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8915 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8916 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8917 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8918 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8919 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8920 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8921 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8925 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8926 /* Unmute front mixer */
8927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8928 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8930 /* Set speaker pin to front mixer */
8931 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8933 /* Init headphone pin */
8934 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8935 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8936 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8937 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8942 /* toggle speaker-output according to the hp-jack state */
8943 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8945 struct alc_spec *spec = codec->spec;
8947 spec->autocfg.hp_pins[0] = 0x1a;
8948 spec->autocfg.speaker_pins[0] = 0x15;
8951 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8952 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8953 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8954 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8955 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8956 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8957 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8958 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8959 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8963 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8964 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8965 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8966 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8967 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8968 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8969 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8970 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8971 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8972 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8976 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8977 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8978 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8979 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8980 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8981 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8982 0x0d, 1, 0x0, HDA_OUTPUT),
8983 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8984 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8985 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8986 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8987 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8988 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8989 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8990 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8991 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8993 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8996 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8997 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9001 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9003 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9004 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9005 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9006 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9007 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9009 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9010 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9011 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9012 /* Output switches */
9013 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9014 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9015 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9017 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
9018 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
9020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9022 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9023 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9027 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9028 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9029 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9032 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9037 static struct hda_bind_ctls alc883_bind_cap_vol = {
9038 .ops = &snd_hda_bind_vol,
9040 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9041 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9046 static struct hda_bind_ctls alc883_bind_cap_switch = {
9047 .ops = &snd_hda_bind_sw,
9049 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9050 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9055 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9056 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9057 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9058 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9059 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9060 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9061 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9062 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9063 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9067 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9068 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9069 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9071 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9072 /* .name = "Capture Source", */
9073 .name = "Input Source",
9075 .info = alc_mux_enum_info,
9076 .get = alc_mux_enum_get,
9077 .put = alc_mux_enum_put,
9082 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9084 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9085 .name = "Channel Mode",
9086 .info = alc_ch_mode_info,
9087 .get = alc_ch_mode_get,
9088 .put = alc_ch_mode_put,
9093 /* toggle speaker-output according to the hp-jack state */
9094 static void alc883_mitac_setup(struct hda_codec *codec)
9096 struct alc_spec *spec = codec->spec;
9098 spec->autocfg.hp_pins[0] = 0x15;
9099 spec->autocfg.speaker_pins[0] = 0x14;
9100 spec->autocfg.speaker_pins[1] = 0x17;
9103 /* auto-toggle front mic */
9105 static void alc883_mitac_mic_automute(struct hda_codec *codec)
9107 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
9109 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
9113 static struct hda_verb alc883_mitac_verbs[] = {
9115 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9116 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9118 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9119 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9121 /* enable unsolicited event */
9122 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9123 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9128 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9130 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9131 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9133 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9135 /* enable unsolicited event */
9137 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9138 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9144 static struct hda_verb alc883_clevo_m720_verbs[] = {
9146 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9147 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9149 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9150 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9152 /* enable unsolicited event */
9153 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9154 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9159 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9161 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9162 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9164 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9165 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9167 /* enable unsolicited event */
9168 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9173 static struct hda_verb alc883_targa_verbs[] = {
9174 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9175 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9177 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9178 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9180 /* Connect Line-Out side jack (SPDIF) to Side */
9181 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9182 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9183 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9184 /* Connect Mic jack to CLFE */
9185 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9186 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9187 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9188 /* Connect Line-in jack to Surround */
9189 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9190 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9191 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9192 /* Connect HP out jack to Front */
9193 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9194 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9195 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9197 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9202 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9203 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9204 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9205 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9209 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9210 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9211 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9212 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9213 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9217 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9218 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9219 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9220 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9221 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9222 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9226 static struct hda_verb alc883_haier_w66_verbs[] = {
9227 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9230 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9232 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9233 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9234 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9235 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9239 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9240 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9241 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9242 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9243 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9244 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9245 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9246 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9247 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9251 static struct hda_verb alc888_6st_dell_verbs[] = {
9252 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9256 static struct hda_verb alc883_vaiott_verbs[] = {
9258 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9259 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9261 /* enable unsolicited event */
9262 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9267 static void alc888_3st_hp_setup(struct hda_codec *codec)
9269 struct alc_spec *spec = codec->spec;
9271 spec->autocfg.hp_pins[0] = 0x1b;
9272 spec->autocfg.speaker_pins[0] = 0x14;
9273 spec->autocfg.speaker_pins[1] = 0x16;
9274 spec->autocfg.speaker_pins[2] = 0x18;
9277 static struct hda_verb alc888_3st_hp_verbs[] = {
9278 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9279 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9280 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9281 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9288 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9289 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9290 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9291 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9292 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9299 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9300 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9301 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9302 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9303 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9304 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9311 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9312 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9313 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9314 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9315 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9316 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9317 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9321 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9322 { 2, alc888_3st_hp_2ch_init },
9323 { 4, alc888_3st_hp_4ch_init },
9324 { 6, alc888_3st_hp_6ch_init },
9327 /* toggle front-jack and RCA according to the hp-jack state */
9328 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9330 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9332 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9333 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9334 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9335 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9338 /* toggle RCA according to the front-jack state */
9339 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9341 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9343 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9344 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9347 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9350 if ((res >> 26) == ALC880_HP_EVENT)
9351 alc888_lenovo_ms7195_front_automute(codec);
9352 if ((res >> 26) == ALC880_FRONT_EVENT)
9353 alc888_lenovo_ms7195_rca_automute(codec);
9356 static struct hda_verb alc883_medion_md2_verbs[] = {
9357 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9358 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9362 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9366 /* toggle speaker-output according to the hp-jack state */
9367 static void alc883_medion_md2_setup(struct hda_codec *codec)
9369 struct alc_spec *spec = codec->spec;
9371 spec->autocfg.hp_pins[0] = 0x14;
9372 spec->autocfg.speaker_pins[0] = 0x15;
9375 /* toggle speaker-output according to the hp-jack state */
9376 #define alc883_targa_init_hook alc882_targa_init_hook
9377 #define alc883_targa_unsol_event alc882_targa_unsol_event
9379 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9381 unsigned int present;
9383 present = snd_hda_jack_detect(codec, 0x18);
9384 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9385 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9388 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9390 struct alc_spec *spec = codec->spec;
9392 spec->autocfg.hp_pins[0] = 0x15;
9393 spec->autocfg.speaker_pins[0] = 0x14;
9396 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9398 alc_automute_amp(codec);
9399 alc883_clevo_m720_mic_automute(codec);
9402 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9405 switch (res >> 26) {
9406 case ALC880_MIC_EVENT:
9407 alc883_clevo_m720_mic_automute(codec);
9410 alc_automute_amp_unsol_event(codec, res);
9415 /* toggle speaker-output according to the hp-jack state */
9416 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9418 struct alc_spec *spec = codec->spec;
9420 spec->autocfg.hp_pins[0] = 0x14;
9421 spec->autocfg.speaker_pins[0] = 0x15;
9424 static void alc883_haier_w66_setup(struct hda_codec *codec)
9426 struct alc_spec *spec = codec->spec;
9428 spec->autocfg.hp_pins[0] = 0x1b;
9429 spec->autocfg.speaker_pins[0] = 0x14;
9432 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9434 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9436 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9437 HDA_AMP_MUTE, bits);
9440 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9442 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9444 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9445 HDA_AMP_MUTE, bits);
9446 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9447 HDA_AMP_MUTE, bits);
9450 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9453 if ((res >> 26) == ALC880_HP_EVENT)
9454 alc883_lenovo_101e_all_automute(codec);
9455 if ((res >> 26) == ALC880_FRONT_EVENT)
9456 alc883_lenovo_101e_ispeaker_automute(codec);
9459 /* toggle speaker-output according to the hp-jack state */
9460 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9462 struct alc_spec *spec = codec->spec;
9464 spec->autocfg.hp_pins[0] = 0x14;
9465 spec->autocfg.speaker_pins[0] = 0x15;
9466 spec->autocfg.speaker_pins[1] = 0x16;
9469 static struct hda_verb alc883_acer_eapd_verbs[] = {
9470 /* HP Pin: output 0 (0x0c) */
9471 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9472 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9473 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9474 /* Front Pin: output 0 (0x0c) */
9475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9476 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9477 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9478 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9479 /* eanable EAPD on medion laptop */
9480 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9481 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9482 /* enable unsolicited event */
9483 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9487 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9488 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9489 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9490 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9494 static void alc888_6st_dell_setup(struct hda_codec *codec)
9496 struct alc_spec *spec = codec->spec;
9498 spec->autocfg.hp_pins[0] = 0x1b;
9499 spec->autocfg.speaker_pins[0] = 0x14;
9500 spec->autocfg.speaker_pins[1] = 0x15;
9501 spec->autocfg.speaker_pins[2] = 0x16;
9502 spec->autocfg.speaker_pins[3] = 0x17;
9505 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9507 struct alc_spec *spec = codec->spec;
9509 spec->autocfg.hp_pins[0] = 0x1b;
9510 spec->autocfg.speaker_pins[0] = 0x14;
9511 spec->autocfg.speaker_pins[1] = 0x15;
9512 spec->autocfg.speaker_pins[2] = 0x16;
9513 spec->autocfg.speaker_pins[3] = 0x17;
9514 spec->autocfg.speaker_pins[4] = 0x1a;
9517 static void alc883_vaiott_setup(struct hda_codec *codec)
9519 struct alc_spec *spec = codec->spec;
9521 spec->autocfg.hp_pins[0] = 0x15;
9522 spec->autocfg.speaker_pins[0] = 0x14;
9523 spec->autocfg.speaker_pins[1] = 0x17;
9526 static struct hda_verb alc888_asus_m90v_verbs[] = {
9527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9528 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9529 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9530 /* enable unsolicited event */
9531 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9532 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9536 static void alc883_mode2_setup(struct hda_codec *codec)
9538 struct alc_spec *spec = codec->spec;
9540 spec->autocfg.hp_pins[0] = 0x1b;
9541 spec->autocfg.speaker_pins[0] = 0x14;
9542 spec->autocfg.speaker_pins[1] = 0x15;
9543 spec->autocfg.speaker_pins[2] = 0x16;
9544 spec->ext_mic.pin = 0x18;
9545 spec->int_mic.pin = 0x19;
9546 spec->ext_mic.mux_idx = 0;
9547 spec->int_mic.mux_idx = 1;
9551 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9552 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9553 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9555 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9556 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9557 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9558 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9559 /* enable unsolicited event */
9560 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9564 static void alc883_eee1601_inithook(struct hda_codec *codec)
9566 struct alc_spec *spec = codec->spec;
9568 spec->autocfg.hp_pins[0] = 0x14;
9569 spec->autocfg.speaker_pins[0] = 0x1b;
9570 alc_automute_pin(codec);
9573 static struct hda_verb alc889A_mb31_verbs[] = {
9574 /* Init rear pin (used as headphone output) */
9575 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9576 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9577 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9578 /* Init line pin (used as output in 4ch and 6ch mode) */
9579 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9580 /* Init line 2 pin (used as headphone out by default) */
9581 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9582 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9586 /* Mute speakers according to the headphone jack state */
9587 static void alc889A_mb31_automute(struct hda_codec *codec)
9589 unsigned int present;
9591 /* Mute only in 2ch or 4ch mode */
9592 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9594 present = snd_hda_jack_detect(codec, 0x15);
9595 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9596 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9597 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9598 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9602 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9604 if ((res >> 26) == ALC880_HP_EVENT)
9605 alc889A_mb31_automute(codec);
9609 #ifdef CONFIG_SND_HDA_POWER_SAVE
9610 #define alc882_loopbacks alc880_loopbacks
9613 /* pcm configuration: identical with ALC880 */
9614 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9615 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9616 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9617 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9619 static hda_nid_t alc883_slave_dig_outs[] = {
9620 ALC1200_DIGOUT_NID, 0,
9623 static hda_nid_t alc1200_slave_dig_outs[] = {
9624 ALC883_DIGOUT_NID, 0,
9628 * configuration and preset
9630 static const char *alc882_models[ALC882_MODEL_LAST] = {
9631 [ALC882_3ST_DIG] = "3stack-dig",
9632 [ALC882_6ST_DIG] = "6stack-dig",
9633 [ALC882_ARIMA] = "arima",
9634 [ALC882_W2JC] = "w2jc",
9635 [ALC882_TARGA] = "targa",
9636 [ALC882_ASUS_A7J] = "asus-a7j",
9637 [ALC882_ASUS_A7M] = "asus-a7m",
9638 [ALC885_MACPRO] = "macpro",
9639 [ALC885_MB5] = "mb5",
9640 [ALC885_MACMINI3] = "macmini3",
9641 [ALC885_MBA21] = "mba21",
9642 [ALC885_MBP3] = "mbp3",
9643 [ALC885_IMAC24] = "imac24",
9644 [ALC885_IMAC91] = "imac91",
9645 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9646 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9647 [ALC883_3ST_6ch] = "3stack-6ch",
9648 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9649 [ALC883_TARGA_DIG] = "targa-dig",
9650 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9651 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9652 [ALC883_ACER] = "acer",
9653 [ALC883_ACER_ASPIRE] = "acer-aspire",
9654 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9655 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9656 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9657 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9658 [ALC883_MEDION] = "medion",
9659 [ALC883_MEDION_MD2] = "medion-md2",
9660 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9661 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9662 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9663 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9664 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9665 [ALC888_LENOVO_SKY] = "lenovo-sky",
9666 [ALC883_HAIER_W66] = "haier-w66",
9667 [ALC888_3ST_HP] = "3stack-hp",
9668 [ALC888_6ST_DELL] = "6stack-dell",
9669 [ALC883_MITAC] = "mitac",
9670 [ALC883_CLEVO_M540R] = "clevo-m540r",
9671 [ALC883_CLEVO_M720] = "clevo-m720",
9672 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9673 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9674 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9675 [ALC889A_INTEL] = "intel-alc889a",
9676 [ALC889_INTEL] = "intel-x58",
9677 [ALC1200_ASUS_P5Q] = "asus-p5q",
9678 [ALC889A_MB31] = "mb31",
9679 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9680 [ALC882_AUTO] = "auto",
9683 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9684 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9686 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9687 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9688 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9689 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9690 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9691 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9692 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9693 ALC888_ACER_ASPIRE_4930G),
9694 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9695 ALC888_ACER_ASPIRE_4930G),
9696 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9697 ALC888_ACER_ASPIRE_8930G),
9698 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9699 ALC888_ACER_ASPIRE_8930G),
9700 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9701 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9702 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9703 ALC888_ACER_ASPIRE_6530G),
9704 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9705 ALC888_ACER_ASPIRE_6530G),
9706 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9707 ALC888_ACER_ASPIRE_7730G),
9708 /* default Acer -- disabled as it causes more problems.
9709 * model=auto should work fine now
9711 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9713 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9715 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9716 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9717 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9718 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9719 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9720 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9722 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9723 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9724 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9725 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9726 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9727 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9728 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9729 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9730 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9731 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9732 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9734 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9735 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9736 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9737 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9738 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9739 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9740 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9741 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9742 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9744 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9745 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9746 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9747 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9748 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9749 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9750 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9751 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9752 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9753 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9754 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9755 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9756 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9757 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9758 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9759 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9760 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9761 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9762 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9763 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9764 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9765 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9766 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9767 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9768 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9769 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9770 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9771 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9772 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9773 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9774 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9776 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9777 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9778 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9779 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9780 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9781 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9782 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9783 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9784 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9785 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9786 ALC883_FUJITSU_PI2515),
9787 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9788 ALC888_FUJITSU_XA3530),
9789 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9790 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9791 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9792 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9793 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9794 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9795 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9796 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9797 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9799 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9800 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9801 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9802 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9803 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9804 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9805 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9810 /* codec SSID table for Intel Mac */
9811 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9812 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9813 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9814 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9815 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9816 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9817 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9818 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9819 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9820 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9821 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9822 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9823 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9824 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9825 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9826 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9827 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9828 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9829 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9830 * so apparently no perfect solution yet
9832 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9833 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9834 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9838 static struct alc_config_preset alc882_presets[] = {
9839 [ALC882_3ST_DIG] = {
9840 .mixers = { alc882_base_mixer },
9841 .init_verbs = { alc882_base_init_verbs,
9842 alc882_adc1_init_verbs },
9843 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9844 .dac_nids = alc882_dac_nids,
9845 .dig_out_nid = ALC882_DIGOUT_NID,
9846 .dig_in_nid = ALC882_DIGIN_NID,
9847 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9848 .channel_mode = alc882_ch_modes,
9850 .input_mux = &alc882_capture_source,
9852 [ALC882_6ST_DIG] = {
9853 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9854 .init_verbs = { alc882_base_init_verbs,
9855 alc882_adc1_init_verbs },
9856 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9857 .dac_nids = alc882_dac_nids,
9858 .dig_out_nid = ALC882_DIGOUT_NID,
9859 .dig_in_nid = ALC882_DIGIN_NID,
9860 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9861 .channel_mode = alc882_sixstack_modes,
9862 .input_mux = &alc882_capture_source,
9865 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9866 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9867 alc882_eapd_verbs },
9868 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9869 .dac_nids = alc882_dac_nids,
9870 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9871 .channel_mode = alc882_sixstack_modes,
9872 .input_mux = &alc882_capture_source,
9875 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9876 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9877 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9878 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9879 .dac_nids = alc882_dac_nids,
9880 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9881 .channel_mode = alc880_threestack_modes,
9883 .input_mux = &alc882_capture_source,
9884 .dig_out_nid = ALC882_DIGOUT_NID,
9887 .mixers = { alc885_mba21_mixer },
9888 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9890 .dac_nids = alc882_dac_nids,
9891 .channel_mode = alc885_mba21_ch_modes,
9892 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9893 .input_mux = &alc882_capture_source,
9894 .unsol_event = alc_automute_amp_unsol_event,
9895 .setup = alc885_mba21_setup,
9896 .init_hook = alc_automute_amp,
9899 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9900 .init_verbs = { alc885_mbp3_init_verbs,
9901 alc880_gpio1_init_verbs },
9903 .dac_nids = alc882_dac_nids,
9905 .channel_mode = alc885_mbp_4ch_modes,
9906 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9907 .input_mux = &alc882_capture_source,
9908 .dig_out_nid = ALC882_DIGOUT_NID,
9909 .dig_in_nid = ALC882_DIGIN_NID,
9910 .unsol_event = alc_automute_amp_unsol_event,
9911 .setup = alc885_mbp3_setup,
9912 .init_hook = alc_automute_amp,
9915 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9916 .init_verbs = { alc885_mb5_init_verbs,
9917 alc880_gpio1_init_verbs },
9918 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9919 .dac_nids = alc882_dac_nids,
9920 .channel_mode = alc885_mb5_6ch_modes,
9921 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9922 .input_mux = &mb5_capture_source,
9923 .dig_out_nid = ALC882_DIGOUT_NID,
9924 .dig_in_nid = ALC882_DIGIN_NID,
9925 .unsol_event = alc_automute_amp_unsol_event,
9926 .setup = alc885_mb5_setup,
9927 .init_hook = alc_automute_amp,
9929 [ALC885_MACMINI3] = {
9930 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9931 .init_verbs = { alc885_macmini3_init_verbs,
9932 alc880_gpio1_init_verbs },
9933 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9934 .dac_nids = alc882_dac_nids,
9935 .channel_mode = alc885_macmini3_6ch_modes,
9936 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9937 .input_mux = &macmini3_capture_source,
9938 .dig_out_nid = ALC882_DIGOUT_NID,
9939 .dig_in_nid = ALC882_DIGIN_NID,
9940 .unsol_event = alc_automute_amp_unsol_event,
9941 .setup = alc885_macmini3_setup,
9942 .init_hook = alc_automute_amp,
9945 .mixers = { alc882_macpro_mixer },
9946 .init_verbs = { alc882_macpro_init_verbs },
9947 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9948 .dac_nids = alc882_dac_nids,
9949 .dig_out_nid = ALC882_DIGOUT_NID,
9950 .dig_in_nid = ALC882_DIGIN_NID,
9951 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9952 .channel_mode = alc882_ch_modes,
9953 .input_mux = &alc882_capture_source,
9954 .init_hook = alc885_macpro_init_hook,
9957 .mixers = { alc885_imac24_mixer },
9958 .init_verbs = { alc885_imac24_init_verbs },
9959 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9960 .dac_nids = alc882_dac_nids,
9961 .dig_out_nid = ALC882_DIGOUT_NID,
9962 .dig_in_nid = ALC882_DIGIN_NID,
9963 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9964 .channel_mode = alc882_ch_modes,
9965 .input_mux = &alc882_capture_source,
9966 .unsol_event = alc_automute_amp_unsol_event,
9967 .setup = alc885_imac24_setup,
9968 .init_hook = alc885_imac24_init_hook,
9971 .mixers = {alc885_imac91_mixer},
9972 .init_verbs = { alc885_imac91_init_verbs,
9973 alc880_gpio1_init_verbs },
9974 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9975 .dac_nids = alc882_dac_nids,
9976 .channel_mode = alc885_mba21_ch_modes,
9977 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9978 .input_mux = &alc889A_imac91_capture_source,
9979 .dig_out_nid = ALC882_DIGOUT_NID,
9980 .dig_in_nid = ALC882_DIGIN_NID,
9981 .unsol_event = alc_automute_amp_unsol_event,
9982 .setup = alc885_imac91_setup,
9983 .init_hook = alc_automute_amp,
9986 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9987 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9988 alc880_gpio3_init_verbs, alc882_targa_verbs},
9989 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9990 .dac_nids = alc882_dac_nids,
9991 .dig_out_nid = ALC882_DIGOUT_NID,
9992 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9993 .adc_nids = alc882_adc_nids,
9994 .capsrc_nids = alc882_capsrc_nids,
9995 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9996 .channel_mode = alc882_3ST_6ch_modes,
9998 .input_mux = &alc882_capture_source,
9999 .unsol_event = alc882_targa_unsol_event,
10000 .setup = alc882_targa_setup,
10001 .init_hook = alc882_targa_automute,
10003 [ALC882_ASUS_A7J] = {
10004 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10005 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10006 alc882_asus_a7j_verbs},
10007 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10008 .dac_nids = alc882_dac_nids,
10009 .dig_out_nid = ALC882_DIGOUT_NID,
10010 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10011 .adc_nids = alc882_adc_nids,
10012 .capsrc_nids = alc882_capsrc_nids,
10013 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10014 .channel_mode = alc882_3ST_6ch_modes,
10016 .input_mux = &alc882_capture_source,
10018 [ALC882_ASUS_A7M] = {
10019 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10020 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10021 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10022 alc882_asus_a7m_verbs },
10023 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10024 .dac_nids = alc882_dac_nids,
10025 .dig_out_nid = ALC882_DIGOUT_NID,
10026 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10027 .channel_mode = alc880_threestack_modes,
10029 .input_mux = &alc882_capture_source,
10031 [ALC883_3ST_2ch_DIG] = {
10032 .mixers = { alc883_3ST_2ch_mixer },
10033 .init_verbs = { alc883_init_verbs },
10034 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10035 .dac_nids = alc883_dac_nids,
10036 .dig_out_nid = ALC883_DIGOUT_NID,
10037 .dig_in_nid = ALC883_DIGIN_NID,
10038 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10039 .channel_mode = alc883_3ST_2ch_modes,
10040 .input_mux = &alc883_capture_source,
10042 [ALC883_3ST_6ch_DIG] = {
10043 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10044 .init_verbs = { alc883_init_verbs },
10045 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10046 .dac_nids = alc883_dac_nids,
10047 .dig_out_nid = ALC883_DIGOUT_NID,
10048 .dig_in_nid = ALC883_DIGIN_NID,
10049 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10050 .channel_mode = alc883_3ST_6ch_modes,
10052 .input_mux = &alc883_capture_source,
10054 [ALC883_3ST_6ch] = {
10055 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10056 .init_verbs = { alc883_init_verbs },
10057 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10058 .dac_nids = alc883_dac_nids,
10059 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10060 .channel_mode = alc883_3ST_6ch_modes,
10062 .input_mux = &alc883_capture_source,
10064 [ALC883_3ST_6ch_INTEL] = {
10065 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10066 .init_verbs = { alc883_init_verbs },
10067 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10068 .dac_nids = alc883_dac_nids,
10069 .dig_out_nid = ALC883_DIGOUT_NID,
10070 .dig_in_nid = ALC883_DIGIN_NID,
10071 .slave_dig_outs = alc883_slave_dig_outs,
10072 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10073 .channel_mode = alc883_3ST_6ch_intel_modes,
10075 .input_mux = &alc883_3stack_6ch_intel,
10077 [ALC889A_INTEL] = {
10078 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10079 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10080 alc_hp15_unsol_verbs },
10081 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10082 .dac_nids = alc883_dac_nids,
10083 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10084 .adc_nids = alc889_adc_nids,
10085 .dig_out_nid = ALC883_DIGOUT_NID,
10086 .dig_in_nid = ALC883_DIGIN_NID,
10087 .slave_dig_outs = alc883_slave_dig_outs,
10088 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10089 .channel_mode = alc889_8ch_intel_modes,
10090 .capsrc_nids = alc889_capsrc_nids,
10091 .input_mux = &alc889_capture_source,
10092 .setup = alc889_automute_setup,
10093 .init_hook = alc_automute_amp,
10094 .unsol_event = alc_automute_amp_unsol_event,
10098 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10099 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10100 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10101 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10102 .dac_nids = alc883_dac_nids,
10103 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10104 .adc_nids = alc889_adc_nids,
10105 .dig_out_nid = ALC883_DIGOUT_NID,
10106 .dig_in_nid = ALC883_DIGIN_NID,
10107 .slave_dig_outs = alc883_slave_dig_outs,
10108 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10109 .channel_mode = alc889_8ch_intel_modes,
10110 .capsrc_nids = alc889_capsrc_nids,
10111 .input_mux = &alc889_capture_source,
10112 .setup = alc889_automute_setup,
10113 .init_hook = alc889_intel_init_hook,
10114 .unsol_event = alc_automute_amp_unsol_event,
10117 [ALC883_6ST_DIG] = {
10118 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10119 .init_verbs = { alc883_init_verbs },
10120 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10121 .dac_nids = alc883_dac_nids,
10122 .dig_out_nid = ALC883_DIGOUT_NID,
10123 .dig_in_nid = ALC883_DIGIN_NID,
10124 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10125 .channel_mode = alc883_sixstack_modes,
10126 .input_mux = &alc883_capture_source,
10128 [ALC883_TARGA_DIG] = {
10129 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10130 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10131 alc883_targa_verbs},
10132 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10133 .dac_nids = alc883_dac_nids,
10134 .dig_out_nid = ALC883_DIGOUT_NID,
10135 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10136 .channel_mode = alc883_3ST_6ch_modes,
10138 .input_mux = &alc883_capture_source,
10139 .unsol_event = alc883_targa_unsol_event,
10140 .setup = alc882_targa_setup,
10141 .init_hook = alc882_targa_automute,
10143 [ALC883_TARGA_2ch_DIG] = {
10144 .mixers = { alc883_targa_2ch_mixer},
10145 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10146 alc883_targa_verbs},
10147 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10148 .dac_nids = alc883_dac_nids,
10149 .adc_nids = alc883_adc_nids_alt,
10150 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10151 .capsrc_nids = alc883_capsrc_nids,
10152 .dig_out_nid = ALC883_DIGOUT_NID,
10153 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10154 .channel_mode = alc883_3ST_2ch_modes,
10155 .input_mux = &alc883_capture_source,
10156 .unsol_event = alc883_targa_unsol_event,
10157 .setup = alc882_targa_setup,
10158 .init_hook = alc882_targa_automute,
10160 [ALC883_TARGA_8ch_DIG] = {
10161 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10162 alc883_chmode_mixer },
10163 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10164 alc883_targa_verbs },
10165 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10166 .dac_nids = alc883_dac_nids,
10167 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10168 .adc_nids = alc883_adc_nids_rev,
10169 .capsrc_nids = alc883_capsrc_nids_rev,
10170 .dig_out_nid = ALC883_DIGOUT_NID,
10171 .dig_in_nid = ALC883_DIGIN_NID,
10172 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10173 .channel_mode = alc883_4ST_8ch_modes,
10175 .input_mux = &alc883_capture_source,
10176 .unsol_event = alc883_targa_unsol_event,
10177 .setup = alc882_targa_setup,
10178 .init_hook = alc882_targa_automute,
10181 .mixers = { alc883_base_mixer },
10182 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10183 * and the headphone jack. Turn this on and rely on the
10184 * standard mute methods whenever the user wants to turn
10185 * these outputs off.
10187 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10188 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10189 .dac_nids = alc883_dac_nids,
10190 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10191 .channel_mode = alc883_3ST_2ch_modes,
10192 .input_mux = &alc883_capture_source,
10194 [ALC883_ACER_ASPIRE] = {
10195 .mixers = { alc883_acer_aspire_mixer },
10196 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10197 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10198 .dac_nids = alc883_dac_nids,
10199 .dig_out_nid = ALC883_DIGOUT_NID,
10200 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10201 .channel_mode = alc883_3ST_2ch_modes,
10202 .input_mux = &alc883_capture_source,
10203 .unsol_event = alc_automute_amp_unsol_event,
10204 .setup = alc883_acer_aspire_setup,
10205 .init_hook = alc_automute_amp,
10207 [ALC888_ACER_ASPIRE_4930G] = {
10208 .mixers = { alc888_base_mixer,
10209 alc883_chmode_mixer },
10210 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10211 alc888_acer_aspire_4930g_verbs },
10212 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10213 .dac_nids = alc883_dac_nids,
10214 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10215 .adc_nids = alc883_adc_nids_rev,
10216 .capsrc_nids = alc883_capsrc_nids_rev,
10217 .dig_out_nid = ALC883_DIGOUT_NID,
10218 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10219 .channel_mode = alc883_3ST_6ch_modes,
10221 .const_channel_count = 6,
10223 ARRAY_SIZE(alc888_2_capture_sources),
10224 .input_mux = alc888_2_capture_sources,
10225 .unsol_event = alc_automute_amp_unsol_event,
10226 .setup = alc888_acer_aspire_4930g_setup,
10227 .init_hook = alc_automute_amp,
10229 [ALC888_ACER_ASPIRE_6530G] = {
10230 .mixers = { alc888_acer_aspire_6530_mixer },
10231 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10232 alc888_acer_aspire_6530g_verbs },
10233 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10234 .dac_nids = alc883_dac_nids,
10235 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10236 .adc_nids = alc883_adc_nids_rev,
10237 .capsrc_nids = alc883_capsrc_nids_rev,
10238 .dig_out_nid = ALC883_DIGOUT_NID,
10239 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10240 .channel_mode = alc883_3ST_2ch_modes,
10242 ARRAY_SIZE(alc888_2_capture_sources),
10243 .input_mux = alc888_acer_aspire_6530_sources,
10244 .unsol_event = alc_automute_amp_unsol_event,
10245 .setup = alc888_acer_aspire_6530g_setup,
10246 .init_hook = alc_automute_amp,
10248 [ALC888_ACER_ASPIRE_8930G] = {
10249 .mixers = { alc889_acer_aspire_8930g_mixer,
10250 alc883_chmode_mixer },
10251 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10252 alc889_acer_aspire_8930g_verbs,
10253 alc889_eapd_verbs},
10254 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10255 .dac_nids = alc883_dac_nids,
10256 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10257 .adc_nids = alc889_adc_nids,
10258 .capsrc_nids = alc889_capsrc_nids,
10259 .dig_out_nid = ALC883_DIGOUT_NID,
10260 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10261 .channel_mode = alc883_3ST_6ch_modes,
10263 .const_channel_count = 6,
10265 ARRAY_SIZE(alc889_capture_sources),
10266 .input_mux = alc889_capture_sources,
10267 .unsol_event = alc_automute_amp_unsol_event,
10268 .setup = alc889_acer_aspire_8930g_setup,
10269 .init_hook = alc_automute_amp,
10270 #ifdef CONFIG_SND_HDA_POWER_SAVE
10271 .power_hook = alc_power_eapd,
10274 [ALC888_ACER_ASPIRE_7730G] = {
10275 .mixers = { alc883_3ST_6ch_mixer,
10276 alc883_chmode_mixer },
10277 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10278 alc888_acer_aspire_7730G_verbs },
10279 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10280 .dac_nids = alc883_dac_nids,
10281 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10282 .adc_nids = alc883_adc_nids_rev,
10283 .capsrc_nids = alc883_capsrc_nids_rev,
10284 .dig_out_nid = ALC883_DIGOUT_NID,
10285 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10286 .channel_mode = alc883_3ST_6ch_modes,
10288 .const_channel_count = 6,
10289 .input_mux = &alc883_capture_source,
10290 .unsol_event = alc_automute_amp_unsol_event,
10291 .setup = alc888_acer_aspire_6530g_setup,
10292 .init_hook = alc_automute_amp,
10294 [ALC883_MEDION] = {
10295 .mixers = { alc883_fivestack_mixer,
10296 alc883_chmode_mixer },
10297 .init_verbs = { alc883_init_verbs,
10298 alc883_medion_eapd_verbs },
10299 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10300 .dac_nids = alc883_dac_nids,
10301 .adc_nids = alc883_adc_nids_alt,
10302 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10303 .capsrc_nids = alc883_capsrc_nids,
10304 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10305 .channel_mode = alc883_sixstack_modes,
10306 .input_mux = &alc883_capture_source,
10308 [ALC883_MEDION_MD2] = {
10309 .mixers = { alc883_medion_md2_mixer},
10310 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
10311 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10312 .dac_nids = alc883_dac_nids,
10313 .dig_out_nid = ALC883_DIGOUT_NID,
10314 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10315 .channel_mode = alc883_3ST_2ch_modes,
10316 .input_mux = &alc883_capture_source,
10317 .unsol_event = alc_automute_amp_unsol_event,
10318 .setup = alc883_medion_md2_setup,
10319 .init_hook = alc_automute_amp,
10321 [ALC883_MEDION_WIM2160] = {
10322 .mixers = { alc883_medion_wim2160_mixer },
10323 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10324 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10325 .dac_nids = alc883_dac_nids,
10326 .dig_out_nid = ALC883_DIGOUT_NID,
10327 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10328 .adc_nids = alc883_adc_nids,
10329 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10330 .channel_mode = alc883_3ST_2ch_modes,
10331 .input_mux = &alc883_capture_source,
10332 .unsol_event = alc_automute_amp_unsol_event,
10333 .setup = alc883_medion_wim2160_setup,
10334 .init_hook = alc_automute_amp,
10336 [ALC883_LAPTOP_EAPD] = {
10337 .mixers = { alc883_base_mixer },
10338 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10339 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10340 .dac_nids = alc883_dac_nids,
10341 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10342 .channel_mode = alc883_3ST_2ch_modes,
10343 .input_mux = &alc883_capture_source,
10345 [ALC883_CLEVO_M540R] = {
10346 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10347 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10348 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10349 .dac_nids = alc883_dac_nids,
10350 .dig_out_nid = ALC883_DIGOUT_NID,
10351 .dig_in_nid = ALC883_DIGIN_NID,
10352 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10353 .channel_mode = alc883_3ST_6ch_clevo_modes,
10355 .input_mux = &alc883_capture_source,
10356 /* This machine has the hardware HP auto-muting, thus
10357 * we need no software mute via unsol event
10360 [ALC883_CLEVO_M720] = {
10361 .mixers = { alc883_clevo_m720_mixer },
10362 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10363 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10364 .dac_nids = alc883_dac_nids,
10365 .dig_out_nid = ALC883_DIGOUT_NID,
10366 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10367 .channel_mode = alc883_3ST_2ch_modes,
10368 .input_mux = &alc883_capture_source,
10369 .unsol_event = alc883_clevo_m720_unsol_event,
10370 .setup = alc883_clevo_m720_setup,
10371 .init_hook = alc883_clevo_m720_init_hook,
10373 [ALC883_LENOVO_101E_2ch] = {
10374 .mixers = { alc883_lenovo_101e_2ch_mixer},
10375 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10376 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10377 .dac_nids = alc883_dac_nids,
10378 .adc_nids = alc883_adc_nids_alt,
10379 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10380 .capsrc_nids = alc883_capsrc_nids,
10381 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10382 .channel_mode = alc883_3ST_2ch_modes,
10383 .input_mux = &alc883_lenovo_101e_capture_source,
10384 .unsol_event = alc883_lenovo_101e_unsol_event,
10385 .init_hook = alc883_lenovo_101e_all_automute,
10387 [ALC883_LENOVO_NB0763] = {
10388 .mixers = { alc883_lenovo_nb0763_mixer },
10389 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10390 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10391 .dac_nids = alc883_dac_nids,
10392 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10393 .channel_mode = alc883_3ST_2ch_modes,
10395 .input_mux = &alc883_lenovo_nb0763_capture_source,
10396 .unsol_event = alc_automute_amp_unsol_event,
10397 .setup = alc883_medion_md2_setup,
10398 .init_hook = alc_automute_amp,
10400 [ALC888_LENOVO_MS7195_DIG] = {
10401 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10402 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10403 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10404 .dac_nids = alc883_dac_nids,
10405 .dig_out_nid = ALC883_DIGOUT_NID,
10406 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10407 .channel_mode = alc883_3ST_6ch_modes,
10409 .input_mux = &alc883_capture_source,
10410 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10411 .init_hook = alc888_lenovo_ms7195_front_automute,
10413 [ALC883_HAIER_W66] = {
10414 .mixers = { alc883_targa_2ch_mixer},
10415 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10416 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10417 .dac_nids = alc883_dac_nids,
10418 .dig_out_nid = ALC883_DIGOUT_NID,
10419 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10420 .channel_mode = alc883_3ST_2ch_modes,
10421 .input_mux = &alc883_capture_source,
10422 .unsol_event = alc_automute_amp_unsol_event,
10423 .setup = alc883_haier_w66_setup,
10424 .init_hook = alc_automute_amp,
10426 [ALC888_3ST_HP] = {
10427 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10428 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10429 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10430 .dac_nids = alc883_dac_nids,
10431 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10432 .channel_mode = alc888_3st_hp_modes,
10434 .input_mux = &alc883_capture_source,
10435 .unsol_event = alc_automute_amp_unsol_event,
10436 .setup = alc888_3st_hp_setup,
10437 .init_hook = alc_automute_amp,
10439 [ALC888_6ST_DELL] = {
10440 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10441 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10442 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10443 .dac_nids = alc883_dac_nids,
10444 .dig_out_nid = ALC883_DIGOUT_NID,
10445 .dig_in_nid = ALC883_DIGIN_NID,
10446 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10447 .channel_mode = alc883_sixstack_modes,
10448 .input_mux = &alc883_capture_source,
10449 .unsol_event = alc_automute_amp_unsol_event,
10450 .setup = alc888_6st_dell_setup,
10451 .init_hook = alc_automute_amp,
10454 .mixers = { alc883_mitac_mixer },
10455 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10456 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10457 .dac_nids = alc883_dac_nids,
10458 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10459 .channel_mode = alc883_3ST_2ch_modes,
10460 .input_mux = &alc883_capture_source,
10461 .unsol_event = alc_automute_amp_unsol_event,
10462 .setup = alc883_mitac_setup,
10463 .init_hook = alc_automute_amp,
10465 [ALC883_FUJITSU_PI2515] = {
10466 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10467 .init_verbs = { alc883_init_verbs,
10468 alc883_2ch_fujitsu_pi2515_verbs},
10469 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10470 .dac_nids = alc883_dac_nids,
10471 .dig_out_nid = ALC883_DIGOUT_NID,
10472 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10473 .channel_mode = alc883_3ST_2ch_modes,
10474 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10475 .unsol_event = alc_automute_amp_unsol_event,
10476 .setup = alc883_2ch_fujitsu_pi2515_setup,
10477 .init_hook = alc_automute_amp,
10479 [ALC888_FUJITSU_XA3530] = {
10480 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10481 .init_verbs = { alc883_init_verbs,
10482 alc888_fujitsu_xa3530_verbs },
10483 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10484 .dac_nids = alc883_dac_nids,
10485 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10486 .adc_nids = alc883_adc_nids_rev,
10487 .capsrc_nids = alc883_capsrc_nids_rev,
10488 .dig_out_nid = ALC883_DIGOUT_NID,
10489 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10490 .channel_mode = alc888_4ST_8ch_intel_modes,
10492 ARRAY_SIZE(alc888_2_capture_sources),
10493 .input_mux = alc888_2_capture_sources,
10494 .unsol_event = alc_automute_amp_unsol_event,
10495 .setup = alc888_fujitsu_xa3530_setup,
10496 .init_hook = alc_automute_amp,
10498 [ALC888_LENOVO_SKY] = {
10499 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10500 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10501 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10502 .dac_nids = alc883_dac_nids,
10503 .dig_out_nid = ALC883_DIGOUT_NID,
10504 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10505 .channel_mode = alc883_sixstack_modes,
10507 .input_mux = &alc883_lenovo_sky_capture_source,
10508 .unsol_event = alc_automute_amp_unsol_event,
10509 .setup = alc888_lenovo_sky_setup,
10510 .init_hook = alc_automute_amp,
10512 [ALC888_ASUS_M90V] = {
10513 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10514 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10515 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10516 .dac_nids = alc883_dac_nids,
10517 .dig_out_nid = ALC883_DIGOUT_NID,
10518 .dig_in_nid = ALC883_DIGIN_NID,
10519 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10520 .channel_mode = alc883_3ST_6ch_modes,
10522 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10523 .unsol_event = alc_sku_unsol_event,
10524 .setup = alc883_mode2_setup,
10525 .init_hook = alc_inithook,
10527 [ALC888_ASUS_EEE1601] = {
10528 .mixers = { alc883_asus_eee1601_mixer },
10529 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10530 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10531 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10532 .dac_nids = alc883_dac_nids,
10533 .dig_out_nid = ALC883_DIGOUT_NID,
10534 .dig_in_nid = ALC883_DIGIN_NID,
10535 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10536 .channel_mode = alc883_3ST_2ch_modes,
10538 .input_mux = &alc883_asus_eee1601_capture_source,
10539 .unsol_event = alc_sku_unsol_event,
10540 .init_hook = alc883_eee1601_inithook,
10542 [ALC1200_ASUS_P5Q] = {
10543 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10544 .init_verbs = { alc883_init_verbs },
10545 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10546 .dac_nids = alc883_dac_nids,
10547 .dig_out_nid = ALC1200_DIGOUT_NID,
10548 .dig_in_nid = ALC883_DIGIN_NID,
10549 .slave_dig_outs = alc1200_slave_dig_outs,
10550 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10551 .channel_mode = alc883_sixstack_modes,
10552 .input_mux = &alc883_capture_source,
10555 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10556 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10557 alc880_gpio1_init_verbs },
10558 .adc_nids = alc883_adc_nids,
10559 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10560 .capsrc_nids = alc883_capsrc_nids,
10561 .dac_nids = alc883_dac_nids,
10562 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10563 .channel_mode = alc889A_mb31_6ch_modes,
10564 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10565 .input_mux = &alc889A_mb31_capture_source,
10566 .dig_out_nid = ALC883_DIGOUT_NID,
10567 .unsol_event = alc889A_mb31_unsol_event,
10568 .init_hook = alc889A_mb31_automute,
10570 [ALC883_SONY_VAIO_TT] = {
10571 .mixers = { alc883_vaiott_mixer },
10572 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10573 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10574 .dac_nids = alc883_dac_nids,
10575 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10576 .channel_mode = alc883_3ST_2ch_modes,
10577 .input_mux = &alc883_capture_source,
10578 .unsol_event = alc_automute_amp_unsol_event,
10579 .setup = alc883_vaiott_setup,
10580 .init_hook = alc_automute_amp,
10589 PINFIX_ABIT_AW9D_MAX,
10593 static const struct alc_fixup alc882_fixups[] = {
10594 [PINFIX_ABIT_AW9D_MAX] = {
10595 .pins = (const struct alc_pincfg[]) {
10596 { 0x15, 0x01080104 }, /* side */
10597 { 0x16, 0x01011012 }, /* rear */
10598 { 0x17, 0x01016011 }, /* clfe */
10602 [PINFIX_PB_M5210] = {
10603 .verbs = (const struct hda_verb[]) {
10604 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10610 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10611 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10612 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10617 * BIOS auto configuration
10619 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10620 const struct auto_pin_cfg *cfg)
10622 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10625 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10626 hda_nid_t nid, int pin_type,
10631 /* set as output */
10632 alc_set_pin_output(codec, nid, pin_type);
10636 else if (dac >= 0x02 && dac <= 0x05)
10640 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10643 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10645 struct alc_spec *spec = codec->spec;
10648 for (i = 0; i <= HDA_SIDE; i++) {
10649 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10650 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10652 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10653 spec->multiout.dac_nids[i]);
10657 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10659 struct alc_spec *spec = codec->spec;
10660 hda_nid_t pin, dac;
10663 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10664 pin = spec->autocfg.hp_pins[i];
10667 dac = spec->multiout.hp_nid;
10669 dac = spec->multiout.dac_nids[0]; /* to front */
10670 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10672 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10673 pin = spec->autocfg.speaker_pins[i];
10676 dac = spec->multiout.extra_out_nid[0];
10678 dac = spec->multiout.dac_nids[0]; /* to front */
10679 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10683 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10685 struct alc_spec *spec = codec->spec;
10686 struct auto_pin_cfg *cfg = &spec->autocfg;
10689 for (i = 0; i < cfg->num_inputs; i++) {
10690 hda_nid_t nid = cfg->inputs[i].pin;
10691 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10692 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10693 snd_hda_codec_write(codec, nid, 0,
10694 AC_VERB_SET_AMP_GAIN_MUTE,
10699 static void alc882_auto_init_input_src(struct hda_codec *codec)
10701 struct alc_spec *spec = codec->spec;
10704 for (c = 0; c < spec->num_adc_nids; c++) {
10705 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10706 hda_nid_t nid = spec->capsrc_nids[c];
10707 unsigned int mux_idx;
10708 const struct hda_input_mux *imux;
10709 int conns, mute, idx, item;
10711 conns = snd_hda_get_connections(codec, nid, conn_list,
10712 ARRAY_SIZE(conn_list));
10715 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10716 imux = &spec->input_mux[mux_idx];
10717 if (!imux->num_items && mux_idx > 0)
10718 imux = &spec->input_mux[0];
10719 for (idx = 0; idx < conns; idx++) {
10720 /* if the current connection is the selected one,
10721 * unmute it as default - otherwise mute it
10723 mute = AMP_IN_MUTE(idx);
10724 for (item = 0; item < imux->num_items; item++) {
10725 if (imux->items[item].index == idx) {
10726 if (spec->cur_mux[c] == item)
10727 mute = AMP_IN_UNMUTE(idx);
10731 /* check if we have a selector or mixer
10732 * we could check for the widget type instead, but
10733 * just check for Amp-In presence (in case of mixer
10734 * without amp-in there is something wrong, this
10735 * function shouldn't be used or capsrc nid is wrong)
10737 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10738 snd_hda_codec_write(codec, nid, 0,
10739 AC_VERB_SET_AMP_GAIN_MUTE,
10741 else if (mute != AMP_IN_MUTE(idx))
10742 snd_hda_codec_write(codec, nid, 0,
10743 AC_VERB_SET_CONNECT_SEL,
10749 /* add mic boosts if needed */
10750 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10752 struct alc_spec *spec = codec->spec;
10753 struct auto_pin_cfg *cfg = &spec->autocfg;
10757 for (i = 0; i < cfg->num_inputs; i++) {
10758 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10760 nid = cfg->inputs[i].pin;
10761 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10763 snprintf(label, sizeof(label), "%s Boost",
10764 hda_get_autocfg_input_label(codec, cfg, i));
10765 err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0,
10766 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10774 /* almost identical with ALC880 parser... */
10775 static int alc882_parse_auto_config(struct hda_codec *codec)
10777 struct alc_spec *spec = codec->spec;
10778 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10781 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10785 if (!spec->autocfg.line_outs)
10786 return 0; /* can't find valid BIOS pin config */
10788 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10791 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10794 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10798 err = alc880_auto_create_extra_out(spec,
10799 spec->autocfg.speaker_pins[0],
10803 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10807 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10809 alc_auto_parse_digital(codec);
10811 if (spec->kctls.list)
10812 add_mixer(spec, spec->kctls.list);
10814 add_verb(spec, alc883_auto_init_verbs);
10815 /* if ADC 0x07 is available, initialize it, too */
10816 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10817 add_verb(spec, alc882_adc1_init_verbs);
10819 spec->num_mux_defs = 1;
10820 spec->input_mux = &spec->private_imux[0];
10822 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10824 err = alc_auto_add_mic_boost(codec);
10828 return 1; /* config found */
10831 /* additional initialization for auto-configuration model */
10832 static void alc882_auto_init(struct hda_codec *codec)
10834 struct alc_spec *spec = codec->spec;
10835 alc882_auto_init_multi_out(codec);
10836 alc882_auto_init_hp_out(codec);
10837 alc882_auto_init_analog_input(codec);
10838 alc882_auto_init_input_src(codec);
10839 alc_auto_init_digital(codec);
10840 if (spec->unsol_event)
10841 alc_inithook(codec);
10844 static int patch_alc882(struct hda_codec *codec)
10846 struct alc_spec *spec;
10847 int err, board_config;
10849 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10853 codec->spec = spec;
10855 alc_auto_parse_customize_define(codec);
10857 switch (codec->vendor_id) {
10862 /* ALC883 and variants */
10863 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10867 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10871 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10872 board_config = snd_hda_check_board_codec_sid_config(codec,
10873 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10875 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10876 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10878 board_config = ALC882_AUTO;
10881 if (board_config == ALC882_AUTO)
10882 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10884 if (board_config == ALC882_AUTO) {
10885 /* automatic parse from the BIOS config */
10886 err = alc882_parse_auto_config(codec);
10892 "hda_codec: Cannot set up configuration "
10893 "from BIOS. Using base mode...\n");
10894 board_config = ALC882_3ST_DIG;
10898 if (has_cdefine_beep(codec)) {
10899 err = snd_hda_attach_beep_device(codec, 0x1);
10906 if (board_config != ALC882_AUTO)
10907 setup_preset(codec, &alc882_presets[board_config]);
10909 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10910 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10911 /* FIXME: setup DAC5 */
10912 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10913 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10915 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10916 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10918 if (!spec->adc_nids && spec->input_mux) {
10920 spec->num_adc_nids = 0;
10921 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10922 const struct hda_input_mux *imux = spec->input_mux;
10924 hda_nid_t items[16];
10925 hda_nid_t nid = alc882_adc_nids[i];
10926 unsigned int wcap = get_wcaps(codec, nid);
10928 wcap = get_wcaps_type(wcap);
10929 if (wcap != AC_WID_AUD_IN)
10931 spec->private_adc_nids[spec->num_adc_nids] = nid;
10932 err = snd_hda_get_connections(codec, nid, &cap, 1);
10935 err = snd_hda_get_connections(codec, cap, items,
10936 ARRAY_SIZE(items));
10939 for (j = 0; j < imux->num_items; j++)
10940 if (imux->items[j].index >= err)
10942 if (j < imux->num_items)
10944 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10945 spec->num_adc_nids++;
10947 spec->adc_nids = spec->private_adc_nids;
10948 spec->capsrc_nids = spec->private_capsrc_nids;
10951 set_capture_mixer(codec);
10953 if (has_cdefine_beep(codec))
10954 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10956 if (board_config == ALC882_AUTO)
10957 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
10959 spec->vmaster_nid = 0x0c;
10961 codec->patch_ops = alc_patch_ops;
10962 if (board_config == ALC882_AUTO)
10963 spec->init_hook = alc882_auto_init;
10964 #ifdef CONFIG_SND_HDA_POWER_SAVE
10965 if (!spec->loopback.amplist)
10966 spec->loopback.amplist = alc882_loopbacks;
10977 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10978 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10980 #define alc262_dac_nids alc260_dac_nids
10981 #define alc262_adc_nids alc882_adc_nids
10982 #define alc262_adc_nids_alt alc882_adc_nids_alt
10983 #define alc262_capsrc_nids alc882_capsrc_nids
10984 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10986 #define alc262_modes alc260_modes
10987 #define alc262_capture_source alc882_capture_source
10989 static hda_nid_t alc262_dmic_adc_nids[1] = {
10994 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10996 static struct snd_kcontrol_new alc262_base_mixer[] = {
10997 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10998 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10999 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11000 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11001 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11002 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11003 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11004 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11005 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11006 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11007 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11008 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11009 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11010 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11011 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11012 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11016 /* update HP, line and mono-out pins according to the master switch */
11017 static void alc262_hp_master_update(struct hda_codec *codec)
11019 struct alc_spec *spec = codec->spec;
11020 int val = spec->master_sw;
11022 /* HP & line-out */
11023 snd_hda_codec_write_cache(codec, 0x1b, 0,
11024 AC_VERB_SET_PIN_WIDGET_CONTROL,
11026 snd_hda_codec_write_cache(codec, 0x15, 0,
11027 AC_VERB_SET_PIN_WIDGET_CONTROL,
11029 /* mono (speaker) depending on the HP jack sense */
11030 val = val && !spec->jack_present;
11031 snd_hda_codec_write_cache(codec, 0x16, 0,
11032 AC_VERB_SET_PIN_WIDGET_CONTROL,
11033 val ? PIN_OUT : 0);
11036 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11038 struct alc_spec *spec = codec->spec;
11040 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11041 alc262_hp_master_update(codec);
11044 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11046 if ((res >> 26) != ALC880_HP_EVENT)
11048 alc262_hp_bpc_automute(codec);
11051 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11053 struct alc_spec *spec = codec->spec;
11055 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11056 alc262_hp_master_update(codec);
11059 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11062 if ((res >> 26) != ALC880_HP_EVENT)
11064 alc262_hp_wildwest_automute(codec);
11067 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11069 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11070 struct snd_ctl_elem_value *ucontrol)
11072 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11073 struct alc_spec *spec = codec->spec;
11074 int val = !!*ucontrol->value.integer.value;
11076 if (val == spec->master_sw)
11078 spec->master_sw = val;
11079 alc262_hp_master_update(codec);
11083 #define ALC262_HP_MASTER_SWITCH \
11085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11086 .name = "Master Playback Switch", \
11087 .info = snd_ctl_boolean_mono_info, \
11088 .get = alc262_hp_master_sw_get, \
11089 .put = alc262_hp_master_sw_put, \
11092 .iface = NID_MAPPING, \
11093 .name = "Master Playback Switch", \
11094 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11098 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11099 ALC262_HP_MASTER_SWITCH,
11100 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11101 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11102 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11103 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11105 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11109 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11110 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11112 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11113 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11114 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11115 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11116 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11117 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11118 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11122 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11123 ALC262_HP_MASTER_SWITCH,
11124 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11125 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11126 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11127 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11128 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11130 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11132 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11133 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11134 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
11135 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11136 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11137 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11138 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11142 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11143 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11144 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11145 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
11149 /* mute/unmute internal speaker according to the hp jack and mute state */
11150 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11152 struct alc_spec *spec = codec->spec;
11154 spec->autocfg.hp_pins[0] = 0x15;
11155 spec->autocfg.speaker_pins[0] = 0x14;
11158 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11159 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11160 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11161 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11162 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11165 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11169 static struct hda_verb alc262_hp_t5735_verbs[] = {
11170 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11171 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11173 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11177 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11178 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11179 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11180 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11181 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11182 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11183 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11187 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11188 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11189 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11190 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11191 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11192 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11193 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11194 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11196 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11201 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11208 /* bind hp and internal speaker mute (with plug check) as master switch */
11209 static void alc262_hippo_master_update(struct hda_codec *codec)
11211 struct alc_spec *spec = codec->spec;
11212 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11213 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11214 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11218 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11219 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11220 HDA_AMP_MUTE, mute);
11221 /* mute internal speaker per jack sense */
11222 if (spec->jack_present)
11223 mute = HDA_AMP_MUTE;
11225 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11226 HDA_AMP_MUTE, mute);
11227 if (speaker_nid && speaker_nid != line_nid)
11228 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11229 HDA_AMP_MUTE, mute);
11232 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11234 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11235 struct snd_ctl_elem_value *ucontrol)
11237 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11238 struct alc_spec *spec = codec->spec;
11239 int val = !!*ucontrol->value.integer.value;
11241 if (val == spec->master_sw)
11243 spec->master_sw = val;
11244 alc262_hippo_master_update(codec);
11248 #define ALC262_HIPPO_MASTER_SWITCH \
11250 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11251 .name = "Master Playback Switch", \
11252 .info = snd_ctl_boolean_mono_info, \
11253 .get = alc262_hippo_master_sw_get, \
11254 .put = alc262_hippo_master_sw_put, \
11257 .iface = NID_MAPPING, \
11258 .name = "Master Playback Switch", \
11259 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11260 (SUBDEV_SPEAKER(0) << 16), \
11263 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11264 ALC262_HIPPO_MASTER_SWITCH,
11265 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11266 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11267 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11268 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11269 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11270 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11271 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11272 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11273 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11274 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11275 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11276 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11280 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11281 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11282 ALC262_HIPPO_MASTER_SWITCH,
11283 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11284 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11285 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11286 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11287 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11288 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11289 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11290 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11291 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11292 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11296 /* mute/unmute internal speaker according to the hp jack and mute state */
11297 static void alc262_hippo_automute(struct hda_codec *codec)
11299 struct alc_spec *spec = codec->spec;
11300 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11302 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11303 alc262_hippo_master_update(codec);
11306 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11308 if ((res >> 26) != ALC880_HP_EVENT)
11310 alc262_hippo_automute(codec);
11313 static void alc262_hippo_setup(struct hda_codec *codec)
11315 struct alc_spec *spec = codec->spec;
11317 spec->autocfg.hp_pins[0] = 0x15;
11318 spec->autocfg.speaker_pins[0] = 0x14;
11321 static void alc262_hippo1_setup(struct hda_codec *codec)
11323 struct alc_spec *spec = codec->spec;
11325 spec->autocfg.hp_pins[0] = 0x1b;
11326 spec->autocfg.speaker_pins[0] = 0x14;
11330 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11331 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11332 ALC262_HIPPO_MASTER_SWITCH,
11333 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11334 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11335 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11336 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11340 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11341 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11342 ALC262_HIPPO_MASTER_SWITCH,
11343 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11344 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11345 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11346 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11347 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11351 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11352 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11353 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11354 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11355 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11356 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11357 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11358 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11359 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11360 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11361 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11362 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11363 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11367 static struct hda_verb alc262_tyan_verbs[] = {
11368 /* Headphone automute */
11369 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11370 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11371 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11373 /* P11 AUX_IN, white 4-pin connector */
11374 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11375 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11376 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11377 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11382 /* unsolicited event for HP jack sensing */
11383 static void alc262_tyan_setup(struct hda_codec *codec)
11385 struct alc_spec *spec = codec->spec;
11387 spec->autocfg.hp_pins[0] = 0x1b;
11388 spec->autocfg.speaker_pins[0] = 0x15;
11392 #define alc262_capture_mixer alc882_capture_mixer
11393 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11396 * generic initialization of ADC, input mixers and output mixers
11398 static struct hda_verb alc262_init_verbs[] = {
11400 * Unmute ADC0-2 and set the default input to mic-in
11402 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11403 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11404 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11405 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11406 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11407 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11409 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11411 * Note: PASD motherboards uses the Line In 2 as the input for
11412 * front panel mic (mic 2)
11414 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11415 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11422 * Set up output mixers (0x0c - 0x0e)
11424 /* set vol=0 to output mixers */
11425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11426 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11427 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11428 /* set up input amps for analog loopback */
11429 /* Amp Indices: DAC = 0, mixer = 1 */
11430 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11431 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11432 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11433 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11434 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11437 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11438 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11439 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11440 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11441 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11442 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11444 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11445 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11446 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11447 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11448 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11450 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11451 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11453 /* FIXME: use matrix-type input source selection */
11454 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11455 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11456 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11458 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11461 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11466 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11467 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11474 static struct hda_verb alc262_eapd_verbs[] = {
11475 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11476 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11480 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11481 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11482 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11483 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11485 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11486 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11490 static struct hda_verb alc262_sony_unsol_verbs[] = {
11491 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11492 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11493 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11495 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11496 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11500 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11501 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11502 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11503 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11504 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11505 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11509 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11510 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11511 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11512 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11513 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11514 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11515 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11516 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11517 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11521 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11523 struct alc_spec *spec = codec->spec;
11525 spec->autocfg.hp_pins[0] = 0x15;
11526 spec->autocfg.speaker_pins[0] = 0x14;
11527 spec->ext_mic.pin = 0x18;
11528 spec->ext_mic.mux_idx = 0;
11529 spec->int_mic.pin = 0x12;
11530 spec->int_mic.mux_idx = 9;
11531 spec->auto_mic = 1;
11537 * 0x16 = internal speaker
11538 * 0x18 = external mic
11541 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11542 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11543 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11545 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11546 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11547 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11549 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11550 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11554 static struct hda_verb alc262_nec_verbs[] = {
11555 /* Unmute Speaker */
11556 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11559 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11560 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11562 /* External mic to headphone */
11563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11564 /* External mic to speaker */
11565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11571 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11572 * 0x1b = port replicator headphone out
11575 #define ALC_HP_EVENT 0x37
11577 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11578 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11579 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11580 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11581 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11585 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11586 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11587 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11591 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11592 /* Front Mic pin: input vref at 50% */
11593 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11594 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11598 static struct hda_input_mux alc262_fujitsu_capture_source = {
11602 { "Int Mic", 0x1 },
11607 static struct hda_input_mux alc262_HP_capture_source = {
11611 { "Front Mic", 0x1 },
11618 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11622 { "Front Mic", 0x2 },
11628 /* mute/unmute internal speaker according to the hp jacks and mute state */
11629 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11631 struct alc_spec *spec = codec->spec;
11634 if (force || !spec->sense_updated) {
11635 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11636 snd_hda_jack_detect(codec, 0x1b);
11637 spec->sense_updated = 1;
11639 /* unmute internal speaker only if both HPs are unplugged and
11640 * master switch is on
11642 if (spec->jack_present)
11643 mute = HDA_AMP_MUTE;
11645 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11646 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11647 HDA_AMP_MUTE, mute);
11650 /* unsolicited event for HP jack sensing */
11651 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11654 if ((res >> 26) != ALC_HP_EVENT)
11656 alc262_fujitsu_automute(codec, 1);
11659 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11661 alc262_fujitsu_automute(codec, 1);
11664 /* bind volumes of both NID 0x0c and 0x0d */
11665 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11666 .ops = &snd_hda_bind_vol,
11668 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11669 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11674 /* mute/unmute internal speaker according to the hp jack and mute state */
11675 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11677 struct alc_spec *spec = codec->spec;
11680 if (force || !spec->sense_updated) {
11681 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11682 spec->sense_updated = 1;
11684 if (spec->jack_present) {
11685 /* mute internal speaker */
11686 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11687 HDA_AMP_MUTE, HDA_AMP_MUTE);
11688 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11689 HDA_AMP_MUTE, HDA_AMP_MUTE);
11691 /* unmute internal speaker if necessary */
11692 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11693 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11694 HDA_AMP_MUTE, mute);
11695 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11696 HDA_AMP_MUTE, mute);
11700 /* unsolicited event for HP jack sensing */
11701 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11704 if ((res >> 26) != ALC_HP_EVENT)
11706 alc262_lenovo_3000_automute(codec, 1);
11709 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11710 int dir, int idx, long *valp)
11714 for (i = 0; i < 2; i++, valp++)
11715 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11717 *valp ? 0 : HDA_AMP_MUTE);
11721 /* bind hp and internal speaker mute (with plug check) */
11722 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11723 struct snd_ctl_elem_value *ucontrol)
11725 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11726 long *valp = ucontrol->value.integer.value;
11729 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11730 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11732 alc262_fujitsu_automute(codec, 0);
11736 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11737 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11739 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11740 .name = "Master Playback Switch",
11741 .subdevice = HDA_SUBDEV_AMP_FLAG,
11742 .info = snd_hda_mixer_amp_switch_info,
11743 .get = snd_hda_mixer_amp_switch_get,
11744 .put = alc262_fujitsu_master_sw_put,
11745 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11748 .iface = NID_MAPPING,
11749 .name = "Master Playback Switch",
11750 .private_value = 0x1b,
11752 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11753 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11754 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11755 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11756 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11757 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11758 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11759 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11763 /* bind hp and internal speaker mute (with plug check) */
11764 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11765 struct snd_ctl_elem_value *ucontrol)
11767 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11768 long *valp = ucontrol->value.integer.value;
11771 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11773 alc262_lenovo_3000_automute(codec, 0);
11777 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11778 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11780 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11781 .name = "Master Playback Switch",
11782 .subdevice = HDA_SUBDEV_AMP_FLAG,
11783 .info = snd_hda_mixer_amp_switch_info,
11784 .get = snd_hda_mixer_amp_switch_get,
11785 .put = alc262_lenovo_3000_master_sw_put,
11786 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11788 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11789 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11790 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11791 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11792 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11793 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11794 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11795 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11799 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11800 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11801 ALC262_HIPPO_MASTER_SWITCH,
11802 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11804 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11805 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11806 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11807 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11811 /* additional init verbs for Benq laptops */
11812 static struct hda_verb alc262_EAPD_verbs[] = {
11813 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11814 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11818 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11819 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11820 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11822 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11823 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11827 /* Samsung Q1 Ultra Vista model setup */
11828 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11829 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11830 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11832 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11833 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11834 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11838 static struct hda_verb alc262_ultra_verbs[] = {
11840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11844 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11845 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11846 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11847 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11849 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11850 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11851 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11852 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11853 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11855 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11856 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11857 /* ADC, choose mic */
11858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11861 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11862 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11863 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11864 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11865 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11866 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11867 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11871 /* mute/unmute internal speaker according to the hp jack and mute state */
11872 static void alc262_ultra_automute(struct hda_codec *codec)
11874 struct alc_spec *spec = codec->spec;
11878 /* auto-mute only when HP is used as HP */
11879 if (!spec->cur_mux[0]) {
11880 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11881 if (spec->jack_present)
11882 mute = HDA_AMP_MUTE;
11884 /* mute/unmute internal speaker */
11885 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11886 HDA_AMP_MUTE, mute);
11887 /* mute/unmute HP */
11888 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11889 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11892 /* unsolicited event for HP jack sensing */
11893 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11896 if ((res >> 26) != ALC880_HP_EVENT)
11898 alc262_ultra_automute(codec);
11901 static struct hda_input_mux alc262_ultra_capture_source = {
11905 { "Headphone", 0x7 },
11909 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11910 struct snd_ctl_elem_value *ucontrol)
11912 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11913 struct alc_spec *spec = codec->spec;
11916 ret = alc_mux_enum_put(kcontrol, ucontrol);
11919 /* reprogram the HP pin as mic or HP according to the input source */
11920 snd_hda_codec_write_cache(codec, 0x15, 0,
11921 AC_VERB_SET_PIN_WIDGET_CONTROL,
11922 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11923 alc262_ultra_automute(codec); /* mute/unmute HP */
11927 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11928 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11929 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11931 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11932 .name = "Capture Source",
11933 .info = alc_mux_enum_info,
11934 .get = alc_mux_enum_get,
11935 .put = alc262_ultra_mux_enum_put,
11938 .iface = NID_MAPPING,
11939 .name = "Capture Source",
11940 .private_value = 0x15,
11945 /* We use two mixers depending on the output pin; 0x16 is a mono output
11946 * and thus it's bound with a different mixer.
11947 * This function returns which mixer amp should be used.
11949 static int alc262_check_volbit(hda_nid_t nid)
11953 else if (nid == 0x16)
11959 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11960 const char *pfx, int *vbits, int idx)
11965 vbit = alc262_check_volbit(nid);
11968 if (*vbits & vbit) /* a volume control for this mixer already there */
11972 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11974 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11975 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
11978 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11979 const char *pfx, int idx)
11986 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11988 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11989 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
11992 /* add playback controls from the parsed DAC table */
11993 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11994 const struct auto_pin_cfg *cfg)
12000 spec->multiout.num_dacs = 1; /* only use one dac */
12001 spec->multiout.dac_nids = spec->private_dac_nids;
12002 spec->multiout.dac_nids[0] = 2;
12004 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
12006 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12008 else if (cfg->line_out_type == AUTO_PIN_HP_OUT)
12012 for (i = 0; i < 2; i++) {
12013 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12016 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12017 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12022 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12023 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12030 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12031 alc262_check_volbit(cfg->speaker_pins[0]) |
12032 alc262_check_volbit(cfg->hp_pins[0]);
12033 if (vbits == 1 || vbits == 2)
12034 pfx = "Master"; /* only one mixer is used */
12036 for (i = 0; i < 2; i++) {
12037 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12041 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12042 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12043 "Speaker", &vbits, i);
12047 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12048 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12049 "Headphone", &vbits, i);
12057 #define alc262_auto_create_input_ctls \
12058 alc882_auto_create_input_ctls
12061 * generic initialization of ADC, input mixers and output mixers
12063 static struct hda_verb alc262_volume_init_verbs[] = {
12065 * Unmute ADC0-2 and set the default input to mic-in
12067 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12068 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12069 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12070 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12071 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12074 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12076 * Note: PASD motherboards uses the Line In 2 as the input for
12077 * front panel mic (mic 2)
12079 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12080 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12081 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12087 * Set up output mixers (0x0c - 0x0f)
12089 /* set vol=0 to output mixers */
12090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12091 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12092 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12094 /* set up input amps for analog loopback */
12095 /* Amp Indices: DAC = 0, mixer = 1 */
12096 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12098 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12099 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12100 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12101 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12103 /* FIXME: use matrix-type input source selection */
12104 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12105 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12106 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12107 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12108 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12109 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12111 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12112 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12113 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12114 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12124 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12126 * Unmute ADC0-2 and set the default input to mic-in
12128 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12130 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12131 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12132 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12133 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12135 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12137 * Note: PASD motherboards uses the Line In 2 as the input for
12138 * front panel mic (mic 2)
12140 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12141 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12142 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12143 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12144 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12145 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12146 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12147 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12150 * Set up output mixers (0x0c - 0x0e)
12152 /* set vol=0 to output mixers */
12153 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12154 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12155 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12157 /* set up input amps for analog loopback */
12158 /* Amp Indices: DAC = 0, mixer = 1 */
12159 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12160 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12161 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12162 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12163 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12164 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12166 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12167 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12168 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12170 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12171 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12173 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12174 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12177 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12178 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12179 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12180 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12182 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12183 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12184 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12185 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12186 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12187 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12190 /* FIXME: use matrix-type input source selection */
12191 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12192 /* Input mixer1: only unmute Mic */
12193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12200 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12201 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12203 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12204 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12205 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12206 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12207 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12208 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12209 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12210 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12213 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12214 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12220 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12221 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12223 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12228 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12230 * Unmute ADC0-2 and set the default input to mic-in
12232 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12234 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12236 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12239 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12241 * Note: PASD motherboards uses the Line In 2 as the input for front
12242 * panel mic (mic 2)
12244 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12254 * Set up output mixers (0x0c - 0x0e)
12256 /* set vol=0 to output mixers */
12257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12258 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12259 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12261 /* set up input amps for analog loopback */
12262 /* Amp Indices: DAC = 0, mixer = 1 */
12263 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12265 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12266 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12267 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12268 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12271 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12272 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12273 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12274 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12275 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12276 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12277 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12279 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12280 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12282 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12283 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12285 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12286 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12287 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12288 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12289 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12290 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12292 /* FIXME: use matrix-type input source selection */
12293 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12294 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12295 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12296 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12297 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12298 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12300 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12308 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12316 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12319 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12324 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12327 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12328 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12330 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12331 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12332 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12333 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12335 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12336 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12337 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12348 static const struct alc_fixup alc262_fixups[] = {
12349 [PINFIX_FSC_H270] = {
12350 .pins = (const struct alc_pincfg[]) {
12351 { 0x14, 0x99130110 }, /* speaker */
12352 { 0x15, 0x0221142f }, /* front HP */
12353 { 0x1b, 0x0121141f }, /* rear HP */
12357 [PINFIX_PB_M5210] = {
12358 .verbs = (const struct hda_verb[]) {
12359 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
12365 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12366 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12371 #ifdef CONFIG_SND_HDA_POWER_SAVE
12372 #define alc262_loopbacks alc880_loopbacks
12375 /* pcm configuration: identical with ALC880 */
12376 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12377 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12378 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12379 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12382 * BIOS auto configuration
12384 static int alc262_parse_auto_config(struct hda_codec *codec)
12386 struct alc_spec *spec = codec->spec;
12388 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12390 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12394 if (!spec->autocfg.line_outs) {
12395 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12396 spec->multiout.max_channels = 2;
12397 spec->no_analog = 1;
12400 return 0; /* can't find valid BIOS pin config */
12402 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12405 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12409 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12412 alc_auto_parse_digital(codec);
12414 if (spec->kctls.list)
12415 add_mixer(spec, spec->kctls.list);
12417 add_verb(spec, alc262_volume_init_verbs);
12418 spec->num_mux_defs = 1;
12419 spec->input_mux = &spec->private_imux[0];
12421 err = alc_auto_add_mic_boost(codec);
12425 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12430 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12431 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12432 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12433 #define alc262_auto_init_input_src alc882_auto_init_input_src
12436 /* init callback for auto-configuration model -- overriding the default init */
12437 static void alc262_auto_init(struct hda_codec *codec)
12439 struct alc_spec *spec = codec->spec;
12440 alc262_auto_init_multi_out(codec);
12441 alc262_auto_init_hp_out(codec);
12442 alc262_auto_init_analog_input(codec);
12443 alc262_auto_init_input_src(codec);
12444 alc_auto_init_digital(codec);
12445 if (spec->unsol_event)
12446 alc_inithook(codec);
12450 * configuration and preset
12452 static const char *alc262_models[ALC262_MODEL_LAST] = {
12453 [ALC262_BASIC] = "basic",
12454 [ALC262_HIPPO] = "hippo",
12455 [ALC262_HIPPO_1] = "hippo_1",
12456 [ALC262_FUJITSU] = "fujitsu",
12457 [ALC262_HP_BPC] = "hp-bpc",
12458 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12459 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12460 [ALC262_HP_RP5700] = "hp-rp5700",
12461 [ALC262_BENQ_ED8] = "benq",
12462 [ALC262_BENQ_T31] = "benq-t31",
12463 [ALC262_SONY_ASSAMD] = "sony-assamd",
12464 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12465 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12466 [ALC262_ULTRA] = "ultra",
12467 [ALC262_LENOVO_3000] = "lenovo-3000",
12468 [ALC262_NEC] = "nec",
12469 [ALC262_TYAN] = "tyan",
12470 [ALC262_AUTO] = "auto",
12473 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12474 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12475 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12476 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12478 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12480 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12482 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12483 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12484 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12485 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12486 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12487 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12488 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12489 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12490 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12491 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12492 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12493 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12494 ALC262_HP_TC_T5735),
12495 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12496 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12497 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12498 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12499 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12500 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12501 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12502 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12503 #if 0 /* disable the quirk since model=auto works better in recent versions */
12504 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12505 ALC262_SONY_ASSAMD),
12507 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12508 ALC262_TOSHIBA_RX1),
12509 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12510 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12511 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12512 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12513 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12515 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12516 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12517 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12518 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12519 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12523 static struct alc_config_preset alc262_presets[] = {
12525 .mixers = { alc262_base_mixer },
12526 .init_verbs = { alc262_init_verbs },
12527 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12528 .dac_nids = alc262_dac_nids,
12530 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12531 .channel_mode = alc262_modes,
12532 .input_mux = &alc262_capture_source,
12535 .mixers = { alc262_hippo_mixer },
12536 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12537 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12538 .dac_nids = alc262_dac_nids,
12540 .dig_out_nid = ALC262_DIGOUT_NID,
12541 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12542 .channel_mode = alc262_modes,
12543 .input_mux = &alc262_capture_source,
12544 .unsol_event = alc262_hippo_unsol_event,
12545 .setup = alc262_hippo_setup,
12546 .init_hook = alc262_hippo_automute,
12548 [ALC262_HIPPO_1] = {
12549 .mixers = { alc262_hippo1_mixer },
12550 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12551 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12552 .dac_nids = alc262_dac_nids,
12554 .dig_out_nid = ALC262_DIGOUT_NID,
12555 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12556 .channel_mode = alc262_modes,
12557 .input_mux = &alc262_capture_source,
12558 .unsol_event = alc262_hippo_unsol_event,
12559 .setup = alc262_hippo1_setup,
12560 .init_hook = alc262_hippo_automute,
12562 [ALC262_FUJITSU] = {
12563 .mixers = { alc262_fujitsu_mixer },
12564 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12565 alc262_fujitsu_unsol_verbs },
12566 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12567 .dac_nids = alc262_dac_nids,
12569 .dig_out_nid = ALC262_DIGOUT_NID,
12570 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12571 .channel_mode = alc262_modes,
12572 .input_mux = &alc262_fujitsu_capture_source,
12573 .unsol_event = alc262_fujitsu_unsol_event,
12574 .init_hook = alc262_fujitsu_init_hook,
12576 [ALC262_HP_BPC] = {
12577 .mixers = { alc262_HP_BPC_mixer },
12578 .init_verbs = { alc262_HP_BPC_init_verbs },
12579 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12580 .dac_nids = alc262_dac_nids,
12582 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12583 .channel_mode = alc262_modes,
12584 .input_mux = &alc262_HP_capture_source,
12585 .unsol_event = alc262_hp_bpc_unsol_event,
12586 .init_hook = alc262_hp_bpc_automute,
12588 [ALC262_HP_BPC_D7000_WF] = {
12589 .mixers = { alc262_HP_BPC_WildWest_mixer },
12590 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12591 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12592 .dac_nids = alc262_dac_nids,
12594 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12595 .channel_mode = alc262_modes,
12596 .input_mux = &alc262_HP_D7000_capture_source,
12597 .unsol_event = alc262_hp_wildwest_unsol_event,
12598 .init_hook = alc262_hp_wildwest_automute,
12600 [ALC262_HP_BPC_D7000_WL] = {
12601 .mixers = { alc262_HP_BPC_WildWest_mixer,
12602 alc262_HP_BPC_WildWest_option_mixer },
12603 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12604 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12605 .dac_nids = alc262_dac_nids,
12607 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12608 .channel_mode = alc262_modes,
12609 .input_mux = &alc262_HP_D7000_capture_source,
12610 .unsol_event = alc262_hp_wildwest_unsol_event,
12611 .init_hook = alc262_hp_wildwest_automute,
12613 [ALC262_HP_TC_T5735] = {
12614 .mixers = { alc262_hp_t5735_mixer },
12615 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12616 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12617 .dac_nids = alc262_dac_nids,
12619 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12620 .channel_mode = alc262_modes,
12621 .input_mux = &alc262_capture_source,
12622 .unsol_event = alc_sku_unsol_event,
12623 .setup = alc262_hp_t5735_setup,
12624 .init_hook = alc_inithook,
12626 [ALC262_HP_RP5700] = {
12627 .mixers = { alc262_hp_rp5700_mixer },
12628 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12629 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12630 .dac_nids = alc262_dac_nids,
12631 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12632 .channel_mode = alc262_modes,
12633 .input_mux = &alc262_hp_rp5700_capture_source,
12635 [ALC262_BENQ_ED8] = {
12636 .mixers = { alc262_base_mixer },
12637 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12638 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12639 .dac_nids = alc262_dac_nids,
12641 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12642 .channel_mode = alc262_modes,
12643 .input_mux = &alc262_capture_source,
12645 [ALC262_SONY_ASSAMD] = {
12646 .mixers = { alc262_sony_mixer },
12647 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12648 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12649 .dac_nids = alc262_dac_nids,
12651 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12652 .channel_mode = alc262_modes,
12653 .input_mux = &alc262_capture_source,
12654 .unsol_event = alc262_hippo_unsol_event,
12655 .setup = alc262_hippo_setup,
12656 .init_hook = alc262_hippo_automute,
12658 [ALC262_BENQ_T31] = {
12659 .mixers = { alc262_benq_t31_mixer },
12660 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12661 alc_hp15_unsol_verbs },
12662 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12663 .dac_nids = alc262_dac_nids,
12665 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12666 .channel_mode = alc262_modes,
12667 .input_mux = &alc262_capture_source,
12668 .unsol_event = alc262_hippo_unsol_event,
12669 .setup = alc262_hippo_setup,
12670 .init_hook = alc262_hippo_automute,
12673 .mixers = { alc262_ultra_mixer },
12674 .cap_mixer = alc262_ultra_capture_mixer,
12675 .init_verbs = { alc262_ultra_verbs },
12676 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12677 .dac_nids = alc262_dac_nids,
12678 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12679 .channel_mode = alc262_modes,
12680 .input_mux = &alc262_ultra_capture_source,
12681 .adc_nids = alc262_adc_nids, /* ADC0 */
12682 .capsrc_nids = alc262_capsrc_nids,
12683 .num_adc_nids = 1, /* single ADC */
12684 .unsol_event = alc262_ultra_unsol_event,
12685 .init_hook = alc262_ultra_automute,
12687 [ALC262_LENOVO_3000] = {
12688 .mixers = { alc262_lenovo_3000_mixer },
12689 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12690 alc262_lenovo_3000_unsol_verbs,
12691 alc262_lenovo_3000_init_verbs },
12692 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12693 .dac_nids = alc262_dac_nids,
12695 .dig_out_nid = ALC262_DIGOUT_NID,
12696 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12697 .channel_mode = alc262_modes,
12698 .input_mux = &alc262_fujitsu_capture_source,
12699 .unsol_event = alc262_lenovo_3000_unsol_event,
12702 .mixers = { alc262_nec_mixer },
12703 .init_verbs = { alc262_nec_verbs },
12704 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12705 .dac_nids = alc262_dac_nids,
12707 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12708 .channel_mode = alc262_modes,
12709 .input_mux = &alc262_capture_source,
12711 [ALC262_TOSHIBA_S06] = {
12712 .mixers = { alc262_toshiba_s06_mixer },
12713 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12714 alc262_eapd_verbs },
12715 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12716 .capsrc_nids = alc262_dmic_capsrc_nids,
12717 .dac_nids = alc262_dac_nids,
12718 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12719 .num_adc_nids = 1, /* single ADC */
12720 .dig_out_nid = ALC262_DIGOUT_NID,
12721 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12722 .channel_mode = alc262_modes,
12723 .unsol_event = alc_sku_unsol_event,
12724 .setup = alc262_toshiba_s06_setup,
12725 .init_hook = alc_inithook,
12727 [ALC262_TOSHIBA_RX1] = {
12728 .mixers = { alc262_toshiba_rx1_mixer },
12729 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12730 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12731 .dac_nids = alc262_dac_nids,
12733 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12734 .channel_mode = alc262_modes,
12735 .input_mux = &alc262_capture_source,
12736 .unsol_event = alc262_hippo_unsol_event,
12737 .setup = alc262_hippo_setup,
12738 .init_hook = alc262_hippo_automute,
12741 .mixers = { alc262_tyan_mixer },
12742 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12743 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12744 .dac_nids = alc262_dac_nids,
12746 .dig_out_nid = ALC262_DIGOUT_NID,
12747 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12748 .channel_mode = alc262_modes,
12749 .input_mux = &alc262_capture_source,
12750 .unsol_event = alc_automute_amp_unsol_event,
12751 .setup = alc262_tyan_setup,
12752 .init_hook = alc_automute_amp,
12756 static int patch_alc262(struct hda_codec *codec)
12758 struct alc_spec *spec;
12762 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12766 codec->spec = spec;
12768 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12773 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12774 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12775 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12776 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12779 alc_auto_parse_customize_define(codec);
12781 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12783 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12787 if (board_config < 0) {
12788 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12790 board_config = ALC262_AUTO;
12793 if (board_config == ALC262_AUTO)
12794 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1);
12796 if (board_config == ALC262_AUTO) {
12797 /* automatic parse from the BIOS config */
12798 err = alc262_parse_auto_config(codec);
12804 "hda_codec: Cannot set up configuration "
12805 "from BIOS. Using base mode...\n");
12806 board_config = ALC262_BASIC;
12810 if (!spec->no_analog && has_cdefine_beep(codec)) {
12811 err = snd_hda_attach_beep_device(codec, 0x1);
12818 if (board_config != ALC262_AUTO)
12819 setup_preset(codec, &alc262_presets[board_config]);
12821 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12822 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12824 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12825 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12827 if (!spec->adc_nids && spec->input_mux) {
12829 /* check whether the digital-mic has to be supported */
12830 for (i = 0; i < spec->input_mux->num_items; i++) {
12831 if (spec->input_mux->items[i].index >= 9)
12834 if (i < spec->input_mux->num_items) {
12835 /* use only ADC0 */
12836 spec->adc_nids = alc262_dmic_adc_nids;
12837 spec->num_adc_nids = 1;
12838 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12840 /* all analog inputs */
12841 /* check whether NID 0x07 is valid */
12842 unsigned int wcap = get_wcaps(codec, 0x07);
12845 wcap = get_wcaps_type(wcap);
12846 if (wcap != AC_WID_AUD_IN) {
12847 spec->adc_nids = alc262_adc_nids_alt;
12848 spec->num_adc_nids =
12849 ARRAY_SIZE(alc262_adc_nids_alt);
12850 spec->capsrc_nids = alc262_capsrc_nids_alt;
12852 spec->adc_nids = alc262_adc_nids;
12853 spec->num_adc_nids =
12854 ARRAY_SIZE(alc262_adc_nids);
12855 spec->capsrc_nids = alc262_capsrc_nids;
12859 if (!spec->cap_mixer && !spec->no_analog)
12860 set_capture_mixer(codec);
12861 if (!spec->no_analog && has_cdefine_beep(codec))
12862 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12864 if (board_config == ALC262_AUTO)
12865 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
12867 spec->vmaster_nid = 0x0c;
12869 codec->patch_ops = alc_patch_ops;
12870 if (board_config == ALC262_AUTO)
12871 spec->init_hook = alc262_auto_init;
12872 #ifdef CONFIG_SND_HDA_POWER_SAVE
12873 if (!spec->loopback.amplist)
12874 spec->loopback.amplist = alc262_loopbacks;
12881 * ALC268 channel source setting (2 channel)
12883 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12884 #define alc268_modes alc260_modes
12886 static hda_nid_t alc268_dac_nids[2] = {
12891 static hda_nid_t alc268_adc_nids[2] = {
12896 static hda_nid_t alc268_adc_nids_alt[1] = {
12901 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12903 static struct snd_kcontrol_new alc268_base_mixer[] = {
12904 /* output mixer control */
12905 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12906 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12907 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12908 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12909 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12910 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12911 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12915 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12916 /* output mixer control */
12917 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12918 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12919 ALC262_HIPPO_MASTER_SWITCH,
12920 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12921 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12922 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12926 /* bind Beep switches of both NID 0x0f and 0x10 */
12927 static struct hda_bind_ctls alc268_bind_beep_sw = {
12928 .ops = &snd_hda_bind_sw,
12930 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12931 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12936 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12937 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12938 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12942 static struct hda_verb alc268_eapd_verbs[] = {
12943 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12944 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12948 /* Toshiba specific */
12949 static struct hda_verb alc268_toshiba_verbs[] = {
12950 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12954 /* Acer specific */
12955 /* bind volumes of both NID 0x02 and 0x03 */
12956 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12957 .ops = &snd_hda_bind_vol,
12959 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12960 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12965 /* mute/unmute internal speaker according to the hp jack and mute state */
12966 static void alc268_acer_automute(struct hda_codec *codec, int force)
12968 struct alc_spec *spec = codec->spec;
12971 if (force || !spec->sense_updated) {
12972 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12973 spec->sense_updated = 1;
12975 if (spec->jack_present)
12976 mute = HDA_AMP_MUTE; /* mute internal speaker */
12977 else /* unmute internal speaker if necessary */
12978 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12979 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12980 HDA_AMP_MUTE, mute);
12984 /* bind hp and internal speaker mute (with plug check) */
12985 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12986 struct snd_ctl_elem_value *ucontrol)
12988 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12989 long *valp = ucontrol->value.integer.value;
12992 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12994 alc268_acer_automute(codec, 0);
12998 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12999 /* output mixer control */
13000 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13002 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13003 .name = "Master Playback Switch",
13004 .subdevice = HDA_SUBDEV_AMP_FLAG,
13005 .info = snd_hda_mixer_amp_switch_info,
13006 .get = snd_hda_mixer_amp_switch_get,
13007 .put = alc268_acer_master_sw_put,
13008 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13010 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13014 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13015 /* output mixer control */
13016 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13018 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13019 .name = "Master Playback Switch",
13020 .subdevice = HDA_SUBDEV_AMP_FLAG,
13021 .info = snd_hda_mixer_amp_switch_info,
13022 .get = snd_hda_mixer_amp_switch_get,
13023 .put = alc268_acer_master_sw_put,
13024 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13026 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13027 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13028 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13032 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13033 /* output mixer control */
13034 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13036 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13037 .name = "Master Playback Switch",
13038 .subdevice = HDA_SUBDEV_AMP_FLAG,
13039 .info = snd_hda_mixer_amp_switch_info,
13040 .get = snd_hda_mixer_amp_switch_get,
13041 .put = alc268_acer_master_sw_put,
13042 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13044 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13045 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13049 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13050 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13051 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13052 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13053 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13054 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13055 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13059 static struct hda_verb alc268_acer_verbs[] = {
13060 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13061 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13062 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13063 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13064 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13066 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13070 /* unsolicited event for HP jack sensing */
13071 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13072 #define alc268_toshiba_setup alc262_hippo_setup
13073 #define alc268_toshiba_automute alc262_hippo_automute
13075 static void alc268_acer_unsol_event(struct hda_codec *codec,
13078 if ((res >> 26) != ALC880_HP_EVENT)
13080 alc268_acer_automute(codec, 1);
13083 static void alc268_acer_init_hook(struct hda_codec *codec)
13085 alc268_acer_automute(codec, 1);
13088 /* toggle speaker-output according to the hp-jack state */
13089 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13091 unsigned int present;
13092 unsigned char bits;
13094 present = snd_hda_jack_detect(codec, 0x15);
13095 bits = present ? HDA_AMP_MUTE : 0;
13096 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13097 HDA_AMP_MUTE, bits);
13098 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13099 HDA_AMP_MUTE, bits);
13102 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13105 switch (res >> 26) {
13106 case ALC880_HP_EVENT:
13107 alc268_aspire_one_speaker_automute(codec);
13109 case ALC880_MIC_EVENT:
13110 alc_mic_automute(codec);
13115 static void alc268_acer_lc_setup(struct hda_codec *codec)
13117 struct alc_spec *spec = codec->spec;
13118 spec->ext_mic.pin = 0x18;
13119 spec->ext_mic.mux_idx = 0;
13120 spec->int_mic.pin = 0x12;
13121 spec->int_mic.mux_idx = 6;
13122 spec->auto_mic = 1;
13125 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13127 alc268_aspire_one_speaker_automute(codec);
13128 alc_mic_automute(codec);
13131 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13132 /* output mixer control */
13133 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13134 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13135 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13136 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13137 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13138 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13142 static struct hda_verb alc268_dell_verbs[] = {
13143 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13144 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13145 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13146 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13150 /* mute/unmute internal speaker according to the hp jack and mute state */
13151 static void alc268_dell_setup(struct hda_codec *codec)
13153 struct alc_spec *spec = codec->spec;
13155 spec->autocfg.hp_pins[0] = 0x15;
13156 spec->autocfg.speaker_pins[0] = 0x14;
13157 spec->ext_mic.pin = 0x18;
13158 spec->ext_mic.mux_idx = 0;
13159 spec->int_mic.pin = 0x19;
13160 spec->int_mic.mux_idx = 1;
13161 spec->auto_mic = 1;
13164 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13165 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13166 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13167 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13169 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13170 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13171 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13172 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13176 static struct hda_verb alc267_quanta_il1_verbs[] = {
13177 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13178 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13182 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13184 struct alc_spec *spec = codec->spec;
13185 spec->autocfg.hp_pins[0] = 0x15;
13186 spec->autocfg.speaker_pins[0] = 0x14;
13187 spec->ext_mic.pin = 0x18;
13188 spec->ext_mic.mux_idx = 0;
13189 spec->int_mic.pin = 0x19;
13190 spec->int_mic.mux_idx = 1;
13191 spec->auto_mic = 1;
13195 * generic initialization of ADC, input mixers and output mixers
13197 static struct hda_verb alc268_base_init_verbs[] = {
13198 /* Unmute DAC0-1 and set vol = 0 */
13199 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13200 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13203 * Set up output mixers (0x0c - 0x0e)
13205 /* set vol=0 to output mixers */
13206 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13207 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13209 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13210 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13212 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13213 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13214 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13215 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13216 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13217 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13218 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13219 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13222 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13223 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13224 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13225 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13227 /* set PCBEEP vol = 0, mute connections */
13228 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13229 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13230 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13232 /* Unmute Selector 23h,24h and set the default input to mic-in */
13234 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13235 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13236 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13237 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13243 * generic initialization of ADC, input mixers and output mixers
13245 static struct hda_verb alc268_volume_init_verbs[] = {
13246 /* set output DAC */
13247 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13248 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13250 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13251 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13252 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13253 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13254 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13256 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13257 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13258 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13260 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13261 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13263 /* set PCBEEP vol = 0, mute connections */
13264 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13265 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13266 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13271 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13272 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13273 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13277 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13278 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13279 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13284 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13285 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13286 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13287 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13288 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13293 static struct hda_input_mux alc268_capture_source = {
13297 { "Front Mic", 0x1 },
13303 static struct hda_input_mux alc268_acer_capture_source = {
13307 { "Internal Mic", 0x1 },
13312 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13316 { "Internal Mic", 0x6 },
13321 #ifdef CONFIG_SND_DEBUG
13322 static struct snd_kcontrol_new alc268_test_mixer[] = {
13323 /* Volume widgets */
13324 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13325 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13326 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13327 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13328 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13329 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13330 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13331 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13332 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13333 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13334 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13335 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13336 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13337 /* The below appears problematic on some hardwares */
13338 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13339 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13340 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13341 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13342 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13344 /* Modes for retasking pin widgets */
13345 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13346 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13347 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13348 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13350 /* Controls for GPIO pins, assuming they are configured as outputs */
13351 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13352 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13353 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13354 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13356 /* Switches to allow the digital SPDIF output pin to be enabled.
13357 * The ALC268 does not have an SPDIF input.
13359 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13361 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13362 * this output to turn on an external amplifier.
13364 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13365 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13371 /* create input playback/capture controls for the given pin */
13372 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13373 const char *ctlname, int idx)
13384 case 0x1a: /* ALC259/269 only */
13385 case 0x1b: /* ALC259/269 only */
13386 case 0x21: /* ALC269vb has this pin, too */
13390 snd_printd(KERN_WARNING "hda_codec: "
13391 "ignoring pin 0x%x as unknown\n", nid);
13394 if (spec->multiout.dac_nids[0] != dac &&
13395 spec->multiout.dac_nids[1] != dac) {
13396 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13397 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13401 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13405 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13406 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13408 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13409 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13415 /* add playback controls from the parsed DAC table */
13416 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13417 const struct auto_pin_cfg *cfg)
13422 spec->multiout.dac_nids = spec->private_dac_nids;
13424 nid = cfg->line_out_pins[0];
13427 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13431 err = alc268_new_analog_output(spec, nid, name, 0);
13436 nid = cfg->speaker_pins[0];
13438 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13439 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13443 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13447 nid = cfg->hp_pins[0];
13449 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13454 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13456 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13457 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13464 /* create playback/capture controls for input pins */
13465 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13466 const struct auto_pin_cfg *cfg)
13468 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13471 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13472 hda_nid_t nid, int pin_type)
13476 alc_set_pin_output(codec, nid, pin_type);
13477 if (nid == 0x14 || nid == 0x16)
13481 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13484 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13486 struct alc_spec *spec = codec->spec;
13489 for (i = 0; i < spec->autocfg.line_outs; i++) {
13490 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13491 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13492 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13496 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13498 struct alc_spec *spec = codec->spec;
13502 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13503 pin = spec->autocfg.hp_pins[i];
13504 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13506 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13507 pin = spec->autocfg.speaker_pins[i];
13508 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13510 if (spec->autocfg.mono_out_pin)
13511 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13512 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13515 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13517 struct alc_spec *spec = codec->spec;
13518 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13519 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13520 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13521 unsigned int dac_vol1, dac_vol2;
13523 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13524 snd_hda_codec_write(codec, speaker_nid, 0,
13525 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13526 /* mute mixer inputs from 0x1d */
13527 snd_hda_codec_write(codec, 0x0f, 0,
13528 AC_VERB_SET_AMP_GAIN_MUTE,
13530 snd_hda_codec_write(codec, 0x10, 0,
13531 AC_VERB_SET_AMP_GAIN_MUTE,
13534 /* unmute mixer inputs from 0x1d */
13535 snd_hda_codec_write(codec, 0x0f, 0,
13536 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13537 snd_hda_codec_write(codec, 0x10, 0,
13538 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13541 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13542 if (line_nid == 0x14)
13543 dac_vol2 = AMP_OUT_ZERO;
13544 else if (line_nid == 0x15)
13545 dac_vol1 = AMP_OUT_ZERO;
13546 if (hp_nid == 0x14)
13547 dac_vol2 = AMP_OUT_ZERO;
13548 else if (hp_nid == 0x15)
13549 dac_vol1 = AMP_OUT_ZERO;
13550 if (line_nid != 0x16 || hp_nid != 0x16 ||
13551 spec->autocfg.line_out_pins[1] != 0x16 ||
13552 spec->autocfg.line_out_pins[2] != 0x16)
13553 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13555 snd_hda_codec_write(codec, 0x02, 0,
13556 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13557 snd_hda_codec_write(codec, 0x03, 0,
13558 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13561 /* pcm configuration: identical with ALC880 */
13562 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13563 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13564 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13565 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13568 * BIOS auto configuration
13570 static int alc268_parse_auto_config(struct hda_codec *codec)
13572 struct alc_spec *spec = codec->spec;
13574 static hda_nid_t alc268_ignore[] = { 0 };
13576 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13580 if (!spec->autocfg.line_outs) {
13581 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13582 spec->multiout.max_channels = 2;
13583 spec->no_analog = 1;
13586 return 0; /* can't find valid BIOS pin config */
13588 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13591 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13595 spec->multiout.max_channels = 2;
13598 /* digital only support output */
13599 alc_auto_parse_digital(codec);
13600 if (spec->kctls.list)
13601 add_mixer(spec, spec->kctls.list);
13603 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13604 add_mixer(spec, alc268_beep_mixer);
13606 add_verb(spec, alc268_volume_init_verbs);
13607 spec->num_mux_defs = 2;
13608 spec->input_mux = &spec->private_imux[0];
13610 err = alc_auto_add_mic_boost(codec);
13614 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13619 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13621 /* init callback for auto-configuration model -- overriding the default init */
13622 static void alc268_auto_init(struct hda_codec *codec)
13624 struct alc_spec *spec = codec->spec;
13625 alc268_auto_init_multi_out(codec);
13626 alc268_auto_init_hp_out(codec);
13627 alc268_auto_init_mono_speaker_out(codec);
13628 alc268_auto_init_analog_input(codec);
13629 alc_auto_init_digital(codec);
13630 if (spec->unsol_event)
13631 alc_inithook(codec);
13635 * configuration and preset
13637 static const char *alc268_models[ALC268_MODEL_LAST] = {
13638 [ALC267_QUANTA_IL1] = "quanta-il1",
13639 [ALC268_3ST] = "3stack",
13640 [ALC268_TOSHIBA] = "toshiba",
13641 [ALC268_ACER] = "acer",
13642 [ALC268_ACER_DMIC] = "acer-dmic",
13643 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13644 [ALC268_DELL] = "dell",
13645 [ALC268_ZEPTO] = "zepto",
13646 #ifdef CONFIG_SND_DEBUG
13647 [ALC268_TEST] = "test",
13649 [ALC268_AUTO] = "auto",
13652 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13653 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13654 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13655 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13656 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13657 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13658 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13659 ALC268_ACER_ASPIRE_ONE),
13660 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13661 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13662 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13663 /* almost compatible with toshiba but with optional digital outs;
13664 * auto-probing seems working fine
13666 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13668 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13669 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13670 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13671 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13672 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13676 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13677 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13678 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13679 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13680 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13685 static struct alc_config_preset alc268_presets[] = {
13686 [ALC267_QUANTA_IL1] = {
13687 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13688 alc268_capture_nosrc_mixer },
13689 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13690 alc267_quanta_il1_verbs },
13691 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13692 .dac_nids = alc268_dac_nids,
13693 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13694 .adc_nids = alc268_adc_nids_alt,
13696 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13697 .channel_mode = alc268_modes,
13698 .unsol_event = alc_sku_unsol_event,
13699 .setup = alc267_quanta_il1_setup,
13700 .init_hook = alc_inithook,
13703 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13704 alc268_beep_mixer },
13705 .init_verbs = { alc268_base_init_verbs },
13706 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13707 .dac_nids = alc268_dac_nids,
13708 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13709 .adc_nids = alc268_adc_nids_alt,
13710 .capsrc_nids = alc268_capsrc_nids,
13712 .dig_out_nid = ALC268_DIGOUT_NID,
13713 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13714 .channel_mode = alc268_modes,
13715 .input_mux = &alc268_capture_source,
13717 [ALC268_TOSHIBA] = {
13718 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13719 alc268_beep_mixer },
13720 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13721 alc268_toshiba_verbs },
13722 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13723 .dac_nids = alc268_dac_nids,
13724 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13725 .adc_nids = alc268_adc_nids_alt,
13726 .capsrc_nids = alc268_capsrc_nids,
13728 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13729 .channel_mode = alc268_modes,
13730 .input_mux = &alc268_capture_source,
13731 .unsol_event = alc268_toshiba_unsol_event,
13732 .setup = alc268_toshiba_setup,
13733 .init_hook = alc268_toshiba_automute,
13736 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13737 alc268_beep_mixer },
13738 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13739 alc268_acer_verbs },
13740 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13741 .dac_nids = alc268_dac_nids,
13742 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13743 .adc_nids = alc268_adc_nids_alt,
13744 .capsrc_nids = alc268_capsrc_nids,
13746 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13747 .channel_mode = alc268_modes,
13748 .input_mux = &alc268_acer_capture_source,
13749 .unsol_event = alc268_acer_unsol_event,
13750 .init_hook = alc268_acer_init_hook,
13752 [ALC268_ACER_DMIC] = {
13753 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13754 alc268_beep_mixer },
13755 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13756 alc268_acer_verbs },
13757 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13758 .dac_nids = alc268_dac_nids,
13759 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13760 .adc_nids = alc268_adc_nids_alt,
13761 .capsrc_nids = alc268_capsrc_nids,
13763 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13764 .channel_mode = alc268_modes,
13765 .input_mux = &alc268_acer_dmic_capture_source,
13766 .unsol_event = alc268_acer_unsol_event,
13767 .init_hook = alc268_acer_init_hook,
13769 [ALC268_ACER_ASPIRE_ONE] = {
13770 .mixers = { alc268_acer_aspire_one_mixer,
13772 alc268_capture_nosrc_mixer },
13773 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13774 alc268_acer_aspire_one_verbs },
13775 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13776 .dac_nids = alc268_dac_nids,
13777 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13778 .adc_nids = alc268_adc_nids_alt,
13779 .capsrc_nids = alc268_capsrc_nids,
13781 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13782 .channel_mode = alc268_modes,
13783 .unsol_event = alc268_acer_lc_unsol_event,
13784 .setup = alc268_acer_lc_setup,
13785 .init_hook = alc268_acer_lc_init_hook,
13788 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13789 alc268_capture_nosrc_mixer },
13790 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13791 alc268_dell_verbs },
13792 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13793 .dac_nids = alc268_dac_nids,
13794 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13795 .adc_nids = alc268_adc_nids_alt,
13796 .capsrc_nids = alc268_capsrc_nids,
13798 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13799 .channel_mode = alc268_modes,
13800 .unsol_event = alc_sku_unsol_event,
13801 .setup = alc268_dell_setup,
13802 .init_hook = alc_inithook,
13805 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13806 alc268_beep_mixer },
13807 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13808 alc268_toshiba_verbs },
13809 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13810 .dac_nids = alc268_dac_nids,
13811 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13812 .adc_nids = alc268_adc_nids_alt,
13813 .capsrc_nids = alc268_capsrc_nids,
13815 .dig_out_nid = ALC268_DIGOUT_NID,
13816 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13817 .channel_mode = alc268_modes,
13818 .input_mux = &alc268_capture_source,
13819 .setup = alc268_toshiba_setup,
13820 .init_hook = alc268_toshiba_automute,
13822 #ifdef CONFIG_SND_DEBUG
13824 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13825 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13826 alc268_volume_init_verbs },
13827 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13828 .dac_nids = alc268_dac_nids,
13829 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13830 .adc_nids = alc268_adc_nids_alt,
13831 .capsrc_nids = alc268_capsrc_nids,
13833 .dig_out_nid = ALC268_DIGOUT_NID,
13834 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13835 .channel_mode = alc268_modes,
13836 .input_mux = &alc268_capture_source,
13841 static int patch_alc268(struct hda_codec *codec)
13843 struct alc_spec *spec;
13845 int i, has_beep, err;
13847 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13851 codec->spec = spec;
13853 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13857 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13858 board_config = snd_hda_check_board_codec_sid_config(codec,
13859 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13861 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13862 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13864 board_config = ALC268_AUTO;
13867 if (board_config == ALC268_AUTO) {
13868 /* automatic parse from the BIOS config */
13869 err = alc268_parse_auto_config(codec);
13875 "hda_codec: Cannot set up configuration "
13876 "from BIOS. Using base mode...\n");
13877 board_config = ALC268_3ST;
13881 if (board_config != ALC268_AUTO)
13882 setup_preset(codec, &alc268_presets[board_config]);
13884 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13885 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13886 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13888 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13891 for (i = 0; i < spec->num_mixers; i++) {
13892 if (spec->mixers[i] == alc268_beep_mixer) {
13899 err = snd_hda_attach_beep_device(codec, 0x1);
13904 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13905 /* override the amp caps for beep generator */
13906 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13907 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13908 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13909 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13910 (0 << AC_AMPCAP_MUTE_SHIFT));
13913 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13914 /* check whether NID 0x07 is valid */
13915 unsigned int wcap = get_wcaps(codec, 0x07);
13918 spec->capsrc_nids = alc268_capsrc_nids;
13920 wcap = get_wcaps_type(wcap);
13921 if (spec->auto_mic ||
13922 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13923 spec->adc_nids = alc268_adc_nids_alt;
13924 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13925 if (spec->auto_mic)
13926 fixup_automic_adc(codec);
13927 if (spec->auto_mic || spec->input_mux->num_items == 1)
13928 add_mixer(spec, alc268_capture_nosrc_mixer);
13930 add_mixer(spec, alc268_capture_alt_mixer);
13932 spec->adc_nids = alc268_adc_nids;
13933 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13934 add_mixer(spec, alc268_capture_mixer);
13936 /* set default input source */
13937 for (i = 0; i < spec->num_adc_nids; i++)
13938 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13939 0, AC_VERB_SET_CONNECT_SEL,
13940 i < spec->num_mux_defs ?
13941 spec->input_mux[i].items[0].index :
13942 spec->input_mux->items[0].index);
13945 spec->vmaster_nid = 0x02;
13947 codec->patch_ops = alc_patch_ops;
13948 if (board_config == ALC268_AUTO)
13949 spec->init_hook = alc268_auto_init;
13955 * ALC269 channel source setting (2 channel)
13957 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13959 #define alc269_dac_nids alc260_dac_nids
13961 static hda_nid_t alc269_adc_nids[1] = {
13966 static hda_nid_t alc269_capsrc_nids[1] = {
13970 static hda_nid_t alc269vb_adc_nids[1] = {
13975 static hda_nid_t alc269vb_capsrc_nids[1] = {
13979 static hda_nid_t alc269_adc_candidates[] = {
13983 #define alc269_modes alc260_modes
13984 #define alc269_capture_source alc880_lg_lw_capture_source
13986 static struct snd_kcontrol_new alc269_base_mixer[] = {
13987 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13988 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13989 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13990 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13991 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13992 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13993 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13994 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13995 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13996 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13998 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14002 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14003 /* output mixer control */
14004 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14006 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14007 .name = "Master Playback Switch",
14008 .subdevice = HDA_SUBDEV_AMP_FLAG,
14009 .info = snd_hda_mixer_amp_switch_info,
14010 .get = snd_hda_mixer_amp_switch_get,
14011 .put = alc268_acer_master_sw_put,
14012 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14015 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14016 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14017 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14018 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14019 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
14023 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14024 /* output mixer control */
14025 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14027 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14028 .name = "Master Playback Switch",
14029 .subdevice = HDA_SUBDEV_AMP_FLAG,
14030 .info = snd_hda_mixer_amp_switch_info,
14031 .get = snd_hda_mixer_amp_switch_get,
14032 .put = alc268_acer_master_sw_put,
14033 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14035 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14036 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14037 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14038 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14039 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14040 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
14041 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14042 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14043 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
14047 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14048 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14049 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14050 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14051 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14055 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14056 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14057 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14058 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14059 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14063 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14064 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14065 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14069 /* capture mixer elements */
14070 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14071 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14072 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14073 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14074 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
14078 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14079 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14080 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14081 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14085 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14086 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14087 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14088 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14089 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
14093 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14094 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14095 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14096 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14101 #define alc269_fujitsu_mixer alc269_laptop_mixer
14103 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14104 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14105 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14106 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14107 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14108 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14109 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14113 static struct hda_verb alc269_lifebook_verbs[] = {
14114 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14115 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14116 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14117 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14118 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14119 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14120 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14121 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14122 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14123 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14127 /* toggle speaker-output according to the hp-jack state */
14128 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14130 unsigned int present;
14131 unsigned char bits;
14133 present = snd_hda_jack_detect(codec, 0x15);
14134 bits = present ? HDA_AMP_MUTE : 0;
14135 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14136 HDA_AMP_MUTE, bits);
14137 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14138 HDA_AMP_MUTE, bits);
14140 snd_hda_codec_write(codec, 0x20, 0,
14141 AC_VERB_SET_COEF_INDEX, 0x0c);
14142 snd_hda_codec_write(codec, 0x20, 0,
14143 AC_VERB_SET_PROC_COEF, 0x680);
14145 snd_hda_codec_write(codec, 0x20, 0,
14146 AC_VERB_SET_COEF_INDEX, 0x0c);
14147 snd_hda_codec_write(codec, 0x20, 0,
14148 AC_VERB_SET_PROC_COEF, 0x480);
14151 /* toggle speaker-output according to the hp-jacks state */
14152 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14154 unsigned int present;
14155 unsigned char bits;
14157 /* Check laptop headphone socket */
14158 present = snd_hda_jack_detect(codec, 0x15);
14160 /* Check port replicator headphone socket */
14161 present |= snd_hda_jack_detect(codec, 0x1a);
14163 bits = present ? HDA_AMP_MUTE : 0;
14164 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14165 HDA_AMP_MUTE, bits);
14166 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14167 HDA_AMP_MUTE, bits);
14169 snd_hda_codec_write(codec, 0x20, 0,
14170 AC_VERB_SET_COEF_INDEX, 0x0c);
14171 snd_hda_codec_write(codec, 0x20, 0,
14172 AC_VERB_SET_PROC_COEF, 0x680);
14174 snd_hda_codec_write(codec, 0x20, 0,
14175 AC_VERB_SET_COEF_INDEX, 0x0c);
14176 snd_hda_codec_write(codec, 0x20, 0,
14177 AC_VERB_SET_PROC_COEF, 0x480);
14180 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14182 unsigned int present_laptop;
14183 unsigned int present_dock;
14185 present_laptop = snd_hda_jack_detect(codec, 0x18);
14186 present_dock = snd_hda_jack_detect(codec, 0x1b);
14188 /* Laptop mic port overrides dock mic port, design decision */
14190 snd_hda_codec_write(codec, 0x23, 0,
14191 AC_VERB_SET_CONNECT_SEL, 0x3);
14192 if (present_laptop)
14193 snd_hda_codec_write(codec, 0x23, 0,
14194 AC_VERB_SET_CONNECT_SEL, 0x0);
14195 if (!present_dock && !present_laptop)
14196 snd_hda_codec_write(codec, 0x23, 0,
14197 AC_VERB_SET_CONNECT_SEL, 0x1);
14200 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14203 switch (res >> 26) {
14204 case ALC880_HP_EVENT:
14205 alc269_quanta_fl1_speaker_automute(codec);
14207 case ALC880_MIC_EVENT:
14208 alc_mic_automute(codec);
14213 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14216 if ((res >> 26) == ALC880_HP_EVENT)
14217 alc269_lifebook_speaker_automute(codec);
14218 if ((res >> 26) == ALC880_MIC_EVENT)
14219 alc269_lifebook_mic_autoswitch(codec);
14222 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14224 struct alc_spec *spec = codec->spec;
14225 spec->autocfg.hp_pins[0] = 0x15;
14226 spec->autocfg.speaker_pins[0] = 0x14;
14227 spec->ext_mic.pin = 0x18;
14228 spec->ext_mic.mux_idx = 0;
14229 spec->int_mic.pin = 0x19;
14230 spec->int_mic.mux_idx = 1;
14231 spec->auto_mic = 1;
14234 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14236 alc269_quanta_fl1_speaker_automute(codec);
14237 alc_mic_automute(codec);
14240 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14242 alc269_lifebook_speaker_automute(codec);
14243 alc269_lifebook_mic_autoswitch(codec);
14246 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14247 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14248 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14249 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14250 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14251 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14252 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14253 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14257 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14258 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14259 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14260 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14261 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14262 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14263 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14267 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14268 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14269 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14270 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14271 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14272 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14273 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14274 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14278 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14279 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14280 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14281 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14282 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14283 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14284 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14285 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14289 static struct hda_verb alc271_acer_dmic_verbs[] = {
14290 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14291 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14292 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14293 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14294 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14295 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14296 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14297 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14298 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14299 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14303 /* toggle speaker-output according to the hp-jack state */
14304 static void alc269_speaker_automute(struct hda_codec *codec)
14306 struct alc_spec *spec = codec->spec;
14307 unsigned int nid = spec->autocfg.hp_pins[0];
14308 unsigned int present;
14309 unsigned char bits;
14311 present = snd_hda_jack_detect(codec, nid);
14312 bits = present ? HDA_AMP_MUTE : 0;
14313 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14314 HDA_AMP_MUTE, bits);
14315 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14316 HDA_AMP_MUTE, bits);
14319 /* unsolicited event for HP jack sensing */
14320 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14323 switch (res >> 26) {
14324 case ALC880_HP_EVENT:
14325 alc269_speaker_automute(codec);
14327 case ALC880_MIC_EVENT:
14328 alc_mic_automute(codec);
14333 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14335 struct alc_spec *spec = codec->spec;
14336 spec->autocfg.hp_pins[0] = 0x15;
14337 spec->autocfg.speaker_pins[0] = 0x14;
14338 spec->ext_mic.pin = 0x18;
14339 spec->ext_mic.mux_idx = 0;
14340 spec->int_mic.pin = 0x19;
14341 spec->int_mic.mux_idx = 1;
14342 spec->auto_mic = 1;
14345 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14347 struct alc_spec *spec = codec->spec;
14348 spec->autocfg.hp_pins[0] = 0x15;
14349 spec->autocfg.speaker_pins[0] = 0x14;
14350 spec->ext_mic.pin = 0x18;
14351 spec->ext_mic.mux_idx = 0;
14352 spec->int_mic.pin = 0x12;
14353 spec->int_mic.mux_idx = 5;
14354 spec->auto_mic = 1;
14357 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14359 struct alc_spec *spec = codec->spec;
14360 spec->autocfg.hp_pins[0] = 0x21;
14361 spec->autocfg.speaker_pins[0] = 0x14;
14362 spec->ext_mic.pin = 0x18;
14363 spec->ext_mic.mux_idx = 0;
14364 spec->int_mic.pin = 0x19;
14365 spec->int_mic.mux_idx = 1;
14366 spec->auto_mic = 1;
14369 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14371 struct alc_spec *spec = codec->spec;
14372 spec->autocfg.hp_pins[0] = 0x21;
14373 spec->autocfg.speaker_pins[0] = 0x14;
14374 spec->ext_mic.pin = 0x18;
14375 spec->ext_mic.mux_idx = 0;
14376 spec->int_mic.pin = 0x12;
14377 spec->int_mic.mux_idx = 6;
14378 spec->auto_mic = 1;
14381 static void alc269_laptop_inithook(struct hda_codec *codec)
14383 alc269_speaker_automute(codec);
14384 alc_mic_automute(codec);
14388 * generic initialization of ADC, input mixers and output mixers
14390 static struct hda_verb alc269_init_verbs[] = {
14392 * Unmute ADC0 and set the default input to mic-in
14394 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14397 * Set up output mixers (0x02 - 0x03)
14399 /* set vol=0 to output mixers */
14400 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14401 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14403 /* set up input amps for analog loopback */
14404 /* Amp Indices: DAC = 0, mixer = 1 */
14405 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14406 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14407 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14408 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14409 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14410 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14413 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14414 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14415 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14416 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14417 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14418 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14420 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14421 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14423 /* FIXME: use Mux-type input source selection */
14424 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14425 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14426 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14429 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14433 static struct hda_verb alc269vb_init_verbs[] = {
14435 * Unmute ADC0 and set the default input to mic-in
14437 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14440 * Set up output mixers (0x02 - 0x03)
14442 /* set vol=0 to output mixers */
14443 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14444 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14446 /* set up input amps for analog loopback */
14447 /* Amp Indices: DAC = 0, mixer = 1 */
14448 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14449 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14450 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14451 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14452 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14453 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14455 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14456 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14457 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14458 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14459 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14460 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14461 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14463 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14464 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14466 /* FIXME: use Mux-type input source selection */
14467 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14468 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14469 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14472 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14476 #define alc269_auto_create_multi_out_ctls \
14477 alc268_auto_create_multi_out_ctls
14478 #define alc269_auto_create_input_ctls \
14479 alc268_auto_create_input_ctls
14481 #ifdef CONFIG_SND_HDA_POWER_SAVE
14482 #define alc269_loopbacks alc880_loopbacks
14485 /* pcm configuration: identical with ALC880 */
14486 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14487 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14488 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14489 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14491 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14495 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14496 /* NID is set in alc_build_pcms */
14498 .open = alc880_playback_pcm_open,
14499 .prepare = alc880_playback_pcm_prepare,
14500 .cleanup = alc880_playback_pcm_cleanup
14504 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14508 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14509 /* NID is set in alc_build_pcms */
14512 #ifdef CONFIG_SND_HDA_POWER_SAVE
14513 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14515 switch (codec->subsystem_id) {
14522 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14524 /* update mute-LED according to the speaker mute state */
14525 if (nid == 0x01 || nid == 0x14) {
14527 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14532 /* mic2 vref pin is used for mute LED control */
14533 snd_hda_codec_update_cache(codec, 0x19, 0,
14534 AC_VERB_SET_PIN_WIDGET_CONTROL,
14537 return alc_check_power_status(codec, nid);
14539 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14541 static int alc275_setup_dual_adc(struct hda_codec *codec)
14543 struct alc_spec *spec = codec->spec;
14545 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14547 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14548 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14549 if (spec->ext_mic.pin <= 0x12) {
14550 spec->private_adc_nids[0] = 0x08;
14551 spec->private_adc_nids[1] = 0x11;
14552 spec->private_capsrc_nids[0] = 0x23;
14553 spec->private_capsrc_nids[1] = 0x22;
14555 spec->private_adc_nids[0] = 0x11;
14556 spec->private_adc_nids[1] = 0x08;
14557 spec->private_capsrc_nids[0] = 0x22;
14558 spec->private_capsrc_nids[1] = 0x23;
14560 spec->adc_nids = spec->private_adc_nids;
14561 spec->capsrc_nids = spec->private_capsrc_nids;
14562 spec->num_adc_nids = 2;
14563 spec->dual_adc_switch = 1;
14564 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14565 spec->adc_nids[0], spec->adc_nids[1]);
14572 * BIOS auto configuration
14574 static int alc269_parse_auto_config(struct hda_codec *codec)
14576 struct alc_spec *spec = codec->spec;
14578 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14580 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14585 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14588 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14592 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14594 alc_auto_parse_digital(codec);
14596 if (spec->kctls.list)
14597 add_mixer(spec, spec->kctls.list);
14599 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14600 add_verb(spec, alc269vb_init_verbs);
14601 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14603 add_verb(spec, alc269_init_verbs);
14604 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14607 spec->num_mux_defs = 1;
14608 spec->input_mux = &spec->private_imux[0];
14610 if (!alc275_setup_dual_adc(codec))
14611 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14612 sizeof(alc269_adc_candidates));
14614 /* set default input source */
14615 if (!spec->dual_adc_switch)
14616 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14617 spec->input_mux->items[0].index);
14619 err = alc_auto_add_mic_boost(codec);
14623 if (!spec->cap_mixer && !spec->no_analog)
14624 set_capture_mixer(codec);
14629 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14630 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14631 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14634 /* init callback for auto-configuration model -- overriding the default init */
14635 static void alc269_auto_init(struct hda_codec *codec)
14637 struct alc_spec *spec = codec->spec;
14638 alc269_auto_init_multi_out(codec);
14639 alc269_auto_init_hp_out(codec);
14640 alc269_auto_init_analog_input(codec);
14641 alc_auto_init_digital(codec);
14642 alc_init_jacks(codec);
14643 if (spec->unsol_event)
14644 alc_inithook(codec);
14647 #ifdef CONFIG_SND_HDA_POWER_SAVE
14648 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14650 struct alc_spec *spec = codec->spec;
14653 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14654 val = alc_read_coef_idx(codec, 0x04);
14655 /* Power down output pin */
14656 alc_write_coef_idx(codec, 0x04, val & ~(1<<11));
14659 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14660 val = alc_read_coef_idx(codec, 0x04);
14661 /* Power down output pin */
14662 alc_write_coef_idx(codec, 0x04, val & ~(1<<11));
14667 if (spec && spec->power_hook)
14668 spec->power_hook(codec);
14672 #ifdef SND_HDA_NEEDS_RESUME
14673 static int alc269_resume(struct hda_codec *codec)
14677 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14678 val = alc_read_coef_idx(codec, 0x04);
14679 /* Power down output pin */
14680 alc_write_coef_idx(codec, 0x04, val & ~(1<<11));
14684 codec->patch_ops.init(codec);
14686 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14687 val = alc_read_coef_idx(codec, 0x04);
14688 /* Power up output pin */
14689 alc_write_coef_idx(codec, 0x04, val | (1<<11));
14693 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14694 val = alc_read_coef_idx(codec, 0x04);
14695 /* Power up output pin */
14696 alc_write_coef_idx(codec, 0x04, val | (1<<11));
14699 snd_hda_codec_resume_amp(codec);
14700 snd_hda_codec_resume_cache(codec);
14701 #ifdef CONFIG_SND_HDA_POWER_SAVE
14702 if (codec->patch_ops.check_power_status)
14703 codec->patch_ops.check_power_status(codec, 0x01);
14710 ALC269_FIXUP_SONY_VAIO,
14713 static const struct alc_fixup alc269_fixups[] = {
14714 [ALC269_FIXUP_SONY_VAIO] = {
14715 .verbs = (const struct hda_verb[]) {
14716 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14722 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14723 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14724 SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14730 * configuration and preset
14732 static const char *alc269_models[ALC269_MODEL_LAST] = {
14733 [ALC269_BASIC] = "basic",
14734 [ALC269_QUANTA_FL1] = "quanta",
14735 [ALC269_AMIC] = "laptop-amic",
14736 [ALC269_DMIC] = "laptop-dmic",
14737 [ALC269_FUJITSU] = "fujitsu",
14738 [ALC269_LIFEBOOK] = "lifebook",
14739 [ALC269_AUTO] = "auto",
14742 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14743 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14744 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14745 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14747 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14748 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14749 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14750 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14751 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14752 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14753 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14754 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14755 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14756 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14757 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14758 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14759 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14760 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14761 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14762 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14763 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14764 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14765 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14766 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14767 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14768 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14769 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14770 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14771 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14772 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14773 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14774 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14775 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14776 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14777 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14778 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14779 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14780 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14781 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14782 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14783 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14785 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14787 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14788 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14789 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14790 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14791 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14792 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14793 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14794 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14795 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14796 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14800 static struct alc_config_preset alc269_presets[] = {
14802 .mixers = { alc269_base_mixer },
14803 .init_verbs = { alc269_init_verbs },
14804 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14805 .dac_nids = alc269_dac_nids,
14807 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14808 .channel_mode = alc269_modes,
14809 .input_mux = &alc269_capture_source,
14811 [ALC269_QUANTA_FL1] = {
14812 .mixers = { alc269_quanta_fl1_mixer },
14813 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14814 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14815 .dac_nids = alc269_dac_nids,
14817 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14818 .channel_mode = alc269_modes,
14819 .input_mux = &alc269_capture_source,
14820 .unsol_event = alc269_quanta_fl1_unsol_event,
14821 .setup = alc269_quanta_fl1_setup,
14822 .init_hook = alc269_quanta_fl1_init_hook,
14825 .mixers = { alc269_laptop_mixer },
14826 .cap_mixer = alc269_laptop_analog_capture_mixer,
14827 .init_verbs = { alc269_init_verbs,
14828 alc269_laptop_amic_init_verbs },
14829 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14830 .dac_nids = alc269_dac_nids,
14832 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14833 .channel_mode = alc269_modes,
14834 .unsol_event = alc269_laptop_unsol_event,
14835 .setup = alc269_laptop_amic_setup,
14836 .init_hook = alc269_laptop_inithook,
14839 .mixers = { alc269_laptop_mixer },
14840 .cap_mixer = alc269_laptop_digital_capture_mixer,
14841 .init_verbs = { alc269_init_verbs,
14842 alc269_laptop_dmic_init_verbs },
14843 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14844 .dac_nids = alc269_dac_nids,
14846 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14847 .channel_mode = alc269_modes,
14848 .unsol_event = alc269_laptop_unsol_event,
14849 .setup = alc269_laptop_dmic_setup,
14850 .init_hook = alc269_laptop_inithook,
14852 [ALC269VB_AMIC] = {
14853 .mixers = { alc269vb_laptop_mixer },
14854 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14855 .init_verbs = { alc269vb_init_verbs,
14856 alc269vb_laptop_amic_init_verbs },
14857 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14858 .dac_nids = alc269_dac_nids,
14860 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14861 .channel_mode = alc269_modes,
14862 .unsol_event = alc269_laptop_unsol_event,
14863 .setup = alc269vb_laptop_amic_setup,
14864 .init_hook = alc269_laptop_inithook,
14866 [ALC269VB_DMIC] = {
14867 .mixers = { alc269vb_laptop_mixer },
14868 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14869 .init_verbs = { alc269vb_init_verbs,
14870 alc269vb_laptop_dmic_init_verbs },
14871 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14872 .dac_nids = alc269_dac_nids,
14874 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14875 .channel_mode = alc269_modes,
14876 .unsol_event = alc269_laptop_unsol_event,
14877 .setup = alc269vb_laptop_dmic_setup,
14878 .init_hook = alc269_laptop_inithook,
14880 [ALC269_FUJITSU] = {
14881 .mixers = { alc269_fujitsu_mixer },
14882 .cap_mixer = alc269_laptop_digital_capture_mixer,
14883 .init_verbs = { alc269_init_verbs,
14884 alc269_laptop_dmic_init_verbs },
14885 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14886 .dac_nids = alc269_dac_nids,
14888 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14889 .channel_mode = alc269_modes,
14890 .unsol_event = alc269_laptop_unsol_event,
14891 .setup = alc269_laptop_dmic_setup,
14892 .init_hook = alc269_laptop_inithook,
14894 [ALC269_LIFEBOOK] = {
14895 .mixers = { alc269_lifebook_mixer },
14896 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14897 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14898 .dac_nids = alc269_dac_nids,
14900 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14901 .channel_mode = alc269_modes,
14902 .input_mux = &alc269_capture_source,
14903 .unsol_event = alc269_lifebook_unsol_event,
14904 .init_hook = alc269_lifebook_init_hook,
14907 .mixers = { alc269_asus_mixer },
14908 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14909 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
14910 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14911 .dac_nids = alc269_dac_nids,
14912 .adc_nids = alc262_dmic_adc_nids,
14913 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
14914 .capsrc_nids = alc262_dmic_capsrc_nids,
14915 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14916 .channel_mode = alc269_modes,
14917 .input_mux = &alc269_capture_source,
14918 .dig_out_nid = ALC880_DIGOUT_NID,
14919 .unsol_event = alc_sku_unsol_event,
14920 .setup = alc269vb_laptop_dmic_setup,
14921 .init_hook = alc_inithook,
14925 static int alc269_fill_coef(struct hda_codec *codec)
14929 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
14930 alc_write_coef_idx(codec, 0xf, 0x960b);
14931 alc_write_coef_idx(codec, 0xe, 0x8817);
14934 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
14935 alc_write_coef_idx(codec, 0xf, 0x960b);
14936 alc_write_coef_idx(codec, 0xe, 0x8814);
14939 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14940 val = alc_read_coef_idx(codec, 0x04);
14941 /* Power up output pin */
14942 alc_write_coef_idx(codec, 0x04, val | (1<<11));
14945 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14946 val = alc_read_coef_idx(codec, 0xd);
14947 if ((val & 0x0c00) >> 10 != 0x1) {
14948 /* Capless ramp up clock control */
14949 alc_write_coef_idx(codec, 0xd, val | 1<<10);
14951 val = alc_read_coef_idx(codec, 0x17);
14952 if ((val & 0x01c0) >> 6 != 0x4) {
14953 /* Class D power on reset */
14954 alc_write_coef_idx(codec, 0x17, val | 1<<7);
14960 static int patch_alc269(struct hda_codec *codec)
14962 struct alc_spec *spec;
14965 int is_alc269vb = 0;
14967 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14971 codec->spec = spec;
14973 alc_auto_parse_customize_define(codec);
14975 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14976 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14977 spec->cdefine.platform_type == 1)
14978 alc_codec_rename(codec, "ALC271X");
14980 alc_codec_rename(codec, "ALC259");
14983 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14985 alc269_fill_coef(codec);
14987 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14991 if (board_config < 0) {
14992 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14994 board_config = ALC269_AUTO;
14997 if (board_config == ALC269_AUTO)
14998 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
15000 if (board_config == ALC269_AUTO) {
15001 /* automatic parse from the BIOS config */
15002 err = alc269_parse_auto_config(codec);
15008 "hda_codec: Cannot set up configuration "
15009 "from BIOS. Using base mode...\n");
15010 board_config = ALC269_BASIC;
15014 if (has_cdefine_beep(codec)) {
15015 err = snd_hda_attach_beep_device(codec, 0x1);
15022 if (board_config != ALC269_AUTO)
15023 setup_preset(codec, &alc269_presets[board_config]);
15025 if (board_config == ALC269_QUANTA_FL1) {
15026 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15027 * fix the sample rate of analog I/O to 44.1kHz
15029 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15030 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15031 } else if (spec->dual_adc_switch) {
15032 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15033 /* switch ADC dynamically */
15034 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15036 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15037 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15039 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15040 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15042 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15043 if (!is_alc269vb) {
15044 spec->adc_nids = alc269_adc_nids;
15045 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15046 spec->capsrc_nids = alc269_capsrc_nids;
15048 spec->adc_nids = alc269vb_adc_nids;
15049 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15050 spec->capsrc_nids = alc269vb_capsrc_nids;
15054 if (!spec->cap_mixer)
15055 set_capture_mixer(codec);
15056 if (has_cdefine_beep(codec))
15057 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15059 if (board_config == ALC269_AUTO)
15060 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
15062 spec->vmaster_nid = 0x02;
15064 codec->patch_ops = alc_patch_ops;
15065 #ifdef CONFIG_SND_HDA_POWER_SAVE
15066 codec->patch_ops.suspend = alc269_suspend;
15068 #ifdef SND_HDA_NEEDS_RESUME
15069 codec->patch_ops.resume = alc269_resume;
15071 if (board_config == ALC269_AUTO)
15072 spec->init_hook = alc269_auto_init;
15073 #ifdef CONFIG_SND_HDA_POWER_SAVE
15074 if (!spec->loopback.amplist)
15075 spec->loopback.amplist = alc269_loopbacks;
15076 if (alc269_mic2_for_mute_led(codec))
15077 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15084 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15088 * set the path ways for 2 channel output
15089 * need to set the codec line out and mic 1 pin widgets to inputs
15091 static struct hda_verb alc861_threestack_ch2_init[] = {
15092 /* set pin widget 1Ah (line in) for input */
15093 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15094 /* set pin widget 18h (mic1/2) for input, for mic also enable
15097 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15099 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15101 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15102 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15108 * need to set the codec line out and mic 1 pin widgets to outputs
15110 static struct hda_verb alc861_threestack_ch6_init[] = {
15111 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15112 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15113 /* set pin widget 18h (mic1) for output (CLFE)*/
15114 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15116 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15117 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15119 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15121 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15122 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15127 static struct hda_channel_mode alc861_threestack_modes[2] = {
15128 { 2, alc861_threestack_ch2_init },
15129 { 6, alc861_threestack_ch6_init },
15131 /* Set mic1 as input and unmute the mixer */
15132 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15133 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15134 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15137 /* Set mic1 as output and mute mixer */
15138 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15139 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15140 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15144 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15145 { 2, alc861_uniwill_m31_ch2_init },
15146 { 4, alc861_uniwill_m31_ch4_init },
15149 /* Set mic1 and line-in as input and unmute the mixer */
15150 static struct hda_verb alc861_asus_ch2_init[] = {
15151 /* set pin widget 1Ah (line in) for input */
15152 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15153 /* set pin widget 18h (mic1/2) for input, for mic also enable
15156 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15158 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15160 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15161 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15165 /* Set mic1 nad line-in as output and mute mixer */
15166 static struct hda_verb alc861_asus_ch6_init[] = {
15167 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15168 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15169 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15170 /* set pin widget 18h (mic1) for output (CLFE)*/
15171 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15172 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15173 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15174 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15176 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15178 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15179 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15184 static struct hda_channel_mode alc861_asus_modes[2] = {
15185 { 2, alc861_asus_ch2_init },
15186 { 6, alc861_asus_ch6_init },
15191 static struct snd_kcontrol_new alc861_base_mixer[] = {
15192 /* output mixer control */
15193 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15194 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15195 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15196 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15197 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15199 /*Input mixer control */
15200 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15201 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15202 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15203 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15204 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15205 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15206 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15207 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15208 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15214 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15215 /* output mixer control */
15216 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15217 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15218 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15219 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15220 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15222 /* Input mixer control */
15223 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15224 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15225 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15226 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15227 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15228 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15229 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15230 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15231 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15232 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15235 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15236 .name = "Channel Mode",
15237 .info = alc_ch_mode_info,
15238 .get = alc_ch_mode_get,
15239 .put = alc_ch_mode_put,
15240 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15245 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15246 /* output mixer control */
15247 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15249 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15254 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15255 /* output mixer control */
15256 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15257 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15258 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15259 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15260 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15262 /* Input mixer control */
15263 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15264 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15265 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15266 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15267 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15268 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15269 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15270 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15271 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15272 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15275 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15276 .name = "Channel Mode",
15277 .info = alc_ch_mode_info,
15278 .get = alc_ch_mode_get,
15279 .put = alc_ch_mode_put,
15280 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15285 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15286 /* output mixer control */
15287 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15288 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15289 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15290 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15291 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15293 /* Input mixer control */
15294 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15295 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15296 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15297 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15298 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15299 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15300 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15301 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15302 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15303 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15306 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15307 .name = "Channel Mode",
15308 .info = alc_ch_mode_info,
15309 .get = alc_ch_mode_get,
15310 .put = alc_ch_mode_put,
15311 .private_value = ARRAY_SIZE(alc861_asus_modes),
15316 /* additional mixer */
15317 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15318 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15319 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15324 * generic initialization of ADC, input mixers and output mixers
15326 static struct hda_verb alc861_base_init_verbs[] = {
15328 * Unmute ADC0 and set the default input to mic-in
15330 /* port-A for surround (rear panel) */
15331 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15332 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15333 /* port-B for mic-in (rear panel) with vref */
15334 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15335 /* port-C for line-in (rear panel) */
15336 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15337 /* port-D for Front */
15338 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15339 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15340 /* port-E for HP out (front panel) */
15341 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15342 /* route front PCM to HP */
15343 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15344 /* port-F for mic-in (front panel) with vref */
15345 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15346 /* port-G for CLFE (rear panel) */
15347 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15348 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15349 /* port-H for side (rear panel) */
15350 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15351 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15353 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15354 /* route front mic to ADC1*/
15355 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15356 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15358 /* Unmute DAC0~3 & spdif out*/
15359 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15360 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15361 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15362 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15363 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15365 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15366 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15367 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15368 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15369 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15371 /* Unmute Stereo Mixer 15 */
15372 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15373 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15374 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15375 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15377 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15378 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15379 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15380 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15381 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15382 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15383 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15384 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15385 /* hp used DAC 3 (Front) */
15386 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15387 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15392 static struct hda_verb alc861_threestack_init_verbs[] = {
15394 * Unmute ADC0 and set the default input to mic-in
15396 /* port-A for surround (rear panel) */
15397 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15398 /* port-B for mic-in (rear panel) with vref */
15399 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15400 /* port-C for line-in (rear panel) */
15401 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15402 /* port-D for Front */
15403 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15404 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15405 /* port-E for HP out (front panel) */
15406 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15407 /* route front PCM to HP */
15408 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15409 /* port-F for mic-in (front panel) with vref */
15410 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15411 /* port-G for CLFE (rear panel) */
15412 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15413 /* port-H for side (rear panel) */
15414 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15416 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15417 /* route front mic to ADC1*/
15418 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15419 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15420 /* Unmute DAC0~3 & spdif out*/
15421 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15422 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15423 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15424 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15425 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15427 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15428 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15429 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15430 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15431 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15433 /* Unmute Stereo Mixer 15 */
15434 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15435 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15436 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15437 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15439 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15440 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15441 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15442 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15443 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15444 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15445 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15446 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15447 /* hp used DAC 3 (Front) */
15448 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15449 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15453 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15455 * Unmute ADC0 and set the default input to mic-in
15457 /* port-A for surround (rear panel) */
15458 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15459 /* port-B for mic-in (rear panel) with vref */
15460 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15461 /* port-C for line-in (rear panel) */
15462 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15463 /* port-D for Front */
15464 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15465 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15466 /* port-E for HP out (front panel) */
15467 /* this has to be set to VREF80 */
15468 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15469 /* route front PCM to HP */
15470 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15471 /* port-F for mic-in (front panel) with vref */
15472 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15473 /* port-G for CLFE (rear panel) */
15474 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15475 /* port-H for side (rear panel) */
15476 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15478 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15479 /* route front mic to ADC1*/
15480 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15481 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15482 /* Unmute DAC0~3 & spdif out*/
15483 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15484 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15485 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15486 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15489 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15490 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15491 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15492 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15493 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15495 /* Unmute Stereo Mixer 15 */
15496 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15497 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15498 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15499 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15501 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15502 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15503 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15504 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15505 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15506 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15507 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15508 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15509 /* hp used DAC 3 (Front) */
15510 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15511 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15515 static struct hda_verb alc861_asus_init_verbs[] = {
15517 * Unmute ADC0 and set the default input to mic-in
15519 /* port-A for surround (rear panel)
15520 * according to codec#0 this is the HP jack
15522 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15523 /* route front PCM to HP */
15524 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15525 /* port-B for mic-in (rear panel) with vref */
15526 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15527 /* port-C for line-in (rear panel) */
15528 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15529 /* port-D for Front */
15530 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15531 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15532 /* port-E for HP out (front panel) */
15533 /* this has to be set to VREF80 */
15534 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15535 /* route front PCM to HP */
15536 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15537 /* port-F for mic-in (front panel) with vref */
15538 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15539 /* port-G for CLFE (rear panel) */
15540 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15541 /* port-H for side (rear panel) */
15542 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15544 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15545 /* route front mic to ADC1*/
15546 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15547 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15548 /* Unmute DAC0~3 & spdif out*/
15549 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15550 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15551 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15552 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15554 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15555 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15556 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15557 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15558 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15560 /* Unmute Stereo Mixer 15 */
15561 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15562 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15563 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15564 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15566 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15567 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15568 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15569 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15570 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15571 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15572 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15573 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15574 /* hp used DAC 3 (Front) */
15575 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15576 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15580 /* additional init verbs for ASUS laptops */
15581 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15582 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15583 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15588 * generic initialization of ADC, input mixers and output mixers
15590 static struct hda_verb alc861_auto_init_verbs[] = {
15592 * Unmute ADC0 and set the default input to mic-in
15594 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15597 /* Unmute DAC0~3 & spdif out*/
15598 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15599 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15600 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15601 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15602 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15604 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15605 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15606 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15607 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15608 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15610 /* Unmute Stereo Mixer 15 */
15611 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15612 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15613 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15616 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15617 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15618 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15619 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15620 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15621 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15622 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15623 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15625 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15626 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15627 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15628 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15629 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15630 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15631 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15632 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15634 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15639 static struct hda_verb alc861_toshiba_init_verbs[] = {
15640 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15645 /* toggle speaker-output according to the hp-jack state */
15646 static void alc861_toshiba_automute(struct hda_codec *codec)
15648 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15650 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15651 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15652 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15653 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15656 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15659 if ((res >> 26) == ALC880_HP_EVENT)
15660 alc861_toshiba_automute(codec);
15663 /* pcm configuration: identical with ALC880 */
15664 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15665 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15666 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15667 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15670 #define ALC861_DIGOUT_NID 0x07
15672 static struct hda_channel_mode alc861_8ch_modes[1] = {
15676 static hda_nid_t alc861_dac_nids[4] = {
15677 /* front, surround, clfe, side */
15678 0x03, 0x06, 0x05, 0x04
15681 static hda_nid_t alc660_dac_nids[3] = {
15682 /* front, clfe, surround */
15686 static hda_nid_t alc861_adc_nids[1] = {
15691 static struct hda_input_mux alc861_capture_source = {
15695 { "Front Mic", 0x3 },
15702 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15704 struct alc_spec *spec = codec->spec;
15705 hda_nid_t mix, srcs[5];
15708 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15710 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15713 for (i = 0; i < num; i++) {
15715 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15716 if (type != AC_WID_AUD_OUT)
15718 for (j = 0; j < spec->multiout.num_dacs; j++)
15719 if (spec->multiout.dac_nids[j] == srcs[i])
15721 if (j >= spec->multiout.num_dacs)
15727 /* fill in the dac_nids table from the parsed pin configuration */
15728 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15729 const struct auto_pin_cfg *cfg)
15731 struct alc_spec *spec = codec->spec;
15733 hda_nid_t nid, dac;
15735 spec->multiout.dac_nids = spec->private_dac_nids;
15736 for (i = 0; i < cfg->line_outs; i++) {
15737 nid = cfg->line_out_pins[i];
15738 dac = alc861_look_for_dac(codec, nid);
15741 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15746 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15747 hda_nid_t nid, unsigned int chs)
15749 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15750 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15753 /* add playback controls from the parsed DAC table */
15754 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15755 const struct auto_pin_cfg *cfg)
15757 struct alc_spec *spec = codec->spec;
15758 static const char *chname[4] = {
15759 "Front", "Surround", NULL /*CLFE*/, "Side"
15764 if (cfg->line_outs == 1) {
15765 const char *pfx = NULL;
15768 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15771 nid = spec->multiout.dac_nids[0];
15772 return alc861_create_out_sw(codec, pfx, nid, 3);
15776 for (i = 0; i < cfg->line_outs; i++) {
15777 nid = spec->multiout.dac_nids[i];
15782 err = alc861_create_out_sw(codec, "Center", nid, 1);
15785 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15789 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15797 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15799 struct alc_spec *spec = codec->spec;
15806 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15807 nid = alc861_look_for_dac(codec, pin);
15809 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15812 spec->multiout.hp_nid = nid;
15818 /* create playback/capture controls for input pins */
15819 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15820 const struct auto_pin_cfg *cfg)
15822 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15825 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15827 int pin_type, hda_nid_t dac)
15829 hda_nid_t mix, srcs[5];
15832 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15834 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15836 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15838 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15841 for (i = 0; i < num; i++) {
15843 if (srcs[i] == dac || srcs[i] == 0x15)
15844 mute = AMP_IN_UNMUTE(i);
15846 mute = AMP_IN_MUTE(i);
15847 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15852 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15854 struct alc_spec *spec = codec->spec;
15857 for (i = 0; i < spec->autocfg.line_outs; i++) {
15858 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15859 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15861 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15862 spec->multiout.dac_nids[i]);
15866 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15868 struct alc_spec *spec = codec->spec;
15870 if (spec->autocfg.hp_outs)
15871 alc861_auto_set_output_and_unmute(codec,
15872 spec->autocfg.hp_pins[0],
15874 spec->multiout.hp_nid);
15875 if (spec->autocfg.speaker_outs)
15876 alc861_auto_set_output_and_unmute(codec,
15877 spec->autocfg.speaker_pins[0],
15879 spec->multiout.dac_nids[0]);
15882 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15884 struct alc_spec *spec = codec->spec;
15885 struct auto_pin_cfg *cfg = &spec->autocfg;
15888 for (i = 0; i < cfg->num_inputs; i++) {
15889 hda_nid_t nid = cfg->inputs[i].pin;
15890 if (nid >= 0x0c && nid <= 0x11)
15891 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
15895 /* parse the BIOS configuration and set up the alc_spec */
15896 /* return 1 if successful, 0 if the proper config is not found,
15897 * or a negative error code
15899 static int alc861_parse_auto_config(struct hda_codec *codec)
15901 struct alc_spec *spec = codec->spec;
15903 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15905 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15909 if (!spec->autocfg.line_outs)
15910 return 0; /* can't find valid BIOS pin config */
15912 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15915 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15918 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15921 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15925 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15927 alc_auto_parse_digital(codec);
15929 if (spec->kctls.list)
15930 add_mixer(spec, spec->kctls.list);
15932 add_verb(spec, alc861_auto_init_verbs);
15934 spec->num_mux_defs = 1;
15935 spec->input_mux = &spec->private_imux[0];
15937 spec->adc_nids = alc861_adc_nids;
15938 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15939 set_capture_mixer(codec);
15941 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15946 /* additional initialization for auto-configuration model */
15947 static void alc861_auto_init(struct hda_codec *codec)
15949 struct alc_spec *spec = codec->spec;
15950 alc861_auto_init_multi_out(codec);
15951 alc861_auto_init_hp_out(codec);
15952 alc861_auto_init_analog_input(codec);
15953 alc_auto_init_digital(codec);
15954 if (spec->unsol_event)
15955 alc_inithook(codec);
15958 #ifdef CONFIG_SND_HDA_POWER_SAVE
15959 static struct hda_amp_list alc861_loopbacks[] = {
15960 { 0x15, HDA_INPUT, 0 },
15961 { 0x15, HDA_INPUT, 1 },
15962 { 0x15, HDA_INPUT, 2 },
15963 { 0x15, HDA_INPUT, 3 },
15970 * configuration and preset
15972 static const char *alc861_models[ALC861_MODEL_LAST] = {
15973 [ALC861_3ST] = "3stack",
15974 [ALC660_3ST] = "3stack-660",
15975 [ALC861_3ST_DIG] = "3stack-dig",
15976 [ALC861_6ST_DIG] = "6stack-dig",
15977 [ALC861_UNIWILL_M31] = "uniwill-m31",
15978 [ALC861_TOSHIBA] = "toshiba",
15979 [ALC861_ASUS] = "asus",
15980 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15981 [ALC861_AUTO] = "auto",
15984 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15985 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15986 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15987 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15988 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15989 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15990 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15991 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15992 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15993 * Any other models that need this preset?
15995 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15996 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15997 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15998 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15999 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16000 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16001 /* FIXME: the below seems conflict */
16002 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16003 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16004 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16008 static struct alc_config_preset alc861_presets[] = {
16010 .mixers = { alc861_3ST_mixer },
16011 .init_verbs = { alc861_threestack_init_verbs },
16012 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16013 .dac_nids = alc861_dac_nids,
16014 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16015 .channel_mode = alc861_threestack_modes,
16017 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16018 .adc_nids = alc861_adc_nids,
16019 .input_mux = &alc861_capture_source,
16021 [ALC861_3ST_DIG] = {
16022 .mixers = { alc861_base_mixer },
16023 .init_verbs = { alc861_threestack_init_verbs },
16024 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16025 .dac_nids = alc861_dac_nids,
16026 .dig_out_nid = ALC861_DIGOUT_NID,
16027 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16028 .channel_mode = alc861_threestack_modes,
16030 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16031 .adc_nids = alc861_adc_nids,
16032 .input_mux = &alc861_capture_source,
16034 [ALC861_6ST_DIG] = {
16035 .mixers = { alc861_base_mixer },
16036 .init_verbs = { alc861_base_init_verbs },
16037 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16038 .dac_nids = alc861_dac_nids,
16039 .dig_out_nid = ALC861_DIGOUT_NID,
16040 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16041 .channel_mode = alc861_8ch_modes,
16042 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16043 .adc_nids = alc861_adc_nids,
16044 .input_mux = &alc861_capture_source,
16047 .mixers = { alc861_3ST_mixer },
16048 .init_verbs = { alc861_threestack_init_verbs },
16049 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16050 .dac_nids = alc660_dac_nids,
16051 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16052 .channel_mode = alc861_threestack_modes,
16054 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16055 .adc_nids = alc861_adc_nids,
16056 .input_mux = &alc861_capture_source,
16058 [ALC861_UNIWILL_M31] = {
16059 .mixers = { alc861_uniwill_m31_mixer },
16060 .init_verbs = { alc861_uniwill_m31_init_verbs },
16061 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16062 .dac_nids = alc861_dac_nids,
16063 .dig_out_nid = ALC861_DIGOUT_NID,
16064 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16065 .channel_mode = alc861_uniwill_m31_modes,
16067 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16068 .adc_nids = alc861_adc_nids,
16069 .input_mux = &alc861_capture_source,
16071 [ALC861_TOSHIBA] = {
16072 .mixers = { alc861_toshiba_mixer },
16073 .init_verbs = { alc861_base_init_verbs,
16074 alc861_toshiba_init_verbs },
16075 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16076 .dac_nids = alc861_dac_nids,
16077 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16078 .channel_mode = alc883_3ST_2ch_modes,
16079 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16080 .adc_nids = alc861_adc_nids,
16081 .input_mux = &alc861_capture_source,
16082 .unsol_event = alc861_toshiba_unsol_event,
16083 .init_hook = alc861_toshiba_automute,
16086 .mixers = { alc861_asus_mixer },
16087 .init_verbs = { alc861_asus_init_verbs },
16088 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16089 .dac_nids = alc861_dac_nids,
16090 .dig_out_nid = ALC861_DIGOUT_NID,
16091 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16092 .channel_mode = alc861_asus_modes,
16095 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16096 .adc_nids = alc861_adc_nids,
16097 .input_mux = &alc861_capture_source,
16099 [ALC861_ASUS_LAPTOP] = {
16100 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16101 .init_verbs = { alc861_asus_init_verbs,
16102 alc861_asus_laptop_init_verbs },
16103 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16104 .dac_nids = alc861_dac_nids,
16105 .dig_out_nid = ALC861_DIGOUT_NID,
16106 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16107 .channel_mode = alc883_3ST_2ch_modes,
16109 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16110 .adc_nids = alc861_adc_nids,
16111 .input_mux = &alc861_capture_source,
16115 /* Pin config fixes */
16117 PINFIX_FSC_AMILO_PI1505,
16120 static const struct alc_fixup alc861_fixups[] = {
16121 [PINFIX_FSC_AMILO_PI1505] = {
16122 .pins = (const struct alc_pincfg[]) {
16123 { 0x0b, 0x0221101f }, /* HP */
16124 { 0x0f, 0x90170310 }, /* speaker */
16130 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16131 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16135 static int patch_alc861(struct hda_codec *codec)
16137 struct alc_spec *spec;
16141 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16145 codec->spec = spec;
16147 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16151 if (board_config < 0) {
16152 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16154 board_config = ALC861_AUTO;
16157 if (board_config == ALC861_AUTO)
16158 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
16160 if (board_config == ALC861_AUTO) {
16161 /* automatic parse from the BIOS config */
16162 err = alc861_parse_auto_config(codec);
16168 "hda_codec: Cannot set up configuration "
16169 "from BIOS. Using base mode...\n");
16170 board_config = ALC861_3ST_DIG;
16174 err = snd_hda_attach_beep_device(codec, 0x23);
16180 if (board_config != ALC861_AUTO)
16181 setup_preset(codec, &alc861_presets[board_config]);
16183 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16184 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16186 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16187 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16189 if (!spec->cap_mixer)
16190 set_capture_mixer(codec);
16191 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16193 spec->vmaster_nid = 0x03;
16195 if (board_config == ALC861_AUTO)
16196 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
16198 codec->patch_ops = alc_patch_ops;
16199 if (board_config == ALC861_AUTO) {
16200 spec->init_hook = alc861_auto_init;
16201 #ifdef CONFIG_SND_HDA_POWER_SAVE
16202 spec->power_hook = alc_power_eapd;
16205 #ifdef CONFIG_SND_HDA_POWER_SAVE
16206 if (!spec->loopback.amplist)
16207 spec->loopback.amplist = alc861_loopbacks;
16214 * ALC861-VD support
16218 * In addition, an independent DAC
16220 #define ALC861VD_DIGOUT_NID 0x06
16222 static hda_nid_t alc861vd_dac_nids[4] = {
16223 /* front, surr, clfe, side surr */
16224 0x02, 0x03, 0x04, 0x05
16227 /* dac_nids for ALC660vd are in a different order - according to
16228 * Realtek's driver.
16229 * This should probably result in a different mixer for 6stack models
16230 * of ALC660vd codecs, but for now there is only 3stack mixer
16231 * - and it is the same as in 861vd.
16232 * adc_nids in ALC660vd are (is) the same as in 861vd
16234 static hda_nid_t alc660vd_dac_nids[3] = {
16235 /* front, rear, clfe, rear_surr */
16239 static hda_nid_t alc861vd_adc_nids[1] = {
16244 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16247 /* FIXME: should be a matrix-type input source selection */
16248 static struct hda_input_mux alc861vd_capture_source = {
16252 { "Front Mic", 0x1 },
16258 static struct hda_input_mux alc861vd_dallas_capture_source = {
16261 { "Ext Mic", 0x0 },
16262 { "Int Mic", 0x1 },
16266 static struct hda_input_mux alc861vd_hp_capture_source = {
16269 { "Front Mic", 0x0 },
16270 { "ATAPI Mic", 0x1 },
16277 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16284 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16285 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16286 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16287 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16288 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16295 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16296 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16297 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16298 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16299 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16303 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16304 { 6, alc861vd_6stack_ch6_init },
16305 { 8, alc861vd_6stack_ch8_init },
16308 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16311 .name = "Channel Mode",
16312 .info = alc_ch_mode_info,
16313 .get = alc_ch_mode_get,
16314 .put = alc_ch_mode_put,
16319 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16320 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16322 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16323 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16324 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16326 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16327 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16329 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16331 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16333 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16334 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16336 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16337 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16339 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16341 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16343 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16345 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16346 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16347 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16349 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16350 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16352 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16353 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16358 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16359 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16360 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16362 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16364 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16365 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16366 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16368 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16369 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16370 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16372 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16373 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16375 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16376 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16381 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16382 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16383 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16384 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16386 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16388 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16392 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16393 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16394 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16396 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16397 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16402 /* Pin assignment: Speaker=0x14, HP = 0x15,
16403 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16405 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16406 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16407 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16408 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16409 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16410 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16411 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16412 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16413 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16414 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16415 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16419 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16420 * Front Mic=0x18, ATAPI Mic = 0x19,
16422 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16423 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16424 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16425 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16426 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16427 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16428 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16429 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16430 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16436 * generic initialization of ADC, input mixers and output mixers
16438 static struct hda_verb alc861vd_volume_init_verbs[] = {
16440 * Unmute ADC0 and set the default input to mic-in
16442 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16443 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16445 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16446 * the analog-loopback mixer widget
16448 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16450 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16453 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16455 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16462 * Set up output mixers (0x02 - 0x05)
16464 /* set vol=0 to output mixers */
16465 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16466 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16467 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16468 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16470 /* set up input amps for analog loopback */
16471 /* Amp Indices: DAC = 0, mixer = 1 */
16472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16474 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16475 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16476 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16477 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16478 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16479 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16485 * 3-stack pin configuration:
16486 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16488 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16490 * Set pin mode and muting
16492 /* set front pin widgets 0x14 for output */
16493 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16494 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16495 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16497 /* Mic (rear) pin: input vref at 80% */
16498 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16499 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16500 /* Front Mic pin: input vref at 80% */
16501 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16503 /* Line In pin: input */
16504 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16505 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16506 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16508 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16509 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16510 /* CD pin widget for input */
16511 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16517 * 6-stack pin configuration:
16519 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16521 * Set pin mode and muting
16523 /* set front pin widgets 0x14 for output */
16524 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16525 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16526 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16528 /* Rear Pin: output 1 (0x0d) */
16529 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16530 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16531 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16532 /* CLFE Pin: output 2 (0x0e) */
16533 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16534 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16535 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16536 /* Side Pin: output 3 (0x0f) */
16537 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16538 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16539 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16541 /* Mic (rear) pin: input vref at 80% */
16542 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16543 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16544 /* Front Mic pin: input vref at 80% */
16545 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16546 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16547 /* Line In pin: input */
16548 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16549 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16550 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16551 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16552 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16553 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16554 /* CD pin widget for input */
16555 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16560 static struct hda_verb alc861vd_eapd_verbs[] = {
16561 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16565 static struct hda_verb alc660vd_eapd_verbs[] = {
16566 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16567 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16571 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16572 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16573 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16574 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16575 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16576 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16580 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16582 unsigned int present;
16583 unsigned char bits;
16585 present = snd_hda_jack_detect(codec, 0x18);
16586 bits = present ? HDA_AMP_MUTE : 0;
16588 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16589 HDA_AMP_MUTE, bits);
16592 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16594 struct alc_spec *spec = codec->spec;
16595 spec->autocfg.hp_pins[0] = 0x1b;
16596 spec->autocfg.speaker_pins[0] = 0x14;
16599 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16601 alc_automute_amp(codec);
16602 alc861vd_lenovo_mic_automute(codec);
16605 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16608 switch (res >> 26) {
16609 case ALC880_MIC_EVENT:
16610 alc861vd_lenovo_mic_automute(codec);
16613 alc_automute_amp_unsol_event(codec, res);
16618 static struct hda_verb alc861vd_dallas_verbs[] = {
16619 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16620 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16621 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16622 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16626 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16627 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16628 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16629 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16630 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16631 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16634 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16635 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16636 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16637 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16638 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16639 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16640 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16642 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16643 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16644 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16645 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16646 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16647 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16648 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16649 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16656 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16657 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16658 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16663 /* toggle speaker-output according to the hp-jack state */
16664 static void alc861vd_dallas_setup(struct hda_codec *codec)
16666 struct alc_spec *spec = codec->spec;
16668 spec->autocfg.hp_pins[0] = 0x15;
16669 spec->autocfg.speaker_pins[0] = 0x14;
16672 #ifdef CONFIG_SND_HDA_POWER_SAVE
16673 #define alc861vd_loopbacks alc880_loopbacks
16676 /* pcm configuration: identical with ALC880 */
16677 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16678 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16679 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16680 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16683 * configuration and preset
16685 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16686 [ALC660VD_3ST] = "3stack-660",
16687 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16688 [ALC660VD_ASUS_V1S] = "asus-v1s",
16689 [ALC861VD_3ST] = "3stack",
16690 [ALC861VD_3ST_DIG] = "3stack-digout",
16691 [ALC861VD_6ST_DIG] = "6stack-digout",
16692 [ALC861VD_LENOVO] = "lenovo",
16693 [ALC861VD_DALLAS] = "dallas",
16694 [ALC861VD_HP] = "hp",
16695 [ALC861VD_AUTO] = "auto",
16698 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16699 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16700 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16701 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16702 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16703 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16704 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16705 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16706 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16707 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16708 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16709 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16710 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16711 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16712 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16713 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16717 static struct alc_config_preset alc861vd_presets[] = {
16719 .mixers = { alc861vd_3st_mixer },
16720 .init_verbs = { alc861vd_volume_init_verbs,
16721 alc861vd_3stack_init_verbs },
16722 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16723 .dac_nids = alc660vd_dac_nids,
16724 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16725 .channel_mode = alc861vd_3stack_2ch_modes,
16726 .input_mux = &alc861vd_capture_source,
16728 [ALC660VD_3ST_DIG] = {
16729 .mixers = { alc861vd_3st_mixer },
16730 .init_verbs = { alc861vd_volume_init_verbs,
16731 alc861vd_3stack_init_verbs },
16732 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16733 .dac_nids = alc660vd_dac_nids,
16734 .dig_out_nid = ALC861VD_DIGOUT_NID,
16735 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16736 .channel_mode = alc861vd_3stack_2ch_modes,
16737 .input_mux = &alc861vd_capture_source,
16740 .mixers = { alc861vd_3st_mixer },
16741 .init_verbs = { alc861vd_volume_init_verbs,
16742 alc861vd_3stack_init_verbs },
16743 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16744 .dac_nids = alc861vd_dac_nids,
16745 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16746 .channel_mode = alc861vd_3stack_2ch_modes,
16747 .input_mux = &alc861vd_capture_source,
16749 [ALC861VD_3ST_DIG] = {
16750 .mixers = { alc861vd_3st_mixer },
16751 .init_verbs = { alc861vd_volume_init_verbs,
16752 alc861vd_3stack_init_verbs },
16753 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16754 .dac_nids = alc861vd_dac_nids,
16755 .dig_out_nid = ALC861VD_DIGOUT_NID,
16756 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16757 .channel_mode = alc861vd_3stack_2ch_modes,
16758 .input_mux = &alc861vd_capture_source,
16760 [ALC861VD_6ST_DIG] = {
16761 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16762 .init_verbs = { alc861vd_volume_init_verbs,
16763 alc861vd_6stack_init_verbs },
16764 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16765 .dac_nids = alc861vd_dac_nids,
16766 .dig_out_nid = ALC861VD_DIGOUT_NID,
16767 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16768 .channel_mode = alc861vd_6stack_modes,
16769 .input_mux = &alc861vd_capture_source,
16771 [ALC861VD_LENOVO] = {
16772 .mixers = { alc861vd_lenovo_mixer },
16773 .init_verbs = { alc861vd_volume_init_verbs,
16774 alc861vd_3stack_init_verbs,
16775 alc861vd_eapd_verbs,
16776 alc861vd_lenovo_unsol_verbs },
16777 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16778 .dac_nids = alc660vd_dac_nids,
16779 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16780 .channel_mode = alc861vd_3stack_2ch_modes,
16781 .input_mux = &alc861vd_capture_source,
16782 .unsol_event = alc861vd_lenovo_unsol_event,
16783 .setup = alc861vd_lenovo_setup,
16784 .init_hook = alc861vd_lenovo_init_hook,
16786 [ALC861VD_DALLAS] = {
16787 .mixers = { alc861vd_dallas_mixer },
16788 .init_verbs = { alc861vd_dallas_verbs },
16789 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16790 .dac_nids = alc861vd_dac_nids,
16791 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16792 .channel_mode = alc861vd_3stack_2ch_modes,
16793 .input_mux = &alc861vd_dallas_capture_source,
16794 .unsol_event = alc_automute_amp_unsol_event,
16795 .setup = alc861vd_dallas_setup,
16796 .init_hook = alc_automute_amp,
16799 .mixers = { alc861vd_hp_mixer },
16800 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16801 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16802 .dac_nids = alc861vd_dac_nids,
16803 .dig_out_nid = ALC861VD_DIGOUT_NID,
16804 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16805 .channel_mode = alc861vd_3stack_2ch_modes,
16806 .input_mux = &alc861vd_hp_capture_source,
16807 .unsol_event = alc_automute_amp_unsol_event,
16808 .setup = alc861vd_dallas_setup,
16809 .init_hook = alc_automute_amp,
16811 [ALC660VD_ASUS_V1S] = {
16812 .mixers = { alc861vd_lenovo_mixer },
16813 .init_verbs = { alc861vd_volume_init_verbs,
16814 alc861vd_3stack_init_verbs,
16815 alc861vd_eapd_verbs,
16816 alc861vd_lenovo_unsol_verbs },
16817 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16818 .dac_nids = alc660vd_dac_nids,
16819 .dig_out_nid = ALC861VD_DIGOUT_NID,
16820 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16821 .channel_mode = alc861vd_3stack_2ch_modes,
16822 .input_mux = &alc861vd_capture_source,
16823 .unsol_event = alc861vd_lenovo_unsol_event,
16824 .setup = alc861vd_lenovo_setup,
16825 .init_hook = alc861vd_lenovo_init_hook,
16830 * BIOS auto configuration
16832 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16833 const struct auto_pin_cfg *cfg)
16835 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16839 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16840 hda_nid_t nid, int pin_type, int dac_idx)
16842 alc_set_pin_output(codec, nid, pin_type);
16845 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16847 struct alc_spec *spec = codec->spec;
16850 for (i = 0; i <= HDA_SIDE; i++) {
16851 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16852 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16854 alc861vd_auto_set_output_and_unmute(codec, nid,
16860 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16862 struct alc_spec *spec = codec->spec;
16865 pin = spec->autocfg.hp_pins[0];
16866 if (pin) /* connect to front and use dac 0 */
16867 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16868 pin = spec->autocfg.speaker_pins[0];
16870 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16873 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16875 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16877 struct alc_spec *spec = codec->spec;
16878 struct auto_pin_cfg *cfg = &spec->autocfg;
16881 for (i = 0; i < cfg->num_inputs; i++) {
16882 hda_nid_t nid = cfg->inputs[i].pin;
16883 if (alc_is_input_pin(codec, nid)) {
16884 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16885 if (nid != ALC861VD_PIN_CD_NID &&
16886 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16887 snd_hda_codec_write(codec, nid, 0,
16888 AC_VERB_SET_AMP_GAIN_MUTE,
16894 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16896 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16897 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16899 /* add playback controls from the parsed DAC table */
16900 /* Based on ALC880 version. But ALC861VD has separate,
16901 * different NIDs for mute/unmute switch and volume control */
16902 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16903 const struct auto_pin_cfg *cfg)
16905 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16906 hda_nid_t nid_v, nid_s;
16909 for (i = 0; i < cfg->line_outs; i++) {
16910 if (!spec->multiout.dac_nids[i])
16912 nid_v = alc861vd_idx_to_mixer_vol(
16914 spec->multiout.dac_nids[i]));
16915 nid_s = alc861vd_idx_to_mixer_switch(
16917 spec->multiout.dac_nids[i]));
16921 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16923 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16927 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16929 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16933 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16935 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16939 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16941 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16947 if (cfg->line_outs == 1 &&
16948 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16955 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16956 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16960 if (cfg->line_outs == 1 &&
16961 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16963 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16964 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16973 /* add playback controls for speaker and HP outputs */
16974 /* Based on ALC880 version. But ALC861VD has separate,
16975 * different NIDs for mute/unmute switch and volume control */
16976 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16977 hda_nid_t pin, const char *pfx)
16979 hda_nid_t nid_v, nid_s;
16985 if (alc880_is_fixed_pin(pin)) {
16986 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16987 /* specify the DAC as the extra output */
16988 if (!spec->multiout.hp_nid)
16989 spec->multiout.hp_nid = nid_v;
16991 spec->multiout.extra_out_nid[0] = nid_v;
16992 /* control HP volume/switch on the output mixer amp */
16993 nid_v = alc861vd_idx_to_mixer_vol(
16994 alc880_fixed_pin_idx(pin));
16995 nid_s = alc861vd_idx_to_mixer_switch(
16996 alc880_fixed_pin_idx(pin));
16998 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16999 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17002 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17003 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17006 } else if (alc880_is_multi_pin(pin)) {
17007 /* set manual connection */
17008 /* we have only a switch on HP-out PIN */
17009 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17010 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17017 /* parse the BIOS configuration and set up the alc_spec
17018 * return 1 if successful, 0 if the proper config is not found,
17019 * or a negative error code
17020 * Based on ALC880 version - had to change it to override
17021 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17022 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17024 struct alc_spec *spec = codec->spec;
17026 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17028 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17032 if (!spec->autocfg.line_outs)
17033 return 0; /* can't find valid BIOS pin config */
17035 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17038 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17041 err = alc861vd_auto_create_extra_out(spec,
17042 spec->autocfg.speaker_pins[0],
17046 err = alc861vd_auto_create_extra_out(spec,
17047 spec->autocfg.hp_pins[0],
17051 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17055 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17057 alc_auto_parse_digital(codec);
17059 if (spec->kctls.list)
17060 add_mixer(spec, spec->kctls.list);
17062 add_verb(spec, alc861vd_volume_init_verbs);
17064 spec->num_mux_defs = 1;
17065 spec->input_mux = &spec->private_imux[0];
17067 err = alc_auto_add_mic_boost(codec);
17071 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17076 /* additional initialization for auto-configuration model */
17077 static void alc861vd_auto_init(struct hda_codec *codec)
17079 struct alc_spec *spec = codec->spec;
17080 alc861vd_auto_init_multi_out(codec);
17081 alc861vd_auto_init_hp_out(codec);
17082 alc861vd_auto_init_analog_input(codec);
17083 alc861vd_auto_init_input_src(codec);
17084 alc_auto_init_digital(codec);
17085 if (spec->unsol_event)
17086 alc_inithook(codec);
17090 ALC660VD_FIX_ASUS_GPIO1
17094 static const struct alc_fixup alc861vd_fixups[] = {
17095 [ALC660VD_FIX_ASUS_GPIO1] = {
17096 .verbs = (const struct hda_verb[]) {
17097 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17098 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17099 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17105 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17106 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17110 static int patch_alc861vd(struct hda_codec *codec)
17112 struct alc_spec *spec;
17113 int err, board_config;
17115 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17119 codec->spec = spec;
17121 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17125 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17126 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17128 board_config = ALC861VD_AUTO;
17131 if (board_config == ALC861VD_AUTO)
17132 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
17134 if (board_config == ALC861VD_AUTO) {
17135 /* automatic parse from the BIOS config */
17136 err = alc861vd_parse_auto_config(codec);
17142 "hda_codec: Cannot set up configuration "
17143 "from BIOS. Using base mode...\n");
17144 board_config = ALC861VD_3ST;
17148 err = snd_hda_attach_beep_device(codec, 0x23);
17154 if (board_config != ALC861VD_AUTO)
17155 setup_preset(codec, &alc861vd_presets[board_config]);
17157 if (codec->vendor_id == 0x10ec0660) {
17158 /* always turn on EAPD */
17159 add_verb(spec, alc660vd_eapd_verbs);
17162 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17163 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17165 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17166 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17168 if (!spec->adc_nids) {
17169 spec->adc_nids = alc861vd_adc_nids;
17170 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17172 if (!spec->capsrc_nids)
17173 spec->capsrc_nids = alc861vd_capsrc_nids;
17175 set_capture_mixer(codec);
17176 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17178 spec->vmaster_nid = 0x02;
17180 if (board_config == ALC861VD_AUTO)
17181 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
17183 codec->patch_ops = alc_patch_ops;
17185 if (board_config == ALC861VD_AUTO)
17186 spec->init_hook = alc861vd_auto_init;
17187 #ifdef CONFIG_SND_HDA_POWER_SAVE
17188 if (!spec->loopback.amplist)
17189 spec->loopback.amplist = alc861vd_loopbacks;
17198 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17199 * configuration. Each pin widget can choose any input DACs and a mixer.
17200 * Each ADC is connected from a mixer of all inputs. This makes possible
17201 * 6-channel independent captures.
17203 * In addition, an independent DAC for the multi-playback (not used in this
17206 #define ALC662_DIGOUT_NID 0x06
17207 #define ALC662_DIGIN_NID 0x0a
17209 static hda_nid_t alc662_dac_nids[4] = {
17210 /* front, rear, clfe, rear_surr */
17214 static hda_nid_t alc272_dac_nids[2] = {
17218 static hda_nid_t alc662_adc_nids[2] = {
17223 static hda_nid_t alc272_adc_nids[1] = {
17228 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17229 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17233 /* FIXME: should be a matrix-type input source selection */
17234 static struct hda_input_mux alc662_capture_source = {
17238 { "Front Mic", 0x1 },
17244 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17252 static struct hda_input_mux alc663_capture_source = {
17256 { "Front Mic", 0x1 },
17261 #if 0 /* set to 1 for testing other input sources below */
17262 static struct hda_input_mux alc272_nc10_capture_source = {
17265 { "Autoselect Mic", 0x0 },
17266 { "Internal Mic", 0x1 },
17267 { "In-0x02", 0x2 },
17268 { "In-0x03", 0x3 },
17269 { "In-0x04", 0x4 },
17270 { "In-0x05", 0x5 },
17271 { "In-0x06", 0x6 },
17272 { "In-0x07", 0x7 },
17273 { "In-0x08", 0x8 },
17274 { "In-0x09", 0x9 },
17275 { "In-0x0a", 0x0a },
17276 { "In-0x0b", 0x0b },
17277 { "In-0x0c", 0x0c },
17278 { "In-0x0d", 0x0d },
17279 { "In-0x0e", 0x0e },
17280 { "In-0x0f", 0x0f },
17288 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17295 static struct hda_verb alc662_3ST_ch2_init[] = {
17296 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17297 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17298 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17299 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17306 static struct hda_verb alc662_3ST_ch6_init[] = {
17307 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17308 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17309 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17310 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17311 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17312 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17316 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17317 { 2, alc662_3ST_ch2_init },
17318 { 6, alc662_3ST_ch6_init },
17324 static struct hda_verb alc662_sixstack_ch6_init[] = {
17325 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17326 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17327 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17334 static struct hda_verb alc662_sixstack_ch8_init[] = {
17335 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17336 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17337 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17341 static struct hda_channel_mode alc662_5stack_modes[2] = {
17342 { 2, alc662_sixstack_ch6_init },
17343 { 6, alc662_sixstack_ch8_init },
17346 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17347 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17350 static struct snd_kcontrol_new alc662_base_mixer[] = {
17351 /* output mixer control */
17352 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17353 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17354 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17355 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17356 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17357 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17358 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17359 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17360 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17362 /*Input mixer control */
17363 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17364 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17365 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17366 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17367 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17368 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17369 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17370 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17374 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17375 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17376 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17377 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17378 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17379 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17380 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17381 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17382 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17383 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17384 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17385 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17389 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17390 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17391 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17392 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17393 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17394 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17395 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17396 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17397 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17398 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17399 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17400 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17401 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17402 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17403 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17404 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17405 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17406 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17410 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17411 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17412 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17413 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17414 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17415 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17416 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17417 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17419 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17423 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17424 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17425 ALC262_HIPPO_MASTER_SWITCH,
17427 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
17428 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17429 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17431 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17432 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17433 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17437 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17438 ALC262_HIPPO_MASTER_SWITCH,
17439 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17440 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17441 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17442 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17443 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17444 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17445 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17446 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17447 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17451 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17452 .ops = &snd_hda_bind_vol,
17454 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17455 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17460 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17461 .ops = &snd_hda_bind_sw,
17463 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17464 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17469 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17470 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17471 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17472 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17473 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17477 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17478 .ops = &snd_hda_bind_sw,
17480 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17481 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17482 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17487 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17488 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17489 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17490 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17491 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17492 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17493 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17498 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17499 .ops = &snd_hda_bind_sw,
17501 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17502 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17503 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17508 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17509 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17510 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17511 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17512 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17513 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17514 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17518 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17519 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17520 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17521 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17522 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17523 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17524 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17525 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17529 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17530 .ops = &snd_hda_bind_vol,
17532 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17533 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17538 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17539 .ops = &snd_hda_bind_sw,
17541 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17542 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17547 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17548 HDA_BIND_VOL("Master Playback Volume",
17549 &alc663_asus_two_bind_master_vol),
17550 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17551 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17552 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17553 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17554 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17558 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17559 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17560 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17561 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17562 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17563 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17564 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17568 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17569 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17570 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17571 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17572 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17573 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17576 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17577 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17578 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17582 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17583 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17584 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17585 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17587 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17588 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17589 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17590 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17591 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17592 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17596 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17597 .ops = &snd_hda_bind_sw,
17599 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17600 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17601 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17602 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17603 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17608 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17609 .ops = &snd_hda_bind_sw,
17611 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17612 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17617 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17618 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17619 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17620 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17621 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17622 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17623 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17624 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17625 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17626 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17630 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17631 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17632 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17633 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17634 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17635 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17636 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17637 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17642 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17644 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17645 .name = "Channel Mode",
17646 .info = alc_ch_mode_info,
17647 .get = alc_ch_mode_get,
17648 .put = alc_ch_mode_put,
17653 static struct hda_verb alc662_init_verbs[] = {
17654 /* ADC: mute amp left and right */
17655 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17656 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17660 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17662 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17665 /* Front Pin: output 0 (0x0c) */
17666 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17667 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17669 /* Rear Pin: output 1 (0x0d) */
17670 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17671 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17673 /* CLFE Pin: output 2 (0x0e) */
17674 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17675 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17677 /* Mic (rear) pin: input vref at 80% */
17678 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17679 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17680 /* Front Mic pin: input vref at 80% */
17681 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17682 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17683 /* Line In pin: input */
17684 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17685 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17686 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17687 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17688 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17689 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17690 /* CD pin widget for input */
17691 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17693 /* FIXME: use matrix-type input source selection */
17694 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17696 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17697 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17699 /* always trun on EAPD */
17700 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17701 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17706 static struct hda_verb alc663_init_verbs[] = {
17707 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17708 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17709 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17710 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17711 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17712 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17716 static struct hda_verb alc272_init_verbs[] = {
17717 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17718 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17719 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17720 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17721 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17722 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17723 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17724 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17728 static struct hda_verb alc662_sue_init_verbs[] = {
17729 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17730 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17734 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17735 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17736 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17740 /* Set Unsolicited Event*/
17741 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17742 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17743 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17747 static struct hda_verb alc663_m51va_init_verbs[] = {
17748 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17749 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17750 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17751 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17752 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17753 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17754 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17755 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17756 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17760 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17761 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17762 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17763 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17764 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17765 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17766 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17767 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17771 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17772 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17773 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17774 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17775 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17776 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17778 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17779 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17783 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17784 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17785 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17786 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17787 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17789 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17790 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17794 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17795 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17796 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17797 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17798 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17799 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17801 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17802 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17803 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17804 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17805 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17806 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17810 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17811 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17812 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17813 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17814 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17815 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17817 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17818 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17819 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17820 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17821 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17822 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17826 static struct hda_verb alc663_g71v_init_verbs[] = {
17827 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17828 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17829 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17831 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17832 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17833 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17835 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17836 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17837 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17841 static struct hda_verb alc663_g50v_init_verbs[] = {
17842 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17843 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17844 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17846 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17847 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17851 static struct hda_verb alc662_ecs_init_verbs[] = {
17852 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17853 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17854 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17855 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17859 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17860 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17861 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17862 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17863 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17864 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17865 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17866 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17867 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17868 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17869 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17870 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17874 static struct hda_verb alc272_dell_init_verbs[] = {
17875 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17876 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17877 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17878 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17879 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17880 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17881 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17882 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17883 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17884 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17885 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17889 static struct hda_verb alc663_mode7_init_verbs[] = {
17890 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17891 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17892 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17893 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17894 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17895 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17896 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17897 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17898 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17899 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17900 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17901 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17902 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17903 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17904 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17908 static struct hda_verb alc663_mode8_init_verbs[] = {
17909 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17910 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17911 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17912 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17913 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17914 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17915 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17916 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17917 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17918 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17919 {0x21, 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(9)},
17922 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17923 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17924 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17928 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17929 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17930 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17934 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17935 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17936 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17940 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17942 unsigned int present;
17943 unsigned char bits;
17945 present = snd_hda_jack_detect(codec, 0x14);
17946 bits = present ? HDA_AMP_MUTE : 0;
17948 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17949 HDA_AMP_MUTE, bits);
17952 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17954 unsigned int present;
17955 unsigned char bits;
17957 present = snd_hda_jack_detect(codec, 0x1b);
17958 bits = present ? HDA_AMP_MUTE : 0;
17960 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17961 HDA_AMP_MUTE, bits);
17962 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17963 HDA_AMP_MUTE, bits);
17966 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17969 if ((res >> 26) == ALC880_HP_EVENT)
17970 alc662_lenovo_101e_all_automute(codec);
17971 if ((res >> 26) == ALC880_FRONT_EVENT)
17972 alc662_lenovo_101e_ispeaker_automute(codec);
17975 /* unsolicited event for HP jack sensing */
17976 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17979 if ((res >> 26) == ALC880_MIC_EVENT)
17980 alc_mic_automute(codec);
17982 alc262_hippo_unsol_event(codec, res);
17985 static void alc662_eeepc_setup(struct hda_codec *codec)
17987 struct alc_spec *spec = codec->spec;
17989 alc262_hippo1_setup(codec);
17990 spec->ext_mic.pin = 0x18;
17991 spec->ext_mic.mux_idx = 0;
17992 spec->int_mic.pin = 0x19;
17993 spec->int_mic.mux_idx = 1;
17994 spec->auto_mic = 1;
17997 static void alc662_eeepc_inithook(struct hda_codec *codec)
17999 alc262_hippo_automute(codec);
18000 alc_mic_automute(codec);
18003 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18005 struct alc_spec *spec = codec->spec;
18007 spec->autocfg.hp_pins[0] = 0x14;
18008 spec->autocfg.speaker_pins[0] = 0x1b;
18011 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18013 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18015 unsigned int present;
18016 unsigned char bits;
18018 present = snd_hda_jack_detect(codec, 0x21);
18019 bits = present ? HDA_AMP_MUTE : 0;
18020 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18021 HDA_AMP_MUTE, bits);
18022 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18023 HDA_AMP_MUTE, bits);
18026 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18028 unsigned int present;
18029 unsigned char bits;
18031 present = snd_hda_jack_detect(codec, 0x21);
18032 bits = present ? HDA_AMP_MUTE : 0;
18033 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18034 HDA_AMP_MUTE, bits);
18035 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18036 HDA_AMP_MUTE, bits);
18037 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18038 HDA_AMP_MUTE, bits);
18039 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18040 HDA_AMP_MUTE, bits);
18043 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18045 unsigned int present;
18046 unsigned char bits;
18048 present = snd_hda_jack_detect(codec, 0x15);
18049 bits = present ? HDA_AMP_MUTE : 0;
18050 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18051 HDA_AMP_MUTE, bits);
18052 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18053 HDA_AMP_MUTE, bits);
18054 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18055 HDA_AMP_MUTE, bits);
18056 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18057 HDA_AMP_MUTE, bits);
18060 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18062 unsigned int present;
18063 unsigned char bits;
18065 present = snd_hda_jack_detect(codec, 0x1b);
18066 bits = present ? 0 : PIN_OUT;
18067 snd_hda_codec_write(codec, 0x14, 0,
18068 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18071 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18073 unsigned int present1, present2;
18075 present1 = snd_hda_jack_detect(codec, 0x21);
18076 present2 = snd_hda_jack_detect(codec, 0x15);
18078 if (present1 || present2) {
18079 snd_hda_codec_write_cache(codec, 0x14, 0,
18080 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18082 snd_hda_codec_write_cache(codec, 0x14, 0,
18083 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18087 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18089 unsigned int present1, present2;
18091 present1 = snd_hda_jack_detect(codec, 0x1b);
18092 present2 = snd_hda_jack_detect(codec, 0x15);
18094 if (present1 || present2) {
18095 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18096 HDA_AMP_MUTE, HDA_AMP_MUTE);
18097 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18098 HDA_AMP_MUTE, HDA_AMP_MUTE);
18100 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18102 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18107 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18109 unsigned int present1, present2;
18111 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18112 AC_VERB_GET_PIN_SENSE, 0)
18113 & AC_PINSENSE_PRESENCE;
18114 present2 = snd_hda_codec_read(codec, 0x21, 0,
18115 AC_VERB_GET_PIN_SENSE, 0)
18116 & AC_PINSENSE_PRESENCE;
18118 if (present1 || present2) {
18119 snd_hda_codec_write_cache(codec, 0x14, 0,
18120 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18121 snd_hda_codec_write_cache(codec, 0x17, 0,
18122 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18124 snd_hda_codec_write_cache(codec, 0x14, 0,
18125 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18126 snd_hda_codec_write_cache(codec, 0x17, 0,
18127 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18131 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18133 unsigned int present1, present2;
18135 present1 = snd_hda_codec_read(codec, 0x21, 0,
18136 AC_VERB_GET_PIN_SENSE, 0)
18137 & AC_PINSENSE_PRESENCE;
18138 present2 = snd_hda_codec_read(codec, 0x15, 0,
18139 AC_VERB_GET_PIN_SENSE, 0)
18140 & AC_PINSENSE_PRESENCE;
18142 if (present1 || present2) {
18143 snd_hda_codec_write_cache(codec, 0x14, 0,
18144 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18145 snd_hda_codec_write_cache(codec, 0x17, 0,
18146 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18148 snd_hda_codec_write_cache(codec, 0x14, 0,
18149 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18150 snd_hda_codec_write_cache(codec, 0x17, 0,
18151 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18155 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18158 switch (res >> 26) {
18159 case ALC880_HP_EVENT:
18160 alc663_m51va_speaker_automute(codec);
18162 case ALC880_MIC_EVENT:
18163 alc_mic_automute(codec);
18168 static void alc663_m51va_setup(struct hda_codec *codec)
18170 struct alc_spec *spec = codec->spec;
18171 spec->ext_mic.pin = 0x18;
18172 spec->ext_mic.mux_idx = 0;
18173 spec->int_mic.pin = 0x12;
18174 spec->int_mic.mux_idx = 9;
18175 spec->auto_mic = 1;
18178 static void alc663_m51va_inithook(struct hda_codec *codec)
18180 alc663_m51va_speaker_automute(codec);
18181 alc_mic_automute(codec);
18184 /* ***************** Mode1 ******************************/
18185 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18187 static void alc663_mode1_setup(struct hda_codec *codec)
18189 struct alc_spec *spec = codec->spec;
18190 spec->ext_mic.pin = 0x18;
18191 spec->ext_mic.mux_idx = 0;
18192 spec->int_mic.pin = 0x19;
18193 spec->int_mic.mux_idx = 1;
18194 spec->auto_mic = 1;
18197 #define alc663_mode1_inithook alc663_m51va_inithook
18199 /* ***************** Mode2 ******************************/
18200 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18203 switch (res >> 26) {
18204 case ALC880_HP_EVENT:
18205 alc662_f5z_speaker_automute(codec);
18207 case ALC880_MIC_EVENT:
18208 alc_mic_automute(codec);
18213 #define alc662_mode2_setup alc663_mode1_setup
18215 static void alc662_mode2_inithook(struct hda_codec *codec)
18217 alc662_f5z_speaker_automute(codec);
18218 alc_mic_automute(codec);
18220 /* ***************** Mode3 ******************************/
18221 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18224 switch (res >> 26) {
18225 case ALC880_HP_EVENT:
18226 alc663_two_hp_m1_speaker_automute(codec);
18228 case ALC880_MIC_EVENT:
18229 alc_mic_automute(codec);
18234 #define alc663_mode3_setup alc663_mode1_setup
18236 static void alc663_mode3_inithook(struct hda_codec *codec)
18238 alc663_two_hp_m1_speaker_automute(codec);
18239 alc_mic_automute(codec);
18241 /* ***************** Mode4 ******************************/
18242 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18245 switch (res >> 26) {
18246 case ALC880_HP_EVENT:
18247 alc663_21jd_two_speaker_automute(codec);
18249 case ALC880_MIC_EVENT:
18250 alc_mic_automute(codec);
18255 #define alc663_mode4_setup alc663_mode1_setup
18257 static void alc663_mode4_inithook(struct hda_codec *codec)
18259 alc663_21jd_two_speaker_automute(codec);
18260 alc_mic_automute(codec);
18262 /* ***************** Mode5 ******************************/
18263 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18266 switch (res >> 26) {
18267 case ALC880_HP_EVENT:
18268 alc663_15jd_two_speaker_automute(codec);
18270 case ALC880_MIC_EVENT:
18271 alc_mic_automute(codec);
18276 #define alc663_mode5_setup alc663_mode1_setup
18278 static void alc663_mode5_inithook(struct hda_codec *codec)
18280 alc663_15jd_two_speaker_automute(codec);
18281 alc_mic_automute(codec);
18283 /* ***************** Mode6 ******************************/
18284 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18287 switch (res >> 26) {
18288 case ALC880_HP_EVENT:
18289 alc663_two_hp_m2_speaker_automute(codec);
18291 case ALC880_MIC_EVENT:
18292 alc_mic_automute(codec);
18297 #define alc663_mode6_setup alc663_mode1_setup
18299 static void alc663_mode6_inithook(struct hda_codec *codec)
18301 alc663_two_hp_m2_speaker_automute(codec);
18302 alc_mic_automute(codec);
18305 /* ***************** Mode7 ******************************/
18306 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18309 switch (res >> 26) {
18310 case ALC880_HP_EVENT:
18311 alc663_two_hp_m7_speaker_automute(codec);
18313 case ALC880_MIC_EVENT:
18314 alc_mic_automute(codec);
18319 #define alc663_mode7_setup alc663_mode1_setup
18321 static void alc663_mode7_inithook(struct hda_codec *codec)
18323 alc663_two_hp_m7_speaker_automute(codec);
18324 alc_mic_automute(codec);
18327 /* ***************** Mode8 ******************************/
18328 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18331 switch (res >> 26) {
18332 case ALC880_HP_EVENT:
18333 alc663_two_hp_m8_speaker_automute(codec);
18335 case ALC880_MIC_EVENT:
18336 alc_mic_automute(codec);
18341 #define alc663_mode8_setup alc663_m51va_setup
18343 static void alc663_mode8_inithook(struct hda_codec *codec)
18345 alc663_two_hp_m8_speaker_automute(codec);
18346 alc_mic_automute(codec);
18349 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18351 unsigned int present;
18352 unsigned char bits;
18354 present = snd_hda_jack_detect(codec, 0x21);
18355 bits = present ? HDA_AMP_MUTE : 0;
18356 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18357 HDA_AMP_MUTE, bits);
18358 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18359 HDA_AMP_MUTE, bits);
18362 static void alc663_g71v_front_automute(struct hda_codec *codec)
18364 unsigned int present;
18365 unsigned char bits;
18367 present = snd_hda_jack_detect(codec, 0x15);
18368 bits = present ? HDA_AMP_MUTE : 0;
18369 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18370 HDA_AMP_MUTE, bits);
18373 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18376 switch (res >> 26) {
18377 case ALC880_HP_EVENT:
18378 alc663_g71v_hp_automute(codec);
18380 case ALC880_FRONT_EVENT:
18381 alc663_g71v_front_automute(codec);
18383 case ALC880_MIC_EVENT:
18384 alc_mic_automute(codec);
18389 #define alc663_g71v_setup alc663_m51va_setup
18391 static void alc663_g71v_inithook(struct hda_codec *codec)
18393 alc663_g71v_front_automute(codec);
18394 alc663_g71v_hp_automute(codec);
18395 alc_mic_automute(codec);
18398 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18401 switch (res >> 26) {
18402 case ALC880_HP_EVENT:
18403 alc663_m51va_speaker_automute(codec);
18405 case ALC880_MIC_EVENT:
18406 alc_mic_automute(codec);
18411 #define alc663_g50v_setup alc663_m51va_setup
18413 static void alc663_g50v_inithook(struct hda_codec *codec)
18415 alc663_m51va_speaker_automute(codec);
18416 alc_mic_automute(codec);
18419 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18420 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18421 ALC262_HIPPO_MASTER_SWITCH,
18423 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
18424 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18425 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18427 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
18428 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18429 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18433 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18434 /* Master Playback automatically created from Speaker and Headphone */
18435 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18436 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18437 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18438 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18440 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18441 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18442 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
18444 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18445 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18446 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
18450 #ifdef CONFIG_SND_HDA_POWER_SAVE
18451 #define alc662_loopbacks alc880_loopbacks
18455 /* pcm configuration: identical with ALC880 */
18456 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18457 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18458 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18459 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18462 * configuration and preset
18464 static const char *alc662_models[ALC662_MODEL_LAST] = {
18465 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18466 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18467 [ALC662_3ST_6ch] = "3stack-6ch",
18468 [ALC662_5ST_DIG] = "6stack-dig",
18469 [ALC662_LENOVO_101E] = "lenovo-101e",
18470 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18471 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18472 [ALC662_ECS] = "ecs",
18473 [ALC663_ASUS_M51VA] = "m51va",
18474 [ALC663_ASUS_G71V] = "g71v",
18475 [ALC663_ASUS_H13] = "h13",
18476 [ALC663_ASUS_G50V] = "g50v",
18477 [ALC663_ASUS_MODE1] = "asus-mode1",
18478 [ALC662_ASUS_MODE2] = "asus-mode2",
18479 [ALC663_ASUS_MODE3] = "asus-mode3",
18480 [ALC663_ASUS_MODE4] = "asus-mode4",
18481 [ALC663_ASUS_MODE5] = "asus-mode5",
18482 [ALC663_ASUS_MODE6] = "asus-mode6",
18483 [ALC663_ASUS_MODE7] = "asus-mode7",
18484 [ALC663_ASUS_MODE8] = "asus-mode8",
18485 [ALC272_DELL] = "dell",
18486 [ALC272_DELL_ZM1] = "dell-zm1",
18487 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18488 [ALC662_AUTO] = "auto",
18491 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18492 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18493 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18494 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18495 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18496 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18497 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18498 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18499 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18500 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18501 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18502 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18503 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18504 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18505 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18506 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18507 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18508 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18509 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18510 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18511 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18512 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18513 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18514 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18515 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18516 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18517 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18518 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18519 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18520 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18521 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18522 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18523 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18524 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18525 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18526 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18527 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18528 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18529 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18530 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18531 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18532 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18533 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18534 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18535 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18536 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18537 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18538 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18539 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18540 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18541 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18542 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18543 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18544 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18545 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18546 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18547 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18548 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18549 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18550 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18551 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18552 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18553 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18554 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18555 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18556 ALC662_3ST_6ch_DIG),
18557 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18558 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18559 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18560 ALC662_3ST_6ch_DIG),
18561 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18562 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18563 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18564 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18565 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18566 ALC662_3ST_6ch_DIG),
18567 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18572 static struct alc_config_preset alc662_presets[] = {
18573 [ALC662_3ST_2ch_DIG] = {
18574 .mixers = { alc662_3ST_2ch_mixer },
18575 .init_verbs = { alc662_init_verbs },
18576 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18577 .dac_nids = alc662_dac_nids,
18578 .dig_out_nid = ALC662_DIGOUT_NID,
18579 .dig_in_nid = ALC662_DIGIN_NID,
18580 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18581 .channel_mode = alc662_3ST_2ch_modes,
18582 .input_mux = &alc662_capture_source,
18584 [ALC662_3ST_6ch_DIG] = {
18585 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18586 .init_verbs = { alc662_init_verbs },
18587 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18588 .dac_nids = alc662_dac_nids,
18589 .dig_out_nid = ALC662_DIGOUT_NID,
18590 .dig_in_nid = ALC662_DIGIN_NID,
18591 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18592 .channel_mode = alc662_3ST_6ch_modes,
18594 .input_mux = &alc662_capture_source,
18596 [ALC662_3ST_6ch] = {
18597 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18598 .init_verbs = { alc662_init_verbs },
18599 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18600 .dac_nids = alc662_dac_nids,
18601 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18602 .channel_mode = alc662_3ST_6ch_modes,
18604 .input_mux = &alc662_capture_source,
18606 [ALC662_5ST_DIG] = {
18607 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18608 .init_verbs = { alc662_init_verbs },
18609 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18610 .dac_nids = alc662_dac_nids,
18611 .dig_out_nid = ALC662_DIGOUT_NID,
18612 .dig_in_nid = ALC662_DIGIN_NID,
18613 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18614 .channel_mode = alc662_5stack_modes,
18615 .input_mux = &alc662_capture_source,
18617 [ALC662_LENOVO_101E] = {
18618 .mixers = { alc662_lenovo_101e_mixer },
18619 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18620 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18621 .dac_nids = alc662_dac_nids,
18622 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18623 .channel_mode = alc662_3ST_2ch_modes,
18624 .input_mux = &alc662_lenovo_101e_capture_source,
18625 .unsol_event = alc662_lenovo_101e_unsol_event,
18626 .init_hook = alc662_lenovo_101e_all_automute,
18628 [ALC662_ASUS_EEEPC_P701] = {
18629 .mixers = { alc662_eeepc_p701_mixer },
18630 .init_verbs = { alc662_init_verbs,
18631 alc662_eeepc_sue_init_verbs },
18632 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18633 .dac_nids = alc662_dac_nids,
18634 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18635 .channel_mode = alc662_3ST_2ch_modes,
18636 .unsol_event = alc662_eeepc_unsol_event,
18637 .setup = alc662_eeepc_setup,
18638 .init_hook = alc662_eeepc_inithook,
18640 [ALC662_ASUS_EEEPC_EP20] = {
18641 .mixers = { alc662_eeepc_ep20_mixer,
18642 alc662_chmode_mixer },
18643 .init_verbs = { alc662_init_verbs,
18644 alc662_eeepc_ep20_sue_init_verbs },
18645 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18646 .dac_nids = alc662_dac_nids,
18647 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18648 .channel_mode = alc662_3ST_6ch_modes,
18649 .input_mux = &alc662_lenovo_101e_capture_source,
18650 .unsol_event = alc662_eeepc_unsol_event,
18651 .setup = alc662_eeepc_ep20_setup,
18652 .init_hook = alc662_eeepc_ep20_inithook,
18655 .mixers = { alc662_ecs_mixer },
18656 .init_verbs = { alc662_init_verbs,
18657 alc662_ecs_init_verbs },
18658 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18659 .dac_nids = alc662_dac_nids,
18660 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18661 .channel_mode = alc662_3ST_2ch_modes,
18662 .unsol_event = alc662_eeepc_unsol_event,
18663 .setup = alc662_eeepc_setup,
18664 .init_hook = alc662_eeepc_inithook,
18666 [ALC663_ASUS_M51VA] = {
18667 .mixers = { alc663_m51va_mixer },
18668 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18669 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18670 .dac_nids = alc662_dac_nids,
18671 .dig_out_nid = ALC662_DIGOUT_NID,
18672 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18673 .channel_mode = alc662_3ST_2ch_modes,
18674 .unsol_event = alc663_m51va_unsol_event,
18675 .setup = alc663_m51va_setup,
18676 .init_hook = alc663_m51va_inithook,
18678 [ALC663_ASUS_G71V] = {
18679 .mixers = { alc663_g71v_mixer },
18680 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18681 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18682 .dac_nids = alc662_dac_nids,
18683 .dig_out_nid = ALC662_DIGOUT_NID,
18684 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18685 .channel_mode = alc662_3ST_2ch_modes,
18686 .unsol_event = alc663_g71v_unsol_event,
18687 .setup = alc663_g71v_setup,
18688 .init_hook = alc663_g71v_inithook,
18690 [ALC663_ASUS_H13] = {
18691 .mixers = { alc663_m51va_mixer },
18692 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18693 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18694 .dac_nids = alc662_dac_nids,
18695 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18696 .channel_mode = alc662_3ST_2ch_modes,
18697 .unsol_event = alc663_m51va_unsol_event,
18698 .init_hook = alc663_m51va_inithook,
18700 [ALC663_ASUS_G50V] = {
18701 .mixers = { alc663_g50v_mixer },
18702 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18703 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18704 .dac_nids = alc662_dac_nids,
18705 .dig_out_nid = ALC662_DIGOUT_NID,
18706 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18707 .channel_mode = alc662_3ST_6ch_modes,
18708 .input_mux = &alc663_capture_source,
18709 .unsol_event = alc663_g50v_unsol_event,
18710 .setup = alc663_g50v_setup,
18711 .init_hook = alc663_g50v_inithook,
18713 [ALC663_ASUS_MODE1] = {
18714 .mixers = { alc663_m51va_mixer },
18715 .cap_mixer = alc662_auto_capture_mixer,
18716 .init_verbs = { alc662_init_verbs,
18717 alc663_21jd_amic_init_verbs },
18718 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18720 .dac_nids = alc662_dac_nids,
18721 .dig_out_nid = ALC662_DIGOUT_NID,
18722 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18723 .channel_mode = alc662_3ST_2ch_modes,
18724 .unsol_event = alc663_mode1_unsol_event,
18725 .setup = alc663_mode1_setup,
18726 .init_hook = alc663_mode1_inithook,
18728 [ALC662_ASUS_MODE2] = {
18729 .mixers = { alc662_1bjd_mixer },
18730 .cap_mixer = alc662_auto_capture_mixer,
18731 .init_verbs = { alc662_init_verbs,
18732 alc662_1bjd_amic_init_verbs },
18733 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18734 .dac_nids = alc662_dac_nids,
18735 .dig_out_nid = ALC662_DIGOUT_NID,
18736 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18737 .channel_mode = alc662_3ST_2ch_modes,
18738 .unsol_event = alc662_mode2_unsol_event,
18739 .setup = alc662_mode2_setup,
18740 .init_hook = alc662_mode2_inithook,
18742 [ALC663_ASUS_MODE3] = {
18743 .mixers = { alc663_two_hp_m1_mixer },
18744 .cap_mixer = alc662_auto_capture_mixer,
18745 .init_verbs = { alc662_init_verbs,
18746 alc663_two_hp_amic_m1_init_verbs },
18747 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18749 .dac_nids = alc662_dac_nids,
18750 .dig_out_nid = ALC662_DIGOUT_NID,
18751 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18752 .channel_mode = alc662_3ST_2ch_modes,
18753 .unsol_event = alc663_mode3_unsol_event,
18754 .setup = alc663_mode3_setup,
18755 .init_hook = alc663_mode3_inithook,
18757 [ALC663_ASUS_MODE4] = {
18758 .mixers = { alc663_asus_21jd_clfe_mixer },
18759 .cap_mixer = alc662_auto_capture_mixer,
18760 .init_verbs = { alc662_init_verbs,
18761 alc663_21jd_amic_init_verbs},
18762 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18764 .dac_nids = alc662_dac_nids,
18765 .dig_out_nid = ALC662_DIGOUT_NID,
18766 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18767 .channel_mode = alc662_3ST_2ch_modes,
18768 .unsol_event = alc663_mode4_unsol_event,
18769 .setup = alc663_mode4_setup,
18770 .init_hook = alc663_mode4_inithook,
18772 [ALC663_ASUS_MODE5] = {
18773 .mixers = { alc663_asus_15jd_clfe_mixer },
18774 .cap_mixer = alc662_auto_capture_mixer,
18775 .init_verbs = { alc662_init_verbs,
18776 alc663_15jd_amic_init_verbs },
18777 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18779 .dac_nids = alc662_dac_nids,
18780 .dig_out_nid = ALC662_DIGOUT_NID,
18781 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18782 .channel_mode = alc662_3ST_2ch_modes,
18783 .unsol_event = alc663_mode5_unsol_event,
18784 .setup = alc663_mode5_setup,
18785 .init_hook = alc663_mode5_inithook,
18787 [ALC663_ASUS_MODE6] = {
18788 .mixers = { alc663_two_hp_m2_mixer },
18789 .cap_mixer = alc662_auto_capture_mixer,
18790 .init_verbs = { alc662_init_verbs,
18791 alc663_two_hp_amic_m2_init_verbs },
18792 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18794 .dac_nids = alc662_dac_nids,
18795 .dig_out_nid = ALC662_DIGOUT_NID,
18796 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18797 .channel_mode = alc662_3ST_2ch_modes,
18798 .unsol_event = alc663_mode6_unsol_event,
18799 .setup = alc663_mode6_setup,
18800 .init_hook = alc663_mode6_inithook,
18802 [ALC663_ASUS_MODE7] = {
18803 .mixers = { alc663_mode7_mixer },
18804 .cap_mixer = alc662_auto_capture_mixer,
18805 .init_verbs = { alc662_init_verbs,
18806 alc663_mode7_init_verbs },
18807 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18809 .dac_nids = alc662_dac_nids,
18810 .dig_out_nid = ALC662_DIGOUT_NID,
18811 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18812 .channel_mode = alc662_3ST_2ch_modes,
18813 .unsol_event = alc663_mode7_unsol_event,
18814 .setup = alc663_mode7_setup,
18815 .init_hook = alc663_mode7_inithook,
18817 [ALC663_ASUS_MODE8] = {
18818 .mixers = { alc663_mode8_mixer },
18819 .cap_mixer = alc662_auto_capture_mixer,
18820 .init_verbs = { alc662_init_verbs,
18821 alc663_mode8_init_verbs },
18822 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18824 .dac_nids = alc662_dac_nids,
18825 .dig_out_nid = ALC662_DIGOUT_NID,
18826 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18827 .channel_mode = alc662_3ST_2ch_modes,
18828 .unsol_event = alc663_mode8_unsol_event,
18829 .setup = alc663_mode8_setup,
18830 .init_hook = alc663_mode8_inithook,
18833 .mixers = { alc663_m51va_mixer },
18834 .cap_mixer = alc272_auto_capture_mixer,
18835 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18836 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18837 .dac_nids = alc662_dac_nids,
18838 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18839 .adc_nids = alc272_adc_nids,
18840 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18841 .capsrc_nids = alc272_capsrc_nids,
18842 .channel_mode = alc662_3ST_2ch_modes,
18843 .unsol_event = alc663_m51va_unsol_event,
18844 .setup = alc663_m51va_setup,
18845 .init_hook = alc663_m51va_inithook,
18847 [ALC272_DELL_ZM1] = {
18848 .mixers = { alc663_m51va_mixer },
18849 .cap_mixer = alc662_auto_capture_mixer,
18850 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18851 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18852 .dac_nids = alc662_dac_nids,
18853 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18854 .adc_nids = alc662_adc_nids,
18856 .capsrc_nids = alc662_capsrc_nids,
18857 .channel_mode = alc662_3ST_2ch_modes,
18858 .unsol_event = alc663_m51va_unsol_event,
18859 .setup = alc663_m51va_setup,
18860 .init_hook = alc663_m51va_inithook,
18862 [ALC272_SAMSUNG_NC10] = {
18863 .mixers = { alc272_nc10_mixer },
18864 .init_verbs = { alc662_init_verbs,
18865 alc663_21jd_amic_init_verbs },
18866 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18867 .dac_nids = alc272_dac_nids,
18868 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18869 .channel_mode = alc662_3ST_2ch_modes,
18870 /*.input_mux = &alc272_nc10_capture_source,*/
18871 .unsol_event = alc663_mode4_unsol_event,
18872 .setup = alc663_mode4_setup,
18873 .init_hook = alc663_mode4_inithook,
18879 * BIOS auto configuration
18882 /* convert from MIX nid to DAC */
18883 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18887 else if (nid >= 0x0c && nid <= 0x0e)
18888 return nid - 0x0c + 0x02;
18893 /* get MIX nid connected to the given pin targeted to DAC */
18894 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18900 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18901 for (i = 0; i < num; i++) {
18902 if (alc662_mix_to_dac(mix[i]) == dac)
18908 /* look for an empty DAC slot */
18909 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18911 struct alc_spec *spec = codec->spec;
18915 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18918 for (i = 0; i < num; i++) {
18919 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18922 for (j = 0; j < spec->multiout.num_dacs; j++)
18923 if (spec->multiout.dac_nids[j] == nid)
18925 if (j >= spec->multiout.num_dacs)
18931 /* fill in the dac_nids table from the parsed pin configuration */
18932 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18933 const struct auto_pin_cfg *cfg)
18935 struct alc_spec *spec = codec->spec;
18939 spec->multiout.dac_nids = spec->private_dac_nids;
18940 for (i = 0; i < cfg->line_outs; i++) {
18941 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18944 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18949 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18950 hda_nid_t nid, unsigned int chs)
18952 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18953 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18956 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18957 hda_nid_t nid, unsigned int chs)
18959 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18960 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18963 #define alc662_add_stereo_vol(spec, pfx, nid) \
18964 alc662_add_vol_ctl(spec, pfx, nid, 3)
18965 #define alc662_add_stereo_sw(spec, pfx, nid) \
18966 alc662_add_sw_ctl(spec, pfx, nid, 3)
18968 /* add playback controls from the parsed DAC table */
18969 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18970 const struct auto_pin_cfg *cfg)
18972 struct alc_spec *spec = codec->spec;
18973 static const char *chname[4] = {
18974 "Front", "Surround", NULL /*CLFE*/, "Side"
18976 hda_nid_t nid, mix;
18979 for (i = 0; i < cfg->line_outs; i++) {
18980 nid = spec->multiout.dac_nids[i];
18983 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18988 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18991 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18994 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18997 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19002 if (cfg->line_outs == 1 &&
19003 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
19010 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19013 if (cfg->line_outs == 1 &&
19014 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19016 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19024 /* add playback controls for speaker and HP outputs */
19025 /* return DAC nid if any new DAC is assigned */
19026 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19029 struct alc_spec *spec = codec->spec;
19030 hda_nid_t nid, mix;
19035 nid = alc662_look_for_dac(codec, pin);
19037 /* the corresponding DAC is already occupied */
19038 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19039 return 0; /* no way */
19040 /* create a switch only */
19041 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19042 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19045 mix = alc662_dac_to_mix(codec, pin, nid);
19048 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19051 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19057 /* create playback/capture controls for input pins */
19058 #define alc662_auto_create_input_ctls \
19059 alc882_auto_create_input_ctls
19061 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19062 hda_nid_t nid, int pin_type,
19066 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19068 alc_set_pin_output(codec, nid, pin_type);
19069 /* need the manual connection? */
19070 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19073 for (i = 0; i < num; i++) {
19074 if (alc662_mix_to_dac(srcs[i]) != dac)
19076 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19081 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19083 struct alc_spec *spec = codec->spec;
19084 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19087 for (i = 0; i <= HDA_SIDE; i++) {
19088 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19090 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19091 spec->multiout.dac_nids[i]);
19095 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19097 struct alc_spec *spec = codec->spec;
19100 pin = spec->autocfg.hp_pins[0];
19102 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19103 spec->multiout.hp_nid);
19104 pin = spec->autocfg.speaker_pins[0];
19106 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19107 spec->multiout.extra_out_nid[0]);
19110 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19112 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19114 struct alc_spec *spec = codec->spec;
19115 struct auto_pin_cfg *cfg = &spec->autocfg;
19118 for (i = 0; i < cfg->num_inputs; i++) {
19119 hda_nid_t nid = cfg->inputs[i].pin;
19120 if (alc_is_input_pin(codec, nid)) {
19121 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19122 if (nid != ALC662_PIN_CD_NID &&
19123 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19124 snd_hda_codec_write(codec, nid, 0,
19125 AC_VERB_SET_AMP_GAIN_MUTE,
19131 #define alc662_auto_init_input_src alc882_auto_init_input_src
19133 static int alc662_parse_auto_config(struct hda_codec *codec)
19135 struct alc_spec *spec = codec->spec;
19137 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19139 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19143 if (!spec->autocfg.line_outs)
19144 return 0; /* can't find valid BIOS pin config */
19146 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19149 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19152 err = alc662_auto_create_extra_out(codec,
19153 spec->autocfg.speaker_pins[0],
19158 spec->multiout.extra_out_nid[0] = err;
19159 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19164 spec->multiout.hp_nid = err;
19165 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19169 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19171 alc_auto_parse_digital(codec);
19173 if (spec->kctls.list)
19174 add_mixer(spec, spec->kctls.list);
19176 spec->num_mux_defs = 1;
19177 spec->input_mux = &spec->private_imux[0];
19179 add_verb(spec, alc662_init_verbs);
19180 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19181 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19182 add_verb(spec, alc663_init_verbs);
19184 if (codec->vendor_id == 0x10ec0272)
19185 add_verb(spec, alc272_init_verbs);
19187 err = alc_auto_add_mic_boost(codec);
19191 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19192 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19193 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19195 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19200 /* additional initialization for auto-configuration model */
19201 static void alc662_auto_init(struct hda_codec *codec)
19203 struct alc_spec *spec = codec->spec;
19204 alc662_auto_init_multi_out(codec);
19205 alc662_auto_init_hp_out(codec);
19206 alc662_auto_init_analog_input(codec);
19207 alc662_auto_init_input_src(codec);
19208 alc_auto_init_digital(codec);
19209 if (spec->unsol_event)
19210 alc_inithook(codec);
19214 ALC662_FIXUP_IDEAPAD,
19217 static const struct alc_fixup alc662_fixups[] = {
19218 [ALC662_FIXUP_IDEAPAD] = {
19219 .pins = (const struct alc_pincfg[]) {
19220 { 0x17, 0x99130112 }, /* subwoofer */
19226 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19227 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19233 static int patch_alc662(struct hda_codec *codec)
19235 struct alc_spec *spec;
19236 int err, board_config;
19238 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19242 codec->spec = spec;
19244 alc_auto_parse_customize_define(codec);
19246 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19248 if (alc_read_coef_idx(codec, 0) == 0x8020)
19249 alc_codec_rename(codec, "ALC661");
19250 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
19251 codec->bus->pci->subsystem_vendor == 0x1025 &&
19252 spec->cdefine.platform_type == 1)
19253 alc_codec_rename(codec, "ALC272X");
19255 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19258 if (board_config < 0) {
19259 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19261 board_config = ALC662_AUTO;
19264 if (board_config == ALC662_AUTO) {
19265 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1);
19266 /* automatic parse from the BIOS config */
19267 err = alc662_parse_auto_config(codec);
19273 "hda_codec: Cannot set up configuration "
19274 "from BIOS. Using base mode...\n");
19275 board_config = ALC662_3ST_2ch_DIG;
19279 if (has_cdefine_beep(codec)) {
19280 err = snd_hda_attach_beep_device(codec, 0x1);
19287 if (board_config != ALC662_AUTO)
19288 setup_preset(codec, &alc662_presets[board_config]);
19290 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19291 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19293 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19294 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19296 if (!spec->adc_nids) {
19297 spec->adc_nids = alc662_adc_nids;
19298 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19300 if (!spec->capsrc_nids)
19301 spec->capsrc_nids = alc662_capsrc_nids;
19303 if (!spec->cap_mixer)
19304 set_capture_mixer(codec);
19306 if (has_cdefine_beep(codec)) {
19307 switch (codec->vendor_id) {
19309 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19314 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19317 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19321 spec->vmaster_nid = 0x02;
19323 codec->patch_ops = alc_patch_ops;
19324 if (board_config == ALC662_AUTO) {
19325 spec->init_hook = alc662_auto_init;
19326 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0);
19329 #ifdef CONFIG_SND_HDA_POWER_SAVE
19330 if (!spec->loopback.amplist)
19331 spec->loopback.amplist = alc662_loopbacks;
19337 static int patch_alc888(struct hda_codec *codec)
19339 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19340 kfree(codec->chip_name);
19341 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19342 if (!codec->chip_name) {
19346 return patch_alc662(codec);
19348 return patch_alc882(codec);
19354 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19355 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19356 #define alc680_modes alc260_modes
19358 static hda_nid_t alc680_dac_nids[3] = {
19359 /* Lout1, Lout2, hp */
19363 static hda_nid_t alc680_adc_nids[3] = {
19365 /* DMIC, MIC, Line-in*/
19370 * Analog capture ADC cgange
19372 static void alc680_rec_autoswitch(struct hda_codec *codec)
19374 struct alc_spec *spec = codec->spec;
19375 struct auto_pin_cfg *cfg = &spec->autocfg;
19377 int type_found = AUTO_PIN_LAST;
19381 for (i = 0; i < cfg->num_inputs; i++) {
19382 nid = cfg->inputs[i].pin;
19383 if (!(snd_hda_query_pin_caps(codec, nid) &
19384 AC_PINCAP_PRES_DETECT))
19386 if (snd_hda_jack_detect(codec, nid)) {
19387 if (cfg->inputs[i].type < type_found) {
19388 type_found = cfg->inputs[i].type;
19396 snd_hda_get_connections(codec, pin_found, &nid, 1);
19398 if (nid != spec->cur_adc)
19399 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19400 spec->cur_adc = nid;
19401 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19402 spec->cur_adc_format);
19405 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19406 struct hda_codec *codec,
19407 unsigned int stream_tag,
19408 unsigned int format,
19409 struct snd_pcm_substream *substream)
19411 struct alc_spec *spec = codec->spec;
19413 spec->cur_adc = 0x07;
19414 spec->cur_adc_stream_tag = stream_tag;
19415 spec->cur_adc_format = format;
19417 alc680_rec_autoswitch(codec);
19421 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19422 struct hda_codec *codec,
19423 struct snd_pcm_substream *substream)
19425 snd_hda_codec_cleanup_stream(codec, 0x07);
19426 snd_hda_codec_cleanup_stream(codec, 0x08);
19427 snd_hda_codec_cleanup_stream(codec, 0x09);
19431 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19432 .substreams = 1, /* can be overridden */
19435 /* NID is set in alc_build_pcms */
19437 .prepare = alc680_capture_pcm_prepare,
19438 .cleanup = alc680_capture_pcm_cleanup
19442 static struct snd_kcontrol_new alc680_base_mixer[] = {
19443 /* output mixer control */
19444 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19445 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19446 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19447 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19448 HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT),
19449 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
19450 HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT),
19454 static struct hda_bind_ctls alc680_bind_cap_vol = {
19455 .ops = &snd_hda_bind_vol,
19457 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19458 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19459 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19464 static struct hda_bind_ctls alc680_bind_cap_switch = {
19465 .ops = &snd_hda_bind_sw,
19467 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19468 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19469 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19474 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19475 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19476 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19481 * generic initialization of ADC, input mixers and output mixers
19483 static struct hda_verb alc680_init_verbs[] = {
19484 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19485 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19486 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19488 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19489 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19490 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19491 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19492 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19493 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19495 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19496 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19497 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19498 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19499 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19501 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19502 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19503 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19508 /* toggle speaker-output according to the hp-jack state */
19509 static void alc680_base_setup(struct hda_codec *codec)
19511 struct alc_spec *spec = codec->spec;
19513 spec->autocfg.hp_pins[0] = 0x16;
19514 spec->autocfg.speaker_pins[0] = 0x14;
19515 spec->autocfg.speaker_pins[1] = 0x15;
19516 spec->autocfg.num_inputs = 2;
19517 spec->autocfg.inputs[0].pin = 0x18;
19518 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19519 spec->autocfg.inputs[1].pin = 0x19;
19520 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19523 static void alc680_unsol_event(struct hda_codec *codec,
19526 if ((res >> 26) == ALC880_HP_EVENT)
19527 alc_automute_amp(codec);
19528 if ((res >> 26) == ALC880_MIC_EVENT)
19529 alc680_rec_autoswitch(codec);
19532 static void alc680_inithook(struct hda_codec *codec)
19534 alc_automute_amp(codec);
19535 alc680_rec_autoswitch(codec);
19538 /* create input playback/capture controls for the given pin */
19539 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19540 const char *ctlname, int idx)
19558 if (spec->multiout.dac_nids[0] != dac &&
19559 spec->multiout.dac_nids[1] != dac) {
19560 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19561 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19566 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19567 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19571 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19577 /* add playback controls from the parsed DAC table */
19578 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19579 const struct auto_pin_cfg *cfg)
19584 spec->multiout.dac_nids = spec->private_dac_nids;
19586 nid = cfg->line_out_pins[0];
19589 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19593 err = alc680_new_analog_output(spec, nid, name, 0);
19598 nid = cfg->speaker_pins[0];
19600 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19604 nid = cfg->hp_pins[0];
19606 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19614 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19615 hda_nid_t nid, int pin_type)
19617 alc_set_pin_output(codec, nid, pin_type);
19620 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19622 struct alc_spec *spec = codec->spec;
19623 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19625 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19626 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19630 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19632 struct alc_spec *spec = codec->spec;
19635 pin = spec->autocfg.hp_pins[0];
19637 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19638 pin = spec->autocfg.speaker_pins[0];
19640 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19643 /* pcm configuration: identical with ALC880 */
19644 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19645 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19646 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19647 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19648 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19651 * BIOS auto configuration
19653 static int alc680_parse_auto_config(struct hda_codec *codec)
19655 struct alc_spec *spec = codec->spec;
19657 static hda_nid_t alc680_ignore[] = { 0 };
19659 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19664 if (!spec->autocfg.line_outs) {
19665 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19666 spec->multiout.max_channels = 2;
19667 spec->no_analog = 1;
19670 return 0; /* can't find valid BIOS pin config */
19672 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19676 spec->multiout.max_channels = 2;
19679 /* digital only support output */
19680 alc_auto_parse_digital(codec);
19681 if (spec->kctls.list)
19682 add_mixer(spec, spec->kctls.list);
19684 add_verb(spec, alc680_init_verbs);
19686 err = alc_auto_add_mic_boost(codec);
19693 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19695 /* init callback for auto-configuration model -- overriding the default init */
19696 static void alc680_auto_init(struct hda_codec *codec)
19698 struct alc_spec *spec = codec->spec;
19699 alc680_auto_init_multi_out(codec);
19700 alc680_auto_init_hp_out(codec);
19701 alc680_auto_init_analog_input(codec);
19702 alc_auto_init_digital(codec);
19703 if (spec->unsol_event)
19704 alc_inithook(codec);
19708 * configuration and preset
19710 static const char *alc680_models[ALC680_MODEL_LAST] = {
19711 [ALC680_BASE] = "base",
19712 [ALC680_AUTO] = "auto",
19715 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19716 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19720 static struct alc_config_preset alc680_presets[] = {
19722 .mixers = { alc680_base_mixer },
19723 .cap_mixer = alc680_master_capture_mixer,
19724 .init_verbs = { alc680_init_verbs },
19725 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19726 .dac_nids = alc680_dac_nids,
19727 .dig_out_nid = ALC680_DIGOUT_NID,
19728 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19729 .channel_mode = alc680_modes,
19730 .unsol_event = alc680_unsol_event,
19731 .setup = alc680_base_setup,
19732 .init_hook = alc680_inithook,
19737 static int patch_alc680(struct hda_codec *codec)
19739 struct alc_spec *spec;
19743 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19747 codec->spec = spec;
19749 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19753 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19754 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19756 board_config = ALC680_AUTO;
19759 if (board_config == ALC680_AUTO) {
19760 /* automatic parse from the BIOS config */
19761 err = alc680_parse_auto_config(codec);
19767 "hda_codec: Cannot set up configuration "
19768 "from BIOS. Using base mode...\n");
19769 board_config = ALC680_BASE;
19773 if (board_config != ALC680_AUTO)
19774 setup_preset(codec, &alc680_presets[board_config]);
19776 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19777 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19778 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19779 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19781 if (!spec->adc_nids) {
19782 spec->adc_nids = alc680_adc_nids;
19783 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19786 if (!spec->cap_mixer)
19787 set_capture_mixer(codec);
19789 spec->vmaster_nid = 0x02;
19791 codec->patch_ops = alc_patch_ops;
19792 if (board_config == ALC680_AUTO)
19793 spec->init_hook = alc680_auto_init;
19801 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19802 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19803 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19804 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19805 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19806 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19807 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19808 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19809 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19810 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19811 .patch = patch_alc861 },
19812 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19813 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19814 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19815 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19816 .patch = patch_alc882 },
19817 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19818 .patch = patch_alc662 },
19819 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19820 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19821 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19822 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19823 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19824 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19825 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19826 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19827 .patch = patch_alc882 },
19828 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19829 .patch = patch_alc882 },
19830 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19831 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
19832 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19833 .patch = patch_alc882 },
19834 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19835 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19836 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19837 {} /* terminator */
19840 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19842 MODULE_LICENSE("GPL");
19843 MODULE_DESCRIPTION("Realtek HD-audio codec");
19845 static struct hda_codec_preset_list realtek_list = {
19846 .preset = snd_hda_preset_realtek,
19847 .owner = THIS_MODULE,
19850 static int __init patch_realtek_init(void)
19852 return snd_hda_add_codec_preset(&realtek_list);
19855 static void __exit patch_realtek_exit(void)
19857 snd_hda_delete_codec_preset(&realtek_list);
19860 module_init(patch_realtek_init)
19861 module_exit(patch_realtek_exit)