2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include <sound/jack.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
36 #define ALC880_FRONT_EVENT 0x01
37 #define ALC880_DCVOL_EVENT 0x02
38 #define ALC880_HP_EVENT 0x04
39 #define ALC880_MIC_EVENT 0x08
41 /* ALC880 board config type */
65 #ifdef CONFIG_SND_DEBUG
69 ALC880_MODEL_LAST /* last tag */
83 #ifdef CONFIG_SND_DEBUG
87 ALC260_MODEL_LAST /* last tag */
97 ALC262_HP_BPC_D7000_WL,
98 ALC262_HP_BPC_D7000_WF,
111 ALC262_MODEL_LAST /* last tag */
121 ALC268_ACER_ASPIRE_ONE,
124 #ifdef CONFIG_SND_DEBUG
128 ALC268_MODEL_LAST /* last tag */
143 ALC269_MODEL_LAST /* last tag */
160 /* ALC861-VD models */
182 ALC662_ASUS_EEEPC_P701,
183 ALC662_ASUS_EEEPC_EP20,
225 ALC883_TARGA_2ch_DIG,
226 ALC883_TARGA_8ch_DIG,
229 ALC888_ACER_ASPIRE_4930G,
230 ALC888_ACER_ASPIRE_6530G,
231 ALC888_ACER_ASPIRE_8930G,
232 ALC888_ACER_ASPIRE_7730G,
234 ALC883_MEDION_WIM2160,
236 ALC883_LENOVO_101E_2ch,
237 ALC883_LENOVO_NB0763,
238 ALC888_LENOVO_MS7195_DIG,
246 ALC883_FUJITSU_PI2515,
247 ALC888_FUJITSU_XA3530,
248 ALC883_3ST_6ch_INTEL,
268 #define GPIO_MASK 0x03
270 /* extra amp-initialization sequence types */
279 struct alc_mic_route {
281 unsigned char mux_idx;
282 unsigned char amix_idx;
288 struct snd_jack *jack;
291 #define MUX_IDX_UNDEF ((unsigned char)-1)
293 struct alc_customize_define {
294 unsigned int sku_cfg;
295 unsigned char port_connectivity;
296 unsigned char check_sum;
297 unsigned char customization;
298 unsigned char external_amp;
299 unsigned int enable_pcbeep:1;
300 unsigned int platform_type:1;
302 unsigned int override:1;
303 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
309 /* codec parameterization */
310 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
311 unsigned int num_mixers;
312 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
313 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
315 const struct hda_verb *init_verbs[10]; /* initialization verbs
319 unsigned int num_init_verbs;
321 char stream_name_analog[32]; /* analog PCM stream */
322 struct hda_pcm_stream *stream_analog_playback;
323 struct hda_pcm_stream *stream_analog_capture;
324 struct hda_pcm_stream *stream_analog_alt_playback;
325 struct hda_pcm_stream *stream_analog_alt_capture;
327 char stream_name_digital[32]; /* digital PCM stream */
328 struct hda_pcm_stream *stream_digital_playback;
329 struct hda_pcm_stream *stream_digital_capture;
332 struct hda_multi_out multiout; /* playback set-up
333 * max_channels, dacs must be set
334 * dig_out_nid and hp_nid are optional
336 hda_nid_t alt_dac_nid;
337 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
341 unsigned int num_adc_nids;
343 hda_nid_t *capsrc_nids;
344 hda_nid_t dig_in_nid; /* digital-in NID; optional */
346 /* capture setup for dynamic dual-adc switch */
347 unsigned int cur_adc_idx;
349 unsigned int cur_adc_stream_tag;
350 unsigned int cur_adc_format;
353 unsigned int num_mux_defs;
354 const struct hda_input_mux *input_mux;
355 unsigned int cur_mux[3];
356 struct alc_mic_route ext_mic;
357 struct alc_mic_route int_mic;
360 const struct hda_channel_mode *channel_mode;
361 int num_channel_mode;
363 int const_channel_count;
364 int ext_channel_count;
366 /* PCM information */
367 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
370 struct snd_array jacks;
372 /* dynamic controls, init_verbs and input_mux */
373 struct auto_pin_cfg autocfg;
374 struct alc_customize_define cdefine;
375 struct snd_array kctls;
376 struct hda_input_mux private_imux[3];
377 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
378 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
379 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
382 void (*init_hook)(struct hda_codec *codec);
383 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
384 #ifdef CONFIG_SND_HDA_POWER_SAVE
385 void (*power_hook)(struct hda_codec *codec);
388 /* for pin sensing */
389 unsigned int sense_updated: 1;
390 unsigned int jack_present: 1;
391 unsigned int master_sw: 1;
392 unsigned int auto_mic:1;
395 unsigned int no_analog :1; /* digital I/O only */
396 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
398 int codec_variant; /* flag for other variants */
400 /* for virtual master */
401 hda_nid_t vmaster_nid;
402 #ifdef CONFIG_SND_HDA_POWER_SAVE
403 struct hda_loopback_check loopback;
408 unsigned int pll_coef_idx, pll_coef_bit;
412 const struct alc_fixup *fixup_list;
413 const char *fixup_name;
417 * configuration template - to be copied to the spec instance
419 struct alc_config_preset {
420 struct snd_kcontrol_new *mixers[5]; /* should be identical size
423 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
424 const struct hda_verb *init_verbs[5];
425 unsigned int num_dacs;
427 hda_nid_t dig_out_nid; /* optional */
428 hda_nid_t hp_nid; /* optional */
429 hda_nid_t *slave_dig_outs;
430 unsigned int num_adc_nids;
432 hda_nid_t *capsrc_nids;
433 hda_nid_t dig_in_nid;
434 unsigned int num_channel_mode;
435 const struct hda_channel_mode *channel_mode;
437 int const_channel_count;
438 unsigned int num_mux_defs;
439 const struct hda_input_mux *input_mux;
440 void (*unsol_event)(struct hda_codec *, unsigned int);
441 void (*setup)(struct hda_codec *);
442 void (*init_hook)(struct hda_codec *);
443 #ifdef CONFIG_SND_HDA_POWER_SAVE
444 struct hda_amp_list *loopbacks;
445 void (*power_hook)(struct hda_codec *codec);
453 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
454 struct snd_ctl_elem_info *uinfo)
456 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
457 struct alc_spec *spec = codec->spec;
458 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
459 if (mux_idx >= spec->num_mux_defs)
461 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
463 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
466 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
467 struct snd_ctl_elem_value *ucontrol)
469 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
470 struct alc_spec *spec = codec->spec;
471 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
473 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
477 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol)
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct alc_spec *spec = codec->spec;
482 const struct hda_input_mux *imux;
483 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
484 unsigned int mux_idx;
485 hda_nid_t nid = spec->capsrc_nids ?
486 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
489 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
490 imux = &spec->input_mux[mux_idx];
491 if (!imux->num_items && mux_idx > 0)
492 imux = &spec->input_mux[0];
494 type = get_wcaps_type(get_wcaps(codec, nid));
495 if (type == AC_WID_AUD_MIX) {
496 /* Matrix-mixer style (e.g. ALC882) */
497 unsigned int *cur_val = &spec->cur_mux[adc_idx];
500 idx = ucontrol->value.enumerated.item[0];
501 if (idx >= imux->num_items)
502 idx = imux->num_items - 1;
505 for (i = 0; i < imux->num_items; i++) {
506 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
507 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
508 imux->items[i].index,
514 /* MUX style (e.g. ALC880) */
515 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
516 &spec->cur_mux[adc_idx]);
521 * channel mode setting
523 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
524 struct snd_ctl_elem_info *uinfo)
526 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
527 struct alc_spec *spec = codec->spec;
528 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
529 spec->num_channel_mode);
532 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
533 struct snd_ctl_elem_value *ucontrol)
535 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
536 struct alc_spec *spec = codec->spec;
537 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
538 spec->num_channel_mode,
539 spec->ext_channel_count);
542 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
543 struct snd_ctl_elem_value *ucontrol)
545 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
546 struct alc_spec *spec = codec->spec;
547 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
548 spec->num_channel_mode,
549 &spec->ext_channel_count);
550 if (err >= 0 && !spec->const_channel_count) {
551 spec->multiout.max_channels = spec->ext_channel_count;
552 if (spec->need_dac_fix)
553 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
559 * Control the mode of pin widget settings via the mixer. "pc" is used
560 * instead of "%" to avoid consequences of accidently treating the % as
561 * being part of a format specifier. Maximum allowed length of a value is
562 * 63 characters plus NULL terminator.
564 * Note: some retasking pin complexes seem to ignore requests for input
565 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
566 * are requested. Therefore order this list so that this behaviour will not
567 * cause problems when mixer clients move through the enum sequentially.
568 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
571 static char *alc_pin_mode_names[] = {
572 "Mic 50pc bias", "Mic 80pc bias",
573 "Line in", "Line out", "Headphone out",
575 static unsigned char alc_pin_mode_values[] = {
576 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
578 /* The control can present all 5 options, or it can limit the options based
579 * in the pin being assumed to be exclusively an input or an output pin. In
580 * addition, "input" pins may or may not process the mic bias option
581 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
582 * accept requests for bias as of chip versions up to March 2006) and/or
583 * wiring in the computer.
585 #define ALC_PIN_DIR_IN 0x00
586 #define ALC_PIN_DIR_OUT 0x01
587 #define ALC_PIN_DIR_INOUT 0x02
588 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
589 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
591 /* Info about the pin modes supported by the different pin direction modes.
592 * For each direction the minimum and maximum values are given.
594 static signed char alc_pin_mode_dir_info[5][2] = {
595 { 0, 2 }, /* ALC_PIN_DIR_IN */
596 { 3, 4 }, /* ALC_PIN_DIR_OUT */
597 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
598 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
599 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
601 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
602 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
603 #define alc_pin_mode_n_items(_dir) \
604 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
606 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
607 struct snd_ctl_elem_info *uinfo)
609 unsigned int item_num = uinfo->value.enumerated.item;
610 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
612 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
614 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
616 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
617 item_num = alc_pin_mode_min(dir);
618 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
622 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
623 struct snd_ctl_elem_value *ucontrol)
626 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
627 hda_nid_t nid = kcontrol->private_value & 0xffff;
628 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
629 long *valp = ucontrol->value.integer.value;
630 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
631 AC_VERB_GET_PIN_WIDGET_CONTROL,
634 /* Find enumerated value for current pinctl setting */
635 i = alc_pin_mode_min(dir);
636 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
638 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
642 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
643 struct snd_ctl_elem_value *ucontrol)
646 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
647 hda_nid_t nid = kcontrol->private_value & 0xffff;
648 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
649 long val = *ucontrol->value.integer.value;
650 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
651 AC_VERB_GET_PIN_WIDGET_CONTROL,
654 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
655 val = alc_pin_mode_min(dir);
657 change = pinctl != alc_pin_mode_values[val];
659 /* Set pin mode to that requested */
660 snd_hda_codec_write_cache(codec, nid, 0,
661 AC_VERB_SET_PIN_WIDGET_CONTROL,
662 alc_pin_mode_values[val]);
664 /* Also enable the retasking pin's input/output as required
665 * for the requested pin mode. Enum values of 2 or less are
668 * Dynamically switching the input/output buffers probably
669 * reduces noise slightly (particularly on input) so we'll
670 * do it. However, having both input and output buffers
671 * enabled simultaneously doesn't seem to be problematic if
672 * this turns out to be necessary in the future.
675 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
676 HDA_AMP_MUTE, HDA_AMP_MUTE);
677 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
680 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
681 HDA_AMP_MUTE, HDA_AMP_MUTE);
682 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
689 #define ALC_PIN_MODE(xname, nid, dir) \
690 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
691 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
692 .info = alc_pin_mode_info, \
693 .get = alc_pin_mode_get, \
694 .put = alc_pin_mode_put, \
695 .private_value = nid | (dir<<16) }
697 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
698 * together using a mask with more than one bit set. This control is
699 * currently used only by the ALC260 test model. At this stage they are not
700 * needed for any "production" models.
702 #ifdef CONFIG_SND_DEBUG
703 #define alc_gpio_data_info snd_ctl_boolean_mono_info
705 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
706 struct snd_ctl_elem_value *ucontrol)
708 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
709 hda_nid_t nid = kcontrol->private_value & 0xffff;
710 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
711 long *valp = ucontrol->value.integer.value;
712 unsigned int val = snd_hda_codec_read(codec, nid, 0,
713 AC_VERB_GET_GPIO_DATA, 0x00);
715 *valp = (val & mask) != 0;
718 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
719 struct snd_ctl_elem_value *ucontrol)
722 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
723 hda_nid_t nid = kcontrol->private_value & 0xffff;
724 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
725 long val = *ucontrol->value.integer.value;
726 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
727 AC_VERB_GET_GPIO_DATA,
730 /* Set/unset the masked GPIO bit(s) as needed */
731 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
736 snd_hda_codec_write_cache(codec, nid, 0,
737 AC_VERB_SET_GPIO_DATA, gpio_data);
741 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
742 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
743 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
744 .info = alc_gpio_data_info, \
745 .get = alc_gpio_data_get, \
746 .put = alc_gpio_data_put, \
747 .private_value = nid | (mask<<16) }
748 #endif /* CONFIG_SND_DEBUG */
750 /* A switch control to allow the enabling of the digital IO pins on the
751 * ALC260. This is incredibly simplistic; the intention of this control is
752 * to provide something in the test model allowing digital outputs to be
753 * identified if present. If models are found which can utilise these
754 * outputs a more complete mixer control can be devised for those models if
757 #ifdef CONFIG_SND_DEBUG
758 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
760 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
761 struct snd_ctl_elem_value *ucontrol)
763 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
764 hda_nid_t nid = kcontrol->private_value & 0xffff;
765 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
766 long *valp = ucontrol->value.integer.value;
767 unsigned int val = snd_hda_codec_read(codec, nid, 0,
768 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
770 *valp = (val & mask) != 0;
773 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
774 struct snd_ctl_elem_value *ucontrol)
777 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
778 hda_nid_t nid = kcontrol->private_value & 0xffff;
779 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
780 long val = *ucontrol->value.integer.value;
781 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
782 AC_VERB_GET_DIGI_CONVERT_1,
785 /* Set/unset the masked control bit(s) as needed */
786 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
791 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
796 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
797 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
798 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
799 .info = alc_spdif_ctrl_info, \
800 .get = alc_spdif_ctrl_get, \
801 .put = alc_spdif_ctrl_put, \
802 .private_value = nid | (mask<<16) }
803 #endif /* CONFIG_SND_DEBUG */
805 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
806 * Again, this is only used in the ALC26x test models to help identify when
807 * the EAPD line must be asserted for features to work.
809 #ifdef CONFIG_SND_DEBUG
810 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
812 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
813 struct snd_ctl_elem_value *ucontrol)
815 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
816 hda_nid_t nid = kcontrol->private_value & 0xffff;
817 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
818 long *valp = ucontrol->value.integer.value;
819 unsigned int val = snd_hda_codec_read(codec, nid, 0,
820 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
822 *valp = (val & mask) != 0;
826 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
827 struct snd_ctl_elem_value *ucontrol)
830 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
831 hda_nid_t nid = kcontrol->private_value & 0xffff;
832 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
833 long val = *ucontrol->value.integer.value;
834 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
835 AC_VERB_GET_EAPD_BTLENABLE,
838 /* Set/unset the masked control bit(s) as needed */
839 change = (!val ? 0 : mask) != (ctrl_data & mask);
844 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
850 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
851 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
852 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
853 .info = alc_eapd_ctrl_info, \
854 .get = alc_eapd_ctrl_get, \
855 .put = alc_eapd_ctrl_put, \
856 .private_value = nid | (mask<<16) }
857 #endif /* CONFIG_SND_DEBUG */
860 * set up the input pin config (depending on the given auto-pin type)
862 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
865 unsigned int val = PIN_IN;
867 if (auto_pin_type == AUTO_PIN_MIC) {
870 oldval = snd_hda_codec_read(codec, nid, 0,
871 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
872 pincap = snd_hda_query_pin_caps(codec, nid);
873 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
874 /* if the default pin setup is vref50, we give it priority */
875 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
877 else if (pincap & AC_PINCAP_VREF_50)
879 else if (pincap & AC_PINCAP_VREF_100)
881 else if (pincap & AC_PINCAP_VREF_GRD)
884 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
887 static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
889 struct alc_spec *spec = codec->spec;
890 struct auto_pin_cfg *cfg = &spec->autocfg;
892 if (!cfg->line_outs) {
893 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
894 cfg->line_out_pins[cfg->line_outs])
897 if (!cfg->speaker_outs) {
898 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
899 cfg->speaker_pins[cfg->speaker_outs])
903 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
904 cfg->hp_pins[cfg->hp_outs])
911 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
913 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
915 spec->mixers[spec->num_mixers++] = mix;
918 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
920 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
922 spec->init_verbs[spec->num_init_verbs++] = verb;
926 * set up from the preset table
928 static void setup_preset(struct hda_codec *codec,
929 const struct alc_config_preset *preset)
931 struct alc_spec *spec = codec->spec;
934 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
935 add_mixer(spec, preset->mixers[i]);
936 spec->cap_mixer = preset->cap_mixer;
937 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
939 add_verb(spec, preset->init_verbs[i]);
941 spec->channel_mode = preset->channel_mode;
942 spec->num_channel_mode = preset->num_channel_mode;
943 spec->need_dac_fix = preset->need_dac_fix;
944 spec->const_channel_count = preset->const_channel_count;
946 if (preset->const_channel_count)
947 spec->multiout.max_channels = preset->const_channel_count;
949 spec->multiout.max_channels = spec->channel_mode[0].channels;
950 spec->ext_channel_count = spec->channel_mode[0].channels;
952 spec->multiout.num_dacs = preset->num_dacs;
953 spec->multiout.dac_nids = preset->dac_nids;
954 spec->multiout.dig_out_nid = preset->dig_out_nid;
955 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
956 spec->multiout.hp_nid = preset->hp_nid;
958 spec->num_mux_defs = preset->num_mux_defs;
959 if (!spec->num_mux_defs)
960 spec->num_mux_defs = 1;
961 spec->input_mux = preset->input_mux;
963 spec->num_adc_nids = preset->num_adc_nids;
964 spec->adc_nids = preset->adc_nids;
965 spec->capsrc_nids = preset->capsrc_nids;
966 spec->dig_in_nid = preset->dig_in_nid;
968 spec->unsol_event = preset->unsol_event;
969 spec->init_hook = preset->init_hook;
970 #ifdef CONFIG_SND_HDA_POWER_SAVE
971 spec->power_hook = preset->power_hook;
972 spec->loopback.amplist = preset->loopbacks;
976 preset->setup(codec);
978 alc_fixup_autocfg_pin_nums(codec);
981 /* Enable GPIO mask and set output */
982 static struct hda_verb alc_gpio1_init_verbs[] = {
983 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
984 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
985 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
989 static struct hda_verb alc_gpio2_init_verbs[] = {
990 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
991 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
992 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
996 static struct hda_verb alc_gpio3_init_verbs[] = {
997 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
998 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
999 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
1004 * Fix hardware PLL issue
1005 * On some codecs, the analog PLL gating control must be off while
1006 * the default value is 1.
1008 static void alc_fix_pll(struct hda_codec *codec)
1010 struct alc_spec *spec = codec->spec;
1015 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1016 spec->pll_coef_idx);
1017 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1018 AC_VERB_GET_PROC_COEF, 0);
1019 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1020 spec->pll_coef_idx);
1021 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1022 val & ~(1 << spec->pll_coef_bit));
1025 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
1026 unsigned int coef_idx, unsigned int coef_bit)
1028 struct alc_spec *spec = codec->spec;
1029 spec->pll_nid = nid;
1030 spec->pll_coef_idx = coef_idx;
1031 spec->pll_coef_bit = coef_bit;
1035 #ifdef CONFIG_SND_HDA_INPUT_JACK
1036 static void alc_free_jack_priv(struct snd_jack *jack)
1038 struct alc_jack *jacks = jack->private_data;
1043 static int alc_add_jack(struct hda_codec *codec,
1044 hda_nid_t nid, int type)
1046 struct alc_spec *spec;
1047 struct alc_jack *jack;
1052 snd_array_init(&spec->jacks, sizeof(*jack), 32);
1053 jack = snd_array_new(&spec->jacks);
1059 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;
1061 err = snd_jack_new(codec->bus->card, name, type, &jack->jack);
1064 jack->jack->private_data = jack;
1065 jack->jack->private_free = alc_free_jack_priv;
1069 static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1071 struct alc_spec *spec = codec->spec;
1072 struct alc_jack *jacks = spec->jacks.list;
1076 for (i = 0; i < spec->jacks.used; i++) {
1077 if (jacks->nid == nid) {
1078 unsigned int present;
1079 present = snd_hda_jack_detect(codec, nid);
1081 present = (present) ? jacks->type : 0;
1083 snd_jack_report(jacks->jack, present);
1090 static int alc_init_jacks(struct hda_codec *codec)
1092 struct alc_spec *spec = codec->spec;
1094 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1095 unsigned int mic_nid = spec->ext_mic.pin;
1098 err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE);
1101 alc_report_jack(codec, hp_nid);
1105 err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE);
1108 alc_report_jack(codec, mic_nid);
1114 static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1118 static inline int alc_init_jacks(struct hda_codec *codec)
1124 static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1126 struct alc_spec *spec = codec->spec;
1131 spec->jack_present = 0;
1132 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1133 nid = spec->autocfg.hp_pins[i];
1136 alc_report_jack(codec, nid);
1137 spec->jack_present |= snd_hda_jack_detect(codec, nid);
1140 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1141 /* Toggle internal speakers muting */
1142 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1143 nid = spec->autocfg.speaker_pins[i];
1147 snd_hda_codec_write(codec, nid, 0,
1148 AC_VERB_SET_PIN_WIDGET_CONTROL,
1149 spec->jack_present ? 0 : PIN_OUT);
1151 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1152 HDA_AMP_MUTE, mute);
1157 static void alc_automute_pin(struct hda_codec *codec)
1159 alc_automute_speaker(codec, 1);
1162 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1165 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1168 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1169 for (i = 0; i < nums; i++)
1175 /* switch the current ADC according to the jack state */
1176 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1178 struct alc_spec *spec = codec->spec;
1179 unsigned int present;
1182 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1184 spec->cur_adc_idx = 1;
1186 spec->cur_adc_idx = 0;
1187 new_adc = spec->adc_nids[spec->cur_adc_idx];
1188 if (spec->cur_adc && spec->cur_adc != new_adc) {
1189 /* stream is running, let's swap the current ADC */
1190 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1191 spec->cur_adc = new_adc;
1192 snd_hda_codec_setup_stream(codec, new_adc,
1193 spec->cur_adc_stream_tag, 0,
1194 spec->cur_adc_format);
1198 static void alc_mic_automute(struct hda_codec *codec)
1200 struct alc_spec *spec = codec->spec;
1201 struct alc_mic_route *dead, *alive;
1202 unsigned int present, type;
1205 if (!spec->auto_mic)
1207 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1209 if (snd_BUG_ON(!spec->adc_nids))
1212 if (spec->dual_adc_switch) {
1213 alc_dual_mic_adc_auto_switch(codec);
1217 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1219 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1221 alive = &spec->ext_mic;
1222 dead = &spec->int_mic;
1224 alive = &spec->int_mic;
1225 dead = &spec->ext_mic;
1228 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1229 if (type == AC_WID_AUD_MIX) {
1230 /* Matrix-mixer style (e.g. ALC882) */
1231 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1234 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1236 HDA_AMP_MUTE, HDA_AMP_MUTE);
1238 /* MUX style (e.g. ALC880) */
1239 snd_hda_codec_write_cache(codec, cap_nid, 0,
1240 AC_VERB_SET_CONNECT_SEL,
1243 alc_report_jack(codec, spec->ext_mic.pin);
1245 /* FIXME: analog mixer */
1248 /* unsolicited event for HP jack sensing */
1249 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1251 if (codec->vendor_id == 0x10ec0880)
1256 case ALC880_HP_EVENT:
1257 alc_automute_pin(codec);
1259 case ALC880_MIC_EVENT:
1260 alc_mic_automute(codec);
1265 static void alc_inithook(struct hda_codec *codec)
1267 alc_automute_pin(codec);
1268 alc_mic_automute(codec);
1271 /* additional initialization for ALC888 variants */
1272 static void alc888_coef_init(struct hda_codec *codec)
1276 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1277 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1278 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1279 if ((tmp & 0xf0) == 0x20)
1281 snd_hda_codec_read(codec, 0x20, 0,
1282 AC_VERB_SET_PROC_COEF, 0x830);
1285 snd_hda_codec_read(codec, 0x20, 0,
1286 AC_VERB_SET_PROC_COEF, 0x3030);
1289 static void alc889_coef_init(struct hda_codec *codec)
1293 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1294 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1295 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1296 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1299 /* turn on/off EAPD control (only if available) */
1300 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1302 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1304 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1305 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1309 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1314 case ALC_INIT_GPIO1:
1315 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1317 case ALC_INIT_GPIO2:
1318 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1320 case ALC_INIT_GPIO3:
1321 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1323 case ALC_INIT_DEFAULT:
1324 switch (codec->vendor_id) {
1326 set_eapd(codec, 0x0f, 1);
1327 set_eapd(codec, 0x10, 1);
1340 set_eapd(codec, 0x14, 1);
1341 set_eapd(codec, 0x15, 1);
1344 switch (codec->vendor_id) {
1346 snd_hda_codec_write(codec, 0x1a, 0,
1347 AC_VERB_SET_COEF_INDEX, 7);
1348 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1349 AC_VERB_GET_PROC_COEF, 0);
1350 snd_hda_codec_write(codec, 0x1a, 0,
1351 AC_VERB_SET_COEF_INDEX, 7);
1352 snd_hda_codec_write(codec, 0x1a, 0,
1353 AC_VERB_SET_PROC_COEF,
1363 alc889_coef_init(codec);
1366 alc888_coef_init(codec);
1368 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1371 snd_hda_codec_write(codec, 0x20, 0,
1372 AC_VERB_SET_COEF_INDEX, 7);
1373 tmp = snd_hda_codec_read(codec, 0x20, 0,
1374 AC_VERB_GET_PROC_COEF, 0);
1375 snd_hda_codec_write(codec, 0x20, 0,
1376 AC_VERB_SET_COEF_INDEX, 7);
1377 snd_hda_codec_write(codec, 0x20, 0,
1378 AC_VERB_SET_PROC_COEF,
1387 static void alc_init_auto_hp(struct hda_codec *codec)
1389 struct alc_spec *spec = codec->spec;
1390 struct auto_pin_cfg *cfg = &spec->autocfg;
1393 if (!cfg->hp_pins[0]) {
1394 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1398 if (!cfg->speaker_pins[0]) {
1399 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1401 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1402 sizeof(cfg->speaker_pins));
1403 cfg->speaker_outs = cfg->line_outs;
1406 if (!cfg->hp_pins[0]) {
1407 memcpy(cfg->hp_pins, cfg->line_out_pins,
1408 sizeof(cfg->hp_pins));
1409 cfg->hp_outs = cfg->line_outs;
1412 for (i = 0; i < cfg->hp_outs; i++) {
1413 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1415 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1416 AC_VERB_SET_UNSOLICITED_ENABLE,
1417 AC_USRSP_EN | ALC880_HP_EVENT);
1419 spec->unsol_event = alc_sku_unsol_event;
1422 static void alc_init_auto_mic(struct hda_codec *codec)
1424 struct alc_spec *spec = codec->spec;
1425 struct auto_pin_cfg *cfg = &spec->autocfg;
1426 hda_nid_t fixed, ext;
1429 /* there must be only two mic inputs exclusively */
1430 for (i = 0; i < cfg->num_inputs; i++)
1431 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1435 for (i = 0; i < cfg->num_inputs; i++) {
1436 hda_nid_t nid = cfg->inputs[i].pin;
1437 unsigned int defcfg;
1438 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1439 switch (snd_hda_get_input_pin_attr(defcfg)) {
1440 case INPUT_PIN_ATTR_INT:
1442 return; /* already occupied */
1445 case INPUT_PIN_ATTR_UNUSED:
1446 return; /* invalid entry */
1449 return; /* already occupied */
1456 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1457 return; /* no unsol support */
1458 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1460 spec->ext_mic.pin = ext;
1461 spec->int_mic.pin = fixed;
1462 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1463 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1465 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1466 AC_VERB_SET_UNSOLICITED_ENABLE,
1467 AC_USRSP_EN | ALC880_MIC_EVENT);
1468 spec->unsol_event = alc_sku_unsol_event;
1471 /* Could be any non-zero and even value. When used as fixup, tells
1472 * the driver to ignore any present sku defines.
1474 #define ALC_FIXUP_SKU_IGNORE (2)
1476 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1478 unsigned int ass, tmp, i;
1480 struct alc_spec *spec = codec->spec;
1482 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1484 if (spec->cdefine.fixup) {
1485 ass = spec->cdefine.sku_cfg;
1486 if (ass == ALC_FIXUP_SKU_IGNORE)
1491 ass = codec->subsystem_id & 0xffff;
1492 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1496 if (codec->vendor_id == 0x10ec0260)
1498 ass = snd_hda_codec_get_pincfg(codec, nid);
1501 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1502 codec->chip_name, ass);
1508 for (i = 1; i < 16; i++) {
1512 if (((ass >> 16) & 0xf) != tmp)
1515 spec->cdefine.port_connectivity = ass >> 30;
1516 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1517 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1518 spec->cdefine.customization = ass >> 8;
1520 spec->cdefine.sku_cfg = ass;
1521 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1522 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1523 spec->cdefine.swap = (ass & 0x2) >> 1;
1524 spec->cdefine.override = ass & 0x1;
1526 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1527 nid, spec->cdefine.sku_cfg);
1528 snd_printd("SKU: port_connectivity=0x%x\n",
1529 spec->cdefine.port_connectivity);
1530 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1531 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1532 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1533 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1534 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1535 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1536 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1541 /* check subsystem ID and set up device-specific initialization;
1542 * return 1 if initialized, 0 if invalid SSID
1544 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1545 * 31 ~ 16 : Manufacture ID
1547 * 7 ~ 0 : Assembly ID
1548 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1550 static int alc_subsystem_id(struct hda_codec *codec,
1551 hda_nid_t porta, hda_nid_t porte,
1552 hda_nid_t portd, hda_nid_t porti)
1554 unsigned int ass, tmp, i;
1556 struct alc_spec *spec = codec->spec;
1558 if (spec->cdefine.fixup) {
1559 ass = spec->cdefine.sku_cfg;
1560 if (ass == ALC_FIXUP_SKU_IGNORE)
1565 ass = codec->subsystem_id & 0xffff;
1566 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1569 /* invalid SSID, check the special NID pin defcfg instead */
1571 * 31~30 : port connectivity
1574 * 19~16 : Check sum (15:1)
1579 if (codec->vendor_id == 0x10ec0260)
1581 ass = snd_hda_codec_get_pincfg(codec, nid);
1582 snd_printd("realtek: No valid SSID, "
1583 "checking pincfg 0x%08x for NID 0x%x\n",
1587 if ((ass >> 30) != 1) /* no physical connection */
1592 for (i = 1; i < 16; i++) {
1596 if (((ass >> 16) & 0xf) != tmp)
1599 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1600 ass & 0xffff, codec->vendor_id);
1604 * 2 : 0 --> Desktop, 1 --> Laptop
1605 * 3~5 : External Amplifier control
1608 tmp = (ass & 0x38) >> 3; /* external Amp control */
1611 spec->init_amp = ALC_INIT_GPIO1;
1614 spec->init_amp = ALC_INIT_GPIO2;
1617 spec->init_amp = ALC_INIT_GPIO3;
1621 spec->init_amp = ALC_INIT_DEFAULT;
1625 /* is laptop or Desktop and enable the function "Mute internal speaker
1626 * when the external headphone out jack is plugged"
1628 if (!(ass & 0x8000))
1631 * 10~8 : Jack location
1632 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1634 * 15 : 1 --> enable the function "Mute internal speaker
1635 * when the external headphone out jack is plugged"
1637 if (!spec->autocfg.hp_pins[0]) {
1639 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1650 for (i = 0; i < spec->autocfg.line_outs; i++)
1651 if (spec->autocfg.line_out_pins[i] == nid)
1653 spec->autocfg.hp_pins[0] = nid;
1656 alc_init_auto_hp(codec);
1657 alc_init_auto_mic(codec);
1661 static void alc_ssid_check(struct hda_codec *codec,
1662 hda_nid_t porta, hda_nid_t porte,
1663 hda_nid_t portd, hda_nid_t porti)
1665 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1666 struct alc_spec *spec = codec->spec;
1667 snd_printd("realtek: "
1668 "Enable default setup for auto mode as fallback\n");
1669 spec->init_amp = ALC_INIT_DEFAULT;
1670 alc_init_auto_hp(codec);
1671 alc_init_auto_mic(codec);
1676 * Fix-up pin default configurations and add default verbs
1684 struct alc_model_fixup {
1695 const struct alc_pincfg *pins;
1696 const struct hda_verb *verbs;
1697 void (*func)(struct hda_codec *codec,
1698 const struct alc_fixup *fix,
1712 ALC_FIXUP_ACT_PRE_PROBE,
1713 ALC_FIXUP_ACT_PROBE,
1717 static void alc_apply_fixup(struct hda_codec *codec, int action)
1719 struct alc_spec *spec = codec->spec;
1720 int id = spec->fixup_id;
1721 #ifdef CONFIG_SND_DEBUG_VERBOSE
1722 const char *modelname = spec->fixup_name;
1726 if (!spec->fixup_list)
1730 const struct alc_fixup *fix = spec->fixup_list + id;
1731 const struct alc_pincfg *cfg;
1733 switch (fix->type) {
1735 if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
1737 snd_printdd(KERN_INFO "hda_codec: %s: "
1738 "Apply sku override for %s\n",
1739 codec->chip_name, modelname);
1740 spec->cdefine.sku_cfg = fix->v.sku;
1741 spec->cdefine.fixup = 1;
1743 case ALC_FIXUP_PINS:
1745 if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
1747 snd_printdd(KERN_INFO "hda_codec: %s: "
1748 "Apply pincfg for %s\n",
1749 codec->chip_name, modelname);
1750 for (; cfg->nid; cfg++)
1751 snd_hda_codec_set_pincfg(codec, cfg->nid,
1754 case ALC_FIXUP_VERBS:
1755 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
1757 snd_printdd(KERN_INFO "hda_codec: %s: "
1758 "Apply fix-verbs for %s\n",
1759 codec->chip_name, modelname);
1760 add_verb(codec->spec, fix->v.verbs);
1762 case ALC_FIXUP_FUNC:
1765 snd_printdd(KERN_INFO "hda_codec: %s: "
1766 "Apply fix-func for %s\n",
1767 codec->chip_name, modelname);
1768 fix->v.func(codec, fix, action);
1771 snd_printk(KERN_ERR "hda_codec: %s: "
1772 "Invalid fixup type %d\n",
1773 codec->chip_name, fix->type);
1776 if (!fix[id].chained)
1780 id = fix[id].chain_id;
1784 static void alc_pick_fixup(struct hda_codec *codec,
1785 const struct alc_model_fixup *models,
1786 const struct snd_pci_quirk *quirk,
1787 const struct alc_fixup *fixlist)
1789 struct alc_spec *spec = codec->spec;
1791 const char *name = NULL;
1793 if (codec->modelname && models) {
1794 while (models->name) {
1795 if (!strcmp(codec->modelname, models->name)) {
1797 name = models->name;
1804 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1807 #ifdef CONFIG_SND_DEBUG_VERBOSE
1813 spec->fixup_id = id;
1815 spec->fixup_list = fixlist;
1816 spec->fixup_name = name;
1820 static int alc_read_coef_idx(struct hda_codec *codec,
1821 unsigned int coef_idx)
1824 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1826 val = snd_hda_codec_read(codec, 0x20, 0,
1827 AC_VERB_GET_PROC_COEF, 0);
1831 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
1832 unsigned int coef_val)
1834 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1836 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
1840 /* set right pin controls for digital I/O */
1841 static void alc_auto_init_digital(struct hda_codec *codec)
1843 struct alc_spec *spec = codec->spec;
1847 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1848 pin = spec->autocfg.dig_out_pins[i];
1850 snd_hda_codec_write(codec, pin, 0,
1851 AC_VERB_SET_PIN_WIDGET_CONTROL,
1855 pin = spec->autocfg.dig_in_pin;
1857 snd_hda_codec_write(codec, pin, 0,
1858 AC_VERB_SET_PIN_WIDGET_CONTROL,
1862 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1863 static void alc_auto_parse_digital(struct hda_codec *codec)
1865 struct alc_spec *spec = codec->spec;
1869 /* support multiple SPDIFs; the secondary is set up as a slave */
1870 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1871 err = snd_hda_get_connections(codec,
1872 spec->autocfg.dig_out_pins[i],
1877 spec->multiout.dig_out_nid = dig_nid;
1878 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1880 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1881 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1883 spec->slave_dig_outs[i - 1] = dig_nid;
1887 if (spec->autocfg.dig_in_pin) {
1888 dig_nid = codec->start_nid;
1889 for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
1890 unsigned int wcaps = get_wcaps(codec, dig_nid);
1891 if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
1893 if (!(wcaps & AC_WCAP_DIGITAL))
1895 if (!(wcaps & AC_WCAP_CONN_LIST))
1897 err = get_connection_index(codec, dig_nid,
1898 spec->autocfg.dig_in_pin);
1900 spec->dig_in_nid = dig_nid;
1914 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1915 /* Mic-in jack as mic in */
1916 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1917 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1918 /* Line-in jack as Line in */
1919 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1920 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1921 /* Line-Out as Front */
1922 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1929 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1930 /* Mic-in jack as mic in */
1931 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1932 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1933 /* Line-in jack as Surround */
1934 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1935 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1936 /* Line-Out as Front */
1937 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1944 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1945 /* Mic-in jack as CLFE */
1946 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1947 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1948 /* Line-in jack as Surround */
1949 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1950 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1951 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1952 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1959 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1960 /* Mic-in jack as CLFE */
1961 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1962 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1963 /* Line-in jack as Surround */
1964 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1965 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1966 /* Line-Out as Side */
1967 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1971 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1972 { 2, alc888_4ST_ch2_intel_init },
1973 { 4, alc888_4ST_ch4_intel_init },
1974 { 6, alc888_4ST_ch6_intel_init },
1975 { 8, alc888_4ST_ch8_intel_init },
1979 * ALC888 Fujitsu Siemens Amillo xa3530
1982 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1983 /* Front Mic: set to PIN_IN (empty by default) */
1984 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1985 /* Connect Internal HP to Front */
1986 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1987 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1988 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1989 /* Connect Bass HP to Front */
1990 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1991 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1992 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1993 /* Connect Line-Out side jack (SPDIF) to Side */
1994 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1995 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1996 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1997 /* Connect Mic jack to CLFE */
1998 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1999 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2000 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
2001 /* Connect Line-in jack to Surround */
2002 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2003 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2004 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
2005 /* Connect HP out jack to Front */
2006 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2007 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2008 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2009 /* Enable unsolicited event for HP jack and Line-out jack */
2010 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2011 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2015 static void alc_automute_amp(struct hda_codec *codec)
2017 alc_automute_speaker(codec, 0);
2020 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
2023 if (codec->vendor_id == 0x10ec0880)
2027 if (res == ALC880_HP_EVENT)
2028 alc_automute_amp(codec);
2031 static void alc889_automute_setup(struct hda_codec *codec)
2033 struct alc_spec *spec = codec->spec;
2035 spec->autocfg.hp_pins[0] = 0x15;
2036 spec->autocfg.speaker_pins[0] = 0x14;
2037 spec->autocfg.speaker_pins[1] = 0x16;
2038 spec->autocfg.speaker_pins[2] = 0x17;
2039 spec->autocfg.speaker_pins[3] = 0x19;
2040 spec->autocfg.speaker_pins[4] = 0x1a;
2043 static void alc889_intel_init_hook(struct hda_codec *codec)
2045 alc889_coef_init(codec);
2046 alc_automute_amp(codec);
2049 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
2051 struct alc_spec *spec = codec->spec;
2053 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
2054 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
2055 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
2056 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
2060 * ALC888 Acer Aspire 4930G model
2063 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
2064 /* Front Mic: set to PIN_IN (empty by default) */
2065 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2066 /* Unselect Front Mic by default in input mixer 3 */
2067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2068 /* Enable unsolicited event for HP jack */
2069 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2070 /* Connect Internal HP to front */
2071 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2072 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2073 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2074 /* Connect HP out to front */
2075 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2076 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2077 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2078 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2083 * ALC888 Acer Aspire 6530G model
2086 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2087 /* Route to built-in subwoofer as well as speakers */
2088 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2090 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2091 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2092 /* Bias voltage on for external mic port */
2093 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2094 /* Front Mic: set to PIN_IN (empty by default) */
2095 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2096 /* Unselect Front Mic by default in input mixer 3 */
2097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2098 /* Enable unsolicited event for HP jack */
2099 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2100 /* Enable speaker output */
2101 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2102 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2103 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2104 /* Enable headphone output */
2105 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2106 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2107 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2108 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2113 *ALC888 Acer Aspire 7730G model
2116 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2117 /* Bias voltage on for external mic port */
2118 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2119 /* Front Mic: set to PIN_IN (empty by default) */
2120 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2121 /* Unselect Front Mic by default in input mixer 3 */
2122 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2123 /* Enable unsolicited event for HP jack */
2124 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2125 /* Enable speaker output */
2126 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2127 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2128 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2129 /* Enable headphone output */
2130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2131 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2132 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2133 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2134 /*Enable internal subwoofer */
2135 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2136 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2137 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2138 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
2143 * ALC889 Acer Aspire 8930G model
2146 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2147 /* Front Mic: set to PIN_IN (empty by default) */
2148 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2149 /* Unselect Front Mic by default in input mixer 3 */
2150 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2151 /* Enable unsolicited event for HP jack */
2152 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2153 /* Connect Internal Front to Front */
2154 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2155 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2156 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2157 /* Connect Internal Rear to Rear */
2158 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2159 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2160 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
2161 /* Connect Internal CLFE to CLFE */
2162 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2163 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2164 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
2165 /* Connect HP out to Front */
2166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2167 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2168 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2169 /* Enable all DACs */
2170 /* DAC DISABLE/MUTE 1? */
2171 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2172 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2173 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2174 /* DAC DISABLE/MUTE 2? */
2175 /* some bit here disables the other DACs. Init=0x4900 */
2176 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2177 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2179 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2180 * which makes the stereo useless. However, either the mic or the ALC889
2181 * makes the signal become a difference/sum signal instead of standard
2182 * stereo, which is annoying. So instead we flip this bit which makes the
2183 * codec replicate the sum signal to both channels, turning it into a
2186 /* DMIC_CONTROL? Init value = 0x0001 */
2187 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2188 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2192 static struct hda_input_mux alc888_2_capture_sources[2] = {
2193 /* Front mic only available on one ADC */
2200 { "Front Mic", 0xb },
2213 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2214 /* Interal mic only available on one ADC */
2221 { "Input Mix", 0xa },
2222 { "Internal Mic", 0xb },
2231 { "Input Mix", 0xa },
2236 static struct hda_input_mux alc889_capture_sources[3] = {
2237 /* Digital mic only available on first "ADC" */
2244 { "Front Mic", 0xb },
2245 { "Input Mix", 0xa },
2254 { "Input Mix", 0xa },
2263 { "Input Mix", 0xa },
2268 static struct snd_kcontrol_new alc888_base_mixer[] = {
2269 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2270 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2271 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2272 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2273 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2275 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2276 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2277 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2278 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2279 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2280 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2281 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2282 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2283 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2285 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2286 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2290 static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2291 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2292 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2293 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2294 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2295 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0f, 2, 0x0,
2297 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0f, 2, 2, HDA_INPUT),
2298 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
2299 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT),
2300 HDA_CODEC_VOLUME("Side Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2301 HDA_BIND_MUTE("Side Playback Switch", 0x0e, 2, HDA_INPUT),
2302 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2303 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2304 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2305 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2306 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2307 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2308 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2313 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2314 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2315 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2316 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2317 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2318 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2320 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2321 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2322 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2323 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2324 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2325 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2326 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2332 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2334 struct alc_spec *spec = codec->spec;
2336 spec->autocfg.hp_pins[0] = 0x15;
2337 spec->autocfg.speaker_pins[0] = 0x14;
2338 spec->autocfg.speaker_pins[1] = 0x16;
2339 spec->autocfg.speaker_pins[2] = 0x17;
2342 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2344 struct alc_spec *spec = codec->spec;
2346 spec->autocfg.hp_pins[0] = 0x15;
2347 spec->autocfg.speaker_pins[0] = 0x14;
2348 spec->autocfg.speaker_pins[1] = 0x16;
2349 spec->autocfg.speaker_pins[2] = 0x17;
2352 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2354 struct alc_spec *spec = codec->spec;
2356 spec->autocfg.hp_pins[0] = 0x15;
2357 spec->autocfg.speaker_pins[0] = 0x14;
2358 spec->autocfg.speaker_pins[1] = 0x16;
2359 spec->autocfg.speaker_pins[2] = 0x17;
2362 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2364 struct alc_spec *spec = codec->spec;
2366 spec->autocfg.hp_pins[0] = 0x15;
2367 spec->autocfg.speaker_pins[0] = 0x14;
2368 spec->autocfg.speaker_pins[1] = 0x16;
2369 spec->autocfg.speaker_pins[2] = 0x1b;
2373 * ALC880 3-stack model
2375 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2376 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2377 * F-Mic = 0x1b, HP = 0x19
2380 static hda_nid_t alc880_dac_nids[4] = {
2381 /* front, rear, clfe, rear_surr */
2382 0x02, 0x05, 0x04, 0x03
2385 static hda_nid_t alc880_adc_nids[3] = {
2390 /* The datasheet says the node 0x07 is connected from inputs,
2391 * but it shows zero connection in the real implementation on some devices.
2392 * Note: this is a 915GAV bug, fixed on 915GLV
2394 static hda_nid_t alc880_adc_nids_alt[2] = {
2399 #define ALC880_DIGOUT_NID 0x06
2400 #define ALC880_DIGIN_NID 0x0a
2402 static struct hda_input_mux alc880_capture_source = {
2406 { "Front Mic", 0x3 },
2412 /* channel source setting (2/6 channel selection for 3-stack) */
2414 static struct hda_verb alc880_threestack_ch2_init[] = {
2415 /* set line-in to input, mute it */
2416 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2417 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2418 /* set mic-in to input vref 80%, mute it */
2419 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2420 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2425 static struct hda_verb alc880_threestack_ch6_init[] = {
2426 /* set line-in to output, unmute it */
2427 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2428 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2429 /* set mic-in to output, unmute it */
2430 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2431 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2435 static struct hda_channel_mode alc880_threestack_modes[2] = {
2436 { 2, alc880_threestack_ch2_init },
2437 { 6, alc880_threestack_ch6_init },
2440 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2441 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2442 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2443 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2444 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2445 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2446 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2447 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2448 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2449 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2450 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2451 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2452 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2454 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2455 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2456 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2457 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2459 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2460 .name = "Channel Mode",
2461 .info = alc_ch_mode_info,
2462 .get = alc_ch_mode_get,
2463 .put = alc_ch_mode_put,
2468 /* capture mixer elements */
2469 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2470 struct snd_ctl_elem_info *uinfo)
2472 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2473 struct alc_spec *spec = codec->spec;
2476 mutex_lock(&codec->control_mutex);
2477 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2479 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2480 mutex_unlock(&codec->control_mutex);
2484 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2485 unsigned int size, unsigned int __user *tlv)
2487 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2488 struct alc_spec *spec = codec->spec;
2491 mutex_lock(&codec->control_mutex);
2492 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2494 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2495 mutex_unlock(&codec->control_mutex);
2499 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2500 struct snd_ctl_elem_value *ucontrol);
2502 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2503 struct snd_ctl_elem_value *ucontrol,
2506 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2507 struct alc_spec *spec = codec->spec;
2508 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2511 mutex_lock(&codec->control_mutex);
2512 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2514 err = func(kcontrol, ucontrol);
2515 mutex_unlock(&codec->control_mutex);
2519 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2520 struct snd_ctl_elem_value *ucontrol)
2522 return alc_cap_getput_caller(kcontrol, ucontrol,
2523 snd_hda_mixer_amp_volume_get);
2526 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2527 struct snd_ctl_elem_value *ucontrol)
2529 return alc_cap_getput_caller(kcontrol, ucontrol,
2530 snd_hda_mixer_amp_volume_put);
2533 /* capture mixer elements */
2534 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2536 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2537 struct snd_ctl_elem_value *ucontrol)
2539 return alc_cap_getput_caller(kcontrol, ucontrol,
2540 snd_hda_mixer_amp_switch_get);
2543 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2544 struct snd_ctl_elem_value *ucontrol)
2546 return alc_cap_getput_caller(kcontrol, ucontrol,
2547 snd_hda_mixer_amp_switch_put);
2550 #define _DEFINE_CAPMIX(num) \
2552 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2553 .name = "Capture Switch", \
2554 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2556 .info = alc_cap_sw_info, \
2557 .get = alc_cap_sw_get, \
2558 .put = alc_cap_sw_put, \
2561 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2562 .name = "Capture Volume", \
2563 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2564 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2565 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2567 .info = alc_cap_vol_info, \
2568 .get = alc_cap_vol_get, \
2569 .put = alc_cap_vol_put, \
2570 .tlv = { .c = alc_cap_vol_tlv }, \
2573 #define _DEFINE_CAPSRC(num) \
2575 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2576 /* .name = "Capture Source", */ \
2577 .name = "Input Source", \
2579 .info = alc_mux_enum_info, \
2580 .get = alc_mux_enum_get, \
2581 .put = alc_mux_enum_put, \
2584 #define DEFINE_CAPMIX(num) \
2585 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2586 _DEFINE_CAPMIX(num), \
2587 _DEFINE_CAPSRC(num), \
2591 #define DEFINE_CAPMIX_NOSRC(num) \
2592 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2593 _DEFINE_CAPMIX(num), \
2597 /* up to three ADCs */
2601 DEFINE_CAPMIX_NOSRC(1);
2602 DEFINE_CAPMIX_NOSRC(2);
2603 DEFINE_CAPMIX_NOSRC(3);
2606 * ALC880 5-stack model
2608 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2610 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2611 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2614 /* additional mixers to alc880_three_stack_mixer */
2615 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2616 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2617 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2621 /* channel source setting (6/8 channel selection for 5-stack) */
2623 static struct hda_verb alc880_fivestack_ch6_init[] = {
2624 /* set line-in to input, mute it */
2625 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2626 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2631 static struct hda_verb alc880_fivestack_ch8_init[] = {
2632 /* set line-in to output, unmute it */
2633 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2634 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2638 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2639 { 6, alc880_fivestack_ch6_init },
2640 { 8, alc880_fivestack_ch8_init },
2645 * ALC880 6-stack model
2647 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2648 * Side = 0x05 (0x0f)
2649 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2650 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2653 static hda_nid_t alc880_6st_dac_nids[4] = {
2654 /* front, rear, clfe, rear_surr */
2655 0x02, 0x03, 0x04, 0x05
2658 static struct hda_input_mux alc880_6stack_capture_source = {
2662 { "Front Mic", 0x1 },
2668 /* fixed 8-channels */
2669 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2673 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2674 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2675 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2676 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2677 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2678 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2679 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2680 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2681 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2682 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2683 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2684 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2685 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2686 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2687 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2688 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2689 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2690 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2691 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2693 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2694 .name = "Channel Mode",
2695 .info = alc_ch_mode_info,
2696 .get = alc_ch_mode_get,
2697 .put = alc_ch_mode_put,
2706 * W810 has rear IO for:
2709 * Center/LFE (DAC 04)
2712 * The system also has a pair of internal speakers, and a headphone jack.
2713 * These are both connected to Line2 on the codec, hence to DAC 02.
2715 * There is a variable resistor to control the speaker or headphone
2716 * volume. This is a hardware-only device without a software API.
2718 * Plugging headphones in will disable the internal speakers. This is
2719 * implemented in hardware, not via the driver using jack sense. In
2720 * a similar fashion, plugging into the rear socket marked "front" will
2721 * disable both the speakers and headphones.
2723 * For input, there's a microphone jack, and an "audio in" jack.
2724 * These may not do anything useful with this driver yet, because I
2725 * haven't setup any initialization verbs for these yet...
2728 static hda_nid_t alc880_w810_dac_nids[3] = {
2729 /* front, rear/surround, clfe */
2733 /* fixed 6 channels */
2734 static struct hda_channel_mode alc880_w810_modes[1] = {
2738 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2739 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2740 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2741 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2742 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2743 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2744 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2745 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2746 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2747 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2748 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2756 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2757 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2761 static hda_nid_t alc880_z71v_dac_nids[1] = {
2764 #define ALC880_Z71V_HP_DAC 0x03
2766 /* fixed 2 channels */
2767 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2771 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2772 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2773 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2774 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2775 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2776 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2777 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2785 * ALC880 F1734 model
2787 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2788 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2791 static hda_nid_t alc880_f1734_dac_nids[1] = {
2794 #define ALC880_F1734_HP_DAC 0x02
2796 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2797 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2798 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2799 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2800 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2801 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2802 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2808 static struct hda_input_mux alc880_f1734_capture_source = {
2820 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2821 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2822 * Mic = 0x18, Line = 0x1a
2825 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2826 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2828 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2829 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2830 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2831 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2832 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2833 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2834 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2835 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2836 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2837 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2838 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2839 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2840 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2841 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2842 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2844 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2845 .name = "Channel Mode",
2846 .info = alc_ch_mode_info,
2847 .get = alc_ch_mode_get,
2848 .put = alc_ch_mode_put,
2854 * ALC880 ASUS W1V model
2856 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2857 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2858 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2861 /* additional mixers to alc880_asus_mixer */
2862 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2863 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2864 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2869 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2870 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2871 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2872 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2873 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2874 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2875 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2876 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2877 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2878 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2883 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2884 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2885 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2886 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2887 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2888 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2889 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2890 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2891 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2892 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2893 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2894 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2895 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2896 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2897 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2898 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2899 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2901 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2902 .name = "Channel Mode",
2903 .info = alc_ch_mode_info,
2904 .get = alc_ch_mode_get,
2905 .put = alc_ch_mode_put,
2910 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2911 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2912 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2913 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2914 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2915 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2916 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2917 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2918 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2919 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2920 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2924 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2925 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2926 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2927 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2928 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2929 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2930 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2935 * virtual master controls
2939 * slave controls for virtual master
2941 static const char * const alc_slave_vols[] = {
2942 "Front Playback Volume",
2943 "Surround Playback Volume",
2944 "Center Playback Volume",
2945 "LFE Playback Volume",
2946 "Side Playback Volume",
2947 "Headphone Playback Volume",
2948 "Speaker Playback Volume",
2949 "Mono Playback Volume",
2950 "Line-Out Playback Volume",
2951 "PCM Playback Volume",
2955 static const char * const alc_slave_sws[] = {
2956 "Front Playback Switch",
2957 "Surround Playback Switch",
2958 "Center Playback Switch",
2959 "LFE Playback Switch",
2960 "Side Playback Switch",
2961 "Headphone Playback Switch",
2962 "Speaker Playback Switch",
2963 "Mono Playback Switch",
2964 "IEC958 Playback Switch",
2965 "Line-Out Playback Switch",
2966 "PCM Playback Switch",
2971 * build control elements
2974 #define NID_MAPPING (-1)
2976 #define SUBDEV_SPEAKER_ (0 << 6)
2977 #define SUBDEV_HP_ (1 << 6)
2978 #define SUBDEV_LINE_ (2 << 6)
2979 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2980 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2981 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2983 static void alc_free_kctls(struct hda_codec *codec);
2985 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2986 /* additional beep mixers; the actual parameters are overwritten at build */
2987 static struct snd_kcontrol_new alc_beep_mixer[] = {
2988 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2989 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2994 static int alc_build_controls(struct hda_codec *codec)
2996 struct alc_spec *spec = codec->spec;
2997 struct snd_kcontrol *kctl = NULL;
2998 struct snd_kcontrol_new *knew;
3003 for (i = 0; i < spec->num_mixers; i++) {
3004 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
3008 if (spec->cap_mixer) {
3009 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
3013 if (spec->multiout.dig_out_nid) {
3014 err = snd_hda_create_spdif_out_ctls(codec,
3015 spec->multiout.dig_out_nid);
3018 if (!spec->no_analog) {
3019 err = snd_hda_create_spdif_share_sw(codec,
3023 spec->multiout.share_spdif = 1;
3026 if (spec->dig_in_nid) {
3027 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
3032 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3033 /* create beep controls if needed */
3034 if (spec->beep_amp) {
3035 struct snd_kcontrol_new *knew;
3036 for (knew = alc_beep_mixer; knew->name; knew++) {
3037 struct snd_kcontrol *kctl;
3038 kctl = snd_ctl_new1(knew, codec);
3041 kctl->private_value = spec->beep_amp;
3042 err = snd_hda_ctl_add(codec, 0, kctl);
3049 /* if we have no master control, let's create it */
3050 if (!spec->no_analog &&
3051 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
3052 unsigned int vmaster_tlv[4];
3053 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
3054 HDA_OUTPUT, vmaster_tlv);
3055 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
3056 vmaster_tlv, alc_slave_vols);
3060 if (!spec->no_analog &&
3061 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
3062 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
3063 NULL, alc_slave_sws);
3068 /* assign Capture Source enums to NID */
3069 if (spec->capsrc_nids || spec->adc_nids) {
3070 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
3072 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3073 for (i = 0; kctl && i < kctl->count; i++) {
3074 hda_nid_t *nids = spec->capsrc_nids;
3076 nids = spec->adc_nids;
3077 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
3082 if (spec->cap_mixer) {
3083 const char *kname = kctl ? kctl->id.name : NULL;
3084 for (knew = spec->cap_mixer; knew->name; knew++) {
3085 if (kname && strcmp(knew->name, kname) == 0)
3087 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3088 for (i = 0; kctl && i < kctl->count; i++) {
3089 err = snd_hda_add_nid(codec, kctl, i,
3097 /* other nid->control mapping */
3098 for (i = 0; i < spec->num_mixers; i++) {
3099 for (knew = spec->mixers[i]; knew->name; knew++) {
3100 if (knew->iface != NID_MAPPING)
3102 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3105 u = knew->subdevice;
3106 for (j = 0; j < 4; j++, u >>= 8) {
3111 case SUBDEV_SPEAKER_:
3112 nid = spec->autocfg.speaker_pins[nid];
3115 nid = spec->autocfg.line_out_pins[nid];
3118 nid = spec->autocfg.hp_pins[nid];
3123 err = snd_hda_add_nid(codec, kctl, 0, nid);
3127 u = knew->private_value;
3128 for (j = 0; j < 4; j++, u >>= 8) {
3132 err = snd_hda_add_nid(codec, kctl, 0, nid);
3139 alc_free_kctls(codec); /* no longer needed */
3146 * initialize the codec volumes, etc
3150 * generic initialization of ADC, input mixers and output mixers
3152 static struct hda_verb alc880_volume_init_verbs[] = {
3154 * Unmute ADC0-2 and set the default input to mic-in
3156 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3158 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3159 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3160 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3161 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3163 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3165 * Note: PASD motherboards uses the Line In 2 as the input for front
3168 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3169 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3170 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3171 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3172 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3173 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3174 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3175 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3178 * Set up output mixers (0x0c - 0x0f)
3180 /* set vol=0 to output mixers */
3181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3182 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3183 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3184 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3185 /* set up input amps for analog loopback */
3186 /* Amp Indices: DAC = 0, mixer = 1 */
3187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3189 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3191 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3192 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3193 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3194 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3200 * 3-stack pin configuration:
3201 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3203 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3205 * preset connection lists of input pins
3206 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3208 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3209 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3210 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3213 * Set pin mode and muting
3215 /* set front pin widgets 0x14 for output */
3216 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3217 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3218 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3219 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3220 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3221 /* Mic2 (as headphone out) for HP output */
3222 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3223 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3224 /* Line In pin widget for input */
3225 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3226 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3227 /* Line2 (as front mic) pin widget for input and vref at 80% */
3228 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3229 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3230 /* CD pin widget for input */
3231 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3237 * 5-stack pin configuration:
3238 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3239 * line-in/side = 0x1a, f-mic = 0x1b
3241 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3243 * preset connection lists of input pins
3244 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3246 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3247 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3250 * Set pin mode and muting
3252 /* set pin widgets 0x14-0x17 for output */
3253 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3254 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3255 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3256 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3257 /* unmute pins for output (no gain on this amp) */
3258 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3260 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3261 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3263 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3264 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3265 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3266 /* Mic2 (as headphone out) for HP output */
3267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3269 /* Line In pin widget for input */
3270 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3271 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3272 /* Line2 (as front mic) pin widget for input and vref at 80% */
3273 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3274 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3275 /* CD pin widget for input */
3276 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3282 * W810 pin configuration:
3283 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3285 static struct hda_verb alc880_pin_w810_init_verbs[] = {
3286 /* hphone/speaker input selector: front DAC */
3287 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3289 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3290 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3291 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3292 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3293 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3294 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3296 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3297 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3303 * Z71V pin configuration:
3304 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3306 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3307 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3308 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3309 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3310 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3312 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3313 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3314 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3315 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3321 * 6-stack pin configuration:
3322 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3323 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3325 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3326 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3328 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3329 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3330 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3331 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3332 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3333 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3334 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3335 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3337 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3338 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3339 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3340 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3341 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3342 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3343 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3344 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3345 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3351 * Uniwill pin configuration:
3352 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3355 static struct hda_verb alc880_uniwill_init_verbs[] = {
3356 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3358 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3359 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3361 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3362 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3363 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3364 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3365 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3367 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3368 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3369 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3370 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3371 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3373 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3374 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3375 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3376 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3377 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3378 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3379 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3380 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3381 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3383 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3384 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3391 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3393 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3394 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3396 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3397 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3398 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3399 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3400 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3401 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3404 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3405 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3406 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3409 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3410 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3411 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3412 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3413 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3414 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3416 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3417 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3422 static struct hda_verb alc880_beep_init_verbs[] = {
3423 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3427 /* auto-toggle front mic */
3428 static void alc88x_simple_mic_automute(struct hda_codec *codec)
3430 unsigned int present;
3433 present = snd_hda_jack_detect(codec, 0x18);
3434 bits = present ? HDA_AMP_MUTE : 0;
3435 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3438 static void alc880_uniwill_setup(struct hda_codec *codec)
3440 struct alc_spec *spec = codec->spec;
3442 spec->autocfg.hp_pins[0] = 0x14;
3443 spec->autocfg.speaker_pins[0] = 0x15;
3444 spec->autocfg.speaker_pins[0] = 0x16;
3447 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3449 alc_automute_amp(codec);
3450 alc88x_simple_mic_automute(codec);
3453 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3456 /* Looks like the unsol event is incompatible with the standard
3457 * definition. 4bit tag is placed at 28 bit!
3459 switch (res >> 28) {
3460 case ALC880_MIC_EVENT:
3461 alc88x_simple_mic_automute(codec);
3464 alc_automute_amp_unsol_event(codec, res);
3469 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3471 struct alc_spec *spec = codec->spec;
3473 spec->autocfg.hp_pins[0] = 0x14;
3474 spec->autocfg.speaker_pins[0] = 0x15;
3477 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3479 unsigned int present;
3481 present = snd_hda_codec_read(codec, 0x21, 0,
3482 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3483 present &= HDA_AMP_VOLMASK;
3484 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3485 HDA_AMP_VOLMASK, present);
3486 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3487 HDA_AMP_VOLMASK, present);
3490 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3493 /* Looks like the unsol event is incompatible with the standard
3494 * definition. 4bit tag is placed at 28 bit!
3496 if ((res >> 28) == ALC880_DCVOL_EVENT)
3497 alc880_uniwill_p53_dcvol_automute(codec);
3499 alc_automute_amp_unsol_event(codec, res);
3503 * F1734 pin configuration:
3504 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3506 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3507 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3508 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3509 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3510 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3511 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3513 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3514 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3515 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3518 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3519 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3520 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3521 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3522 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3523 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3524 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3525 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3526 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3528 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3529 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3535 * ASUS pin configuration:
3536 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3538 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3539 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3540 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3541 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3542 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3544 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3545 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3546 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3548 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3549 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3550 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3551 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3553 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3554 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3555 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3556 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3557 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3558 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3559 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3560 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3561 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3566 /* Enable GPIO mask and set output */
3567 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3568 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3569 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3571 /* Clevo m520g init */
3572 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3573 /* headphone output */
3574 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3576 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3577 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3579 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3580 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3582 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3583 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3584 /* Mic1 (rear panel) */
3585 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3586 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3587 /* Mic2 (front panel) */
3588 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3589 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3591 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3592 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3593 /* change to EAPD mode */
3594 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3595 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3600 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3601 /* change to EAPD mode */
3602 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3603 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3605 /* Headphone output */
3606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3608 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3609 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3611 /* Line In pin widget for input */
3612 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3613 /* CD pin widget for input */
3614 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3615 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3616 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3618 /* change to EAPD mode */
3619 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3620 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3626 * LG m1 express dual
3629 * Rear Line-In/Out (blue): 0x14
3630 * Build-in Mic-In: 0x15
3632 * HP-Out (green): 0x1b
3633 * Mic-In/Out (red): 0x19
3637 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3638 static hda_nid_t alc880_lg_dac_nids[3] = {
3642 /* seems analog CD is not working */
3643 static struct hda_input_mux alc880_lg_capture_source = {
3648 { "Internal Mic", 0x6 },
3652 /* 2,4,6 channel modes */
3653 static struct hda_verb alc880_lg_ch2_init[] = {
3654 /* set line-in and mic-in to input */
3655 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3656 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3660 static struct hda_verb alc880_lg_ch4_init[] = {
3661 /* set line-in to out and mic-in to input */
3662 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3663 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3667 static struct hda_verb alc880_lg_ch6_init[] = {
3668 /* set line-in and mic-in to output */
3669 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3670 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3674 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3675 { 2, alc880_lg_ch2_init },
3676 { 4, alc880_lg_ch4_init },
3677 { 6, alc880_lg_ch6_init },
3680 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3681 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3682 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3683 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3684 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3685 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3686 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3687 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3688 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3689 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3690 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3691 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3692 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3693 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3694 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3696 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3697 .name = "Channel Mode",
3698 .info = alc_ch_mode_info,
3699 .get = alc_ch_mode_get,
3700 .put = alc_ch_mode_put,
3705 static struct hda_verb alc880_lg_init_verbs[] = {
3706 /* set capture source to mic-in */
3707 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3708 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3709 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3710 /* mute all amp mixer inputs */
3711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3714 /* line-in to input */
3715 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3716 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3718 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3719 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3721 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3722 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3723 /* mic-in to input */
3724 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3725 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3726 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3728 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3729 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3730 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3732 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3736 /* toggle speaker-output according to the hp-jack state */
3737 static void alc880_lg_setup(struct hda_codec *codec)
3739 struct alc_spec *spec = codec->spec;
3741 spec->autocfg.hp_pins[0] = 0x1b;
3742 spec->autocfg.speaker_pins[0] = 0x17;
3751 * Built-in Mic-In: 0x19
3757 static struct hda_input_mux alc880_lg_lw_capture_source = {
3761 { "Internal Mic", 0x1 },
3766 #define alc880_lg_lw_modes alc880_threestack_modes
3768 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3769 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3770 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3771 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3772 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3773 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3774 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3775 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3776 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3777 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3778 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3780 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3781 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3782 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3785 .name = "Channel Mode",
3786 .info = alc_ch_mode_info,
3787 .get = alc_ch_mode_get,
3788 .put = alc_ch_mode_put,
3793 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3794 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3795 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3796 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3798 /* set capture source to mic-in */
3799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3800 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3801 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3802 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3805 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3807 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3808 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3809 /* mic-in to input */
3810 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3811 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3813 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3814 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3816 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3820 /* toggle speaker-output according to the hp-jack state */
3821 static void alc880_lg_lw_setup(struct hda_codec *codec)
3823 struct alc_spec *spec = codec->spec;
3825 spec->autocfg.hp_pins[0] = 0x1b;
3826 spec->autocfg.speaker_pins[0] = 0x14;
3829 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3830 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3831 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3832 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3833 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3834 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3835 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3839 static struct hda_input_mux alc880_medion_rim_capture_source = {
3843 { "Internal Mic", 0x1 },
3847 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3848 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3850 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3851 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3853 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3854 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3855 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3856 /* Mic2 (as headphone out) for HP output */
3857 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3858 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3859 /* Internal Speaker */
3860 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3861 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3863 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3864 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3866 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3870 /* toggle speaker-output according to the hp-jack state */
3871 static void alc880_medion_rim_automute(struct hda_codec *codec)
3873 struct alc_spec *spec = codec->spec;
3874 alc_automute_amp(codec);
3876 if (spec->jack_present)
3877 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3879 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3882 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3885 /* Looks like the unsol event is incompatible with the standard
3886 * definition. 4bit tag is placed at 28 bit!
3888 if ((res >> 28) == ALC880_HP_EVENT)
3889 alc880_medion_rim_automute(codec);
3892 static void alc880_medion_rim_setup(struct hda_codec *codec)
3894 struct alc_spec *spec = codec->spec;
3896 spec->autocfg.hp_pins[0] = 0x14;
3897 spec->autocfg.speaker_pins[0] = 0x1b;
3900 #ifdef CONFIG_SND_HDA_POWER_SAVE
3901 static struct hda_amp_list alc880_loopbacks[] = {
3902 { 0x0b, HDA_INPUT, 0 },
3903 { 0x0b, HDA_INPUT, 1 },
3904 { 0x0b, HDA_INPUT, 2 },
3905 { 0x0b, HDA_INPUT, 3 },
3906 { 0x0b, HDA_INPUT, 4 },
3910 static struct hda_amp_list alc880_lg_loopbacks[] = {
3911 { 0x0b, HDA_INPUT, 1 },
3912 { 0x0b, HDA_INPUT, 6 },
3913 { 0x0b, HDA_INPUT, 7 },
3922 static int alc_init(struct hda_codec *codec)
3924 struct alc_spec *spec = codec->spec;
3928 alc_auto_init_amp(codec, spec->init_amp);
3930 for (i = 0; i < spec->num_init_verbs; i++)
3931 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3933 if (spec->init_hook)
3934 spec->init_hook(codec);
3936 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
3938 hda_call_check_power_status(codec, 0x01);
3942 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3944 struct alc_spec *spec = codec->spec;
3946 if (spec->unsol_event)
3947 spec->unsol_event(codec, res);
3950 #ifdef CONFIG_SND_HDA_POWER_SAVE
3951 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3953 struct alc_spec *spec = codec->spec;
3954 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3959 * Analog playback callbacks
3961 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3962 struct hda_codec *codec,
3963 struct snd_pcm_substream *substream)
3965 struct alc_spec *spec = codec->spec;
3966 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3970 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3971 struct hda_codec *codec,
3972 unsigned int stream_tag,
3973 unsigned int format,
3974 struct snd_pcm_substream *substream)
3976 struct alc_spec *spec = codec->spec;
3977 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3978 stream_tag, format, substream);
3981 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3982 struct hda_codec *codec,
3983 struct snd_pcm_substream *substream)
3985 struct alc_spec *spec = codec->spec;
3986 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3992 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3993 struct hda_codec *codec,
3994 struct snd_pcm_substream *substream)
3996 struct alc_spec *spec = codec->spec;
3997 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
4000 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4001 struct hda_codec *codec,
4002 unsigned int stream_tag,
4003 unsigned int format,
4004 struct snd_pcm_substream *substream)
4006 struct alc_spec *spec = codec->spec;
4007 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
4008 stream_tag, format, substream);
4011 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4012 struct hda_codec *codec,
4013 struct snd_pcm_substream *substream)
4015 struct alc_spec *spec = codec->spec;
4016 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
4019 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
4020 struct hda_codec *codec,
4021 struct snd_pcm_substream *substream)
4023 struct alc_spec *spec = codec->spec;
4024 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
4030 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4031 struct hda_codec *codec,
4032 unsigned int stream_tag,
4033 unsigned int format,
4034 struct snd_pcm_substream *substream)
4036 struct alc_spec *spec = codec->spec;
4038 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
4039 stream_tag, 0, format);
4043 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4044 struct hda_codec *codec,
4045 struct snd_pcm_substream *substream)
4047 struct alc_spec *spec = codec->spec;
4049 snd_hda_codec_cleanup_stream(codec,
4050 spec->adc_nids[substream->number + 1]);
4054 /* analog capture with dynamic dual-adc changes */
4055 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4056 struct hda_codec *codec,
4057 unsigned int stream_tag,
4058 unsigned int format,
4059 struct snd_pcm_substream *substream)
4061 struct alc_spec *spec = codec->spec;
4062 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
4063 spec->cur_adc_stream_tag = stream_tag;
4064 spec->cur_adc_format = format;
4065 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
4069 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4070 struct hda_codec *codec,
4071 struct snd_pcm_substream *substream)
4073 struct alc_spec *spec = codec->spec;
4074 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
4079 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
4083 .nid = 0, /* fill later */
4085 .prepare = dualmic_capture_pcm_prepare,
4086 .cleanup = dualmic_capture_pcm_cleanup
4092 static struct hda_pcm_stream alc880_pcm_analog_playback = {
4096 /* NID is set in alc_build_pcms */
4098 .open = alc880_playback_pcm_open,
4099 .prepare = alc880_playback_pcm_prepare,
4100 .cleanup = alc880_playback_pcm_cleanup
4104 static struct hda_pcm_stream alc880_pcm_analog_capture = {
4108 /* NID is set in alc_build_pcms */
4111 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4115 /* NID is set in alc_build_pcms */
4118 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4119 .substreams = 2, /* can be overridden */
4122 /* NID is set in alc_build_pcms */
4124 .prepare = alc880_alt_capture_pcm_prepare,
4125 .cleanup = alc880_alt_capture_pcm_cleanup
4129 static struct hda_pcm_stream alc880_pcm_digital_playback = {
4133 /* NID is set in alc_build_pcms */
4135 .open = alc880_dig_playback_pcm_open,
4136 .close = alc880_dig_playback_pcm_close,
4137 .prepare = alc880_dig_playback_pcm_prepare,
4138 .cleanup = alc880_dig_playback_pcm_cleanup
4142 static struct hda_pcm_stream alc880_pcm_digital_capture = {
4146 /* NID is set in alc_build_pcms */
4149 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4150 static struct hda_pcm_stream alc_pcm_null_stream = {
4156 static int alc_build_pcms(struct hda_codec *codec)
4158 struct alc_spec *spec = codec->spec;
4159 struct hda_pcm *info = spec->pcm_rec;
4162 codec->num_pcms = 1;
4163 codec->pcm_info = info;
4165 if (spec->no_analog)
4168 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4169 "%s Analog", codec->chip_name);
4170 info->name = spec->stream_name_analog;
4172 if (spec->stream_analog_playback) {
4173 if (snd_BUG_ON(!spec->multiout.dac_nids))
4175 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4176 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4178 if (spec->stream_analog_capture) {
4179 if (snd_BUG_ON(!spec->adc_nids))
4181 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4182 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4185 if (spec->channel_mode) {
4186 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4187 for (i = 0; i < spec->num_channel_mode; i++) {
4188 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4189 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4195 /* SPDIF for stream index #1 */
4196 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4197 snprintf(spec->stream_name_digital,
4198 sizeof(spec->stream_name_digital),
4199 "%s Digital", codec->chip_name);
4200 codec->num_pcms = 2;
4201 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4202 info = spec->pcm_rec + 1;
4203 info->name = spec->stream_name_digital;
4204 if (spec->dig_out_type)
4205 info->pcm_type = spec->dig_out_type;
4207 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4208 if (spec->multiout.dig_out_nid &&
4209 spec->stream_digital_playback) {
4210 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4211 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4213 if (spec->dig_in_nid &&
4214 spec->stream_digital_capture) {
4215 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4216 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4218 /* FIXME: do we need this for all Realtek codec models? */
4219 codec->spdif_status_reset = 1;
4222 if (spec->no_analog)
4225 /* If the use of more than one ADC is requested for the current
4226 * model, configure a second analog capture-only PCM.
4228 /* Additional Analaog capture for index #2 */
4229 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4230 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4231 codec->num_pcms = 3;
4232 info = spec->pcm_rec + 2;
4233 info->name = spec->stream_name_analog;
4234 if (spec->alt_dac_nid) {
4235 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4236 *spec->stream_analog_alt_playback;
4237 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4240 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4241 alc_pcm_null_stream;
4242 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4244 if (spec->num_adc_nids > 1) {
4245 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4246 *spec->stream_analog_alt_capture;
4247 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4249 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4250 spec->num_adc_nids - 1;
4252 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4253 alc_pcm_null_stream;
4254 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4261 static inline void alc_shutup(struct hda_codec *codec)
4263 snd_hda_shutup_pins(codec);
4266 static void alc_free_kctls(struct hda_codec *codec)
4268 struct alc_spec *spec = codec->spec;
4270 if (spec->kctls.list) {
4271 struct snd_kcontrol_new *kctl = spec->kctls.list;
4273 for (i = 0; i < spec->kctls.used; i++)
4274 kfree(kctl[i].name);
4276 snd_array_free(&spec->kctls);
4279 static void alc_free(struct hda_codec *codec)
4281 struct alc_spec *spec = codec->spec;
4287 alc_free_kctls(codec);
4289 snd_hda_detach_beep_device(codec);
4292 #ifdef CONFIG_SND_HDA_POWER_SAVE
4293 static void alc_power_eapd(struct hda_codec *codec)
4295 /* We currently only handle front, HP */
4296 switch (codec->vendor_id) {
4298 set_eapd(codec, 0x0f, 0);
4299 set_eapd(codec, 0x10, 0);
4312 set_eapd(codec, 0x14, 0);
4313 set_eapd(codec, 0x15, 0);
4318 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4320 struct alc_spec *spec = codec->spec;
4322 if (spec && spec->power_hook)
4323 spec->power_hook(codec);
4328 #ifdef SND_HDA_NEEDS_RESUME
4329 static int alc_resume(struct hda_codec *codec)
4331 codec->patch_ops.init(codec);
4332 snd_hda_codec_resume_amp(codec);
4333 snd_hda_codec_resume_cache(codec);
4334 hda_call_check_power_status(codec, 0x01);
4341 static struct hda_codec_ops alc_patch_ops = {
4342 .build_controls = alc_build_controls,
4343 .build_pcms = alc_build_pcms,
4346 .unsol_event = alc_unsol_event,
4347 #ifdef SND_HDA_NEEDS_RESUME
4348 .resume = alc_resume,
4350 #ifdef CONFIG_SND_HDA_POWER_SAVE
4351 .suspend = alc_suspend,
4352 .check_power_status = alc_check_power_status,
4354 .reboot_notify = alc_shutup,
4357 /* replace the codec chip_name with the given string */
4358 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4360 kfree(codec->chip_name);
4361 codec->chip_name = kstrdup(name, GFP_KERNEL);
4362 if (!codec->chip_name) {
4370 * Test configuration for debugging
4372 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4375 #ifdef CONFIG_SND_DEBUG
4376 static hda_nid_t alc880_test_dac_nids[4] = {
4377 0x02, 0x03, 0x04, 0x05
4380 static struct hda_input_mux alc880_test_capture_source = {
4389 { "Surround", 0x6 },
4393 static struct hda_channel_mode alc880_test_modes[4] = {
4400 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4401 struct snd_ctl_elem_info *uinfo)
4403 static char *texts[] = {
4404 "N/A", "Line Out", "HP Out",
4405 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4407 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4409 uinfo->value.enumerated.items = 8;
4410 if (uinfo->value.enumerated.item >= 8)
4411 uinfo->value.enumerated.item = 7;
4412 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4416 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4417 struct snd_ctl_elem_value *ucontrol)
4419 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4420 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4421 unsigned int pin_ctl, item = 0;
4423 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4424 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4425 if (pin_ctl & AC_PINCTL_OUT_EN) {
4426 if (pin_ctl & AC_PINCTL_HP_EN)
4430 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4431 switch (pin_ctl & AC_PINCTL_VREFEN) {
4432 case AC_PINCTL_VREF_HIZ: item = 3; break;
4433 case AC_PINCTL_VREF_50: item = 4; break;
4434 case AC_PINCTL_VREF_GRD: item = 5; break;
4435 case AC_PINCTL_VREF_80: item = 6; break;
4436 case AC_PINCTL_VREF_100: item = 7; break;
4439 ucontrol->value.enumerated.item[0] = item;
4443 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4444 struct snd_ctl_elem_value *ucontrol)
4446 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4447 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4448 static unsigned int ctls[] = {
4449 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4450 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4451 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4452 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4453 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4454 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4456 unsigned int old_ctl, new_ctl;
4458 old_ctl = snd_hda_codec_read(codec, nid, 0,
4459 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4460 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4461 if (old_ctl != new_ctl) {
4463 snd_hda_codec_write_cache(codec, nid, 0,
4464 AC_VERB_SET_PIN_WIDGET_CONTROL,
4466 val = ucontrol->value.enumerated.item[0] >= 3 ?
4468 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4475 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4476 struct snd_ctl_elem_info *uinfo)
4478 static char *texts[] = {
4479 "Front", "Surround", "CLFE", "Side"
4481 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4483 uinfo->value.enumerated.items = 4;
4484 if (uinfo->value.enumerated.item >= 4)
4485 uinfo->value.enumerated.item = 3;
4486 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4490 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4491 struct snd_ctl_elem_value *ucontrol)
4493 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4494 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4497 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4498 ucontrol->value.enumerated.item[0] = sel & 3;
4502 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4503 struct snd_ctl_elem_value *ucontrol)
4505 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4506 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4509 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4510 if (ucontrol->value.enumerated.item[0] != sel) {
4511 sel = ucontrol->value.enumerated.item[0] & 3;
4512 snd_hda_codec_write_cache(codec, nid, 0,
4513 AC_VERB_SET_CONNECT_SEL, sel);
4519 #define PIN_CTL_TEST(xname,nid) { \
4520 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4522 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4523 .info = alc_test_pin_ctl_info, \
4524 .get = alc_test_pin_ctl_get, \
4525 .put = alc_test_pin_ctl_put, \
4526 .private_value = nid \
4529 #define PIN_SRC_TEST(xname,nid) { \
4530 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4532 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4533 .info = alc_test_pin_src_info, \
4534 .get = alc_test_pin_src_get, \
4535 .put = alc_test_pin_src_put, \
4536 .private_value = nid \
4539 static struct snd_kcontrol_new alc880_test_mixer[] = {
4540 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4541 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4542 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4543 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4544 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4545 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4546 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4547 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4548 PIN_CTL_TEST("Front Pin Mode", 0x14),
4549 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4550 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4551 PIN_CTL_TEST("Side Pin Mode", 0x17),
4552 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4553 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4554 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4555 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4556 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4557 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4558 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4559 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4560 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4561 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4562 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4563 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4564 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4565 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4566 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4567 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4568 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4569 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4571 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4572 .name = "Channel Mode",
4573 .info = alc_ch_mode_info,
4574 .get = alc_ch_mode_get,
4575 .put = alc_ch_mode_put,
4580 static struct hda_verb alc880_test_init_verbs[] = {
4581 /* Unmute inputs of 0x0c - 0x0f */
4582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4587 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4588 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4589 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4590 /* Vol output for 0x0c-0x0f */
4591 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4592 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4593 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4594 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4595 /* Set output pins 0x14-0x17 */
4596 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4597 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4598 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4599 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4600 /* Unmute output pins 0x14-0x17 */
4601 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4602 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4603 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4604 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4605 /* Set input pins 0x18-0x1c */
4606 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4607 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4608 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4609 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4610 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4611 /* Mute input pins 0x18-0x1b */
4612 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4613 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4614 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4615 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4618 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4619 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4620 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4621 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4622 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4623 /* Analog input/passthru */
4624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4636 static const char * const alc880_models[ALC880_MODEL_LAST] = {
4637 [ALC880_3ST] = "3stack",
4638 [ALC880_TCL_S700] = "tcl",
4639 [ALC880_3ST_DIG] = "3stack-digout",
4640 [ALC880_CLEVO] = "clevo",
4641 [ALC880_5ST] = "5stack",
4642 [ALC880_5ST_DIG] = "5stack-digout",
4643 [ALC880_W810] = "w810",
4644 [ALC880_Z71V] = "z71v",
4645 [ALC880_6ST] = "6stack",
4646 [ALC880_6ST_DIG] = "6stack-digout",
4647 [ALC880_ASUS] = "asus",
4648 [ALC880_ASUS_W1V] = "asus-w1v",
4649 [ALC880_ASUS_DIG] = "asus-dig",
4650 [ALC880_ASUS_DIG2] = "asus-dig2",
4651 [ALC880_UNIWILL_DIG] = "uniwill",
4652 [ALC880_UNIWILL_P53] = "uniwill-p53",
4653 [ALC880_FUJITSU] = "fujitsu",
4654 [ALC880_F1734] = "F1734",
4656 [ALC880_LG_LW] = "lg-lw",
4657 [ALC880_MEDION_RIM] = "medion",
4658 #ifdef CONFIG_SND_DEBUG
4659 [ALC880_TEST] = "test",
4661 [ALC880_AUTO] = "auto",
4664 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4665 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4666 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4667 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4668 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4669 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4670 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4671 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4672 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4673 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4674 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4675 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4676 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4677 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4678 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4679 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4680 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4681 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4682 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4683 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4684 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4685 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4686 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4687 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4688 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4689 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4690 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4691 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4692 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4693 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4694 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4695 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4696 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4697 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4698 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4699 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4700 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4701 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4702 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4703 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4704 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4705 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4706 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4707 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4708 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4709 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4710 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4711 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4712 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4713 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4714 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4715 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4716 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4717 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4718 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
4719 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4720 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4721 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4722 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4723 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4724 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4725 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4726 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4727 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4728 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4729 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4730 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4731 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4732 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4733 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4735 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4736 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4737 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4742 * ALC880 codec presets
4744 static struct alc_config_preset alc880_presets[] = {
4746 .mixers = { alc880_three_stack_mixer },
4747 .init_verbs = { alc880_volume_init_verbs,
4748 alc880_pin_3stack_init_verbs },
4749 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4750 .dac_nids = alc880_dac_nids,
4751 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4752 .channel_mode = alc880_threestack_modes,
4754 .input_mux = &alc880_capture_source,
4756 [ALC880_3ST_DIG] = {
4757 .mixers = { alc880_three_stack_mixer },
4758 .init_verbs = { alc880_volume_init_verbs,
4759 alc880_pin_3stack_init_verbs },
4760 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4761 .dac_nids = alc880_dac_nids,
4762 .dig_out_nid = ALC880_DIGOUT_NID,
4763 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4764 .channel_mode = alc880_threestack_modes,
4766 .input_mux = &alc880_capture_source,
4768 [ALC880_TCL_S700] = {
4769 .mixers = { alc880_tcl_s700_mixer },
4770 .init_verbs = { alc880_volume_init_verbs,
4771 alc880_pin_tcl_S700_init_verbs,
4772 alc880_gpio2_init_verbs },
4773 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4774 .dac_nids = alc880_dac_nids,
4775 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4776 .num_adc_nids = 1, /* single ADC */
4778 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4779 .channel_mode = alc880_2_jack_modes,
4780 .input_mux = &alc880_capture_source,
4783 .mixers = { alc880_three_stack_mixer,
4784 alc880_five_stack_mixer},
4785 .init_verbs = { alc880_volume_init_verbs,
4786 alc880_pin_5stack_init_verbs },
4787 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4788 .dac_nids = alc880_dac_nids,
4789 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4790 .channel_mode = alc880_fivestack_modes,
4791 .input_mux = &alc880_capture_source,
4793 [ALC880_5ST_DIG] = {
4794 .mixers = { alc880_three_stack_mixer,
4795 alc880_five_stack_mixer },
4796 .init_verbs = { alc880_volume_init_verbs,
4797 alc880_pin_5stack_init_verbs },
4798 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4799 .dac_nids = alc880_dac_nids,
4800 .dig_out_nid = ALC880_DIGOUT_NID,
4801 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4802 .channel_mode = alc880_fivestack_modes,
4803 .input_mux = &alc880_capture_source,
4806 .mixers = { alc880_six_stack_mixer },
4807 .init_verbs = { alc880_volume_init_verbs,
4808 alc880_pin_6stack_init_verbs },
4809 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4810 .dac_nids = alc880_6st_dac_nids,
4811 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4812 .channel_mode = alc880_sixstack_modes,
4813 .input_mux = &alc880_6stack_capture_source,
4815 [ALC880_6ST_DIG] = {
4816 .mixers = { alc880_six_stack_mixer },
4817 .init_verbs = { alc880_volume_init_verbs,
4818 alc880_pin_6stack_init_verbs },
4819 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4820 .dac_nids = alc880_6st_dac_nids,
4821 .dig_out_nid = ALC880_DIGOUT_NID,
4822 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4823 .channel_mode = alc880_sixstack_modes,
4824 .input_mux = &alc880_6stack_capture_source,
4827 .mixers = { alc880_w810_base_mixer },
4828 .init_verbs = { alc880_volume_init_verbs,
4829 alc880_pin_w810_init_verbs,
4830 alc880_gpio2_init_verbs },
4831 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4832 .dac_nids = alc880_w810_dac_nids,
4833 .dig_out_nid = ALC880_DIGOUT_NID,
4834 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4835 .channel_mode = alc880_w810_modes,
4836 .input_mux = &alc880_capture_source,
4839 .mixers = { alc880_z71v_mixer },
4840 .init_verbs = { alc880_volume_init_verbs,
4841 alc880_pin_z71v_init_verbs },
4842 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4843 .dac_nids = alc880_z71v_dac_nids,
4844 .dig_out_nid = ALC880_DIGOUT_NID,
4846 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4847 .channel_mode = alc880_2_jack_modes,
4848 .input_mux = &alc880_capture_source,
4851 .mixers = { alc880_f1734_mixer },
4852 .init_verbs = { alc880_volume_init_verbs,
4853 alc880_pin_f1734_init_verbs },
4854 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4855 .dac_nids = alc880_f1734_dac_nids,
4857 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4858 .channel_mode = alc880_2_jack_modes,
4859 .input_mux = &alc880_f1734_capture_source,
4860 .unsol_event = alc880_uniwill_p53_unsol_event,
4861 .setup = alc880_uniwill_p53_setup,
4862 .init_hook = alc_automute_amp,
4865 .mixers = { alc880_asus_mixer },
4866 .init_verbs = { alc880_volume_init_verbs,
4867 alc880_pin_asus_init_verbs,
4868 alc880_gpio1_init_verbs },
4869 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4870 .dac_nids = alc880_asus_dac_nids,
4871 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4872 .channel_mode = alc880_asus_modes,
4874 .input_mux = &alc880_capture_source,
4876 [ALC880_ASUS_DIG] = {
4877 .mixers = { alc880_asus_mixer },
4878 .init_verbs = { alc880_volume_init_verbs,
4879 alc880_pin_asus_init_verbs,
4880 alc880_gpio1_init_verbs },
4881 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4882 .dac_nids = alc880_asus_dac_nids,
4883 .dig_out_nid = ALC880_DIGOUT_NID,
4884 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4885 .channel_mode = alc880_asus_modes,
4887 .input_mux = &alc880_capture_source,
4889 [ALC880_ASUS_DIG2] = {
4890 .mixers = { alc880_asus_mixer },
4891 .init_verbs = { alc880_volume_init_verbs,
4892 alc880_pin_asus_init_verbs,
4893 alc880_gpio2_init_verbs }, /* use GPIO2 */
4894 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4895 .dac_nids = alc880_asus_dac_nids,
4896 .dig_out_nid = ALC880_DIGOUT_NID,
4897 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4898 .channel_mode = alc880_asus_modes,
4900 .input_mux = &alc880_capture_source,
4902 [ALC880_ASUS_W1V] = {
4903 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4904 .init_verbs = { alc880_volume_init_verbs,
4905 alc880_pin_asus_init_verbs,
4906 alc880_gpio1_init_verbs },
4907 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4908 .dac_nids = alc880_asus_dac_nids,
4909 .dig_out_nid = ALC880_DIGOUT_NID,
4910 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4911 .channel_mode = alc880_asus_modes,
4913 .input_mux = &alc880_capture_source,
4915 [ALC880_UNIWILL_DIG] = {
4916 .mixers = { alc880_asus_mixer },
4917 .init_verbs = { alc880_volume_init_verbs,
4918 alc880_pin_asus_init_verbs },
4919 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4920 .dac_nids = alc880_asus_dac_nids,
4921 .dig_out_nid = ALC880_DIGOUT_NID,
4922 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4923 .channel_mode = alc880_asus_modes,
4925 .input_mux = &alc880_capture_source,
4927 [ALC880_UNIWILL] = {
4928 .mixers = { alc880_uniwill_mixer },
4929 .init_verbs = { alc880_volume_init_verbs,
4930 alc880_uniwill_init_verbs },
4931 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4932 .dac_nids = alc880_asus_dac_nids,
4933 .dig_out_nid = ALC880_DIGOUT_NID,
4934 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4935 .channel_mode = alc880_threestack_modes,
4937 .input_mux = &alc880_capture_source,
4938 .unsol_event = alc880_uniwill_unsol_event,
4939 .setup = alc880_uniwill_setup,
4940 .init_hook = alc880_uniwill_init_hook,
4942 [ALC880_UNIWILL_P53] = {
4943 .mixers = { alc880_uniwill_p53_mixer },
4944 .init_verbs = { alc880_volume_init_verbs,
4945 alc880_uniwill_p53_init_verbs },
4946 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4947 .dac_nids = alc880_asus_dac_nids,
4948 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4949 .channel_mode = alc880_threestack_modes,
4950 .input_mux = &alc880_capture_source,
4951 .unsol_event = alc880_uniwill_p53_unsol_event,
4952 .setup = alc880_uniwill_p53_setup,
4953 .init_hook = alc_automute_amp,
4955 [ALC880_FUJITSU] = {
4956 .mixers = { alc880_fujitsu_mixer },
4957 .init_verbs = { alc880_volume_init_verbs,
4958 alc880_uniwill_p53_init_verbs,
4959 alc880_beep_init_verbs },
4960 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4961 .dac_nids = alc880_dac_nids,
4962 .dig_out_nid = ALC880_DIGOUT_NID,
4963 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4964 .channel_mode = alc880_2_jack_modes,
4965 .input_mux = &alc880_capture_source,
4966 .unsol_event = alc880_uniwill_p53_unsol_event,
4967 .setup = alc880_uniwill_p53_setup,
4968 .init_hook = alc_automute_amp,
4971 .mixers = { alc880_three_stack_mixer },
4972 .init_verbs = { alc880_volume_init_verbs,
4973 alc880_pin_clevo_init_verbs },
4974 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4975 .dac_nids = alc880_dac_nids,
4977 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4978 .channel_mode = alc880_threestack_modes,
4980 .input_mux = &alc880_capture_source,
4983 .mixers = { alc880_lg_mixer },
4984 .init_verbs = { alc880_volume_init_verbs,
4985 alc880_lg_init_verbs },
4986 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4987 .dac_nids = alc880_lg_dac_nids,
4988 .dig_out_nid = ALC880_DIGOUT_NID,
4989 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4990 .channel_mode = alc880_lg_ch_modes,
4992 .input_mux = &alc880_lg_capture_source,
4993 .unsol_event = alc_automute_amp_unsol_event,
4994 .setup = alc880_lg_setup,
4995 .init_hook = alc_automute_amp,
4996 #ifdef CONFIG_SND_HDA_POWER_SAVE
4997 .loopbacks = alc880_lg_loopbacks,
5001 .mixers = { alc880_lg_lw_mixer },
5002 .init_verbs = { alc880_volume_init_verbs,
5003 alc880_lg_lw_init_verbs },
5004 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5005 .dac_nids = alc880_dac_nids,
5006 .dig_out_nid = ALC880_DIGOUT_NID,
5007 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
5008 .channel_mode = alc880_lg_lw_modes,
5009 .input_mux = &alc880_lg_lw_capture_source,
5010 .unsol_event = alc_automute_amp_unsol_event,
5011 .setup = alc880_lg_lw_setup,
5012 .init_hook = alc_automute_amp,
5014 [ALC880_MEDION_RIM] = {
5015 .mixers = { alc880_medion_rim_mixer },
5016 .init_verbs = { alc880_volume_init_verbs,
5017 alc880_medion_rim_init_verbs,
5018 alc_gpio2_init_verbs },
5019 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5020 .dac_nids = alc880_dac_nids,
5021 .dig_out_nid = ALC880_DIGOUT_NID,
5022 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5023 .channel_mode = alc880_2_jack_modes,
5024 .input_mux = &alc880_medion_rim_capture_source,
5025 .unsol_event = alc880_medion_rim_unsol_event,
5026 .setup = alc880_medion_rim_setup,
5027 .init_hook = alc880_medion_rim_automute,
5029 #ifdef CONFIG_SND_DEBUG
5031 .mixers = { alc880_test_mixer },
5032 .init_verbs = { alc880_test_init_verbs },
5033 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
5034 .dac_nids = alc880_test_dac_nids,
5035 .dig_out_nid = ALC880_DIGOUT_NID,
5036 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
5037 .channel_mode = alc880_test_modes,
5038 .input_mux = &alc880_test_capture_source,
5044 * Automatic parse of I/O pins from the BIOS configuration
5049 ALC_CTL_WIDGET_MUTE,
5052 static struct snd_kcontrol_new alc880_control_templates[] = {
5053 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
5054 HDA_CODEC_MUTE(NULL, 0, 0, 0),
5055 HDA_BIND_MUTE(NULL, 0, 0, 0),
5058 /* add dynamic controls */
5059 static int add_control(struct alc_spec *spec, int type, const char *name,
5060 int cidx, unsigned long val)
5062 struct snd_kcontrol_new *knew;
5064 snd_array_init(&spec->kctls, sizeof(*knew), 32);
5065 knew = snd_array_new(&spec->kctls);
5068 *knew = alc880_control_templates[type];
5069 knew->name = kstrdup(name, GFP_KERNEL);
5073 if (get_amp_nid_(val))
5074 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
5075 knew->private_value = val;
5079 static int add_control_with_pfx(struct alc_spec *spec, int type,
5080 const char *pfx, const char *dir,
5081 const char *sfx, int cidx, unsigned long val)
5084 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
5085 return add_control(spec, type, name, cidx, val);
5088 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5089 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5090 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5091 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5092 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5093 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5094 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5095 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5097 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5098 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5099 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5100 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5101 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5102 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5103 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5104 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5105 #define ALC880_PIN_CD_NID 0x1c
5107 /* fill in the dac_nids table from the parsed pin configuration */
5108 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
5109 const struct auto_pin_cfg *cfg)
5115 memset(assigned, 0, sizeof(assigned));
5116 spec->multiout.dac_nids = spec->private_dac_nids;
5118 /* check the pins hardwired to audio widget */
5119 for (i = 0; i < cfg->line_outs; i++) {
5120 nid = cfg->line_out_pins[i];
5121 if (alc880_is_fixed_pin(nid)) {
5122 int idx = alc880_fixed_pin_idx(nid);
5123 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
5127 /* left pins can be connect to any audio widget */
5128 for (i = 0; i < cfg->line_outs; i++) {
5129 nid = cfg->line_out_pins[i];
5130 if (alc880_is_fixed_pin(nid))
5132 /* search for an empty channel */
5133 for (j = 0; j < cfg->line_outs; j++) {
5135 spec->multiout.dac_nids[i] =
5136 alc880_idx_to_dac(j);
5142 spec->multiout.num_dacs = cfg->line_outs;
5146 static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5149 if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5152 switch (cfg->line_out_type) {
5153 case AUTO_PIN_SPEAKER_OUT:
5154 if (cfg->line_outs == 1)
5157 case AUTO_PIN_HP_OUT:
5160 if (cfg->line_outs == 1)
5167 /* add playback controls from the parsed DAC table */
5168 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5169 const struct auto_pin_cfg *cfg)
5171 static const char * const chname[4] = {
5172 "Front", "Surround", NULL /*CLFE*/, "Side"
5174 const char *pfx = alc_get_line_out_pfx(cfg, false);
5178 for (i = 0; i < cfg->line_outs; i++) {
5179 if (!spec->multiout.dac_nids[i])
5181 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5182 if (!pfx && i == 2) {
5184 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5186 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5190 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5192 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5196 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5198 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5202 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5204 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5209 const char *name = pfx;
5212 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5214 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5218 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5220 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5229 /* add playback controls for speaker and HP outputs */
5230 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5239 if (alc880_is_fixed_pin(pin)) {
5240 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5241 /* specify the DAC as the extra output */
5242 if (!spec->multiout.hp_nid)
5243 spec->multiout.hp_nid = nid;
5245 spec->multiout.extra_out_nid[0] = nid;
5246 /* control HP volume/switch on the output mixer amp */
5247 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5248 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5249 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5252 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5253 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5256 } else if (alc880_is_multi_pin(pin)) {
5257 /* set manual connection */
5258 /* we have only a switch on HP-out PIN */
5259 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5260 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5267 /* create input playback/capture controls for the given pin */
5268 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5269 const char *ctlname, int ctlidx,
5270 int idx, hda_nid_t mix_nid)
5274 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5275 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5278 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5279 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5285 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5287 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5288 return (pincap & AC_PINCAP_IN) != 0;
5291 /* create playback/capture controls for input pins */
5292 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5293 const struct auto_pin_cfg *cfg,
5295 hda_nid_t cap1, hda_nid_t cap2)
5297 struct alc_spec *spec = codec->spec;
5298 struct hda_input_mux *imux = &spec->private_imux[0];
5299 int i, err, idx, type_idx = 0;
5300 const char *prev_label = NULL;
5302 for (i = 0; i < cfg->num_inputs; i++) {
5306 pin = cfg->inputs[i].pin;
5307 if (!alc_is_input_pin(codec, pin))
5310 label = hda_get_autocfg_input_label(codec, cfg, i);
5311 if (prev_label && !strcmp(label, prev_label))
5318 idx = get_connection_index(codec, mixer, pin);
5320 err = new_analog_input(spec, pin,
5330 idx = get_connection_index(codec, cap1, pin);
5331 if (idx < 0 && cap2)
5332 idx = get_connection_index(codec, cap2, pin);
5334 snd_hda_add_imux_item(imux, label, idx, NULL);
5339 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5340 const struct auto_pin_cfg *cfg)
5342 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5345 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5346 unsigned int pin_type)
5348 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5351 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5355 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5356 hda_nid_t nid, int pin_type,
5359 alc_set_pin_output(codec, nid, pin_type);
5360 /* need the manual connection? */
5361 if (alc880_is_multi_pin(nid)) {
5362 struct alc_spec *spec = codec->spec;
5363 int idx = alc880_multi_pin_idx(nid);
5364 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5365 AC_VERB_SET_CONNECT_SEL,
5366 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5370 static int get_pin_type(int line_out_type)
5372 if (line_out_type == AUTO_PIN_HP_OUT)
5378 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5380 struct alc_spec *spec = codec->spec;
5383 for (i = 0; i < spec->autocfg.line_outs; i++) {
5384 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5385 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5386 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5390 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5392 struct alc_spec *spec = codec->spec;
5395 pin = spec->autocfg.speaker_pins[0];
5396 if (pin) /* connect to front */
5397 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5398 pin = spec->autocfg.hp_pins[0];
5399 if (pin) /* connect to front */
5400 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5403 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5405 struct alc_spec *spec = codec->spec;
5406 struct auto_pin_cfg *cfg = &spec->autocfg;
5409 for (i = 0; i < cfg->num_inputs; i++) {
5410 hda_nid_t nid = cfg->inputs[i].pin;
5411 if (alc_is_input_pin(codec, nid)) {
5412 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5413 if (nid != ALC880_PIN_CD_NID &&
5414 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5415 snd_hda_codec_write(codec, nid, 0,
5416 AC_VERB_SET_AMP_GAIN_MUTE,
5422 static void alc880_auto_init_input_src(struct hda_codec *codec)
5424 struct alc_spec *spec = codec->spec;
5427 for (c = 0; c < spec->num_adc_nids; c++) {
5428 unsigned int mux_idx;
5429 const struct hda_input_mux *imux;
5430 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5431 imux = &spec->input_mux[mux_idx];
5432 if (!imux->num_items && mux_idx > 0)
5433 imux = &spec->input_mux[0];
5435 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5436 AC_VERB_SET_CONNECT_SEL,
5437 imux->items[0].index);
5441 /* parse the BIOS configuration and set up the alc_spec */
5442 /* return 1 if successful, 0 if the proper config is not found,
5443 * or a negative error code
5445 static int alc880_parse_auto_config(struct hda_codec *codec)
5447 struct alc_spec *spec = codec->spec;
5449 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5451 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5455 if (!spec->autocfg.line_outs)
5456 return 0; /* can't find valid BIOS pin config */
5458 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5461 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5464 err = alc880_auto_create_extra_out(spec,
5465 spec->autocfg.speaker_pins[0],
5469 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5473 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5477 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5479 alc_auto_parse_digital(codec);
5481 if (spec->kctls.list)
5482 add_mixer(spec, spec->kctls.list);
5484 add_verb(spec, alc880_volume_init_verbs);
5486 spec->num_mux_defs = 1;
5487 spec->input_mux = &spec->private_imux[0];
5489 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5494 /* additional initialization for auto-configuration model */
5495 static void alc880_auto_init(struct hda_codec *codec)
5497 struct alc_spec *spec = codec->spec;
5498 alc880_auto_init_multi_out(codec);
5499 alc880_auto_init_extra_out(codec);
5500 alc880_auto_init_analog_input(codec);
5501 alc880_auto_init_input_src(codec);
5502 alc_auto_init_digital(codec);
5503 if (spec->unsol_event)
5504 alc_inithook(codec);
5507 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5508 * one of two digital mic pins, e.g. on ALC272
5510 static void fixup_automic_adc(struct hda_codec *codec)
5512 struct alc_spec *spec = codec->spec;
5515 for (i = 0; i < spec->num_adc_nids; i++) {
5516 hda_nid_t cap = spec->capsrc_nids ?
5517 spec->capsrc_nids[i] : spec->adc_nids[i];
5520 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5523 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5526 spec->int_mic.mux_idx = iidx;
5527 spec->ext_mic.mux_idx = eidx;
5528 if (spec->capsrc_nids)
5529 spec->capsrc_nids += i;
5530 spec->adc_nids += i;
5531 spec->num_adc_nids = 1;
5534 snd_printd(KERN_INFO "hda_codec: %s: "
5535 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5536 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5537 spec->auto_mic = 0; /* disable auto-mic to be sure */
5540 /* select or unmute the given capsrc route */
5541 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5544 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5545 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5548 snd_hda_codec_write_cache(codec, cap, 0,
5549 AC_VERB_SET_CONNECT_SEL, idx);
5553 /* set the default connection to that pin */
5554 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5556 struct alc_spec *spec = codec->spec;
5559 for (i = 0; i < spec->num_adc_nids; i++) {
5560 hda_nid_t cap = spec->capsrc_nids ?
5561 spec->capsrc_nids[i] : spec->adc_nids[i];
5564 idx = get_connection_index(codec, cap, pin);
5567 select_or_unmute_capsrc(codec, cap, idx);
5568 return i; /* return the found index */
5570 return -1; /* not found */
5573 /* choose the ADC/MUX containing the input pin and initialize the setup */
5574 static void fixup_single_adc(struct hda_codec *codec)
5576 struct alc_spec *spec = codec->spec;
5577 struct auto_pin_cfg *cfg = &spec->autocfg;
5580 /* search for the input pin; there must be only one */
5581 if (cfg->num_inputs != 1)
5583 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5585 /* use only this ADC */
5586 if (spec->capsrc_nids)
5587 spec->capsrc_nids += i;
5588 spec->adc_nids += i;
5589 spec->num_adc_nids = 1;
5593 /* initialize dual adcs */
5594 static void fixup_dual_adc_switch(struct hda_codec *codec)
5596 struct alc_spec *spec = codec->spec;
5597 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5598 init_capsrc_for_pin(codec, spec->int_mic.pin);
5601 static void set_capture_mixer(struct hda_codec *codec)
5603 struct alc_spec *spec = codec->spec;
5604 static struct snd_kcontrol_new *caps[2][3] = {
5605 { alc_capture_mixer_nosrc1,
5606 alc_capture_mixer_nosrc2,
5607 alc_capture_mixer_nosrc3 },
5608 { alc_capture_mixer1,
5610 alc_capture_mixer3 },
5612 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5614 int num_adcs = spec->num_adc_nids;
5615 if (spec->dual_adc_switch)
5616 fixup_dual_adc_switch(codec);
5617 else if (spec->auto_mic)
5618 fixup_automic_adc(codec);
5619 else if (spec->input_mux) {
5620 if (spec->input_mux->num_items > 1)
5622 else if (spec->input_mux->num_items == 1)
5623 fixup_single_adc(codec);
5625 if (spec->dual_adc_switch)
5627 spec->cap_mixer = caps[mux][num_adcs - 1];
5631 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5632 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5635 struct alc_spec *spec = codec->spec;
5636 struct auto_pin_cfg *cfg = &spec->autocfg;
5638 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5640 for (n = 0; n < num_nids; n++) {
5642 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5646 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5649 nconns = snd_hda_get_connections(codec, cap, conn,
5653 nconns = snd_hda_get_connections(codec, cap, conn,
5658 if (!fallback_adc) {
5662 for (i = 0; i < cfg->num_inputs; i++) {
5663 hda_nid_t nid = cfg->inputs[i].pin;
5664 for (j = 0; j < nconns; j++) {
5671 if (i >= cfg->num_inputs) {
5672 int num_adcs = spec->num_adc_nids;
5673 spec->private_adc_nids[num_adcs] = adc;
5674 spec->private_capsrc_nids[num_adcs] = cap;
5675 spec->num_adc_nids++;
5676 spec->adc_nids = spec->private_adc_nids;
5678 spec->capsrc_nids = spec->private_capsrc_nids;
5681 if (!spec->num_adc_nids) {
5682 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5683 " using fallback 0x%x\n",
5684 codec->chip_name, fallback_adc);
5685 spec->private_adc_nids[0] = fallback_adc;
5686 spec->adc_nids = spec->private_adc_nids;
5687 if (fallback_adc != fallback_cap) {
5688 spec->private_capsrc_nids[0] = fallback_cap;
5689 spec->capsrc_nids = spec->private_adc_nids;
5694 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5695 #define set_beep_amp(spec, nid, idx, dir) \
5696 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5698 static struct snd_pci_quirk beep_white_list[] = {
5699 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5700 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5701 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5705 static inline int has_cdefine_beep(struct hda_codec *codec)
5707 struct alc_spec *spec = codec->spec;
5708 const struct snd_pci_quirk *q;
5709 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5712 return spec->cdefine.enable_pcbeep;
5715 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5716 #define has_cdefine_beep(codec) 0
5720 * OK, here we have finally the patch for ALC880
5723 static int patch_alc880(struct hda_codec *codec)
5725 struct alc_spec *spec;
5729 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5735 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5738 if (board_config < 0) {
5739 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5741 board_config = ALC880_AUTO;
5744 if (board_config == ALC880_AUTO) {
5745 /* automatic parse from the BIOS config */
5746 err = alc880_parse_auto_config(codec);
5752 "hda_codec: Cannot set up configuration "
5753 "from BIOS. Using 3-stack mode...\n");
5754 board_config = ALC880_3ST;
5758 err = snd_hda_attach_beep_device(codec, 0x1);
5764 if (board_config != ALC880_AUTO)
5765 setup_preset(codec, &alc880_presets[board_config]);
5767 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5768 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5769 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5771 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5772 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5774 if (!spec->adc_nids && spec->input_mux) {
5775 /* check whether NID 0x07 is valid */
5776 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5778 wcap = get_wcaps_type(wcap);
5779 if (wcap != AC_WID_AUD_IN) {
5780 spec->adc_nids = alc880_adc_nids_alt;
5781 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5783 spec->adc_nids = alc880_adc_nids;
5784 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5787 set_capture_mixer(codec);
5788 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5790 spec->vmaster_nid = 0x0c;
5792 codec->patch_ops = alc_patch_ops;
5793 if (board_config == ALC880_AUTO)
5794 spec->init_hook = alc880_auto_init;
5795 #ifdef CONFIG_SND_HDA_POWER_SAVE
5796 if (!spec->loopback.amplist)
5797 spec->loopback.amplist = alc880_loopbacks;
5808 static hda_nid_t alc260_dac_nids[1] = {
5813 static hda_nid_t alc260_adc_nids[1] = {
5818 static hda_nid_t alc260_adc_nids_alt[1] = {
5823 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5824 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5826 static hda_nid_t alc260_dual_adc_nids[2] = {
5831 #define ALC260_DIGOUT_NID 0x03
5832 #define ALC260_DIGIN_NID 0x06
5834 static struct hda_input_mux alc260_capture_source = {
5838 { "Front Mic", 0x1 },
5844 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5845 * headphone jack and the internal CD lines since these are the only pins at
5846 * which audio can appear. For flexibility, also allow the option of
5847 * recording the mixer output on the second ADC (ADC0 doesn't have a
5848 * connection to the mixer output).
5850 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5854 { "Mic/Line", 0x0 },
5856 { "Headphone", 0x2 },
5862 { "Mic/Line", 0x0 },
5864 { "Headphone", 0x2 },
5871 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5872 * the Fujitsu S702x, but jacks are marked differently.
5874 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5881 { "Headphone", 0x5 },
5890 { "Headphone", 0x6 },
5896 /* Maxdata Favorit 100XS */
5897 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5901 { "Line/Mic", 0x0 },
5908 { "Line/Mic", 0x0 },
5916 * This is just place-holder, so there's something for alc_build_pcms to look
5917 * at when it calculates the maximum number of channels. ALC260 has no mixer
5918 * element which allows changing the channel mode, so the verb list is
5921 static struct hda_channel_mode alc260_modes[1] = {
5926 /* Mixer combinations
5928 * basic: base_output + input + pc_beep + capture
5929 * HP: base_output + input + capture_alt
5930 * HP_3013: hp_3013 + input + capture
5931 * fujitsu: fujitsu + capture
5932 * acer: acer + capture
5935 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5936 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5937 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5938 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5939 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5940 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5941 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5945 static struct snd_kcontrol_new alc260_input_mixer[] = {
5946 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5947 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5948 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5949 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5950 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5951 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5952 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5953 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5957 /* update HP, line and mono out pins according to the master switch */
5958 static void alc260_hp_master_update(struct hda_codec *codec,
5959 hda_nid_t hp, hda_nid_t line,
5962 struct alc_spec *spec = codec->spec;
5963 unsigned int val = spec->master_sw ? PIN_HP : 0;
5964 /* change HP and line-out pins */
5965 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5967 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5969 /* mono (speaker) depending on the HP jack sense */
5970 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5971 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5975 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5976 struct snd_ctl_elem_value *ucontrol)
5978 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5979 struct alc_spec *spec = codec->spec;
5980 *ucontrol->value.integer.value = spec->master_sw;
5984 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5985 struct snd_ctl_elem_value *ucontrol)
5987 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5988 struct alc_spec *spec = codec->spec;
5989 int val = !!*ucontrol->value.integer.value;
5990 hda_nid_t hp, line, mono;
5992 if (val == spec->master_sw)
5994 spec->master_sw = val;
5995 hp = (kcontrol->private_value >> 16) & 0xff;
5996 line = (kcontrol->private_value >> 8) & 0xff;
5997 mono = kcontrol->private_value & 0xff;
5998 alc260_hp_master_update(codec, hp, line, mono);
6002 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
6004 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6005 .name = "Master Playback Switch",
6006 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6007 .info = snd_ctl_boolean_mono_info,
6008 .get = alc260_hp_master_sw_get,
6009 .put = alc260_hp_master_sw_put,
6010 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
6012 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6013 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
6014 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6015 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
6016 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6018 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6022 static struct hda_verb alc260_hp_unsol_verbs[] = {
6023 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6027 static void alc260_hp_automute(struct hda_codec *codec)
6029 struct alc_spec *spec = codec->spec;
6031 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
6032 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
6035 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
6037 if ((res >> 26) == ALC880_HP_EVENT)
6038 alc260_hp_automute(codec);
6041 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
6043 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6044 .name = "Master Playback Switch",
6045 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6046 .info = snd_ctl_boolean_mono_info,
6047 .get = alc260_hp_master_sw_get,
6048 .put = alc260_hp_master_sw_put,
6049 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
6051 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6052 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6053 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
6054 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
6055 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6056 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6057 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6058 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
6062 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6063 .ops = &snd_hda_bind_vol,
6065 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
6066 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
6067 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
6072 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
6073 .ops = &snd_hda_bind_sw,
6075 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
6076 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
6081 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6082 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6083 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6084 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
6085 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6089 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6090 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6094 static void alc260_hp_3013_automute(struct hda_codec *codec)
6096 struct alc_spec *spec = codec->spec;
6098 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
6099 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
6102 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
6105 if ((res >> 26) == ALC880_HP_EVENT)
6106 alc260_hp_3013_automute(codec);
6109 static void alc260_hp_3012_automute(struct hda_codec *codec)
6111 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6113 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6115 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6117 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6121 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6124 if ((res >> 26) == ALC880_HP_EVENT)
6125 alc260_hp_3012_automute(codec);
6128 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6129 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6131 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6132 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6133 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6134 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6135 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6136 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6137 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6138 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6139 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6140 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6141 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6145 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6146 * versions of the ALC260 don't act on requests to enable mic bias from NID
6147 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6148 * datasheet doesn't mention this restriction. At this stage it's not clear
6149 * whether this behaviour is intentional or is a hardware bug in chip
6150 * revisions available in early 2006. Therefore for now allow the
6151 * "Headphone Jack Mode" control to span all choices, but if it turns out
6152 * that the lack of mic bias for this NID is intentional we could change the
6153 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6155 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6156 * don't appear to make the mic bias available from the "line" jack, even
6157 * though the NID used for this jack (0x14) can supply it. The theory is
6158 * that perhaps Acer have included blocking capacitors between the ALC260
6159 * and the output jack. If this turns out to be the case for all such
6160 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6161 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6163 * The C20x Tablet series have a mono internal speaker which is controlled
6164 * via the chip's Mono sum widget and pin complex, so include the necessary
6165 * controls for such models. On models without a "mono speaker" the control
6166 * won't do anything.
6168 static struct snd_kcontrol_new alc260_acer_mixer[] = {
6169 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6170 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6171 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6172 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6174 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6176 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6177 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6179 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6180 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6181 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6182 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6183 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6187 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6189 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6190 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6191 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6192 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6193 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6194 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6195 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6199 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6200 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6202 static struct snd_kcontrol_new alc260_will_mixer[] = {
6203 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6204 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6206 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6207 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6208 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6209 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6210 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6211 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6212 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6216 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6217 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6219 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6220 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6221 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6222 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6223 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6224 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6225 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6226 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6227 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6228 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6229 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6234 * initialization verbs
6236 static struct hda_verb alc260_init_verbs[] = {
6237 /* Line In pin widget for input */
6238 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6239 /* CD pin widget for input */
6240 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6241 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6242 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6243 /* Mic2 (front panel) pin widget for input and vref at 80% */
6244 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6245 /* LINE-2 is used for line-out in rear */
6246 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6247 /* select line-out */
6248 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6250 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6252 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6254 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6255 /* mute capture amp left and right */
6256 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6257 /* set connection select to line in (default select for this ADC) */
6258 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6259 /* mute capture amp left and right */
6260 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6261 /* set connection select to line in (default select for this ADC) */
6262 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6263 /* set vol=0 Line-Out mixer amp left and right */
6264 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6265 /* unmute pin widget amp left and right (no gain on this amp) */
6266 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6267 /* set vol=0 HP mixer amp left and right */
6268 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6269 /* unmute pin widget amp left and right (no gain on this amp) */
6270 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6271 /* set vol=0 Mono mixer amp left and right */
6272 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6273 /* unmute pin widget amp left and right (no gain on this amp) */
6274 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6275 /* unmute LINE-2 out pin */
6276 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6277 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6280 /* mute analog inputs */
6281 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6282 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6283 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6284 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6285 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6286 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6287 /* mute Front out path */
6288 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6289 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6290 /* mute Headphone out path */
6291 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6292 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6293 /* mute Mono out path */
6294 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6295 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6299 #if 0 /* should be identical with alc260_init_verbs? */
6300 static struct hda_verb alc260_hp_init_verbs[] = {
6301 /* Headphone and output */
6302 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6304 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6305 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6306 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6307 /* Mic2 (front panel) pin widget for input and vref at 80% */
6308 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6309 /* Line In pin widget for input */
6310 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6311 /* Line-2 pin widget for output */
6312 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6313 /* CD pin widget for input */
6314 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6315 /* unmute amp left and right */
6316 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6317 /* set connection select to line in (default select for this ADC) */
6318 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6319 /* unmute Line-Out mixer amp left and right (volume = 0) */
6320 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6321 /* mute pin widget amp left and right (no gain on this amp) */
6322 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6323 /* unmute HP mixer amp left and right (volume = 0) */
6324 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6325 /* mute pin widget amp left and right (no gain on this amp) */
6326 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6327 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6330 /* mute analog inputs */
6331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6336 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6337 /* Unmute Front out path */
6338 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6339 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6340 /* Unmute Headphone out path */
6341 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6342 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6343 /* Unmute Mono out path */
6344 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6345 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6350 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6351 /* Line out and output */
6352 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6354 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6355 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6356 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6357 /* Mic2 (front panel) pin widget for input and vref at 80% */
6358 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6359 /* Line In pin widget for input */
6360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6361 /* Headphone pin widget for output */
6362 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6363 /* CD pin widget for input */
6364 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6365 /* unmute amp left and right */
6366 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6367 /* set connection select to line in (default select for this ADC) */
6368 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6369 /* unmute Line-Out mixer amp left and right (volume = 0) */
6370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6371 /* mute pin widget amp left and right (no gain on this amp) */
6372 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6373 /* unmute HP mixer amp left and right (volume = 0) */
6374 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6375 /* mute pin widget amp left and right (no gain on this amp) */
6376 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6377 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6380 /* mute analog inputs */
6381 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6382 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6383 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6386 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6387 /* Unmute Front out path */
6388 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6389 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6390 /* Unmute Headphone out path */
6391 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6392 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6393 /* Unmute Mono out path */
6394 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6395 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6399 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6400 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6401 * audio = 0x16, internal speaker = 0x10.
6403 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6404 /* Disable all GPIOs */
6405 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6406 /* Internal speaker is connected to headphone pin */
6407 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6408 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6409 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6410 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6411 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6412 /* Ensure all other unused pins are disabled and muted. */
6413 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6414 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6415 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6416 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6417 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6418 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6420 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6422 /* Disable digital (SPDIF) pins */
6423 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6424 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6426 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6427 * when acting as an output.
6429 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6431 /* Start with output sum widgets muted and their output gains at min */
6432 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6433 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6434 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6435 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6436 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6437 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6438 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6439 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6440 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6442 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6443 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6444 /* Unmute Line1 pin widget output buffer since it starts as an output.
6445 * If the pin mode is changed by the user the pin mode control will
6446 * take care of enabling the pin's input/output buffers as needed.
6447 * Therefore there's no need to enable the input buffer at this
6450 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6451 /* Unmute input buffer of pin widget used for Line-in (no equiv
6454 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6456 /* Mute capture amp left and right */
6457 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6458 /* Set ADC connection select to match default mixer setting - line
6461 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6463 /* Do the same for the second ADC: mute capture input amp and
6464 * set ADC connection to line in (on mic1 pin)
6466 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6467 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6469 /* Mute all inputs to mixer widget (even unconnected ones) */
6470 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6471 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6472 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6474 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6475 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6476 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6477 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6482 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6483 * similar laptops (adapted from Fujitsu init verbs).
6485 static struct hda_verb alc260_acer_init_verbs[] = {
6486 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6487 * the headphone jack. Turn this on and rely on the standard mute
6488 * methods whenever the user wants to turn these outputs off.
6490 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6491 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6492 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6493 /* Internal speaker/Headphone jack is connected to Line-out pin */
6494 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6495 /* Internal microphone/Mic jack is connected to Mic1 pin */
6496 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6497 /* Line In jack is connected to Line1 pin */
6498 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6499 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6500 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6501 /* Ensure all other unused pins are disabled and muted. */
6502 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6503 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6504 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6505 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6506 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6507 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6508 /* Disable digital (SPDIF) pins */
6509 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6510 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6512 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6513 * bus when acting as outputs.
6515 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6516 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6518 /* Start with output sum widgets muted and their output gains at min */
6519 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6520 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6521 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6522 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6523 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6524 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6525 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6526 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6527 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6529 /* Unmute Line-out pin widget amp left and right
6530 * (no equiv mixer ctrl)
6532 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6533 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6534 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6535 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6536 * inputs. If the pin mode is changed by the user the pin mode control
6537 * will take care of enabling the pin's input/output buffers as needed.
6538 * Therefore there's no need to enable the input buffer at this
6541 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6542 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6544 /* Mute capture amp left and right */
6545 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6546 /* Set ADC connection select to match default mixer setting - mic
6549 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6551 /* Do similar with the second ADC: mute capture input amp and
6552 * set ADC connection to mic to match ALSA's default state.
6554 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6555 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6557 /* Mute all inputs to mixer widget (even unconnected ones) */
6558 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6559 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6560 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6561 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6562 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6563 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6564 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6565 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6570 /* Initialisation sequence for Maxdata Favorit 100XS
6571 * (adapted from Acer init verbs).
6573 static struct hda_verb alc260_favorit100_init_verbs[] = {
6574 /* GPIO 0 enables the output jack.
6575 * Turn this on and rely on the standard mute
6576 * methods whenever the user wants to turn these outputs off.
6578 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6579 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6580 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6581 /* Line/Mic input jack is connected to Mic1 pin */
6582 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6583 /* Ensure all other unused pins are disabled and muted. */
6584 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6585 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6586 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6587 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6588 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6589 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6590 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6591 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6592 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6593 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6594 /* Disable digital (SPDIF) pins */
6595 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6596 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6598 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6599 * bus when acting as outputs.
6601 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6602 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6604 /* Start with output sum widgets muted and their output gains at min */
6605 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6606 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6607 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6608 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6609 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6610 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6611 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6612 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6613 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6615 /* Unmute Line-out pin widget amp left and right
6616 * (no equiv mixer ctrl)
6618 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6619 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6620 * inputs. If the pin mode is changed by the user the pin mode control
6621 * will take care of enabling the pin's input/output buffers as needed.
6622 * Therefore there's no need to enable the input buffer at this
6625 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6627 /* Mute capture amp left and right */
6628 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6629 /* Set ADC connection select to match default mixer setting - mic
6632 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6634 /* Do similar with the second ADC: mute capture input amp and
6635 * set ADC connection to mic to match ALSA's default state.
6637 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6638 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6640 /* Mute all inputs to mixer widget (even unconnected ones) */
6641 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6642 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6643 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6644 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6645 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6646 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6647 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6648 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6653 static struct hda_verb alc260_will_verbs[] = {
6654 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6655 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6656 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6657 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6658 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6659 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6663 static struct hda_verb alc260_replacer_672v_verbs[] = {
6664 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6665 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6666 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6668 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6669 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6670 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6672 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6676 /* toggle speaker-output according to the hp-jack state */
6677 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6679 unsigned int present;
6681 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6682 present = snd_hda_jack_detect(codec, 0x0f);
6684 snd_hda_codec_write_cache(codec, 0x01, 0,
6685 AC_VERB_SET_GPIO_DATA, 1);
6686 snd_hda_codec_write_cache(codec, 0x0f, 0,
6687 AC_VERB_SET_PIN_WIDGET_CONTROL,
6690 snd_hda_codec_write_cache(codec, 0x01, 0,
6691 AC_VERB_SET_GPIO_DATA, 0);
6692 snd_hda_codec_write_cache(codec, 0x0f, 0,
6693 AC_VERB_SET_PIN_WIDGET_CONTROL,
6698 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6701 if ((res >> 26) == ALC880_HP_EVENT)
6702 alc260_replacer_672v_automute(codec);
6705 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6706 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6707 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6708 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6709 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6710 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6712 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6713 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6714 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6715 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6719 /* Test configuration for debugging, modelled after the ALC880 test
6722 #ifdef CONFIG_SND_DEBUG
6723 static hda_nid_t alc260_test_dac_nids[1] = {
6726 static hda_nid_t alc260_test_adc_nids[2] = {
6729 /* For testing the ALC260, each input MUX needs its own definition since
6730 * the signal assignments are different. This assumes that the first ADC
6733 static struct hda_input_mux alc260_test_capture_sources[2] = {
6737 { "MIC1 pin", 0x0 },
6738 { "MIC2 pin", 0x1 },
6739 { "LINE1 pin", 0x2 },
6740 { "LINE2 pin", 0x3 },
6742 { "LINE-OUT pin", 0x5 },
6743 { "HP-OUT pin", 0x6 },
6749 { "MIC1 pin", 0x0 },
6750 { "MIC2 pin", 0x1 },
6751 { "LINE1 pin", 0x2 },
6752 { "LINE2 pin", 0x3 },
6755 { "LINE-OUT pin", 0x6 },
6756 { "HP-OUT pin", 0x7 },
6760 static struct snd_kcontrol_new alc260_test_mixer[] = {
6761 /* Output driver widgets */
6762 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6763 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6764 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6765 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6766 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6767 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6769 /* Modes for retasking pin widgets
6770 * Note: the ALC260 doesn't seem to act on requests to enable mic
6771 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6772 * mention this restriction. At this stage it's not clear whether
6773 * this behaviour is intentional or is a hardware bug in chip
6774 * revisions available at least up until early 2006. Therefore for
6775 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6776 * choices, but if it turns out that the lack of mic bias for these
6777 * NIDs is intentional we could change their modes from
6778 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6780 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6781 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6782 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6783 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6784 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6785 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6787 /* Loopback mixer controls */
6788 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6789 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6790 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6791 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6792 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6793 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6794 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6795 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6796 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6797 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6798 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6799 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6800 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6801 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6803 /* Controls for GPIO pins, assuming they are configured as outputs */
6804 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6805 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6806 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6807 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6809 /* Switches to allow the digital IO pins to be enabled. The datasheet
6810 * is ambigious as to which NID is which; testing on laptops which
6811 * make this output available should provide clarification.
6813 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6814 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6816 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6817 * this output to turn on an external amplifier.
6819 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6820 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6824 static struct hda_verb alc260_test_init_verbs[] = {
6825 /* Enable all GPIOs as outputs with an initial value of 0 */
6826 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6827 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6828 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6830 /* Enable retasking pins as output, initially without power amp */
6831 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6832 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6833 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6834 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6835 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6836 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6838 /* Disable digital (SPDIF) pins initially, but users can enable
6839 * them via a mixer switch. In the case of SPDIF-out, this initverb
6840 * payload also sets the generation to 0, output to be in "consumer"
6841 * PCM format, copyright asserted, no pre-emphasis and no validity
6844 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6845 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6847 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6848 * OUT1 sum bus when acting as an output.
6850 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6851 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6852 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6853 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6855 /* Start with output sum widgets muted and their output gains at min */
6856 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6857 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6858 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6859 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6860 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6861 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6862 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6863 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6864 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6866 /* Unmute retasking pin widget output buffers since the default
6867 * state appears to be output. As the pin mode is changed by the
6868 * user the pin mode control will take care of enabling the pin's
6869 * input/output buffers as needed.
6871 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6872 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6873 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6874 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6875 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6876 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6877 /* Also unmute the mono-out pin widget */
6878 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6880 /* Mute capture amp left and right */
6881 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6882 /* Set ADC connection select to match default mixer setting (mic1
6885 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6887 /* Do the same for the second ADC: mute capture input amp and
6888 * set ADC connection to mic1 pin
6890 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6891 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6893 /* Mute all inputs to mixer widget (even unconnected ones) */
6894 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6895 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6896 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6897 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6898 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6899 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6900 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6901 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6907 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6908 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6910 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6911 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6914 * for BIOS auto-configuration
6917 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6918 const char *pfx, int *vol_bits)
6921 unsigned long vol_val, sw_val;
6924 if (nid >= 0x0f && nid < 0x11) {
6925 nid_vol = nid - 0x7;
6926 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6927 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6928 } else if (nid == 0x11) {
6929 nid_vol = nid - 0x7;
6930 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6931 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6932 } else if (nid >= 0x12 && nid <= 0x15) {
6934 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6935 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6939 if (!(*vol_bits & (1 << nid_vol))) {
6940 /* first control for the volume widget */
6941 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6944 *vol_bits |= (1 << nid_vol);
6946 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6952 /* add playback controls from the parsed DAC table */
6953 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6954 const struct auto_pin_cfg *cfg)
6960 spec->multiout.num_dacs = 1;
6961 spec->multiout.dac_nids = spec->private_dac_nids;
6962 spec->multiout.dac_nids[0] = 0x02;
6964 nid = cfg->line_out_pins[0];
6967 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6969 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6973 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6978 nid = cfg->speaker_pins[0];
6980 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6985 nid = cfg->hp_pins[0];
6987 err = alc260_add_playback_controls(spec, nid, "Headphone",
6995 /* create playback/capture controls for input pins */
6996 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6997 const struct auto_pin_cfg *cfg)
6999 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
7002 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
7003 hda_nid_t nid, int pin_type,
7006 alc_set_pin_output(codec, nid, pin_type);
7007 /* need the manual connection? */
7009 int idx = nid - 0x12;
7010 snd_hda_codec_write(codec, idx + 0x0b, 0,
7011 AC_VERB_SET_CONNECT_SEL, sel_idx);
7015 static void alc260_auto_init_multi_out(struct hda_codec *codec)
7017 struct alc_spec *spec = codec->spec;
7020 nid = spec->autocfg.line_out_pins[0];
7022 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7023 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
7026 nid = spec->autocfg.speaker_pins[0];
7028 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
7030 nid = spec->autocfg.hp_pins[0];
7032 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
7035 #define ALC260_PIN_CD_NID 0x16
7036 static void alc260_auto_init_analog_input(struct hda_codec *codec)
7038 struct alc_spec *spec = codec->spec;
7039 struct auto_pin_cfg *cfg = &spec->autocfg;
7042 for (i = 0; i < cfg->num_inputs; i++) {
7043 hda_nid_t nid = cfg->inputs[i].pin;
7045 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
7046 if (nid != ALC260_PIN_CD_NID &&
7047 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
7048 snd_hda_codec_write(codec, nid, 0,
7049 AC_VERB_SET_AMP_GAIN_MUTE,
7055 #define alc260_auto_init_input_src alc880_auto_init_input_src
7058 * generic initialization of ADC, input mixers and output mixers
7060 static struct hda_verb alc260_volume_init_verbs[] = {
7062 * Unmute ADC0-1 and set the default input to mic-in
7064 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
7065 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7066 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
7067 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7069 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7071 * Note: PASD motherboards uses the Line In 2 as the input for
7072 * front panel mic (mic 2)
7074 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7075 /* mute analog inputs */
7076 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7077 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7078 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7079 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7080 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7083 * Set up output mixers (0x08 - 0x0a)
7085 /* set vol=0 to output mixers */
7086 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7087 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7088 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7089 /* set up input amps for analog loopback */
7090 /* Amp Indices: DAC = 0, mixer = 1 */
7091 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7092 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7093 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7094 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7095 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7096 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7101 static int alc260_parse_auto_config(struct hda_codec *codec)
7103 struct alc_spec *spec = codec->spec;
7105 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
7107 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7111 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7114 if (!spec->kctls.list)
7115 return 0; /* can't find valid BIOS pin config */
7116 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7120 spec->multiout.max_channels = 2;
7122 if (spec->autocfg.dig_outs)
7123 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7124 if (spec->kctls.list)
7125 add_mixer(spec, spec->kctls.list);
7127 add_verb(spec, alc260_volume_init_verbs);
7129 spec->num_mux_defs = 1;
7130 spec->input_mux = &spec->private_imux[0];
7132 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7137 /* additional initialization for auto-configuration model */
7138 static void alc260_auto_init(struct hda_codec *codec)
7140 struct alc_spec *spec = codec->spec;
7141 alc260_auto_init_multi_out(codec);
7142 alc260_auto_init_analog_input(codec);
7143 alc260_auto_init_input_src(codec);
7144 alc_auto_init_digital(codec);
7145 if (spec->unsol_event)
7146 alc_inithook(codec);
7149 #ifdef CONFIG_SND_HDA_POWER_SAVE
7150 static struct hda_amp_list alc260_loopbacks[] = {
7151 { 0x07, HDA_INPUT, 0 },
7152 { 0x07, HDA_INPUT, 1 },
7153 { 0x07, HDA_INPUT, 2 },
7154 { 0x07, HDA_INPUT, 3 },
7155 { 0x07, HDA_INPUT, 4 },
7167 static const struct alc_fixup alc260_fixups[] = {
7168 [PINFIX_HP_DC5750] = {
7169 .type = ALC_FIXUP_PINS,
7170 .v.pins = (const struct alc_pincfg[]) {
7171 { 0x11, 0x90130110 }, /* speaker */
7177 static struct snd_pci_quirk alc260_fixup_tbl[] = {
7178 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7183 * ALC260 configurations
7185 static const char * const alc260_models[ALC260_MODEL_LAST] = {
7186 [ALC260_BASIC] = "basic",
7188 [ALC260_HP_3013] = "hp-3013",
7189 [ALC260_HP_DC7600] = "hp-dc7600",
7190 [ALC260_FUJITSU_S702X] = "fujitsu",
7191 [ALC260_ACER] = "acer",
7192 [ALC260_WILL] = "will",
7193 [ALC260_REPLACER_672V] = "replacer",
7194 [ALC260_FAVORIT100] = "favorit100",
7195 #ifdef CONFIG_SND_DEBUG
7196 [ALC260_TEST] = "test",
7198 [ALC260_AUTO] = "auto",
7201 static struct snd_pci_quirk alc260_cfg_tbl[] = {
7202 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7203 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7204 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7205 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7206 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7207 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7208 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7209 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7210 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7211 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7212 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7213 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7214 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7215 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7216 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7217 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7218 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7219 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7220 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7221 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7225 static struct alc_config_preset alc260_presets[] = {
7227 .mixers = { alc260_base_output_mixer,
7228 alc260_input_mixer },
7229 .init_verbs = { alc260_init_verbs },
7230 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7231 .dac_nids = alc260_dac_nids,
7232 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7233 .adc_nids = alc260_dual_adc_nids,
7234 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7235 .channel_mode = alc260_modes,
7236 .input_mux = &alc260_capture_source,
7239 .mixers = { alc260_hp_output_mixer,
7240 alc260_input_mixer },
7241 .init_verbs = { alc260_init_verbs,
7242 alc260_hp_unsol_verbs },
7243 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7244 .dac_nids = alc260_dac_nids,
7245 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7246 .adc_nids = alc260_adc_nids_alt,
7247 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7248 .channel_mode = alc260_modes,
7249 .input_mux = &alc260_capture_source,
7250 .unsol_event = alc260_hp_unsol_event,
7251 .init_hook = alc260_hp_automute,
7253 [ALC260_HP_DC7600] = {
7254 .mixers = { alc260_hp_dc7600_mixer,
7255 alc260_input_mixer },
7256 .init_verbs = { alc260_init_verbs,
7257 alc260_hp_dc7600_verbs },
7258 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7259 .dac_nids = alc260_dac_nids,
7260 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7261 .adc_nids = alc260_adc_nids_alt,
7262 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7263 .channel_mode = alc260_modes,
7264 .input_mux = &alc260_capture_source,
7265 .unsol_event = alc260_hp_3012_unsol_event,
7266 .init_hook = alc260_hp_3012_automute,
7268 [ALC260_HP_3013] = {
7269 .mixers = { alc260_hp_3013_mixer,
7270 alc260_input_mixer },
7271 .init_verbs = { alc260_hp_3013_init_verbs,
7272 alc260_hp_3013_unsol_verbs },
7273 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7274 .dac_nids = alc260_dac_nids,
7275 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7276 .adc_nids = alc260_adc_nids_alt,
7277 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7278 .channel_mode = alc260_modes,
7279 .input_mux = &alc260_capture_source,
7280 .unsol_event = alc260_hp_3013_unsol_event,
7281 .init_hook = alc260_hp_3013_automute,
7283 [ALC260_FUJITSU_S702X] = {
7284 .mixers = { alc260_fujitsu_mixer },
7285 .init_verbs = { alc260_fujitsu_init_verbs },
7286 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7287 .dac_nids = alc260_dac_nids,
7288 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7289 .adc_nids = alc260_dual_adc_nids,
7290 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7291 .channel_mode = alc260_modes,
7292 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7293 .input_mux = alc260_fujitsu_capture_sources,
7296 .mixers = { alc260_acer_mixer },
7297 .init_verbs = { alc260_acer_init_verbs },
7298 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7299 .dac_nids = alc260_dac_nids,
7300 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7301 .adc_nids = alc260_dual_adc_nids,
7302 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7303 .channel_mode = alc260_modes,
7304 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7305 .input_mux = alc260_acer_capture_sources,
7307 [ALC260_FAVORIT100] = {
7308 .mixers = { alc260_favorit100_mixer },
7309 .init_verbs = { alc260_favorit100_init_verbs },
7310 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7311 .dac_nids = alc260_dac_nids,
7312 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7313 .adc_nids = alc260_dual_adc_nids,
7314 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7315 .channel_mode = alc260_modes,
7316 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7317 .input_mux = alc260_favorit100_capture_sources,
7320 .mixers = { alc260_will_mixer },
7321 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7322 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7323 .dac_nids = alc260_dac_nids,
7324 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7325 .adc_nids = alc260_adc_nids,
7326 .dig_out_nid = ALC260_DIGOUT_NID,
7327 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7328 .channel_mode = alc260_modes,
7329 .input_mux = &alc260_capture_source,
7331 [ALC260_REPLACER_672V] = {
7332 .mixers = { alc260_replacer_672v_mixer },
7333 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7334 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7335 .dac_nids = alc260_dac_nids,
7336 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7337 .adc_nids = alc260_adc_nids,
7338 .dig_out_nid = ALC260_DIGOUT_NID,
7339 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7340 .channel_mode = alc260_modes,
7341 .input_mux = &alc260_capture_source,
7342 .unsol_event = alc260_replacer_672v_unsol_event,
7343 .init_hook = alc260_replacer_672v_automute,
7345 #ifdef CONFIG_SND_DEBUG
7347 .mixers = { alc260_test_mixer },
7348 .init_verbs = { alc260_test_init_verbs },
7349 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7350 .dac_nids = alc260_test_dac_nids,
7351 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7352 .adc_nids = alc260_test_adc_nids,
7353 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7354 .channel_mode = alc260_modes,
7355 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7356 .input_mux = alc260_test_capture_sources,
7361 static int patch_alc260(struct hda_codec *codec)
7363 struct alc_spec *spec;
7364 int err, board_config;
7366 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7372 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7375 if (board_config < 0) {
7376 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7378 board_config = ALC260_AUTO;
7381 if (board_config == ALC260_AUTO) {
7382 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7383 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7386 if (board_config == ALC260_AUTO) {
7387 /* automatic parse from the BIOS config */
7388 err = alc260_parse_auto_config(codec);
7394 "hda_codec: Cannot set up configuration "
7395 "from BIOS. Using base mode...\n");
7396 board_config = ALC260_BASIC;
7400 err = snd_hda_attach_beep_device(codec, 0x1);
7406 if (board_config != ALC260_AUTO)
7407 setup_preset(codec, &alc260_presets[board_config]);
7409 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7410 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7411 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7413 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7414 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7416 if (!spec->adc_nids && spec->input_mux) {
7417 /* check whether NID 0x04 is valid */
7418 unsigned int wcap = get_wcaps(codec, 0x04);
7419 wcap = get_wcaps_type(wcap);
7421 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7422 spec->adc_nids = alc260_adc_nids_alt;
7423 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7425 spec->adc_nids = alc260_adc_nids;
7426 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7429 set_capture_mixer(codec);
7430 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7432 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7434 spec->vmaster_nid = 0x08;
7436 codec->patch_ops = alc_patch_ops;
7437 if (board_config == ALC260_AUTO)
7438 spec->init_hook = alc260_auto_init;
7439 #ifdef CONFIG_SND_HDA_POWER_SAVE
7440 if (!spec->loopback.amplist)
7441 spec->loopback.amplist = alc260_loopbacks;
7449 * ALC882/883/885/888/889 support
7451 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7452 * configuration. Each pin widget can choose any input DACs and a mixer.
7453 * Each ADC is connected from a mixer of all inputs. This makes possible
7454 * 6-channel independent captures.
7456 * In addition, an independent DAC for the multi-playback (not used in this
7459 #define ALC882_DIGOUT_NID 0x06
7460 #define ALC882_DIGIN_NID 0x0a
7461 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7462 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7463 #define ALC1200_DIGOUT_NID 0x10
7466 static struct hda_channel_mode alc882_ch_modes[1] = {
7471 static hda_nid_t alc882_dac_nids[4] = {
7472 /* front, rear, clfe, rear_surr */
7473 0x02, 0x03, 0x04, 0x05
7475 #define alc883_dac_nids alc882_dac_nids
7478 #define alc882_adc_nids alc880_adc_nids
7479 #define alc882_adc_nids_alt alc880_adc_nids_alt
7480 #define alc883_adc_nids alc882_adc_nids_alt
7481 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7482 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7483 #define alc889_adc_nids alc880_adc_nids
7485 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7486 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7487 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7488 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7489 #define alc889_capsrc_nids alc882_capsrc_nids
7492 /* FIXME: should be a matrix-type input source selection */
7494 static struct hda_input_mux alc882_capture_source = {
7498 { "Front Mic", 0x1 },
7504 #define alc883_capture_source alc882_capture_source
7506 static struct hda_input_mux alc889_capture_source = {
7509 { "Front Mic", 0x0 },
7515 static struct hda_input_mux mb5_capture_source = {
7524 static struct hda_input_mux macmini3_capture_source = {
7532 static struct hda_input_mux alc883_3stack_6ch_intel = {
7536 { "Front Mic", 0x0 },
7542 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7550 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7554 { "Internal Mic", 0x1 },
7560 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7564 { "Internal Mic", 0x1 },
7568 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7572 { "Front Mic", 0x1 },
7577 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7585 static struct hda_input_mux alc889A_mb31_capture_source = {
7589 /* Front Mic (0x01) unused */
7591 /* Line 2 (0x03) unused */
7592 /* CD (0x04) unused? */
7596 static struct hda_input_mux alc889A_imac91_capture_source = {
7600 { "Line", 0x2 }, /* Not sure! */
7607 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7614 static struct hda_verb alc882_3ST_ch2_init[] = {
7615 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7616 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7617 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7618 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7625 static struct hda_verb alc882_3ST_ch4_init[] = {
7626 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7627 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7628 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7629 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7630 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7637 static struct hda_verb alc882_3ST_ch6_init[] = {
7638 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7639 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7640 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7641 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7642 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7643 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7647 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7648 { 2, alc882_3ST_ch2_init },
7649 { 4, alc882_3ST_ch4_init },
7650 { 6, alc882_3ST_ch6_init },
7653 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7658 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7659 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7660 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7661 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7662 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7663 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7670 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7671 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7672 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7673 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7674 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7675 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7676 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7683 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7684 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7685 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7686 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7687 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7688 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7689 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7690 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7694 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7695 { 2, alc883_3ST_ch2_clevo_init },
7696 { 4, alc883_3ST_ch4_clevo_init },
7697 { 6, alc883_3ST_ch6_clevo_init },
7704 static struct hda_verb alc882_sixstack_ch6_init[] = {
7705 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7706 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7707 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7708 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7715 static struct hda_verb alc882_sixstack_ch8_init[] = {
7716 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7717 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7718 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7719 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7723 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7724 { 6, alc882_sixstack_ch6_init },
7725 { 8, alc882_sixstack_ch8_init },
7729 /* Macbook Air 2,1 */
7731 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7736 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7742 static struct hda_verb alc885_mbp_ch2_init[] = {
7743 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7744 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7745 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7752 static struct hda_verb alc885_mbp_ch4_init[] = {
7753 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7754 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7755 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7756 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7757 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7761 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7762 { 2, alc885_mbp_ch2_init },
7763 { 4, alc885_mbp_ch4_init },
7768 * Speakers/Woofer/HP = Front
7771 static struct hda_verb alc885_mb5_ch2_init[] = {
7772 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7773 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7779 * Speakers/HP = Front
7783 static struct hda_verb alc885_mb5_ch6_init[] = {
7784 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7785 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7786 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7790 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7791 { 2, alc885_mb5_ch2_init },
7792 { 6, alc885_mb5_ch6_init },
7795 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7800 static struct hda_verb alc883_4ST_ch2_init[] = {
7801 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7802 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7803 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7804 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7805 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7806 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7813 static struct hda_verb alc883_4ST_ch4_init[] = {
7814 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7815 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7816 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7817 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7818 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7819 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7820 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7827 static struct hda_verb alc883_4ST_ch6_init[] = {
7828 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7829 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7830 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7831 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7832 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7833 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7834 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7835 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7842 static struct hda_verb alc883_4ST_ch8_init[] = {
7843 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7844 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7845 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7846 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7847 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7848 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7849 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7850 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7851 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7855 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7856 { 2, alc883_4ST_ch2_init },
7857 { 4, alc883_4ST_ch4_init },
7858 { 6, alc883_4ST_ch6_init },
7859 { 8, alc883_4ST_ch8_init },
7866 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7867 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7868 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7869 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7870 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7877 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7878 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7879 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7880 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7881 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7882 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7889 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7890 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7891 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7892 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7893 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7894 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7895 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7899 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7900 { 2, alc883_3ST_ch2_intel_init },
7901 { 4, alc883_3ST_ch4_intel_init },
7902 { 6, alc883_3ST_ch6_intel_init },
7908 static struct hda_verb alc889_ch2_intel_init[] = {
7909 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7910 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7911 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7912 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7913 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7914 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7921 static struct hda_verb alc889_ch6_intel_init[] = {
7922 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7923 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7924 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7925 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7926 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7927 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7934 static struct hda_verb alc889_ch8_intel_init[] = {
7935 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7936 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7937 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7938 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7939 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7940 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7941 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7945 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7946 { 2, alc889_ch2_intel_init },
7947 { 6, alc889_ch6_intel_init },
7948 { 8, alc889_ch8_intel_init },
7954 static struct hda_verb alc883_sixstack_ch6_init[] = {
7955 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7956 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7957 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7958 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7965 static struct hda_verb alc883_sixstack_ch8_init[] = {
7966 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7967 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7968 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7969 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7973 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7974 { 6, alc883_sixstack_ch6_init },
7975 { 8, alc883_sixstack_ch8_init },
7979 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7980 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7982 static struct snd_kcontrol_new alc882_base_mixer[] = {
7983 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7984 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7985 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7986 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7987 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7988 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7989 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7990 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7991 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7992 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7993 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7994 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7995 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7996 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7997 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7998 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7999 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8000 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8001 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8002 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8003 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8007 /* Macbook Air 2,1 same control for HP and internal Speaker */
8009 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
8010 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8011 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
8016 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
8017 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8018 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8019 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8020 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
8021 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8022 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8023 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8024 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8025 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8026 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
8027 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
8031 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
8032 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8033 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8034 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8035 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8036 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8037 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8038 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8039 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8040 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8041 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8042 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8043 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8044 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8045 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
8049 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
8050 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8051 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8052 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8053 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8054 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8055 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8056 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8057 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8058 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8059 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8064 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
8065 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8066 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8071 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8072 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8073 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8074 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8075 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8077 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8079 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8080 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8084 static struct snd_kcontrol_new alc882_targa_mixer[] = {
8085 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8086 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8088 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8089 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8090 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8091 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8092 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8093 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8094 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8095 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8096 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8097 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8101 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8102 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8104 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8105 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8106 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8107 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8108 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8109 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8110 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8111 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8112 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8113 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8114 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8115 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8116 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8117 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8121 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8122 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8123 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8124 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8130 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8135 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8137 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8138 .name = "Channel Mode",
8139 .info = alc_ch_mode_info,
8140 .get = alc_ch_mode_get,
8141 .put = alc_ch_mode_put,
8146 static struct hda_verb alc882_base_init_verbs[] = {
8147 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8148 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8151 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8152 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8154 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8155 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8157 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8158 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8160 /* Front Pin: output 0 (0x0c) */
8161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8162 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8163 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8164 /* Rear Pin: output 1 (0x0d) */
8165 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8166 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8167 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8168 /* CLFE Pin: output 2 (0x0e) */
8169 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8170 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8171 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8172 /* Side Pin: output 3 (0x0f) */
8173 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8174 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8175 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8176 /* Mic (rear) pin: input vref at 80% */
8177 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8178 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8179 /* Front Mic pin: input vref at 80% */
8180 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8181 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8182 /* Line In pin: input */
8183 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8184 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8185 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8186 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8187 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8188 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8189 /* CD pin widget for input */
8190 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8192 /* FIXME: use matrix-type input source selection */
8193 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8195 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8198 /* ADC2: mute amp left and right */
8199 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8200 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8201 /* ADC3: mute amp left and right */
8202 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8203 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8208 static struct hda_verb alc882_adc1_init_verbs[] = {
8209 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8210 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8211 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8212 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8213 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8214 /* ADC1: mute amp left and right */
8215 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8216 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8220 static struct hda_verb alc882_eapd_verbs[] = {
8221 /* change to EAPD mode */
8222 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8223 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8227 static struct hda_verb alc889_eapd_verbs[] = {
8228 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8229 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8233 static struct hda_verb alc_hp15_unsol_verbs[] = {
8234 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8239 static struct hda_verb alc885_init_verbs[] = {
8240 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8241 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8242 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8244 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8245 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8247 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8248 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8250 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8251 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8253 /* Front HP Pin: output 0 (0x0c) */
8254 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8255 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8256 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8257 /* Front Pin: output 0 (0x0c) */
8258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8259 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8260 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8261 /* Rear Pin: output 1 (0x0d) */
8262 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8263 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8264 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8265 /* CLFE Pin: output 2 (0x0e) */
8266 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8267 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8268 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8269 /* Side Pin: output 3 (0x0f) */
8270 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8271 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8272 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8273 /* Mic (rear) pin: input vref at 80% */
8274 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8275 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8276 /* Front Mic pin: input vref at 80% */
8277 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8278 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8279 /* Line In pin: input */
8280 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8281 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8283 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8285 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8287 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8290 /* ADC2: mute amp left and right */
8291 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8292 /* ADC3: mute amp left and right */
8293 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8298 static struct hda_verb alc885_init_input_verbs[] = {
8299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8306 /* Unmute Selector 24h and set the default input to front mic */
8307 static struct hda_verb alc889_init_input_verbs[] = {
8308 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8309 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8314 #define alc883_init_verbs alc882_base_init_verbs
8317 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8318 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8319 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8320 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8321 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8322 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8323 /* FIXME: this looks suspicious...
8324 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8325 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8330 static struct hda_verb alc882_macpro_init_verbs[] = {
8331 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8335 /* Front Pin: output 0 (0x0c) */
8336 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8337 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8338 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8339 /* Front Mic pin: input vref at 80% */
8340 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8341 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8342 /* Speaker: output */
8343 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8344 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8345 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8346 /* Headphone output (output 0 - 0x0c) */
8347 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8348 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8349 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8351 /* FIXME: use matrix-type input source selection */
8352 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8353 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8354 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8355 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8356 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8357 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8359 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8360 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8361 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8362 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8366 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8367 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8368 /* ADC1: mute amp left and right */
8369 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8370 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8371 /* ADC2: mute amp left and right */
8372 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8373 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8374 /* ADC3: mute amp left and right */
8375 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8376 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8382 static struct hda_verb alc885_mb5_init_verbs[] = {
8384 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8385 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8386 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8387 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8389 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8390 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8391 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8392 /* Surround mixer */
8393 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8394 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8395 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8397 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8398 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8399 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8401 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8402 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8403 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8404 /* Front Pin (0x0c) */
8405 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8406 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8407 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8408 /* LFE Pin (0x0e) */
8409 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8410 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8411 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8413 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8414 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8415 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8416 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8417 /* Front Mic pin: input vref at 80% */
8418 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8419 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8421 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8422 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8424 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8425 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8426 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8431 static struct hda_verb alc885_macmini3_init_verbs[] = {
8433 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8434 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8435 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8436 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8438 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8439 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8440 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8441 /* Surround mixer */
8442 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8443 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8444 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8446 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8447 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8448 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8450 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8451 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8452 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8453 /* Front Pin (0x0c) */
8454 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8455 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8456 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8457 /* LFE Pin (0x0e) */
8458 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8459 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8460 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8462 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8463 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8464 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8465 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8467 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8468 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8470 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8471 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8472 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8473 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8478 static struct hda_verb alc885_mba21_init_verbs[] = {
8479 /*Internal and HP Speaker Mixer*/
8480 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8481 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8482 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8483 /*Internal Speaker Pin (0x0c)*/
8484 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8485 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8486 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8487 /* HP Pin: output 0 (0x0e) */
8488 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8489 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8490 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8491 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8492 /* Line in (is hp when jack connected)*/
8493 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8494 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8500 /* Macbook Pro rev3 */
8501 static struct hda_verb alc885_mbp3_init_verbs[] = {
8502 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8505 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8507 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8508 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8509 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8511 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8512 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8513 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8514 /* Front Pin: output 0 (0x0c) */
8515 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8516 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8517 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8518 /* HP Pin: output 0 (0x0e) */
8519 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8520 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8521 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8522 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8523 /* Mic (rear) pin: input vref at 80% */
8524 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8525 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8526 /* Front Mic pin: input vref at 80% */
8527 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8528 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8529 /* Line In pin: use output 1 when in LineOut mode */
8530 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8531 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8532 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8534 /* FIXME: use matrix-type input source selection */
8535 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8536 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8537 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8538 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8539 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8540 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8542 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8543 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8544 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8545 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8547 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8548 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8549 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8550 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8551 /* ADC1: mute amp left and right */
8552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8553 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8554 /* ADC2: mute amp left and right */
8555 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8556 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8557 /* ADC3: mute amp left and right */
8558 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8559 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8565 static struct hda_verb alc885_imac91_init_verbs[] = {
8566 /* Internal Speaker Pin (0x0c) */
8567 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8568 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8569 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8570 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8571 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8572 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8574 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8575 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8576 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8577 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8579 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8580 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8581 /* Front Mic pin: input vref at 80% */
8582 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8583 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8587 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8588 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8589 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8590 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8591 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8592 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8593 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8594 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8595 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8596 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8597 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8598 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8599 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8600 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8601 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8602 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8603 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8604 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8605 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8606 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8607 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8608 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8609 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8610 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8611 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8612 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8613 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8614 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8615 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8619 /* iMac 24 mixer. */
8620 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8621 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8622 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8626 /* iMac 24 init verbs. */
8627 static struct hda_verb alc885_imac24_init_verbs[] = {
8628 /* Internal speakers: output 0 (0x0c) */
8629 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8630 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8631 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8632 /* Internal speakers: output 0 (0x0c) */
8633 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8634 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8635 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8636 /* Headphone: output 0 (0x0c) */
8637 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8638 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8639 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8640 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8641 /* Front Mic: input vref at 80% */
8642 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8643 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8647 /* Toggle speaker-output according to the hp-jack state */
8648 static void alc885_imac24_setup(struct hda_codec *codec)
8650 struct alc_spec *spec = codec->spec;
8652 spec->autocfg.hp_pins[0] = 0x14;
8653 spec->autocfg.speaker_pins[0] = 0x18;
8654 spec->autocfg.speaker_pins[1] = 0x1a;
8657 #define alc885_mb5_setup alc885_imac24_setup
8658 #define alc885_macmini3_setup alc885_imac24_setup
8660 /* Macbook Air 2,1 */
8661 static void alc885_mba21_setup(struct hda_codec *codec)
8663 struct alc_spec *spec = codec->spec;
8665 spec->autocfg.hp_pins[0] = 0x14;
8666 spec->autocfg.speaker_pins[0] = 0x18;
8671 static void alc885_mbp3_setup(struct hda_codec *codec)
8673 struct alc_spec *spec = codec->spec;
8675 spec->autocfg.hp_pins[0] = 0x15;
8676 spec->autocfg.speaker_pins[0] = 0x14;
8679 static void alc885_imac91_setup(struct hda_codec *codec)
8681 struct alc_spec *spec = codec->spec;
8683 spec->autocfg.hp_pins[0] = 0x14;
8684 spec->autocfg.speaker_pins[0] = 0x18;
8685 spec->autocfg.speaker_pins[1] = 0x1a;
8688 static struct hda_verb alc882_targa_verbs[] = {
8689 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8690 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8692 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8693 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8695 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8696 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8697 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8699 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8703 /* toggle speaker-output according to the hp-jack state */
8704 static void alc882_targa_automute(struct hda_codec *codec)
8706 struct alc_spec *spec = codec->spec;
8707 alc_automute_amp(codec);
8708 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8709 spec->jack_present ? 1 : 3);
8712 static void alc882_targa_setup(struct hda_codec *codec)
8714 struct alc_spec *spec = codec->spec;
8716 spec->autocfg.hp_pins[0] = 0x14;
8717 spec->autocfg.speaker_pins[0] = 0x1b;
8720 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8722 if ((res >> 26) == ALC880_HP_EVENT)
8723 alc882_targa_automute(codec);
8726 static struct hda_verb alc882_asus_a7j_verbs[] = {
8727 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8728 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8730 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8731 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8732 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8734 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8735 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8736 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8738 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8739 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8740 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8744 static struct hda_verb alc882_asus_a7m_verbs[] = {
8745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8748 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8749 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8750 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8752 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8753 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8754 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8756 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8757 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8758 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8762 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8764 unsigned int gpiostate, gpiomask, gpiodir;
8766 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8767 AC_VERB_GET_GPIO_DATA, 0);
8770 gpiostate |= (1 << pin);
8772 gpiostate &= ~(1 << pin);
8774 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8775 AC_VERB_GET_GPIO_MASK, 0);
8776 gpiomask |= (1 << pin);
8778 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8779 AC_VERB_GET_GPIO_DIRECTION, 0);
8780 gpiodir |= (1 << pin);
8783 snd_hda_codec_write(codec, codec->afg, 0,
8784 AC_VERB_SET_GPIO_MASK, gpiomask);
8785 snd_hda_codec_write(codec, codec->afg, 0,
8786 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8790 snd_hda_codec_write(codec, codec->afg, 0,
8791 AC_VERB_SET_GPIO_DATA, gpiostate);
8794 /* set up GPIO at initialization */
8795 static void alc885_macpro_init_hook(struct hda_codec *codec)
8797 alc882_gpio_mute(codec, 0, 0);
8798 alc882_gpio_mute(codec, 1, 0);
8801 /* set up GPIO and update auto-muting at initialization */
8802 static void alc885_imac24_init_hook(struct hda_codec *codec)
8804 alc885_macpro_init_hook(codec);
8805 alc_automute_amp(codec);
8809 * generic initialization of ADC, input mixers and output mixers
8811 static struct hda_verb alc883_auto_init_verbs[] = {
8813 * Unmute ADC0-2 and set the default input to mic-in
8815 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8816 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8817 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8818 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8821 * Set up output mixers (0x0c - 0x0f)
8823 /* set vol=0 to output mixers */
8824 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8825 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8826 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8827 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8828 /* set up input amps for analog loopback */
8829 /* Amp Indices: DAC = 0, mixer = 1 */
8830 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8831 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8832 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8833 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8834 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8835 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8836 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8837 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8838 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8839 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8841 /* FIXME: use matrix-type input source selection */
8842 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8844 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8846 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8850 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8851 static struct hda_verb alc889A_mb31_ch2_init[] = {
8852 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8853 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8854 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8855 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8859 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8860 static struct hda_verb alc889A_mb31_ch4_init[] = {
8861 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8862 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8863 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8864 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8868 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8869 static struct hda_verb alc889A_mb31_ch5_init[] = {
8870 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8871 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8872 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8873 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8877 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8878 static struct hda_verb alc889A_mb31_ch6_init[] = {
8879 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8880 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8881 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8882 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8886 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8887 { 2, alc889A_mb31_ch2_init },
8888 { 4, alc889A_mb31_ch4_init },
8889 { 5, alc889A_mb31_ch5_init },
8890 { 6, alc889A_mb31_ch6_init },
8893 static struct hda_verb alc883_medion_eapd_verbs[] = {
8894 /* eanable EAPD on medion laptop */
8895 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8896 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8900 #define alc883_base_mixer alc882_base_mixer
8902 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8903 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8904 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8905 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8906 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8907 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8908 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8909 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8910 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8911 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8912 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8913 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8914 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8915 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8919 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8920 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8921 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8922 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8923 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8925 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8926 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8927 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8928 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8929 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8933 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8934 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8935 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8936 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8937 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8938 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8939 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8940 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8941 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8942 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8943 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8947 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8948 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8949 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8950 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8951 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8952 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8953 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8954 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8955 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8956 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8957 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8958 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8959 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8960 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8964 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8965 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8966 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8967 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8968 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8969 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8970 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8971 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8972 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8973 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8974 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8975 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8976 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8977 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8978 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8979 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8980 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8981 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8982 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8983 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8987 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8988 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8989 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8990 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8991 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8992 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8994 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8995 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8996 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8998 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8999 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9000 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9001 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9002 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9003 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9004 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9005 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9006 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9007 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9011 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
9012 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9013 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9014 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9015 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9016 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9018 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9019 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9020 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9021 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9022 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
9023 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9024 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9025 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
9027 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
9028 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
9029 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9030 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9031 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9035 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
9036 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9037 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9038 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9039 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9040 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9041 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9042 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9043 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9044 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9045 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9046 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9047 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9048 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9050 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9051 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9052 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9053 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9054 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9058 static struct snd_kcontrol_new alc883_targa_mixer[] = {
9059 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9060 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9061 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9062 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9063 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9064 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9065 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9066 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9067 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9068 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9069 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9070 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9071 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9072 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9073 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9074 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9075 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9079 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9080 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9081 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9082 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9083 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9084 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9085 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9086 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9087 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9088 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9089 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9090 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9091 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9095 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9096 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9097 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9098 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9099 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9100 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9104 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9105 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9106 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9107 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9108 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9109 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9111 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9116 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9117 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9118 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9119 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9120 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9121 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9122 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9123 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9124 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9125 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9129 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9130 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9131 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9132 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9133 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9134 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9135 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9139 static struct hda_verb alc883_medion_wim2160_verbs[] = {
9140 /* Unmute front mixer */
9141 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9142 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9144 /* Set speaker pin to front mixer */
9145 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9147 /* Init headphone pin */
9148 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9149 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9150 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9151 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9156 /* toggle speaker-output according to the hp-jack state */
9157 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9159 struct alc_spec *spec = codec->spec;
9161 spec->autocfg.hp_pins[0] = 0x1a;
9162 spec->autocfg.speaker_pins[0] = 0x15;
9165 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9166 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9167 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9169 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9170 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9172 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9177 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9178 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9179 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9180 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9181 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9182 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9183 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9184 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9185 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9186 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9190 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9191 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9192 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9193 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9194 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9195 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9196 0x0d, 1, 0x0, HDA_OUTPUT),
9197 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9198 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9199 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9200 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9201 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9202 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9203 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9204 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9205 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9206 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9207 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9208 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9209 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9210 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9211 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9215 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9217 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9218 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9219 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9220 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9221 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9223 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9224 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9225 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9226 /* Output switches */
9227 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9228 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9229 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9231 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
9232 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
9234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9236 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9237 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9241 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9243 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9244 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9245 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9246 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9251 static struct hda_bind_ctls alc883_bind_cap_vol = {
9252 .ops = &snd_hda_bind_vol,
9254 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9255 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9260 static struct hda_bind_ctls alc883_bind_cap_switch = {
9261 .ops = &snd_hda_bind_sw,
9263 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9264 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9269 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9270 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9271 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9272 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9273 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9274 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9275 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9276 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9277 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9281 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9282 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9283 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9285 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9286 /* .name = "Capture Source", */
9287 .name = "Input Source",
9289 .info = alc_mux_enum_info,
9290 .get = alc_mux_enum_get,
9291 .put = alc_mux_enum_put,
9296 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9298 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9299 .name = "Channel Mode",
9300 .info = alc_ch_mode_info,
9301 .get = alc_ch_mode_get,
9302 .put = alc_ch_mode_put,
9307 /* toggle speaker-output according to the hp-jack state */
9308 static void alc883_mitac_setup(struct hda_codec *codec)
9310 struct alc_spec *spec = codec->spec;
9312 spec->autocfg.hp_pins[0] = 0x15;
9313 spec->autocfg.speaker_pins[0] = 0x14;
9314 spec->autocfg.speaker_pins[1] = 0x17;
9317 static struct hda_verb alc883_mitac_verbs[] = {
9319 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9320 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9322 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9323 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9325 /* enable unsolicited event */
9326 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9327 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9332 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9334 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9335 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9337 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9339 /* enable unsolicited event */
9341 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9342 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9348 static struct hda_verb alc883_clevo_m720_verbs[] = {
9350 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9351 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9353 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9354 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9356 /* enable unsolicited event */
9357 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9358 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9363 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9365 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9366 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9368 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9369 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9371 /* enable unsolicited event */
9372 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9377 static struct hda_verb alc883_targa_verbs[] = {
9378 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9379 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9381 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9382 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9384 /* Connect Line-Out side jack (SPDIF) to Side */
9385 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9386 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9387 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9388 /* Connect Mic jack to CLFE */
9389 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9390 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9391 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9392 /* Connect Line-in jack to Surround */
9393 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9394 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9395 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9396 /* Connect HP out jack to Front */
9397 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9398 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9399 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9401 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9406 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9407 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9408 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9409 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9413 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9414 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9415 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9416 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9417 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9421 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9422 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9423 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9424 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9425 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9426 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9430 static struct hda_verb alc883_haier_w66_verbs[] = {
9431 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9432 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9434 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9436 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9437 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9438 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9439 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9443 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9444 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9445 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9446 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9447 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9448 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9449 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9450 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9451 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9455 static struct hda_verb alc888_6st_dell_verbs[] = {
9456 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9460 static struct hda_verb alc883_vaiott_verbs[] = {
9462 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9463 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9465 /* enable unsolicited event */
9466 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9471 static void alc888_3st_hp_setup(struct hda_codec *codec)
9473 struct alc_spec *spec = codec->spec;
9475 spec->autocfg.hp_pins[0] = 0x1b;
9476 spec->autocfg.speaker_pins[0] = 0x14;
9477 spec->autocfg.speaker_pins[1] = 0x16;
9478 spec->autocfg.speaker_pins[2] = 0x18;
9481 static struct hda_verb alc888_3st_hp_verbs[] = {
9482 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9483 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9484 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9485 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9492 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9493 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9494 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9495 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9496 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9503 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9504 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9505 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9506 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9507 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9508 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9515 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9516 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9517 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9518 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9519 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9520 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9521 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9525 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9526 { 2, alc888_3st_hp_2ch_init },
9527 { 4, alc888_3st_hp_4ch_init },
9528 { 6, alc888_3st_hp_6ch_init },
9531 /* toggle front-jack and RCA according to the hp-jack state */
9532 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9534 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9536 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9537 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9538 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9539 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9542 /* toggle RCA according to the front-jack state */
9543 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9545 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9547 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9548 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9551 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9554 if ((res >> 26) == ALC880_HP_EVENT)
9555 alc888_lenovo_ms7195_front_automute(codec);
9556 if ((res >> 26) == ALC880_FRONT_EVENT)
9557 alc888_lenovo_ms7195_rca_automute(codec);
9560 /* toggle speaker-output according to the hp-jack state */
9561 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9563 struct alc_spec *spec = codec->spec;
9565 spec->autocfg.hp_pins[0] = 0x14;
9566 spec->autocfg.speaker_pins[0] = 0x15;
9569 /* toggle speaker-output according to the hp-jack state */
9570 #define alc883_targa_init_hook alc882_targa_init_hook
9571 #define alc883_targa_unsol_event alc882_targa_unsol_event
9573 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9575 struct alc_spec *spec = codec->spec;
9577 spec->autocfg.hp_pins[0] = 0x15;
9578 spec->autocfg.speaker_pins[0] = 0x14;
9581 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9583 alc_automute_amp(codec);
9584 alc88x_simple_mic_automute(codec);
9587 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9590 switch (res >> 26) {
9591 case ALC880_MIC_EVENT:
9592 alc88x_simple_mic_automute(codec);
9595 alc_automute_amp_unsol_event(codec, res);
9600 /* toggle speaker-output according to the hp-jack state */
9601 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9603 struct alc_spec *spec = codec->spec;
9605 spec->autocfg.hp_pins[0] = 0x14;
9606 spec->autocfg.speaker_pins[0] = 0x15;
9609 static void alc883_haier_w66_setup(struct hda_codec *codec)
9611 struct alc_spec *spec = codec->spec;
9613 spec->autocfg.hp_pins[0] = 0x1b;
9614 spec->autocfg.speaker_pins[0] = 0x14;
9617 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9619 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9621 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9622 HDA_AMP_MUTE, bits);
9625 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9627 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9629 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9630 HDA_AMP_MUTE, bits);
9631 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9632 HDA_AMP_MUTE, bits);
9635 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9638 if ((res >> 26) == ALC880_HP_EVENT)
9639 alc883_lenovo_101e_all_automute(codec);
9640 if ((res >> 26) == ALC880_FRONT_EVENT)
9641 alc883_lenovo_101e_ispeaker_automute(codec);
9644 /* toggle speaker-output according to the hp-jack state */
9645 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9647 struct alc_spec *spec = codec->spec;
9649 spec->autocfg.hp_pins[0] = 0x14;
9650 spec->autocfg.speaker_pins[0] = 0x15;
9651 spec->autocfg.speaker_pins[1] = 0x16;
9654 static struct hda_verb alc883_acer_eapd_verbs[] = {
9655 /* HP Pin: output 0 (0x0c) */
9656 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9657 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9658 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9659 /* Front Pin: output 0 (0x0c) */
9660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9661 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9662 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9663 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9664 /* eanable EAPD on medion laptop */
9665 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9666 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9667 /* enable unsolicited event */
9668 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9672 static void alc888_6st_dell_setup(struct hda_codec *codec)
9674 struct alc_spec *spec = codec->spec;
9676 spec->autocfg.hp_pins[0] = 0x1b;
9677 spec->autocfg.speaker_pins[0] = 0x14;
9678 spec->autocfg.speaker_pins[1] = 0x15;
9679 spec->autocfg.speaker_pins[2] = 0x16;
9680 spec->autocfg.speaker_pins[3] = 0x17;
9683 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9685 struct alc_spec *spec = codec->spec;
9687 spec->autocfg.hp_pins[0] = 0x1b;
9688 spec->autocfg.speaker_pins[0] = 0x14;
9689 spec->autocfg.speaker_pins[1] = 0x15;
9690 spec->autocfg.speaker_pins[2] = 0x16;
9691 spec->autocfg.speaker_pins[3] = 0x17;
9692 spec->autocfg.speaker_pins[4] = 0x1a;
9695 static void alc883_vaiott_setup(struct hda_codec *codec)
9697 struct alc_spec *spec = codec->spec;
9699 spec->autocfg.hp_pins[0] = 0x15;
9700 spec->autocfg.speaker_pins[0] = 0x14;
9701 spec->autocfg.speaker_pins[1] = 0x17;
9704 static struct hda_verb alc888_asus_m90v_verbs[] = {
9705 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9706 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9707 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9708 /* enable unsolicited event */
9709 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9710 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9714 static void alc883_mode2_setup(struct hda_codec *codec)
9716 struct alc_spec *spec = codec->spec;
9718 spec->autocfg.hp_pins[0] = 0x1b;
9719 spec->autocfg.speaker_pins[0] = 0x14;
9720 spec->autocfg.speaker_pins[1] = 0x15;
9721 spec->autocfg.speaker_pins[2] = 0x16;
9722 spec->ext_mic.pin = 0x18;
9723 spec->int_mic.pin = 0x19;
9724 spec->ext_mic.mux_idx = 0;
9725 spec->int_mic.mux_idx = 1;
9729 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9731 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9732 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9733 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9734 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9735 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9736 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9737 /* enable unsolicited event */
9738 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9742 static void alc883_eee1601_inithook(struct hda_codec *codec)
9744 struct alc_spec *spec = codec->spec;
9746 spec->autocfg.hp_pins[0] = 0x14;
9747 spec->autocfg.speaker_pins[0] = 0x1b;
9748 alc_automute_pin(codec);
9751 static struct hda_verb alc889A_mb31_verbs[] = {
9752 /* Init rear pin (used as headphone output) */
9753 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9754 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9755 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9756 /* Init line pin (used as output in 4ch and 6ch mode) */
9757 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9758 /* Init line 2 pin (used as headphone out by default) */
9759 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9760 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9764 /* Mute speakers according to the headphone jack state */
9765 static void alc889A_mb31_automute(struct hda_codec *codec)
9767 unsigned int present;
9769 /* Mute only in 2ch or 4ch mode */
9770 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9772 present = snd_hda_jack_detect(codec, 0x15);
9773 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9774 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9775 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9776 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9780 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9782 if ((res >> 26) == ALC880_HP_EVENT)
9783 alc889A_mb31_automute(codec);
9787 #ifdef CONFIG_SND_HDA_POWER_SAVE
9788 #define alc882_loopbacks alc880_loopbacks
9791 /* pcm configuration: identical with ALC880 */
9792 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9793 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9794 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9795 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9797 static hda_nid_t alc883_slave_dig_outs[] = {
9798 ALC1200_DIGOUT_NID, 0,
9801 static hda_nid_t alc1200_slave_dig_outs[] = {
9802 ALC883_DIGOUT_NID, 0,
9806 * configuration and preset
9808 static const char * const alc882_models[ALC882_MODEL_LAST] = {
9809 [ALC882_3ST_DIG] = "3stack-dig",
9810 [ALC882_6ST_DIG] = "6stack-dig",
9811 [ALC882_ARIMA] = "arima",
9812 [ALC882_W2JC] = "w2jc",
9813 [ALC882_TARGA] = "targa",
9814 [ALC882_ASUS_A7J] = "asus-a7j",
9815 [ALC882_ASUS_A7M] = "asus-a7m",
9816 [ALC885_MACPRO] = "macpro",
9817 [ALC885_MB5] = "mb5",
9818 [ALC885_MACMINI3] = "macmini3",
9819 [ALC885_MBA21] = "mba21",
9820 [ALC885_MBP3] = "mbp3",
9821 [ALC885_IMAC24] = "imac24",
9822 [ALC885_IMAC91] = "imac91",
9823 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9824 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9825 [ALC883_3ST_6ch] = "3stack-6ch",
9826 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9827 [ALC883_TARGA_DIG] = "targa-dig",
9828 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9829 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9830 [ALC883_ACER] = "acer",
9831 [ALC883_ACER_ASPIRE] = "acer-aspire",
9832 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9833 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9834 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9835 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9836 [ALC883_MEDION] = "medion",
9837 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9838 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9839 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9840 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9841 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9842 [ALC888_LENOVO_SKY] = "lenovo-sky",
9843 [ALC883_HAIER_W66] = "haier-w66",
9844 [ALC888_3ST_HP] = "3stack-hp",
9845 [ALC888_6ST_DELL] = "6stack-dell",
9846 [ALC883_MITAC] = "mitac",
9847 [ALC883_CLEVO_M540R] = "clevo-m540r",
9848 [ALC883_CLEVO_M720] = "clevo-m720",
9849 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9850 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9851 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9852 [ALC889A_INTEL] = "intel-alc889a",
9853 [ALC889_INTEL] = "intel-x58",
9854 [ALC1200_ASUS_P5Q] = "asus-p5q",
9855 [ALC889A_MB31] = "mb31",
9856 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9857 [ALC882_AUTO] = "auto",
9860 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9861 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9863 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9864 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9865 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9866 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9867 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9868 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9869 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9870 ALC888_ACER_ASPIRE_4930G),
9871 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9872 ALC888_ACER_ASPIRE_4930G),
9873 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9874 ALC888_ACER_ASPIRE_8930G),
9875 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9876 ALC888_ACER_ASPIRE_8930G),
9877 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9878 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9879 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9880 ALC888_ACER_ASPIRE_6530G),
9881 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9882 ALC888_ACER_ASPIRE_6530G),
9883 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9884 ALC888_ACER_ASPIRE_7730G),
9885 /* default Acer -- disabled as it causes more problems.
9886 * model=auto should work fine now
9888 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9890 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9892 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9893 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9894 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9895 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9896 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9897 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9899 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9900 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9901 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9902 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9903 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9904 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9905 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9906 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9907 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9908 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9909 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9911 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9912 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9913 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9914 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9915 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9916 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9917 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9918 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9919 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9921 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9922 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9923 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9924 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9925 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9926 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9927 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9928 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9929 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9930 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9931 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9932 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9933 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9934 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9935 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9936 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9937 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9938 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9939 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9940 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9941 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9942 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9943 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9944 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9945 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9946 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9947 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9948 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9949 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9950 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9951 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9953 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9954 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9955 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9956 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9957 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9958 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9959 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9960 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9961 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9962 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9963 ALC883_FUJITSU_PI2515),
9964 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9965 ALC888_FUJITSU_XA3530),
9966 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9967 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9968 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9969 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9970 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9971 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9972 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9973 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9975 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9976 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9977 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9978 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9979 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9980 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9981 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9986 /* codec SSID table for Intel Mac */
9987 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9988 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9989 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9990 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9991 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9992 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9993 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9994 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9995 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9996 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9997 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9998 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9999 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
10000 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
10001 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
10002 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
10003 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
10004 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
10005 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
10006 * so apparently no perfect solution yet
10008 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
10009 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
10010 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
10011 {} /* terminator */
10014 static struct alc_config_preset alc882_presets[] = {
10015 [ALC882_3ST_DIG] = {
10016 .mixers = { alc882_base_mixer },
10017 .init_verbs = { alc882_base_init_verbs,
10018 alc882_adc1_init_verbs },
10019 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10020 .dac_nids = alc882_dac_nids,
10021 .dig_out_nid = ALC882_DIGOUT_NID,
10022 .dig_in_nid = ALC882_DIGIN_NID,
10023 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10024 .channel_mode = alc882_ch_modes,
10026 .input_mux = &alc882_capture_source,
10028 [ALC882_6ST_DIG] = {
10029 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10030 .init_verbs = { alc882_base_init_verbs,
10031 alc882_adc1_init_verbs },
10032 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10033 .dac_nids = alc882_dac_nids,
10034 .dig_out_nid = ALC882_DIGOUT_NID,
10035 .dig_in_nid = ALC882_DIGIN_NID,
10036 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10037 .channel_mode = alc882_sixstack_modes,
10038 .input_mux = &alc882_capture_source,
10041 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10042 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10043 alc882_eapd_verbs },
10044 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10045 .dac_nids = alc882_dac_nids,
10046 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10047 .channel_mode = alc882_sixstack_modes,
10048 .input_mux = &alc882_capture_source,
10051 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
10052 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10053 alc882_eapd_verbs, alc880_gpio1_init_verbs },
10054 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10055 .dac_nids = alc882_dac_nids,
10056 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10057 .channel_mode = alc880_threestack_modes,
10059 .input_mux = &alc882_capture_source,
10060 .dig_out_nid = ALC882_DIGOUT_NID,
10063 .mixers = { alc885_mba21_mixer },
10064 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
10066 .dac_nids = alc882_dac_nids,
10067 .channel_mode = alc885_mba21_ch_modes,
10068 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10069 .input_mux = &alc882_capture_source,
10070 .unsol_event = alc_automute_amp_unsol_event,
10071 .setup = alc885_mba21_setup,
10072 .init_hook = alc_automute_amp,
10075 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
10076 .init_verbs = { alc885_mbp3_init_verbs,
10077 alc880_gpio1_init_verbs },
10079 .dac_nids = alc882_dac_nids,
10081 .channel_mode = alc885_mbp_4ch_modes,
10082 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10083 .input_mux = &alc882_capture_source,
10084 .dig_out_nid = ALC882_DIGOUT_NID,
10085 .dig_in_nid = ALC882_DIGIN_NID,
10086 .unsol_event = alc_automute_amp_unsol_event,
10087 .setup = alc885_mbp3_setup,
10088 .init_hook = alc_automute_amp,
10091 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10092 .init_verbs = { alc885_mb5_init_verbs,
10093 alc880_gpio1_init_verbs },
10094 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10095 .dac_nids = alc882_dac_nids,
10096 .channel_mode = alc885_mb5_6ch_modes,
10097 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10098 .input_mux = &mb5_capture_source,
10099 .dig_out_nid = ALC882_DIGOUT_NID,
10100 .dig_in_nid = ALC882_DIGIN_NID,
10101 .unsol_event = alc_automute_amp_unsol_event,
10102 .setup = alc885_mb5_setup,
10103 .init_hook = alc_automute_amp,
10105 [ALC885_MACMINI3] = {
10106 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10107 .init_verbs = { alc885_macmini3_init_verbs,
10108 alc880_gpio1_init_verbs },
10109 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10110 .dac_nids = alc882_dac_nids,
10111 .channel_mode = alc885_macmini3_6ch_modes,
10112 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10113 .input_mux = &macmini3_capture_source,
10114 .dig_out_nid = ALC882_DIGOUT_NID,
10115 .dig_in_nid = ALC882_DIGIN_NID,
10116 .unsol_event = alc_automute_amp_unsol_event,
10117 .setup = alc885_macmini3_setup,
10118 .init_hook = alc_automute_amp,
10120 [ALC885_MACPRO] = {
10121 .mixers = { alc882_macpro_mixer },
10122 .init_verbs = { alc882_macpro_init_verbs },
10123 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10124 .dac_nids = alc882_dac_nids,
10125 .dig_out_nid = ALC882_DIGOUT_NID,
10126 .dig_in_nid = ALC882_DIGIN_NID,
10127 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10128 .channel_mode = alc882_ch_modes,
10129 .input_mux = &alc882_capture_source,
10130 .init_hook = alc885_macpro_init_hook,
10132 [ALC885_IMAC24] = {
10133 .mixers = { alc885_imac24_mixer },
10134 .init_verbs = { alc885_imac24_init_verbs },
10135 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10136 .dac_nids = alc882_dac_nids,
10137 .dig_out_nid = ALC882_DIGOUT_NID,
10138 .dig_in_nid = ALC882_DIGIN_NID,
10139 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10140 .channel_mode = alc882_ch_modes,
10141 .input_mux = &alc882_capture_source,
10142 .unsol_event = alc_automute_amp_unsol_event,
10143 .setup = alc885_imac24_setup,
10144 .init_hook = alc885_imac24_init_hook,
10146 [ALC885_IMAC91] = {
10147 .mixers = {alc885_imac91_mixer},
10148 .init_verbs = { alc885_imac91_init_verbs,
10149 alc880_gpio1_init_verbs },
10150 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10151 .dac_nids = alc882_dac_nids,
10152 .channel_mode = alc885_mba21_ch_modes,
10153 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10154 .input_mux = &alc889A_imac91_capture_source,
10155 .dig_out_nid = ALC882_DIGOUT_NID,
10156 .dig_in_nid = ALC882_DIGIN_NID,
10157 .unsol_event = alc_automute_amp_unsol_event,
10158 .setup = alc885_imac91_setup,
10159 .init_hook = alc_automute_amp,
10162 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10163 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10164 alc880_gpio3_init_verbs, alc882_targa_verbs},
10165 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10166 .dac_nids = alc882_dac_nids,
10167 .dig_out_nid = ALC882_DIGOUT_NID,
10168 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10169 .adc_nids = alc882_adc_nids,
10170 .capsrc_nids = alc882_capsrc_nids,
10171 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10172 .channel_mode = alc882_3ST_6ch_modes,
10174 .input_mux = &alc882_capture_source,
10175 .unsol_event = alc882_targa_unsol_event,
10176 .setup = alc882_targa_setup,
10177 .init_hook = alc882_targa_automute,
10179 [ALC882_ASUS_A7J] = {
10180 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10181 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10182 alc882_asus_a7j_verbs},
10183 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10184 .dac_nids = alc882_dac_nids,
10185 .dig_out_nid = ALC882_DIGOUT_NID,
10186 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10187 .adc_nids = alc882_adc_nids,
10188 .capsrc_nids = alc882_capsrc_nids,
10189 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10190 .channel_mode = alc882_3ST_6ch_modes,
10192 .input_mux = &alc882_capture_source,
10194 [ALC882_ASUS_A7M] = {
10195 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10196 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10197 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10198 alc882_asus_a7m_verbs },
10199 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10200 .dac_nids = alc882_dac_nids,
10201 .dig_out_nid = ALC882_DIGOUT_NID,
10202 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10203 .channel_mode = alc880_threestack_modes,
10205 .input_mux = &alc882_capture_source,
10207 [ALC883_3ST_2ch_DIG] = {
10208 .mixers = { alc883_3ST_2ch_mixer },
10209 .init_verbs = { alc883_init_verbs },
10210 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10211 .dac_nids = alc883_dac_nids,
10212 .dig_out_nid = ALC883_DIGOUT_NID,
10213 .dig_in_nid = ALC883_DIGIN_NID,
10214 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10215 .channel_mode = alc883_3ST_2ch_modes,
10216 .input_mux = &alc883_capture_source,
10218 [ALC883_3ST_6ch_DIG] = {
10219 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10220 .init_verbs = { alc883_init_verbs },
10221 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10222 .dac_nids = alc883_dac_nids,
10223 .dig_out_nid = ALC883_DIGOUT_NID,
10224 .dig_in_nid = ALC883_DIGIN_NID,
10225 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10226 .channel_mode = alc883_3ST_6ch_modes,
10228 .input_mux = &alc883_capture_source,
10230 [ALC883_3ST_6ch] = {
10231 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10232 .init_verbs = { alc883_init_verbs },
10233 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10234 .dac_nids = alc883_dac_nids,
10235 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10236 .channel_mode = alc883_3ST_6ch_modes,
10238 .input_mux = &alc883_capture_source,
10240 [ALC883_3ST_6ch_INTEL] = {
10241 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10242 .init_verbs = { alc883_init_verbs },
10243 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10244 .dac_nids = alc883_dac_nids,
10245 .dig_out_nid = ALC883_DIGOUT_NID,
10246 .dig_in_nid = ALC883_DIGIN_NID,
10247 .slave_dig_outs = alc883_slave_dig_outs,
10248 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10249 .channel_mode = alc883_3ST_6ch_intel_modes,
10251 .input_mux = &alc883_3stack_6ch_intel,
10253 [ALC889A_INTEL] = {
10254 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10255 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10256 alc_hp15_unsol_verbs },
10257 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10258 .dac_nids = alc883_dac_nids,
10259 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10260 .adc_nids = alc889_adc_nids,
10261 .dig_out_nid = ALC883_DIGOUT_NID,
10262 .dig_in_nid = ALC883_DIGIN_NID,
10263 .slave_dig_outs = alc883_slave_dig_outs,
10264 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10265 .channel_mode = alc889_8ch_intel_modes,
10266 .capsrc_nids = alc889_capsrc_nids,
10267 .input_mux = &alc889_capture_source,
10268 .setup = alc889_automute_setup,
10269 .init_hook = alc_automute_amp,
10270 .unsol_event = alc_automute_amp_unsol_event,
10274 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10275 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10276 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10277 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10278 .dac_nids = alc883_dac_nids,
10279 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10280 .adc_nids = alc889_adc_nids,
10281 .dig_out_nid = ALC883_DIGOUT_NID,
10282 .dig_in_nid = ALC883_DIGIN_NID,
10283 .slave_dig_outs = alc883_slave_dig_outs,
10284 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10285 .channel_mode = alc889_8ch_intel_modes,
10286 .capsrc_nids = alc889_capsrc_nids,
10287 .input_mux = &alc889_capture_source,
10288 .setup = alc889_automute_setup,
10289 .init_hook = alc889_intel_init_hook,
10290 .unsol_event = alc_automute_amp_unsol_event,
10293 [ALC883_6ST_DIG] = {
10294 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10295 .init_verbs = { alc883_init_verbs },
10296 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10297 .dac_nids = alc883_dac_nids,
10298 .dig_out_nid = ALC883_DIGOUT_NID,
10299 .dig_in_nid = ALC883_DIGIN_NID,
10300 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10301 .channel_mode = alc883_sixstack_modes,
10302 .input_mux = &alc883_capture_source,
10304 [ALC883_TARGA_DIG] = {
10305 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10306 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10307 alc883_targa_verbs},
10308 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10309 .dac_nids = alc883_dac_nids,
10310 .dig_out_nid = ALC883_DIGOUT_NID,
10311 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10312 .channel_mode = alc883_3ST_6ch_modes,
10314 .input_mux = &alc883_capture_source,
10315 .unsol_event = alc883_targa_unsol_event,
10316 .setup = alc882_targa_setup,
10317 .init_hook = alc882_targa_automute,
10319 [ALC883_TARGA_2ch_DIG] = {
10320 .mixers = { alc883_targa_2ch_mixer},
10321 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10322 alc883_targa_verbs},
10323 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10324 .dac_nids = alc883_dac_nids,
10325 .adc_nids = alc883_adc_nids_alt,
10326 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10327 .capsrc_nids = alc883_capsrc_nids,
10328 .dig_out_nid = ALC883_DIGOUT_NID,
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 = alc883_targa_unsol_event,
10333 .setup = alc882_targa_setup,
10334 .init_hook = alc882_targa_automute,
10336 [ALC883_TARGA_8ch_DIG] = {
10337 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10338 alc883_chmode_mixer },
10339 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10340 alc883_targa_verbs },
10341 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10342 .dac_nids = alc883_dac_nids,
10343 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10344 .adc_nids = alc883_adc_nids_rev,
10345 .capsrc_nids = alc883_capsrc_nids_rev,
10346 .dig_out_nid = ALC883_DIGOUT_NID,
10347 .dig_in_nid = ALC883_DIGIN_NID,
10348 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10349 .channel_mode = alc883_4ST_8ch_modes,
10351 .input_mux = &alc883_capture_source,
10352 .unsol_event = alc883_targa_unsol_event,
10353 .setup = alc882_targa_setup,
10354 .init_hook = alc882_targa_automute,
10357 .mixers = { alc883_base_mixer },
10358 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10359 * and the headphone jack. Turn this on and rely on the
10360 * standard mute methods whenever the user wants to turn
10361 * these outputs off.
10363 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10364 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10365 .dac_nids = alc883_dac_nids,
10366 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10367 .channel_mode = alc883_3ST_2ch_modes,
10368 .input_mux = &alc883_capture_source,
10370 [ALC883_ACER_ASPIRE] = {
10371 .mixers = { alc883_acer_aspire_mixer },
10372 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10373 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10374 .dac_nids = alc883_dac_nids,
10375 .dig_out_nid = ALC883_DIGOUT_NID,
10376 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10377 .channel_mode = alc883_3ST_2ch_modes,
10378 .input_mux = &alc883_capture_source,
10379 .unsol_event = alc_automute_amp_unsol_event,
10380 .setup = alc883_acer_aspire_setup,
10381 .init_hook = alc_automute_amp,
10383 [ALC888_ACER_ASPIRE_4930G] = {
10384 .mixers = { alc888_acer_aspire_4930g_mixer,
10385 alc883_chmode_mixer },
10386 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10387 alc888_acer_aspire_4930g_verbs },
10388 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10389 .dac_nids = alc883_dac_nids,
10390 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10391 .adc_nids = alc883_adc_nids_rev,
10392 .capsrc_nids = alc883_capsrc_nids_rev,
10393 .dig_out_nid = ALC883_DIGOUT_NID,
10394 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10395 .channel_mode = alc883_3ST_6ch_modes,
10397 .const_channel_count = 6,
10399 ARRAY_SIZE(alc888_2_capture_sources),
10400 .input_mux = alc888_2_capture_sources,
10401 .unsol_event = alc_automute_amp_unsol_event,
10402 .setup = alc888_acer_aspire_4930g_setup,
10403 .init_hook = alc_automute_amp,
10405 [ALC888_ACER_ASPIRE_6530G] = {
10406 .mixers = { alc888_acer_aspire_6530_mixer },
10407 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10408 alc888_acer_aspire_6530g_verbs },
10409 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10410 .dac_nids = alc883_dac_nids,
10411 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10412 .adc_nids = alc883_adc_nids_rev,
10413 .capsrc_nids = alc883_capsrc_nids_rev,
10414 .dig_out_nid = ALC883_DIGOUT_NID,
10415 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10416 .channel_mode = alc883_3ST_2ch_modes,
10418 ARRAY_SIZE(alc888_2_capture_sources),
10419 .input_mux = alc888_acer_aspire_6530_sources,
10420 .unsol_event = alc_automute_amp_unsol_event,
10421 .setup = alc888_acer_aspire_6530g_setup,
10422 .init_hook = alc_automute_amp,
10424 [ALC888_ACER_ASPIRE_8930G] = {
10425 .mixers = { alc889_acer_aspire_8930g_mixer,
10426 alc883_chmode_mixer },
10427 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10428 alc889_acer_aspire_8930g_verbs,
10429 alc889_eapd_verbs},
10430 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10431 .dac_nids = alc883_dac_nids,
10432 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10433 .adc_nids = alc889_adc_nids,
10434 .capsrc_nids = alc889_capsrc_nids,
10435 .dig_out_nid = ALC883_DIGOUT_NID,
10436 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10437 .channel_mode = alc883_3ST_6ch_modes,
10439 .const_channel_count = 6,
10441 ARRAY_SIZE(alc889_capture_sources),
10442 .input_mux = alc889_capture_sources,
10443 .unsol_event = alc_automute_amp_unsol_event,
10444 .setup = alc889_acer_aspire_8930g_setup,
10445 .init_hook = alc_automute_amp,
10446 #ifdef CONFIG_SND_HDA_POWER_SAVE
10447 .power_hook = alc_power_eapd,
10450 [ALC888_ACER_ASPIRE_7730G] = {
10451 .mixers = { alc883_3ST_6ch_mixer,
10452 alc883_chmode_mixer },
10453 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10454 alc888_acer_aspire_7730G_verbs },
10455 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10456 .dac_nids = alc883_dac_nids,
10457 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10458 .adc_nids = alc883_adc_nids_rev,
10459 .capsrc_nids = alc883_capsrc_nids_rev,
10460 .dig_out_nid = ALC883_DIGOUT_NID,
10461 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10462 .channel_mode = alc883_3ST_6ch_modes,
10464 .const_channel_count = 6,
10465 .input_mux = &alc883_capture_source,
10466 .unsol_event = alc_automute_amp_unsol_event,
10467 .setup = alc888_acer_aspire_7730g_setup,
10468 .init_hook = alc_automute_amp,
10470 [ALC883_MEDION] = {
10471 .mixers = { alc883_fivestack_mixer,
10472 alc883_chmode_mixer },
10473 .init_verbs = { alc883_init_verbs,
10474 alc883_medion_eapd_verbs },
10475 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10476 .dac_nids = alc883_dac_nids,
10477 .adc_nids = alc883_adc_nids_alt,
10478 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10479 .capsrc_nids = alc883_capsrc_nids,
10480 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10481 .channel_mode = alc883_sixstack_modes,
10482 .input_mux = &alc883_capture_source,
10484 [ALC883_MEDION_WIM2160] = {
10485 .mixers = { alc883_medion_wim2160_mixer },
10486 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10487 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10488 .dac_nids = alc883_dac_nids,
10489 .dig_out_nid = ALC883_DIGOUT_NID,
10490 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10491 .adc_nids = alc883_adc_nids,
10492 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10493 .channel_mode = alc883_3ST_2ch_modes,
10494 .input_mux = &alc883_capture_source,
10495 .unsol_event = alc_automute_amp_unsol_event,
10496 .setup = alc883_medion_wim2160_setup,
10497 .init_hook = alc_automute_amp,
10499 [ALC883_LAPTOP_EAPD] = {
10500 .mixers = { alc883_base_mixer },
10501 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10502 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10503 .dac_nids = alc883_dac_nids,
10504 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10505 .channel_mode = alc883_3ST_2ch_modes,
10506 .input_mux = &alc883_capture_source,
10508 [ALC883_CLEVO_M540R] = {
10509 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10510 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10511 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10512 .dac_nids = alc883_dac_nids,
10513 .dig_out_nid = ALC883_DIGOUT_NID,
10514 .dig_in_nid = ALC883_DIGIN_NID,
10515 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10516 .channel_mode = alc883_3ST_6ch_clevo_modes,
10518 .input_mux = &alc883_capture_source,
10519 /* This machine has the hardware HP auto-muting, thus
10520 * we need no software mute via unsol event
10523 [ALC883_CLEVO_M720] = {
10524 .mixers = { alc883_clevo_m720_mixer },
10525 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10526 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10527 .dac_nids = alc883_dac_nids,
10528 .dig_out_nid = ALC883_DIGOUT_NID,
10529 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10530 .channel_mode = alc883_3ST_2ch_modes,
10531 .input_mux = &alc883_capture_source,
10532 .unsol_event = alc883_clevo_m720_unsol_event,
10533 .setup = alc883_clevo_m720_setup,
10534 .init_hook = alc883_clevo_m720_init_hook,
10536 [ALC883_LENOVO_101E_2ch] = {
10537 .mixers = { alc883_lenovo_101e_2ch_mixer},
10538 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10539 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10540 .dac_nids = alc883_dac_nids,
10541 .adc_nids = alc883_adc_nids_alt,
10542 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10543 .capsrc_nids = alc883_capsrc_nids,
10544 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10545 .channel_mode = alc883_3ST_2ch_modes,
10546 .input_mux = &alc883_lenovo_101e_capture_source,
10547 .unsol_event = alc883_lenovo_101e_unsol_event,
10548 .init_hook = alc883_lenovo_101e_all_automute,
10550 [ALC883_LENOVO_NB0763] = {
10551 .mixers = { alc883_lenovo_nb0763_mixer },
10552 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10553 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10554 .dac_nids = alc883_dac_nids,
10555 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10556 .channel_mode = alc883_3ST_2ch_modes,
10558 .input_mux = &alc883_lenovo_nb0763_capture_source,
10559 .unsol_event = alc_automute_amp_unsol_event,
10560 .setup = alc883_lenovo_nb0763_setup,
10561 .init_hook = alc_automute_amp,
10563 [ALC888_LENOVO_MS7195_DIG] = {
10564 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10565 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10566 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10567 .dac_nids = alc883_dac_nids,
10568 .dig_out_nid = ALC883_DIGOUT_NID,
10569 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10570 .channel_mode = alc883_3ST_6ch_modes,
10572 .input_mux = &alc883_capture_source,
10573 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10574 .init_hook = alc888_lenovo_ms7195_front_automute,
10576 [ALC883_HAIER_W66] = {
10577 .mixers = { alc883_targa_2ch_mixer},
10578 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10579 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10580 .dac_nids = alc883_dac_nids,
10581 .dig_out_nid = ALC883_DIGOUT_NID,
10582 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10583 .channel_mode = alc883_3ST_2ch_modes,
10584 .input_mux = &alc883_capture_source,
10585 .unsol_event = alc_automute_amp_unsol_event,
10586 .setup = alc883_haier_w66_setup,
10587 .init_hook = alc_automute_amp,
10589 [ALC888_3ST_HP] = {
10590 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10591 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10592 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10593 .dac_nids = alc883_dac_nids,
10594 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10595 .channel_mode = alc888_3st_hp_modes,
10597 .input_mux = &alc883_capture_source,
10598 .unsol_event = alc_automute_amp_unsol_event,
10599 .setup = alc888_3st_hp_setup,
10600 .init_hook = alc_automute_amp,
10602 [ALC888_6ST_DELL] = {
10603 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10604 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10605 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10606 .dac_nids = alc883_dac_nids,
10607 .dig_out_nid = ALC883_DIGOUT_NID,
10608 .dig_in_nid = ALC883_DIGIN_NID,
10609 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10610 .channel_mode = alc883_sixstack_modes,
10611 .input_mux = &alc883_capture_source,
10612 .unsol_event = alc_automute_amp_unsol_event,
10613 .setup = alc888_6st_dell_setup,
10614 .init_hook = alc_automute_amp,
10617 .mixers = { alc883_mitac_mixer },
10618 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10619 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10620 .dac_nids = alc883_dac_nids,
10621 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10622 .channel_mode = alc883_3ST_2ch_modes,
10623 .input_mux = &alc883_capture_source,
10624 .unsol_event = alc_automute_amp_unsol_event,
10625 .setup = alc883_mitac_setup,
10626 .init_hook = alc_automute_amp,
10628 [ALC883_FUJITSU_PI2515] = {
10629 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10630 .init_verbs = { alc883_init_verbs,
10631 alc883_2ch_fujitsu_pi2515_verbs},
10632 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10633 .dac_nids = alc883_dac_nids,
10634 .dig_out_nid = ALC883_DIGOUT_NID,
10635 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10636 .channel_mode = alc883_3ST_2ch_modes,
10637 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10638 .unsol_event = alc_automute_amp_unsol_event,
10639 .setup = alc883_2ch_fujitsu_pi2515_setup,
10640 .init_hook = alc_automute_amp,
10642 [ALC888_FUJITSU_XA3530] = {
10643 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10644 .init_verbs = { alc883_init_verbs,
10645 alc888_fujitsu_xa3530_verbs },
10646 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10647 .dac_nids = alc883_dac_nids,
10648 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10649 .adc_nids = alc883_adc_nids_rev,
10650 .capsrc_nids = alc883_capsrc_nids_rev,
10651 .dig_out_nid = ALC883_DIGOUT_NID,
10652 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10653 .channel_mode = alc888_4ST_8ch_intel_modes,
10655 ARRAY_SIZE(alc888_2_capture_sources),
10656 .input_mux = alc888_2_capture_sources,
10657 .unsol_event = alc_automute_amp_unsol_event,
10658 .setup = alc888_fujitsu_xa3530_setup,
10659 .init_hook = alc_automute_amp,
10661 [ALC888_LENOVO_SKY] = {
10662 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10663 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10664 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10665 .dac_nids = alc883_dac_nids,
10666 .dig_out_nid = ALC883_DIGOUT_NID,
10667 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10668 .channel_mode = alc883_sixstack_modes,
10670 .input_mux = &alc883_lenovo_sky_capture_source,
10671 .unsol_event = alc_automute_amp_unsol_event,
10672 .setup = alc888_lenovo_sky_setup,
10673 .init_hook = alc_automute_amp,
10675 [ALC888_ASUS_M90V] = {
10676 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10677 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10678 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10679 .dac_nids = alc883_dac_nids,
10680 .dig_out_nid = ALC883_DIGOUT_NID,
10681 .dig_in_nid = ALC883_DIGIN_NID,
10682 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10683 .channel_mode = alc883_3ST_6ch_modes,
10685 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10686 .unsol_event = alc_sku_unsol_event,
10687 .setup = alc883_mode2_setup,
10688 .init_hook = alc_inithook,
10690 [ALC888_ASUS_EEE1601] = {
10691 .mixers = { alc883_asus_eee1601_mixer },
10692 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10693 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10694 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10695 .dac_nids = alc883_dac_nids,
10696 .dig_out_nid = ALC883_DIGOUT_NID,
10697 .dig_in_nid = ALC883_DIGIN_NID,
10698 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10699 .channel_mode = alc883_3ST_2ch_modes,
10701 .input_mux = &alc883_asus_eee1601_capture_source,
10702 .unsol_event = alc_sku_unsol_event,
10703 .init_hook = alc883_eee1601_inithook,
10705 [ALC1200_ASUS_P5Q] = {
10706 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10707 .init_verbs = { alc883_init_verbs },
10708 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10709 .dac_nids = alc883_dac_nids,
10710 .dig_out_nid = ALC1200_DIGOUT_NID,
10711 .dig_in_nid = ALC883_DIGIN_NID,
10712 .slave_dig_outs = alc1200_slave_dig_outs,
10713 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10714 .channel_mode = alc883_sixstack_modes,
10715 .input_mux = &alc883_capture_source,
10718 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10719 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10720 alc880_gpio1_init_verbs },
10721 .adc_nids = alc883_adc_nids,
10722 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10723 .capsrc_nids = alc883_capsrc_nids,
10724 .dac_nids = alc883_dac_nids,
10725 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10726 .channel_mode = alc889A_mb31_6ch_modes,
10727 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10728 .input_mux = &alc889A_mb31_capture_source,
10729 .dig_out_nid = ALC883_DIGOUT_NID,
10730 .unsol_event = alc889A_mb31_unsol_event,
10731 .init_hook = alc889A_mb31_automute,
10733 [ALC883_SONY_VAIO_TT] = {
10734 .mixers = { alc883_vaiott_mixer },
10735 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10736 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10737 .dac_nids = alc883_dac_nids,
10738 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10739 .channel_mode = alc883_3ST_2ch_modes,
10740 .input_mux = &alc883_capture_source,
10741 .unsol_event = alc_automute_amp_unsol_event,
10742 .setup = alc883_vaiott_setup,
10743 .init_hook = alc_automute_amp,
10752 PINFIX_ABIT_AW9D_MAX,
10753 PINFIX_LENOVO_Y530,
10755 PINFIX_ACER_ASPIRE_7736,
10758 static const struct alc_fixup alc882_fixups[] = {
10759 [PINFIX_ABIT_AW9D_MAX] = {
10760 .type = ALC_FIXUP_PINS,
10761 .v.pins = (const struct alc_pincfg[]) {
10762 { 0x15, 0x01080104 }, /* side */
10763 { 0x16, 0x01011012 }, /* rear */
10764 { 0x17, 0x01016011 }, /* clfe */
10768 [PINFIX_LENOVO_Y530] = {
10769 .type = ALC_FIXUP_PINS,
10770 .v.pins = (const struct alc_pincfg[]) {
10771 { 0x15, 0x99130112 }, /* rear int speakers */
10772 { 0x16, 0x99130111 }, /* subwoofer */
10776 [PINFIX_PB_M5210] = {
10777 .type = ALC_FIXUP_VERBS,
10778 .v.verbs = (const struct hda_verb[]) {
10779 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10783 [PINFIX_ACER_ASPIRE_7736] = {
10784 .type = ALC_FIXUP_SKU,
10785 .v.sku = ALC_FIXUP_SKU_IGNORE,
10789 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10790 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10791 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
10792 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10793 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10798 * BIOS auto configuration
10800 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10801 const struct auto_pin_cfg *cfg)
10803 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10806 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10807 hda_nid_t nid, int pin_type,
10812 /* set as output */
10813 alc_set_pin_output(codec, nid, pin_type);
10817 else if (dac >= 0x02 && dac <= 0x05)
10821 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10824 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10826 struct alc_spec *spec = codec->spec;
10829 for (i = 0; i <= HDA_SIDE; i++) {
10830 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10831 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10833 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10834 spec->multiout.dac_nids[i]);
10838 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10840 struct alc_spec *spec = codec->spec;
10841 hda_nid_t pin, dac;
10844 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10845 pin = spec->autocfg.hp_pins[i];
10848 dac = spec->multiout.hp_nid;
10850 dac = spec->multiout.dac_nids[0]; /* to front */
10851 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10853 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10854 pin = spec->autocfg.speaker_pins[i];
10857 dac = spec->multiout.extra_out_nid[0];
10859 dac = spec->multiout.dac_nids[0]; /* to front */
10860 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10864 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10866 struct alc_spec *spec = codec->spec;
10867 struct auto_pin_cfg *cfg = &spec->autocfg;
10870 for (i = 0; i < cfg->num_inputs; i++) {
10871 hda_nid_t nid = cfg->inputs[i].pin;
10872 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10873 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10874 snd_hda_codec_write(codec, nid, 0,
10875 AC_VERB_SET_AMP_GAIN_MUTE,
10880 static void alc882_auto_init_input_src(struct hda_codec *codec)
10882 struct alc_spec *spec = codec->spec;
10885 for (c = 0; c < spec->num_adc_nids; c++) {
10886 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10887 hda_nid_t nid = spec->capsrc_nids[c];
10888 unsigned int mux_idx;
10889 const struct hda_input_mux *imux;
10890 int conns, mute, idx, item;
10892 conns = snd_hda_get_connections(codec, nid, conn_list,
10893 ARRAY_SIZE(conn_list));
10896 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10897 imux = &spec->input_mux[mux_idx];
10898 if (!imux->num_items && mux_idx > 0)
10899 imux = &spec->input_mux[0];
10900 for (idx = 0; idx < conns; idx++) {
10901 /* if the current connection is the selected one,
10902 * unmute it as default - otherwise mute it
10904 mute = AMP_IN_MUTE(idx);
10905 for (item = 0; item < imux->num_items; item++) {
10906 if (imux->items[item].index == idx) {
10907 if (spec->cur_mux[c] == item)
10908 mute = AMP_IN_UNMUTE(idx);
10912 /* check if we have a selector or mixer
10913 * we could check for the widget type instead, but
10914 * just check for Amp-In presence (in case of mixer
10915 * without amp-in there is something wrong, this
10916 * function shouldn't be used or capsrc nid is wrong)
10918 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10919 snd_hda_codec_write(codec, nid, 0,
10920 AC_VERB_SET_AMP_GAIN_MUTE,
10922 else if (mute != AMP_IN_MUTE(idx))
10923 snd_hda_codec_write(codec, nid, 0,
10924 AC_VERB_SET_CONNECT_SEL,
10930 /* add mic boosts if needed */
10931 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10933 struct alc_spec *spec = codec->spec;
10934 struct auto_pin_cfg *cfg = &spec->autocfg;
10938 const char *prev_label = NULL;
10940 for (i = 0; i < cfg->num_inputs; i++) {
10941 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10943 nid = cfg->inputs[i].pin;
10944 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10946 char boost_label[32];
10948 label = hda_get_autocfg_input_label(codec, cfg, i);
10949 if (prev_label && !strcmp(label, prev_label))
10953 prev_label = label;
10955 snprintf(boost_label, sizeof(boost_label),
10956 "%s Boost Volume", label);
10957 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10958 boost_label, type_idx,
10959 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10967 /* almost identical with ALC880 parser... */
10968 static int alc882_parse_auto_config(struct hda_codec *codec)
10970 struct alc_spec *spec = codec->spec;
10971 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10974 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10978 if (!spec->autocfg.line_outs)
10979 return 0; /* can't find valid BIOS pin config */
10981 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10984 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10987 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10991 err = alc880_auto_create_extra_out(spec,
10992 spec->autocfg.speaker_pins[0],
10996 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
11000 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11002 alc_auto_parse_digital(codec);
11004 if (spec->kctls.list)
11005 add_mixer(spec, spec->kctls.list);
11007 add_verb(spec, alc883_auto_init_verbs);
11008 /* if ADC 0x07 is available, initialize it, too */
11009 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
11010 add_verb(spec, alc882_adc1_init_verbs);
11012 spec->num_mux_defs = 1;
11013 spec->input_mux = &spec->private_imux[0];
11015 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11017 err = alc_auto_add_mic_boost(codec);
11021 return 1; /* config found */
11024 /* additional initialization for auto-configuration model */
11025 static void alc882_auto_init(struct hda_codec *codec)
11027 struct alc_spec *spec = codec->spec;
11028 alc882_auto_init_multi_out(codec);
11029 alc882_auto_init_hp_out(codec);
11030 alc882_auto_init_analog_input(codec);
11031 alc882_auto_init_input_src(codec);
11032 alc_auto_init_digital(codec);
11033 if (spec->unsol_event)
11034 alc_inithook(codec);
11037 static int patch_alc882(struct hda_codec *codec)
11039 struct alc_spec *spec;
11040 int err, board_config;
11042 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11046 codec->spec = spec;
11048 switch (codec->vendor_id) {
11053 /* ALC883 and variants */
11054 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11058 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
11062 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
11063 board_config = snd_hda_check_board_codec_sid_config(codec,
11064 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
11066 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
11067 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11069 board_config = ALC882_AUTO;
11072 if (board_config == ALC882_AUTO) {
11073 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11074 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11077 alc_auto_parse_customize_define(codec);
11079 if (board_config == ALC882_AUTO) {
11080 /* automatic parse from the BIOS config */
11081 err = alc882_parse_auto_config(codec);
11087 "hda_codec: Cannot set up configuration "
11088 "from BIOS. Using base mode...\n");
11089 board_config = ALC882_3ST_DIG;
11093 if (has_cdefine_beep(codec)) {
11094 err = snd_hda_attach_beep_device(codec, 0x1);
11101 if (board_config != ALC882_AUTO)
11102 setup_preset(codec, &alc882_presets[board_config]);
11104 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11105 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11106 /* FIXME: setup DAC5 */
11107 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11108 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11110 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11111 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11113 if (!spec->adc_nids && spec->input_mux) {
11115 spec->num_adc_nids = 0;
11116 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11117 const struct hda_input_mux *imux = spec->input_mux;
11119 hda_nid_t items[16];
11120 hda_nid_t nid = alc882_adc_nids[i];
11121 unsigned int wcap = get_wcaps(codec, nid);
11123 wcap = get_wcaps_type(wcap);
11124 if (wcap != AC_WID_AUD_IN)
11126 spec->private_adc_nids[spec->num_adc_nids] = nid;
11127 err = snd_hda_get_connections(codec, nid, &cap, 1);
11130 err = snd_hda_get_connections(codec, cap, items,
11131 ARRAY_SIZE(items));
11134 for (j = 0; j < imux->num_items; j++)
11135 if (imux->items[j].index >= err)
11137 if (j < imux->num_items)
11139 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11140 spec->num_adc_nids++;
11142 spec->adc_nids = spec->private_adc_nids;
11143 spec->capsrc_nids = spec->private_capsrc_nids;
11146 set_capture_mixer(codec);
11148 if (has_cdefine_beep(codec))
11149 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11151 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11153 spec->vmaster_nid = 0x0c;
11155 codec->patch_ops = alc_patch_ops;
11156 if (board_config == ALC882_AUTO)
11157 spec->init_hook = alc882_auto_init;
11159 alc_init_jacks(codec);
11160 #ifdef CONFIG_SND_HDA_POWER_SAVE
11161 if (!spec->loopback.amplist)
11162 spec->loopback.amplist = alc882_loopbacks;
11173 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11174 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11176 #define alc262_dac_nids alc260_dac_nids
11177 #define alc262_adc_nids alc882_adc_nids
11178 #define alc262_adc_nids_alt alc882_adc_nids_alt
11179 #define alc262_capsrc_nids alc882_capsrc_nids
11180 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11182 #define alc262_modes alc260_modes
11183 #define alc262_capture_source alc882_capture_source
11185 static hda_nid_t alc262_dmic_adc_nids[1] = {
11190 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11192 static struct snd_kcontrol_new alc262_base_mixer[] = {
11193 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11194 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11195 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11196 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11197 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11198 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11199 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11201 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11202 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11203 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11204 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11205 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11207 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11208 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11212 /* update HP, line and mono-out pins according to the master switch */
11213 static void alc262_hp_master_update(struct hda_codec *codec)
11215 struct alc_spec *spec = codec->spec;
11216 int val = spec->master_sw;
11218 /* HP & line-out */
11219 snd_hda_codec_write_cache(codec, 0x1b, 0,
11220 AC_VERB_SET_PIN_WIDGET_CONTROL,
11222 snd_hda_codec_write_cache(codec, 0x15, 0,
11223 AC_VERB_SET_PIN_WIDGET_CONTROL,
11225 /* mono (speaker) depending on the HP jack sense */
11226 val = val && !spec->jack_present;
11227 snd_hda_codec_write_cache(codec, 0x16, 0,
11228 AC_VERB_SET_PIN_WIDGET_CONTROL,
11229 val ? PIN_OUT : 0);
11232 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11234 struct alc_spec *spec = codec->spec;
11236 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11237 alc262_hp_master_update(codec);
11240 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11242 if ((res >> 26) != ALC880_HP_EVENT)
11244 alc262_hp_bpc_automute(codec);
11247 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11249 struct alc_spec *spec = codec->spec;
11251 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11252 alc262_hp_master_update(codec);
11255 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11258 if ((res >> 26) != ALC880_HP_EVENT)
11260 alc262_hp_wildwest_automute(codec);
11263 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11265 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11266 struct snd_ctl_elem_value *ucontrol)
11268 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11269 struct alc_spec *spec = codec->spec;
11270 int val = !!*ucontrol->value.integer.value;
11272 if (val == spec->master_sw)
11274 spec->master_sw = val;
11275 alc262_hp_master_update(codec);
11279 #define ALC262_HP_MASTER_SWITCH \
11281 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11282 .name = "Master Playback Switch", \
11283 .info = snd_ctl_boolean_mono_info, \
11284 .get = alc262_hp_master_sw_get, \
11285 .put = alc262_hp_master_sw_put, \
11288 .iface = NID_MAPPING, \
11289 .name = "Master Playback Switch", \
11290 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11294 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11295 ALC262_HP_MASTER_SWITCH,
11296 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11297 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11298 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11299 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11301 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11303 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11304 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11305 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11306 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11307 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11308 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11309 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11310 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11311 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11312 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11313 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11314 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11318 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11319 ALC262_HP_MASTER_SWITCH,
11320 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11321 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11322 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11323 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11324 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11326 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11328 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11329 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11330 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11331 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11332 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11333 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11334 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11338 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11339 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11340 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11341 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11345 /* mute/unmute internal speaker according to the hp jack and mute state */
11346 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11348 struct alc_spec *spec = codec->spec;
11350 spec->autocfg.hp_pins[0] = 0x15;
11351 spec->autocfg.speaker_pins[0] = 0x14;
11354 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11355 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11356 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11357 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11358 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11360 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11361 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11365 static struct hda_verb alc262_hp_t5735_verbs[] = {
11366 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11367 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11369 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11373 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11374 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11375 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11376 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11377 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11378 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11379 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11383 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11384 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11385 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11386 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11387 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11388 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11389 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11390 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11391 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11392 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11393 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11397 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11404 /* bind hp and internal speaker mute (with plug check) as master switch */
11405 static void alc262_hippo_master_update(struct hda_codec *codec)
11407 struct alc_spec *spec = codec->spec;
11408 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11409 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11410 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11414 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11415 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11416 HDA_AMP_MUTE, mute);
11417 /* mute internal speaker per jack sense */
11418 if (spec->jack_present)
11419 mute = HDA_AMP_MUTE;
11421 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11422 HDA_AMP_MUTE, mute);
11423 if (speaker_nid && speaker_nid != line_nid)
11424 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11425 HDA_AMP_MUTE, mute);
11428 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11430 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11431 struct snd_ctl_elem_value *ucontrol)
11433 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11434 struct alc_spec *spec = codec->spec;
11435 int val = !!*ucontrol->value.integer.value;
11437 if (val == spec->master_sw)
11439 spec->master_sw = val;
11440 alc262_hippo_master_update(codec);
11444 #define ALC262_HIPPO_MASTER_SWITCH \
11446 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11447 .name = "Master Playback Switch", \
11448 .info = snd_ctl_boolean_mono_info, \
11449 .get = alc262_hippo_master_sw_get, \
11450 .put = alc262_hippo_master_sw_put, \
11453 .iface = NID_MAPPING, \
11454 .name = "Master Playback Switch", \
11455 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11456 (SUBDEV_SPEAKER(0) << 16), \
11459 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11460 ALC262_HIPPO_MASTER_SWITCH,
11461 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11462 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11463 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11464 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11465 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11466 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11467 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11468 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11469 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11470 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11471 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11472 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11476 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11477 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11478 ALC262_HIPPO_MASTER_SWITCH,
11479 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11480 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11481 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11482 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11483 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11484 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11485 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11486 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11487 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11488 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11492 /* mute/unmute internal speaker according to the hp jack and mute state */
11493 static void alc262_hippo_automute(struct hda_codec *codec)
11495 struct alc_spec *spec = codec->spec;
11496 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11498 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11499 alc262_hippo_master_update(codec);
11502 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11504 if ((res >> 26) != ALC880_HP_EVENT)
11506 alc262_hippo_automute(codec);
11509 static void alc262_hippo_setup(struct hda_codec *codec)
11511 struct alc_spec *spec = codec->spec;
11513 spec->autocfg.hp_pins[0] = 0x15;
11514 spec->autocfg.speaker_pins[0] = 0x14;
11517 static void alc262_hippo1_setup(struct hda_codec *codec)
11519 struct alc_spec *spec = codec->spec;
11521 spec->autocfg.hp_pins[0] = 0x1b;
11522 spec->autocfg.speaker_pins[0] = 0x14;
11526 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11527 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11528 ALC262_HIPPO_MASTER_SWITCH,
11529 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11530 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11531 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11532 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11536 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11537 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11538 ALC262_HIPPO_MASTER_SWITCH,
11539 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11540 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11541 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11542 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11543 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11547 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11548 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11549 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11550 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11551 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11552 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11553 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11554 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11555 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11556 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11557 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11558 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11559 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11563 static struct hda_verb alc262_tyan_verbs[] = {
11564 /* Headphone automute */
11565 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11566 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11567 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11569 /* P11 AUX_IN, white 4-pin connector */
11570 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11571 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11572 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11573 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11578 /* unsolicited event for HP jack sensing */
11579 static void alc262_tyan_setup(struct hda_codec *codec)
11581 struct alc_spec *spec = codec->spec;
11583 spec->autocfg.hp_pins[0] = 0x1b;
11584 spec->autocfg.speaker_pins[0] = 0x15;
11588 #define alc262_capture_mixer alc882_capture_mixer
11589 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11592 * generic initialization of ADC, input mixers and output mixers
11594 static struct hda_verb alc262_init_verbs[] = {
11596 * Unmute ADC0-2 and set the default input to mic-in
11598 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11600 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11601 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11602 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11603 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11605 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11607 * Note: PASD motherboards uses the Line In 2 as the input for
11608 * front panel mic (mic 2)
11610 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11618 * Set up output mixers (0x0c - 0x0e)
11620 /* set vol=0 to output mixers */
11621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11623 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11624 /* set up input amps for analog loopback */
11625 /* Amp Indices: DAC = 0, mixer = 1 */
11626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11630 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11634 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11635 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11636 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11637 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11638 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11640 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11641 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11642 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11643 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11644 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11646 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11647 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11649 /* FIXME: use matrix-type input source selection */
11650 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11651 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11652 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11653 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11654 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11657 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11658 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11659 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11662 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11663 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11665 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11670 static struct hda_verb alc262_eapd_verbs[] = {
11671 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11672 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11676 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11677 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11678 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11679 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11681 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11682 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11686 static struct hda_verb alc262_sony_unsol_verbs[] = {
11687 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11688 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11689 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11691 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11692 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11696 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11697 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11698 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11699 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11700 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11701 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11705 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11706 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11708 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11709 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11710 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11711 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11712 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11713 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11717 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11719 struct alc_spec *spec = codec->spec;
11721 spec->autocfg.hp_pins[0] = 0x15;
11722 spec->autocfg.speaker_pins[0] = 0x14;
11723 spec->ext_mic.pin = 0x18;
11724 spec->ext_mic.mux_idx = 0;
11725 spec->int_mic.pin = 0x12;
11726 spec->int_mic.mux_idx = 9;
11727 spec->auto_mic = 1;
11733 * 0x16 = internal speaker
11734 * 0x18 = external mic
11737 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11738 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11739 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11741 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11742 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11743 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11745 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11746 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11750 static struct hda_verb alc262_nec_verbs[] = {
11751 /* Unmute Speaker */
11752 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11755 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11756 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11758 /* External mic to headphone */
11759 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11760 /* External mic to speaker */
11761 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11767 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11768 * 0x1b = port replicator headphone out
11771 #define ALC_HP_EVENT 0x37
11773 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11774 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11775 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11776 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11777 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11781 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11782 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11783 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11787 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11788 /* Front Mic pin: input vref at 50% */
11789 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11790 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11794 static struct hda_input_mux alc262_fujitsu_capture_source = {
11798 { "Internal Mic", 0x1 },
11803 static struct hda_input_mux alc262_HP_capture_source = {
11807 { "Front Mic", 0x1 },
11814 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11818 { "Front Mic", 0x2 },
11824 /* mute/unmute internal speaker according to the hp jacks and mute state */
11825 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11827 struct alc_spec *spec = codec->spec;
11830 if (force || !spec->sense_updated) {
11831 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11832 snd_hda_jack_detect(codec, 0x1b);
11833 spec->sense_updated = 1;
11835 /* unmute internal speaker only if both HPs are unplugged and
11836 * master switch is on
11838 if (spec->jack_present)
11839 mute = HDA_AMP_MUTE;
11841 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11842 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11843 HDA_AMP_MUTE, mute);
11846 /* unsolicited event for HP jack sensing */
11847 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11850 if ((res >> 26) != ALC_HP_EVENT)
11852 alc262_fujitsu_automute(codec, 1);
11855 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11857 alc262_fujitsu_automute(codec, 1);
11860 /* bind volumes of both NID 0x0c and 0x0d */
11861 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11862 .ops = &snd_hda_bind_vol,
11864 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11865 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11870 /* mute/unmute internal speaker according to the hp jack and mute state */
11871 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11873 struct alc_spec *spec = codec->spec;
11876 if (force || !spec->sense_updated) {
11877 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11878 spec->sense_updated = 1;
11880 if (spec->jack_present) {
11881 /* mute internal speaker */
11882 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11883 HDA_AMP_MUTE, HDA_AMP_MUTE);
11884 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11885 HDA_AMP_MUTE, HDA_AMP_MUTE);
11887 /* unmute internal speaker if necessary */
11888 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11889 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11890 HDA_AMP_MUTE, mute);
11891 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11892 HDA_AMP_MUTE, mute);
11896 /* unsolicited event for HP jack sensing */
11897 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11900 if ((res >> 26) != ALC_HP_EVENT)
11902 alc262_lenovo_3000_automute(codec, 1);
11905 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11906 int dir, int idx, long *valp)
11910 for (i = 0; i < 2; i++, valp++)
11911 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11913 *valp ? 0 : HDA_AMP_MUTE);
11917 /* bind hp and internal speaker mute (with plug check) */
11918 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11919 struct snd_ctl_elem_value *ucontrol)
11921 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11922 long *valp = ucontrol->value.integer.value;
11925 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11926 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11928 alc262_fujitsu_automute(codec, 0);
11932 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11933 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11935 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11936 .name = "Master Playback Switch",
11937 .subdevice = HDA_SUBDEV_AMP_FLAG,
11938 .info = snd_hda_mixer_amp_switch_info,
11939 .get = snd_hda_mixer_amp_switch_get,
11940 .put = alc262_fujitsu_master_sw_put,
11941 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11944 .iface = NID_MAPPING,
11945 .name = "Master Playback Switch",
11946 .private_value = 0x1b,
11948 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11949 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11950 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11952 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11953 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11954 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11955 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11959 /* bind hp and internal speaker mute (with plug check) */
11960 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11961 struct snd_ctl_elem_value *ucontrol)
11963 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11964 long *valp = ucontrol->value.integer.value;
11967 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11969 alc262_lenovo_3000_automute(codec, 0);
11973 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11974 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11976 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11977 .name = "Master Playback Switch",
11978 .subdevice = HDA_SUBDEV_AMP_FLAG,
11979 .info = snd_hda_mixer_amp_switch_info,
11980 .get = snd_hda_mixer_amp_switch_get,
11981 .put = alc262_lenovo_3000_master_sw_put,
11982 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11984 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11985 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11986 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11987 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11988 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11989 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11990 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11991 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11995 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11996 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11997 ALC262_HIPPO_MASTER_SWITCH,
11998 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11999 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12000 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12001 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12002 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12003 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
12007 /* additional init verbs for Benq laptops */
12008 static struct hda_verb alc262_EAPD_verbs[] = {
12009 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12010 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
12014 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
12015 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12016 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12018 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12019 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
12023 /* Samsung Q1 Ultra Vista model setup */
12024 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
12025 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
12026 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
12027 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12028 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12029 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
12030 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
12034 static struct hda_verb alc262_ultra_verbs[] = {
12036 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12037 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12038 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12040 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12041 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12042 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12043 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12045 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12046 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12047 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12048 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12049 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12051 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12052 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12053 /* ADC, choose mic */
12054 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12055 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12056 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12057 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12058 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12059 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12060 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12061 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12062 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12063 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
12067 /* mute/unmute internal speaker according to the hp jack and mute state */
12068 static void alc262_ultra_automute(struct hda_codec *codec)
12070 struct alc_spec *spec = codec->spec;
12074 /* auto-mute only when HP is used as HP */
12075 if (!spec->cur_mux[0]) {
12076 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
12077 if (spec->jack_present)
12078 mute = HDA_AMP_MUTE;
12080 /* mute/unmute internal speaker */
12081 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12082 HDA_AMP_MUTE, mute);
12083 /* mute/unmute HP */
12084 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12085 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
12088 /* unsolicited event for HP jack sensing */
12089 static void alc262_ultra_unsol_event(struct hda_codec *codec,
12092 if ((res >> 26) != ALC880_HP_EVENT)
12094 alc262_ultra_automute(codec);
12097 static struct hda_input_mux alc262_ultra_capture_source = {
12101 { "Headphone", 0x7 },
12105 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12106 struct snd_ctl_elem_value *ucontrol)
12108 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12109 struct alc_spec *spec = codec->spec;
12112 ret = alc_mux_enum_put(kcontrol, ucontrol);
12115 /* reprogram the HP pin as mic or HP according to the input source */
12116 snd_hda_codec_write_cache(codec, 0x15, 0,
12117 AC_VERB_SET_PIN_WIDGET_CONTROL,
12118 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12119 alc262_ultra_automute(codec); /* mute/unmute HP */
12123 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12124 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12125 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12127 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12128 .name = "Capture Source",
12129 .info = alc_mux_enum_info,
12130 .get = alc_mux_enum_get,
12131 .put = alc262_ultra_mux_enum_put,
12134 .iface = NID_MAPPING,
12135 .name = "Capture Source",
12136 .private_value = 0x15,
12141 /* We use two mixers depending on the output pin; 0x16 is a mono output
12142 * and thus it's bound with a different mixer.
12143 * This function returns which mixer amp should be used.
12145 static int alc262_check_volbit(hda_nid_t nid)
12149 else if (nid == 0x16)
12155 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12156 const char *pfx, int *vbits, int idx)
12161 vbit = alc262_check_volbit(nid);
12164 if (*vbits & vbit) /* a volume control for this mixer already there */
12168 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12170 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12171 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12174 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12175 const char *pfx, int idx)
12182 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12184 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12185 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12188 /* add playback controls from the parsed DAC table */
12189 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12190 const struct auto_pin_cfg *cfg)
12196 spec->multiout.num_dacs = 1; /* only use one dac */
12197 spec->multiout.dac_nids = spec->private_dac_nids;
12198 spec->multiout.dac_nids[0] = 2;
12200 pfx = alc_get_line_out_pfx(cfg, true);
12203 for (i = 0; i < 2; i++) {
12204 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12207 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12208 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12213 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12214 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12221 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12222 alc262_check_volbit(cfg->speaker_pins[0]) |
12223 alc262_check_volbit(cfg->hp_pins[0]);
12224 if (vbits == 1 || vbits == 2)
12225 pfx = "Master"; /* only one mixer is used */
12227 for (i = 0; i < 2; i++) {
12228 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12232 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12233 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12234 "Speaker", &vbits, i);
12238 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12239 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12240 "Headphone", &vbits, i);
12248 #define alc262_auto_create_input_ctls \
12249 alc882_auto_create_input_ctls
12252 * generic initialization of ADC, input mixers and output mixers
12254 static struct hda_verb alc262_volume_init_verbs[] = {
12256 * Unmute ADC0-2 and set the default input to mic-in
12258 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12259 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12260 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12261 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12262 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12263 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12265 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12267 * Note: PASD motherboards uses the Line In 2 as the input for
12268 * front panel mic (mic 2)
12270 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12271 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12272 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12273 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12274 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12275 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12278 * Set up output mixers (0x0c - 0x0f)
12280 /* set vol=0 to output mixers */
12281 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12282 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12283 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12285 /* set up input amps for analog loopback */
12286 /* Amp Indices: DAC = 0, mixer = 1 */
12287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12289 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12290 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12291 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12292 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12294 /* FIXME: use matrix-type input source selection */
12295 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12296 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12297 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12298 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12302 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12307 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12315 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12317 * Unmute ADC0-2 and set the default input to mic-in
12319 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12320 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12321 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12322 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12323 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12324 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12326 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12328 * Note: PASD motherboards uses the Line In 2 as the input for
12329 * front panel mic (mic 2)
12331 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12332 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12333 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12334 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12335 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12341 * Set up output mixers (0x0c - 0x0e)
12343 /* set vol=0 to output mixers */
12344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12345 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12348 /* set up input amps for analog loopback */
12349 /* Amp Indices: DAC = 0, mixer = 1 */
12350 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12351 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12352 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12353 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12354 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12357 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12358 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12359 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12361 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12362 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12364 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12365 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12367 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12368 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12369 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12370 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12371 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12373 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12374 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12376 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12377 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12378 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12381 /* FIXME: use matrix-type input source selection */
12382 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12383 /* Input mixer1: only unmute Mic */
12384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12389 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12390 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12391 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12392 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12395 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12396 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12397 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12399 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12400 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12401 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12402 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12405 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12407 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12408 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12409 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12414 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12419 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12421 * Unmute ADC0-2 and set the default input to mic-in
12423 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12424 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12425 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12426 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12427 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12428 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12430 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12432 * Note: PASD motherboards uses the Line In 2 as the input for front
12433 * panel mic (mic 2)
12435 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12436 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12437 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12438 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12439 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12440 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12441 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12442 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12443 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12445 * Set up output mixers (0x0c - 0x0e)
12447 /* set vol=0 to output mixers */
12448 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12449 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12450 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12452 /* set up input amps for analog loopback */
12453 /* Amp Indices: DAC = 0, mixer = 1 */
12454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12456 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12457 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12458 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12462 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12463 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12464 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12465 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12466 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12467 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12468 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12470 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12471 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12473 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12474 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12476 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12477 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12478 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12479 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12480 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12481 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12483 /* FIXME: use matrix-type input source selection */
12484 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12485 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12486 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12487 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12488 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12489 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12490 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12491 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12492 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12494 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12495 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12496 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12497 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12498 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12499 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12500 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12502 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12505 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12506 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12507 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12508 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12510 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12515 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12517 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12518 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12519 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12521 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12522 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12523 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12524 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12527 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12528 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12539 static const struct alc_fixup alc262_fixups[] = {
12540 [PINFIX_FSC_H270] = {
12541 .type = ALC_FIXUP_PINS,
12542 .v.pins = (const struct alc_pincfg[]) {
12543 { 0x14, 0x99130110 }, /* speaker */
12544 { 0x15, 0x0221142f }, /* front HP */
12545 { 0x1b, 0x0121141f }, /* rear HP */
12551 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12552 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12557 #ifdef CONFIG_SND_HDA_POWER_SAVE
12558 #define alc262_loopbacks alc880_loopbacks
12561 /* pcm configuration: identical with ALC880 */
12562 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12563 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12564 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12565 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12568 * BIOS auto configuration
12570 static int alc262_parse_auto_config(struct hda_codec *codec)
12572 struct alc_spec *spec = codec->spec;
12574 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12576 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12580 if (!spec->autocfg.line_outs) {
12581 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12582 spec->multiout.max_channels = 2;
12583 spec->no_analog = 1;
12586 return 0; /* can't find valid BIOS pin config */
12588 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12591 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12595 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12598 alc_auto_parse_digital(codec);
12600 if (spec->kctls.list)
12601 add_mixer(spec, spec->kctls.list);
12603 add_verb(spec, alc262_volume_init_verbs);
12604 spec->num_mux_defs = 1;
12605 spec->input_mux = &spec->private_imux[0];
12607 err = alc_auto_add_mic_boost(codec);
12611 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12616 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12617 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12618 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12619 #define alc262_auto_init_input_src alc882_auto_init_input_src
12622 /* init callback for auto-configuration model -- overriding the default init */
12623 static void alc262_auto_init(struct hda_codec *codec)
12625 struct alc_spec *spec = codec->spec;
12626 alc262_auto_init_multi_out(codec);
12627 alc262_auto_init_hp_out(codec);
12628 alc262_auto_init_analog_input(codec);
12629 alc262_auto_init_input_src(codec);
12630 alc_auto_init_digital(codec);
12631 if (spec->unsol_event)
12632 alc_inithook(codec);
12636 * configuration and preset
12638 static const char * const alc262_models[ALC262_MODEL_LAST] = {
12639 [ALC262_BASIC] = "basic",
12640 [ALC262_HIPPO] = "hippo",
12641 [ALC262_HIPPO_1] = "hippo_1",
12642 [ALC262_FUJITSU] = "fujitsu",
12643 [ALC262_HP_BPC] = "hp-bpc",
12644 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12645 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12646 [ALC262_HP_RP5700] = "hp-rp5700",
12647 [ALC262_BENQ_ED8] = "benq",
12648 [ALC262_BENQ_T31] = "benq-t31",
12649 [ALC262_SONY_ASSAMD] = "sony-assamd",
12650 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12651 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12652 [ALC262_ULTRA] = "ultra",
12653 [ALC262_LENOVO_3000] = "lenovo-3000",
12654 [ALC262_NEC] = "nec",
12655 [ALC262_TYAN] = "tyan",
12656 [ALC262_AUTO] = "auto",
12659 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12660 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12661 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12662 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12664 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12666 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12668 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12670 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12671 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12672 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12673 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12674 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12675 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12676 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12677 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12678 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12679 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12680 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12681 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12682 ALC262_HP_TC_T5735),
12683 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12684 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12685 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12686 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12687 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12688 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12689 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12690 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12691 #if 0 /* disable the quirk since model=auto works better in recent versions */
12692 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12693 ALC262_SONY_ASSAMD),
12695 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12696 ALC262_TOSHIBA_RX1),
12697 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12698 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12699 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12700 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12701 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12703 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12704 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12705 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12706 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12707 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12711 static struct alc_config_preset alc262_presets[] = {
12713 .mixers = { alc262_base_mixer },
12714 .init_verbs = { alc262_init_verbs },
12715 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12716 .dac_nids = alc262_dac_nids,
12718 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12719 .channel_mode = alc262_modes,
12720 .input_mux = &alc262_capture_source,
12723 .mixers = { alc262_hippo_mixer },
12724 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12725 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12726 .dac_nids = alc262_dac_nids,
12728 .dig_out_nid = ALC262_DIGOUT_NID,
12729 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12730 .channel_mode = alc262_modes,
12731 .input_mux = &alc262_capture_source,
12732 .unsol_event = alc262_hippo_unsol_event,
12733 .setup = alc262_hippo_setup,
12734 .init_hook = alc262_hippo_automute,
12736 [ALC262_HIPPO_1] = {
12737 .mixers = { alc262_hippo1_mixer },
12738 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12739 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12740 .dac_nids = alc262_dac_nids,
12742 .dig_out_nid = ALC262_DIGOUT_NID,
12743 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12744 .channel_mode = alc262_modes,
12745 .input_mux = &alc262_capture_source,
12746 .unsol_event = alc262_hippo_unsol_event,
12747 .setup = alc262_hippo1_setup,
12748 .init_hook = alc262_hippo_automute,
12750 [ALC262_FUJITSU] = {
12751 .mixers = { alc262_fujitsu_mixer },
12752 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12753 alc262_fujitsu_unsol_verbs },
12754 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12755 .dac_nids = alc262_dac_nids,
12757 .dig_out_nid = ALC262_DIGOUT_NID,
12758 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12759 .channel_mode = alc262_modes,
12760 .input_mux = &alc262_fujitsu_capture_source,
12761 .unsol_event = alc262_fujitsu_unsol_event,
12762 .init_hook = alc262_fujitsu_init_hook,
12764 [ALC262_HP_BPC] = {
12765 .mixers = { alc262_HP_BPC_mixer },
12766 .init_verbs = { alc262_HP_BPC_init_verbs },
12767 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12768 .dac_nids = alc262_dac_nids,
12770 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12771 .channel_mode = alc262_modes,
12772 .input_mux = &alc262_HP_capture_source,
12773 .unsol_event = alc262_hp_bpc_unsol_event,
12774 .init_hook = alc262_hp_bpc_automute,
12776 [ALC262_HP_BPC_D7000_WF] = {
12777 .mixers = { alc262_HP_BPC_WildWest_mixer },
12778 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12779 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12780 .dac_nids = alc262_dac_nids,
12782 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12783 .channel_mode = alc262_modes,
12784 .input_mux = &alc262_HP_D7000_capture_source,
12785 .unsol_event = alc262_hp_wildwest_unsol_event,
12786 .init_hook = alc262_hp_wildwest_automute,
12788 [ALC262_HP_BPC_D7000_WL] = {
12789 .mixers = { alc262_HP_BPC_WildWest_mixer,
12790 alc262_HP_BPC_WildWest_option_mixer },
12791 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12792 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12793 .dac_nids = alc262_dac_nids,
12795 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12796 .channel_mode = alc262_modes,
12797 .input_mux = &alc262_HP_D7000_capture_source,
12798 .unsol_event = alc262_hp_wildwest_unsol_event,
12799 .init_hook = alc262_hp_wildwest_automute,
12801 [ALC262_HP_TC_T5735] = {
12802 .mixers = { alc262_hp_t5735_mixer },
12803 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12804 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12805 .dac_nids = alc262_dac_nids,
12807 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12808 .channel_mode = alc262_modes,
12809 .input_mux = &alc262_capture_source,
12810 .unsol_event = alc_sku_unsol_event,
12811 .setup = alc262_hp_t5735_setup,
12812 .init_hook = alc_inithook,
12814 [ALC262_HP_RP5700] = {
12815 .mixers = { alc262_hp_rp5700_mixer },
12816 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12817 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12818 .dac_nids = alc262_dac_nids,
12819 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12820 .channel_mode = alc262_modes,
12821 .input_mux = &alc262_hp_rp5700_capture_source,
12823 [ALC262_BENQ_ED8] = {
12824 .mixers = { alc262_base_mixer },
12825 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12826 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12827 .dac_nids = alc262_dac_nids,
12829 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12830 .channel_mode = alc262_modes,
12831 .input_mux = &alc262_capture_source,
12833 [ALC262_SONY_ASSAMD] = {
12834 .mixers = { alc262_sony_mixer },
12835 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12836 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12837 .dac_nids = alc262_dac_nids,
12839 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12840 .channel_mode = alc262_modes,
12841 .input_mux = &alc262_capture_source,
12842 .unsol_event = alc262_hippo_unsol_event,
12843 .setup = alc262_hippo_setup,
12844 .init_hook = alc262_hippo_automute,
12846 [ALC262_BENQ_T31] = {
12847 .mixers = { alc262_benq_t31_mixer },
12848 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12849 alc_hp15_unsol_verbs },
12850 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12851 .dac_nids = alc262_dac_nids,
12853 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12854 .channel_mode = alc262_modes,
12855 .input_mux = &alc262_capture_source,
12856 .unsol_event = alc262_hippo_unsol_event,
12857 .setup = alc262_hippo_setup,
12858 .init_hook = alc262_hippo_automute,
12861 .mixers = { alc262_ultra_mixer },
12862 .cap_mixer = alc262_ultra_capture_mixer,
12863 .init_verbs = { alc262_ultra_verbs },
12864 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12865 .dac_nids = alc262_dac_nids,
12866 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12867 .channel_mode = alc262_modes,
12868 .input_mux = &alc262_ultra_capture_source,
12869 .adc_nids = alc262_adc_nids, /* ADC0 */
12870 .capsrc_nids = alc262_capsrc_nids,
12871 .num_adc_nids = 1, /* single ADC */
12872 .unsol_event = alc262_ultra_unsol_event,
12873 .init_hook = alc262_ultra_automute,
12875 [ALC262_LENOVO_3000] = {
12876 .mixers = { alc262_lenovo_3000_mixer },
12877 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12878 alc262_lenovo_3000_unsol_verbs,
12879 alc262_lenovo_3000_init_verbs },
12880 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12881 .dac_nids = alc262_dac_nids,
12883 .dig_out_nid = ALC262_DIGOUT_NID,
12884 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12885 .channel_mode = alc262_modes,
12886 .input_mux = &alc262_fujitsu_capture_source,
12887 .unsol_event = alc262_lenovo_3000_unsol_event,
12890 .mixers = { alc262_nec_mixer },
12891 .init_verbs = { alc262_nec_verbs },
12892 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12893 .dac_nids = alc262_dac_nids,
12895 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12896 .channel_mode = alc262_modes,
12897 .input_mux = &alc262_capture_source,
12899 [ALC262_TOSHIBA_S06] = {
12900 .mixers = { alc262_toshiba_s06_mixer },
12901 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12902 alc262_eapd_verbs },
12903 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12904 .capsrc_nids = alc262_dmic_capsrc_nids,
12905 .dac_nids = alc262_dac_nids,
12906 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12907 .num_adc_nids = 1, /* single ADC */
12908 .dig_out_nid = ALC262_DIGOUT_NID,
12909 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12910 .channel_mode = alc262_modes,
12911 .unsol_event = alc_sku_unsol_event,
12912 .setup = alc262_toshiba_s06_setup,
12913 .init_hook = alc_inithook,
12915 [ALC262_TOSHIBA_RX1] = {
12916 .mixers = { alc262_toshiba_rx1_mixer },
12917 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12918 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12919 .dac_nids = alc262_dac_nids,
12921 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12922 .channel_mode = alc262_modes,
12923 .input_mux = &alc262_capture_source,
12924 .unsol_event = alc262_hippo_unsol_event,
12925 .setup = alc262_hippo_setup,
12926 .init_hook = alc262_hippo_automute,
12929 .mixers = { alc262_tyan_mixer },
12930 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12931 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12932 .dac_nids = alc262_dac_nids,
12934 .dig_out_nid = ALC262_DIGOUT_NID,
12935 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12936 .channel_mode = alc262_modes,
12937 .input_mux = &alc262_capture_source,
12938 .unsol_event = alc_automute_amp_unsol_event,
12939 .setup = alc262_tyan_setup,
12940 .init_hook = alc_automute_amp,
12944 static int patch_alc262(struct hda_codec *codec)
12946 struct alc_spec *spec;
12950 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12954 codec->spec = spec;
12956 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12961 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12962 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12963 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12964 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12967 alc_auto_parse_customize_define(codec);
12969 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12971 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12975 if (board_config < 0) {
12976 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12978 board_config = ALC262_AUTO;
12981 if (board_config == ALC262_AUTO) {
12982 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
12983 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
12986 if (board_config == ALC262_AUTO) {
12987 /* automatic parse from the BIOS config */
12988 err = alc262_parse_auto_config(codec);
12994 "hda_codec: Cannot set up configuration "
12995 "from BIOS. Using base mode...\n");
12996 board_config = ALC262_BASIC;
13000 if (!spec->no_analog && has_cdefine_beep(codec)) {
13001 err = snd_hda_attach_beep_device(codec, 0x1);
13008 if (board_config != ALC262_AUTO)
13009 setup_preset(codec, &alc262_presets[board_config]);
13011 spec->stream_analog_playback = &alc262_pcm_analog_playback;
13012 spec->stream_analog_capture = &alc262_pcm_analog_capture;
13014 spec->stream_digital_playback = &alc262_pcm_digital_playback;
13015 spec->stream_digital_capture = &alc262_pcm_digital_capture;
13017 if (!spec->adc_nids && spec->input_mux) {
13019 /* check whether the digital-mic has to be supported */
13020 for (i = 0; i < spec->input_mux->num_items; i++) {
13021 if (spec->input_mux->items[i].index >= 9)
13024 if (i < spec->input_mux->num_items) {
13025 /* use only ADC0 */
13026 spec->adc_nids = alc262_dmic_adc_nids;
13027 spec->num_adc_nids = 1;
13028 spec->capsrc_nids = alc262_dmic_capsrc_nids;
13030 /* all analog inputs */
13031 /* check whether NID 0x07 is valid */
13032 unsigned int wcap = get_wcaps(codec, 0x07);
13035 wcap = get_wcaps_type(wcap);
13036 if (wcap != AC_WID_AUD_IN) {
13037 spec->adc_nids = alc262_adc_nids_alt;
13038 spec->num_adc_nids =
13039 ARRAY_SIZE(alc262_adc_nids_alt);
13040 spec->capsrc_nids = alc262_capsrc_nids_alt;
13042 spec->adc_nids = alc262_adc_nids;
13043 spec->num_adc_nids =
13044 ARRAY_SIZE(alc262_adc_nids);
13045 spec->capsrc_nids = alc262_capsrc_nids;
13049 if (!spec->cap_mixer && !spec->no_analog)
13050 set_capture_mixer(codec);
13051 if (!spec->no_analog && has_cdefine_beep(codec))
13052 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13054 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
13056 spec->vmaster_nid = 0x0c;
13058 codec->patch_ops = alc_patch_ops;
13059 if (board_config == ALC262_AUTO)
13060 spec->init_hook = alc262_auto_init;
13062 alc_init_jacks(codec);
13063 #ifdef CONFIG_SND_HDA_POWER_SAVE
13064 if (!spec->loopback.amplist)
13065 spec->loopback.amplist = alc262_loopbacks;
13072 * ALC268 channel source setting (2 channel)
13074 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13075 #define alc268_modes alc260_modes
13077 static hda_nid_t alc268_dac_nids[2] = {
13082 static hda_nid_t alc268_adc_nids[2] = {
13087 static hda_nid_t alc268_adc_nids_alt[1] = {
13092 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13094 static struct snd_kcontrol_new alc268_base_mixer[] = {
13095 /* output mixer control */
13096 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13097 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13099 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13100 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13101 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13102 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13106 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13107 /* output mixer control */
13108 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13109 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13110 ALC262_HIPPO_MASTER_SWITCH,
13111 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13112 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13113 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13117 /* bind Beep switches of both NID 0x0f and 0x10 */
13118 static struct hda_bind_ctls alc268_bind_beep_sw = {
13119 .ops = &snd_hda_bind_sw,
13121 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13122 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13127 static struct snd_kcontrol_new alc268_beep_mixer[] = {
13128 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13129 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13133 static struct hda_verb alc268_eapd_verbs[] = {
13134 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13135 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13139 /* Toshiba specific */
13140 static struct hda_verb alc268_toshiba_verbs[] = {
13141 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13145 /* Acer specific */
13146 /* bind volumes of both NID 0x02 and 0x03 */
13147 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13148 .ops = &snd_hda_bind_vol,
13150 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13151 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13156 /* mute/unmute internal speaker according to the hp jack and mute state */
13157 static void alc268_acer_automute(struct hda_codec *codec, int force)
13159 struct alc_spec *spec = codec->spec;
13162 if (force || !spec->sense_updated) {
13163 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13164 spec->sense_updated = 1;
13166 if (spec->jack_present)
13167 mute = HDA_AMP_MUTE; /* mute internal speaker */
13168 else /* unmute internal speaker if necessary */
13169 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13170 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13171 HDA_AMP_MUTE, mute);
13175 /* bind hp and internal speaker mute (with plug check) */
13176 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13177 struct snd_ctl_elem_value *ucontrol)
13179 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13180 long *valp = ucontrol->value.integer.value;
13183 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13185 alc268_acer_automute(codec, 0);
13189 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13190 /* output mixer control */
13191 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13193 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13194 .name = "Master Playback Switch",
13195 .subdevice = HDA_SUBDEV_AMP_FLAG,
13196 .info = snd_hda_mixer_amp_switch_info,
13197 .get = snd_hda_mixer_amp_switch_get,
13198 .put = alc268_acer_master_sw_put,
13199 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13201 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13205 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13206 /* output mixer control */
13207 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13209 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13210 .name = "Master Playback Switch",
13211 .subdevice = HDA_SUBDEV_AMP_FLAG,
13212 .info = snd_hda_mixer_amp_switch_info,
13213 .get = snd_hda_mixer_amp_switch_get,
13214 .put = alc268_acer_master_sw_put,
13215 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13217 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13218 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13219 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13223 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13224 /* output mixer control */
13225 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13227 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13228 .name = "Master Playback Switch",
13229 .subdevice = HDA_SUBDEV_AMP_FLAG,
13230 .info = snd_hda_mixer_amp_switch_info,
13231 .get = snd_hda_mixer_amp_switch_get,
13232 .put = alc268_acer_master_sw_put,
13233 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13235 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13236 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13240 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13241 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13242 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13243 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13244 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13245 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13246 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13250 static struct hda_verb alc268_acer_verbs[] = {
13251 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13252 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13253 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13254 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13255 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13256 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13257 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13261 /* unsolicited event for HP jack sensing */
13262 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13263 #define alc268_toshiba_setup alc262_hippo_setup
13264 #define alc268_toshiba_automute alc262_hippo_automute
13266 static void alc268_acer_unsol_event(struct hda_codec *codec,
13269 if ((res >> 26) != ALC880_HP_EVENT)
13271 alc268_acer_automute(codec, 1);
13274 static void alc268_acer_init_hook(struct hda_codec *codec)
13276 alc268_acer_automute(codec, 1);
13279 /* toggle speaker-output according to the hp-jack state */
13280 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13282 unsigned int present;
13283 unsigned char bits;
13285 present = snd_hda_jack_detect(codec, 0x15);
13286 bits = present ? HDA_AMP_MUTE : 0;
13287 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13288 HDA_AMP_MUTE, bits);
13289 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13290 HDA_AMP_MUTE, bits);
13293 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13296 switch (res >> 26) {
13297 case ALC880_HP_EVENT:
13298 alc268_aspire_one_speaker_automute(codec);
13300 case ALC880_MIC_EVENT:
13301 alc_mic_automute(codec);
13306 static void alc268_acer_lc_setup(struct hda_codec *codec)
13308 struct alc_spec *spec = codec->spec;
13309 spec->ext_mic.pin = 0x18;
13310 spec->ext_mic.mux_idx = 0;
13311 spec->int_mic.pin = 0x12;
13312 spec->int_mic.mux_idx = 6;
13313 spec->auto_mic = 1;
13316 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13318 alc268_aspire_one_speaker_automute(codec);
13319 alc_mic_automute(codec);
13322 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13323 /* output mixer control */
13324 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13325 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13326 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13327 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13328 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13329 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13333 static struct hda_verb alc268_dell_verbs[] = {
13334 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13335 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13336 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13337 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13341 /* mute/unmute internal speaker according to the hp jack and mute state */
13342 static void alc268_dell_setup(struct hda_codec *codec)
13344 struct alc_spec *spec = codec->spec;
13346 spec->autocfg.hp_pins[0] = 0x15;
13347 spec->autocfg.speaker_pins[0] = 0x14;
13348 spec->ext_mic.pin = 0x18;
13349 spec->ext_mic.mux_idx = 0;
13350 spec->int_mic.pin = 0x19;
13351 spec->int_mic.mux_idx = 1;
13352 spec->auto_mic = 1;
13355 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13356 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13357 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13358 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13359 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13360 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13361 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13362 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13363 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13367 static struct hda_verb alc267_quanta_il1_verbs[] = {
13368 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13369 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13373 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13375 struct alc_spec *spec = codec->spec;
13376 spec->autocfg.hp_pins[0] = 0x15;
13377 spec->autocfg.speaker_pins[0] = 0x14;
13378 spec->ext_mic.pin = 0x18;
13379 spec->ext_mic.mux_idx = 0;
13380 spec->int_mic.pin = 0x19;
13381 spec->int_mic.mux_idx = 1;
13382 spec->auto_mic = 1;
13386 * generic initialization of ADC, input mixers and output mixers
13388 static struct hda_verb alc268_base_init_verbs[] = {
13389 /* Unmute DAC0-1 and set vol = 0 */
13390 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13391 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13394 * Set up output mixers (0x0c - 0x0e)
13396 /* set vol=0 to output mixers */
13397 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13398 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13400 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13401 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13403 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13404 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13405 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13406 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13407 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13408 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13409 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13410 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13412 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13413 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13414 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13415 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13416 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13418 /* set PCBEEP vol = 0, mute connections */
13419 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13420 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13421 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13423 /* Unmute Selector 23h,24h and set the default input to mic-in */
13425 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13426 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13427 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13428 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13434 * generic initialization of ADC, input mixers and output mixers
13436 static struct hda_verb alc268_volume_init_verbs[] = {
13437 /* set output DAC */
13438 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13439 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13441 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13442 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13443 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13444 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13445 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13447 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13448 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13449 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13451 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13452 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13454 /* set PCBEEP vol = 0, mute connections */
13455 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13456 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13457 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13462 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13463 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13464 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13468 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13469 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13470 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13475 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13476 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13477 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13478 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13479 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13484 static struct hda_input_mux alc268_capture_source = {
13488 { "Front Mic", 0x1 },
13494 static struct hda_input_mux alc268_acer_capture_source = {
13498 { "Internal Mic", 0x1 },
13503 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13507 { "Internal Mic", 0x6 },
13512 #ifdef CONFIG_SND_DEBUG
13513 static struct snd_kcontrol_new alc268_test_mixer[] = {
13514 /* Volume widgets */
13515 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13516 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13517 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13518 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13519 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13520 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13521 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13522 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13523 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13524 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13525 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13526 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13527 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13528 /* The below appears problematic on some hardwares */
13529 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13530 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13531 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13532 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13533 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13535 /* Modes for retasking pin widgets */
13536 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13537 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13538 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13539 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13541 /* Controls for GPIO pins, assuming they are configured as outputs */
13542 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13543 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13544 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13545 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13547 /* Switches to allow the digital SPDIF output pin to be enabled.
13548 * The ALC268 does not have an SPDIF input.
13550 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13552 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13553 * this output to turn on an external amplifier.
13555 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13556 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13562 /* create input playback/capture controls for the given pin */
13563 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13564 const char *ctlname, int idx)
13575 case 0x1a: /* ALC259/269 only */
13576 case 0x1b: /* ALC259/269 only */
13577 case 0x21: /* ALC269vb has this pin, too */
13581 snd_printd(KERN_WARNING "hda_codec: "
13582 "ignoring pin 0x%x as unknown\n", nid);
13585 if (spec->multiout.dac_nids[0] != dac &&
13586 spec->multiout.dac_nids[1] != dac) {
13587 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13588 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13592 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13596 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13597 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13599 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13600 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13606 /* add playback controls from the parsed DAC table */
13607 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13608 const struct auto_pin_cfg *cfg)
13613 spec->multiout.dac_nids = spec->private_dac_nids;
13615 nid = cfg->line_out_pins[0];
13618 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13622 err = alc268_new_analog_output(spec, nid, name, 0);
13627 nid = cfg->speaker_pins[0];
13629 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13630 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13634 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13638 nid = cfg->hp_pins[0];
13640 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13645 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13647 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13648 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13655 /* create playback/capture controls for input pins */
13656 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13657 const struct auto_pin_cfg *cfg)
13659 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13662 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13663 hda_nid_t nid, int pin_type)
13667 alc_set_pin_output(codec, nid, pin_type);
13668 if (nid == 0x14 || nid == 0x16)
13672 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13675 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13677 struct alc_spec *spec = codec->spec;
13680 for (i = 0; i < spec->autocfg.line_outs; i++) {
13681 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13682 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13683 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13687 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13689 struct alc_spec *spec = codec->spec;
13693 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13694 pin = spec->autocfg.hp_pins[i];
13695 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13697 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13698 pin = spec->autocfg.speaker_pins[i];
13699 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13701 if (spec->autocfg.mono_out_pin)
13702 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13703 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13706 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13708 struct alc_spec *spec = codec->spec;
13709 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13710 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13711 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13712 unsigned int dac_vol1, dac_vol2;
13714 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13715 snd_hda_codec_write(codec, speaker_nid, 0,
13716 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13717 /* mute mixer inputs from 0x1d */
13718 snd_hda_codec_write(codec, 0x0f, 0,
13719 AC_VERB_SET_AMP_GAIN_MUTE,
13721 snd_hda_codec_write(codec, 0x10, 0,
13722 AC_VERB_SET_AMP_GAIN_MUTE,
13725 /* unmute mixer inputs from 0x1d */
13726 snd_hda_codec_write(codec, 0x0f, 0,
13727 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13728 snd_hda_codec_write(codec, 0x10, 0,
13729 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13732 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13733 if (line_nid == 0x14)
13734 dac_vol2 = AMP_OUT_ZERO;
13735 else if (line_nid == 0x15)
13736 dac_vol1 = AMP_OUT_ZERO;
13737 if (hp_nid == 0x14)
13738 dac_vol2 = AMP_OUT_ZERO;
13739 else if (hp_nid == 0x15)
13740 dac_vol1 = AMP_OUT_ZERO;
13741 if (line_nid != 0x16 || hp_nid != 0x16 ||
13742 spec->autocfg.line_out_pins[1] != 0x16 ||
13743 spec->autocfg.line_out_pins[2] != 0x16)
13744 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13746 snd_hda_codec_write(codec, 0x02, 0,
13747 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13748 snd_hda_codec_write(codec, 0x03, 0,
13749 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13752 /* pcm configuration: identical with ALC880 */
13753 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13754 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13755 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13756 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13759 * BIOS auto configuration
13761 static int alc268_parse_auto_config(struct hda_codec *codec)
13763 struct alc_spec *spec = codec->spec;
13765 static hda_nid_t alc268_ignore[] = { 0 };
13767 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13771 if (!spec->autocfg.line_outs) {
13772 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13773 spec->multiout.max_channels = 2;
13774 spec->no_analog = 1;
13777 return 0; /* can't find valid BIOS pin config */
13779 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13782 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13786 spec->multiout.max_channels = 2;
13789 /* digital only support output */
13790 alc_auto_parse_digital(codec);
13791 if (spec->kctls.list)
13792 add_mixer(spec, spec->kctls.list);
13794 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13795 add_mixer(spec, alc268_beep_mixer);
13797 add_verb(spec, alc268_volume_init_verbs);
13798 spec->num_mux_defs = 2;
13799 spec->input_mux = &spec->private_imux[0];
13801 err = alc_auto_add_mic_boost(codec);
13805 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13810 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13812 /* init callback for auto-configuration model -- overriding the default init */
13813 static void alc268_auto_init(struct hda_codec *codec)
13815 struct alc_spec *spec = codec->spec;
13816 alc268_auto_init_multi_out(codec);
13817 alc268_auto_init_hp_out(codec);
13818 alc268_auto_init_mono_speaker_out(codec);
13819 alc268_auto_init_analog_input(codec);
13820 alc_auto_init_digital(codec);
13821 if (spec->unsol_event)
13822 alc_inithook(codec);
13826 * configuration and preset
13828 static const char * const alc268_models[ALC268_MODEL_LAST] = {
13829 [ALC267_QUANTA_IL1] = "quanta-il1",
13830 [ALC268_3ST] = "3stack",
13831 [ALC268_TOSHIBA] = "toshiba",
13832 [ALC268_ACER] = "acer",
13833 [ALC268_ACER_DMIC] = "acer-dmic",
13834 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13835 [ALC268_DELL] = "dell",
13836 [ALC268_ZEPTO] = "zepto",
13837 #ifdef CONFIG_SND_DEBUG
13838 [ALC268_TEST] = "test",
13840 [ALC268_AUTO] = "auto",
13843 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13844 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13845 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13846 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13847 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13848 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13849 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13850 ALC268_ACER_ASPIRE_ONE),
13851 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13852 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13853 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13854 /* almost compatible with toshiba but with optional digital outs;
13855 * auto-probing seems working fine
13857 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13859 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13860 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13861 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13862 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13863 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13867 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13868 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13869 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13870 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13871 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13876 static struct alc_config_preset alc268_presets[] = {
13877 [ALC267_QUANTA_IL1] = {
13878 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13879 alc268_capture_nosrc_mixer },
13880 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13881 alc267_quanta_il1_verbs },
13882 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13883 .dac_nids = alc268_dac_nids,
13884 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13885 .adc_nids = alc268_adc_nids_alt,
13887 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13888 .channel_mode = alc268_modes,
13889 .unsol_event = alc_sku_unsol_event,
13890 .setup = alc267_quanta_il1_setup,
13891 .init_hook = alc_inithook,
13894 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13895 alc268_beep_mixer },
13896 .init_verbs = { alc268_base_init_verbs },
13897 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13898 .dac_nids = alc268_dac_nids,
13899 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13900 .adc_nids = alc268_adc_nids_alt,
13901 .capsrc_nids = alc268_capsrc_nids,
13903 .dig_out_nid = ALC268_DIGOUT_NID,
13904 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13905 .channel_mode = alc268_modes,
13906 .input_mux = &alc268_capture_source,
13908 [ALC268_TOSHIBA] = {
13909 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13910 alc268_beep_mixer },
13911 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13912 alc268_toshiba_verbs },
13913 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13914 .dac_nids = alc268_dac_nids,
13915 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13916 .adc_nids = alc268_adc_nids_alt,
13917 .capsrc_nids = alc268_capsrc_nids,
13919 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13920 .channel_mode = alc268_modes,
13921 .input_mux = &alc268_capture_source,
13922 .unsol_event = alc268_toshiba_unsol_event,
13923 .setup = alc268_toshiba_setup,
13924 .init_hook = alc268_toshiba_automute,
13927 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13928 alc268_beep_mixer },
13929 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13930 alc268_acer_verbs },
13931 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13932 .dac_nids = alc268_dac_nids,
13933 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13934 .adc_nids = alc268_adc_nids_alt,
13935 .capsrc_nids = alc268_capsrc_nids,
13937 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13938 .channel_mode = alc268_modes,
13939 .input_mux = &alc268_acer_capture_source,
13940 .unsol_event = alc268_acer_unsol_event,
13941 .init_hook = alc268_acer_init_hook,
13943 [ALC268_ACER_DMIC] = {
13944 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13945 alc268_beep_mixer },
13946 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13947 alc268_acer_verbs },
13948 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13949 .dac_nids = alc268_dac_nids,
13950 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13951 .adc_nids = alc268_adc_nids_alt,
13952 .capsrc_nids = alc268_capsrc_nids,
13954 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13955 .channel_mode = alc268_modes,
13956 .input_mux = &alc268_acer_dmic_capture_source,
13957 .unsol_event = alc268_acer_unsol_event,
13958 .init_hook = alc268_acer_init_hook,
13960 [ALC268_ACER_ASPIRE_ONE] = {
13961 .mixers = { alc268_acer_aspire_one_mixer,
13963 alc268_capture_nosrc_mixer },
13964 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13965 alc268_acer_aspire_one_verbs },
13966 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13967 .dac_nids = alc268_dac_nids,
13968 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13969 .adc_nids = alc268_adc_nids_alt,
13970 .capsrc_nids = alc268_capsrc_nids,
13972 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13973 .channel_mode = alc268_modes,
13974 .unsol_event = alc268_acer_lc_unsol_event,
13975 .setup = alc268_acer_lc_setup,
13976 .init_hook = alc268_acer_lc_init_hook,
13979 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13980 alc268_capture_nosrc_mixer },
13981 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13982 alc268_dell_verbs },
13983 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13984 .dac_nids = alc268_dac_nids,
13985 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13986 .adc_nids = alc268_adc_nids_alt,
13987 .capsrc_nids = alc268_capsrc_nids,
13989 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13990 .channel_mode = alc268_modes,
13991 .unsol_event = alc_sku_unsol_event,
13992 .setup = alc268_dell_setup,
13993 .init_hook = alc_inithook,
13996 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13997 alc268_beep_mixer },
13998 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13999 alc268_toshiba_verbs },
14000 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14001 .dac_nids = alc268_dac_nids,
14002 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14003 .adc_nids = alc268_adc_nids_alt,
14004 .capsrc_nids = alc268_capsrc_nids,
14006 .dig_out_nid = ALC268_DIGOUT_NID,
14007 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14008 .channel_mode = alc268_modes,
14009 .input_mux = &alc268_capture_source,
14010 .setup = alc268_toshiba_setup,
14011 .init_hook = alc268_toshiba_automute,
14013 #ifdef CONFIG_SND_DEBUG
14015 .mixers = { alc268_test_mixer, alc268_capture_mixer },
14016 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
14017 alc268_volume_init_verbs },
14018 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14019 .dac_nids = alc268_dac_nids,
14020 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14021 .adc_nids = alc268_adc_nids_alt,
14022 .capsrc_nids = alc268_capsrc_nids,
14024 .dig_out_nid = ALC268_DIGOUT_NID,
14025 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14026 .channel_mode = alc268_modes,
14027 .input_mux = &alc268_capture_source,
14032 static int patch_alc268(struct hda_codec *codec)
14034 struct alc_spec *spec;
14036 int i, has_beep, err;
14038 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14042 codec->spec = spec;
14044 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
14048 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
14049 board_config = snd_hda_check_board_codec_sid_config(codec,
14050 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
14052 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
14053 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14055 board_config = ALC268_AUTO;
14058 if (board_config == ALC268_AUTO) {
14059 /* automatic parse from the BIOS config */
14060 err = alc268_parse_auto_config(codec);
14066 "hda_codec: Cannot set up configuration "
14067 "from BIOS. Using base mode...\n");
14068 board_config = ALC268_3ST;
14072 if (board_config != ALC268_AUTO)
14073 setup_preset(codec, &alc268_presets[board_config]);
14075 spec->stream_analog_playback = &alc268_pcm_analog_playback;
14076 spec->stream_analog_capture = &alc268_pcm_analog_capture;
14077 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
14079 spec->stream_digital_playback = &alc268_pcm_digital_playback;
14082 for (i = 0; i < spec->num_mixers; i++) {
14083 if (spec->mixers[i] == alc268_beep_mixer) {
14090 err = snd_hda_attach_beep_device(codec, 0x1);
14095 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14096 /* override the amp caps for beep generator */
14097 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14098 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14099 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14100 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14101 (0 << AC_AMPCAP_MUTE_SHIFT));
14104 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14105 /* check whether NID 0x07 is valid */
14106 unsigned int wcap = get_wcaps(codec, 0x07);
14109 spec->capsrc_nids = alc268_capsrc_nids;
14111 wcap = get_wcaps_type(wcap);
14112 if (spec->auto_mic ||
14113 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14114 spec->adc_nids = alc268_adc_nids_alt;
14115 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14116 if (spec->auto_mic)
14117 fixup_automic_adc(codec);
14118 if (spec->auto_mic || spec->input_mux->num_items == 1)
14119 add_mixer(spec, alc268_capture_nosrc_mixer);
14121 add_mixer(spec, alc268_capture_alt_mixer);
14123 spec->adc_nids = alc268_adc_nids;
14124 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14125 add_mixer(spec, alc268_capture_mixer);
14127 /* set default input source */
14128 for (i = 0; i < spec->num_adc_nids; i++)
14129 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
14130 0, AC_VERB_SET_CONNECT_SEL,
14131 i < spec->num_mux_defs ?
14132 spec->input_mux[i].items[0].index :
14133 spec->input_mux->items[0].index);
14136 spec->vmaster_nid = 0x02;
14138 codec->patch_ops = alc_patch_ops;
14139 if (board_config == ALC268_AUTO)
14140 spec->init_hook = alc268_auto_init;
14142 alc_init_jacks(codec);
14148 * ALC269 channel source setting (2 channel)
14150 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14152 #define alc269_dac_nids alc260_dac_nids
14154 static hda_nid_t alc269_adc_nids[1] = {
14159 static hda_nid_t alc269_capsrc_nids[1] = {
14163 static hda_nid_t alc269vb_adc_nids[1] = {
14168 static hda_nid_t alc269vb_capsrc_nids[1] = {
14172 static hda_nid_t alc269_adc_candidates[] = {
14176 #define alc269_modes alc260_modes
14177 #define alc269_capture_source alc880_lg_lw_capture_source
14179 static struct snd_kcontrol_new alc269_base_mixer[] = {
14180 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14181 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14182 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14183 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14184 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14185 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14186 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14187 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14188 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14189 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14190 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14191 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14195 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14196 /* output mixer control */
14197 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14199 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14200 .name = "Master Playback Switch",
14201 .subdevice = HDA_SUBDEV_AMP_FLAG,
14202 .info = snd_hda_mixer_amp_switch_info,
14203 .get = snd_hda_mixer_amp_switch_get,
14204 .put = alc268_acer_master_sw_put,
14205 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14207 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14208 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14209 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14210 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14211 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14212 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14216 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14217 /* output mixer control */
14218 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14220 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14221 .name = "Master Playback Switch",
14222 .subdevice = HDA_SUBDEV_AMP_FLAG,
14223 .info = snd_hda_mixer_amp_switch_info,
14224 .get = snd_hda_mixer_amp_switch_get,
14225 .put = alc268_acer_master_sw_put,
14226 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14229 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14230 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14231 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14232 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14233 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14234 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14235 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14236 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14240 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14241 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14242 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14243 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14244 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14248 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14249 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14250 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14251 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14252 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14256 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14257 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14258 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14262 /* capture mixer elements */
14263 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14264 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14265 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14266 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14267 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14271 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14272 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14273 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14274 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14278 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14279 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14280 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14281 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14282 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14286 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14287 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14288 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14289 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14294 #define alc269_fujitsu_mixer alc269_laptop_mixer
14296 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14297 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14298 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14299 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14300 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14301 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14302 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14306 static struct hda_verb alc269_lifebook_verbs[] = {
14307 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14308 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14309 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14310 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14311 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14312 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14313 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14314 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14315 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14316 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14320 /* toggle speaker-output according to the hp-jack state */
14321 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14323 unsigned int present;
14324 unsigned char bits;
14326 present = snd_hda_jack_detect(codec, 0x15);
14327 bits = present ? HDA_AMP_MUTE : 0;
14328 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14329 HDA_AMP_MUTE, bits);
14330 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14331 HDA_AMP_MUTE, bits);
14333 snd_hda_codec_write(codec, 0x20, 0,
14334 AC_VERB_SET_COEF_INDEX, 0x0c);
14335 snd_hda_codec_write(codec, 0x20, 0,
14336 AC_VERB_SET_PROC_COEF, 0x680);
14338 snd_hda_codec_write(codec, 0x20, 0,
14339 AC_VERB_SET_COEF_INDEX, 0x0c);
14340 snd_hda_codec_write(codec, 0x20, 0,
14341 AC_VERB_SET_PROC_COEF, 0x480);
14344 /* toggle speaker-output according to the hp-jacks state */
14345 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14347 unsigned int present;
14348 unsigned char bits;
14350 /* Check laptop headphone socket */
14351 present = snd_hda_jack_detect(codec, 0x15);
14353 /* Check port replicator headphone socket */
14354 present |= snd_hda_jack_detect(codec, 0x1a);
14356 bits = present ? HDA_AMP_MUTE : 0;
14357 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14358 HDA_AMP_MUTE, bits);
14359 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14360 HDA_AMP_MUTE, bits);
14362 snd_hda_codec_write(codec, 0x20, 0,
14363 AC_VERB_SET_COEF_INDEX, 0x0c);
14364 snd_hda_codec_write(codec, 0x20, 0,
14365 AC_VERB_SET_PROC_COEF, 0x680);
14367 snd_hda_codec_write(codec, 0x20, 0,
14368 AC_VERB_SET_COEF_INDEX, 0x0c);
14369 snd_hda_codec_write(codec, 0x20, 0,
14370 AC_VERB_SET_PROC_COEF, 0x480);
14373 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14375 unsigned int present_laptop;
14376 unsigned int present_dock;
14378 present_laptop = snd_hda_jack_detect(codec, 0x18);
14379 present_dock = snd_hda_jack_detect(codec, 0x1b);
14381 /* Laptop mic port overrides dock mic port, design decision */
14383 snd_hda_codec_write(codec, 0x23, 0,
14384 AC_VERB_SET_CONNECT_SEL, 0x3);
14385 if (present_laptop)
14386 snd_hda_codec_write(codec, 0x23, 0,
14387 AC_VERB_SET_CONNECT_SEL, 0x0);
14388 if (!present_dock && !present_laptop)
14389 snd_hda_codec_write(codec, 0x23, 0,
14390 AC_VERB_SET_CONNECT_SEL, 0x1);
14393 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14396 switch (res >> 26) {
14397 case ALC880_HP_EVENT:
14398 alc269_quanta_fl1_speaker_automute(codec);
14400 case ALC880_MIC_EVENT:
14401 alc_mic_automute(codec);
14406 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14409 if ((res >> 26) == ALC880_HP_EVENT)
14410 alc269_lifebook_speaker_automute(codec);
14411 if ((res >> 26) == ALC880_MIC_EVENT)
14412 alc269_lifebook_mic_autoswitch(codec);
14415 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14417 struct alc_spec *spec = codec->spec;
14418 spec->autocfg.hp_pins[0] = 0x15;
14419 spec->autocfg.speaker_pins[0] = 0x14;
14420 spec->ext_mic.pin = 0x18;
14421 spec->ext_mic.mux_idx = 0;
14422 spec->int_mic.pin = 0x19;
14423 spec->int_mic.mux_idx = 1;
14424 spec->auto_mic = 1;
14427 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14429 alc269_quanta_fl1_speaker_automute(codec);
14430 alc_mic_automute(codec);
14433 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14435 alc269_lifebook_speaker_automute(codec);
14436 alc269_lifebook_mic_autoswitch(codec);
14439 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14440 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14441 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14442 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14444 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14445 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14446 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14450 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14451 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14452 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14453 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14454 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14455 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14456 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14460 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14461 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14462 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14463 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14464 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14465 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14466 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14467 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14471 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14472 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14473 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14474 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14475 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14476 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14477 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14478 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14482 static struct hda_verb alc271_acer_dmic_verbs[] = {
14483 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14484 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14485 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14486 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14487 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14488 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14489 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14490 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14491 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14492 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14496 /* toggle speaker-output according to the hp-jack state */
14497 static void alc269_speaker_automute(struct hda_codec *codec)
14499 struct alc_spec *spec = codec->spec;
14500 unsigned int nid = spec->autocfg.hp_pins[0];
14501 unsigned int present;
14502 unsigned char bits;
14504 present = snd_hda_jack_detect(codec, nid);
14505 bits = present ? HDA_AMP_MUTE : 0;
14506 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14507 HDA_AMP_MUTE, bits);
14508 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14509 HDA_AMP_MUTE, bits);
14510 alc_report_jack(codec, nid);
14513 /* unsolicited event for HP jack sensing */
14514 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14517 switch (res >> 26) {
14518 case ALC880_HP_EVENT:
14519 alc269_speaker_automute(codec);
14521 case ALC880_MIC_EVENT:
14522 alc_mic_automute(codec);
14527 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14529 struct alc_spec *spec = codec->spec;
14530 spec->autocfg.hp_pins[0] = 0x15;
14531 spec->autocfg.speaker_pins[0] = 0x14;
14532 spec->ext_mic.pin = 0x18;
14533 spec->ext_mic.mux_idx = 0;
14534 spec->int_mic.pin = 0x19;
14535 spec->int_mic.mux_idx = 1;
14536 spec->auto_mic = 1;
14539 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14541 struct alc_spec *spec = codec->spec;
14542 spec->autocfg.hp_pins[0] = 0x15;
14543 spec->autocfg.speaker_pins[0] = 0x14;
14544 spec->ext_mic.pin = 0x18;
14545 spec->ext_mic.mux_idx = 0;
14546 spec->int_mic.pin = 0x12;
14547 spec->int_mic.mux_idx = 5;
14548 spec->auto_mic = 1;
14551 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14553 struct alc_spec *spec = codec->spec;
14554 spec->autocfg.hp_pins[0] = 0x21;
14555 spec->autocfg.speaker_pins[0] = 0x14;
14556 spec->ext_mic.pin = 0x18;
14557 spec->ext_mic.mux_idx = 0;
14558 spec->int_mic.pin = 0x19;
14559 spec->int_mic.mux_idx = 1;
14560 spec->auto_mic = 1;
14563 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14565 struct alc_spec *spec = codec->spec;
14566 spec->autocfg.hp_pins[0] = 0x21;
14567 spec->autocfg.speaker_pins[0] = 0x14;
14568 spec->ext_mic.pin = 0x18;
14569 spec->ext_mic.mux_idx = 0;
14570 spec->int_mic.pin = 0x12;
14571 spec->int_mic.mux_idx = 6;
14572 spec->auto_mic = 1;
14575 static void alc269_laptop_inithook(struct hda_codec *codec)
14577 alc269_speaker_automute(codec);
14578 alc_mic_automute(codec);
14582 * generic initialization of ADC, input mixers and output mixers
14584 static struct hda_verb alc269_init_verbs[] = {
14586 * Unmute ADC0 and set the default input to mic-in
14588 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14591 * Set up output mixers (0x02 - 0x03)
14593 /* set vol=0 to output mixers */
14594 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14595 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14597 /* set up input amps for analog loopback */
14598 /* Amp Indices: DAC = 0, mixer = 1 */
14599 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14600 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14601 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14602 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14603 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14604 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14607 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14608 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14609 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14610 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14611 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14612 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14614 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14615 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14617 /* FIXME: use Mux-type input source selection */
14618 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14619 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14620 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14623 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14627 static struct hda_verb alc269vb_init_verbs[] = {
14629 * Unmute ADC0 and set the default input to mic-in
14631 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14634 * Set up output mixers (0x02 - 0x03)
14636 /* set vol=0 to output mixers */
14637 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14638 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14640 /* set up input amps for analog loopback */
14641 /* Amp Indices: DAC = 0, mixer = 1 */
14642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14644 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14645 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14646 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14649 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14650 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14651 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14652 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14653 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14654 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14655 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14657 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14658 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14660 /* FIXME: use Mux-type input source selection */
14661 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14662 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14663 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14666 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14670 #define alc269_auto_create_multi_out_ctls \
14671 alc268_auto_create_multi_out_ctls
14672 #define alc269_auto_create_input_ctls \
14673 alc268_auto_create_input_ctls
14675 #ifdef CONFIG_SND_HDA_POWER_SAVE
14676 #define alc269_loopbacks alc880_loopbacks
14679 /* pcm configuration: identical with ALC880 */
14680 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14681 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14682 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14683 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14685 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14689 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14690 /* NID is set in alc_build_pcms */
14692 .open = alc880_playback_pcm_open,
14693 .prepare = alc880_playback_pcm_prepare,
14694 .cleanup = alc880_playback_pcm_cleanup
14698 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14702 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14703 /* NID is set in alc_build_pcms */
14706 #ifdef CONFIG_SND_HDA_POWER_SAVE
14707 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14709 switch (codec->subsystem_id) {
14716 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14718 /* update mute-LED according to the speaker mute state */
14719 if (nid == 0x01 || nid == 0x14) {
14721 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14726 /* mic2 vref pin is used for mute LED control */
14727 snd_hda_codec_update_cache(codec, 0x19, 0,
14728 AC_VERB_SET_PIN_WIDGET_CONTROL,
14731 return alc_check_power_status(codec, nid);
14733 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14735 static int alc275_setup_dual_adc(struct hda_codec *codec)
14737 struct alc_spec *spec = codec->spec;
14739 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14741 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14742 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14743 if (spec->ext_mic.pin <= 0x12) {
14744 spec->private_adc_nids[0] = 0x08;
14745 spec->private_adc_nids[1] = 0x11;
14746 spec->private_capsrc_nids[0] = 0x23;
14747 spec->private_capsrc_nids[1] = 0x22;
14749 spec->private_adc_nids[0] = 0x11;
14750 spec->private_adc_nids[1] = 0x08;
14751 spec->private_capsrc_nids[0] = 0x22;
14752 spec->private_capsrc_nids[1] = 0x23;
14754 spec->adc_nids = spec->private_adc_nids;
14755 spec->capsrc_nids = spec->private_capsrc_nids;
14756 spec->num_adc_nids = 2;
14757 spec->dual_adc_switch = 1;
14758 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14759 spec->adc_nids[0], spec->adc_nids[1]);
14765 /* different alc269-variants */
14767 ALC269_TYPE_NORMAL,
14768 ALC269_TYPE_ALC258,
14769 ALC269_TYPE_ALC259,
14770 ALC269_TYPE_ALC269VB,
14771 ALC269_TYPE_ALC270,
14772 ALC269_TYPE_ALC271X,
14776 * BIOS auto configuration
14778 static int alc269_parse_auto_config(struct hda_codec *codec)
14780 struct alc_spec *spec = codec->spec;
14782 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14784 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14789 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14792 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14793 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14795 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14800 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14802 alc_auto_parse_digital(codec);
14804 if (spec->kctls.list)
14805 add_mixer(spec, spec->kctls.list);
14807 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14808 add_verb(spec, alc269vb_init_verbs);
14809 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14811 add_verb(spec, alc269_init_verbs);
14812 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14815 spec->num_mux_defs = 1;
14816 spec->input_mux = &spec->private_imux[0];
14818 if (!alc275_setup_dual_adc(codec))
14819 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14820 sizeof(alc269_adc_candidates));
14822 /* set default input source */
14823 if (!spec->dual_adc_switch)
14824 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14825 spec->input_mux->items[0].index);
14827 err = alc_auto_add_mic_boost(codec);
14831 if (!spec->cap_mixer && !spec->no_analog)
14832 set_capture_mixer(codec);
14837 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14838 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14839 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14842 /* init callback for auto-configuration model -- overriding the default init */
14843 static void alc269_auto_init(struct hda_codec *codec)
14845 struct alc_spec *spec = codec->spec;
14846 alc269_auto_init_multi_out(codec);
14847 alc269_auto_init_hp_out(codec);
14848 alc269_auto_init_analog_input(codec);
14849 alc_auto_init_digital(codec);
14850 if (spec->unsol_event)
14851 alc_inithook(codec);
14854 #ifdef SND_HDA_NEEDS_RESUME
14855 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14857 int val = alc_read_coef_idx(codec, 0x04);
14862 alc_write_coef_idx(codec, 0x04, val);
14865 #ifdef CONFIG_SND_HDA_POWER_SAVE
14866 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14868 struct alc_spec *spec = codec->spec;
14870 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14871 alc269_toggle_power_output(codec, 0);
14872 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14873 alc269_toggle_power_output(codec, 0);
14878 if (spec && spec->power_hook)
14879 spec->power_hook(codec);
14882 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14884 static int alc269_resume(struct hda_codec *codec)
14886 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14887 alc269_toggle_power_output(codec, 0);
14891 codec->patch_ops.init(codec);
14893 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14894 alc269_toggle_power_output(codec, 1);
14898 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14899 alc269_toggle_power_output(codec, 1);
14901 snd_hda_codec_resume_amp(codec);
14902 snd_hda_codec_resume_cache(codec);
14903 hda_call_check_power_status(codec, 0x01);
14906 #endif /* SND_HDA_NEEDS_RESUME */
14908 static void alc269_fixup_hweq(struct hda_codec *codec,
14909 const struct alc_fixup *fix, int action)
14913 if (action != ALC_FIXUP_ACT_INIT)
14915 coef = alc_read_coef_idx(codec, 0x1e);
14916 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14920 ALC269_FIXUP_SONY_VAIO,
14921 ALC275_FIXUP_SONY_VAIO_GPIO2,
14922 ALC269_FIXUP_DELL_M101Z,
14923 ALC269_FIXUP_SKU_IGNORE,
14924 ALC269_FIXUP_ASUS_G73JW,
14925 ALC269_FIXUP_LENOVO_EAPD,
14926 ALC275_FIXUP_SONY_HWEQ,
14929 static const struct alc_fixup alc269_fixups[] = {
14930 [ALC269_FIXUP_SONY_VAIO] = {
14931 .type = ALC_FIXUP_VERBS,
14932 .v.verbs = (const struct hda_verb[]) {
14933 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14937 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14938 .type = ALC_FIXUP_VERBS,
14939 .v.verbs = (const struct hda_verb[]) {
14940 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14941 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14942 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14946 .chain_id = ALC269_FIXUP_SONY_VAIO
14948 [ALC269_FIXUP_DELL_M101Z] = {
14949 .type = ALC_FIXUP_VERBS,
14950 .v.verbs = (const struct hda_verb[]) {
14951 /* Enables internal speaker */
14952 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14953 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14957 [ALC269_FIXUP_SKU_IGNORE] = {
14958 .type = ALC_FIXUP_SKU,
14959 .v.sku = ALC_FIXUP_SKU_IGNORE,
14961 [ALC269_FIXUP_ASUS_G73JW] = {
14962 .type = ALC_FIXUP_PINS,
14963 .v.pins = (const struct alc_pincfg[]) {
14964 { 0x17, 0x99130111 }, /* subwoofer */
14968 [ALC269_FIXUP_LENOVO_EAPD] = {
14969 .type = ALC_FIXUP_VERBS,
14970 .v.verbs = (const struct hda_verb[]) {
14971 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14975 [ALC275_FIXUP_SONY_HWEQ] = {
14976 .type = ALC_FIXUP_FUNC,
14977 .v.func = alc269_fixup_hweq,
14979 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14983 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14984 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14985 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14986 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14987 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14988 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14989 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14990 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
14991 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14992 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
14993 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
14994 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14995 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
15001 * configuration and preset
15003 static const char * const alc269_models[ALC269_MODEL_LAST] = {
15004 [ALC269_BASIC] = "basic",
15005 [ALC269_QUANTA_FL1] = "quanta",
15006 [ALC269_AMIC] = "laptop-amic",
15007 [ALC269_DMIC] = "laptop-dmic",
15008 [ALC269_FUJITSU] = "fujitsu",
15009 [ALC269_LIFEBOOK] = "lifebook",
15010 [ALC269_AUTO] = "auto",
15013 static struct snd_pci_quirk alc269_cfg_tbl[] = {
15014 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
15015 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
15016 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
15018 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
15019 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
15020 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
15021 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
15022 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
15023 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
15024 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
15025 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
15026 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
15027 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC),
15028 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
15029 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
15030 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
15031 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
15032 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
15033 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
15034 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
15035 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
15036 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
15037 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
15038 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
15039 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
15040 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
15041 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
15042 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
15043 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
15044 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
15045 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
15046 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
15047 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
15048 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
15049 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
15050 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
15051 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
15052 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
15053 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
15054 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
15056 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
15058 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
15059 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
15060 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
15061 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
15062 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
15063 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
15064 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
15065 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
15066 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
15067 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
15071 static struct alc_config_preset alc269_presets[] = {
15073 .mixers = { alc269_base_mixer },
15074 .init_verbs = { alc269_init_verbs },
15075 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15076 .dac_nids = alc269_dac_nids,
15078 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15079 .channel_mode = alc269_modes,
15080 .input_mux = &alc269_capture_source,
15082 [ALC269_QUANTA_FL1] = {
15083 .mixers = { alc269_quanta_fl1_mixer },
15084 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
15085 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15086 .dac_nids = alc269_dac_nids,
15088 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15089 .channel_mode = alc269_modes,
15090 .input_mux = &alc269_capture_source,
15091 .unsol_event = alc269_quanta_fl1_unsol_event,
15092 .setup = alc269_quanta_fl1_setup,
15093 .init_hook = alc269_quanta_fl1_init_hook,
15096 .mixers = { alc269_laptop_mixer },
15097 .cap_mixer = alc269_laptop_analog_capture_mixer,
15098 .init_verbs = { alc269_init_verbs,
15099 alc269_laptop_amic_init_verbs },
15100 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15101 .dac_nids = alc269_dac_nids,
15103 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15104 .channel_mode = alc269_modes,
15105 .unsol_event = alc269_laptop_unsol_event,
15106 .setup = alc269_laptop_amic_setup,
15107 .init_hook = alc269_laptop_inithook,
15110 .mixers = { alc269_laptop_mixer },
15111 .cap_mixer = alc269_laptop_digital_capture_mixer,
15112 .init_verbs = { alc269_init_verbs,
15113 alc269_laptop_dmic_init_verbs },
15114 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15115 .dac_nids = alc269_dac_nids,
15117 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15118 .channel_mode = alc269_modes,
15119 .unsol_event = alc269_laptop_unsol_event,
15120 .setup = alc269_laptop_dmic_setup,
15121 .init_hook = alc269_laptop_inithook,
15123 [ALC269VB_AMIC] = {
15124 .mixers = { alc269vb_laptop_mixer },
15125 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
15126 .init_verbs = { alc269vb_init_verbs,
15127 alc269vb_laptop_amic_init_verbs },
15128 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15129 .dac_nids = alc269_dac_nids,
15131 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15132 .channel_mode = alc269_modes,
15133 .unsol_event = alc269_laptop_unsol_event,
15134 .setup = alc269vb_laptop_amic_setup,
15135 .init_hook = alc269_laptop_inithook,
15137 [ALC269VB_DMIC] = {
15138 .mixers = { alc269vb_laptop_mixer },
15139 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15140 .init_verbs = { alc269vb_init_verbs,
15141 alc269vb_laptop_dmic_init_verbs },
15142 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15143 .dac_nids = alc269_dac_nids,
15145 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15146 .channel_mode = alc269_modes,
15147 .unsol_event = alc269_laptop_unsol_event,
15148 .setup = alc269vb_laptop_dmic_setup,
15149 .init_hook = alc269_laptop_inithook,
15151 [ALC269_FUJITSU] = {
15152 .mixers = { alc269_fujitsu_mixer },
15153 .cap_mixer = alc269_laptop_digital_capture_mixer,
15154 .init_verbs = { alc269_init_verbs,
15155 alc269_laptop_dmic_init_verbs },
15156 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15157 .dac_nids = alc269_dac_nids,
15159 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15160 .channel_mode = alc269_modes,
15161 .unsol_event = alc269_laptop_unsol_event,
15162 .setup = alc269_laptop_dmic_setup,
15163 .init_hook = alc269_laptop_inithook,
15165 [ALC269_LIFEBOOK] = {
15166 .mixers = { alc269_lifebook_mixer },
15167 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15168 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15169 .dac_nids = alc269_dac_nids,
15171 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15172 .channel_mode = alc269_modes,
15173 .input_mux = &alc269_capture_source,
15174 .unsol_event = alc269_lifebook_unsol_event,
15175 .init_hook = alc269_lifebook_init_hook,
15178 .mixers = { alc269_asus_mixer },
15179 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15180 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15181 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15182 .dac_nids = alc269_dac_nids,
15183 .adc_nids = alc262_dmic_adc_nids,
15184 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15185 .capsrc_nids = alc262_dmic_capsrc_nids,
15186 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15187 .channel_mode = alc269_modes,
15188 .input_mux = &alc269_capture_source,
15189 .dig_out_nid = ALC880_DIGOUT_NID,
15190 .unsol_event = alc_sku_unsol_event,
15191 .setup = alc269vb_laptop_dmic_setup,
15192 .init_hook = alc_inithook,
15196 static int alc269_fill_coef(struct hda_codec *codec)
15200 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15201 alc_write_coef_idx(codec, 0xf, 0x960b);
15202 alc_write_coef_idx(codec, 0xe, 0x8817);
15205 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15206 alc_write_coef_idx(codec, 0xf, 0x960b);
15207 alc_write_coef_idx(codec, 0xe, 0x8814);
15210 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15211 val = alc_read_coef_idx(codec, 0x04);
15212 /* Power up output pin */
15213 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15216 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15217 val = alc_read_coef_idx(codec, 0xd);
15218 if ((val & 0x0c00) >> 10 != 0x1) {
15219 /* Capless ramp up clock control */
15220 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15222 val = alc_read_coef_idx(codec, 0x17);
15223 if ((val & 0x01c0) >> 6 != 0x4) {
15224 /* Class D power on reset */
15225 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15231 static int patch_alc269(struct hda_codec *codec)
15233 struct alc_spec *spec;
15234 int board_config, coef;
15237 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15241 codec->spec = spec;
15243 alc_auto_parse_customize_define(codec);
15245 if (codec->vendor_id == 0x10ec0269) {
15246 coef = alc_read_coef_idx(codec, 0);
15247 if ((coef & 0x00f0) == 0x0010) {
15248 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15249 spec->cdefine.platform_type == 1) {
15250 alc_codec_rename(codec, "ALC271X");
15251 spec->codec_variant = ALC269_TYPE_ALC271X;
15252 } else if ((coef & 0xf000) == 0x1000) {
15253 spec->codec_variant = ALC269_TYPE_ALC270;
15254 } else if ((coef & 0xf000) == 0x2000) {
15255 alc_codec_rename(codec, "ALC259");
15256 spec->codec_variant = ALC269_TYPE_ALC259;
15257 } else if ((coef & 0xf000) == 0x3000) {
15258 alc_codec_rename(codec, "ALC258");
15259 spec->codec_variant = ALC269_TYPE_ALC258;
15261 alc_codec_rename(codec, "ALC269VB");
15262 spec->codec_variant = ALC269_TYPE_ALC269VB;
15265 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15266 alc269_fill_coef(codec);
15269 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15273 if (board_config < 0) {
15274 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15276 board_config = ALC269_AUTO;
15279 if (board_config == ALC269_AUTO) {
15280 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15281 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15284 if (board_config == ALC269_AUTO) {
15285 /* automatic parse from the BIOS config */
15286 err = alc269_parse_auto_config(codec);
15292 "hda_codec: Cannot set up configuration "
15293 "from BIOS. Using base mode...\n");
15294 board_config = ALC269_BASIC;
15298 if (has_cdefine_beep(codec)) {
15299 err = snd_hda_attach_beep_device(codec, 0x1);
15306 if (board_config != ALC269_AUTO)
15307 setup_preset(codec, &alc269_presets[board_config]);
15309 if (board_config == ALC269_QUANTA_FL1) {
15310 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15311 * fix the sample rate of analog I/O to 44.1kHz
15313 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15314 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15315 } else if (spec->dual_adc_switch) {
15316 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15317 /* switch ADC dynamically */
15318 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15320 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15321 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15323 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15324 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15326 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15327 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15328 spec->adc_nids = alc269_adc_nids;
15329 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15330 spec->capsrc_nids = alc269_capsrc_nids;
15332 spec->adc_nids = alc269vb_adc_nids;
15333 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15334 spec->capsrc_nids = alc269vb_capsrc_nids;
15338 if (!spec->cap_mixer)
15339 set_capture_mixer(codec);
15340 if (has_cdefine_beep(codec))
15341 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15343 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15345 spec->vmaster_nid = 0x02;
15347 codec->patch_ops = alc_patch_ops;
15348 #ifdef CONFIG_SND_HDA_POWER_SAVE
15349 codec->patch_ops.suspend = alc269_suspend;
15351 #ifdef SND_HDA_NEEDS_RESUME
15352 codec->patch_ops.resume = alc269_resume;
15354 if (board_config == ALC269_AUTO)
15355 spec->init_hook = alc269_auto_init;
15357 alc_init_jacks(codec);
15358 #ifdef CONFIG_SND_HDA_POWER_SAVE
15359 if (!spec->loopback.amplist)
15360 spec->loopback.amplist = alc269_loopbacks;
15361 if (alc269_mic2_for_mute_led(codec))
15362 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15369 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15373 * set the path ways for 2 channel output
15374 * need to set the codec line out and mic 1 pin widgets to inputs
15376 static struct hda_verb alc861_threestack_ch2_init[] = {
15377 /* set pin widget 1Ah (line in) for input */
15378 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15379 /* set pin widget 18h (mic1/2) for input, for mic also enable
15382 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15384 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15386 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15387 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15393 * need to set the codec line out and mic 1 pin widgets to outputs
15395 static struct hda_verb alc861_threestack_ch6_init[] = {
15396 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15397 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15398 /* set pin widget 18h (mic1) for output (CLFE)*/
15399 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15401 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15402 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15404 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15406 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15407 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15412 static struct hda_channel_mode alc861_threestack_modes[2] = {
15413 { 2, alc861_threestack_ch2_init },
15414 { 6, alc861_threestack_ch6_init },
15416 /* Set mic1 as input and unmute the mixer */
15417 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15418 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15419 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15422 /* Set mic1 as output and mute mixer */
15423 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15424 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15425 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15429 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15430 { 2, alc861_uniwill_m31_ch2_init },
15431 { 4, alc861_uniwill_m31_ch4_init },
15434 /* Set mic1 and line-in as input and unmute the mixer */
15435 static struct hda_verb alc861_asus_ch2_init[] = {
15436 /* set pin widget 1Ah (line in) for input */
15437 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15438 /* set pin widget 18h (mic1/2) for input, for mic also enable
15441 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15443 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15445 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15446 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15450 /* Set mic1 nad line-in as output and mute mixer */
15451 static struct hda_verb alc861_asus_ch6_init[] = {
15452 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15453 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15454 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15455 /* set pin widget 18h (mic1) for output (CLFE)*/
15456 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15457 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15458 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15459 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15461 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15463 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15464 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15469 static struct hda_channel_mode alc861_asus_modes[2] = {
15470 { 2, alc861_asus_ch2_init },
15471 { 6, alc861_asus_ch6_init },
15476 static struct snd_kcontrol_new alc861_base_mixer[] = {
15477 /* output mixer control */
15478 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15479 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15480 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15481 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15482 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15484 /*Input mixer control */
15485 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15486 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15487 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15488 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15489 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15490 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15491 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15492 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15493 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15494 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15499 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15500 /* output mixer control */
15501 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15502 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15503 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15504 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15505 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15507 /* Input mixer control */
15508 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15509 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15510 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15511 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15512 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15513 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15515 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15516 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15517 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15520 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15521 .name = "Channel Mode",
15522 .info = alc_ch_mode_info,
15523 .get = alc_ch_mode_get,
15524 .put = alc_ch_mode_put,
15525 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15530 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15531 /* output mixer control */
15532 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15533 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15534 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15539 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15540 /* output mixer control */
15541 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15542 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15543 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15544 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15545 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15547 /* Input mixer control */
15548 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15549 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15550 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15551 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15552 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15553 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15554 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15555 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15556 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15557 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15560 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15561 .name = "Channel Mode",
15562 .info = alc_ch_mode_info,
15563 .get = alc_ch_mode_get,
15564 .put = alc_ch_mode_put,
15565 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15570 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15571 /* output mixer control */
15572 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15573 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15574 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15575 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15576 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15578 /* Input mixer control */
15579 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15580 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15581 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15582 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15583 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15584 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15585 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15586 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15587 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15588 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15591 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15592 .name = "Channel Mode",
15593 .info = alc_ch_mode_info,
15594 .get = alc_ch_mode_get,
15595 .put = alc_ch_mode_put,
15596 .private_value = ARRAY_SIZE(alc861_asus_modes),
15601 /* additional mixer */
15602 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15603 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15604 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15609 * generic initialization of ADC, input mixers and output mixers
15611 static struct hda_verb alc861_base_init_verbs[] = {
15613 * Unmute ADC0 and set the default input to mic-in
15615 /* port-A for surround (rear panel) */
15616 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15617 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15618 /* port-B for mic-in (rear panel) with vref */
15619 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15620 /* port-C for line-in (rear panel) */
15621 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15622 /* port-D for Front */
15623 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15624 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15625 /* port-E for HP out (front panel) */
15626 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15627 /* route front PCM to HP */
15628 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15629 /* port-F for mic-in (front panel) with vref */
15630 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15631 /* port-G for CLFE (rear panel) */
15632 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15633 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15634 /* port-H for side (rear panel) */
15635 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15636 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15638 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15639 /* route front mic to ADC1*/
15640 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15641 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15643 /* Unmute DAC0~3 & spdif out*/
15644 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15645 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15646 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15647 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15648 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15650 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15651 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15652 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15653 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15654 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15656 /* Unmute Stereo Mixer 15 */
15657 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15658 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15659 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15660 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15662 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15663 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15664 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15665 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15666 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15667 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15668 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15669 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15670 /* hp used DAC 3 (Front) */
15671 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15672 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15677 static struct hda_verb alc861_threestack_init_verbs[] = {
15679 * Unmute ADC0 and set the default input to mic-in
15681 /* port-A for surround (rear panel) */
15682 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15683 /* port-B for mic-in (rear panel) with vref */
15684 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15685 /* port-C for line-in (rear panel) */
15686 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15687 /* port-D for Front */
15688 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15689 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15690 /* port-E for HP out (front panel) */
15691 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15692 /* route front PCM to HP */
15693 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15694 /* port-F for mic-in (front panel) with vref */
15695 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15696 /* port-G for CLFE (rear panel) */
15697 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15698 /* port-H for side (rear panel) */
15699 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15701 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15702 /* route front mic to ADC1*/
15703 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15704 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15705 /* Unmute DAC0~3 & spdif out*/
15706 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15707 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15708 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15709 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15710 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15712 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15713 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15714 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15715 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15716 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15718 /* Unmute Stereo Mixer 15 */
15719 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15720 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15721 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15722 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15724 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15725 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15726 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15727 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15729 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15730 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15731 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15732 /* hp used DAC 3 (Front) */
15733 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15734 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15738 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15740 * Unmute ADC0 and set the default input to mic-in
15742 /* port-A for surround (rear panel) */
15743 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15744 /* port-B for mic-in (rear panel) with vref */
15745 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15746 /* port-C for line-in (rear panel) */
15747 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15748 /* port-D for Front */
15749 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15750 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15751 /* port-E for HP out (front panel) */
15752 /* this has to be set to VREF80 */
15753 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15754 /* route front PCM to HP */
15755 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15756 /* port-F for mic-in (front panel) with vref */
15757 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15758 /* port-G for CLFE (rear panel) */
15759 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15760 /* port-H for side (rear panel) */
15761 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15763 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15764 /* route front mic to ADC1*/
15765 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15766 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15767 /* Unmute DAC0~3 & spdif out*/
15768 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15769 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15770 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15771 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15772 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15774 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15775 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15776 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15777 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15778 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15780 /* Unmute Stereo Mixer 15 */
15781 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15782 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15783 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15784 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15786 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15787 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15788 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15789 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15790 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15791 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15792 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15793 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15794 /* hp used DAC 3 (Front) */
15795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15796 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15800 static struct hda_verb alc861_asus_init_verbs[] = {
15802 * Unmute ADC0 and set the default input to mic-in
15804 /* port-A for surround (rear panel)
15805 * according to codec#0 this is the HP jack
15807 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15808 /* route front PCM to HP */
15809 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15810 /* port-B for mic-in (rear panel) with vref */
15811 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15812 /* port-C for line-in (rear panel) */
15813 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15814 /* port-D for Front */
15815 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15816 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15817 /* port-E for HP out (front panel) */
15818 /* this has to be set to VREF80 */
15819 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15820 /* route front PCM to HP */
15821 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15822 /* port-F for mic-in (front panel) with vref */
15823 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15824 /* port-G for CLFE (rear panel) */
15825 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15826 /* port-H for side (rear panel) */
15827 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15829 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15830 /* route front mic to ADC1*/
15831 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15832 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15833 /* Unmute DAC0~3 & spdif out*/
15834 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15835 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15836 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15837 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15838 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15839 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15840 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15841 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15842 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15843 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15845 /* Unmute Stereo Mixer 15 */
15846 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15847 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15848 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15849 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15851 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15852 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15853 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15854 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15855 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15856 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15857 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15858 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15859 /* hp used DAC 3 (Front) */
15860 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15861 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15865 /* additional init verbs for ASUS laptops */
15866 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15867 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15868 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15873 * generic initialization of ADC, input mixers and output mixers
15875 static struct hda_verb alc861_auto_init_verbs[] = {
15877 * Unmute ADC0 and set the default input to mic-in
15879 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15880 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15882 /* Unmute DAC0~3 & spdif out*/
15883 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15884 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15885 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15886 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15887 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15889 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15890 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15891 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15892 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15893 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15895 /* Unmute Stereo Mixer 15 */
15896 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15897 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15898 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15899 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15901 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15902 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15903 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15904 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15905 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15906 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15907 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15908 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15910 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15911 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15912 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15913 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15914 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15915 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15916 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15917 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15919 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15924 static struct hda_verb alc861_toshiba_init_verbs[] = {
15925 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15930 /* toggle speaker-output according to the hp-jack state */
15931 static void alc861_toshiba_automute(struct hda_codec *codec)
15933 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15935 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15936 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15937 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15938 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15941 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15944 if ((res >> 26) == ALC880_HP_EVENT)
15945 alc861_toshiba_automute(codec);
15948 /* pcm configuration: identical with ALC880 */
15949 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15950 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15951 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15952 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15955 #define ALC861_DIGOUT_NID 0x07
15957 static struct hda_channel_mode alc861_8ch_modes[1] = {
15961 static hda_nid_t alc861_dac_nids[4] = {
15962 /* front, surround, clfe, side */
15963 0x03, 0x06, 0x05, 0x04
15966 static hda_nid_t alc660_dac_nids[3] = {
15967 /* front, clfe, surround */
15971 static hda_nid_t alc861_adc_nids[1] = {
15976 static struct hda_input_mux alc861_capture_source = {
15980 { "Front Mic", 0x3 },
15987 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15989 struct alc_spec *spec = codec->spec;
15990 hda_nid_t mix, srcs[5];
15993 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15995 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15998 for (i = 0; i < num; i++) {
16000 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
16001 if (type != AC_WID_AUD_OUT)
16003 for (j = 0; j < spec->multiout.num_dacs; j++)
16004 if (spec->multiout.dac_nids[j] == srcs[i])
16006 if (j >= spec->multiout.num_dacs)
16012 /* fill in the dac_nids table from the parsed pin configuration */
16013 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
16014 const struct auto_pin_cfg *cfg)
16016 struct alc_spec *spec = codec->spec;
16018 hda_nid_t nid, dac;
16020 spec->multiout.dac_nids = spec->private_dac_nids;
16021 for (i = 0; i < cfg->line_outs; i++) {
16022 nid = cfg->line_out_pins[i];
16023 dac = alc861_look_for_dac(codec, nid);
16026 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
16031 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
16032 hda_nid_t nid, int idx, unsigned int chs)
16034 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
16035 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
16038 #define alc861_create_out_sw(codec, pfx, nid, chs) \
16039 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
16041 /* add playback controls from the parsed DAC table */
16042 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
16043 const struct auto_pin_cfg *cfg)
16045 struct alc_spec *spec = codec->spec;
16046 static const char * const chname[4] = {
16047 "Front", "Surround", NULL /*CLFE*/, "Side"
16049 const char *pfx = alc_get_line_out_pfx(cfg, true);
16053 for (i = 0; i < cfg->line_outs; i++) {
16054 nid = spec->multiout.dac_nids[i];
16057 if (!pfx && i == 2) {
16059 err = alc861_create_out_sw(codec, "Center", nid, 1);
16062 err = alc861_create_out_sw(codec, "LFE", nid, 2);
16066 const char *name = pfx;
16069 err = __alc861_create_out_sw(codec, name, nid, i, 3);
16077 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
16079 struct alc_spec *spec = codec->spec;
16086 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
16087 nid = alc861_look_for_dac(codec, pin);
16089 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
16092 spec->multiout.hp_nid = nid;
16098 /* create playback/capture controls for input pins */
16099 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
16100 const struct auto_pin_cfg *cfg)
16102 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
16105 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
16107 int pin_type, hda_nid_t dac)
16109 hda_nid_t mix, srcs[5];
16112 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
16114 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16116 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
16118 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16121 for (i = 0; i < num; i++) {
16123 if (srcs[i] == dac || srcs[i] == 0x15)
16124 mute = AMP_IN_UNMUTE(i);
16126 mute = AMP_IN_MUTE(i);
16127 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16132 static void alc861_auto_init_multi_out(struct hda_codec *codec)
16134 struct alc_spec *spec = codec->spec;
16137 for (i = 0; i < spec->autocfg.line_outs; i++) {
16138 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16139 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16141 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
16142 spec->multiout.dac_nids[i]);
16146 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16148 struct alc_spec *spec = codec->spec;
16150 if (spec->autocfg.hp_outs)
16151 alc861_auto_set_output_and_unmute(codec,
16152 spec->autocfg.hp_pins[0],
16154 spec->multiout.hp_nid);
16155 if (spec->autocfg.speaker_outs)
16156 alc861_auto_set_output_and_unmute(codec,
16157 spec->autocfg.speaker_pins[0],
16159 spec->multiout.dac_nids[0]);
16162 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16164 struct alc_spec *spec = codec->spec;
16165 struct auto_pin_cfg *cfg = &spec->autocfg;
16168 for (i = 0; i < cfg->num_inputs; i++) {
16169 hda_nid_t nid = cfg->inputs[i].pin;
16170 if (nid >= 0x0c && nid <= 0x11)
16171 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16175 /* parse the BIOS configuration and set up the alc_spec */
16176 /* return 1 if successful, 0 if the proper config is not found,
16177 * or a negative error code
16179 static int alc861_parse_auto_config(struct hda_codec *codec)
16181 struct alc_spec *spec = codec->spec;
16183 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16185 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16189 if (!spec->autocfg.line_outs)
16190 return 0; /* can't find valid BIOS pin config */
16192 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16195 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16198 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16201 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16205 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16207 alc_auto_parse_digital(codec);
16209 if (spec->kctls.list)
16210 add_mixer(spec, spec->kctls.list);
16212 add_verb(spec, alc861_auto_init_verbs);
16214 spec->num_mux_defs = 1;
16215 spec->input_mux = &spec->private_imux[0];
16217 spec->adc_nids = alc861_adc_nids;
16218 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16219 set_capture_mixer(codec);
16221 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16226 /* additional initialization for auto-configuration model */
16227 static void alc861_auto_init(struct hda_codec *codec)
16229 struct alc_spec *spec = codec->spec;
16230 alc861_auto_init_multi_out(codec);
16231 alc861_auto_init_hp_out(codec);
16232 alc861_auto_init_analog_input(codec);
16233 alc_auto_init_digital(codec);
16234 if (spec->unsol_event)
16235 alc_inithook(codec);
16238 #ifdef CONFIG_SND_HDA_POWER_SAVE
16239 static struct hda_amp_list alc861_loopbacks[] = {
16240 { 0x15, HDA_INPUT, 0 },
16241 { 0x15, HDA_INPUT, 1 },
16242 { 0x15, HDA_INPUT, 2 },
16243 { 0x15, HDA_INPUT, 3 },
16250 * configuration and preset
16252 static const char * const alc861_models[ALC861_MODEL_LAST] = {
16253 [ALC861_3ST] = "3stack",
16254 [ALC660_3ST] = "3stack-660",
16255 [ALC861_3ST_DIG] = "3stack-dig",
16256 [ALC861_6ST_DIG] = "6stack-dig",
16257 [ALC861_UNIWILL_M31] = "uniwill-m31",
16258 [ALC861_TOSHIBA] = "toshiba",
16259 [ALC861_ASUS] = "asus",
16260 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16261 [ALC861_AUTO] = "auto",
16264 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16265 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16266 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16267 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16268 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16269 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16270 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16271 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16272 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16273 * Any other models that need this preset?
16275 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16276 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16277 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16278 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16279 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16280 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16281 /* FIXME: the below seems conflict */
16282 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16283 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16284 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16288 static struct alc_config_preset alc861_presets[] = {
16290 .mixers = { alc861_3ST_mixer },
16291 .init_verbs = { alc861_threestack_init_verbs },
16292 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16293 .dac_nids = alc861_dac_nids,
16294 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16295 .channel_mode = alc861_threestack_modes,
16297 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16298 .adc_nids = alc861_adc_nids,
16299 .input_mux = &alc861_capture_source,
16301 [ALC861_3ST_DIG] = {
16302 .mixers = { alc861_base_mixer },
16303 .init_verbs = { alc861_threestack_init_verbs },
16304 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16305 .dac_nids = alc861_dac_nids,
16306 .dig_out_nid = ALC861_DIGOUT_NID,
16307 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16308 .channel_mode = alc861_threestack_modes,
16310 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16311 .adc_nids = alc861_adc_nids,
16312 .input_mux = &alc861_capture_source,
16314 [ALC861_6ST_DIG] = {
16315 .mixers = { alc861_base_mixer },
16316 .init_verbs = { alc861_base_init_verbs },
16317 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16318 .dac_nids = alc861_dac_nids,
16319 .dig_out_nid = ALC861_DIGOUT_NID,
16320 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16321 .channel_mode = alc861_8ch_modes,
16322 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16323 .adc_nids = alc861_adc_nids,
16324 .input_mux = &alc861_capture_source,
16327 .mixers = { alc861_3ST_mixer },
16328 .init_verbs = { alc861_threestack_init_verbs },
16329 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16330 .dac_nids = alc660_dac_nids,
16331 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16332 .channel_mode = alc861_threestack_modes,
16334 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16335 .adc_nids = alc861_adc_nids,
16336 .input_mux = &alc861_capture_source,
16338 [ALC861_UNIWILL_M31] = {
16339 .mixers = { alc861_uniwill_m31_mixer },
16340 .init_verbs = { alc861_uniwill_m31_init_verbs },
16341 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16342 .dac_nids = alc861_dac_nids,
16343 .dig_out_nid = ALC861_DIGOUT_NID,
16344 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16345 .channel_mode = alc861_uniwill_m31_modes,
16347 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16348 .adc_nids = alc861_adc_nids,
16349 .input_mux = &alc861_capture_source,
16351 [ALC861_TOSHIBA] = {
16352 .mixers = { alc861_toshiba_mixer },
16353 .init_verbs = { alc861_base_init_verbs,
16354 alc861_toshiba_init_verbs },
16355 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16356 .dac_nids = alc861_dac_nids,
16357 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16358 .channel_mode = alc883_3ST_2ch_modes,
16359 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16360 .adc_nids = alc861_adc_nids,
16361 .input_mux = &alc861_capture_source,
16362 .unsol_event = alc861_toshiba_unsol_event,
16363 .init_hook = alc861_toshiba_automute,
16366 .mixers = { alc861_asus_mixer },
16367 .init_verbs = { alc861_asus_init_verbs },
16368 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16369 .dac_nids = alc861_dac_nids,
16370 .dig_out_nid = ALC861_DIGOUT_NID,
16371 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16372 .channel_mode = alc861_asus_modes,
16375 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16376 .adc_nids = alc861_adc_nids,
16377 .input_mux = &alc861_capture_source,
16379 [ALC861_ASUS_LAPTOP] = {
16380 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16381 .init_verbs = { alc861_asus_init_verbs,
16382 alc861_asus_laptop_init_verbs },
16383 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16384 .dac_nids = alc861_dac_nids,
16385 .dig_out_nid = ALC861_DIGOUT_NID,
16386 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16387 .channel_mode = alc883_3ST_2ch_modes,
16389 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16390 .adc_nids = alc861_adc_nids,
16391 .input_mux = &alc861_capture_source,
16395 /* Pin config fixes */
16397 PINFIX_FSC_AMILO_PI1505,
16400 static const struct alc_fixup alc861_fixups[] = {
16401 [PINFIX_FSC_AMILO_PI1505] = {
16402 .type = ALC_FIXUP_PINS,
16403 .v.pins = (const struct alc_pincfg[]) {
16404 { 0x0b, 0x0221101f }, /* HP */
16405 { 0x0f, 0x90170310 }, /* speaker */
16411 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16412 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16416 static int patch_alc861(struct hda_codec *codec)
16418 struct alc_spec *spec;
16422 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16426 codec->spec = spec;
16428 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16432 if (board_config < 0) {
16433 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16435 board_config = ALC861_AUTO;
16438 if (board_config == ALC861_AUTO) {
16439 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16440 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16443 if (board_config == ALC861_AUTO) {
16444 /* automatic parse from the BIOS config */
16445 err = alc861_parse_auto_config(codec);
16451 "hda_codec: Cannot set up configuration "
16452 "from BIOS. Using base mode...\n");
16453 board_config = ALC861_3ST_DIG;
16457 err = snd_hda_attach_beep_device(codec, 0x23);
16463 if (board_config != ALC861_AUTO)
16464 setup_preset(codec, &alc861_presets[board_config]);
16466 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16467 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16469 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16470 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16472 if (!spec->cap_mixer)
16473 set_capture_mixer(codec);
16474 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16476 spec->vmaster_nid = 0x03;
16478 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16480 codec->patch_ops = alc_patch_ops;
16481 if (board_config == ALC861_AUTO) {
16482 spec->init_hook = alc861_auto_init;
16483 #ifdef CONFIG_SND_HDA_POWER_SAVE
16484 spec->power_hook = alc_power_eapd;
16487 #ifdef CONFIG_SND_HDA_POWER_SAVE
16488 if (!spec->loopback.amplist)
16489 spec->loopback.amplist = alc861_loopbacks;
16496 * ALC861-VD support
16500 * In addition, an independent DAC
16502 #define ALC861VD_DIGOUT_NID 0x06
16504 static hda_nid_t alc861vd_dac_nids[4] = {
16505 /* front, surr, clfe, side surr */
16506 0x02, 0x03, 0x04, 0x05
16509 /* dac_nids for ALC660vd are in a different order - according to
16510 * Realtek's driver.
16511 * This should probably result in a different mixer for 6stack models
16512 * of ALC660vd codecs, but for now there is only 3stack mixer
16513 * - and it is the same as in 861vd.
16514 * adc_nids in ALC660vd are (is) the same as in 861vd
16516 static hda_nid_t alc660vd_dac_nids[3] = {
16517 /* front, rear, clfe, rear_surr */
16521 static hda_nid_t alc861vd_adc_nids[1] = {
16526 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16529 /* FIXME: should be a matrix-type input source selection */
16530 static struct hda_input_mux alc861vd_capture_source = {
16534 { "Front Mic", 0x1 },
16540 static struct hda_input_mux alc861vd_dallas_capture_source = {
16544 { "Internal Mic", 0x1 },
16548 static struct hda_input_mux alc861vd_hp_capture_source = {
16551 { "Front Mic", 0x0 },
16552 { "ATAPI Mic", 0x1 },
16559 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16566 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16567 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16568 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16569 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16570 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16577 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16578 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16579 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16580 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16581 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16585 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16586 { 6, alc861vd_6stack_ch6_init },
16587 { 8, alc861vd_6stack_ch8_init },
16590 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16592 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16593 .name = "Channel Mode",
16594 .info = alc_ch_mode_info,
16595 .get = alc_ch_mode_get,
16596 .put = alc_ch_mode_put,
16601 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16602 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16604 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16605 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16606 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16608 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16609 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16611 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16613 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16615 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16616 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16618 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16619 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16621 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16623 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16624 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16625 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16627 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16628 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16629 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16631 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16632 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16634 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16635 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16640 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16641 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16642 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16644 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16646 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16647 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16648 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16650 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16651 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16652 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16654 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16655 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16657 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16658 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16663 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16664 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16665 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16666 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16668 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16670 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16674 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16675 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16676 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16678 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16679 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16684 /* Pin assignment: Speaker=0x14, HP = 0x15,
16685 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16687 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16688 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16689 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16690 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16691 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16692 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16693 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16694 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16695 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16696 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16697 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16701 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16702 * Front Mic=0x18, ATAPI Mic = 0x19,
16704 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16705 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16706 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16707 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16708 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16709 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16710 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16711 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16712 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16718 * generic initialization of ADC, input mixers and output mixers
16720 static struct hda_verb alc861vd_volume_init_verbs[] = {
16722 * Unmute ADC0 and set the default input to mic-in
16724 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16725 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16727 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16728 * the analog-loopback mixer widget
16730 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16737 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16738 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16739 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16740 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16741 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16744 * Set up output mixers (0x02 - 0x05)
16746 /* set vol=0 to output mixers */
16747 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16748 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16749 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16750 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16752 /* set up input amps for analog loopback */
16753 /* Amp Indices: DAC = 0, mixer = 1 */
16754 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16756 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16757 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16758 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16759 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16760 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16761 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16767 * 3-stack pin configuration:
16768 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16770 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16772 * Set pin mode and muting
16774 /* set front pin widgets 0x14 for output */
16775 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16776 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16777 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16779 /* Mic (rear) pin: input vref at 80% */
16780 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16781 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16782 /* Front Mic pin: input vref at 80% */
16783 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16784 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16785 /* Line In pin: input */
16786 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16787 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16788 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16789 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16790 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16791 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16792 /* CD pin widget for input */
16793 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16799 * 6-stack pin configuration:
16801 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16803 * Set pin mode and muting
16805 /* set front pin widgets 0x14 for output */
16806 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16807 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16808 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16810 /* Rear Pin: output 1 (0x0d) */
16811 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16812 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16813 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16814 /* CLFE Pin: output 2 (0x0e) */
16815 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16816 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16817 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16818 /* Side Pin: output 3 (0x0f) */
16819 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16820 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16821 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16823 /* Mic (rear) pin: input vref at 80% */
16824 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16825 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16826 /* Front Mic pin: input vref at 80% */
16827 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16828 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16829 /* Line In pin: input */
16830 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16832 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16833 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16834 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16835 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16836 /* CD pin widget for input */
16837 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16842 static struct hda_verb alc861vd_eapd_verbs[] = {
16843 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16847 static struct hda_verb alc660vd_eapd_verbs[] = {
16848 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16849 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16853 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16854 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16855 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16856 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16857 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16858 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16862 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16864 struct alc_spec *spec = codec->spec;
16865 spec->autocfg.hp_pins[0] = 0x1b;
16866 spec->autocfg.speaker_pins[0] = 0x14;
16869 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16871 alc_automute_amp(codec);
16872 alc88x_simple_mic_automute(codec);
16875 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16878 switch (res >> 26) {
16879 case ALC880_MIC_EVENT:
16880 alc88x_simple_mic_automute(codec);
16883 alc_automute_amp_unsol_event(codec, res);
16888 static struct hda_verb alc861vd_dallas_verbs[] = {
16889 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16890 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16891 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16892 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16895 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16896 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16897 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16898 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16899 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16900 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16901 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16903 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16904 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16905 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16906 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16907 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16908 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16909 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16910 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16912 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16913 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16914 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16915 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16916 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16917 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16918 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16919 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16921 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16922 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16923 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16924 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16926 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16927 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16928 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16933 /* toggle speaker-output according to the hp-jack state */
16934 static void alc861vd_dallas_setup(struct hda_codec *codec)
16936 struct alc_spec *spec = codec->spec;
16938 spec->autocfg.hp_pins[0] = 0x15;
16939 spec->autocfg.speaker_pins[0] = 0x14;
16942 #ifdef CONFIG_SND_HDA_POWER_SAVE
16943 #define alc861vd_loopbacks alc880_loopbacks
16946 /* pcm configuration: identical with ALC880 */
16947 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16948 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16949 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16950 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16953 * configuration and preset
16955 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16956 [ALC660VD_3ST] = "3stack-660",
16957 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16958 [ALC660VD_ASUS_V1S] = "asus-v1s",
16959 [ALC861VD_3ST] = "3stack",
16960 [ALC861VD_3ST_DIG] = "3stack-digout",
16961 [ALC861VD_6ST_DIG] = "6stack-digout",
16962 [ALC861VD_LENOVO] = "lenovo",
16963 [ALC861VD_DALLAS] = "dallas",
16964 [ALC861VD_HP] = "hp",
16965 [ALC861VD_AUTO] = "auto",
16968 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16969 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16970 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16971 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16972 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16973 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16974 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16975 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16976 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16977 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16978 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16979 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16980 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16981 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16982 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16983 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16987 static struct alc_config_preset alc861vd_presets[] = {
16989 .mixers = { alc861vd_3st_mixer },
16990 .init_verbs = { alc861vd_volume_init_verbs,
16991 alc861vd_3stack_init_verbs },
16992 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16993 .dac_nids = alc660vd_dac_nids,
16994 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16995 .channel_mode = alc861vd_3stack_2ch_modes,
16996 .input_mux = &alc861vd_capture_source,
16998 [ALC660VD_3ST_DIG] = {
16999 .mixers = { alc861vd_3st_mixer },
17000 .init_verbs = { alc861vd_volume_init_verbs,
17001 alc861vd_3stack_init_verbs },
17002 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17003 .dac_nids = alc660vd_dac_nids,
17004 .dig_out_nid = ALC861VD_DIGOUT_NID,
17005 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17006 .channel_mode = alc861vd_3stack_2ch_modes,
17007 .input_mux = &alc861vd_capture_source,
17010 .mixers = { alc861vd_3st_mixer },
17011 .init_verbs = { alc861vd_volume_init_verbs,
17012 alc861vd_3stack_init_verbs },
17013 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17014 .dac_nids = alc861vd_dac_nids,
17015 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17016 .channel_mode = alc861vd_3stack_2ch_modes,
17017 .input_mux = &alc861vd_capture_source,
17019 [ALC861VD_3ST_DIG] = {
17020 .mixers = { alc861vd_3st_mixer },
17021 .init_verbs = { alc861vd_volume_init_verbs,
17022 alc861vd_3stack_init_verbs },
17023 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17024 .dac_nids = alc861vd_dac_nids,
17025 .dig_out_nid = ALC861VD_DIGOUT_NID,
17026 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17027 .channel_mode = alc861vd_3stack_2ch_modes,
17028 .input_mux = &alc861vd_capture_source,
17030 [ALC861VD_6ST_DIG] = {
17031 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
17032 .init_verbs = { alc861vd_volume_init_verbs,
17033 alc861vd_6stack_init_verbs },
17034 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17035 .dac_nids = alc861vd_dac_nids,
17036 .dig_out_nid = ALC861VD_DIGOUT_NID,
17037 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
17038 .channel_mode = alc861vd_6stack_modes,
17039 .input_mux = &alc861vd_capture_source,
17041 [ALC861VD_LENOVO] = {
17042 .mixers = { alc861vd_lenovo_mixer },
17043 .init_verbs = { alc861vd_volume_init_verbs,
17044 alc861vd_3stack_init_verbs,
17045 alc861vd_eapd_verbs,
17046 alc861vd_lenovo_unsol_verbs },
17047 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17048 .dac_nids = alc660vd_dac_nids,
17049 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17050 .channel_mode = alc861vd_3stack_2ch_modes,
17051 .input_mux = &alc861vd_capture_source,
17052 .unsol_event = alc861vd_lenovo_unsol_event,
17053 .setup = alc861vd_lenovo_setup,
17054 .init_hook = alc861vd_lenovo_init_hook,
17056 [ALC861VD_DALLAS] = {
17057 .mixers = { alc861vd_dallas_mixer },
17058 .init_verbs = { alc861vd_dallas_verbs },
17059 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17060 .dac_nids = alc861vd_dac_nids,
17061 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17062 .channel_mode = alc861vd_3stack_2ch_modes,
17063 .input_mux = &alc861vd_dallas_capture_source,
17064 .unsol_event = alc_automute_amp_unsol_event,
17065 .setup = alc861vd_dallas_setup,
17066 .init_hook = alc_automute_amp,
17069 .mixers = { alc861vd_hp_mixer },
17070 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
17071 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17072 .dac_nids = alc861vd_dac_nids,
17073 .dig_out_nid = ALC861VD_DIGOUT_NID,
17074 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17075 .channel_mode = alc861vd_3stack_2ch_modes,
17076 .input_mux = &alc861vd_hp_capture_source,
17077 .unsol_event = alc_automute_amp_unsol_event,
17078 .setup = alc861vd_dallas_setup,
17079 .init_hook = alc_automute_amp,
17081 [ALC660VD_ASUS_V1S] = {
17082 .mixers = { alc861vd_lenovo_mixer },
17083 .init_verbs = { alc861vd_volume_init_verbs,
17084 alc861vd_3stack_init_verbs,
17085 alc861vd_eapd_verbs,
17086 alc861vd_lenovo_unsol_verbs },
17087 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17088 .dac_nids = alc660vd_dac_nids,
17089 .dig_out_nid = ALC861VD_DIGOUT_NID,
17090 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17091 .channel_mode = alc861vd_3stack_2ch_modes,
17092 .input_mux = &alc861vd_capture_source,
17093 .unsol_event = alc861vd_lenovo_unsol_event,
17094 .setup = alc861vd_lenovo_setup,
17095 .init_hook = alc861vd_lenovo_init_hook,
17100 * BIOS auto configuration
17102 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
17103 const struct auto_pin_cfg *cfg)
17105 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
17109 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
17110 hda_nid_t nid, int pin_type, int dac_idx)
17112 alc_set_pin_output(codec, nid, pin_type);
17115 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
17117 struct alc_spec *spec = codec->spec;
17120 for (i = 0; i <= HDA_SIDE; i++) {
17121 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17122 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17124 alc861vd_auto_set_output_and_unmute(codec, nid,
17130 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
17132 struct alc_spec *spec = codec->spec;
17135 pin = spec->autocfg.hp_pins[0];
17136 if (pin) /* connect to front and use dac 0 */
17137 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17138 pin = spec->autocfg.speaker_pins[0];
17140 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17143 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17145 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17147 struct alc_spec *spec = codec->spec;
17148 struct auto_pin_cfg *cfg = &spec->autocfg;
17151 for (i = 0; i < cfg->num_inputs; i++) {
17152 hda_nid_t nid = cfg->inputs[i].pin;
17153 if (alc_is_input_pin(codec, nid)) {
17154 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17155 if (nid != ALC861VD_PIN_CD_NID &&
17156 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17157 snd_hda_codec_write(codec, nid, 0,
17158 AC_VERB_SET_AMP_GAIN_MUTE,
17164 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17166 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17167 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17169 /* add playback controls from the parsed DAC table */
17170 /* Based on ALC880 version. But ALC861VD has separate,
17171 * different NIDs for mute/unmute switch and volume control */
17172 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17173 const struct auto_pin_cfg *cfg)
17175 static const char * const chname[4] = {
17176 "Front", "Surround", "CLFE", "Side"
17178 const char *pfx = alc_get_line_out_pfx(cfg, true);
17179 hda_nid_t nid_v, nid_s;
17182 for (i = 0; i < cfg->line_outs; i++) {
17183 if (!spec->multiout.dac_nids[i])
17185 nid_v = alc861vd_idx_to_mixer_vol(
17187 spec->multiout.dac_nids[i]));
17188 nid_s = alc861vd_idx_to_mixer_switch(
17190 spec->multiout.dac_nids[i]));
17192 if (!pfx && i == 2) {
17194 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17196 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17200 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17202 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17206 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17208 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17212 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17214 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17219 const char *name = pfx;
17222 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17224 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17228 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17230 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17239 /* add playback controls for speaker and HP outputs */
17240 /* Based on ALC880 version. But ALC861VD has separate,
17241 * different NIDs for mute/unmute switch and volume control */
17242 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17243 hda_nid_t pin, const char *pfx)
17245 hda_nid_t nid_v, nid_s;
17251 if (alc880_is_fixed_pin(pin)) {
17252 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17253 /* specify the DAC as the extra output */
17254 if (!spec->multiout.hp_nid)
17255 spec->multiout.hp_nid = nid_v;
17257 spec->multiout.extra_out_nid[0] = nid_v;
17258 /* control HP volume/switch on the output mixer amp */
17259 nid_v = alc861vd_idx_to_mixer_vol(
17260 alc880_fixed_pin_idx(pin));
17261 nid_s = alc861vd_idx_to_mixer_switch(
17262 alc880_fixed_pin_idx(pin));
17264 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17265 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17268 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17269 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17272 } else if (alc880_is_multi_pin(pin)) {
17273 /* set manual connection */
17274 /* we have only a switch on HP-out PIN */
17275 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17276 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17283 /* parse the BIOS configuration and set up the alc_spec
17284 * return 1 if successful, 0 if the proper config is not found,
17285 * or a negative error code
17286 * Based on ALC880 version - had to change it to override
17287 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17288 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17290 struct alc_spec *spec = codec->spec;
17292 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17294 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17298 if (!spec->autocfg.line_outs)
17299 return 0; /* can't find valid BIOS pin config */
17301 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17304 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17307 err = alc861vd_auto_create_extra_out(spec,
17308 spec->autocfg.speaker_pins[0],
17312 err = alc861vd_auto_create_extra_out(spec,
17313 spec->autocfg.hp_pins[0],
17317 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17321 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17323 alc_auto_parse_digital(codec);
17325 if (spec->kctls.list)
17326 add_mixer(spec, spec->kctls.list);
17328 add_verb(spec, alc861vd_volume_init_verbs);
17330 spec->num_mux_defs = 1;
17331 spec->input_mux = &spec->private_imux[0];
17333 err = alc_auto_add_mic_boost(codec);
17337 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17342 /* additional initialization for auto-configuration model */
17343 static void alc861vd_auto_init(struct hda_codec *codec)
17345 struct alc_spec *spec = codec->spec;
17346 alc861vd_auto_init_multi_out(codec);
17347 alc861vd_auto_init_hp_out(codec);
17348 alc861vd_auto_init_analog_input(codec);
17349 alc861vd_auto_init_input_src(codec);
17350 alc_auto_init_digital(codec);
17351 if (spec->unsol_event)
17352 alc_inithook(codec);
17356 ALC660VD_FIX_ASUS_GPIO1
17360 static const struct alc_fixup alc861vd_fixups[] = {
17361 [ALC660VD_FIX_ASUS_GPIO1] = {
17362 .type = ALC_FIXUP_VERBS,
17363 .v.verbs = (const struct hda_verb[]) {
17364 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17365 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17366 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17372 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17373 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17377 static int patch_alc861vd(struct hda_codec *codec)
17379 struct alc_spec *spec;
17380 int err, board_config;
17382 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17386 codec->spec = spec;
17388 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17392 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17393 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17395 board_config = ALC861VD_AUTO;
17398 if (board_config == ALC861VD_AUTO) {
17399 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17400 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17403 if (board_config == ALC861VD_AUTO) {
17404 /* automatic parse from the BIOS config */
17405 err = alc861vd_parse_auto_config(codec);
17411 "hda_codec: Cannot set up configuration "
17412 "from BIOS. Using base mode...\n");
17413 board_config = ALC861VD_3ST;
17417 err = snd_hda_attach_beep_device(codec, 0x23);
17423 if (board_config != ALC861VD_AUTO)
17424 setup_preset(codec, &alc861vd_presets[board_config]);
17426 if (codec->vendor_id == 0x10ec0660) {
17427 /* always turn on EAPD */
17428 add_verb(spec, alc660vd_eapd_verbs);
17431 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17432 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17434 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17435 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17437 if (!spec->adc_nids) {
17438 spec->adc_nids = alc861vd_adc_nids;
17439 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17441 if (!spec->capsrc_nids)
17442 spec->capsrc_nids = alc861vd_capsrc_nids;
17444 set_capture_mixer(codec);
17445 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17447 spec->vmaster_nid = 0x02;
17449 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17451 codec->patch_ops = alc_patch_ops;
17453 if (board_config == ALC861VD_AUTO)
17454 spec->init_hook = alc861vd_auto_init;
17455 #ifdef CONFIG_SND_HDA_POWER_SAVE
17456 if (!spec->loopback.amplist)
17457 spec->loopback.amplist = alc861vd_loopbacks;
17466 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17467 * configuration. Each pin widget can choose any input DACs and a mixer.
17468 * Each ADC is connected from a mixer of all inputs. This makes possible
17469 * 6-channel independent captures.
17471 * In addition, an independent DAC for the multi-playback (not used in this
17474 #define ALC662_DIGOUT_NID 0x06
17475 #define ALC662_DIGIN_NID 0x0a
17477 static hda_nid_t alc662_dac_nids[4] = {
17478 /* front, rear, clfe, rear_surr */
17482 static hda_nid_t alc272_dac_nids[2] = {
17486 static hda_nid_t alc662_adc_nids[2] = {
17491 static hda_nid_t alc272_adc_nids[1] = {
17496 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17497 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17501 /* FIXME: should be a matrix-type input source selection */
17502 static struct hda_input_mux alc662_capture_source = {
17506 { "Front Mic", 0x1 },
17512 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17520 static struct hda_input_mux alc663_capture_source = {
17524 { "Front Mic", 0x1 },
17529 #if 0 /* set to 1 for testing other input sources below */
17530 static struct hda_input_mux alc272_nc10_capture_source = {
17533 { "Autoselect Mic", 0x0 },
17534 { "Internal Mic", 0x1 },
17535 { "In-0x02", 0x2 },
17536 { "In-0x03", 0x3 },
17537 { "In-0x04", 0x4 },
17538 { "In-0x05", 0x5 },
17539 { "In-0x06", 0x6 },
17540 { "In-0x07", 0x7 },
17541 { "In-0x08", 0x8 },
17542 { "In-0x09", 0x9 },
17543 { "In-0x0a", 0x0a },
17544 { "In-0x0b", 0x0b },
17545 { "In-0x0c", 0x0c },
17546 { "In-0x0d", 0x0d },
17547 { "In-0x0e", 0x0e },
17548 { "In-0x0f", 0x0f },
17556 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17563 static struct hda_verb alc662_3ST_ch2_init[] = {
17564 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17565 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17566 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17567 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17574 static struct hda_verb alc662_3ST_ch6_init[] = {
17575 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17576 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17577 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17578 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17579 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17580 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17584 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17585 { 2, alc662_3ST_ch2_init },
17586 { 6, alc662_3ST_ch6_init },
17592 static struct hda_verb alc662_sixstack_ch6_init[] = {
17593 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17594 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17595 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17602 static struct hda_verb alc662_sixstack_ch8_init[] = {
17603 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17604 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17605 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17609 static struct hda_channel_mode alc662_5stack_modes[2] = {
17610 { 2, alc662_sixstack_ch6_init },
17611 { 6, alc662_sixstack_ch8_init },
17614 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17615 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17618 static struct snd_kcontrol_new alc662_base_mixer[] = {
17619 /* output mixer control */
17620 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17621 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17622 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17623 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17624 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17625 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17626 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17627 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17628 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17630 /*Input mixer control */
17631 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17632 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17633 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17634 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17635 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17636 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17637 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17638 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17642 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17643 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17644 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17645 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17646 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17647 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17648 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17649 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17651 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17652 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17653 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17657 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17658 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17659 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17660 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17661 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17662 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17663 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17664 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17665 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17666 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17667 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17668 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17669 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17670 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17673 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17674 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17678 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17679 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17680 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17681 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17682 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17683 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17684 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17685 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17687 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17691 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17692 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17693 ALC262_HIPPO_MASTER_SWITCH,
17695 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17697 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17699 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17700 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17701 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17705 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17706 ALC262_HIPPO_MASTER_SWITCH,
17707 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17708 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17709 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17710 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17711 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17712 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17713 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17714 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17715 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17719 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17720 .ops = &snd_hda_bind_vol,
17722 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17723 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17728 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17729 .ops = &snd_hda_bind_sw,
17731 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17732 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17737 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17738 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17739 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17740 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17741 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17745 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17746 .ops = &snd_hda_bind_sw,
17748 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17749 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17750 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17755 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17756 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17757 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17758 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17759 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17760 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17761 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17766 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17767 .ops = &snd_hda_bind_sw,
17769 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17770 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17771 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17776 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17777 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17778 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17780 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17781 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17782 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17786 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17787 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17788 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17789 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17790 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17791 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17792 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17793 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17797 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17798 .ops = &snd_hda_bind_vol,
17800 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17801 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17806 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17807 .ops = &snd_hda_bind_sw,
17809 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17810 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17815 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17816 HDA_BIND_VOL("Master Playback Volume",
17817 &alc663_asus_two_bind_master_vol),
17818 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17819 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17820 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17821 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17822 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17826 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17827 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17828 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17829 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17830 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17832 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17836 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17837 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17838 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17839 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17840 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17841 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17844 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17845 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17846 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17850 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17851 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17852 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17853 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17855 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17856 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17857 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17858 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17859 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17860 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17864 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17865 .ops = &snd_hda_bind_sw,
17867 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17868 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17869 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17870 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17871 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17876 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17877 .ops = &snd_hda_bind_sw,
17879 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17880 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17885 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17886 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17887 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17888 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17889 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17890 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17891 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17892 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17893 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17894 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17898 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17899 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17900 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17901 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17902 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17903 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17904 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17905 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17910 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17912 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17913 .name = "Channel Mode",
17914 .info = alc_ch_mode_info,
17915 .get = alc_ch_mode_get,
17916 .put = alc_ch_mode_put,
17921 static struct hda_verb alc662_init_verbs[] = {
17922 /* ADC: mute amp left and right */
17923 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17924 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17926 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17928 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17929 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17930 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17931 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17933 /* Front Pin: output 0 (0x0c) */
17934 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17935 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17937 /* Rear Pin: output 1 (0x0d) */
17938 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17939 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17941 /* CLFE Pin: output 2 (0x0e) */
17942 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17943 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17945 /* Mic (rear) pin: input vref at 80% */
17946 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17947 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17948 /* Front Mic pin: input vref at 80% */
17949 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17950 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17951 /* Line In pin: input */
17952 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17953 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17954 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17955 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17956 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17957 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17958 /* CD pin widget for input */
17959 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17961 /* FIXME: use matrix-type input source selection */
17962 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17964 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17965 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17967 /* always trun on EAPD */
17968 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17969 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17974 static struct hda_verb alc663_init_verbs[] = {
17975 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17976 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17977 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17978 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17979 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17980 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17984 static struct hda_verb alc272_init_verbs[] = {
17985 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17986 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17987 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17988 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17989 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17990 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17991 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17992 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17996 static struct hda_verb alc662_sue_init_verbs[] = {
17997 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17998 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18002 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
18003 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18004 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18008 /* Set Unsolicited Event*/
18009 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
18010 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18011 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18015 static struct hda_verb alc663_m51va_init_verbs[] = {
18016 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18017 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18018 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18019 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18020 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18022 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18023 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18024 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18028 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
18029 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18030 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18031 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18033 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18034 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18035 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18039 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
18040 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18041 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18042 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18043 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18044 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18045 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18046 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18047 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18051 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
18052 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18054 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18055 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18056 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18057 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18058 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18062 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
18063 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18064 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18065 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18066 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18067 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18069 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18070 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18071 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18072 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18073 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18074 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18078 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
18079 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18080 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18081 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18082 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18083 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18084 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18085 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18088 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18089 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18090 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18094 static struct hda_verb alc663_g71v_init_verbs[] = {
18095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18096 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18097 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
18099 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18100 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18101 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18103 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18104 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
18105 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18109 static struct hda_verb alc663_g50v_init_verbs[] = {
18110 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18111 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18112 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18114 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18115 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18119 static struct hda_verb alc662_ecs_init_verbs[] = {
18120 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
18121 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18122 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18123 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18127 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
18128 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18129 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18131 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18132 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18133 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18134 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18135 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18136 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18137 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18138 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18142 static struct hda_verb alc272_dell_init_verbs[] = {
18143 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18144 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18145 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18146 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18147 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18148 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18149 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18150 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18151 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18152 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18153 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18157 static struct hda_verb alc663_mode7_init_verbs[] = {
18158 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18159 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18160 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18161 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18162 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18163 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18164 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18165 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18166 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18167 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18168 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18169 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18170 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18171 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18172 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18176 static struct hda_verb alc663_mode8_init_verbs[] = {
18177 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18178 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18180 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18181 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18182 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18183 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18184 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18185 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18186 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18187 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18188 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18189 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18190 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18191 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18192 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18196 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18197 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18198 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18202 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18203 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18204 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18208 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18210 unsigned int present;
18211 unsigned char bits;
18213 present = snd_hda_jack_detect(codec, 0x14);
18214 bits = present ? HDA_AMP_MUTE : 0;
18216 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18217 HDA_AMP_MUTE, bits);
18220 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18222 unsigned int present;
18223 unsigned char bits;
18225 present = snd_hda_jack_detect(codec, 0x1b);
18226 bits = present ? HDA_AMP_MUTE : 0;
18228 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18229 HDA_AMP_MUTE, bits);
18230 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18231 HDA_AMP_MUTE, bits);
18234 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18237 if ((res >> 26) == ALC880_HP_EVENT)
18238 alc662_lenovo_101e_all_automute(codec);
18239 if ((res >> 26) == ALC880_FRONT_EVENT)
18240 alc662_lenovo_101e_ispeaker_automute(codec);
18243 /* unsolicited event for HP jack sensing */
18244 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18247 if ((res >> 26) == ALC880_MIC_EVENT)
18248 alc_mic_automute(codec);
18250 alc262_hippo_unsol_event(codec, res);
18253 static void alc662_eeepc_setup(struct hda_codec *codec)
18255 struct alc_spec *spec = codec->spec;
18257 alc262_hippo1_setup(codec);
18258 spec->ext_mic.pin = 0x18;
18259 spec->ext_mic.mux_idx = 0;
18260 spec->int_mic.pin = 0x19;
18261 spec->int_mic.mux_idx = 1;
18262 spec->auto_mic = 1;
18265 static void alc662_eeepc_inithook(struct hda_codec *codec)
18267 alc262_hippo_automute(codec);
18268 alc_mic_automute(codec);
18271 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18273 struct alc_spec *spec = codec->spec;
18275 spec->autocfg.hp_pins[0] = 0x14;
18276 spec->autocfg.speaker_pins[0] = 0x1b;
18279 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18281 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18283 unsigned int present;
18284 unsigned char bits;
18286 present = snd_hda_jack_detect(codec, 0x21);
18287 bits = present ? HDA_AMP_MUTE : 0;
18288 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18289 HDA_AMP_MUTE, bits);
18290 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18291 HDA_AMP_MUTE, bits);
18294 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18296 unsigned int present;
18297 unsigned char bits;
18299 present = snd_hda_jack_detect(codec, 0x21);
18300 bits = present ? HDA_AMP_MUTE : 0;
18301 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18302 HDA_AMP_MUTE, bits);
18303 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18304 HDA_AMP_MUTE, bits);
18305 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18306 HDA_AMP_MUTE, bits);
18307 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18308 HDA_AMP_MUTE, bits);
18311 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18313 unsigned int present;
18314 unsigned char bits;
18316 present = snd_hda_jack_detect(codec, 0x15);
18317 bits = present ? HDA_AMP_MUTE : 0;
18318 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18319 HDA_AMP_MUTE, bits);
18320 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18321 HDA_AMP_MUTE, bits);
18322 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18323 HDA_AMP_MUTE, bits);
18324 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18325 HDA_AMP_MUTE, bits);
18328 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18330 unsigned int present;
18331 unsigned char bits;
18333 present = snd_hda_jack_detect(codec, 0x1b);
18334 bits = present ? 0 : PIN_OUT;
18335 snd_hda_codec_write(codec, 0x14, 0,
18336 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18339 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18341 unsigned int present1, present2;
18343 present1 = snd_hda_jack_detect(codec, 0x21);
18344 present2 = snd_hda_jack_detect(codec, 0x15);
18346 if (present1 || present2) {
18347 snd_hda_codec_write_cache(codec, 0x14, 0,
18348 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18350 snd_hda_codec_write_cache(codec, 0x14, 0,
18351 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18355 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18357 unsigned int present1, present2;
18359 present1 = snd_hda_jack_detect(codec, 0x1b);
18360 present2 = snd_hda_jack_detect(codec, 0x15);
18362 if (present1 || present2) {
18363 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18364 HDA_AMP_MUTE, HDA_AMP_MUTE);
18365 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18366 HDA_AMP_MUTE, HDA_AMP_MUTE);
18368 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18370 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18375 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18377 unsigned int present1, present2;
18379 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18380 AC_VERB_GET_PIN_SENSE, 0)
18381 & AC_PINSENSE_PRESENCE;
18382 present2 = snd_hda_codec_read(codec, 0x21, 0,
18383 AC_VERB_GET_PIN_SENSE, 0)
18384 & AC_PINSENSE_PRESENCE;
18386 if (present1 || present2) {
18387 snd_hda_codec_write_cache(codec, 0x14, 0,
18388 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18389 snd_hda_codec_write_cache(codec, 0x17, 0,
18390 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18392 snd_hda_codec_write_cache(codec, 0x14, 0,
18393 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18394 snd_hda_codec_write_cache(codec, 0x17, 0,
18395 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18399 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18401 unsigned int present1, present2;
18403 present1 = snd_hda_codec_read(codec, 0x21, 0,
18404 AC_VERB_GET_PIN_SENSE, 0)
18405 & AC_PINSENSE_PRESENCE;
18406 present2 = snd_hda_codec_read(codec, 0x15, 0,
18407 AC_VERB_GET_PIN_SENSE, 0)
18408 & AC_PINSENSE_PRESENCE;
18410 if (present1 || present2) {
18411 snd_hda_codec_write_cache(codec, 0x14, 0,
18412 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18413 snd_hda_codec_write_cache(codec, 0x17, 0,
18414 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18416 snd_hda_codec_write_cache(codec, 0x14, 0,
18417 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18418 snd_hda_codec_write_cache(codec, 0x17, 0,
18419 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18423 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18426 switch (res >> 26) {
18427 case ALC880_HP_EVENT:
18428 alc663_m51va_speaker_automute(codec);
18430 case ALC880_MIC_EVENT:
18431 alc_mic_automute(codec);
18436 static void alc663_m51va_setup(struct hda_codec *codec)
18438 struct alc_spec *spec = codec->spec;
18439 spec->ext_mic.pin = 0x18;
18440 spec->ext_mic.mux_idx = 0;
18441 spec->int_mic.pin = 0x12;
18442 spec->int_mic.mux_idx = 9;
18443 spec->auto_mic = 1;
18446 static void alc663_m51va_inithook(struct hda_codec *codec)
18448 alc663_m51va_speaker_automute(codec);
18449 alc_mic_automute(codec);
18452 /* ***************** Mode1 ******************************/
18453 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18455 static void alc663_mode1_setup(struct hda_codec *codec)
18457 struct alc_spec *spec = codec->spec;
18458 spec->ext_mic.pin = 0x18;
18459 spec->ext_mic.mux_idx = 0;
18460 spec->int_mic.pin = 0x19;
18461 spec->int_mic.mux_idx = 1;
18462 spec->auto_mic = 1;
18465 #define alc663_mode1_inithook alc663_m51va_inithook
18467 /* ***************** Mode2 ******************************/
18468 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18471 switch (res >> 26) {
18472 case ALC880_HP_EVENT:
18473 alc662_f5z_speaker_automute(codec);
18475 case ALC880_MIC_EVENT:
18476 alc_mic_automute(codec);
18481 #define alc662_mode2_setup alc663_mode1_setup
18483 static void alc662_mode2_inithook(struct hda_codec *codec)
18485 alc662_f5z_speaker_automute(codec);
18486 alc_mic_automute(codec);
18488 /* ***************** Mode3 ******************************/
18489 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18492 switch (res >> 26) {
18493 case ALC880_HP_EVENT:
18494 alc663_two_hp_m1_speaker_automute(codec);
18496 case ALC880_MIC_EVENT:
18497 alc_mic_automute(codec);
18502 #define alc663_mode3_setup alc663_mode1_setup
18504 static void alc663_mode3_inithook(struct hda_codec *codec)
18506 alc663_two_hp_m1_speaker_automute(codec);
18507 alc_mic_automute(codec);
18509 /* ***************** Mode4 ******************************/
18510 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18513 switch (res >> 26) {
18514 case ALC880_HP_EVENT:
18515 alc663_21jd_two_speaker_automute(codec);
18517 case ALC880_MIC_EVENT:
18518 alc_mic_automute(codec);
18523 #define alc663_mode4_setup alc663_mode1_setup
18525 static void alc663_mode4_inithook(struct hda_codec *codec)
18527 alc663_21jd_two_speaker_automute(codec);
18528 alc_mic_automute(codec);
18530 /* ***************** Mode5 ******************************/
18531 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18534 switch (res >> 26) {
18535 case ALC880_HP_EVENT:
18536 alc663_15jd_two_speaker_automute(codec);
18538 case ALC880_MIC_EVENT:
18539 alc_mic_automute(codec);
18544 #define alc663_mode5_setup alc663_mode1_setup
18546 static void alc663_mode5_inithook(struct hda_codec *codec)
18548 alc663_15jd_two_speaker_automute(codec);
18549 alc_mic_automute(codec);
18551 /* ***************** Mode6 ******************************/
18552 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18555 switch (res >> 26) {
18556 case ALC880_HP_EVENT:
18557 alc663_two_hp_m2_speaker_automute(codec);
18559 case ALC880_MIC_EVENT:
18560 alc_mic_automute(codec);
18565 #define alc663_mode6_setup alc663_mode1_setup
18567 static void alc663_mode6_inithook(struct hda_codec *codec)
18569 alc663_two_hp_m2_speaker_automute(codec);
18570 alc_mic_automute(codec);
18573 /* ***************** Mode7 ******************************/
18574 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18577 switch (res >> 26) {
18578 case ALC880_HP_EVENT:
18579 alc663_two_hp_m7_speaker_automute(codec);
18581 case ALC880_MIC_EVENT:
18582 alc_mic_automute(codec);
18587 #define alc663_mode7_setup alc663_mode1_setup
18589 static void alc663_mode7_inithook(struct hda_codec *codec)
18591 alc663_two_hp_m7_speaker_automute(codec);
18592 alc_mic_automute(codec);
18595 /* ***************** Mode8 ******************************/
18596 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18599 switch (res >> 26) {
18600 case ALC880_HP_EVENT:
18601 alc663_two_hp_m8_speaker_automute(codec);
18603 case ALC880_MIC_EVENT:
18604 alc_mic_automute(codec);
18609 #define alc663_mode8_setup alc663_m51va_setup
18611 static void alc663_mode8_inithook(struct hda_codec *codec)
18613 alc663_two_hp_m8_speaker_automute(codec);
18614 alc_mic_automute(codec);
18617 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18619 unsigned int present;
18620 unsigned char bits;
18622 present = snd_hda_jack_detect(codec, 0x21);
18623 bits = present ? HDA_AMP_MUTE : 0;
18624 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18625 HDA_AMP_MUTE, bits);
18626 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18627 HDA_AMP_MUTE, bits);
18630 static void alc663_g71v_front_automute(struct hda_codec *codec)
18632 unsigned int present;
18633 unsigned char bits;
18635 present = snd_hda_jack_detect(codec, 0x15);
18636 bits = present ? HDA_AMP_MUTE : 0;
18637 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18638 HDA_AMP_MUTE, bits);
18641 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18644 switch (res >> 26) {
18645 case ALC880_HP_EVENT:
18646 alc663_g71v_hp_automute(codec);
18648 case ALC880_FRONT_EVENT:
18649 alc663_g71v_front_automute(codec);
18651 case ALC880_MIC_EVENT:
18652 alc_mic_automute(codec);
18657 #define alc663_g71v_setup alc663_m51va_setup
18659 static void alc663_g71v_inithook(struct hda_codec *codec)
18661 alc663_g71v_front_automute(codec);
18662 alc663_g71v_hp_automute(codec);
18663 alc_mic_automute(codec);
18666 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18669 switch (res >> 26) {
18670 case ALC880_HP_EVENT:
18671 alc663_m51va_speaker_automute(codec);
18673 case ALC880_MIC_EVENT:
18674 alc_mic_automute(codec);
18679 #define alc663_g50v_setup alc663_m51va_setup
18681 static void alc663_g50v_inithook(struct hda_codec *codec)
18683 alc663_m51va_speaker_automute(codec);
18684 alc_mic_automute(codec);
18687 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18688 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18689 ALC262_HIPPO_MASTER_SWITCH,
18691 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18692 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18693 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18695 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18696 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18697 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18701 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18702 /* Master Playback automatically created from Speaker and Headphone */
18703 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18704 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18705 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18706 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18710 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18712 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18713 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18714 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18718 #ifdef CONFIG_SND_HDA_POWER_SAVE
18719 #define alc662_loopbacks alc880_loopbacks
18723 /* pcm configuration: identical with ALC880 */
18724 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18725 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18726 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18727 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18730 * configuration and preset
18732 static const char * const alc662_models[ALC662_MODEL_LAST] = {
18733 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18734 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18735 [ALC662_3ST_6ch] = "3stack-6ch",
18736 [ALC662_5ST_DIG] = "6stack-dig",
18737 [ALC662_LENOVO_101E] = "lenovo-101e",
18738 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18739 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18740 [ALC662_ECS] = "ecs",
18741 [ALC663_ASUS_M51VA] = "m51va",
18742 [ALC663_ASUS_G71V] = "g71v",
18743 [ALC663_ASUS_H13] = "h13",
18744 [ALC663_ASUS_G50V] = "g50v",
18745 [ALC663_ASUS_MODE1] = "asus-mode1",
18746 [ALC662_ASUS_MODE2] = "asus-mode2",
18747 [ALC663_ASUS_MODE3] = "asus-mode3",
18748 [ALC663_ASUS_MODE4] = "asus-mode4",
18749 [ALC663_ASUS_MODE5] = "asus-mode5",
18750 [ALC663_ASUS_MODE6] = "asus-mode6",
18751 [ALC663_ASUS_MODE7] = "asus-mode7",
18752 [ALC663_ASUS_MODE8] = "asus-mode8",
18753 [ALC272_DELL] = "dell",
18754 [ALC272_DELL_ZM1] = "dell-zm1",
18755 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18756 [ALC662_AUTO] = "auto",
18759 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18760 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18761 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18762 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18763 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18764 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18765 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18766 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18767 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18768 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18769 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18770 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18771 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18772 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18773 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18774 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18775 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18776 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18777 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18778 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18779 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18780 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18781 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18782 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18783 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18784 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18785 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18786 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18787 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18788 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18789 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18790 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18791 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18792 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18793 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18794 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18795 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18796 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18797 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18798 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18799 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18800 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18801 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18802 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18803 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18804 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18805 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18806 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18807 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18808 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18809 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18810 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18811 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18812 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18813 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18814 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18815 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18816 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18817 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18818 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18819 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18820 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18821 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18822 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18823 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18824 ALC662_3ST_6ch_DIG),
18825 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18826 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18827 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18828 ALC662_3ST_6ch_DIG),
18829 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18830 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18831 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18832 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18833 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18834 ALC662_3ST_6ch_DIG),
18835 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18837 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E),
18841 static struct alc_config_preset alc662_presets[] = {
18842 [ALC662_3ST_2ch_DIG] = {
18843 .mixers = { alc662_3ST_2ch_mixer },
18844 .init_verbs = { alc662_init_verbs },
18845 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18846 .dac_nids = alc662_dac_nids,
18847 .dig_out_nid = ALC662_DIGOUT_NID,
18848 .dig_in_nid = ALC662_DIGIN_NID,
18849 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18850 .channel_mode = alc662_3ST_2ch_modes,
18851 .input_mux = &alc662_capture_source,
18853 [ALC662_3ST_6ch_DIG] = {
18854 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18855 .init_verbs = { alc662_init_verbs },
18856 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18857 .dac_nids = alc662_dac_nids,
18858 .dig_out_nid = ALC662_DIGOUT_NID,
18859 .dig_in_nid = ALC662_DIGIN_NID,
18860 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18861 .channel_mode = alc662_3ST_6ch_modes,
18863 .input_mux = &alc662_capture_source,
18865 [ALC662_3ST_6ch] = {
18866 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18867 .init_verbs = { alc662_init_verbs },
18868 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18869 .dac_nids = alc662_dac_nids,
18870 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18871 .channel_mode = alc662_3ST_6ch_modes,
18873 .input_mux = &alc662_capture_source,
18875 [ALC662_5ST_DIG] = {
18876 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18877 .init_verbs = { alc662_init_verbs },
18878 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18879 .dac_nids = alc662_dac_nids,
18880 .dig_out_nid = ALC662_DIGOUT_NID,
18881 .dig_in_nid = ALC662_DIGIN_NID,
18882 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18883 .channel_mode = alc662_5stack_modes,
18884 .input_mux = &alc662_capture_source,
18886 [ALC662_LENOVO_101E] = {
18887 .mixers = { alc662_lenovo_101e_mixer },
18888 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18889 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18890 .dac_nids = alc662_dac_nids,
18891 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18892 .channel_mode = alc662_3ST_2ch_modes,
18893 .input_mux = &alc662_lenovo_101e_capture_source,
18894 .unsol_event = alc662_lenovo_101e_unsol_event,
18895 .init_hook = alc662_lenovo_101e_all_automute,
18897 [ALC662_ASUS_EEEPC_P701] = {
18898 .mixers = { alc662_eeepc_p701_mixer },
18899 .init_verbs = { alc662_init_verbs,
18900 alc662_eeepc_sue_init_verbs },
18901 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18902 .dac_nids = alc662_dac_nids,
18903 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18904 .channel_mode = alc662_3ST_2ch_modes,
18905 .unsol_event = alc662_eeepc_unsol_event,
18906 .setup = alc662_eeepc_setup,
18907 .init_hook = alc662_eeepc_inithook,
18909 [ALC662_ASUS_EEEPC_EP20] = {
18910 .mixers = { alc662_eeepc_ep20_mixer,
18911 alc662_chmode_mixer },
18912 .init_verbs = { alc662_init_verbs,
18913 alc662_eeepc_ep20_sue_init_verbs },
18914 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18915 .dac_nids = alc662_dac_nids,
18916 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18917 .channel_mode = alc662_3ST_6ch_modes,
18918 .input_mux = &alc662_lenovo_101e_capture_source,
18919 .unsol_event = alc662_eeepc_unsol_event,
18920 .setup = alc662_eeepc_ep20_setup,
18921 .init_hook = alc662_eeepc_ep20_inithook,
18924 .mixers = { alc662_ecs_mixer },
18925 .init_verbs = { alc662_init_verbs,
18926 alc662_ecs_init_verbs },
18927 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18928 .dac_nids = alc662_dac_nids,
18929 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18930 .channel_mode = alc662_3ST_2ch_modes,
18931 .unsol_event = alc662_eeepc_unsol_event,
18932 .setup = alc662_eeepc_setup,
18933 .init_hook = alc662_eeepc_inithook,
18935 [ALC663_ASUS_M51VA] = {
18936 .mixers = { alc663_m51va_mixer },
18937 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18938 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18939 .dac_nids = alc662_dac_nids,
18940 .dig_out_nid = ALC662_DIGOUT_NID,
18941 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18942 .channel_mode = alc662_3ST_2ch_modes,
18943 .unsol_event = alc663_m51va_unsol_event,
18944 .setup = alc663_m51va_setup,
18945 .init_hook = alc663_m51va_inithook,
18947 [ALC663_ASUS_G71V] = {
18948 .mixers = { alc663_g71v_mixer },
18949 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18950 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18951 .dac_nids = alc662_dac_nids,
18952 .dig_out_nid = ALC662_DIGOUT_NID,
18953 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18954 .channel_mode = alc662_3ST_2ch_modes,
18955 .unsol_event = alc663_g71v_unsol_event,
18956 .setup = alc663_g71v_setup,
18957 .init_hook = alc663_g71v_inithook,
18959 [ALC663_ASUS_H13] = {
18960 .mixers = { alc663_m51va_mixer },
18961 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18962 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18963 .dac_nids = alc662_dac_nids,
18964 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18965 .channel_mode = alc662_3ST_2ch_modes,
18966 .unsol_event = alc663_m51va_unsol_event,
18967 .init_hook = alc663_m51va_inithook,
18969 [ALC663_ASUS_G50V] = {
18970 .mixers = { alc663_g50v_mixer },
18971 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18972 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18973 .dac_nids = alc662_dac_nids,
18974 .dig_out_nid = ALC662_DIGOUT_NID,
18975 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18976 .channel_mode = alc662_3ST_6ch_modes,
18977 .input_mux = &alc663_capture_source,
18978 .unsol_event = alc663_g50v_unsol_event,
18979 .setup = alc663_g50v_setup,
18980 .init_hook = alc663_g50v_inithook,
18982 [ALC663_ASUS_MODE1] = {
18983 .mixers = { alc663_m51va_mixer },
18984 .cap_mixer = alc662_auto_capture_mixer,
18985 .init_verbs = { alc662_init_verbs,
18986 alc663_21jd_amic_init_verbs },
18987 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18989 .dac_nids = alc662_dac_nids,
18990 .dig_out_nid = ALC662_DIGOUT_NID,
18991 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18992 .channel_mode = alc662_3ST_2ch_modes,
18993 .unsol_event = alc663_mode1_unsol_event,
18994 .setup = alc663_mode1_setup,
18995 .init_hook = alc663_mode1_inithook,
18997 [ALC662_ASUS_MODE2] = {
18998 .mixers = { alc662_1bjd_mixer },
18999 .cap_mixer = alc662_auto_capture_mixer,
19000 .init_verbs = { alc662_init_verbs,
19001 alc662_1bjd_amic_init_verbs },
19002 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19003 .dac_nids = alc662_dac_nids,
19004 .dig_out_nid = ALC662_DIGOUT_NID,
19005 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19006 .channel_mode = alc662_3ST_2ch_modes,
19007 .unsol_event = alc662_mode2_unsol_event,
19008 .setup = alc662_mode2_setup,
19009 .init_hook = alc662_mode2_inithook,
19011 [ALC663_ASUS_MODE3] = {
19012 .mixers = { alc663_two_hp_m1_mixer },
19013 .cap_mixer = alc662_auto_capture_mixer,
19014 .init_verbs = { alc662_init_verbs,
19015 alc663_two_hp_amic_m1_init_verbs },
19016 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19018 .dac_nids = alc662_dac_nids,
19019 .dig_out_nid = ALC662_DIGOUT_NID,
19020 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19021 .channel_mode = alc662_3ST_2ch_modes,
19022 .unsol_event = alc663_mode3_unsol_event,
19023 .setup = alc663_mode3_setup,
19024 .init_hook = alc663_mode3_inithook,
19026 [ALC663_ASUS_MODE4] = {
19027 .mixers = { alc663_asus_21jd_clfe_mixer },
19028 .cap_mixer = alc662_auto_capture_mixer,
19029 .init_verbs = { alc662_init_verbs,
19030 alc663_21jd_amic_init_verbs},
19031 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19033 .dac_nids = alc662_dac_nids,
19034 .dig_out_nid = ALC662_DIGOUT_NID,
19035 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19036 .channel_mode = alc662_3ST_2ch_modes,
19037 .unsol_event = alc663_mode4_unsol_event,
19038 .setup = alc663_mode4_setup,
19039 .init_hook = alc663_mode4_inithook,
19041 [ALC663_ASUS_MODE5] = {
19042 .mixers = { alc663_asus_15jd_clfe_mixer },
19043 .cap_mixer = alc662_auto_capture_mixer,
19044 .init_verbs = { alc662_init_verbs,
19045 alc663_15jd_amic_init_verbs },
19046 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19048 .dac_nids = alc662_dac_nids,
19049 .dig_out_nid = ALC662_DIGOUT_NID,
19050 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19051 .channel_mode = alc662_3ST_2ch_modes,
19052 .unsol_event = alc663_mode5_unsol_event,
19053 .setup = alc663_mode5_setup,
19054 .init_hook = alc663_mode5_inithook,
19056 [ALC663_ASUS_MODE6] = {
19057 .mixers = { alc663_two_hp_m2_mixer },
19058 .cap_mixer = alc662_auto_capture_mixer,
19059 .init_verbs = { alc662_init_verbs,
19060 alc663_two_hp_amic_m2_init_verbs },
19061 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19063 .dac_nids = alc662_dac_nids,
19064 .dig_out_nid = ALC662_DIGOUT_NID,
19065 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19066 .channel_mode = alc662_3ST_2ch_modes,
19067 .unsol_event = alc663_mode6_unsol_event,
19068 .setup = alc663_mode6_setup,
19069 .init_hook = alc663_mode6_inithook,
19071 [ALC663_ASUS_MODE7] = {
19072 .mixers = { alc663_mode7_mixer },
19073 .cap_mixer = alc662_auto_capture_mixer,
19074 .init_verbs = { alc662_init_verbs,
19075 alc663_mode7_init_verbs },
19076 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19078 .dac_nids = alc662_dac_nids,
19079 .dig_out_nid = ALC662_DIGOUT_NID,
19080 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19081 .channel_mode = alc662_3ST_2ch_modes,
19082 .unsol_event = alc663_mode7_unsol_event,
19083 .setup = alc663_mode7_setup,
19084 .init_hook = alc663_mode7_inithook,
19086 [ALC663_ASUS_MODE8] = {
19087 .mixers = { alc663_mode8_mixer },
19088 .cap_mixer = alc662_auto_capture_mixer,
19089 .init_verbs = { alc662_init_verbs,
19090 alc663_mode8_init_verbs },
19091 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19093 .dac_nids = alc662_dac_nids,
19094 .dig_out_nid = ALC662_DIGOUT_NID,
19095 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19096 .channel_mode = alc662_3ST_2ch_modes,
19097 .unsol_event = alc663_mode8_unsol_event,
19098 .setup = alc663_mode8_setup,
19099 .init_hook = alc663_mode8_inithook,
19102 .mixers = { alc663_m51va_mixer },
19103 .cap_mixer = alc272_auto_capture_mixer,
19104 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
19105 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19106 .dac_nids = alc662_dac_nids,
19107 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19108 .adc_nids = alc272_adc_nids,
19109 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
19110 .capsrc_nids = alc272_capsrc_nids,
19111 .channel_mode = alc662_3ST_2ch_modes,
19112 .unsol_event = alc663_m51va_unsol_event,
19113 .setup = alc663_m51va_setup,
19114 .init_hook = alc663_m51va_inithook,
19116 [ALC272_DELL_ZM1] = {
19117 .mixers = { alc663_m51va_mixer },
19118 .cap_mixer = alc662_auto_capture_mixer,
19119 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
19120 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19121 .dac_nids = alc662_dac_nids,
19122 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19123 .adc_nids = alc662_adc_nids,
19125 .capsrc_nids = alc662_capsrc_nids,
19126 .channel_mode = alc662_3ST_2ch_modes,
19127 .unsol_event = alc663_m51va_unsol_event,
19128 .setup = alc663_m51va_setup,
19129 .init_hook = alc663_m51va_inithook,
19131 [ALC272_SAMSUNG_NC10] = {
19132 .mixers = { alc272_nc10_mixer },
19133 .init_verbs = { alc662_init_verbs,
19134 alc663_21jd_amic_init_verbs },
19135 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19136 .dac_nids = alc272_dac_nids,
19137 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19138 .channel_mode = alc662_3ST_2ch_modes,
19139 /*.input_mux = &alc272_nc10_capture_source,*/
19140 .unsol_event = alc663_mode4_unsol_event,
19141 .setup = alc663_mode4_setup,
19142 .init_hook = alc663_mode4_inithook,
19148 * BIOS auto configuration
19151 /* convert from MIX nid to DAC */
19152 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19156 else if (nid >= 0x0c && nid <= 0x0e)
19157 return nid - 0x0c + 0x02;
19158 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19164 /* get MIX nid connected to the given pin targeted to DAC */
19165 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19171 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19172 for (i = 0; i < num; i++) {
19173 if (alc662_mix_to_dac(mix[i]) == dac)
19179 /* look for an empty DAC slot */
19180 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19182 struct alc_spec *spec = codec->spec;
19186 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19189 for (i = 0; i < num; i++) {
19190 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19193 for (j = 0; j < spec->multiout.num_dacs; j++)
19194 if (spec->multiout.dac_nids[j] == nid)
19196 if (j >= spec->multiout.num_dacs)
19202 /* fill in the dac_nids table from the parsed pin configuration */
19203 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19204 const struct auto_pin_cfg *cfg)
19206 struct alc_spec *spec = codec->spec;
19210 spec->multiout.dac_nids = spec->private_dac_nids;
19211 for (i = 0; i < cfg->line_outs; i++) {
19212 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19215 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19220 static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19221 hda_nid_t nid, int idx, unsigned int chs)
19223 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx,
19224 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19227 static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19228 hda_nid_t nid, int idx, unsigned int chs)
19230 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
19231 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19234 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19235 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19236 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19237 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19238 #define alc662_add_stereo_vol(spec, pfx, nid) \
19239 alc662_add_vol_ctl(spec, pfx, nid, 3)
19240 #define alc662_add_stereo_sw(spec, pfx, nid) \
19241 alc662_add_sw_ctl(spec, pfx, nid, 3)
19243 /* add playback controls from the parsed DAC table */
19244 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19245 const struct auto_pin_cfg *cfg)
19247 struct alc_spec *spec = codec->spec;
19248 static const char * const chname[4] = {
19249 "Front", "Surround", NULL /*CLFE*/, "Side"
19251 const char *pfx = alc_get_line_out_pfx(cfg, true);
19252 hda_nid_t nid, mix;
19255 for (i = 0; i < cfg->line_outs; i++) {
19256 nid = spec->multiout.dac_nids[i];
19259 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19262 if (!pfx && i == 2) {
19264 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19267 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19270 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19273 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19277 const char *name = pfx;
19280 err = __alc662_add_vol_ctl(spec, name, nid, i, 3);
19283 err = __alc662_add_sw_ctl(spec, name, mix, i, 3);
19291 /* add playback controls for speaker and HP outputs */
19292 /* return DAC nid if any new DAC is assigned */
19293 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19296 struct alc_spec *spec = codec->spec;
19297 hda_nid_t nid, mix;
19302 nid = alc662_look_for_dac(codec, pin);
19304 /* the corresponding DAC is already occupied */
19305 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19306 return 0; /* no way */
19307 /* create a switch only */
19308 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19309 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19312 mix = alc662_dac_to_mix(codec, pin, nid);
19315 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19318 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19324 /* create playback/capture controls for input pins */
19325 #define alc662_auto_create_input_ctls \
19326 alc882_auto_create_input_ctls
19328 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19329 hda_nid_t nid, int pin_type,
19333 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19335 alc_set_pin_output(codec, nid, pin_type);
19336 /* need the manual connection? */
19337 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19340 for (i = 0; i < num; i++) {
19341 if (alc662_mix_to_dac(srcs[i]) != dac)
19343 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19348 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19350 struct alc_spec *spec = codec->spec;
19351 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19354 for (i = 0; i <= HDA_SIDE; i++) {
19355 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19357 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19358 spec->multiout.dac_nids[i]);
19362 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19364 struct alc_spec *spec = codec->spec;
19367 pin = spec->autocfg.hp_pins[0];
19369 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19370 spec->multiout.hp_nid);
19371 pin = spec->autocfg.speaker_pins[0];
19373 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19374 spec->multiout.extra_out_nid[0]);
19377 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19379 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19381 struct alc_spec *spec = codec->spec;
19382 struct auto_pin_cfg *cfg = &spec->autocfg;
19385 for (i = 0; i < cfg->num_inputs; i++) {
19386 hda_nid_t nid = cfg->inputs[i].pin;
19387 if (alc_is_input_pin(codec, nid)) {
19388 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19389 if (nid != ALC662_PIN_CD_NID &&
19390 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19391 snd_hda_codec_write(codec, nid, 0,
19392 AC_VERB_SET_AMP_GAIN_MUTE,
19398 #define alc662_auto_init_input_src alc882_auto_init_input_src
19400 static int alc662_parse_auto_config(struct hda_codec *codec)
19402 struct alc_spec *spec = codec->spec;
19404 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19406 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19410 if (!spec->autocfg.line_outs)
19411 return 0; /* can't find valid BIOS pin config */
19413 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19416 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19419 err = alc662_auto_create_extra_out(codec,
19420 spec->autocfg.speaker_pins[0],
19425 spec->multiout.extra_out_nid[0] = err;
19426 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19431 spec->multiout.hp_nid = err;
19432 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19436 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19438 alc_auto_parse_digital(codec);
19440 if (spec->kctls.list)
19441 add_mixer(spec, spec->kctls.list);
19443 spec->num_mux_defs = 1;
19444 spec->input_mux = &spec->private_imux[0];
19446 add_verb(spec, alc662_init_verbs);
19447 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19448 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19449 add_verb(spec, alc663_init_verbs);
19451 if (codec->vendor_id == 0x10ec0272)
19452 add_verb(spec, alc272_init_verbs);
19454 err = alc_auto_add_mic_boost(codec);
19458 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19459 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19460 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19462 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19467 /* additional initialization for auto-configuration model */
19468 static void alc662_auto_init(struct hda_codec *codec)
19470 struct alc_spec *spec = codec->spec;
19471 alc662_auto_init_multi_out(codec);
19472 alc662_auto_init_hp_out(codec);
19473 alc662_auto_init_analog_input(codec);
19474 alc662_auto_init_input_src(codec);
19475 alc_auto_init_digital(codec);
19476 if (spec->unsol_event)
19477 alc_inithook(codec);
19480 static void alc272_fixup_mario(struct hda_codec *codec,
19481 const struct alc_fixup *fix, int action)
19483 if (action != ALC_FIXUP_ACT_PROBE)
19485 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19486 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19487 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19488 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19489 (0 << AC_AMPCAP_MUTE_SHIFT)))
19490 printk(KERN_WARNING
19491 "hda_codec: failed to override amp caps for NID 0x2\n");
19495 ALC662_FIXUP_ASPIRE,
19496 ALC662_FIXUP_IDEAPAD,
19497 ALC272_FIXUP_MARIO,
19498 ALC662_FIXUP_CZC_P10T,
19501 static const struct alc_fixup alc662_fixups[] = {
19502 [ALC662_FIXUP_ASPIRE] = {
19503 .type = ALC_FIXUP_PINS,
19504 .v.pins = (const struct alc_pincfg[]) {
19505 { 0x15, 0x99130112 }, /* subwoofer */
19509 [ALC662_FIXUP_IDEAPAD] = {
19510 .type = ALC_FIXUP_PINS,
19511 .v.pins = (const struct alc_pincfg[]) {
19512 { 0x17, 0x99130112 }, /* subwoofer */
19516 [ALC272_FIXUP_MARIO] = {
19517 .type = ALC_FIXUP_FUNC,
19518 .v.func = alc272_fixup_mario,
19520 [ALC662_FIXUP_CZC_P10T] = {
19521 .type = ALC_FIXUP_VERBS,
19522 .v.verbs = (const struct hda_verb[]) {
19523 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19529 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19530 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19531 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19532 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19533 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19534 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19535 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19539 static const struct alc_model_fixup alc662_fixup_models[] = {
19540 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19545 static int patch_alc662(struct hda_codec *codec)
19547 struct alc_spec *spec;
19548 int err, board_config;
19551 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19555 codec->spec = spec;
19557 alc_auto_parse_customize_define(codec);
19559 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19561 coef = alc_read_coef_idx(codec, 0);
19562 if (coef == 0x8020 || coef == 0x8011)
19563 alc_codec_rename(codec, "ALC661");
19564 else if (coef & (1 << 14) &&
19565 codec->bus->pci->subsystem_vendor == 0x1025 &&
19566 spec->cdefine.platform_type == 1)
19567 alc_codec_rename(codec, "ALC272X");
19568 else if (coef == 0x4011)
19569 alc_codec_rename(codec, "ALC656");
19571 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19574 if (board_config < 0) {
19575 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19577 board_config = ALC662_AUTO;
19580 if (board_config == ALC662_AUTO) {
19581 alc_pick_fixup(codec, alc662_fixup_models,
19582 alc662_fixup_tbl, alc662_fixups);
19583 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19584 /* automatic parse from the BIOS config */
19585 err = alc662_parse_auto_config(codec);
19591 "hda_codec: Cannot set up configuration "
19592 "from BIOS. Using base mode...\n");
19593 board_config = ALC662_3ST_2ch_DIG;
19597 if (has_cdefine_beep(codec)) {
19598 err = snd_hda_attach_beep_device(codec, 0x1);
19605 if (board_config != ALC662_AUTO)
19606 setup_preset(codec, &alc662_presets[board_config]);
19608 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19609 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19611 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19612 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19614 if (!spec->adc_nids) {
19615 spec->adc_nids = alc662_adc_nids;
19616 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19618 if (!spec->capsrc_nids)
19619 spec->capsrc_nids = alc662_capsrc_nids;
19621 if (!spec->cap_mixer)
19622 set_capture_mixer(codec);
19624 if (has_cdefine_beep(codec)) {
19625 switch (codec->vendor_id) {
19627 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19632 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19635 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19639 spec->vmaster_nid = 0x02;
19641 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19643 codec->patch_ops = alc_patch_ops;
19644 if (board_config == ALC662_AUTO)
19645 spec->init_hook = alc662_auto_init;
19647 alc_init_jacks(codec);
19649 #ifdef CONFIG_SND_HDA_POWER_SAVE
19650 if (!spec->loopback.amplist)
19651 spec->loopback.amplist = alc662_loopbacks;
19657 static int patch_alc888(struct hda_codec *codec)
19659 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19660 kfree(codec->chip_name);
19661 if (codec->vendor_id == 0x10ec0887)
19662 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19664 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19665 if (!codec->chip_name) {
19669 return patch_alc662(codec);
19671 return patch_alc882(codec);
19677 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19678 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19679 #define alc680_modes alc260_modes
19681 static hda_nid_t alc680_dac_nids[3] = {
19682 /* Lout1, Lout2, hp */
19686 static hda_nid_t alc680_adc_nids[3] = {
19688 /* DMIC, MIC, Line-in*/
19693 * Analog capture ADC cgange
19695 static void alc680_rec_autoswitch(struct hda_codec *codec)
19697 struct alc_spec *spec = codec->spec;
19698 struct auto_pin_cfg *cfg = &spec->autocfg;
19700 int type_found = AUTO_PIN_LAST;
19704 for (i = 0; i < cfg->num_inputs; i++) {
19705 nid = cfg->inputs[i].pin;
19706 if (!(snd_hda_query_pin_caps(codec, nid) &
19707 AC_PINCAP_PRES_DETECT))
19709 if (snd_hda_jack_detect(codec, nid)) {
19710 if (cfg->inputs[i].type < type_found) {
19711 type_found = cfg->inputs[i].type;
19719 snd_hda_get_connections(codec, pin_found, &nid, 1);
19721 if (nid != spec->cur_adc)
19722 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19723 spec->cur_adc = nid;
19724 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19725 spec->cur_adc_format);
19728 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19729 struct hda_codec *codec,
19730 unsigned int stream_tag,
19731 unsigned int format,
19732 struct snd_pcm_substream *substream)
19734 struct alc_spec *spec = codec->spec;
19736 spec->cur_adc = 0x07;
19737 spec->cur_adc_stream_tag = stream_tag;
19738 spec->cur_adc_format = format;
19740 alc680_rec_autoswitch(codec);
19744 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19745 struct hda_codec *codec,
19746 struct snd_pcm_substream *substream)
19748 snd_hda_codec_cleanup_stream(codec, 0x07);
19749 snd_hda_codec_cleanup_stream(codec, 0x08);
19750 snd_hda_codec_cleanup_stream(codec, 0x09);
19754 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19755 .substreams = 1, /* can be overridden */
19758 /* NID is set in alc_build_pcms */
19760 .prepare = alc680_capture_pcm_prepare,
19761 .cleanup = alc680_capture_pcm_cleanup
19765 static struct snd_kcontrol_new alc680_base_mixer[] = {
19766 /* output mixer control */
19767 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19768 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19769 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19770 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19771 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19772 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19773 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19777 static struct hda_bind_ctls alc680_bind_cap_vol = {
19778 .ops = &snd_hda_bind_vol,
19780 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19781 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19782 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19787 static struct hda_bind_ctls alc680_bind_cap_switch = {
19788 .ops = &snd_hda_bind_sw,
19790 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19791 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19792 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19797 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19798 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19799 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19804 * generic initialization of ADC, input mixers and output mixers
19806 static struct hda_verb alc680_init_verbs[] = {
19807 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19808 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19809 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19811 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19812 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19813 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19814 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19815 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19816 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19818 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19819 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19820 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19821 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19822 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19824 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19825 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19826 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19831 /* toggle speaker-output according to the hp-jack state */
19832 static void alc680_base_setup(struct hda_codec *codec)
19834 struct alc_spec *spec = codec->spec;
19836 spec->autocfg.hp_pins[0] = 0x16;
19837 spec->autocfg.speaker_pins[0] = 0x14;
19838 spec->autocfg.speaker_pins[1] = 0x15;
19839 spec->autocfg.num_inputs = 2;
19840 spec->autocfg.inputs[0].pin = 0x18;
19841 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19842 spec->autocfg.inputs[1].pin = 0x19;
19843 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19846 static void alc680_unsol_event(struct hda_codec *codec,
19849 if ((res >> 26) == ALC880_HP_EVENT)
19850 alc_automute_amp(codec);
19851 if ((res >> 26) == ALC880_MIC_EVENT)
19852 alc680_rec_autoswitch(codec);
19855 static void alc680_inithook(struct hda_codec *codec)
19857 alc_automute_amp(codec);
19858 alc680_rec_autoswitch(codec);
19861 /* create input playback/capture controls for the given pin */
19862 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19863 const char *ctlname, int idx)
19881 if (spec->multiout.dac_nids[0] != dac &&
19882 spec->multiout.dac_nids[1] != dac) {
19883 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19884 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19889 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19890 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19894 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19900 /* add playback controls from the parsed DAC table */
19901 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19902 const struct auto_pin_cfg *cfg)
19907 spec->multiout.dac_nids = spec->private_dac_nids;
19909 nid = cfg->line_out_pins[0];
19912 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19916 err = alc680_new_analog_output(spec, nid, name, 0);
19921 nid = cfg->speaker_pins[0];
19923 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19927 nid = cfg->hp_pins[0];
19929 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19937 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19938 hda_nid_t nid, int pin_type)
19940 alc_set_pin_output(codec, nid, pin_type);
19943 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19945 struct alc_spec *spec = codec->spec;
19946 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19948 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19949 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19953 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19955 struct alc_spec *spec = codec->spec;
19958 pin = spec->autocfg.hp_pins[0];
19960 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19961 pin = spec->autocfg.speaker_pins[0];
19963 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19966 /* pcm configuration: identical with ALC880 */
19967 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19968 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19969 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19970 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19971 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19974 * BIOS auto configuration
19976 static int alc680_parse_auto_config(struct hda_codec *codec)
19978 struct alc_spec *spec = codec->spec;
19980 static hda_nid_t alc680_ignore[] = { 0 };
19982 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19987 if (!spec->autocfg.line_outs) {
19988 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19989 spec->multiout.max_channels = 2;
19990 spec->no_analog = 1;
19993 return 0; /* can't find valid BIOS pin config */
19995 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19999 spec->multiout.max_channels = 2;
20002 /* digital only support output */
20003 alc_auto_parse_digital(codec);
20004 if (spec->kctls.list)
20005 add_mixer(spec, spec->kctls.list);
20007 add_verb(spec, alc680_init_verbs);
20009 err = alc_auto_add_mic_boost(codec);
20016 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
20018 /* init callback for auto-configuration model -- overriding the default init */
20019 static void alc680_auto_init(struct hda_codec *codec)
20021 struct alc_spec *spec = codec->spec;
20022 alc680_auto_init_multi_out(codec);
20023 alc680_auto_init_hp_out(codec);
20024 alc680_auto_init_analog_input(codec);
20025 alc_auto_init_digital(codec);
20026 if (spec->unsol_event)
20027 alc_inithook(codec);
20031 * configuration and preset
20033 static const char * const alc680_models[ALC680_MODEL_LAST] = {
20034 [ALC680_BASE] = "base",
20035 [ALC680_AUTO] = "auto",
20038 static struct snd_pci_quirk alc680_cfg_tbl[] = {
20039 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
20043 static struct alc_config_preset alc680_presets[] = {
20045 .mixers = { alc680_base_mixer },
20046 .cap_mixer = alc680_master_capture_mixer,
20047 .init_verbs = { alc680_init_verbs },
20048 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
20049 .dac_nids = alc680_dac_nids,
20050 .dig_out_nid = ALC680_DIGOUT_NID,
20051 .num_channel_mode = ARRAY_SIZE(alc680_modes),
20052 .channel_mode = alc680_modes,
20053 .unsol_event = alc680_unsol_event,
20054 .setup = alc680_base_setup,
20055 .init_hook = alc680_inithook,
20060 static int patch_alc680(struct hda_codec *codec)
20062 struct alc_spec *spec;
20066 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
20070 codec->spec = spec;
20072 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
20076 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
20077 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
20079 board_config = ALC680_AUTO;
20082 if (board_config == ALC680_AUTO) {
20083 /* automatic parse from the BIOS config */
20084 err = alc680_parse_auto_config(codec);
20090 "hda_codec: Cannot set up configuration "
20091 "from BIOS. Using base mode...\n");
20092 board_config = ALC680_BASE;
20096 if (board_config != ALC680_AUTO)
20097 setup_preset(codec, &alc680_presets[board_config]);
20099 spec->stream_analog_playback = &alc680_pcm_analog_playback;
20100 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
20101 spec->stream_digital_playback = &alc680_pcm_digital_playback;
20102 spec->stream_digital_capture = &alc680_pcm_digital_capture;
20104 if (!spec->adc_nids) {
20105 spec->adc_nids = alc680_adc_nids;
20106 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
20109 if (!spec->cap_mixer)
20110 set_capture_mixer(codec);
20112 spec->vmaster_nid = 0x02;
20114 codec->patch_ops = alc_patch_ops;
20115 if (board_config == ALC680_AUTO)
20116 spec->init_hook = alc680_auto_init;
20124 static struct hda_codec_preset snd_hda_preset_realtek[] = {
20125 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
20126 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
20127 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
20128 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
20129 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
20130 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
20131 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
20132 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
20133 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
20134 .patch = patch_alc861 },
20135 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
20136 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
20137 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
20138 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
20139 .patch = patch_alc882 },
20140 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
20141 .patch = patch_alc662 },
20142 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
20143 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
20144 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
20145 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
20146 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
20147 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
20148 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
20149 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
20150 .patch = patch_alc882 },
20151 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
20152 .patch = patch_alc882 },
20153 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
20154 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
20155 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
20156 .patch = patch_alc882 },
20157 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20158 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20159 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20160 {} /* terminator */
20163 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20165 MODULE_LICENSE("GPL");
20166 MODULE_DESCRIPTION("Realtek HD-audio codec");
20168 static struct hda_codec_preset_list realtek_list = {
20169 .preset = snd_hda_preset_realtek,
20170 .owner = THIS_MODULE,
20173 static int __init patch_realtek_init(void)
20175 return snd_hda_add_codec_preset(&realtek_list);
20178 static void __exit patch_realtek_exit(void)
20180 snd_hda_delete_codec_preset(&realtek_list);
20183 module_init(patch_realtek_init)
20184 module_exit(patch_realtek_exit)