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", 0x0e, 1, 0x0,
2297 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2298 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2299 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2300 HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
2301 HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 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),
2312 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2313 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2314 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2315 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2316 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2317 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2319 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2320 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2321 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2322 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2323 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2324 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2325 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2326 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2331 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2333 struct alc_spec *spec = codec->spec;
2335 spec->autocfg.hp_pins[0] = 0x15;
2336 spec->autocfg.speaker_pins[0] = 0x14;
2337 spec->autocfg.speaker_pins[1] = 0x16;
2338 spec->autocfg.speaker_pins[2] = 0x17;
2341 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2343 struct alc_spec *spec = codec->spec;
2345 spec->autocfg.hp_pins[0] = 0x15;
2346 spec->autocfg.speaker_pins[0] = 0x14;
2347 spec->autocfg.speaker_pins[1] = 0x16;
2348 spec->autocfg.speaker_pins[2] = 0x17;
2351 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2353 struct alc_spec *spec = codec->spec;
2355 spec->autocfg.hp_pins[0] = 0x15;
2356 spec->autocfg.speaker_pins[0] = 0x14;
2357 spec->autocfg.speaker_pins[1] = 0x16;
2358 spec->autocfg.speaker_pins[2] = 0x17;
2361 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2363 struct alc_spec *spec = codec->spec;
2365 spec->autocfg.hp_pins[0] = 0x15;
2366 spec->autocfg.speaker_pins[0] = 0x14;
2367 spec->autocfg.speaker_pins[1] = 0x16;
2368 spec->autocfg.speaker_pins[2] = 0x1b;
2372 * ALC880 3-stack model
2374 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2375 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2376 * F-Mic = 0x1b, HP = 0x19
2379 static hda_nid_t alc880_dac_nids[4] = {
2380 /* front, rear, clfe, rear_surr */
2381 0x02, 0x05, 0x04, 0x03
2384 static hda_nid_t alc880_adc_nids[3] = {
2389 /* The datasheet says the node 0x07 is connected from inputs,
2390 * but it shows zero connection in the real implementation on some devices.
2391 * Note: this is a 915GAV bug, fixed on 915GLV
2393 static hda_nid_t alc880_adc_nids_alt[2] = {
2398 #define ALC880_DIGOUT_NID 0x06
2399 #define ALC880_DIGIN_NID 0x0a
2401 static struct hda_input_mux alc880_capture_source = {
2405 { "Front Mic", 0x3 },
2411 /* channel source setting (2/6 channel selection for 3-stack) */
2413 static struct hda_verb alc880_threestack_ch2_init[] = {
2414 /* set line-in to input, mute it */
2415 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2416 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2417 /* set mic-in to input vref 80%, mute it */
2418 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2419 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2424 static struct hda_verb alc880_threestack_ch6_init[] = {
2425 /* set line-in to output, unmute it */
2426 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2427 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2428 /* set mic-in to output, unmute it */
2429 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2430 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2434 static struct hda_channel_mode alc880_threestack_modes[2] = {
2435 { 2, alc880_threestack_ch2_init },
2436 { 6, alc880_threestack_ch6_init },
2439 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2440 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2441 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2442 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2443 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2444 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2445 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2446 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2447 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2448 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2449 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2450 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2451 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2452 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2453 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2454 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2455 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2456 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2458 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2459 .name = "Channel Mode",
2460 .info = alc_ch_mode_info,
2461 .get = alc_ch_mode_get,
2462 .put = alc_ch_mode_put,
2467 /* capture mixer elements */
2468 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2469 struct snd_ctl_elem_info *uinfo)
2471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2472 struct alc_spec *spec = codec->spec;
2475 mutex_lock(&codec->control_mutex);
2476 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2478 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2479 mutex_unlock(&codec->control_mutex);
2483 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2484 unsigned int size, unsigned int __user *tlv)
2486 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2487 struct alc_spec *spec = codec->spec;
2490 mutex_lock(&codec->control_mutex);
2491 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2493 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2494 mutex_unlock(&codec->control_mutex);
2498 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2499 struct snd_ctl_elem_value *ucontrol);
2501 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2502 struct snd_ctl_elem_value *ucontrol,
2505 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2506 struct alc_spec *spec = codec->spec;
2507 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2510 mutex_lock(&codec->control_mutex);
2511 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2513 err = func(kcontrol, ucontrol);
2514 mutex_unlock(&codec->control_mutex);
2518 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2519 struct snd_ctl_elem_value *ucontrol)
2521 return alc_cap_getput_caller(kcontrol, ucontrol,
2522 snd_hda_mixer_amp_volume_get);
2525 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2526 struct snd_ctl_elem_value *ucontrol)
2528 return alc_cap_getput_caller(kcontrol, ucontrol,
2529 snd_hda_mixer_amp_volume_put);
2532 /* capture mixer elements */
2533 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2535 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2536 struct snd_ctl_elem_value *ucontrol)
2538 return alc_cap_getput_caller(kcontrol, ucontrol,
2539 snd_hda_mixer_amp_switch_get);
2542 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2543 struct snd_ctl_elem_value *ucontrol)
2545 return alc_cap_getput_caller(kcontrol, ucontrol,
2546 snd_hda_mixer_amp_switch_put);
2549 #define _DEFINE_CAPMIX(num) \
2551 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2552 .name = "Capture Switch", \
2553 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2555 .info = alc_cap_sw_info, \
2556 .get = alc_cap_sw_get, \
2557 .put = alc_cap_sw_put, \
2560 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2561 .name = "Capture Volume", \
2562 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2563 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2564 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2566 .info = alc_cap_vol_info, \
2567 .get = alc_cap_vol_get, \
2568 .put = alc_cap_vol_put, \
2569 .tlv = { .c = alc_cap_vol_tlv }, \
2572 #define _DEFINE_CAPSRC(num) \
2574 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2575 /* .name = "Capture Source", */ \
2576 .name = "Input Source", \
2578 .info = alc_mux_enum_info, \
2579 .get = alc_mux_enum_get, \
2580 .put = alc_mux_enum_put, \
2583 #define DEFINE_CAPMIX(num) \
2584 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2585 _DEFINE_CAPMIX(num), \
2586 _DEFINE_CAPSRC(num), \
2590 #define DEFINE_CAPMIX_NOSRC(num) \
2591 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2592 _DEFINE_CAPMIX(num), \
2596 /* up to three ADCs */
2600 DEFINE_CAPMIX_NOSRC(1);
2601 DEFINE_CAPMIX_NOSRC(2);
2602 DEFINE_CAPMIX_NOSRC(3);
2605 * ALC880 5-stack model
2607 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2609 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2610 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2613 /* additional mixers to alc880_three_stack_mixer */
2614 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2615 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2616 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2620 /* channel source setting (6/8 channel selection for 5-stack) */
2622 static struct hda_verb alc880_fivestack_ch6_init[] = {
2623 /* set line-in to input, mute it */
2624 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2625 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2630 static struct hda_verb alc880_fivestack_ch8_init[] = {
2631 /* set line-in to output, unmute it */
2632 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2633 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2637 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2638 { 6, alc880_fivestack_ch6_init },
2639 { 8, alc880_fivestack_ch8_init },
2644 * ALC880 6-stack model
2646 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2647 * Side = 0x05 (0x0f)
2648 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2649 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2652 static hda_nid_t alc880_6st_dac_nids[4] = {
2653 /* front, rear, clfe, rear_surr */
2654 0x02, 0x03, 0x04, 0x05
2657 static struct hda_input_mux alc880_6stack_capture_source = {
2661 { "Front Mic", 0x1 },
2667 /* fixed 8-channels */
2668 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2672 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2673 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2674 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2675 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2676 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2677 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2678 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2679 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2680 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2681 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2682 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2683 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2684 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2685 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2686 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2687 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2688 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2689 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2690 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2692 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2693 .name = "Channel Mode",
2694 .info = alc_ch_mode_info,
2695 .get = alc_ch_mode_get,
2696 .put = alc_ch_mode_put,
2705 * W810 has rear IO for:
2708 * Center/LFE (DAC 04)
2711 * The system also has a pair of internal speakers, and a headphone jack.
2712 * These are both connected to Line2 on the codec, hence to DAC 02.
2714 * There is a variable resistor to control the speaker or headphone
2715 * volume. This is a hardware-only device without a software API.
2717 * Plugging headphones in will disable the internal speakers. This is
2718 * implemented in hardware, not via the driver using jack sense. In
2719 * a similar fashion, plugging into the rear socket marked "front" will
2720 * disable both the speakers and headphones.
2722 * For input, there's a microphone jack, and an "audio in" jack.
2723 * These may not do anything useful with this driver yet, because I
2724 * haven't setup any initialization verbs for these yet...
2727 static hda_nid_t alc880_w810_dac_nids[3] = {
2728 /* front, rear/surround, clfe */
2732 /* fixed 6 channels */
2733 static struct hda_channel_mode alc880_w810_modes[1] = {
2737 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2738 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2739 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2740 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2741 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2742 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2743 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2744 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2745 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2746 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2747 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2755 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2756 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2760 static hda_nid_t alc880_z71v_dac_nids[1] = {
2763 #define ALC880_Z71V_HP_DAC 0x03
2765 /* fixed 2 channels */
2766 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2770 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2771 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2772 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2773 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2774 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2775 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2776 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2778 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2784 * ALC880 F1734 model
2786 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2787 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2790 static hda_nid_t alc880_f1734_dac_nids[1] = {
2793 #define ALC880_F1734_HP_DAC 0x02
2795 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2796 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2797 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2798 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2799 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2800 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2801 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2802 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2807 static struct hda_input_mux alc880_f1734_capture_source = {
2819 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2820 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2821 * Mic = 0x18, Line = 0x1a
2824 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2825 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2827 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2828 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2829 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2830 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2831 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2832 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2833 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2834 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2835 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2836 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2837 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2838 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2839 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2840 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2841 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2843 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2844 .name = "Channel Mode",
2845 .info = alc_ch_mode_info,
2846 .get = alc_ch_mode_get,
2847 .put = alc_ch_mode_put,
2853 * ALC880 ASUS W1V model
2855 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2856 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2857 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2860 /* additional mixers to alc880_asus_mixer */
2861 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2862 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2863 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2868 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2869 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2870 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2871 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2872 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2873 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2874 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2876 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2877 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2882 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2883 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2884 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2885 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2886 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2887 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2888 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2889 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2890 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2891 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2892 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2893 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2894 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2897 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2898 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2900 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2901 .name = "Channel Mode",
2902 .info = alc_ch_mode_info,
2903 .get = alc_ch_mode_get,
2904 .put = alc_ch_mode_put,
2909 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2910 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2911 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2912 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2913 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2914 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2915 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2916 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2917 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2918 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2919 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2923 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2924 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2925 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2926 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2927 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2934 * virtual master controls
2938 * slave controls for virtual master
2940 static const char * const alc_slave_vols[] = {
2941 "Front Playback Volume",
2942 "Surround Playback Volume",
2943 "Center Playback Volume",
2944 "LFE Playback Volume",
2945 "Side Playback Volume",
2946 "Headphone Playback Volume",
2947 "Speaker Playback Volume",
2948 "Mono Playback Volume",
2949 "Line-Out Playback Volume",
2950 "PCM Playback Volume",
2954 static const char * const alc_slave_sws[] = {
2955 "Front Playback Switch",
2956 "Surround Playback Switch",
2957 "Center Playback Switch",
2958 "LFE Playback Switch",
2959 "Side Playback Switch",
2960 "Headphone Playback Switch",
2961 "Speaker Playback Switch",
2962 "Mono Playback Switch",
2963 "IEC958 Playback Switch",
2964 "Line-Out Playback Switch",
2965 "PCM Playback Switch",
2970 * build control elements
2973 #define NID_MAPPING (-1)
2975 #define SUBDEV_SPEAKER_ (0 << 6)
2976 #define SUBDEV_HP_ (1 << 6)
2977 #define SUBDEV_LINE_ (2 << 6)
2978 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2979 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2980 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2982 static void alc_free_kctls(struct hda_codec *codec);
2984 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2985 /* additional beep mixers; the actual parameters are overwritten at build */
2986 static struct snd_kcontrol_new alc_beep_mixer[] = {
2987 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2988 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2993 static int alc_build_controls(struct hda_codec *codec)
2995 struct alc_spec *spec = codec->spec;
2996 struct snd_kcontrol *kctl = NULL;
2997 struct snd_kcontrol_new *knew;
3002 for (i = 0; i < spec->num_mixers; i++) {
3003 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
3007 if (spec->cap_mixer) {
3008 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
3012 if (spec->multiout.dig_out_nid) {
3013 err = snd_hda_create_spdif_out_ctls(codec,
3014 spec->multiout.dig_out_nid);
3017 if (!spec->no_analog) {
3018 err = snd_hda_create_spdif_share_sw(codec,
3022 spec->multiout.share_spdif = 1;
3025 if (spec->dig_in_nid) {
3026 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
3031 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3032 /* create beep controls if needed */
3033 if (spec->beep_amp) {
3034 struct snd_kcontrol_new *knew;
3035 for (knew = alc_beep_mixer; knew->name; knew++) {
3036 struct snd_kcontrol *kctl;
3037 kctl = snd_ctl_new1(knew, codec);
3040 kctl->private_value = spec->beep_amp;
3041 err = snd_hda_ctl_add(codec, 0, kctl);
3048 /* if we have no master control, let's create it */
3049 if (!spec->no_analog &&
3050 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
3051 unsigned int vmaster_tlv[4];
3052 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
3053 HDA_OUTPUT, vmaster_tlv);
3054 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
3055 vmaster_tlv, alc_slave_vols);
3059 if (!spec->no_analog &&
3060 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
3061 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
3062 NULL, alc_slave_sws);
3067 /* assign Capture Source enums to NID */
3068 if (spec->capsrc_nids || spec->adc_nids) {
3069 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
3071 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3072 for (i = 0; kctl && i < kctl->count; i++) {
3073 hda_nid_t *nids = spec->capsrc_nids;
3075 nids = spec->adc_nids;
3076 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
3081 if (spec->cap_mixer) {
3082 const char *kname = kctl ? kctl->id.name : NULL;
3083 for (knew = spec->cap_mixer; knew->name; knew++) {
3084 if (kname && strcmp(knew->name, kname) == 0)
3086 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3087 for (i = 0; kctl && i < kctl->count; i++) {
3088 err = snd_hda_add_nid(codec, kctl, i,
3096 /* other nid->control mapping */
3097 for (i = 0; i < spec->num_mixers; i++) {
3098 for (knew = spec->mixers[i]; knew->name; knew++) {
3099 if (knew->iface != NID_MAPPING)
3101 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3104 u = knew->subdevice;
3105 for (j = 0; j < 4; j++, u >>= 8) {
3110 case SUBDEV_SPEAKER_:
3111 nid = spec->autocfg.speaker_pins[nid];
3114 nid = spec->autocfg.line_out_pins[nid];
3117 nid = spec->autocfg.hp_pins[nid];
3122 err = snd_hda_add_nid(codec, kctl, 0, nid);
3126 u = knew->private_value;
3127 for (j = 0; j < 4; j++, u >>= 8) {
3131 err = snd_hda_add_nid(codec, kctl, 0, nid);
3138 alc_free_kctls(codec); /* no longer needed */
3145 * initialize the codec volumes, etc
3149 * generic initialization of ADC, input mixers and output mixers
3151 static struct hda_verb alc880_volume_init_verbs[] = {
3153 * Unmute ADC0-2 and set the default input to mic-in
3155 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3157 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3158 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3159 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3160 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3162 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3164 * Note: PASD motherboards uses the Line In 2 as the input for front
3167 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3168 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3169 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3170 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3171 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3172 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3173 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3174 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3177 * Set up output mixers (0x0c - 0x0f)
3179 /* set vol=0 to output mixers */
3180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3181 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3182 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3183 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3184 /* set up input amps for analog loopback */
3185 /* Amp Indices: DAC = 0, mixer = 1 */
3186 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3188 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3189 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3190 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3191 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3192 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3193 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3199 * 3-stack pin configuration:
3200 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3202 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3204 * preset connection lists of input pins
3205 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3207 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3208 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3209 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3212 * Set pin mode and muting
3214 /* set front pin widgets 0x14 for output */
3215 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3216 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3217 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3218 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3219 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3220 /* Mic2 (as headphone out) for HP output */
3221 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3222 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3223 /* Line In pin widget for input */
3224 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3225 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3226 /* Line2 (as front mic) pin widget for input and vref at 80% */
3227 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3228 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3229 /* CD pin widget for input */
3230 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3236 * 5-stack pin configuration:
3237 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3238 * line-in/side = 0x1a, f-mic = 0x1b
3240 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3242 * preset connection lists of input pins
3243 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3245 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3246 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3249 * Set pin mode and muting
3251 /* set pin widgets 0x14-0x17 for output */
3252 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3253 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3254 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3255 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3256 /* unmute pins for output (no gain on this amp) */
3257 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3258 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3259 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3260 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3262 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3263 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3264 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3265 /* Mic2 (as headphone out) for HP output */
3266 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3267 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3268 /* Line In pin widget for input */
3269 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3270 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3271 /* Line2 (as front mic) pin widget for input and vref at 80% */
3272 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3273 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3274 /* CD pin widget for input */
3275 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3281 * W810 pin configuration:
3282 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3284 static struct hda_verb alc880_pin_w810_init_verbs[] = {
3285 /* hphone/speaker input selector: front DAC */
3286 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3289 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3291 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3292 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3293 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3295 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3296 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3302 * Z71V pin configuration:
3303 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3305 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3306 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3307 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3308 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3309 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3311 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3312 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3313 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3314 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3320 * 6-stack pin configuration:
3321 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3322 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3324 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3325 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3327 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3328 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3329 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3330 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3331 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3332 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3333 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3334 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3336 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3337 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3338 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3339 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3340 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3341 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3342 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3343 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3344 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3350 * Uniwill pin configuration:
3351 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3354 static struct hda_verb alc880_uniwill_init_verbs[] = {
3355 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3358 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3359 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3360 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3361 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3362 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3363 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3364 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3367 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3368 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3370 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3372 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3373 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3374 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3376 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3377 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3378 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3379 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3380 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3382 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3383 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3390 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3392 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3393 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3395 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3396 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3397 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3398 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3399 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3400 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3401 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3403 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3404 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3405 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3406 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3408 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3409 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3410 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3411 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3412 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3413 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3415 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3416 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3421 static struct hda_verb alc880_beep_init_verbs[] = {
3422 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3426 /* auto-toggle front mic */
3427 static void alc88x_simple_mic_automute(struct hda_codec *codec)
3429 unsigned int present;
3432 present = snd_hda_jack_detect(codec, 0x18);
3433 bits = present ? HDA_AMP_MUTE : 0;
3434 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3437 static void alc880_uniwill_setup(struct hda_codec *codec)
3439 struct alc_spec *spec = codec->spec;
3441 spec->autocfg.hp_pins[0] = 0x14;
3442 spec->autocfg.speaker_pins[0] = 0x15;
3443 spec->autocfg.speaker_pins[0] = 0x16;
3446 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3448 alc_automute_amp(codec);
3449 alc88x_simple_mic_automute(codec);
3452 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3455 /* Looks like the unsol event is incompatible with the standard
3456 * definition. 4bit tag is placed at 28 bit!
3458 switch (res >> 28) {
3459 case ALC880_MIC_EVENT:
3460 alc88x_simple_mic_automute(codec);
3463 alc_automute_amp_unsol_event(codec, res);
3468 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3470 struct alc_spec *spec = codec->spec;
3472 spec->autocfg.hp_pins[0] = 0x14;
3473 spec->autocfg.speaker_pins[0] = 0x15;
3476 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3478 unsigned int present;
3480 present = snd_hda_codec_read(codec, 0x21, 0,
3481 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3482 present &= HDA_AMP_VOLMASK;
3483 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3484 HDA_AMP_VOLMASK, present);
3485 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3486 HDA_AMP_VOLMASK, present);
3489 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3492 /* Looks like the unsol event is incompatible with the standard
3493 * definition. 4bit tag is placed at 28 bit!
3495 if ((res >> 28) == ALC880_DCVOL_EVENT)
3496 alc880_uniwill_p53_dcvol_automute(codec);
3498 alc_automute_amp_unsol_event(codec, res);
3502 * F1734 pin configuration:
3503 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3505 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3506 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3507 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3508 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3509 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3510 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3513 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3514 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3515 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3517 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3518 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3519 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3520 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3521 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3522 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3523 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3524 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3525 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3527 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3528 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3534 * ASUS pin configuration:
3535 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3537 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3538 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3539 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3540 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3541 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3543 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3544 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3546 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3547 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3548 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3549 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3550 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3552 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3553 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3554 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3555 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3556 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3557 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3558 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3559 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3560 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3565 /* Enable GPIO mask and set output */
3566 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3567 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3568 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3570 /* Clevo m520g init */
3571 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3572 /* headphone output */
3573 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3575 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3576 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3578 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3579 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3581 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3582 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3583 /* Mic1 (rear panel) */
3584 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3585 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3586 /* Mic2 (front panel) */
3587 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3588 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3590 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3591 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3592 /* change to EAPD mode */
3593 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3594 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3599 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3600 /* change to EAPD mode */
3601 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3602 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3604 /* Headphone output */
3605 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3607 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3608 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3610 /* Line In pin widget for input */
3611 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3612 /* CD pin widget for input */
3613 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3614 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3615 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3617 /* change to EAPD mode */
3618 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3619 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3625 * LG m1 express dual
3628 * Rear Line-In/Out (blue): 0x14
3629 * Build-in Mic-In: 0x15
3631 * HP-Out (green): 0x1b
3632 * Mic-In/Out (red): 0x19
3636 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3637 static hda_nid_t alc880_lg_dac_nids[3] = {
3641 /* seems analog CD is not working */
3642 static struct hda_input_mux alc880_lg_capture_source = {
3647 { "Internal Mic", 0x6 },
3651 /* 2,4,6 channel modes */
3652 static struct hda_verb alc880_lg_ch2_init[] = {
3653 /* set line-in and mic-in to input */
3654 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3655 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3659 static struct hda_verb alc880_lg_ch4_init[] = {
3660 /* set line-in to out and mic-in to input */
3661 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3662 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3666 static struct hda_verb alc880_lg_ch6_init[] = {
3667 /* set line-in and mic-in to output */
3668 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3669 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3673 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3674 { 2, alc880_lg_ch2_init },
3675 { 4, alc880_lg_ch4_init },
3676 { 6, alc880_lg_ch6_init },
3679 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3680 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3681 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3682 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3683 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3684 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3685 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3686 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3687 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3688 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3689 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3690 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3691 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3692 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3693 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3695 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3696 .name = "Channel Mode",
3697 .info = alc_ch_mode_info,
3698 .get = alc_ch_mode_get,
3699 .put = alc_ch_mode_put,
3704 static struct hda_verb alc880_lg_init_verbs[] = {
3705 /* set capture source to mic-in */
3706 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3707 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3708 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3709 /* mute all amp mixer inputs */
3710 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3713 /* line-in to input */
3714 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3715 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3717 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3718 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3720 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3721 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3722 /* mic-in to input */
3723 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3724 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3725 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3727 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3728 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3729 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3731 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3735 /* toggle speaker-output according to the hp-jack state */
3736 static void alc880_lg_setup(struct hda_codec *codec)
3738 struct alc_spec *spec = codec->spec;
3740 spec->autocfg.hp_pins[0] = 0x1b;
3741 spec->autocfg.speaker_pins[0] = 0x17;
3750 * Built-in Mic-In: 0x19
3756 static struct hda_input_mux alc880_lg_lw_capture_source = {
3760 { "Internal Mic", 0x1 },
3765 #define alc880_lg_lw_modes alc880_threestack_modes
3767 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3768 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3769 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3770 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3771 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3772 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3773 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3774 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3775 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3776 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3777 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3780 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3781 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3783 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3784 .name = "Channel Mode",
3785 .info = alc_ch_mode_info,
3786 .get = alc_ch_mode_get,
3787 .put = alc_ch_mode_put,
3792 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3793 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3794 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3795 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3797 /* set capture source to mic-in */
3798 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3799 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3800 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3801 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3803 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3804 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3806 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3807 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3808 /* mic-in to input */
3809 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3810 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3812 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3813 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3815 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3819 /* toggle speaker-output according to the hp-jack state */
3820 static void alc880_lg_lw_setup(struct hda_codec *codec)
3822 struct alc_spec *spec = codec->spec;
3824 spec->autocfg.hp_pins[0] = 0x1b;
3825 spec->autocfg.speaker_pins[0] = 0x14;
3828 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3829 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3830 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3832 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3833 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3834 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3838 static struct hda_input_mux alc880_medion_rim_capture_source = {
3842 { "Internal Mic", 0x1 },
3846 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3847 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3849 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3850 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3852 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3853 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3854 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3855 /* Mic2 (as headphone out) for HP output */
3856 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3857 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3858 /* Internal Speaker */
3859 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3860 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3862 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3863 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3865 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3869 /* toggle speaker-output according to the hp-jack state */
3870 static void alc880_medion_rim_automute(struct hda_codec *codec)
3872 struct alc_spec *spec = codec->spec;
3873 alc_automute_amp(codec);
3875 if (spec->jack_present)
3876 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3878 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3881 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3884 /* Looks like the unsol event is incompatible with the standard
3885 * definition. 4bit tag is placed at 28 bit!
3887 if ((res >> 28) == ALC880_HP_EVENT)
3888 alc880_medion_rim_automute(codec);
3891 static void alc880_medion_rim_setup(struct hda_codec *codec)
3893 struct alc_spec *spec = codec->spec;
3895 spec->autocfg.hp_pins[0] = 0x14;
3896 spec->autocfg.speaker_pins[0] = 0x1b;
3899 #ifdef CONFIG_SND_HDA_POWER_SAVE
3900 static struct hda_amp_list alc880_loopbacks[] = {
3901 { 0x0b, HDA_INPUT, 0 },
3902 { 0x0b, HDA_INPUT, 1 },
3903 { 0x0b, HDA_INPUT, 2 },
3904 { 0x0b, HDA_INPUT, 3 },
3905 { 0x0b, HDA_INPUT, 4 },
3909 static struct hda_amp_list alc880_lg_loopbacks[] = {
3910 { 0x0b, HDA_INPUT, 1 },
3911 { 0x0b, HDA_INPUT, 6 },
3912 { 0x0b, HDA_INPUT, 7 },
3921 static int alc_init(struct hda_codec *codec)
3923 struct alc_spec *spec = codec->spec;
3927 alc_auto_init_amp(codec, spec->init_amp);
3929 for (i = 0; i < spec->num_init_verbs; i++)
3930 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3932 if (spec->init_hook)
3933 spec->init_hook(codec);
3935 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
3937 hda_call_check_power_status(codec, 0x01);
3941 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3943 struct alc_spec *spec = codec->spec;
3945 if (spec->unsol_event)
3946 spec->unsol_event(codec, res);
3949 #ifdef CONFIG_SND_HDA_POWER_SAVE
3950 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3952 struct alc_spec *spec = codec->spec;
3953 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3958 * Analog playback callbacks
3960 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3961 struct hda_codec *codec,
3962 struct snd_pcm_substream *substream)
3964 struct alc_spec *spec = codec->spec;
3965 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3969 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3970 struct hda_codec *codec,
3971 unsigned int stream_tag,
3972 unsigned int format,
3973 struct snd_pcm_substream *substream)
3975 struct alc_spec *spec = codec->spec;
3976 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3977 stream_tag, format, substream);
3980 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3981 struct hda_codec *codec,
3982 struct snd_pcm_substream *substream)
3984 struct alc_spec *spec = codec->spec;
3985 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3991 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3992 struct hda_codec *codec,
3993 struct snd_pcm_substream *substream)
3995 struct alc_spec *spec = codec->spec;
3996 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3999 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4000 struct hda_codec *codec,
4001 unsigned int stream_tag,
4002 unsigned int format,
4003 struct snd_pcm_substream *substream)
4005 struct alc_spec *spec = codec->spec;
4006 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
4007 stream_tag, format, substream);
4010 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4011 struct hda_codec *codec,
4012 struct snd_pcm_substream *substream)
4014 struct alc_spec *spec = codec->spec;
4015 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
4018 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
4019 struct hda_codec *codec,
4020 struct snd_pcm_substream *substream)
4022 struct alc_spec *spec = codec->spec;
4023 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
4029 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4030 struct hda_codec *codec,
4031 unsigned int stream_tag,
4032 unsigned int format,
4033 struct snd_pcm_substream *substream)
4035 struct alc_spec *spec = codec->spec;
4037 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
4038 stream_tag, 0, format);
4042 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4043 struct hda_codec *codec,
4044 struct snd_pcm_substream *substream)
4046 struct alc_spec *spec = codec->spec;
4048 snd_hda_codec_cleanup_stream(codec,
4049 spec->adc_nids[substream->number + 1]);
4053 /* analog capture with dynamic dual-adc changes */
4054 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4055 struct hda_codec *codec,
4056 unsigned int stream_tag,
4057 unsigned int format,
4058 struct snd_pcm_substream *substream)
4060 struct alc_spec *spec = codec->spec;
4061 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
4062 spec->cur_adc_stream_tag = stream_tag;
4063 spec->cur_adc_format = format;
4064 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
4068 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4069 struct hda_codec *codec,
4070 struct snd_pcm_substream *substream)
4072 struct alc_spec *spec = codec->spec;
4073 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
4078 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
4082 .nid = 0, /* fill later */
4084 .prepare = dualmic_capture_pcm_prepare,
4085 .cleanup = dualmic_capture_pcm_cleanup
4091 static struct hda_pcm_stream alc880_pcm_analog_playback = {
4095 /* NID is set in alc_build_pcms */
4097 .open = alc880_playback_pcm_open,
4098 .prepare = alc880_playback_pcm_prepare,
4099 .cleanup = alc880_playback_pcm_cleanup
4103 static struct hda_pcm_stream alc880_pcm_analog_capture = {
4107 /* NID is set in alc_build_pcms */
4110 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4114 /* NID is set in alc_build_pcms */
4117 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4118 .substreams = 2, /* can be overridden */
4121 /* NID is set in alc_build_pcms */
4123 .prepare = alc880_alt_capture_pcm_prepare,
4124 .cleanup = alc880_alt_capture_pcm_cleanup
4128 static struct hda_pcm_stream alc880_pcm_digital_playback = {
4132 /* NID is set in alc_build_pcms */
4134 .open = alc880_dig_playback_pcm_open,
4135 .close = alc880_dig_playback_pcm_close,
4136 .prepare = alc880_dig_playback_pcm_prepare,
4137 .cleanup = alc880_dig_playback_pcm_cleanup
4141 static struct hda_pcm_stream alc880_pcm_digital_capture = {
4145 /* NID is set in alc_build_pcms */
4148 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4149 static struct hda_pcm_stream alc_pcm_null_stream = {
4155 static int alc_build_pcms(struct hda_codec *codec)
4157 struct alc_spec *spec = codec->spec;
4158 struct hda_pcm *info = spec->pcm_rec;
4161 codec->num_pcms = 1;
4162 codec->pcm_info = info;
4164 if (spec->no_analog)
4167 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4168 "%s Analog", codec->chip_name);
4169 info->name = spec->stream_name_analog;
4171 if (spec->stream_analog_playback) {
4172 if (snd_BUG_ON(!spec->multiout.dac_nids))
4174 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4175 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4177 if (spec->stream_analog_capture) {
4178 if (snd_BUG_ON(!spec->adc_nids))
4180 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4181 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4184 if (spec->channel_mode) {
4185 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4186 for (i = 0; i < spec->num_channel_mode; i++) {
4187 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4188 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4194 /* SPDIF for stream index #1 */
4195 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4196 snprintf(spec->stream_name_digital,
4197 sizeof(spec->stream_name_digital),
4198 "%s Digital", codec->chip_name);
4199 codec->num_pcms = 2;
4200 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4201 info = spec->pcm_rec + 1;
4202 info->name = spec->stream_name_digital;
4203 if (spec->dig_out_type)
4204 info->pcm_type = spec->dig_out_type;
4206 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4207 if (spec->multiout.dig_out_nid &&
4208 spec->stream_digital_playback) {
4209 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4210 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4212 if (spec->dig_in_nid &&
4213 spec->stream_digital_capture) {
4214 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4215 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4217 /* FIXME: do we need this for all Realtek codec models? */
4218 codec->spdif_status_reset = 1;
4221 if (spec->no_analog)
4224 /* If the use of more than one ADC is requested for the current
4225 * model, configure a second analog capture-only PCM.
4227 /* Additional Analaog capture for index #2 */
4228 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4229 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4230 codec->num_pcms = 3;
4231 info = spec->pcm_rec + 2;
4232 info->name = spec->stream_name_analog;
4233 if (spec->alt_dac_nid) {
4234 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4235 *spec->stream_analog_alt_playback;
4236 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4239 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4240 alc_pcm_null_stream;
4241 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4243 if (spec->num_adc_nids > 1) {
4244 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4245 *spec->stream_analog_alt_capture;
4246 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4248 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4249 spec->num_adc_nids - 1;
4251 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4252 alc_pcm_null_stream;
4253 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4260 static inline void alc_shutup(struct hda_codec *codec)
4262 snd_hda_shutup_pins(codec);
4265 static void alc_free_kctls(struct hda_codec *codec)
4267 struct alc_spec *spec = codec->spec;
4269 if (spec->kctls.list) {
4270 struct snd_kcontrol_new *kctl = spec->kctls.list;
4272 for (i = 0; i < spec->kctls.used; i++)
4273 kfree(kctl[i].name);
4275 snd_array_free(&spec->kctls);
4278 static void alc_free(struct hda_codec *codec)
4280 struct alc_spec *spec = codec->spec;
4286 alc_free_kctls(codec);
4288 snd_hda_detach_beep_device(codec);
4291 #ifdef CONFIG_SND_HDA_POWER_SAVE
4292 static void alc_power_eapd(struct hda_codec *codec)
4294 /* We currently only handle front, HP */
4295 switch (codec->vendor_id) {
4297 set_eapd(codec, 0x0f, 0);
4298 set_eapd(codec, 0x10, 0);
4311 set_eapd(codec, 0x14, 0);
4312 set_eapd(codec, 0x15, 0);
4317 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4319 struct alc_spec *spec = codec->spec;
4321 if (spec && spec->power_hook)
4322 spec->power_hook(codec);
4327 #ifdef SND_HDA_NEEDS_RESUME
4328 static int alc_resume(struct hda_codec *codec)
4330 codec->patch_ops.init(codec);
4331 snd_hda_codec_resume_amp(codec);
4332 snd_hda_codec_resume_cache(codec);
4333 hda_call_check_power_status(codec, 0x01);
4340 static struct hda_codec_ops alc_patch_ops = {
4341 .build_controls = alc_build_controls,
4342 .build_pcms = alc_build_pcms,
4345 .unsol_event = alc_unsol_event,
4346 #ifdef SND_HDA_NEEDS_RESUME
4347 .resume = alc_resume,
4349 #ifdef CONFIG_SND_HDA_POWER_SAVE
4350 .suspend = alc_suspend,
4351 .check_power_status = alc_check_power_status,
4353 .reboot_notify = alc_shutup,
4356 /* replace the codec chip_name with the given string */
4357 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4359 kfree(codec->chip_name);
4360 codec->chip_name = kstrdup(name, GFP_KERNEL);
4361 if (!codec->chip_name) {
4369 * Test configuration for debugging
4371 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4374 #ifdef CONFIG_SND_DEBUG
4375 static hda_nid_t alc880_test_dac_nids[4] = {
4376 0x02, 0x03, 0x04, 0x05
4379 static struct hda_input_mux alc880_test_capture_source = {
4388 { "Surround", 0x6 },
4392 static struct hda_channel_mode alc880_test_modes[4] = {
4399 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4400 struct snd_ctl_elem_info *uinfo)
4402 static char *texts[] = {
4403 "N/A", "Line Out", "HP Out",
4404 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4406 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4408 uinfo->value.enumerated.items = 8;
4409 if (uinfo->value.enumerated.item >= 8)
4410 uinfo->value.enumerated.item = 7;
4411 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4415 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4416 struct snd_ctl_elem_value *ucontrol)
4418 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4419 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4420 unsigned int pin_ctl, item = 0;
4422 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4423 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4424 if (pin_ctl & AC_PINCTL_OUT_EN) {
4425 if (pin_ctl & AC_PINCTL_HP_EN)
4429 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4430 switch (pin_ctl & AC_PINCTL_VREFEN) {
4431 case AC_PINCTL_VREF_HIZ: item = 3; break;
4432 case AC_PINCTL_VREF_50: item = 4; break;
4433 case AC_PINCTL_VREF_GRD: item = 5; break;
4434 case AC_PINCTL_VREF_80: item = 6; break;
4435 case AC_PINCTL_VREF_100: item = 7; break;
4438 ucontrol->value.enumerated.item[0] = item;
4442 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4443 struct snd_ctl_elem_value *ucontrol)
4445 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4446 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4447 static unsigned int ctls[] = {
4448 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4449 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4450 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4451 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4452 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4453 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4455 unsigned int old_ctl, new_ctl;
4457 old_ctl = snd_hda_codec_read(codec, nid, 0,
4458 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4459 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4460 if (old_ctl != new_ctl) {
4462 snd_hda_codec_write_cache(codec, nid, 0,
4463 AC_VERB_SET_PIN_WIDGET_CONTROL,
4465 val = ucontrol->value.enumerated.item[0] >= 3 ?
4467 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4474 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4475 struct snd_ctl_elem_info *uinfo)
4477 static char *texts[] = {
4478 "Front", "Surround", "CLFE", "Side"
4480 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4482 uinfo->value.enumerated.items = 4;
4483 if (uinfo->value.enumerated.item >= 4)
4484 uinfo->value.enumerated.item = 3;
4485 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4489 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4490 struct snd_ctl_elem_value *ucontrol)
4492 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4493 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4496 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4497 ucontrol->value.enumerated.item[0] = sel & 3;
4501 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4502 struct snd_ctl_elem_value *ucontrol)
4504 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4505 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4508 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4509 if (ucontrol->value.enumerated.item[0] != sel) {
4510 sel = ucontrol->value.enumerated.item[0] & 3;
4511 snd_hda_codec_write_cache(codec, nid, 0,
4512 AC_VERB_SET_CONNECT_SEL, sel);
4518 #define PIN_CTL_TEST(xname,nid) { \
4519 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4521 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4522 .info = alc_test_pin_ctl_info, \
4523 .get = alc_test_pin_ctl_get, \
4524 .put = alc_test_pin_ctl_put, \
4525 .private_value = nid \
4528 #define PIN_SRC_TEST(xname,nid) { \
4529 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4531 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4532 .info = alc_test_pin_src_info, \
4533 .get = alc_test_pin_src_get, \
4534 .put = alc_test_pin_src_put, \
4535 .private_value = nid \
4538 static struct snd_kcontrol_new alc880_test_mixer[] = {
4539 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4540 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4541 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4542 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4543 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4544 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4545 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4546 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4547 PIN_CTL_TEST("Front Pin Mode", 0x14),
4548 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4549 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4550 PIN_CTL_TEST("Side Pin Mode", 0x17),
4551 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4552 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4553 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4554 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4555 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4556 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4557 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4558 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4559 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4560 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4561 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4562 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4563 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4564 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4565 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4566 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4567 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4568 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4570 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4571 .name = "Channel Mode",
4572 .info = alc_ch_mode_info,
4573 .get = alc_ch_mode_get,
4574 .put = alc_ch_mode_put,
4579 static struct hda_verb alc880_test_init_verbs[] = {
4580 /* Unmute inputs of 0x0c - 0x0f */
4581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4585 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4587 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4588 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4589 /* Vol output for 0x0c-0x0f */
4590 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4591 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4592 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4593 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4594 /* Set output pins 0x14-0x17 */
4595 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4596 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4597 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4598 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4599 /* Unmute output pins 0x14-0x17 */
4600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4601 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4602 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4603 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4604 /* Set input pins 0x18-0x1c */
4605 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4606 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4607 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4608 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4609 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4610 /* Mute input pins 0x18-0x1b */
4611 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4612 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4613 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4614 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4617 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4618 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4619 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4620 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4621 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4622 /* Analog input/passthru */
4623 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4635 static const char * const alc880_models[ALC880_MODEL_LAST] = {
4636 [ALC880_3ST] = "3stack",
4637 [ALC880_TCL_S700] = "tcl",
4638 [ALC880_3ST_DIG] = "3stack-digout",
4639 [ALC880_CLEVO] = "clevo",
4640 [ALC880_5ST] = "5stack",
4641 [ALC880_5ST_DIG] = "5stack-digout",
4642 [ALC880_W810] = "w810",
4643 [ALC880_Z71V] = "z71v",
4644 [ALC880_6ST] = "6stack",
4645 [ALC880_6ST_DIG] = "6stack-digout",
4646 [ALC880_ASUS] = "asus",
4647 [ALC880_ASUS_W1V] = "asus-w1v",
4648 [ALC880_ASUS_DIG] = "asus-dig",
4649 [ALC880_ASUS_DIG2] = "asus-dig2",
4650 [ALC880_UNIWILL_DIG] = "uniwill",
4651 [ALC880_UNIWILL_P53] = "uniwill-p53",
4652 [ALC880_FUJITSU] = "fujitsu",
4653 [ALC880_F1734] = "F1734",
4655 [ALC880_LG_LW] = "lg-lw",
4656 [ALC880_MEDION_RIM] = "medion",
4657 #ifdef CONFIG_SND_DEBUG
4658 [ALC880_TEST] = "test",
4660 [ALC880_AUTO] = "auto",
4663 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4664 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4665 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4666 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4667 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4668 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4669 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4670 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4671 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4672 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4673 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4674 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4675 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4676 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4677 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4678 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4679 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4680 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4681 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4682 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4683 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4684 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4685 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4686 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4687 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4688 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4689 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4690 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4691 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4692 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4693 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4694 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4695 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4696 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4697 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4698 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4699 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4700 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4701 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4702 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4703 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4704 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4705 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4706 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4707 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4708 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4709 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4710 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4711 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4712 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4713 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4714 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4715 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4716 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4717 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
4718 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4719 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4720 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4721 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4722 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4723 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4724 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4725 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4726 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4727 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4728 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4729 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4730 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4731 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4732 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4734 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4735 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4736 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4741 * ALC880 codec presets
4743 static struct alc_config_preset alc880_presets[] = {
4745 .mixers = { alc880_three_stack_mixer },
4746 .init_verbs = { alc880_volume_init_verbs,
4747 alc880_pin_3stack_init_verbs },
4748 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4749 .dac_nids = alc880_dac_nids,
4750 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4751 .channel_mode = alc880_threestack_modes,
4753 .input_mux = &alc880_capture_source,
4755 [ALC880_3ST_DIG] = {
4756 .mixers = { alc880_three_stack_mixer },
4757 .init_verbs = { alc880_volume_init_verbs,
4758 alc880_pin_3stack_init_verbs },
4759 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4760 .dac_nids = alc880_dac_nids,
4761 .dig_out_nid = ALC880_DIGOUT_NID,
4762 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4763 .channel_mode = alc880_threestack_modes,
4765 .input_mux = &alc880_capture_source,
4767 [ALC880_TCL_S700] = {
4768 .mixers = { alc880_tcl_s700_mixer },
4769 .init_verbs = { alc880_volume_init_verbs,
4770 alc880_pin_tcl_S700_init_verbs,
4771 alc880_gpio2_init_verbs },
4772 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4773 .dac_nids = alc880_dac_nids,
4774 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4775 .num_adc_nids = 1, /* single ADC */
4777 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4778 .channel_mode = alc880_2_jack_modes,
4779 .input_mux = &alc880_capture_source,
4782 .mixers = { alc880_three_stack_mixer,
4783 alc880_five_stack_mixer},
4784 .init_verbs = { alc880_volume_init_verbs,
4785 alc880_pin_5stack_init_verbs },
4786 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4787 .dac_nids = alc880_dac_nids,
4788 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4789 .channel_mode = alc880_fivestack_modes,
4790 .input_mux = &alc880_capture_source,
4792 [ALC880_5ST_DIG] = {
4793 .mixers = { alc880_three_stack_mixer,
4794 alc880_five_stack_mixer },
4795 .init_verbs = { alc880_volume_init_verbs,
4796 alc880_pin_5stack_init_verbs },
4797 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4798 .dac_nids = alc880_dac_nids,
4799 .dig_out_nid = ALC880_DIGOUT_NID,
4800 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4801 .channel_mode = alc880_fivestack_modes,
4802 .input_mux = &alc880_capture_source,
4805 .mixers = { alc880_six_stack_mixer },
4806 .init_verbs = { alc880_volume_init_verbs,
4807 alc880_pin_6stack_init_verbs },
4808 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4809 .dac_nids = alc880_6st_dac_nids,
4810 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4811 .channel_mode = alc880_sixstack_modes,
4812 .input_mux = &alc880_6stack_capture_source,
4814 [ALC880_6ST_DIG] = {
4815 .mixers = { alc880_six_stack_mixer },
4816 .init_verbs = { alc880_volume_init_verbs,
4817 alc880_pin_6stack_init_verbs },
4818 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4819 .dac_nids = alc880_6st_dac_nids,
4820 .dig_out_nid = ALC880_DIGOUT_NID,
4821 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4822 .channel_mode = alc880_sixstack_modes,
4823 .input_mux = &alc880_6stack_capture_source,
4826 .mixers = { alc880_w810_base_mixer },
4827 .init_verbs = { alc880_volume_init_verbs,
4828 alc880_pin_w810_init_verbs,
4829 alc880_gpio2_init_verbs },
4830 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4831 .dac_nids = alc880_w810_dac_nids,
4832 .dig_out_nid = ALC880_DIGOUT_NID,
4833 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4834 .channel_mode = alc880_w810_modes,
4835 .input_mux = &alc880_capture_source,
4838 .mixers = { alc880_z71v_mixer },
4839 .init_verbs = { alc880_volume_init_verbs,
4840 alc880_pin_z71v_init_verbs },
4841 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4842 .dac_nids = alc880_z71v_dac_nids,
4843 .dig_out_nid = ALC880_DIGOUT_NID,
4845 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4846 .channel_mode = alc880_2_jack_modes,
4847 .input_mux = &alc880_capture_source,
4850 .mixers = { alc880_f1734_mixer },
4851 .init_verbs = { alc880_volume_init_verbs,
4852 alc880_pin_f1734_init_verbs },
4853 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4854 .dac_nids = alc880_f1734_dac_nids,
4856 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4857 .channel_mode = alc880_2_jack_modes,
4858 .input_mux = &alc880_f1734_capture_source,
4859 .unsol_event = alc880_uniwill_p53_unsol_event,
4860 .setup = alc880_uniwill_p53_setup,
4861 .init_hook = alc_automute_amp,
4864 .mixers = { alc880_asus_mixer },
4865 .init_verbs = { alc880_volume_init_verbs,
4866 alc880_pin_asus_init_verbs,
4867 alc880_gpio1_init_verbs },
4868 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4869 .dac_nids = alc880_asus_dac_nids,
4870 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4871 .channel_mode = alc880_asus_modes,
4873 .input_mux = &alc880_capture_source,
4875 [ALC880_ASUS_DIG] = {
4876 .mixers = { alc880_asus_mixer },
4877 .init_verbs = { alc880_volume_init_verbs,
4878 alc880_pin_asus_init_verbs,
4879 alc880_gpio1_init_verbs },
4880 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4881 .dac_nids = alc880_asus_dac_nids,
4882 .dig_out_nid = ALC880_DIGOUT_NID,
4883 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4884 .channel_mode = alc880_asus_modes,
4886 .input_mux = &alc880_capture_source,
4888 [ALC880_ASUS_DIG2] = {
4889 .mixers = { alc880_asus_mixer },
4890 .init_verbs = { alc880_volume_init_verbs,
4891 alc880_pin_asus_init_verbs,
4892 alc880_gpio2_init_verbs }, /* use GPIO2 */
4893 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4894 .dac_nids = alc880_asus_dac_nids,
4895 .dig_out_nid = ALC880_DIGOUT_NID,
4896 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4897 .channel_mode = alc880_asus_modes,
4899 .input_mux = &alc880_capture_source,
4901 [ALC880_ASUS_W1V] = {
4902 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4903 .init_verbs = { alc880_volume_init_verbs,
4904 alc880_pin_asus_init_verbs,
4905 alc880_gpio1_init_verbs },
4906 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4907 .dac_nids = alc880_asus_dac_nids,
4908 .dig_out_nid = ALC880_DIGOUT_NID,
4909 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4910 .channel_mode = alc880_asus_modes,
4912 .input_mux = &alc880_capture_source,
4914 [ALC880_UNIWILL_DIG] = {
4915 .mixers = { alc880_asus_mixer },
4916 .init_verbs = { alc880_volume_init_verbs,
4917 alc880_pin_asus_init_verbs },
4918 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4919 .dac_nids = alc880_asus_dac_nids,
4920 .dig_out_nid = ALC880_DIGOUT_NID,
4921 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4922 .channel_mode = alc880_asus_modes,
4924 .input_mux = &alc880_capture_source,
4926 [ALC880_UNIWILL] = {
4927 .mixers = { alc880_uniwill_mixer },
4928 .init_verbs = { alc880_volume_init_verbs,
4929 alc880_uniwill_init_verbs },
4930 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4931 .dac_nids = alc880_asus_dac_nids,
4932 .dig_out_nid = ALC880_DIGOUT_NID,
4933 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4934 .channel_mode = alc880_threestack_modes,
4936 .input_mux = &alc880_capture_source,
4937 .unsol_event = alc880_uniwill_unsol_event,
4938 .setup = alc880_uniwill_setup,
4939 .init_hook = alc880_uniwill_init_hook,
4941 [ALC880_UNIWILL_P53] = {
4942 .mixers = { alc880_uniwill_p53_mixer },
4943 .init_verbs = { alc880_volume_init_verbs,
4944 alc880_uniwill_p53_init_verbs },
4945 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4946 .dac_nids = alc880_asus_dac_nids,
4947 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4948 .channel_mode = alc880_threestack_modes,
4949 .input_mux = &alc880_capture_source,
4950 .unsol_event = alc880_uniwill_p53_unsol_event,
4951 .setup = alc880_uniwill_p53_setup,
4952 .init_hook = alc_automute_amp,
4954 [ALC880_FUJITSU] = {
4955 .mixers = { alc880_fujitsu_mixer },
4956 .init_verbs = { alc880_volume_init_verbs,
4957 alc880_uniwill_p53_init_verbs,
4958 alc880_beep_init_verbs },
4959 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4960 .dac_nids = alc880_dac_nids,
4961 .dig_out_nid = ALC880_DIGOUT_NID,
4962 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4963 .channel_mode = alc880_2_jack_modes,
4964 .input_mux = &alc880_capture_source,
4965 .unsol_event = alc880_uniwill_p53_unsol_event,
4966 .setup = alc880_uniwill_p53_setup,
4967 .init_hook = alc_automute_amp,
4970 .mixers = { alc880_three_stack_mixer },
4971 .init_verbs = { alc880_volume_init_verbs,
4972 alc880_pin_clevo_init_verbs },
4973 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4974 .dac_nids = alc880_dac_nids,
4976 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4977 .channel_mode = alc880_threestack_modes,
4979 .input_mux = &alc880_capture_source,
4982 .mixers = { alc880_lg_mixer },
4983 .init_verbs = { alc880_volume_init_verbs,
4984 alc880_lg_init_verbs },
4985 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4986 .dac_nids = alc880_lg_dac_nids,
4987 .dig_out_nid = ALC880_DIGOUT_NID,
4988 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4989 .channel_mode = alc880_lg_ch_modes,
4991 .input_mux = &alc880_lg_capture_source,
4992 .unsol_event = alc_automute_amp_unsol_event,
4993 .setup = alc880_lg_setup,
4994 .init_hook = alc_automute_amp,
4995 #ifdef CONFIG_SND_HDA_POWER_SAVE
4996 .loopbacks = alc880_lg_loopbacks,
5000 .mixers = { alc880_lg_lw_mixer },
5001 .init_verbs = { alc880_volume_init_verbs,
5002 alc880_lg_lw_init_verbs },
5003 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5004 .dac_nids = alc880_dac_nids,
5005 .dig_out_nid = ALC880_DIGOUT_NID,
5006 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
5007 .channel_mode = alc880_lg_lw_modes,
5008 .input_mux = &alc880_lg_lw_capture_source,
5009 .unsol_event = alc_automute_amp_unsol_event,
5010 .setup = alc880_lg_lw_setup,
5011 .init_hook = alc_automute_amp,
5013 [ALC880_MEDION_RIM] = {
5014 .mixers = { alc880_medion_rim_mixer },
5015 .init_verbs = { alc880_volume_init_verbs,
5016 alc880_medion_rim_init_verbs,
5017 alc_gpio2_init_verbs },
5018 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5019 .dac_nids = alc880_dac_nids,
5020 .dig_out_nid = ALC880_DIGOUT_NID,
5021 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5022 .channel_mode = alc880_2_jack_modes,
5023 .input_mux = &alc880_medion_rim_capture_source,
5024 .unsol_event = alc880_medion_rim_unsol_event,
5025 .setup = alc880_medion_rim_setup,
5026 .init_hook = alc880_medion_rim_automute,
5028 #ifdef CONFIG_SND_DEBUG
5030 .mixers = { alc880_test_mixer },
5031 .init_verbs = { alc880_test_init_verbs },
5032 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
5033 .dac_nids = alc880_test_dac_nids,
5034 .dig_out_nid = ALC880_DIGOUT_NID,
5035 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
5036 .channel_mode = alc880_test_modes,
5037 .input_mux = &alc880_test_capture_source,
5043 * Automatic parse of I/O pins from the BIOS configuration
5048 ALC_CTL_WIDGET_MUTE,
5051 static struct snd_kcontrol_new alc880_control_templates[] = {
5052 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
5053 HDA_CODEC_MUTE(NULL, 0, 0, 0),
5054 HDA_BIND_MUTE(NULL, 0, 0, 0),
5057 /* add dynamic controls */
5058 static int add_control(struct alc_spec *spec, int type, const char *name,
5059 int cidx, unsigned long val)
5061 struct snd_kcontrol_new *knew;
5063 snd_array_init(&spec->kctls, sizeof(*knew), 32);
5064 knew = snd_array_new(&spec->kctls);
5067 *knew = alc880_control_templates[type];
5068 knew->name = kstrdup(name, GFP_KERNEL);
5072 if (get_amp_nid_(val))
5073 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
5074 knew->private_value = val;
5078 static int add_control_with_pfx(struct alc_spec *spec, int type,
5079 const char *pfx, const char *dir,
5080 const char *sfx, int cidx, unsigned long val)
5083 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
5084 return add_control(spec, type, name, cidx, val);
5087 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5088 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5089 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5090 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5091 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5092 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5093 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5094 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5096 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5097 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5098 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5099 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5100 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5101 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5102 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5103 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5104 #define ALC880_PIN_CD_NID 0x1c
5106 /* fill in the dac_nids table from the parsed pin configuration */
5107 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
5108 const struct auto_pin_cfg *cfg)
5114 memset(assigned, 0, sizeof(assigned));
5115 spec->multiout.dac_nids = spec->private_dac_nids;
5117 /* check the pins hardwired to audio widget */
5118 for (i = 0; i < cfg->line_outs; i++) {
5119 nid = cfg->line_out_pins[i];
5120 if (alc880_is_fixed_pin(nid)) {
5121 int idx = alc880_fixed_pin_idx(nid);
5122 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
5126 /* left pins can be connect to any audio widget */
5127 for (i = 0; i < cfg->line_outs; i++) {
5128 nid = cfg->line_out_pins[i];
5129 if (alc880_is_fixed_pin(nid))
5131 /* search for an empty channel */
5132 for (j = 0; j < cfg->line_outs; j++) {
5134 spec->multiout.dac_nids[i] =
5135 alc880_idx_to_dac(j);
5141 spec->multiout.num_dacs = cfg->line_outs;
5145 static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5148 if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5151 switch (cfg->line_out_type) {
5152 case AUTO_PIN_SPEAKER_OUT:
5154 case AUTO_PIN_HP_OUT:
5157 if (cfg->line_outs == 1)
5164 /* add playback controls from the parsed DAC table */
5165 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5166 const struct auto_pin_cfg *cfg)
5168 static const char * const chname[4] = {
5169 "Front", "Surround", NULL /*CLFE*/, "Side"
5171 const char *pfx = alc_get_line_out_pfx(cfg, false);
5175 for (i = 0; i < cfg->line_outs; i++) {
5176 if (!spec->multiout.dac_nids[i])
5178 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5179 if (!pfx && i == 2) {
5181 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5183 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5187 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5189 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5193 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5195 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5199 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5201 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5206 const char *name = pfx;
5209 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5211 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5215 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5217 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5226 /* add playback controls for speaker and HP outputs */
5227 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5236 if (alc880_is_fixed_pin(pin)) {
5237 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5238 /* specify the DAC as the extra output */
5239 if (!spec->multiout.hp_nid)
5240 spec->multiout.hp_nid = nid;
5242 spec->multiout.extra_out_nid[0] = nid;
5243 /* control HP volume/switch on the output mixer amp */
5244 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5245 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5246 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5249 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5250 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5253 } else if (alc880_is_multi_pin(pin)) {
5254 /* set manual connection */
5255 /* we have only a switch on HP-out PIN */
5256 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5257 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5264 /* create input playback/capture controls for the given pin */
5265 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5266 const char *ctlname, int ctlidx,
5267 int idx, hda_nid_t mix_nid)
5271 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5272 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5275 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5276 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5282 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5284 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5285 return (pincap & AC_PINCAP_IN) != 0;
5288 /* create playback/capture controls for input pins */
5289 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5290 const struct auto_pin_cfg *cfg,
5292 hda_nid_t cap1, hda_nid_t cap2)
5294 struct alc_spec *spec = codec->spec;
5295 struct hda_input_mux *imux = &spec->private_imux[0];
5296 int i, err, idx, type_idx = 0;
5297 const char *prev_label = NULL;
5299 for (i = 0; i < cfg->num_inputs; i++) {
5303 pin = cfg->inputs[i].pin;
5304 if (!alc_is_input_pin(codec, pin))
5307 label = hda_get_autocfg_input_label(codec, cfg, i);
5308 if (prev_label && !strcmp(label, prev_label))
5315 idx = get_connection_index(codec, mixer, pin);
5317 err = new_analog_input(spec, pin,
5327 idx = get_connection_index(codec, cap1, pin);
5328 if (idx < 0 && cap2)
5329 idx = get_connection_index(codec, cap2, pin);
5331 snd_hda_add_imux_item(imux, label, idx, NULL);
5336 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5337 const struct auto_pin_cfg *cfg)
5339 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5342 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5343 unsigned int pin_type)
5345 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5348 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5352 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5353 hda_nid_t nid, int pin_type,
5356 alc_set_pin_output(codec, nid, pin_type);
5357 /* need the manual connection? */
5358 if (alc880_is_multi_pin(nid)) {
5359 struct alc_spec *spec = codec->spec;
5360 int idx = alc880_multi_pin_idx(nid);
5361 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5362 AC_VERB_SET_CONNECT_SEL,
5363 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5367 static int get_pin_type(int line_out_type)
5369 if (line_out_type == AUTO_PIN_HP_OUT)
5375 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5377 struct alc_spec *spec = codec->spec;
5380 for (i = 0; i < spec->autocfg.line_outs; i++) {
5381 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5382 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5383 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5387 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5389 struct alc_spec *spec = codec->spec;
5392 pin = spec->autocfg.speaker_pins[0];
5393 if (pin) /* connect to front */
5394 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5395 pin = spec->autocfg.hp_pins[0];
5396 if (pin) /* connect to front */
5397 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5400 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5402 struct alc_spec *spec = codec->spec;
5403 struct auto_pin_cfg *cfg = &spec->autocfg;
5406 for (i = 0; i < cfg->num_inputs; i++) {
5407 hda_nid_t nid = cfg->inputs[i].pin;
5408 if (alc_is_input_pin(codec, nid)) {
5409 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5410 if (nid != ALC880_PIN_CD_NID &&
5411 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5412 snd_hda_codec_write(codec, nid, 0,
5413 AC_VERB_SET_AMP_GAIN_MUTE,
5419 static void alc880_auto_init_input_src(struct hda_codec *codec)
5421 struct alc_spec *spec = codec->spec;
5424 for (c = 0; c < spec->num_adc_nids; c++) {
5425 unsigned int mux_idx;
5426 const struct hda_input_mux *imux;
5427 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5428 imux = &spec->input_mux[mux_idx];
5429 if (!imux->num_items && mux_idx > 0)
5430 imux = &spec->input_mux[0];
5432 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5433 AC_VERB_SET_CONNECT_SEL,
5434 imux->items[0].index);
5438 /* parse the BIOS configuration and set up the alc_spec */
5439 /* return 1 if successful, 0 if the proper config is not found,
5440 * or a negative error code
5442 static int alc880_parse_auto_config(struct hda_codec *codec)
5444 struct alc_spec *spec = codec->spec;
5446 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5448 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5452 if (!spec->autocfg.line_outs)
5453 return 0; /* can't find valid BIOS pin config */
5455 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5458 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5461 err = alc880_auto_create_extra_out(spec,
5462 spec->autocfg.speaker_pins[0],
5466 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5470 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5474 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5476 alc_auto_parse_digital(codec);
5478 if (spec->kctls.list)
5479 add_mixer(spec, spec->kctls.list);
5481 add_verb(spec, alc880_volume_init_verbs);
5483 spec->num_mux_defs = 1;
5484 spec->input_mux = &spec->private_imux[0];
5486 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5491 /* additional initialization for auto-configuration model */
5492 static void alc880_auto_init(struct hda_codec *codec)
5494 struct alc_spec *spec = codec->spec;
5495 alc880_auto_init_multi_out(codec);
5496 alc880_auto_init_extra_out(codec);
5497 alc880_auto_init_analog_input(codec);
5498 alc880_auto_init_input_src(codec);
5499 alc_auto_init_digital(codec);
5500 if (spec->unsol_event)
5501 alc_inithook(codec);
5504 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5505 * one of two digital mic pins, e.g. on ALC272
5507 static void fixup_automic_adc(struct hda_codec *codec)
5509 struct alc_spec *spec = codec->spec;
5512 for (i = 0; i < spec->num_adc_nids; i++) {
5513 hda_nid_t cap = spec->capsrc_nids ?
5514 spec->capsrc_nids[i] : spec->adc_nids[i];
5517 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5520 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5523 spec->int_mic.mux_idx = iidx;
5524 spec->ext_mic.mux_idx = eidx;
5525 if (spec->capsrc_nids)
5526 spec->capsrc_nids += i;
5527 spec->adc_nids += i;
5528 spec->num_adc_nids = 1;
5531 snd_printd(KERN_INFO "hda_codec: %s: "
5532 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5533 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5534 spec->auto_mic = 0; /* disable auto-mic to be sure */
5537 /* select or unmute the given capsrc route */
5538 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5541 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5542 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5545 snd_hda_codec_write_cache(codec, cap, 0,
5546 AC_VERB_SET_CONNECT_SEL, idx);
5550 /* set the default connection to that pin */
5551 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5553 struct alc_spec *spec = codec->spec;
5556 for (i = 0; i < spec->num_adc_nids; i++) {
5557 hda_nid_t cap = spec->capsrc_nids ?
5558 spec->capsrc_nids[i] : spec->adc_nids[i];
5561 idx = get_connection_index(codec, cap, pin);
5564 select_or_unmute_capsrc(codec, cap, idx);
5565 return i; /* return the found index */
5567 return -1; /* not found */
5570 /* choose the ADC/MUX containing the input pin and initialize the setup */
5571 static void fixup_single_adc(struct hda_codec *codec)
5573 struct alc_spec *spec = codec->spec;
5574 struct auto_pin_cfg *cfg = &spec->autocfg;
5577 /* search for the input pin; there must be only one */
5578 if (cfg->num_inputs != 1)
5580 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5582 /* use only this ADC */
5583 if (spec->capsrc_nids)
5584 spec->capsrc_nids += i;
5585 spec->adc_nids += i;
5586 spec->num_adc_nids = 1;
5590 /* initialize dual adcs */
5591 static void fixup_dual_adc_switch(struct hda_codec *codec)
5593 struct alc_spec *spec = codec->spec;
5594 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5595 init_capsrc_for_pin(codec, spec->int_mic.pin);
5598 static void set_capture_mixer(struct hda_codec *codec)
5600 struct alc_spec *spec = codec->spec;
5601 static struct snd_kcontrol_new *caps[2][3] = {
5602 { alc_capture_mixer_nosrc1,
5603 alc_capture_mixer_nosrc2,
5604 alc_capture_mixer_nosrc3 },
5605 { alc_capture_mixer1,
5607 alc_capture_mixer3 },
5609 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5611 int num_adcs = spec->num_adc_nids;
5612 if (spec->dual_adc_switch)
5613 fixup_dual_adc_switch(codec);
5614 else if (spec->auto_mic)
5615 fixup_automic_adc(codec);
5616 else if (spec->input_mux) {
5617 if (spec->input_mux->num_items > 1)
5619 else if (spec->input_mux->num_items == 1)
5620 fixup_single_adc(codec);
5622 if (spec->dual_adc_switch)
5624 spec->cap_mixer = caps[mux][num_adcs - 1];
5628 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5629 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5632 struct alc_spec *spec = codec->spec;
5633 struct auto_pin_cfg *cfg = &spec->autocfg;
5635 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5637 for (n = 0; n < num_nids; n++) {
5639 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5643 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5646 nconns = snd_hda_get_connections(codec, cap, conn,
5650 nconns = snd_hda_get_connections(codec, cap, conn,
5655 if (!fallback_adc) {
5659 for (i = 0; i < cfg->num_inputs; i++) {
5660 hda_nid_t nid = cfg->inputs[i].pin;
5661 for (j = 0; j < nconns; j++) {
5668 if (i >= cfg->num_inputs) {
5669 int num_adcs = spec->num_adc_nids;
5670 spec->private_adc_nids[num_adcs] = adc;
5671 spec->private_capsrc_nids[num_adcs] = cap;
5672 spec->num_adc_nids++;
5673 spec->adc_nids = spec->private_adc_nids;
5675 spec->capsrc_nids = spec->private_capsrc_nids;
5678 if (!spec->num_adc_nids) {
5679 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5680 " using fallback 0x%x\n",
5681 codec->chip_name, fallback_adc);
5682 spec->private_adc_nids[0] = fallback_adc;
5683 spec->adc_nids = spec->private_adc_nids;
5684 if (fallback_adc != fallback_cap) {
5685 spec->private_capsrc_nids[0] = fallback_cap;
5686 spec->capsrc_nids = spec->private_adc_nids;
5691 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5692 #define set_beep_amp(spec, nid, idx, dir) \
5693 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5695 static struct snd_pci_quirk beep_white_list[] = {
5696 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5697 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5698 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5702 static inline int has_cdefine_beep(struct hda_codec *codec)
5704 struct alc_spec *spec = codec->spec;
5705 const struct snd_pci_quirk *q;
5706 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5709 return spec->cdefine.enable_pcbeep;
5712 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5713 #define has_cdefine_beep(codec) 0
5717 * OK, here we have finally the patch for ALC880
5720 static int patch_alc880(struct hda_codec *codec)
5722 struct alc_spec *spec;
5726 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5732 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5735 if (board_config < 0) {
5736 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5738 board_config = ALC880_AUTO;
5741 if (board_config == ALC880_AUTO) {
5742 /* automatic parse from the BIOS config */
5743 err = alc880_parse_auto_config(codec);
5749 "hda_codec: Cannot set up configuration "
5750 "from BIOS. Using 3-stack mode...\n");
5751 board_config = ALC880_3ST;
5755 err = snd_hda_attach_beep_device(codec, 0x1);
5761 if (board_config != ALC880_AUTO)
5762 setup_preset(codec, &alc880_presets[board_config]);
5764 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5765 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5766 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5768 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5769 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5771 if (!spec->adc_nids && spec->input_mux) {
5772 /* check whether NID 0x07 is valid */
5773 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5775 wcap = get_wcaps_type(wcap);
5776 if (wcap != AC_WID_AUD_IN) {
5777 spec->adc_nids = alc880_adc_nids_alt;
5778 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5780 spec->adc_nids = alc880_adc_nids;
5781 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5784 set_capture_mixer(codec);
5785 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5787 spec->vmaster_nid = 0x0c;
5789 codec->patch_ops = alc_patch_ops;
5790 if (board_config == ALC880_AUTO)
5791 spec->init_hook = alc880_auto_init;
5792 #ifdef CONFIG_SND_HDA_POWER_SAVE
5793 if (!spec->loopback.amplist)
5794 spec->loopback.amplist = alc880_loopbacks;
5805 static hda_nid_t alc260_dac_nids[1] = {
5810 static hda_nid_t alc260_adc_nids[1] = {
5815 static hda_nid_t alc260_adc_nids_alt[1] = {
5820 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5821 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5823 static hda_nid_t alc260_dual_adc_nids[2] = {
5828 #define ALC260_DIGOUT_NID 0x03
5829 #define ALC260_DIGIN_NID 0x06
5831 static struct hda_input_mux alc260_capture_source = {
5835 { "Front Mic", 0x1 },
5841 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5842 * headphone jack and the internal CD lines since these are the only pins at
5843 * which audio can appear. For flexibility, also allow the option of
5844 * recording the mixer output on the second ADC (ADC0 doesn't have a
5845 * connection to the mixer output).
5847 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5851 { "Mic/Line", 0x0 },
5853 { "Headphone", 0x2 },
5859 { "Mic/Line", 0x0 },
5861 { "Headphone", 0x2 },
5868 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5869 * the Fujitsu S702x, but jacks are marked differently.
5871 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5878 { "Headphone", 0x5 },
5887 { "Headphone", 0x6 },
5893 /* Maxdata Favorit 100XS */
5894 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5898 { "Line/Mic", 0x0 },
5905 { "Line/Mic", 0x0 },
5913 * This is just place-holder, so there's something for alc_build_pcms to look
5914 * at when it calculates the maximum number of channels. ALC260 has no mixer
5915 * element which allows changing the channel mode, so the verb list is
5918 static struct hda_channel_mode alc260_modes[1] = {
5923 /* Mixer combinations
5925 * basic: base_output + input + pc_beep + capture
5926 * HP: base_output + input + capture_alt
5927 * HP_3013: hp_3013 + input + capture
5928 * fujitsu: fujitsu + capture
5929 * acer: acer + capture
5932 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5933 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5934 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5935 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5936 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5937 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5938 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5942 static struct snd_kcontrol_new alc260_input_mixer[] = {
5943 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5944 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5945 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5946 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5948 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5949 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5950 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5954 /* update HP, line and mono out pins according to the master switch */
5955 static void alc260_hp_master_update(struct hda_codec *codec,
5956 hda_nid_t hp, hda_nid_t line,
5959 struct alc_spec *spec = codec->spec;
5960 unsigned int val = spec->master_sw ? PIN_HP : 0;
5961 /* change HP and line-out pins */
5962 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5964 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5966 /* mono (speaker) depending on the HP jack sense */
5967 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5968 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5972 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5973 struct snd_ctl_elem_value *ucontrol)
5975 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5976 struct alc_spec *spec = codec->spec;
5977 *ucontrol->value.integer.value = spec->master_sw;
5981 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5982 struct snd_ctl_elem_value *ucontrol)
5984 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5985 struct alc_spec *spec = codec->spec;
5986 int val = !!*ucontrol->value.integer.value;
5987 hda_nid_t hp, line, mono;
5989 if (val == spec->master_sw)
5991 spec->master_sw = val;
5992 hp = (kcontrol->private_value >> 16) & 0xff;
5993 line = (kcontrol->private_value >> 8) & 0xff;
5994 mono = kcontrol->private_value & 0xff;
5995 alc260_hp_master_update(codec, hp, line, mono);
5999 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
6001 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6002 .name = "Master Playback Switch",
6003 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6004 .info = snd_ctl_boolean_mono_info,
6005 .get = alc260_hp_master_sw_get,
6006 .put = alc260_hp_master_sw_put,
6007 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
6009 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6010 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
6011 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6012 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
6013 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6015 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6019 static struct hda_verb alc260_hp_unsol_verbs[] = {
6020 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6024 static void alc260_hp_automute(struct hda_codec *codec)
6026 struct alc_spec *spec = codec->spec;
6028 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
6029 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
6032 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
6034 if ((res >> 26) == ALC880_HP_EVENT)
6035 alc260_hp_automute(codec);
6038 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
6040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6041 .name = "Master Playback Switch",
6042 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6043 .info = snd_ctl_boolean_mono_info,
6044 .get = alc260_hp_master_sw_get,
6045 .put = alc260_hp_master_sw_put,
6046 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
6048 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6049 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6050 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
6051 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
6052 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6053 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6054 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6055 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
6059 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6060 .ops = &snd_hda_bind_vol,
6062 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
6063 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
6064 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
6069 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
6070 .ops = &snd_hda_bind_sw,
6072 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
6073 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
6078 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6079 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6080 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6081 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
6082 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6086 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6087 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6091 static void alc260_hp_3013_automute(struct hda_codec *codec)
6093 struct alc_spec *spec = codec->spec;
6095 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
6096 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
6099 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
6102 if ((res >> 26) == ALC880_HP_EVENT)
6103 alc260_hp_3013_automute(codec);
6106 static void alc260_hp_3012_automute(struct hda_codec *codec)
6108 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6110 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6112 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6114 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6118 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6121 if ((res >> 26) == ALC880_HP_EVENT)
6122 alc260_hp_3012_automute(codec);
6125 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6126 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6128 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6129 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6130 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6131 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6132 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6133 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6134 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6135 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6136 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6137 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6138 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6142 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6143 * versions of the ALC260 don't act on requests to enable mic bias from NID
6144 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6145 * datasheet doesn't mention this restriction. At this stage it's not clear
6146 * whether this behaviour is intentional or is a hardware bug in chip
6147 * revisions available in early 2006. Therefore for now allow the
6148 * "Headphone Jack Mode" control to span all choices, but if it turns out
6149 * that the lack of mic bias for this NID is intentional we could change the
6150 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6152 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6153 * don't appear to make the mic bias available from the "line" jack, even
6154 * though the NID used for this jack (0x14) can supply it. The theory is
6155 * that perhaps Acer have included blocking capacitors between the ALC260
6156 * and the output jack. If this turns out to be the case for all such
6157 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6158 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6160 * The C20x Tablet series have a mono internal speaker which is controlled
6161 * via the chip's Mono sum widget and pin complex, so include the necessary
6162 * controls for such models. On models without a "mono speaker" the control
6163 * won't do anything.
6165 static struct snd_kcontrol_new alc260_acer_mixer[] = {
6166 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6167 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6168 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6169 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6171 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6173 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6174 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6175 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6176 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6177 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6178 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6179 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6180 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6184 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6186 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6187 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6188 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6189 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6190 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6191 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6192 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6196 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6197 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6199 static struct snd_kcontrol_new alc260_will_mixer[] = {
6200 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6201 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6203 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6204 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6205 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6206 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6207 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6208 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6209 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6213 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6214 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6216 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6217 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6218 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6220 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6221 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6222 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6223 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6224 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6225 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6226 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6231 * initialization verbs
6233 static struct hda_verb alc260_init_verbs[] = {
6234 /* Line In pin widget for input */
6235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6236 /* CD pin widget for input */
6237 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6238 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6239 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6240 /* Mic2 (front panel) pin widget for input and vref at 80% */
6241 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6242 /* LINE-2 is used for line-out in rear */
6243 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6244 /* select line-out */
6245 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6247 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6249 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6251 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6252 /* mute capture amp left and right */
6253 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6254 /* set connection select to line in (default select for this ADC) */
6255 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6256 /* mute capture amp left and right */
6257 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6258 /* set connection select to line in (default select for this ADC) */
6259 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6260 /* set vol=0 Line-Out mixer amp left and right */
6261 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6262 /* unmute pin widget amp left and right (no gain on this amp) */
6263 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6264 /* set vol=0 HP mixer amp left and right */
6265 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6266 /* unmute pin widget amp left and right (no gain on this amp) */
6267 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6268 /* set vol=0 Mono mixer amp left and right */
6269 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6270 /* unmute pin widget amp left and right (no gain on this amp) */
6271 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6272 /* unmute LINE-2 out pin */
6273 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6274 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6277 /* mute analog inputs */
6278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6281 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6282 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6283 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6284 /* mute Front out path */
6285 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6286 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6287 /* mute Headphone out path */
6288 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6289 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6290 /* mute Mono out path */
6291 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6292 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6296 #if 0 /* should be identical with alc260_init_verbs? */
6297 static struct hda_verb alc260_hp_init_verbs[] = {
6298 /* Headphone and output */
6299 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6301 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6302 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6303 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6304 /* Mic2 (front panel) pin widget for input and vref at 80% */
6305 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6306 /* Line In pin widget for input */
6307 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6308 /* Line-2 pin widget for output */
6309 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6310 /* CD pin widget for input */
6311 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6312 /* unmute amp left and right */
6313 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6314 /* set connection select to line in (default select for this ADC) */
6315 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6316 /* unmute Line-Out mixer amp left and right (volume = 0) */
6317 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6318 /* mute pin widget amp left and right (no gain on this amp) */
6319 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6320 /* unmute HP mixer amp left and right (volume = 0) */
6321 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6322 /* mute pin widget amp left and right (no gain on this amp) */
6323 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6324 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6327 /* mute analog inputs */
6328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6333 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6334 /* Unmute Front out path */
6335 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6336 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6337 /* Unmute Headphone out path */
6338 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6339 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6340 /* Unmute Mono out path */
6341 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6342 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6347 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6348 /* Line out and output */
6349 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6351 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6352 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6353 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6354 /* Mic2 (front panel) pin widget for input and vref at 80% */
6355 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6356 /* Line In pin widget for input */
6357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6358 /* Headphone pin widget for output */
6359 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6360 /* CD pin widget for input */
6361 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6362 /* unmute amp left and right */
6363 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6364 /* set connection select to line in (default select for this ADC) */
6365 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6366 /* unmute Line-Out mixer amp left and right (volume = 0) */
6367 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6368 /* mute pin widget amp left and right (no gain on this amp) */
6369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6370 /* unmute HP mixer amp left and right (volume = 0) */
6371 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6372 /* mute pin widget amp left and right (no gain on this amp) */
6373 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6374 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6377 /* mute analog inputs */
6378 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6379 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6380 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6381 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6382 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6383 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6384 /* Unmute Front out path */
6385 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6386 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6387 /* Unmute Headphone out path */
6388 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6389 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6390 /* Unmute Mono out path */
6391 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6392 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6396 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6397 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6398 * audio = 0x16, internal speaker = 0x10.
6400 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6401 /* Disable all GPIOs */
6402 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6403 /* Internal speaker is connected to headphone pin */
6404 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6405 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6406 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6407 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6408 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6409 /* Ensure all other unused pins are disabled and muted. */
6410 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6411 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6412 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6413 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6414 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6415 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6416 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6417 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6419 /* Disable digital (SPDIF) pins */
6420 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6421 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6423 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6424 * when acting as an output.
6426 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6428 /* Start with output sum widgets muted and their output gains at min */
6429 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6430 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6431 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6432 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6433 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6434 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6435 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6436 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6437 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6439 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6440 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6441 /* Unmute Line1 pin widget output buffer since it starts as an output.
6442 * If the pin mode is changed by the user the pin mode control will
6443 * take care of enabling the pin's input/output buffers as needed.
6444 * Therefore there's no need to enable the input buffer at this
6447 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6448 /* Unmute input buffer of pin widget used for Line-in (no equiv
6451 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6453 /* Mute capture amp left and right */
6454 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6455 /* Set ADC connection select to match default mixer setting - line
6458 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6460 /* Do the same for the second ADC: mute capture input amp and
6461 * set ADC connection to line in (on mic1 pin)
6463 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6464 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6466 /* Mute all inputs to mixer widget (even unconnected ones) */
6467 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6468 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6469 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6470 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6471 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6472 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6474 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6479 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6480 * similar laptops (adapted from Fujitsu init verbs).
6482 static struct hda_verb alc260_acer_init_verbs[] = {
6483 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6484 * the headphone jack. Turn this on and rely on the standard mute
6485 * methods whenever the user wants to turn these outputs off.
6487 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6488 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6489 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6490 /* Internal speaker/Headphone jack is connected to Line-out pin */
6491 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6492 /* Internal microphone/Mic jack is connected to Mic1 pin */
6493 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6494 /* Line In jack is connected to Line1 pin */
6495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6496 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6497 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6498 /* Ensure all other unused pins are disabled and muted. */
6499 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6500 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6501 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6502 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6505 /* Disable digital (SPDIF) pins */
6506 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6507 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6509 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6510 * bus when acting as outputs.
6512 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6513 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6515 /* Start with output sum widgets muted and their output gains at min */
6516 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6517 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6518 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6519 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6520 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6521 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6522 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6523 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6524 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6526 /* Unmute Line-out pin widget amp left and right
6527 * (no equiv mixer ctrl)
6529 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6530 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6531 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6532 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6533 * inputs. If the pin mode is changed by the user the pin mode control
6534 * will take care of enabling the pin's input/output buffers as needed.
6535 * Therefore there's no need to enable the input buffer at this
6538 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6539 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6541 /* Mute capture amp left and right */
6542 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6543 /* Set ADC connection select to match default mixer setting - mic
6546 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6548 /* Do similar with the second ADC: mute capture input amp and
6549 * set ADC connection to mic to match ALSA's default state.
6551 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6552 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6554 /* Mute all inputs to mixer widget (even unconnected ones) */
6555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6556 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6557 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6558 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6559 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6560 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6561 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6562 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6567 /* Initialisation sequence for Maxdata Favorit 100XS
6568 * (adapted from Acer init verbs).
6570 static struct hda_verb alc260_favorit100_init_verbs[] = {
6571 /* GPIO 0 enables the output jack.
6572 * Turn this on and rely on the standard mute
6573 * methods whenever the user wants to turn these outputs off.
6575 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6576 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6577 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6578 /* Line/Mic input jack is connected to Mic1 pin */
6579 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6580 /* Ensure all other unused pins are disabled and muted. */
6581 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6582 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6583 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6584 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6585 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6586 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6587 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6588 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6589 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6590 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6591 /* Disable digital (SPDIF) pins */
6592 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6593 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6595 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6596 * bus when acting as outputs.
6598 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6599 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6601 /* Start with output sum widgets muted and their output gains at min */
6602 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6603 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6604 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6605 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6606 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6607 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6608 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6609 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6610 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6612 /* Unmute Line-out pin widget amp left and right
6613 * (no equiv mixer ctrl)
6615 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6616 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6617 * inputs. If the pin mode is changed by the user the pin mode control
6618 * will take care of enabling the pin's input/output buffers as needed.
6619 * Therefore there's no need to enable the input buffer at this
6622 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6624 /* Mute capture amp left and right */
6625 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6626 /* Set ADC connection select to match default mixer setting - mic
6629 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6631 /* Do similar with the second ADC: mute capture input amp and
6632 * set ADC connection to mic to match ALSA's default state.
6634 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6635 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6637 /* Mute all inputs to mixer widget (even unconnected ones) */
6638 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6640 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6641 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6642 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6643 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6644 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6645 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6650 static struct hda_verb alc260_will_verbs[] = {
6651 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6652 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6653 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6654 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6655 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6656 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6660 static struct hda_verb alc260_replacer_672v_verbs[] = {
6661 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6662 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6663 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6665 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6666 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6667 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6669 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6673 /* toggle speaker-output according to the hp-jack state */
6674 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6676 unsigned int present;
6678 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6679 present = snd_hda_jack_detect(codec, 0x0f);
6681 snd_hda_codec_write_cache(codec, 0x01, 0,
6682 AC_VERB_SET_GPIO_DATA, 1);
6683 snd_hda_codec_write_cache(codec, 0x0f, 0,
6684 AC_VERB_SET_PIN_WIDGET_CONTROL,
6687 snd_hda_codec_write_cache(codec, 0x01, 0,
6688 AC_VERB_SET_GPIO_DATA, 0);
6689 snd_hda_codec_write_cache(codec, 0x0f, 0,
6690 AC_VERB_SET_PIN_WIDGET_CONTROL,
6695 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6698 if ((res >> 26) == ALC880_HP_EVENT)
6699 alc260_replacer_672v_automute(codec);
6702 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6703 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6704 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6705 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6706 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6707 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6708 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6709 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6710 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6711 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6712 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6716 /* Test configuration for debugging, modelled after the ALC880 test
6719 #ifdef CONFIG_SND_DEBUG
6720 static hda_nid_t alc260_test_dac_nids[1] = {
6723 static hda_nid_t alc260_test_adc_nids[2] = {
6726 /* For testing the ALC260, each input MUX needs its own definition since
6727 * the signal assignments are different. This assumes that the first ADC
6730 static struct hda_input_mux alc260_test_capture_sources[2] = {
6734 { "MIC1 pin", 0x0 },
6735 { "MIC2 pin", 0x1 },
6736 { "LINE1 pin", 0x2 },
6737 { "LINE2 pin", 0x3 },
6739 { "LINE-OUT pin", 0x5 },
6740 { "HP-OUT pin", 0x6 },
6746 { "MIC1 pin", 0x0 },
6747 { "MIC2 pin", 0x1 },
6748 { "LINE1 pin", 0x2 },
6749 { "LINE2 pin", 0x3 },
6752 { "LINE-OUT pin", 0x6 },
6753 { "HP-OUT pin", 0x7 },
6757 static struct snd_kcontrol_new alc260_test_mixer[] = {
6758 /* Output driver widgets */
6759 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6760 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6761 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6762 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6763 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6764 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6766 /* Modes for retasking pin widgets
6767 * Note: the ALC260 doesn't seem to act on requests to enable mic
6768 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6769 * mention this restriction. At this stage it's not clear whether
6770 * this behaviour is intentional or is a hardware bug in chip
6771 * revisions available at least up until early 2006. Therefore for
6772 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6773 * choices, but if it turns out that the lack of mic bias for these
6774 * NIDs is intentional we could change their modes from
6775 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6777 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6778 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6779 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6780 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6781 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6782 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6784 /* Loopback mixer controls */
6785 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6786 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6787 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6788 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6789 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6790 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6791 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6792 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6793 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6794 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6795 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6796 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6797 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6798 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6800 /* Controls for GPIO pins, assuming they are configured as outputs */
6801 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6802 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6803 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6804 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6806 /* Switches to allow the digital IO pins to be enabled. The datasheet
6807 * is ambigious as to which NID is which; testing on laptops which
6808 * make this output available should provide clarification.
6810 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6811 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6813 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6814 * this output to turn on an external amplifier.
6816 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6817 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6821 static struct hda_verb alc260_test_init_verbs[] = {
6822 /* Enable all GPIOs as outputs with an initial value of 0 */
6823 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6824 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6825 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6827 /* Enable retasking pins as output, initially without power amp */
6828 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6829 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6830 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6832 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6833 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6835 /* Disable digital (SPDIF) pins initially, but users can enable
6836 * them via a mixer switch. In the case of SPDIF-out, this initverb
6837 * payload also sets the generation to 0, output to be in "consumer"
6838 * PCM format, copyright asserted, no pre-emphasis and no validity
6841 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6842 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6844 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6845 * OUT1 sum bus when acting as an output.
6847 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6848 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6849 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6850 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6852 /* Start with output sum widgets muted and their output gains at min */
6853 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6854 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6856 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6857 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6858 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6859 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6860 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6861 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6863 /* Unmute retasking pin widget output buffers since the default
6864 * state appears to be output. As the pin mode is changed by the
6865 * user the pin mode control will take care of enabling the pin's
6866 * input/output buffers as needed.
6868 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6869 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6870 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6871 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6872 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6873 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6874 /* Also unmute the mono-out pin widget */
6875 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6877 /* Mute capture amp left and right */
6878 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6879 /* Set ADC connection select to match default mixer setting (mic1
6882 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6884 /* Do the same for the second ADC: mute capture input amp and
6885 * set ADC connection to mic1 pin
6887 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6888 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6890 /* Mute all inputs to mixer widget (even unconnected ones) */
6891 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6892 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6893 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6894 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6895 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6896 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6897 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6898 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6904 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6905 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6907 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6908 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6911 * for BIOS auto-configuration
6914 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6915 const char *pfx, int *vol_bits)
6918 unsigned long vol_val, sw_val;
6921 if (nid >= 0x0f && nid < 0x11) {
6922 nid_vol = nid - 0x7;
6923 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6924 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6925 } else if (nid == 0x11) {
6926 nid_vol = nid - 0x7;
6927 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6928 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6929 } else if (nid >= 0x12 && nid <= 0x15) {
6931 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6932 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6936 if (!(*vol_bits & (1 << nid_vol))) {
6937 /* first control for the volume widget */
6938 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6941 *vol_bits |= (1 << nid_vol);
6943 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6949 /* add playback controls from the parsed DAC table */
6950 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6951 const struct auto_pin_cfg *cfg)
6957 spec->multiout.num_dacs = 1;
6958 spec->multiout.dac_nids = spec->private_dac_nids;
6959 spec->multiout.dac_nids[0] = 0x02;
6961 nid = cfg->line_out_pins[0];
6964 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6966 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6970 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6975 nid = cfg->speaker_pins[0];
6977 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6982 nid = cfg->hp_pins[0];
6984 err = alc260_add_playback_controls(spec, nid, "Headphone",
6992 /* create playback/capture controls for input pins */
6993 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6994 const struct auto_pin_cfg *cfg)
6996 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6999 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
7000 hda_nid_t nid, int pin_type,
7003 alc_set_pin_output(codec, nid, pin_type);
7004 /* need the manual connection? */
7006 int idx = nid - 0x12;
7007 snd_hda_codec_write(codec, idx + 0x0b, 0,
7008 AC_VERB_SET_CONNECT_SEL, sel_idx);
7012 static void alc260_auto_init_multi_out(struct hda_codec *codec)
7014 struct alc_spec *spec = codec->spec;
7017 nid = spec->autocfg.line_out_pins[0];
7019 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7020 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
7023 nid = spec->autocfg.speaker_pins[0];
7025 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
7027 nid = spec->autocfg.hp_pins[0];
7029 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
7032 #define ALC260_PIN_CD_NID 0x16
7033 static void alc260_auto_init_analog_input(struct hda_codec *codec)
7035 struct alc_spec *spec = codec->spec;
7036 struct auto_pin_cfg *cfg = &spec->autocfg;
7039 for (i = 0; i < cfg->num_inputs; i++) {
7040 hda_nid_t nid = cfg->inputs[i].pin;
7042 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
7043 if (nid != ALC260_PIN_CD_NID &&
7044 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
7045 snd_hda_codec_write(codec, nid, 0,
7046 AC_VERB_SET_AMP_GAIN_MUTE,
7052 #define alc260_auto_init_input_src alc880_auto_init_input_src
7055 * generic initialization of ADC, input mixers and output mixers
7057 static struct hda_verb alc260_volume_init_verbs[] = {
7059 * Unmute ADC0-1 and set the default input to mic-in
7061 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
7062 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7063 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
7064 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7066 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7068 * Note: PASD motherboards uses the Line In 2 as the input for
7069 * front panel mic (mic 2)
7071 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7072 /* mute analog inputs */
7073 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7074 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7075 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7076 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7077 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7080 * Set up output mixers (0x08 - 0x0a)
7082 /* set vol=0 to output mixers */
7083 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7084 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7085 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7086 /* set up input amps for analog loopback */
7087 /* Amp Indices: DAC = 0, mixer = 1 */
7088 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7089 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7090 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7091 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7092 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7093 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7098 static int alc260_parse_auto_config(struct hda_codec *codec)
7100 struct alc_spec *spec = codec->spec;
7102 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
7104 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7108 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7111 if (!spec->kctls.list)
7112 return 0; /* can't find valid BIOS pin config */
7113 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7117 spec->multiout.max_channels = 2;
7119 if (spec->autocfg.dig_outs)
7120 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7121 if (spec->kctls.list)
7122 add_mixer(spec, spec->kctls.list);
7124 add_verb(spec, alc260_volume_init_verbs);
7126 spec->num_mux_defs = 1;
7127 spec->input_mux = &spec->private_imux[0];
7129 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7134 /* additional initialization for auto-configuration model */
7135 static void alc260_auto_init(struct hda_codec *codec)
7137 struct alc_spec *spec = codec->spec;
7138 alc260_auto_init_multi_out(codec);
7139 alc260_auto_init_analog_input(codec);
7140 alc260_auto_init_input_src(codec);
7141 alc_auto_init_digital(codec);
7142 if (spec->unsol_event)
7143 alc_inithook(codec);
7146 #ifdef CONFIG_SND_HDA_POWER_SAVE
7147 static struct hda_amp_list alc260_loopbacks[] = {
7148 { 0x07, HDA_INPUT, 0 },
7149 { 0x07, HDA_INPUT, 1 },
7150 { 0x07, HDA_INPUT, 2 },
7151 { 0x07, HDA_INPUT, 3 },
7152 { 0x07, HDA_INPUT, 4 },
7164 static const struct alc_fixup alc260_fixups[] = {
7165 [PINFIX_HP_DC5750] = {
7166 .type = ALC_FIXUP_PINS,
7167 .v.pins = (const struct alc_pincfg[]) {
7168 { 0x11, 0x90130110 }, /* speaker */
7174 static struct snd_pci_quirk alc260_fixup_tbl[] = {
7175 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7180 * ALC260 configurations
7182 static const char * const alc260_models[ALC260_MODEL_LAST] = {
7183 [ALC260_BASIC] = "basic",
7185 [ALC260_HP_3013] = "hp-3013",
7186 [ALC260_HP_DC7600] = "hp-dc7600",
7187 [ALC260_FUJITSU_S702X] = "fujitsu",
7188 [ALC260_ACER] = "acer",
7189 [ALC260_WILL] = "will",
7190 [ALC260_REPLACER_672V] = "replacer",
7191 [ALC260_FAVORIT100] = "favorit100",
7192 #ifdef CONFIG_SND_DEBUG
7193 [ALC260_TEST] = "test",
7195 [ALC260_AUTO] = "auto",
7198 static struct snd_pci_quirk alc260_cfg_tbl[] = {
7199 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7200 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7201 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7202 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7203 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7204 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7205 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7206 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7207 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7208 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7209 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7210 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7211 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7212 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7213 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7214 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7215 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7216 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7217 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7218 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7222 static struct alc_config_preset alc260_presets[] = {
7224 .mixers = { alc260_base_output_mixer,
7225 alc260_input_mixer },
7226 .init_verbs = { alc260_init_verbs },
7227 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7228 .dac_nids = alc260_dac_nids,
7229 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7230 .adc_nids = alc260_dual_adc_nids,
7231 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7232 .channel_mode = alc260_modes,
7233 .input_mux = &alc260_capture_source,
7236 .mixers = { alc260_hp_output_mixer,
7237 alc260_input_mixer },
7238 .init_verbs = { alc260_init_verbs,
7239 alc260_hp_unsol_verbs },
7240 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7241 .dac_nids = alc260_dac_nids,
7242 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7243 .adc_nids = alc260_adc_nids_alt,
7244 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7245 .channel_mode = alc260_modes,
7246 .input_mux = &alc260_capture_source,
7247 .unsol_event = alc260_hp_unsol_event,
7248 .init_hook = alc260_hp_automute,
7250 [ALC260_HP_DC7600] = {
7251 .mixers = { alc260_hp_dc7600_mixer,
7252 alc260_input_mixer },
7253 .init_verbs = { alc260_init_verbs,
7254 alc260_hp_dc7600_verbs },
7255 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7256 .dac_nids = alc260_dac_nids,
7257 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7258 .adc_nids = alc260_adc_nids_alt,
7259 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7260 .channel_mode = alc260_modes,
7261 .input_mux = &alc260_capture_source,
7262 .unsol_event = alc260_hp_3012_unsol_event,
7263 .init_hook = alc260_hp_3012_automute,
7265 [ALC260_HP_3013] = {
7266 .mixers = { alc260_hp_3013_mixer,
7267 alc260_input_mixer },
7268 .init_verbs = { alc260_hp_3013_init_verbs,
7269 alc260_hp_3013_unsol_verbs },
7270 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7271 .dac_nids = alc260_dac_nids,
7272 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7273 .adc_nids = alc260_adc_nids_alt,
7274 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7275 .channel_mode = alc260_modes,
7276 .input_mux = &alc260_capture_source,
7277 .unsol_event = alc260_hp_3013_unsol_event,
7278 .init_hook = alc260_hp_3013_automute,
7280 [ALC260_FUJITSU_S702X] = {
7281 .mixers = { alc260_fujitsu_mixer },
7282 .init_verbs = { alc260_fujitsu_init_verbs },
7283 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7284 .dac_nids = alc260_dac_nids,
7285 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7286 .adc_nids = alc260_dual_adc_nids,
7287 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7288 .channel_mode = alc260_modes,
7289 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7290 .input_mux = alc260_fujitsu_capture_sources,
7293 .mixers = { alc260_acer_mixer },
7294 .init_verbs = { alc260_acer_init_verbs },
7295 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7296 .dac_nids = alc260_dac_nids,
7297 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7298 .adc_nids = alc260_dual_adc_nids,
7299 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7300 .channel_mode = alc260_modes,
7301 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7302 .input_mux = alc260_acer_capture_sources,
7304 [ALC260_FAVORIT100] = {
7305 .mixers = { alc260_favorit100_mixer },
7306 .init_verbs = { alc260_favorit100_init_verbs },
7307 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7308 .dac_nids = alc260_dac_nids,
7309 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7310 .adc_nids = alc260_dual_adc_nids,
7311 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7312 .channel_mode = alc260_modes,
7313 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7314 .input_mux = alc260_favorit100_capture_sources,
7317 .mixers = { alc260_will_mixer },
7318 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7319 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7320 .dac_nids = alc260_dac_nids,
7321 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7322 .adc_nids = alc260_adc_nids,
7323 .dig_out_nid = ALC260_DIGOUT_NID,
7324 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7325 .channel_mode = alc260_modes,
7326 .input_mux = &alc260_capture_source,
7328 [ALC260_REPLACER_672V] = {
7329 .mixers = { alc260_replacer_672v_mixer },
7330 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7331 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7332 .dac_nids = alc260_dac_nids,
7333 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7334 .adc_nids = alc260_adc_nids,
7335 .dig_out_nid = ALC260_DIGOUT_NID,
7336 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7337 .channel_mode = alc260_modes,
7338 .input_mux = &alc260_capture_source,
7339 .unsol_event = alc260_replacer_672v_unsol_event,
7340 .init_hook = alc260_replacer_672v_automute,
7342 #ifdef CONFIG_SND_DEBUG
7344 .mixers = { alc260_test_mixer },
7345 .init_verbs = { alc260_test_init_verbs },
7346 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7347 .dac_nids = alc260_test_dac_nids,
7348 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7349 .adc_nids = alc260_test_adc_nids,
7350 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7351 .channel_mode = alc260_modes,
7352 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7353 .input_mux = alc260_test_capture_sources,
7358 static int patch_alc260(struct hda_codec *codec)
7360 struct alc_spec *spec;
7361 int err, board_config;
7363 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7369 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7372 if (board_config < 0) {
7373 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7375 board_config = ALC260_AUTO;
7378 if (board_config == ALC260_AUTO) {
7379 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7380 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7383 if (board_config == ALC260_AUTO) {
7384 /* automatic parse from the BIOS config */
7385 err = alc260_parse_auto_config(codec);
7391 "hda_codec: Cannot set up configuration "
7392 "from BIOS. Using base mode...\n");
7393 board_config = ALC260_BASIC;
7397 err = snd_hda_attach_beep_device(codec, 0x1);
7403 if (board_config != ALC260_AUTO)
7404 setup_preset(codec, &alc260_presets[board_config]);
7406 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7407 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7408 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7410 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7411 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7413 if (!spec->adc_nids && spec->input_mux) {
7414 /* check whether NID 0x04 is valid */
7415 unsigned int wcap = get_wcaps(codec, 0x04);
7416 wcap = get_wcaps_type(wcap);
7418 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7419 spec->adc_nids = alc260_adc_nids_alt;
7420 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7422 spec->adc_nids = alc260_adc_nids;
7423 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7426 set_capture_mixer(codec);
7427 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7429 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7431 spec->vmaster_nid = 0x08;
7433 codec->patch_ops = alc_patch_ops;
7434 if (board_config == ALC260_AUTO)
7435 spec->init_hook = alc260_auto_init;
7436 #ifdef CONFIG_SND_HDA_POWER_SAVE
7437 if (!spec->loopback.amplist)
7438 spec->loopback.amplist = alc260_loopbacks;
7446 * ALC882/883/885/888/889 support
7448 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7449 * configuration. Each pin widget can choose any input DACs and a mixer.
7450 * Each ADC is connected from a mixer of all inputs. This makes possible
7451 * 6-channel independent captures.
7453 * In addition, an independent DAC for the multi-playback (not used in this
7456 #define ALC882_DIGOUT_NID 0x06
7457 #define ALC882_DIGIN_NID 0x0a
7458 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7459 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7460 #define ALC1200_DIGOUT_NID 0x10
7463 static struct hda_channel_mode alc882_ch_modes[1] = {
7468 static hda_nid_t alc882_dac_nids[4] = {
7469 /* front, rear, clfe, rear_surr */
7470 0x02, 0x03, 0x04, 0x05
7472 #define alc883_dac_nids alc882_dac_nids
7475 #define alc882_adc_nids alc880_adc_nids
7476 #define alc882_adc_nids_alt alc880_adc_nids_alt
7477 #define alc883_adc_nids alc882_adc_nids_alt
7478 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7479 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7480 #define alc889_adc_nids alc880_adc_nids
7482 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7483 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7484 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7485 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7486 #define alc889_capsrc_nids alc882_capsrc_nids
7489 /* FIXME: should be a matrix-type input source selection */
7491 static struct hda_input_mux alc882_capture_source = {
7495 { "Front Mic", 0x1 },
7501 #define alc883_capture_source alc882_capture_source
7503 static struct hda_input_mux alc889_capture_source = {
7506 { "Front Mic", 0x0 },
7512 static struct hda_input_mux mb5_capture_source = {
7521 static struct hda_input_mux macmini3_capture_source = {
7529 static struct hda_input_mux alc883_3stack_6ch_intel = {
7533 { "Front Mic", 0x0 },
7539 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7547 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7551 { "Internal Mic", 0x1 },
7557 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7561 { "Internal Mic", 0x1 },
7565 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7569 { "Front Mic", 0x1 },
7574 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7582 static struct hda_input_mux alc889A_mb31_capture_source = {
7586 /* Front Mic (0x01) unused */
7588 /* Line 2 (0x03) unused */
7589 /* CD (0x04) unused? */
7593 static struct hda_input_mux alc889A_imac91_capture_source = {
7597 { "Line", 0x2 }, /* Not sure! */
7604 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7611 static struct hda_verb alc882_3ST_ch2_init[] = {
7612 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7613 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7614 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7615 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7622 static struct hda_verb alc882_3ST_ch4_init[] = {
7623 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7624 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7625 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7626 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7627 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7634 static struct hda_verb alc882_3ST_ch6_init[] = {
7635 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7636 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7637 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7638 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7639 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7640 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7644 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7645 { 2, alc882_3ST_ch2_init },
7646 { 4, alc882_3ST_ch4_init },
7647 { 6, alc882_3ST_ch6_init },
7650 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7655 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7656 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7657 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7658 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7659 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7660 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7667 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7668 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7669 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7670 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7671 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7672 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7673 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7680 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7681 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7682 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7683 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7684 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7685 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7686 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7687 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7691 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7692 { 2, alc883_3ST_ch2_clevo_init },
7693 { 4, alc883_3ST_ch4_clevo_init },
7694 { 6, alc883_3ST_ch6_clevo_init },
7701 static struct hda_verb alc882_sixstack_ch6_init[] = {
7702 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7703 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7704 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7705 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7712 static struct hda_verb alc882_sixstack_ch8_init[] = {
7713 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7714 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7715 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7716 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7720 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7721 { 6, alc882_sixstack_ch6_init },
7722 { 8, alc882_sixstack_ch8_init },
7726 /* Macbook Air 2,1 */
7728 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7733 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7739 static struct hda_verb alc885_mbp_ch2_init[] = {
7740 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7741 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7742 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7749 static struct hda_verb alc885_mbp_ch4_init[] = {
7750 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7751 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7752 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7753 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7754 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7758 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7759 { 2, alc885_mbp_ch2_init },
7760 { 4, alc885_mbp_ch4_init },
7765 * Speakers/Woofer/HP = Front
7768 static struct hda_verb alc885_mb5_ch2_init[] = {
7769 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7776 * Speakers/HP = Front
7780 static struct hda_verb alc885_mb5_ch6_init[] = {
7781 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7782 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7783 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7787 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7788 { 2, alc885_mb5_ch2_init },
7789 { 6, alc885_mb5_ch6_init },
7792 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7797 static struct hda_verb alc883_4ST_ch2_init[] = {
7798 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7799 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7800 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7801 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7802 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7803 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7810 static struct hda_verb alc883_4ST_ch4_init[] = {
7811 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7812 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7813 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7814 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7815 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7816 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7817 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7824 static struct hda_verb alc883_4ST_ch6_init[] = {
7825 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7826 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7827 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7828 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7829 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7830 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7831 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7832 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7839 static struct hda_verb alc883_4ST_ch8_init[] = {
7840 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7841 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7842 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7843 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7844 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7845 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7846 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7847 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7848 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7852 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7853 { 2, alc883_4ST_ch2_init },
7854 { 4, alc883_4ST_ch4_init },
7855 { 6, alc883_4ST_ch6_init },
7856 { 8, alc883_4ST_ch8_init },
7863 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7864 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7865 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7866 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7867 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7874 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7875 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7876 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7877 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7878 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7879 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7886 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7887 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7888 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7889 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7890 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7891 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7892 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7896 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7897 { 2, alc883_3ST_ch2_intel_init },
7898 { 4, alc883_3ST_ch4_intel_init },
7899 { 6, alc883_3ST_ch6_intel_init },
7905 static struct hda_verb alc889_ch2_intel_init[] = {
7906 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7907 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7908 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7909 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7910 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7911 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7918 static struct hda_verb alc889_ch6_intel_init[] = {
7919 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7920 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7921 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7922 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7923 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7924 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7931 static struct hda_verb alc889_ch8_intel_init[] = {
7932 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7933 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7934 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7935 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7936 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7937 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7938 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7942 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7943 { 2, alc889_ch2_intel_init },
7944 { 6, alc889_ch6_intel_init },
7945 { 8, alc889_ch8_intel_init },
7951 static struct hda_verb alc883_sixstack_ch6_init[] = {
7952 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7953 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7954 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7955 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7962 static struct hda_verb alc883_sixstack_ch8_init[] = {
7963 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7964 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7965 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7966 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7970 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7971 { 6, alc883_sixstack_ch6_init },
7972 { 8, alc883_sixstack_ch8_init },
7976 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7977 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7979 static struct snd_kcontrol_new alc882_base_mixer[] = {
7980 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7981 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7982 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7983 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7984 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7985 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7986 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7987 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7988 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7989 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7990 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7991 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7992 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7993 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7994 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7996 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
7997 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7998 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7999 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8000 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8004 /* Macbook Air 2,1 same control for HP and internal Speaker */
8006 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
8007 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8008 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
8013 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
8014 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8015 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8016 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8017 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
8018 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8019 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8020 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8021 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8022 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8023 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
8024 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
8028 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
8029 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8030 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8031 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8032 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8033 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8034 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8035 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8036 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8037 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8038 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8039 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8040 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8041 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8042 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
8046 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
8047 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8048 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8049 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8050 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8051 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8052 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8053 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8054 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8055 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8056 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8057 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8061 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
8062 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8063 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8068 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8069 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8070 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8071 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8072 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8073 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8074 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8077 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8081 static struct snd_kcontrol_new alc882_targa_mixer[] = {
8082 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8083 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8084 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8085 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8086 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8087 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8088 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8089 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8090 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8091 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8092 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8093 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8094 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8098 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8099 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8101 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8102 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8103 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8104 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8105 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8106 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8107 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8110 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8111 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8113 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8114 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8118 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8119 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8120 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8121 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8124 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8125 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8127 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8132 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8134 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8135 .name = "Channel Mode",
8136 .info = alc_ch_mode_info,
8137 .get = alc_ch_mode_get,
8138 .put = alc_ch_mode_put,
8143 static struct hda_verb alc882_base_init_verbs[] = {
8144 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8145 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8146 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8148 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8149 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8151 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8152 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8154 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8155 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8157 /* Front Pin: output 0 (0x0c) */
8158 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8159 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8160 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8161 /* Rear Pin: output 1 (0x0d) */
8162 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8163 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8164 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8165 /* CLFE Pin: output 2 (0x0e) */
8166 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8167 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8168 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8169 /* Side Pin: output 3 (0x0f) */
8170 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8171 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8172 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8173 /* Mic (rear) pin: input vref at 80% */
8174 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8175 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8176 /* Front Mic pin: input vref at 80% */
8177 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8178 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8179 /* Line In pin: input */
8180 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8181 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8182 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8183 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8184 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8185 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8186 /* CD pin widget for input */
8187 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8189 /* FIXME: use matrix-type input source selection */
8190 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8192 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8194 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8195 /* ADC2: mute amp left and right */
8196 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8197 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8198 /* ADC3: mute amp left and right */
8199 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8200 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8205 static struct hda_verb alc882_adc1_init_verbs[] = {
8206 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8208 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8209 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8210 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8211 /* ADC1: mute amp left and right */
8212 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8213 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8217 static struct hda_verb alc882_eapd_verbs[] = {
8218 /* change to EAPD mode */
8219 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8220 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8224 static struct hda_verb alc889_eapd_verbs[] = {
8225 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8226 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8230 static struct hda_verb alc_hp15_unsol_verbs[] = {
8231 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8232 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8236 static struct hda_verb alc885_init_verbs[] = {
8237 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8238 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8239 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8241 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8242 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8245 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8247 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8248 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8250 /* Front HP Pin: output 0 (0x0c) */
8251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8252 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8253 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8254 /* Front Pin: output 0 (0x0c) */
8255 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8256 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8257 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8258 /* Rear Pin: output 1 (0x0d) */
8259 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8260 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8261 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8262 /* CLFE Pin: output 2 (0x0e) */
8263 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8264 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8265 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8266 /* Side Pin: output 3 (0x0f) */
8267 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8268 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8269 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8270 /* Mic (rear) pin: input vref at 80% */
8271 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8272 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8273 /* Front Mic pin: input vref at 80% */
8274 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8275 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8276 /* Line In pin: input */
8277 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8278 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8280 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8282 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8287 /* ADC2: mute amp left and right */
8288 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8289 /* ADC3: mute amp left and right */
8290 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8295 static struct hda_verb alc885_init_input_verbs[] = {
8296 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8297 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8298 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8303 /* Unmute Selector 24h and set the default input to front mic */
8304 static struct hda_verb alc889_init_input_verbs[] = {
8305 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8306 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8311 #define alc883_init_verbs alc882_base_init_verbs
8314 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8315 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8316 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8317 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8318 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8319 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8320 /* FIXME: this looks suspicious...
8321 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8322 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8327 static struct hda_verb alc882_macpro_init_verbs[] = {
8328 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8329 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8332 /* Front Pin: output 0 (0x0c) */
8333 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8334 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8335 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8336 /* Front Mic pin: input vref at 80% */
8337 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8338 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8339 /* Speaker: output */
8340 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8341 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8342 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8343 /* Headphone output (output 0 - 0x0c) */
8344 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8345 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8346 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8348 /* FIXME: use matrix-type input source selection */
8349 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8350 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8354 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8356 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8357 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8358 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8359 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8361 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8362 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8363 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8365 /* ADC1: mute amp left and right */
8366 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8367 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8368 /* ADC2: mute amp left and right */
8369 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8370 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8371 /* ADC3: mute amp left and right */
8372 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8373 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8379 static struct hda_verb alc885_mb5_init_verbs[] = {
8381 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8382 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8383 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8384 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8386 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8387 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8388 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8389 /* Surround mixer */
8390 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8391 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8392 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8395 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8396 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8398 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8399 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8400 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8401 /* Front Pin (0x0c) */
8402 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8403 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8404 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8405 /* LFE Pin (0x0e) */
8406 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8407 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8408 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8411 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8412 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8413 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8414 /* Front Mic pin: input vref at 80% */
8415 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8416 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8418 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8419 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8421 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8422 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8423 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8428 static struct hda_verb alc885_macmini3_init_verbs[] = {
8430 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8431 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8432 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8433 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8436 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8437 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8438 /* Surround mixer */
8439 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8440 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8441 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8443 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8444 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8445 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8447 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8448 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8449 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8450 /* Front Pin (0x0c) */
8451 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8452 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8453 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8454 /* LFE Pin (0x0e) */
8455 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8456 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8457 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8459 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8460 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8461 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8462 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8464 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8465 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8467 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8468 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8469 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8470 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8475 static struct hda_verb alc885_mba21_init_verbs[] = {
8476 /*Internal and HP Speaker Mixer*/
8477 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8478 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8479 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8480 /*Internal Speaker Pin (0x0c)*/
8481 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8482 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8483 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8484 /* HP Pin: output 0 (0x0e) */
8485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8486 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8487 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8488 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8489 /* Line in (is hp when jack connected)*/
8490 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8491 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8497 /* Macbook Pro rev3 */
8498 static struct hda_verb alc885_mbp3_init_verbs[] = {
8499 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8504 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8506 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8508 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8509 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8510 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8511 /* Front Pin: output 0 (0x0c) */
8512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8513 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8514 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8515 /* HP Pin: output 0 (0x0e) */
8516 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8517 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8518 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8519 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8520 /* Mic (rear) pin: input vref at 80% */
8521 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8522 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8523 /* Front Mic pin: input vref at 80% */
8524 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8525 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8526 /* Line In pin: use output 1 when in LineOut mode */
8527 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8528 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8529 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8531 /* FIXME: use matrix-type input source selection */
8532 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8533 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8534 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8535 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8536 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8537 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8539 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8540 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8541 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8542 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8544 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8545 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8546 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8547 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8548 /* ADC1: mute amp left and right */
8549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8550 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8551 /* ADC2: mute amp left and right */
8552 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8553 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8554 /* ADC3: mute amp left and right */
8555 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8556 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8562 static struct hda_verb alc885_imac91_init_verbs[] = {
8563 /* Internal Speaker Pin (0x0c) */
8564 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8565 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8566 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8567 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8568 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8569 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8571 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8572 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8573 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8574 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8576 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8577 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8578 /* Front Mic pin: input vref at 80% */
8579 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8580 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8582 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8585 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8588 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8589 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8590 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8591 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8592 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8593 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8594 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8595 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8596 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8597 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8598 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8599 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8601 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8602 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8603 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8604 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8605 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8606 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8607 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8608 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8609 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8610 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8611 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8612 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8616 /* iMac 24 mixer. */
8617 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8618 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8619 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8623 /* iMac 24 init verbs. */
8624 static struct hda_verb alc885_imac24_init_verbs[] = {
8625 /* Internal speakers: output 0 (0x0c) */
8626 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8627 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8628 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8629 /* Internal speakers: output 0 (0x0c) */
8630 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8631 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8632 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8633 /* Headphone: output 0 (0x0c) */
8634 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8635 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8636 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8637 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8638 /* Front Mic: input vref at 80% */
8639 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8640 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8644 /* Toggle speaker-output according to the hp-jack state */
8645 static void alc885_imac24_setup(struct hda_codec *codec)
8647 struct alc_spec *spec = codec->spec;
8649 spec->autocfg.hp_pins[0] = 0x14;
8650 spec->autocfg.speaker_pins[0] = 0x18;
8651 spec->autocfg.speaker_pins[1] = 0x1a;
8654 #define alc885_mb5_setup alc885_imac24_setup
8655 #define alc885_macmini3_setup alc885_imac24_setup
8657 /* Macbook Air 2,1 */
8658 static void alc885_mba21_setup(struct hda_codec *codec)
8660 struct alc_spec *spec = codec->spec;
8662 spec->autocfg.hp_pins[0] = 0x14;
8663 spec->autocfg.speaker_pins[0] = 0x18;
8668 static void alc885_mbp3_setup(struct hda_codec *codec)
8670 struct alc_spec *spec = codec->spec;
8672 spec->autocfg.hp_pins[0] = 0x15;
8673 spec->autocfg.speaker_pins[0] = 0x14;
8676 static void alc885_imac91_setup(struct hda_codec *codec)
8678 struct alc_spec *spec = codec->spec;
8680 spec->autocfg.hp_pins[0] = 0x14;
8681 spec->autocfg.speaker_pins[0] = 0x18;
8682 spec->autocfg.speaker_pins[1] = 0x1a;
8685 static struct hda_verb alc882_targa_verbs[] = {
8686 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8687 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8689 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8690 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8692 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8693 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8694 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8696 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8700 /* toggle speaker-output according to the hp-jack state */
8701 static void alc882_targa_automute(struct hda_codec *codec)
8703 struct alc_spec *spec = codec->spec;
8704 alc_automute_amp(codec);
8705 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8706 spec->jack_present ? 1 : 3);
8709 static void alc882_targa_setup(struct hda_codec *codec)
8711 struct alc_spec *spec = codec->spec;
8713 spec->autocfg.hp_pins[0] = 0x14;
8714 spec->autocfg.speaker_pins[0] = 0x1b;
8717 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8719 if ((res >> 26) == ALC880_HP_EVENT)
8720 alc882_targa_automute(codec);
8723 static struct hda_verb alc882_asus_a7j_verbs[] = {
8724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8729 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8731 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8732 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8733 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8735 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8736 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8737 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8741 static struct hda_verb alc882_asus_a7m_verbs[] = {
8742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8745 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8746 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8747 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8749 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8750 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8751 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8753 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8754 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8755 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8759 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8761 unsigned int gpiostate, gpiomask, gpiodir;
8763 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8764 AC_VERB_GET_GPIO_DATA, 0);
8767 gpiostate |= (1 << pin);
8769 gpiostate &= ~(1 << pin);
8771 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8772 AC_VERB_GET_GPIO_MASK, 0);
8773 gpiomask |= (1 << pin);
8775 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8776 AC_VERB_GET_GPIO_DIRECTION, 0);
8777 gpiodir |= (1 << pin);
8780 snd_hda_codec_write(codec, codec->afg, 0,
8781 AC_VERB_SET_GPIO_MASK, gpiomask);
8782 snd_hda_codec_write(codec, codec->afg, 0,
8783 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8787 snd_hda_codec_write(codec, codec->afg, 0,
8788 AC_VERB_SET_GPIO_DATA, gpiostate);
8791 /* set up GPIO at initialization */
8792 static void alc885_macpro_init_hook(struct hda_codec *codec)
8794 alc882_gpio_mute(codec, 0, 0);
8795 alc882_gpio_mute(codec, 1, 0);
8798 /* set up GPIO and update auto-muting at initialization */
8799 static void alc885_imac24_init_hook(struct hda_codec *codec)
8801 alc885_macpro_init_hook(codec);
8802 alc_automute_amp(codec);
8806 * generic initialization of ADC, input mixers and output mixers
8808 static struct hda_verb alc883_auto_init_verbs[] = {
8810 * Unmute ADC0-2 and set the default input to mic-in
8812 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8813 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8814 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8815 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8818 * Set up output mixers (0x0c - 0x0f)
8820 /* set vol=0 to output mixers */
8821 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8822 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8823 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8824 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8825 /* set up input amps for analog loopback */
8826 /* Amp Indices: DAC = 0, mixer = 1 */
8827 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8828 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8829 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8830 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8831 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8832 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8833 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8834 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8835 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8836 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8838 /* FIXME: use matrix-type input source selection */
8839 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8841 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8843 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8847 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8848 static struct hda_verb alc889A_mb31_ch2_init[] = {
8849 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8850 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8851 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8852 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8856 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8857 static struct hda_verb alc889A_mb31_ch4_init[] = {
8858 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8859 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8860 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8861 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8865 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8866 static struct hda_verb alc889A_mb31_ch5_init[] = {
8867 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8868 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8869 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8870 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8874 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8875 static struct hda_verb alc889A_mb31_ch6_init[] = {
8876 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8877 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8878 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8879 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8883 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8884 { 2, alc889A_mb31_ch2_init },
8885 { 4, alc889A_mb31_ch4_init },
8886 { 5, alc889A_mb31_ch5_init },
8887 { 6, alc889A_mb31_ch6_init },
8890 static struct hda_verb alc883_medion_eapd_verbs[] = {
8891 /* eanable EAPD on medion laptop */
8892 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8893 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8897 #define alc883_base_mixer alc882_base_mixer
8899 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8900 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8901 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8902 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8903 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8904 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8905 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8906 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8908 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8909 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8910 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8911 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8912 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8916 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8917 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8918 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8919 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8920 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8921 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8922 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8923 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8924 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8925 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8926 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8930 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8931 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8932 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8933 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8934 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8936 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8937 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8938 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8939 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8940 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8944 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8945 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8946 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8947 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8948 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8949 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8950 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8951 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8952 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8953 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8954 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8955 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8956 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8957 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8961 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8962 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8963 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8964 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8965 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8966 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8967 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8968 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8969 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8970 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8971 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8972 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8973 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8974 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8975 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8976 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8977 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8978 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8979 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8980 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8984 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8985 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8986 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8987 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8988 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8989 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8991 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8992 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8993 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8995 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8996 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8997 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8998 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8999 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9000 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9001 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9002 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9003 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9004 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9008 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
9009 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9010 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9011 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9012 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9013 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9015 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9016 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9017 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9018 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9019 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
9020 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9021 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9022 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9023 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
9024 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
9025 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
9026 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9027 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9028 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9032 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
9033 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9034 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9035 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9036 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9037 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9038 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9039 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9040 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9041 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9042 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9043 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9044 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9045 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9046 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9047 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9048 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9049 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9050 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9051 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9055 static struct snd_kcontrol_new alc883_targa_mixer[] = {
9056 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9057 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9058 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9059 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9060 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9061 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9062 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9063 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9064 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9065 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9066 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9067 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9068 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9069 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9070 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9071 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9072 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9076 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9077 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9078 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9079 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9080 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9081 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9082 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9083 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9084 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9085 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9086 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9087 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9088 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9092 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9093 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9094 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9095 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9096 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9097 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9101 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9102 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9103 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9104 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9105 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9106 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9108 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9113 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9114 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9115 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9117 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9118 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9120 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9121 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9122 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9126 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9127 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9128 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9129 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9130 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9131 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9132 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9136 static struct hda_verb alc883_medion_wim2160_verbs[] = {
9137 /* Unmute front mixer */
9138 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9139 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9141 /* Set speaker pin to front mixer */
9142 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9144 /* Init headphone pin */
9145 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9146 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9147 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9148 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9153 /* toggle speaker-output according to the hp-jack state */
9154 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9156 struct alc_spec *spec = codec->spec;
9158 spec->autocfg.hp_pins[0] = 0x1a;
9159 spec->autocfg.speaker_pins[0] = 0x15;
9162 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9163 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9164 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9166 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9167 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9168 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9169 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9170 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9174 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9175 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9176 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9177 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9178 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9179 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9180 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9182 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9183 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9187 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9188 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9189 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9190 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9191 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9192 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9193 0x0d, 1, 0x0, HDA_OUTPUT),
9194 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9195 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9196 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9197 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9198 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9199 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9200 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9201 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9202 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9204 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9205 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9206 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9207 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9208 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9212 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9214 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9215 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9216 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9217 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9218 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9220 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9221 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9222 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9223 /* Output switches */
9224 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9225 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9226 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9228 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
9229 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
9231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9238 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9239 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9240 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9241 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9243 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9248 static struct hda_bind_ctls alc883_bind_cap_vol = {
9249 .ops = &snd_hda_bind_vol,
9251 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9252 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9257 static struct hda_bind_ctls alc883_bind_cap_switch = {
9258 .ops = &snd_hda_bind_sw,
9260 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9261 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9266 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9267 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9268 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9269 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9270 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9271 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9273 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9274 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9278 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9279 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9280 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9282 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9283 /* .name = "Capture Source", */
9284 .name = "Input Source",
9286 .info = alc_mux_enum_info,
9287 .get = alc_mux_enum_get,
9288 .put = alc_mux_enum_put,
9293 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9295 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9296 .name = "Channel Mode",
9297 .info = alc_ch_mode_info,
9298 .get = alc_ch_mode_get,
9299 .put = alc_ch_mode_put,
9304 /* toggle speaker-output according to the hp-jack state */
9305 static void alc883_mitac_setup(struct hda_codec *codec)
9307 struct alc_spec *spec = codec->spec;
9309 spec->autocfg.hp_pins[0] = 0x15;
9310 spec->autocfg.speaker_pins[0] = 0x14;
9311 spec->autocfg.speaker_pins[1] = 0x17;
9314 static struct hda_verb alc883_mitac_verbs[] = {
9316 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9317 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9319 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9320 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9322 /* enable unsolicited event */
9323 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9324 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9329 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9331 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9332 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9334 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9336 /* enable unsolicited event */
9338 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9339 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9345 static struct hda_verb alc883_clevo_m720_verbs[] = {
9347 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9348 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9350 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9353 /* enable unsolicited event */
9354 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9355 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9360 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9362 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9363 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9365 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9368 /* enable unsolicited event */
9369 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9374 static struct hda_verb alc883_targa_verbs[] = {
9375 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9376 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9378 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9379 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9381 /* Connect Line-Out side jack (SPDIF) to Side */
9382 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9383 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9384 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9385 /* Connect Mic jack to CLFE */
9386 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9387 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9388 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9389 /* Connect Line-in jack to Surround */
9390 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9391 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9392 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9393 /* Connect HP out jack to Front */
9394 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9395 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9396 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9398 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9403 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9404 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9405 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9406 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9410 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9411 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9413 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9414 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9418 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9420 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9421 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9422 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9423 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9427 static struct hda_verb alc883_haier_w66_verbs[] = {
9428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9431 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9433 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9434 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9435 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9436 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9440 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9441 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9442 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9443 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9444 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9445 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9446 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9447 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9448 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9452 static struct hda_verb alc888_6st_dell_verbs[] = {
9453 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9457 static struct hda_verb alc883_vaiott_verbs[] = {
9459 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9460 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9462 /* enable unsolicited event */
9463 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9468 static void alc888_3st_hp_setup(struct hda_codec *codec)
9470 struct alc_spec *spec = codec->spec;
9472 spec->autocfg.hp_pins[0] = 0x1b;
9473 spec->autocfg.speaker_pins[0] = 0x14;
9474 spec->autocfg.speaker_pins[1] = 0x16;
9475 spec->autocfg.speaker_pins[2] = 0x18;
9478 static struct hda_verb alc888_3st_hp_verbs[] = {
9479 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9480 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9481 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9482 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9489 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9490 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9491 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9492 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9493 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9500 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9501 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9502 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9503 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9504 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9505 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9512 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9513 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9514 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9515 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9516 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9517 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9518 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9522 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9523 { 2, alc888_3st_hp_2ch_init },
9524 { 4, alc888_3st_hp_4ch_init },
9525 { 6, alc888_3st_hp_6ch_init },
9528 /* toggle front-jack and RCA according to the hp-jack state */
9529 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9531 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9533 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9534 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9535 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9536 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9539 /* toggle RCA according to the front-jack state */
9540 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9542 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9544 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9545 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9548 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9551 if ((res >> 26) == ALC880_HP_EVENT)
9552 alc888_lenovo_ms7195_front_automute(codec);
9553 if ((res >> 26) == ALC880_FRONT_EVENT)
9554 alc888_lenovo_ms7195_rca_automute(codec);
9557 /* toggle speaker-output according to the hp-jack state */
9558 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9560 struct alc_spec *spec = codec->spec;
9562 spec->autocfg.hp_pins[0] = 0x14;
9563 spec->autocfg.speaker_pins[0] = 0x15;
9566 /* toggle speaker-output according to the hp-jack state */
9567 #define alc883_targa_init_hook alc882_targa_init_hook
9568 #define alc883_targa_unsol_event alc882_targa_unsol_event
9570 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9572 struct alc_spec *spec = codec->spec;
9574 spec->autocfg.hp_pins[0] = 0x15;
9575 spec->autocfg.speaker_pins[0] = 0x14;
9578 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9580 alc_automute_amp(codec);
9581 alc88x_simple_mic_automute(codec);
9584 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9587 switch (res >> 26) {
9588 case ALC880_MIC_EVENT:
9589 alc88x_simple_mic_automute(codec);
9592 alc_automute_amp_unsol_event(codec, res);
9597 /* toggle speaker-output according to the hp-jack state */
9598 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9600 struct alc_spec *spec = codec->spec;
9602 spec->autocfg.hp_pins[0] = 0x14;
9603 spec->autocfg.speaker_pins[0] = 0x15;
9606 static void alc883_haier_w66_setup(struct hda_codec *codec)
9608 struct alc_spec *spec = codec->spec;
9610 spec->autocfg.hp_pins[0] = 0x1b;
9611 spec->autocfg.speaker_pins[0] = 0x14;
9614 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9616 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9618 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9619 HDA_AMP_MUTE, bits);
9622 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9624 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9626 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9627 HDA_AMP_MUTE, bits);
9628 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9629 HDA_AMP_MUTE, bits);
9632 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9635 if ((res >> 26) == ALC880_HP_EVENT)
9636 alc883_lenovo_101e_all_automute(codec);
9637 if ((res >> 26) == ALC880_FRONT_EVENT)
9638 alc883_lenovo_101e_ispeaker_automute(codec);
9641 /* toggle speaker-output according to the hp-jack state */
9642 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9644 struct alc_spec *spec = codec->spec;
9646 spec->autocfg.hp_pins[0] = 0x14;
9647 spec->autocfg.speaker_pins[0] = 0x15;
9648 spec->autocfg.speaker_pins[1] = 0x16;
9651 static struct hda_verb alc883_acer_eapd_verbs[] = {
9652 /* HP Pin: output 0 (0x0c) */
9653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9654 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9655 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9656 /* Front Pin: output 0 (0x0c) */
9657 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9658 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9659 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9660 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9661 /* eanable EAPD on medion laptop */
9662 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9663 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9664 /* enable unsolicited event */
9665 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9669 static void alc888_6st_dell_setup(struct hda_codec *codec)
9671 struct alc_spec *spec = codec->spec;
9673 spec->autocfg.hp_pins[0] = 0x1b;
9674 spec->autocfg.speaker_pins[0] = 0x14;
9675 spec->autocfg.speaker_pins[1] = 0x15;
9676 spec->autocfg.speaker_pins[2] = 0x16;
9677 spec->autocfg.speaker_pins[3] = 0x17;
9680 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9682 struct alc_spec *spec = codec->spec;
9684 spec->autocfg.hp_pins[0] = 0x1b;
9685 spec->autocfg.speaker_pins[0] = 0x14;
9686 spec->autocfg.speaker_pins[1] = 0x15;
9687 spec->autocfg.speaker_pins[2] = 0x16;
9688 spec->autocfg.speaker_pins[3] = 0x17;
9689 spec->autocfg.speaker_pins[4] = 0x1a;
9692 static void alc883_vaiott_setup(struct hda_codec *codec)
9694 struct alc_spec *spec = codec->spec;
9696 spec->autocfg.hp_pins[0] = 0x15;
9697 spec->autocfg.speaker_pins[0] = 0x14;
9698 spec->autocfg.speaker_pins[1] = 0x17;
9701 static struct hda_verb alc888_asus_m90v_verbs[] = {
9702 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9703 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9704 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9705 /* enable unsolicited event */
9706 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9707 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9711 static void alc883_mode2_setup(struct hda_codec *codec)
9713 struct alc_spec *spec = codec->spec;
9715 spec->autocfg.hp_pins[0] = 0x1b;
9716 spec->autocfg.speaker_pins[0] = 0x14;
9717 spec->autocfg.speaker_pins[1] = 0x15;
9718 spec->autocfg.speaker_pins[2] = 0x16;
9719 spec->ext_mic.pin = 0x18;
9720 spec->int_mic.pin = 0x19;
9721 spec->ext_mic.mux_idx = 0;
9722 spec->int_mic.mux_idx = 1;
9726 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9727 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9728 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9729 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9730 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9731 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9732 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9733 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9734 /* enable unsolicited event */
9735 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9739 static void alc883_eee1601_inithook(struct hda_codec *codec)
9741 struct alc_spec *spec = codec->spec;
9743 spec->autocfg.hp_pins[0] = 0x14;
9744 spec->autocfg.speaker_pins[0] = 0x1b;
9745 alc_automute_pin(codec);
9748 static struct hda_verb alc889A_mb31_verbs[] = {
9749 /* Init rear pin (used as headphone output) */
9750 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9751 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9752 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9753 /* Init line pin (used as output in 4ch and 6ch mode) */
9754 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9755 /* Init line 2 pin (used as headphone out by default) */
9756 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9757 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9761 /* Mute speakers according to the headphone jack state */
9762 static void alc889A_mb31_automute(struct hda_codec *codec)
9764 unsigned int present;
9766 /* Mute only in 2ch or 4ch mode */
9767 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9769 present = snd_hda_jack_detect(codec, 0x15);
9770 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9771 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9772 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9773 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9777 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9779 if ((res >> 26) == ALC880_HP_EVENT)
9780 alc889A_mb31_automute(codec);
9784 #ifdef CONFIG_SND_HDA_POWER_SAVE
9785 #define alc882_loopbacks alc880_loopbacks
9788 /* pcm configuration: identical with ALC880 */
9789 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9790 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9791 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9792 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9794 static hda_nid_t alc883_slave_dig_outs[] = {
9795 ALC1200_DIGOUT_NID, 0,
9798 static hda_nid_t alc1200_slave_dig_outs[] = {
9799 ALC883_DIGOUT_NID, 0,
9803 * configuration and preset
9805 static const char * const alc882_models[ALC882_MODEL_LAST] = {
9806 [ALC882_3ST_DIG] = "3stack-dig",
9807 [ALC882_6ST_DIG] = "6stack-dig",
9808 [ALC882_ARIMA] = "arima",
9809 [ALC882_W2JC] = "w2jc",
9810 [ALC882_TARGA] = "targa",
9811 [ALC882_ASUS_A7J] = "asus-a7j",
9812 [ALC882_ASUS_A7M] = "asus-a7m",
9813 [ALC885_MACPRO] = "macpro",
9814 [ALC885_MB5] = "mb5",
9815 [ALC885_MACMINI3] = "macmini3",
9816 [ALC885_MBA21] = "mba21",
9817 [ALC885_MBP3] = "mbp3",
9818 [ALC885_IMAC24] = "imac24",
9819 [ALC885_IMAC91] = "imac91",
9820 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9821 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9822 [ALC883_3ST_6ch] = "3stack-6ch",
9823 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9824 [ALC883_TARGA_DIG] = "targa-dig",
9825 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9826 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9827 [ALC883_ACER] = "acer",
9828 [ALC883_ACER_ASPIRE] = "acer-aspire",
9829 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9830 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9831 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9832 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9833 [ALC883_MEDION] = "medion",
9834 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9835 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9836 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9837 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9838 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9839 [ALC888_LENOVO_SKY] = "lenovo-sky",
9840 [ALC883_HAIER_W66] = "haier-w66",
9841 [ALC888_3ST_HP] = "3stack-hp",
9842 [ALC888_6ST_DELL] = "6stack-dell",
9843 [ALC883_MITAC] = "mitac",
9844 [ALC883_CLEVO_M540R] = "clevo-m540r",
9845 [ALC883_CLEVO_M720] = "clevo-m720",
9846 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9847 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9848 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9849 [ALC889A_INTEL] = "intel-alc889a",
9850 [ALC889_INTEL] = "intel-x58",
9851 [ALC1200_ASUS_P5Q] = "asus-p5q",
9852 [ALC889A_MB31] = "mb31",
9853 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9854 [ALC882_AUTO] = "auto",
9857 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9858 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9860 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9861 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9862 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9863 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9864 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9865 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9866 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9867 ALC888_ACER_ASPIRE_4930G),
9868 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9869 ALC888_ACER_ASPIRE_4930G),
9870 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9871 ALC888_ACER_ASPIRE_8930G),
9872 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9873 ALC888_ACER_ASPIRE_8930G),
9874 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9875 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9876 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9877 ALC888_ACER_ASPIRE_6530G),
9878 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9879 ALC888_ACER_ASPIRE_6530G),
9880 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9881 ALC888_ACER_ASPIRE_7730G),
9882 /* default Acer -- disabled as it causes more problems.
9883 * model=auto should work fine now
9885 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9887 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9889 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9890 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9891 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9892 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9893 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9894 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9896 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9897 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9898 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9899 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9900 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9901 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9902 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9903 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9904 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9905 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9906 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9908 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9909 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9910 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9911 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9912 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9913 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9914 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9915 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9916 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9918 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9919 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9920 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9921 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9922 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9923 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9924 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9925 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9926 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9927 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9928 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9929 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9930 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9931 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9932 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9933 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9934 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9935 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9936 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9937 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9938 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9939 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9940 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9941 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9942 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9943 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9944 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9945 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9946 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9947 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9948 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9950 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9951 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9952 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9953 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9954 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9955 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9956 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9957 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9958 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9959 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9960 ALC883_FUJITSU_PI2515),
9961 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9962 ALC888_FUJITSU_XA3530),
9963 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9964 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9965 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9966 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9967 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9968 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9969 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9970 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9972 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9973 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9974 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9975 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9976 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9977 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9978 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9983 /* codec SSID table for Intel Mac */
9984 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9985 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9986 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9987 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9988 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9989 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9990 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9991 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9992 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9993 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9994 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9995 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9996 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9997 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9998 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9999 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
10000 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
10001 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
10002 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
10003 * so apparently no perfect solution yet
10005 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
10006 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
10007 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
10008 {} /* terminator */
10011 static struct alc_config_preset alc882_presets[] = {
10012 [ALC882_3ST_DIG] = {
10013 .mixers = { alc882_base_mixer },
10014 .init_verbs = { alc882_base_init_verbs,
10015 alc882_adc1_init_verbs },
10016 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10017 .dac_nids = alc882_dac_nids,
10018 .dig_out_nid = ALC882_DIGOUT_NID,
10019 .dig_in_nid = ALC882_DIGIN_NID,
10020 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10021 .channel_mode = alc882_ch_modes,
10023 .input_mux = &alc882_capture_source,
10025 [ALC882_6ST_DIG] = {
10026 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10027 .init_verbs = { alc882_base_init_verbs,
10028 alc882_adc1_init_verbs },
10029 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10030 .dac_nids = alc882_dac_nids,
10031 .dig_out_nid = ALC882_DIGOUT_NID,
10032 .dig_in_nid = ALC882_DIGIN_NID,
10033 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10034 .channel_mode = alc882_sixstack_modes,
10035 .input_mux = &alc882_capture_source,
10038 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10039 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10040 alc882_eapd_verbs },
10041 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10042 .dac_nids = alc882_dac_nids,
10043 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10044 .channel_mode = alc882_sixstack_modes,
10045 .input_mux = &alc882_capture_source,
10048 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
10049 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10050 alc882_eapd_verbs, alc880_gpio1_init_verbs },
10051 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10052 .dac_nids = alc882_dac_nids,
10053 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10054 .channel_mode = alc880_threestack_modes,
10056 .input_mux = &alc882_capture_source,
10057 .dig_out_nid = ALC882_DIGOUT_NID,
10060 .mixers = { alc885_mba21_mixer },
10061 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
10063 .dac_nids = alc882_dac_nids,
10064 .channel_mode = alc885_mba21_ch_modes,
10065 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10066 .input_mux = &alc882_capture_source,
10067 .unsol_event = alc_automute_amp_unsol_event,
10068 .setup = alc885_mba21_setup,
10069 .init_hook = alc_automute_amp,
10072 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
10073 .init_verbs = { alc885_mbp3_init_verbs,
10074 alc880_gpio1_init_verbs },
10076 .dac_nids = alc882_dac_nids,
10078 .channel_mode = alc885_mbp_4ch_modes,
10079 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10080 .input_mux = &alc882_capture_source,
10081 .dig_out_nid = ALC882_DIGOUT_NID,
10082 .dig_in_nid = ALC882_DIGIN_NID,
10083 .unsol_event = alc_automute_amp_unsol_event,
10084 .setup = alc885_mbp3_setup,
10085 .init_hook = alc_automute_amp,
10088 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10089 .init_verbs = { alc885_mb5_init_verbs,
10090 alc880_gpio1_init_verbs },
10091 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10092 .dac_nids = alc882_dac_nids,
10093 .channel_mode = alc885_mb5_6ch_modes,
10094 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10095 .input_mux = &mb5_capture_source,
10096 .dig_out_nid = ALC882_DIGOUT_NID,
10097 .dig_in_nid = ALC882_DIGIN_NID,
10098 .unsol_event = alc_automute_amp_unsol_event,
10099 .setup = alc885_mb5_setup,
10100 .init_hook = alc_automute_amp,
10102 [ALC885_MACMINI3] = {
10103 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10104 .init_verbs = { alc885_macmini3_init_verbs,
10105 alc880_gpio1_init_verbs },
10106 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10107 .dac_nids = alc882_dac_nids,
10108 .channel_mode = alc885_macmini3_6ch_modes,
10109 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10110 .input_mux = &macmini3_capture_source,
10111 .dig_out_nid = ALC882_DIGOUT_NID,
10112 .dig_in_nid = ALC882_DIGIN_NID,
10113 .unsol_event = alc_automute_amp_unsol_event,
10114 .setup = alc885_macmini3_setup,
10115 .init_hook = alc_automute_amp,
10117 [ALC885_MACPRO] = {
10118 .mixers = { alc882_macpro_mixer },
10119 .init_verbs = { alc882_macpro_init_verbs },
10120 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10121 .dac_nids = alc882_dac_nids,
10122 .dig_out_nid = ALC882_DIGOUT_NID,
10123 .dig_in_nid = ALC882_DIGIN_NID,
10124 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10125 .channel_mode = alc882_ch_modes,
10126 .input_mux = &alc882_capture_source,
10127 .init_hook = alc885_macpro_init_hook,
10129 [ALC885_IMAC24] = {
10130 .mixers = { alc885_imac24_mixer },
10131 .init_verbs = { alc885_imac24_init_verbs },
10132 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10133 .dac_nids = alc882_dac_nids,
10134 .dig_out_nid = ALC882_DIGOUT_NID,
10135 .dig_in_nid = ALC882_DIGIN_NID,
10136 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10137 .channel_mode = alc882_ch_modes,
10138 .input_mux = &alc882_capture_source,
10139 .unsol_event = alc_automute_amp_unsol_event,
10140 .setup = alc885_imac24_setup,
10141 .init_hook = alc885_imac24_init_hook,
10143 [ALC885_IMAC91] = {
10144 .mixers = {alc885_imac91_mixer},
10145 .init_verbs = { alc885_imac91_init_verbs,
10146 alc880_gpio1_init_verbs },
10147 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10148 .dac_nids = alc882_dac_nids,
10149 .channel_mode = alc885_mba21_ch_modes,
10150 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10151 .input_mux = &alc889A_imac91_capture_source,
10152 .dig_out_nid = ALC882_DIGOUT_NID,
10153 .dig_in_nid = ALC882_DIGIN_NID,
10154 .unsol_event = alc_automute_amp_unsol_event,
10155 .setup = alc885_imac91_setup,
10156 .init_hook = alc_automute_amp,
10159 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10160 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10161 alc880_gpio3_init_verbs, alc882_targa_verbs},
10162 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10163 .dac_nids = alc882_dac_nids,
10164 .dig_out_nid = ALC882_DIGOUT_NID,
10165 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10166 .adc_nids = alc882_adc_nids,
10167 .capsrc_nids = alc882_capsrc_nids,
10168 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10169 .channel_mode = alc882_3ST_6ch_modes,
10171 .input_mux = &alc882_capture_source,
10172 .unsol_event = alc882_targa_unsol_event,
10173 .setup = alc882_targa_setup,
10174 .init_hook = alc882_targa_automute,
10176 [ALC882_ASUS_A7J] = {
10177 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10178 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10179 alc882_asus_a7j_verbs},
10180 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10181 .dac_nids = alc882_dac_nids,
10182 .dig_out_nid = ALC882_DIGOUT_NID,
10183 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10184 .adc_nids = alc882_adc_nids,
10185 .capsrc_nids = alc882_capsrc_nids,
10186 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10187 .channel_mode = alc882_3ST_6ch_modes,
10189 .input_mux = &alc882_capture_source,
10191 [ALC882_ASUS_A7M] = {
10192 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10193 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10194 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10195 alc882_asus_a7m_verbs },
10196 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10197 .dac_nids = alc882_dac_nids,
10198 .dig_out_nid = ALC882_DIGOUT_NID,
10199 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10200 .channel_mode = alc880_threestack_modes,
10202 .input_mux = &alc882_capture_source,
10204 [ALC883_3ST_2ch_DIG] = {
10205 .mixers = { alc883_3ST_2ch_mixer },
10206 .init_verbs = { alc883_init_verbs },
10207 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10208 .dac_nids = alc883_dac_nids,
10209 .dig_out_nid = ALC883_DIGOUT_NID,
10210 .dig_in_nid = ALC883_DIGIN_NID,
10211 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10212 .channel_mode = alc883_3ST_2ch_modes,
10213 .input_mux = &alc883_capture_source,
10215 [ALC883_3ST_6ch_DIG] = {
10216 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10217 .init_verbs = { alc883_init_verbs },
10218 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10219 .dac_nids = alc883_dac_nids,
10220 .dig_out_nid = ALC883_DIGOUT_NID,
10221 .dig_in_nid = ALC883_DIGIN_NID,
10222 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10223 .channel_mode = alc883_3ST_6ch_modes,
10225 .input_mux = &alc883_capture_source,
10227 [ALC883_3ST_6ch] = {
10228 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10229 .init_verbs = { alc883_init_verbs },
10230 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10231 .dac_nids = alc883_dac_nids,
10232 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10233 .channel_mode = alc883_3ST_6ch_modes,
10235 .input_mux = &alc883_capture_source,
10237 [ALC883_3ST_6ch_INTEL] = {
10238 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10239 .init_verbs = { alc883_init_verbs },
10240 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10241 .dac_nids = alc883_dac_nids,
10242 .dig_out_nid = ALC883_DIGOUT_NID,
10243 .dig_in_nid = ALC883_DIGIN_NID,
10244 .slave_dig_outs = alc883_slave_dig_outs,
10245 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10246 .channel_mode = alc883_3ST_6ch_intel_modes,
10248 .input_mux = &alc883_3stack_6ch_intel,
10250 [ALC889A_INTEL] = {
10251 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10252 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10253 alc_hp15_unsol_verbs },
10254 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10255 .dac_nids = alc883_dac_nids,
10256 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10257 .adc_nids = alc889_adc_nids,
10258 .dig_out_nid = ALC883_DIGOUT_NID,
10259 .dig_in_nid = ALC883_DIGIN_NID,
10260 .slave_dig_outs = alc883_slave_dig_outs,
10261 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10262 .channel_mode = alc889_8ch_intel_modes,
10263 .capsrc_nids = alc889_capsrc_nids,
10264 .input_mux = &alc889_capture_source,
10265 .setup = alc889_automute_setup,
10266 .init_hook = alc_automute_amp,
10267 .unsol_event = alc_automute_amp_unsol_event,
10271 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10272 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10273 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10274 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10275 .dac_nids = alc883_dac_nids,
10276 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10277 .adc_nids = alc889_adc_nids,
10278 .dig_out_nid = ALC883_DIGOUT_NID,
10279 .dig_in_nid = ALC883_DIGIN_NID,
10280 .slave_dig_outs = alc883_slave_dig_outs,
10281 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10282 .channel_mode = alc889_8ch_intel_modes,
10283 .capsrc_nids = alc889_capsrc_nids,
10284 .input_mux = &alc889_capture_source,
10285 .setup = alc889_automute_setup,
10286 .init_hook = alc889_intel_init_hook,
10287 .unsol_event = alc_automute_amp_unsol_event,
10290 [ALC883_6ST_DIG] = {
10291 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10292 .init_verbs = { alc883_init_verbs },
10293 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10294 .dac_nids = alc883_dac_nids,
10295 .dig_out_nid = ALC883_DIGOUT_NID,
10296 .dig_in_nid = ALC883_DIGIN_NID,
10297 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10298 .channel_mode = alc883_sixstack_modes,
10299 .input_mux = &alc883_capture_source,
10301 [ALC883_TARGA_DIG] = {
10302 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10303 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10304 alc883_targa_verbs},
10305 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10306 .dac_nids = alc883_dac_nids,
10307 .dig_out_nid = ALC883_DIGOUT_NID,
10308 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10309 .channel_mode = alc883_3ST_6ch_modes,
10311 .input_mux = &alc883_capture_source,
10312 .unsol_event = alc883_targa_unsol_event,
10313 .setup = alc882_targa_setup,
10314 .init_hook = alc882_targa_automute,
10316 [ALC883_TARGA_2ch_DIG] = {
10317 .mixers = { alc883_targa_2ch_mixer},
10318 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10319 alc883_targa_verbs},
10320 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10321 .dac_nids = alc883_dac_nids,
10322 .adc_nids = alc883_adc_nids_alt,
10323 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10324 .capsrc_nids = alc883_capsrc_nids,
10325 .dig_out_nid = ALC883_DIGOUT_NID,
10326 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10327 .channel_mode = alc883_3ST_2ch_modes,
10328 .input_mux = &alc883_capture_source,
10329 .unsol_event = alc883_targa_unsol_event,
10330 .setup = alc882_targa_setup,
10331 .init_hook = alc882_targa_automute,
10333 [ALC883_TARGA_8ch_DIG] = {
10334 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10335 alc883_chmode_mixer },
10336 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10337 alc883_targa_verbs },
10338 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10339 .dac_nids = alc883_dac_nids,
10340 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10341 .adc_nids = alc883_adc_nids_rev,
10342 .capsrc_nids = alc883_capsrc_nids_rev,
10343 .dig_out_nid = ALC883_DIGOUT_NID,
10344 .dig_in_nid = ALC883_DIGIN_NID,
10345 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10346 .channel_mode = alc883_4ST_8ch_modes,
10348 .input_mux = &alc883_capture_source,
10349 .unsol_event = alc883_targa_unsol_event,
10350 .setup = alc882_targa_setup,
10351 .init_hook = alc882_targa_automute,
10354 .mixers = { alc883_base_mixer },
10355 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10356 * and the headphone jack. Turn this on and rely on the
10357 * standard mute methods whenever the user wants to turn
10358 * these outputs off.
10360 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10361 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10362 .dac_nids = alc883_dac_nids,
10363 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10364 .channel_mode = alc883_3ST_2ch_modes,
10365 .input_mux = &alc883_capture_source,
10367 [ALC883_ACER_ASPIRE] = {
10368 .mixers = { alc883_acer_aspire_mixer },
10369 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10370 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10371 .dac_nids = alc883_dac_nids,
10372 .dig_out_nid = ALC883_DIGOUT_NID,
10373 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10374 .channel_mode = alc883_3ST_2ch_modes,
10375 .input_mux = &alc883_capture_source,
10376 .unsol_event = alc_automute_amp_unsol_event,
10377 .setup = alc883_acer_aspire_setup,
10378 .init_hook = alc_automute_amp,
10380 [ALC888_ACER_ASPIRE_4930G] = {
10381 .mixers = { alc888_acer_aspire_4930g_mixer,
10382 alc883_chmode_mixer },
10383 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10384 alc888_acer_aspire_4930g_verbs },
10385 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10386 .dac_nids = alc883_dac_nids,
10387 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10388 .adc_nids = alc883_adc_nids_rev,
10389 .capsrc_nids = alc883_capsrc_nids_rev,
10390 .dig_out_nid = ALC883_DIGOUT_NID,
10391 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10392 .channel_mode = alc883_3ST_6ch_modes,
10394 .const_channel_count = 6,
10396 ARRAY_SIZE(alc888_2_capture_sources),
10397 .input_mux = alc888_2_capture_sources,
10398 .unsol_event = alc_automute_amp_unsol_event,
10399 .setup = alc888_acer_aspire_4930g_setup,
10400 .init_hook = alc_automute_amp,
10402 [ALC888_ACER_ASPIRE_6530G] = {
10403 .mixers = { alc888_acer_aspire_6530_mixer },
10404 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10405 alc888_acer_aspire_6530g_verbs },
10406 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10407 .dac_nids = alc883_dac_nids,
10408 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10409 .adc_nids = alc883_adc_nids_rev,
10410 .capsrc_nids = alc883_capsrc_nids_rev,
10411 .dig_out_nid = ALC883_DIGOUT_NID,
10412 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10413 .channel_mode = alc883_3ST_2ch_modes,
10415 ARRAY_SIZE(alc888_2_capture_sources),
10416 .input_mux = alc888_acer_aspire_6530_sources,
10417 .unsol_event = alc_automute_amp_unsol_event,
10418 .setup = alc888_acer_aspire_6530g_setup,
10419 .init_hook = alc_automute_amp,
10421 [ALC888_ACER_ASPIRE_8930G] = {
10422 .mixers = { alc889_acer_aspire_8930g_mixer,
10423 alc883_chmode_mixer },
10424 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10425 alc889_acer_aspire_8930g_verbs,
10426 alc889_eapd_verbs},
10427 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10428 .dac_nids = alc883_dac_nids,
10429 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10430 .adc_nids = alc889_adc_nids,
10431 .capsrc_nids = alc889_capsrc_nids,
10432 .dig_out_nid = ALC883_DIGOUT_NID,
10433 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10434 .channel_mode = alc883_3ST_6ch_modes,
10436 .const_channel_count = 6,
10438 ARRAY_SIZE(alc889_capture_sources),
10439 .input_mux = alc889_capture_sources,
10440 .unsol_event = alc_automute_amp_unsol_event,
10441 .setup = alc889_acer_aspire_8930g_setup,
10442 .init_hook = alc_automute_amp,
10443 #ifdef CONFIG_SND_HDA_POWER_SAVE
10444 .power_hook = alc_power_eapd,
10447 [ALC888_ACER_ASPIRE_7730G] = {
10448 .mixers = { alc883_3ST_6ch_mixer,
10449 alc883_chmode_mixer },
10450 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10451 alc888_acer_aspire_7730G_verbs },
10452 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10453 .dac_nids = alc883_dac_nids,
10454 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10455 .adc_nids = alc883_adc_nids_rev,
10456 .capsrc_nids = alc883_capsrc_nids_rev,
10457 .dig_out_nid = ALC883_DIGOUT_NID,
10458 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10459 .channel_mode = alc883_3ST_6ch_modes,
10461 .const_channel_count = 6,
10462 .input_mux = &alc883_capture_source,
10463 .unsol_event = alc_automute_amp_unsol_event,
10464 .setup = alc888_acer_aspire_7730g_setup,
10465 .init_hook = alc_automute_amp,
10467 [ALC883_MEDION] = {
10468 .mixers = { alc883_fivestack_mixer,
10469 alc883_chmode_mixer },
10470 .init_verbs = { alc883_init_verbs,
10471 alc883_medion_eapd_verbs },
10472 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10473 .dac_nids = alc883_dac_nids,
10474 .adc_nids = alc883_adc_nids_alt,
10475 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10476 .capsrc_nids = alc883_capsrc_nids,
10477 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10478 .channel_mode = alc883_sixstack_modes,
10479 .input_mux = &alc883_capture_source,
10481 [ALC883_MEDION_WIM2160] = {
10482 .mixers = { alc883_medion_wim2160_mixer },
10483 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10484 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10485 .dac_nids = alc883_dac_nids,
10486 .dig_out_nid = ALC883_DIGOUT_NID,
10487 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10488 .adc_nids = alc883_adc_nids,
10489 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10490 .channel_mode = alc883_3ST_2ch_modes,
10491 .input_mux = &alc883_capture_source,
10492 .unsol_event = alc_automute_amp_unsol_event,
10493 .setup = alc883_medion_wim2160_setup,
10494 .init_hook = alc_automute_amp,
10496 [ALC883_LAPTOP_EAPD] = {
10497 .mixers = { alc883_base_mixer },
10498 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10499 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10500 .dac_nids = alc883_dac_nids,
10501 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10502 .channel_mode = alc883_3ST_2ch_modes,
10503 .input_mux = &alc883_capture_source,
10505 [ALC883_CLEVO_M540R] = {
10506 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10507 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10508 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10509 .dac_nids = alc883_dac_nids,
10510 .dig_out_nid = ALC883_DIGOUT_NID,
10511 .dig_in_nid = ALC883_DIGIN_NID,
10512 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10513 .channel_mode = alc883_3ST_6ch_clevo_modes,
10515 .input_mux = &alc883_capture_source,
10516 /* This machine has the hardware HP auto-muting, thus
10517 * we need no software mute via unsol event
10520 [ALC883_CLEVO_M720] = {
10521 .mixers = { alc883_clevo_m720_mixer },
10522 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10523 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10524 .dac_nids = alc883_dac_nids,
10525 .dig_out_nid = ALC883_DIGOUT_NID,
10526 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10527 .channel_mode = alc883_3ST_2ch_modes,
10528 .input_mux = &alc883_capture_source,
10529 .unsol_event = alc883_clevo_m720_unsol_event,
10530 .setup = alc883_clevo_m720_setup,
10531 .init_hook = alc883_clevo_m720_init_hook,
10533 [ALC883_LENOVO_101E_2ch] = {
10534 .mixers = { alc883_lenovo_101e_2ch_mixer},
10535 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10536 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10537 .dac_nids = alc883_dac_nids,
10538 .adc_nids = alc883_adc_nids_alt,
10539 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10540 .capsrc_nids = alc883_capsrc_nids,
10541 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10542 .channel_mode = alc883_3ST_2ch_modes,
10543 .input_mux = &alc883_lenovo_101e_capture_source,
10544 .unsol_event = alc883_lenovo_101e_unsol_event,
10545 .init_hook = alc883_lenovo_101e_all_automute,
10547 [ALC883_LENOVO_NB0763] = {
10548 .mixers = { alc883_lenovo_nb0763_mixer },
10549 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10550 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10551 .dac_nids = alc883_dac_nids,
10552 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10553 .channel_mode = alc883_3ST_2ch_modes,
10555 .input_mux = &alc883_lenovo_nb0763_capture_source,
10556 .unsol_event = alc_automute_amp_unsol_event,
10557 .setup = alc883_lenovo_nb0763_setup,
10558 .init_hook = alc_automute_amp,
10560 [ALC888_LENOVO_MS7195_DIG] = {
10561 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10562 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10563 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10564 .dac_nids = alc883_dac_nids,
10565 .dig_out_nid = ALC883_DIGOUT_NID,
10566 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10567 .channel_mode = alc883_3ST_6ch_modes,
10569 .input_mux = &alc883_capture_source,
10570 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10571 .init_hook = alc888_lenovo_ms7195_front_automute,
10573 [ALC883_HAIER_W66] = {
10574 .mixers = { alc883_targa_2ch_mixer},
10575 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10576 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10577 .dac_nids = alc883_dac_nids,
10578 .dig_out_nid = ALC883_DIGOUT_NID,
10579 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10580 .channel_mode = alc883_3ST_2ch_modes,
10581 .input_mux = &alc883_capture_source,
10582 .unsol_event = alc_automute_amp_unsol_event,
10583 .setup = alc883_haier_w66_setup,
10584 .init_hook = alc_automute_amp,
10586 [ALC888_3ST_HP] = {
10587 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10588 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10589 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10590 .dac_nids = alc883_dac_nids,
10591 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10592 .channel_mode = alc888_3st_hp_modes,
10594 .input_mux = &alc883_capture_source,
10595 .unsol_event = alc_automute_amp_unsol_event,
10596 .setup = alc888_3st_hp_setup,
10597 .init_hook = alc_automute_amp,
10599 [ALC888_6ST_DELL] = {
10600 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10601 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10602 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10603 .dac_nids = alc883_dac_nids,
10604 .dig_out_nid = ALC883_DIGOUT_NID,
10605 .dig_in_nid = ALC883_DIGIN_NID,
10606 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10607 .channel_mode = alc883_sixstack_modes,
10608 .input_mux = &alc883_capture_source,
10609 .unsol_event = alc_automute_amp_unsol_event,
10610 .setup = alc888_6st_dell_setup,
10611 .init_hook = alc_automute_amp,
10614 .mixers = { alc883_mitac_mixer },
10615 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10616 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10617 .dac_nids = alc883_dac_nids,
10618 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10619 .channel_mode = alc883_3ST_2ch_modes,
10620 .input_mux = &alc883_capture_source,
10621 .unsol_event = alc_automute_amp_unsol_event,
10622 .setup = alc883_mitac_setup,
10623 .init_hook = alc_automute_amp,
10625 [ALC883_FUJITSU_PI2515] = {
10626 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10627 .init_verbs = { alc883_init_verbs,
10628 alc883_2ch_fujitsu_pi2515_verbs},
10629 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10630 .dac_nids = alc883_dac_nids,
10631 .dig_out_nid = ALC883_DIGOUT_NID,
10632 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10633 .channel_mode = alc883_3ST_2ch_modes,
10634 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10635 .unsol_event = alc_automute_amp_unsol_event,
10636 .setup = alc883_2ch_fujitsu_pi2515_setup,
10637 .init_hook = alc_automute_amp,
10639 [ALC888_FUJITSU_XA3530] = {
10640 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10641 .init_verbs = { alc883_init_verbs,
10642 alc888_fujitsu_xa3530_verbs },
10643 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10644 .dac_nids = alc883_dac_nids,
10645 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10646 .adc_nids = alc883_adc_nids_rev,
10647 .capsrc_nids = alc883_capsrc_nids_rev,
10648 .dig_out_nid = ALC883_DIGOUT_NID,
10649 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10650 .channel_mode = alc888_4ST_8ch_intel_modes,
10652 ARRAY_SIZE(alc888_2_capture_sources),
10653 .input_mux = alc888_2_capture_sources,
10654 .unsol_event = alc_automute_amp_unsol_event,
10655 .setup = alc888_fujitsu_xa3530_setup,
10656 .init_hook = alc_automute_amp,
10658 [ALC888_LENOVO_SKY] = {
10659 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10660 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10661 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10662 .dac_nids = alc883_dac_nids,
10663 .dig_out_nid = ALC883_DIGOUT_NID,
10664 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10665 .channel_mode = alc883_sixstack_modes,
10667 .input_mux = &alc883_lenovo_sky_capture_source,
10668 .unsol_event = alc_automute_amp_unsol_event,
10669 .setup = alc888_lenovo_sky_setup,
10670 .init_hook = alc_automute_amp,
10672 [ALC888_ASUS_M90V] = {
10673 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10674 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10675 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10676 .dac_nids = alc883_dac_nids,
10677 .dig_out_nid = ALC883_DIGOUT_NID,
10678 .dig_in_nid = ALC883_DIGIN_NID,
10679 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10680 .channel_mode = alc883_3ST_6ch_modes,
10682 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10683 .unsol_event = alc_sku_unsol_event,
10684 .setup = alc883_mode2_setup,
10685 .init_hook = alc_inithook,
10687 [ALC888_ASUS_EEE1601] = {
10688 .mixers = { alc883_asus_eee1601_mixer },
10689 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10690 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10691 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10692 .dac_nids = alc883_dac_nids,
10693 .dig_out_nid = ALC883_DIGOUT_NID,
10694 .dig_in_nid = ALC883_DIGIN_NID,
10695 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10696 .channel_mode = alc883_3ST_2ch_modes,
10698 .input_mux = &alc883_asus_eee1601_capture_source,
10699 .unsol_event = alc_sku_unsol_event,
10700 .init_hook = alc883_eee1601_inithook,
10702 [ALC1200_ASUS_P5Q] = {
10703 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10704 .init_verbs = { alc883_init_verbs },
10705 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10706 .dac_nids = alc883_dac_nids,
10707 .dig_out_nid = ALC1200_DIGOUT_NID,
10708 .dig_in_nid = ALC883_DIGIN_NID,
10709 .slave_dig_outs = alc1200_slave_dig_outs,
10710 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10711 .channel_mode = alc883_sixstack_modes,
10712 .input_mux = &alc883_capture_source,
10715 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10716 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10717 alc880_gpio1_init_verbs },
10718 .adc_nids = alc883_adc_nids,
10719 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10720 .capsrc_nids = alc883_capsrc_nids,
10721 .dac_nids = alc883_dac_nids,
10722 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10723 .channel_mode = alc889A_mb31_6ch_modes,
10724 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10725 .input_mux = &alc889A_mb31_capture_source,
10726 .dig_out_nid = ALC883_DIGOUT_NID,
10727 .unsol_event = alc889A_mb31_unsol_event,
10728 .init_hook = alc889A_mb31_automute,
10730 [ALC883_SONY_VAIO_TT] = {
10731 .mixers = { alc883_vaiott_mixer },
10732 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10733 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10734 .dac_nids = alc883_dac_nids,
10735 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10736 .channel_mode = alc883_3ST_2ch_modes,
10737 .input_mux = &alc883_capture_source,
10738 .unsol_event = alc_automute_amp_unsol_event,
10739 .setup = alc883_vaiott_setup,
10740 .init_hook = alc_automute_amp,
10749 PINFIX_ABIT_AW9D_MAX,
10751 PINFIX_ACER_ASPIRE_7736,
10754 static const struct alc_fixup alc882_fixups[] = {
10755 [PINFIX_ABIT_AW9D_MAX] = {
10756 .type = ALC_FIXUP_PINS,
10757 .v.pins = (const struct alc_pincfg[]) {
10758 { 0x15, 0x01080104 }, /* side */
10759 { 0x16, 0x01011012 }, /* rear */
10760 { 0x17, 0x01016011 }, /* clfe */
10764 [PINFIX_PB_M5210] = {
10765 .type = ALC_FIXUP_VERBS,
10766 .v.verbs = (const struct hda_verb[]) {
10767 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10771 [PINFIX_ACER_ASPIRE_7736] = {
10772 .type = ALC_FIXUP_SKU,
10773 .v.sku = ALC_FIXUP_SKU_IGNORE,
10777 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10778 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10779 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10780 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10785 * BIOS auto configuration
10787 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10788 const struct auto_pin_cfg *cfg)
10790 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10793 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10794 hda_nid_t nid, int pin_type,
10799 /* set as output */
10800 alc_set_pin_output(codec, nid, pin_type);
10804 else if (dac >= 0x02 && dac <= 0x05)
10808 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10811 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10813 struct alc_spec *spec = codec->spec;
10816 for (i = 0; i <= HDA_SIDE; i++) {
10817 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10818 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10820 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10821 spec->multiout.dac_nids[i]);
10825 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10827 struct alc_spec *spec = codec->spec;
10828 hda_nid_t pin, dac;
10831 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10832 pin = spec->autocfg.hp_pins[i];
10835 dac = spec->multiout.hp_nid;
10837 dac = spec->multiout.dac_nids[0]; /* to front */
10838 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10840 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10841 pin = spec->autocfg.speaker_pins[i];
10844 dac = spec->multiout.extra_out_nid[0];
10846 dac = spec->multiout.dac_nids[0]; /* to front */
10847 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10851 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10853 struct alc_spec *spec = codec->spec;
10854 struct auto_pin_cfg *cfg = &spec->autocfg;
10857 for (i = 0; i < cfg->num_inputs; i++) {
10858 hda_nid_t nid = cfg->inputs[i].pin;
10859 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10860 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10861 snd_hda_codec_write(codec, nid, 0,
10862 AC_VERB_SET_AMP_GAIN_MUTE,
10867 static void alc882_auto_init_input_src(struct hda_codec *codec)
10869 struct alc_spec *spec = codec->spec;
10872 for (c = 0; c < spec->num_adc_nids; c++) {
10873 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10874 hda_nid_t nid = spec->capsrc_nids[c];
10875 unsigned int mux_idx;
10876 const struct hda_input_mux *imux;
10877 int conns, mute, idx, item;
10879 conns = snd_hda_get_connections(codec, nid, conn_list,
10880 ARRAY_SIZE(conn_list));
10883 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10884 imux = &spec->input_mux[mux_idx];
10885 if (!imux->num_items && mux_idx > 0)
10886 imux = &spec->input_mux[0];
10887 for (idx = 0; idx < conns; idx++) {
10888 /* if the current connection is the selected one,
10889 * unmute it as default - otherwise mute it
10891 mute = AMP_IN_MUTE(idx);
10892 for (item = 0; item < imux->num_items; item++) {
10893 if (imux->items[item].index == idx) {
10894 if (spec->cur_mux[c] == item)
10895 mute = AMP_IN_UNMUTE(idx);
10899 /* check if we have a selector or mixer
10900 * we could check for the widget type instead, but
10901 * just check for Amp-In presence (in case of mixer
10902 * without amp-in there is something wrong, this
10903 * function shouldn't be used or capsrc nid is wrong)
10905 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10906 snd_hda_codec_write(codec, nid, 0,
10907 AC_VERB_SET_AMP_GAIN_MUTE,
10909 else if (mute != AMP_IN_MUTE(idx))
10910 snd_hda_codec_write(codec, nid, 0,
10911 AC_VERB_SET_CONNECT_SEL,
10917 /* add mic boosts if needed */
10918 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10920 struct alc_spec *spec = codec->spec;
10921 struct auto_pin_cfg *cfg = &spec->autocfg;
10925 const char *prev_label = NULL;
10927 for (i = 0; i < cfg->num_inputs; i++) {
10928 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10930 nid = cfg->inputs[i].pin;
10931 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10933 char boost_label[32];
10935 label = hda_get_autocfg_input_label(codec, cfg, i);
10936 if (prev_label && !strcmp(label, prev_label))
10940 prev_label = label;
10942 snprintf(boost_label, sizeof(boost_label),
10943 "%s Boost Volume", label);
10944 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10945 boost_label, type_idx,
10946 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10954 /* almost identical with ALC880 parser... */
10955 static int alc882_parse_auto_config(struct hda_codec *codec)
10957 struct alc_spec *spec = codec->spec;
10958 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10961 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10965 if (!spec->autocfg.line_outs)
10966 return 0; /* can't find valid BIOS pin config */
10968 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10971 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10974 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10978 err = alc880_auto_create_extra_out(spec,
10979 spec->autocfg.speaker_pins[0],
10983 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10987 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10989 alc_auto_parse_digital(codec);
10991 if (spec->kctls.list)
10992 add_mixer(spec, spec->kctls.list);
10994 add_verb(spec, alc883_auto_init_verbs);
10995 /* if ADC 0x07 is available, initialize it, too */
10996 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10997 add_verb(spec, alc882_adc1_init_verbs);
10999 spec->num_mux_defs = 1;
11000 spec->input_mux = &spec->private_imux[0];
11002 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11004 err = alc_auto_add_mic_boost(codec);
11008 return 1; /* config found */
11011 /* additional initialization for auto-configuration model */
11012 static void alc882_auto_init(struct hda_codec *codec)
11014 struct alc_spec *spec = codec->spec;
11015 alc882_auto_init_multi_out(codec);
11016 alc882_auto_init_hp_out(codec);
11017 alc882_auto_init_analog_input(codec);
11018 alc882_auto_init_input_src(codec);
11019 alc_auto_init_digital(codec);
11020 if (spec->unsol_event)
11021 alc_inithook(codec);
11024 static int patch_alc882(struct hda_codec *codec)
11026 struct alc_spec *spec;
11027 int err, board_config;
11029 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11033 codec->spec = spec;
11035 switch (codec->vendor_id) {
11040 /* ALC883 and variants */
11041 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11045 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
11049 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
11050 board_config = snd_hda_check_board_codec_sid_config(codec,
11051 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
11053 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
11054 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11056 board_config = ALC882_AUTO;
11059 if (board_config == ALC882_AUTO) {
11060 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11061 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11064 alc_auto_parse_customize_define(codec);
11066 if (board_config == ALC882_AUTO) {
11067 /* automatic parse from the BIOS config */
11068 err = alc882_parse_auto_config(codec);
11074 "hda_codec: Cannot set up configuration "
11075 "from BIOS. Using base mode...\n");
11076 board_config = ALC882_3ST_DIG;
11080 if (has_cdefine_beep(codec)) {
11081 err = snd_hda_attach_beep_device(codec, 0x1);
11088 if (board_config != ALC882_AUTO)
11089 setup_preset(codec, &alc882_presets[board_config]);
11091 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11092 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11093 /* FIXME: setup DAC5 */
11094 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11095 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11097 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11098 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11100 if (!spec->adc_nids && spec->input_mux) {
11102 spec->num_adc_nids = 0;
11103 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11104 const struct hda_input_mux *imux = spec->input_mux;
11106 hda_nid_t items[16];
11107 hda_nid_t nid = alc882_adc_nids[i];
11108 unsigned int wcap = get_wcaps(codec, nid);
11110 wcap = get_wcaps_type(wcap);
11111 if (wcap != AC_WID_AUD_IN)
11113 spec->private_adc_nids[spec->num_adc_nids] = nid;
11114 err = snd_hda_get_connections(codec, nid, &cap, 1);
11117 err = snd_hda_get_connections(codec, cap, items,
11118 ARRAY_SIZE(items));
11121 for (j = 0; j < imux->num_items; j++)
11122 if (imux->items[j].index >= err)
11124 if (j < imux->num_items)
11126 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11127 spec->num_adc_nids++;
11129 spec->adc_nids = spec->private_adc_nids;
11130 spec->capsrc_nids = spec->private_capsrc_nids;
11133 set_capture_mixer(codec);
11135 if (has_cdefine_beep(codec))
11136 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11138 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11140 spec->vmaster_nid = 0x0c;
11142 codec->patch_ops = alc_patch_ops;
11143 if (board_config == ALC882_AUTO)
11144 spec->init_hook = alc882_auto_init;
11146 alc_init_jacks(codec);
11147 #ifdef CONFIG_SND_HDA_POWER_SAVE
11148 if (!spec->loopback.amplist)
11149 spec->loopback.amplist = alc882_loopbacks;
11160 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11161 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11163 #define alc262_dac_nids alc260_dac_nids
11164 #define alc262_adc_nids alc882_adc_nids
11165 #define alc262_adc_nids_alt alc882_adc_nids_alt
11166 #define alc262_capsrc_nids alc882_capsrc_nids
11167 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11169 #define alc262_modes alc260_modes
11170 #define alc262_capture_source alc882_capture_source
11172 static hda_nid_t alc262_dmic_adc_nids[1] = {
11177 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11179 static struct snd_kcontrol_new alc262_base_mixer[] = {
11180 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11181 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11182 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11183 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11184 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11185 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11186 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11187 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11188 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11189 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11190 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11191 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11192 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11193 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11194 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11195 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11199 /* update HP, line and mono-out pins according to the master switch */
11200 static void alc262_hp_master_update(struct hda_codec *codec)
11202 struct alc_spec *spec = codec->spec;
11203 int val = spec->master_sw;
11205 /* HP & line-out */
11206 snd_hda_codec_write_cache(codec, 0x1b, 0,
11207 AC_VERB_SET_PIN_WIDGET_CONTROL,
11209 snd_hda_codec_write_cache(codec, 0x15, 0,
11210 AC_VERB_SET_PIN_WIDGET_CONTROL,
11212 /* mono (speaker) depending on the HP jack sense */
11213 val = val && !spec->jack_present;
11214 snd_hda_codec_write_cache(codec, 0x16, 0,
11215 AC_VERB_SET_PIN_WIDGET_CONTROL,
11216 val ? PIN_OUT : 0);
11219 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11221 struct alc_spec *spec = codec->spec;
11223 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11224 alc262_hp_master_update(codec);
11227 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11229 if ((res >> 26) != ALC880_HP_EVENT)
11231 alc262_hp_bpc_automute(codec);
11234 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11236 struct alc_spec *spec = codec->spec;
11238 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11239 alc262_hp_master_update(codec);
11242 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11245 if ((res >> 26) != ALC880_HP_EVENT)
11247 alc262_hp_wildwest_automute(codec);
11250 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11252 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11253 struct snd_ctl_elem_value *ucontrol)
11255 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11256 struct alc_spec *spec = codec->spec;
11257 int val = !!*ucontrol->value.integer.value;
11259 if (val == spec->master_sw)
11261 spec->master_sw = val;
11262 alc262_hp_master_update(codec);
11266 #define ALC262_HP_MASTER_SWITCH \
11268 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11269 .name = "Master Playback Switch", \
11270 .info = snd_ctl_boolean_mono_info, \
11271 .get = alc262_hp_master_sw_get, \
11272 .put = alc262_hp_master_sw_put, \
11275 .iface = NID_MAPPING, \
11276 .name = "Master Playback Switch", \
11277 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11281 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11282 ALC262_HP_MASTER_SWITCH,
11283 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11284 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11285 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11286 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11288 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11291 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11292 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11293 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11294 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11295 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11296 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11297 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11298 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11299 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11300 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11301 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11305 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11306 ALC262_HP_MASTER_SWITCH,
11307 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11308 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11309 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11310 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11311 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11313 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11315 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11316 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11317 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11318 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11319 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11320 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11321 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11325 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11326 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11327 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11328 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11332 /* mute/unmute internal speaker according to the hp jack and mute state */
11333 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11335 struct alc_spec *spec = codec->spec;
11337 spec->autocfg.hp_pins[0] = 0x15;
11338 spec->autocfg.speaker_pins[0] = 0x14;
11341 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11342 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11343 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11344 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11345 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11346 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11347 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11348 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11352 static struct hda_verb alc262_hp_t5735_verbs[] = {
11353 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11354 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11356 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11360 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11361 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11362 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11363 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11364 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11365 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11366 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11370 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11371 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11372 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11373 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11374 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11375 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11376 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11378 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11380 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11384 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11391 /* bind hp and internal speaker mute (with plug check) as master switch */
11392 static void alc262_hippo_master_update(struct hda_codec *codec)
11394 struct alc_spec *spec = codec->spec;
11395 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11396 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11397 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11401 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11402 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11403 HDA_AMP_MUTE, mute);
11404 /* mute internal speaker per jack sense */
11405 if (spec->jack_present)
11406 mute = HDA_AMP_MUTE;
11408 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11409 HDA_AMP_MUTE, mute);
11410 if (speaker_nid && speaker_nid != line_nid)
11411 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11412 HDA_AMP_MUTE, mute);
11415 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11417 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11418 struct snd_ctl_elem_value *ucontrol)
11420 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11421 struct alc_spec *spec = codec->spec;
11422 int val = !!*ucontrol->value.integer.value;
11424 if (val == spec->master_sw)
11426 spec->master_sw = val;
11427 alc262_hippo_master_update(codec);
11431 #define ALC262_HIPPO_MASTER_SWITCH \
11433 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11434 .name = "Master Playback Switch", \
11435 .info = snd_ctl_boolean_mono_info, \
11436 .get = alc262_hippo_master_sw_get, \
11437 .put = alc262_hippo_master_sw_put, \
11440 .iface = NID_MAPPING, \
11441 .name = "Master Playback Switch", \
11442 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11443 (SUBDEV_SPEAKER(0) << 16), \
11446 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11447 ALC262_HIPPO_MASTER_SWITCH,
11448 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11449 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11450 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11451 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11452 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11454 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11455 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11456 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11457 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11458 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11459 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11463 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11464 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11465 ALC262_HIPPO_MASTER_SWITCH,
11466 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11467 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11468 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11469 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11470 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11471 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11472 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11473 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11474 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11475 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11479 /* mute/unmute internal speaker according to the hp jack and mute state */
11480 static void alc262_hippo_automute(struct hda_codec *codec)
11482 struct alc_spec *spec = codec->spec;
11483 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11485 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11486 alc262_hippo_master_update(codec);
11489 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11491 if ((res >> 26) != ALC880_HP_EVENT)
11493 alc262_hippo_automute(codec);
11496 static void alc262_hippo_setup(struct hda_codec *codec)
11498 struct alc_spec *spec = codec->spec;
11500 spec->autocfg.hp_pins[0] = 0x15;
11501 spec->autocfg.speaker_pins[0] = 0x14;
11504 static void alc262_hippo1_setup(struct hda_codec *codec)
11506 struct alc_spec *spec = codec->spec;
11508 spec->autocfg.hp_pins[0] = 0x1b;
11509 spec->autocfg.speaker_pins[0] = 0x14;
11513 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11514 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11515 ALC262_HIPPO_MASTER_SWITCH,
11516 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11517 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11518 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11519 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11523 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11524 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11525 ALC262_HIPPO_MASTER_SWITCH,
11526 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11527 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11528 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11529 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11530 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11534 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11535 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11536 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11537 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11538 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11539 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11540 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11541 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11542 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11543 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11544 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11545 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11546 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11550 static struct hda_verb alc262_tyan_verbs[] = {
11551 /* Headphone automute */
11552 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11553 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11554 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11556 /* P11 AUX_IN, white 4-pin connector */
11557 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11558 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11559 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11560 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11565 /* unsolicited event for HP jack sensing */
11566 static void alc262_tyan_setup(struct hda_codec *codec)
11568 struct alc_spec *spec = codec->spec;
11570 spec->autocfg.hp_pins[0] = 0x1b;
11571 spec->autocfg.speaker_pins[0] = 0x15;
11575 #define alc262_capture_mixer alc882_capture_mixer
11576 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11579 * generic initialization of ADC, input mixers and output mixers
11581 static struct hda_verb alc262_init_verbs[] = {
11583 * Unmute ADC0-2 and set the default input to mic-in
11585 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11586 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11587 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11588 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11589 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11590 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11592 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11594 * Note: PASD motherboards uses the Line In 2 as the input for
11595 * front panel mic (mic 2)
11597 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11598 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11599 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11600 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11601 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11602 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11605 * Set up output mixers (0x0c - 0x0e)
11607 /* set vol=0 to output mixers */
11608 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11609 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11610 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11611 /* set up input amps for analog loopback */
11612 /* Amp Indices: DAC = 0, mixer = 1 */
11613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11615 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11617 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11618 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11620 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11622 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11623 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11624 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11625 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11627 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11628 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11629 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11630 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11631 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11633 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11634 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11636 /* FIXME: use matrix-type input source selection */
11637 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11638 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11639 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11640 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11641 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11642 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11644 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11645 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11646 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11647 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11650 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11657 static struct hda_verb alc262_eapd_verbs[] = {
11658 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11659 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11663 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11664 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11665 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11666 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11668 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11669 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11673 static struct hda_verb alc262_sony_unsol_verbs[] = {
11674 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11675 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11676 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11678 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11679 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11683 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11684 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11685 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11686 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11687 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11688 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11692 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11693 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11694 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11695 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11696 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11697 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11698 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11699 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11700 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11704 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11706 struct alc_spec *spec = codec->spec;
11708 spec->autocfg.hp_pins[0] = 0x15;
11709 spec->autocfg.speaker_pins[0] = 0x14;
11710 spec->ext_mic.pin = 0x18;
11711 spec->ext_mic.mux_idx = 0;
11712 spec->int_mic.pin = 0x12;
11713 spec->int_mic.mux_idx = 9;
11714 spec->auto_mic = 1;
11720 * 0x16 = internal speaker
11721 * 0x18 = external mic
11724 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11725 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11726 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11728 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11729 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11730 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11732 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11733 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11737 static struct hda_verb alc262_nec_verbs[] = {
11738 /* Unmute Speaker */
11739 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11742 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11743 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11745 /* External mic to headphone */
11746 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11747 /* External mic to speaker */
11748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11754 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11755 * 0x1b = port replicator headphone out
11758 #define ALC_HP_EVENT 0x37
11760 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11761 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11762 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11763 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11764 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11768 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11769 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11770 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11774 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11775 /* Front Mic pin: input vref at 50% */
11776 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11777 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11781 static struct hda_input_mux alc262_fujitsu_capture_source = {
11785 { "Internal Mic", 0x1 },
11790 static struct hda_input_mux alc262_HP_capture_source = {
11794 { "Front Mic", 0x1 },
11801 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11805 { "Front Mic", 0x2 },
11811 /* mute/unmute internal speaker according to the hp jacks and mute state */
11812 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11814 struct alc_spec *spec = codec->spec;
11817 if (force || !spec->sense_updated) {
11818 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11819 snd_hda_jack_detect(codec, 0x1b);
11820 spec->sense_updated = 1;
11822 /* unmute internal speaker only if both HPs are unplugged and
11823 * master switch is on
11825 if (spec->jack_present)
11826 mute = HDA_AMP_MUTE;
11828 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11829 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11830 HDA_AMP_MUTE, mute);
11833 /* unsolicited event for HP jack sensing */
11834 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11837 if ((res >> 26) != ALC_HP_EVENT)
11839 alc262_fujitsu_automute(codec, 1);
11842 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11844 alc262_fujitsu_automute(codec, 1);
11847 /* bind volumes of both NID 0x0c and 0x0d */
11848 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11849 .ops = &snd_hda_bind_vol,
11851 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11852 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11857 /* mute/unmute internal speaker according to the hp jack and mute state */
11858 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11860 struct alc_spec *spec = codec->spec;
11863 if (force || !spec->sense_updated) {
11864 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11865 spec->sense_updated = 1;
11867 if (spec->jack_present) {
11868 /* mute internal speaker */
11869 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11870 HDA_AMP_MUTE, HDA_AMP_MUTE);
11871 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11872 HDA_AMP_MUTE, HDA_AMP_MUTE);
11874 /* unmute internal speaker if necessary */
11875 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11876 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11877 HDA_AMP_MUTE, mute);
11878 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11879 HDA_AMP_MUTE, mute);
11883 /* unsolicited event for HP jack sensing */
11884 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11887 if ((res >> 26) != ALC_HP_EVENT)
11889 alc262_lenovo_3000_automute(codec, 1);
11892 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11893 int dir, int idx, long *valp)
11897 for (i = 0; i < 2; i++, valp++)
11898 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11900 *valp ? 0 : HDA_AMP_MUTE);
11904 /* bind hp and internal speaker mute (with plug check) */
11905 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11906 struct snd_ctl_elem_value *ucontrol)
11908 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11909 long *valp = ucontrol->value.integer.value;
11912 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11913 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11915 alc262_fujitsu_automute(codec, 0);
11919 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11920 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11922 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11923 .name = "Master Playback Switch",
11924 .subdevice = HDA_SUBDEV_AMP_FLAG,
11925 .info = snd_hda_mixer_amp_switch_info,
11926 .get = snd_hda_mixer_amp_switch_get,
11927 .put = alc262_fujitsu_master_sw_put,
11928 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11931 .iface = NID_MAPPING,
11932 .name = "Master Playback Switch",
11933 .private_value = 0x1b,
11935 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11936 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11937 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11938 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11939 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11940 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11941 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11942 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11946 /* bind hp and internal speaker mute (with plug check) */
11947 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11948 struct snd_ctl_elem_value *ucontrol)
11950 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11951 long *valp = ucontrol->value.integer.value;
11954 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11956 alc262_lenovo_3000_automute(codec, 0);
11960 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11961 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11963 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11964 .name = "Master Playback Switch",
11965 .subdevice = HDA_SUBDEV_AMP_FLAG,
11966 .info = snd_hda_mixer_amp_switch_info,
11967 .get = snd_hda_mixer_amp_switch_get,
11968 .put = alc262_lenovo_3000_master_sw_put,
11969 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11971 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11972 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11973 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11976 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11977 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11978 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11982 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11983 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11984 ALC262_HIPPO_MASTER_SWITCH,
11985 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11986 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11987 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11988 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11989 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11990 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11994 /* additional init verbs for Benq laptops */
11995 static struct hda_verb alc262_EAPD_verbs[] = {
11996 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11997 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
12001 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
12002 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12003 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12005 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12006 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
12010 /* Samsung Q1 Ultra Vista model setup */
12011 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
12012 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
12013 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
12014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12015 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12016 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
12017 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
12021 static struct hda_verb alc262_ultra_verbs[] = {
12023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12027 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12028 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12030 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12032 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12033 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12034 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12035 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12036 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12038 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12040 /* ADC, choose mic */
12041 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12042 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12043 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12044 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12045 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12046 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12047 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12048 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12049 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12050 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
12054 /* mute/unmute internal speaker according to the hp jack and mute state */
12055 static void alc262_ultra_automute(struct hda_codec *codec)
12057 struct alc_spec *spec = codec->spec;
12061 /* auto-mute only when HP is used as HP */
12062 if (!spec->cur_mux[0]) {
12063 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
12064 if (spec->jack_present)
12065 mute = HDA_AMP_MUTE;
12067 /* mute/unmute internal speaker */
12068 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12069 HDA_AMP_MUTE, mute);
12070 /* mute/unmute HP */
12071 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12072 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
12075 /* unsolicited event for HP jack sensing */
12076 static void alc262_ultra_unsol_event(struct hda_codec *codec,
12079 if ((res >> 26) != ALC880_HP_EVENT)
12081 alc262_ultra_automute(codec);
12084 static struct hda_input_mux alc262_ultra_capture_source = {
12088 { "Headphone", 0x7 },
12092 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12093 struct snd_ctl_elem_value *ucontrol)
12095 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12096 struct alc_spec *spec = codec->spec;
12099 ret = alc_mux_enum_put(kcontrol, ucontrol);
12102 /* reprogram the HP pin as mic or HP according to the input source */
12103 snd_hda_codec_write_cache(codec, 0x15, 0,
12104 AC_VERB_SET_PIN_WIDGET_CONTROL,
12105 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12106 alc262_ultra_automute(codec); /* mute/unmute HP */
12110 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12111 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12112 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12114 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12115 .name = "Capture Source",
12116 .info = alc_mux_enum_info,
12117 .get = alc_mux_enum_get,
12118 .put = alc262_ultra_mux_enum_put,
12121 .iface = NID_MAPPING,
12122 .name = "Capture Source",
12123 .private_value = 0x15,
12128 /* We use two mixers depending on the output pin; 0x16 is a mono output
12129 * and thus it's bound with a different mixer.
12130 * This function returns which mixer amp should be used.
12132 static int alc262_check_volbit(hda_nid_t nid)
12136 else if (nid == 0x16)
12142 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12143 const char *pfx, int *vbits, int idx)
12148 vbit = alc262_check_volbit(nid);
12151 if (*vbits & vbit) /* a volume control for this mixer already there */
12155 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12157 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12158 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12161 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12162 const char *pfx, int idx)
12169 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12171 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12172 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12175 /* add playback controls from the parsed DAC table */
12176 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12177 const struct auto_pin_cfg *cfg)
12183 spec->multiout.num_dacs = 1; /* only use one dac */
12184 spec->multiout.dac_nids = spec->private_dac_nids;
12185 spec->multiout.dac_nids[0] = 2;
12187 pfx = alc_get_line_out_pfx(cfg, true);
12190 for (i = 0; i < 2; i++) {
12191 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12194 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12195 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12200 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12201 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12208 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12209 alc262_check_volbit(cfg->speaker_pins[0]) |
12210 alc262_check_volbit(cfg->hp_pins[0]);
12211 if (vbits == 1 || vbits == 2)
12212 pfx = "Master"; /* only one mixer is used */
12214 for (i = 0; i < 2; i++) {
12215 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12219 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12220 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12221 "Speaker", &vbits, i);
12225 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12226 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12227 "Headphone", &vbits, i);
12235 #define alc262_auto_create_input_ctls \
12236 alc882_auto_create_input_ctls
12239 * generic initialization of ADC, input mixers and output mixers
12241 static struct hda_verb alc262_volume_init_verbs[] = {
12243 * Unmute ADC0-2 and set the default input to mic-in
12245 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12246 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12247 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12248 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12249 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12250 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12252 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12254 * Note: PASD motherboards uses the Line In 2 as the input for
12255 * front panel mic (mic 2)
12257 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12258 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12259 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12260 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12261 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12262 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12265 * Set up output mixers (0x0c - 0x0f)
12267 /* set vol=0 to output mixers */
12268 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12269 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12270 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12272 /* set up input amps for analog loopback */
12273 /* Amp Indices: DAC = 0, mixer = 1 */
12274 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12275 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12276 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12277 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12278 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12279 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12281 /* FIXME: use matrix-type input source selection */
12282 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12283 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12284 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12285 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12286 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12287 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12289 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12290 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12291 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12294 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12295 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12296 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12297 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12302 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12304 * Unmute ADC0-2 and set the default input to mic-in
12306 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12307 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12308 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12309 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12310 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12311 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12313 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12315 * Note: PASD motherboards uses the Line In 2 as the input for
12316 * front panel mic (mic 2)
12318 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12323 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12324 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12328 * Set up output mixers (0x0c - 0x0e)
12330 /* set vol=0 to output mixers */
12331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12335 /* set up input amps for analog loopback */
12336 /* Amp Indices: DAC = 0, mixer = 1 */
12337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12339 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12340 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12341 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12342 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12344 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12345 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12346 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12348 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12349 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12351 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12352 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12354 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12355 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12356 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12357 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12358 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12360 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12361 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12362 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12363 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12364 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12365 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12368 /* FIXME: use matrix-type input source selection */
12369 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12370 /* Input mixer1: only unmute Mic */
12371 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12374 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12375 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12376 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12377 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12378 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12379 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12381 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12382 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12383 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12384 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12385 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12386 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12387 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12388 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12389 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12391 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12392 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12393 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12394 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12395 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12397 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12398 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12399 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12401 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12406 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12408 * Unmute ADC0-2 and set the default input to mic-in
12410 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12412 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12413 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12414 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12415 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12417 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12419 * Note: PASD motherboards uses the Line In 2 as the input for front
12420 * panel mic (mic 2)
12422 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12423 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12424 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12425 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12426 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12427 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12428 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12429 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12430 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12432 * Set up output mixers (0x0c - 0x0e)
12434 /* set vol=0 to output mixers */
12435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12436 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12437 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12439 /* set up input amps for analog loopback */
12440 /* Amp Indices: DAC = 0, mixer = 1 */
12441 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12442 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12443 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12444 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12445 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12446 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12449 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12450 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12451 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12452 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12453 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12454 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12455 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12457 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12458 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12460 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12461 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12463 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12464 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12465 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12466 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12467 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12468 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12470 /* FIXME: use matrix-type input source selection */
12471 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12472 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12473 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12474 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12475 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12476 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12477 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12478 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12479 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12481 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12482 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12483 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12484 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12485 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12486 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12487 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12490 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12492 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12493 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12494 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12497 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12502 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12506 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12508 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12509 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12510 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12511 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12513 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12514 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12515 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12526 static const struct alc_fixup alc262_fixups[] = {
12527 [PINFIX_FSC_H270] = {
12528 .type = ALC_FIXUP_PINS,
12529 .v.pins = (const struct alc_pincfg[]) {
12530 { 0x14, 0x99130110 }, /* speaker */
12531 { 0x15, 0x0221142f }, /* front HP */
12532 { 0x1b, 0x0121141f }, /* rear HP */
12538 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12539 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12544 #ifdef CONFIG_SND_HDA_POWER_SAVE
12545 #define alc262_loopbacks alc880_loopbacks
12548 /* pcm configuration: identical with ALC880 */
12549 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12550 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12551 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12552 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12555 * BIOS auto configuration
12557 static int alc262_parse_auto_config(struct hda_codec *codec)
12559 struct alc_spec *spec = codec->spec;
12561 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12563 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12567 if (!spec->autocfg.line_outs) {
12568 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12569 spec->multiout.max_channels = 2;
12570 spec->no_analog = 1;
12573 return 0; /* can't find valid BIOS pin config */
12575 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12578 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12582 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12585 alc_auto_parse_digital(codec);
12587 if (spec->kctls.list)
12588 add_mixer(spec, spec->kctls.list);
12590 add_verb(spec, alc262_volume_init_verbs);
12591 spec->num_mux_defs = 1;
12592 spec->input_mux = &spec->private_imux[0];
12594 err = alc_auto_add_mic_boost(codec);
12598 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12603 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12604 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12605 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12606 #define alc262_auto_init_input_src alc882_auto_init_input_src
12609 /* init callback for auto-configuration model -- overriding the default init */
12610 static void alc262_auto_init(struct hda_codec *codec)
12612 struct alc_spec *spec = codec->spec;
12613 alc262_auto_init_multi_out(codec);
12614 alc262_auto_init_hp_out(codec);
12615 alc262_auto_init_analog_input(codec);
12616 alc262_auto_init_input_src(codec);
12617 alc_auto_init_digital(codec);
12618 if (spec->unsol_event)
12619 alc_inithook(codec);
12623 * configuration and preset
12625 static const char * const alc262_models[ALC262_MODEL_LAST] = {
12626 [ALC262_BASIC] = "basic",
12627 [ALC262_HIPPO] = "hippo",
12628 [ALC262_HIPPO_1] = "hippo_1",
12629 [ALC262_FUJITSU] = "fujitsu",
12630 [ALC262_HP_BPC] = "hp-bpc",
12631 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12632 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12633 [ALC262_HP_RP5700] = "hp-rp5700",
12634 [ALC262_BENQ_ED8] = "benq",
12635 [ALC262_BENQ_T31] = "benq-t31",
12636 [ALC262_SONY_ASSAMD] = "sony-assamd",
12637 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12638 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12639 [ALC262_ULTRA] = "ultra",
12640 [ALC262_LENOVO_3000] = "lenovo-3000",
12641 [ALC262_NEC] = "nec",
12642 [ALC262_TYAN] = "tyan",
12643 [ALC262_AUTO] = "auto",
12646 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12647 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12648 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12649 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12651 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12653 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12655 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12657 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12658 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12659 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12660 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12661 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12662 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12663 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12664 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12665 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12666 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12667 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12668 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12669 ALC262_HP_TC_T5735),
12670 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12671 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12672 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12673 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12674 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12675 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12676 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12677 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12678 #if 0 /* disable the quirk since model=auto works better in recent versions */
12679 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12680 ALC262_SONY_ASSAMD),
12682 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12683 ALC262_TOSHIBA_RX1),
12684 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12685 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12686 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12687 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12688 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12690 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12691 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12692 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12693 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12694 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12698 static struct alc_config_preset alc262_presets[] = {
12700 .mixers = { alc262_base_mixer },
12701 .init_verbs = { alc262_init_verbs },
12702 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12703 .dac_nids = alc262_dac_nids,
12705 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12706 .channel_mode = alc262_modes,
12707 .input_mux = &alc262_capture_source,
12710 .mixers = { alc262_hippo_mixer },
12711 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12712 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12713 .dac_nids = alc262_dac_nids,
12715 .dig_out_nid = ALC262_DIGOUT_NID,
12716 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12717 .channel_mode = alc262_modes,
12718 .input_mux = &alc262_capture_source,
12719 .unsol_event = alc262_hippo_unsol_event,
12720 .setup = alc262_hippo_setup,
12721 .init_hook = alc262_hippo_automute,
12723 [ALC262_HIPPO_1] = {
12724 .mixers = { alc262_hippo1_mixer },
12725 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12726 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12727 .dac_nids = alc262_dac_nids,
12729 .dig_out_nid = ALC262_DIGOUT_NID,
12730 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12731 .channel_mode = alc262_modes,
12732 .input_mux = &alc262_capture_source,
12733 .unsol_event = alc262_hippo_unsol_event,
12734 .setup = alc262_hippo1_setup,
12735 .init_hook = alc262_hippo_automute,
12737 [ALC262_FUJITSU] = {
12738 .mixers = { alc262_fujitsu_mixer },
12739 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12740 alc262_fujitsu_unsol_verbs },
12741 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12742 .dac_nids = alc262_dac_nids,
12744 .dig_out_nid = ALC262_DIGOUT_NID,
12745 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12746 .channel_mode = alc262_modes,
12747 .input_mux = &alc262_fujitsu_capture_source,
12748 .unsol_event = alc262_fujitsu_unsol_event,
12749 .init_hook = alc262_fujitsu_init_hook,
12751 [ALC262_HP_BPC] = {
12752 .mixers = { alc262_HP_BPC_mixer },
12753 .init_verbs = { alc262_HP_BPC_init_verbs },
12754 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12755 .dac_nids = alc262_dac_nids,
12757 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12758 .channel_mode = alc262_modes,
12759 .input_mux = &alc262_HP_capture_source,
12760 .unsol_event = alc262_hp_bpc_unsol_event,
12761 .init_hook = alc262_hp_bpc_automute,
12763 [ALC262_HP_BPC_D7000_WF] = {
12764 .mixers = { alc262_HP_BPC_WildWest_mixer },
12765 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12766 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12767 .dac_nids = alc262_dac_nids,
12769 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12770 .channel_mode = alc262_modes,
12771 .input_mux = &alc262_HP_D7000_capture_source,
12772 .unsol_event = alc262_hp_wildwest_unsol_event,
12773 .init_hook = alc262_hp_wildwest_automute,
12775 [ALC262_HP_BPC_D7000_WL] = {
12776 .mixers = { alc262_HP_BPC_WildWest_mixer,
12777 alc262_HP_BPC_WildWest_option_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_TC_T5735] = {
12789 .mixers = { alc262_hp_t5735_mixer },
12790 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12791 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12792 .dac_nids = alc262_dac_nids,
12794 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12795 .channel_mode = alc262_modes,
12796 .input_mux = &alc262_capture_source,
12797 .unsol_event = alc_sku_unsol_event,
12798 .setup = alc262_hp_t5735_setup,
12799 .init_hook = alc_inithook,
12801 [ALC262_HP_RP5700] = {
12802 .mixers = { alc262_hp_rp5700_mixer },
12803 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12804 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12805 .dac_nids = alc262_dac_nids,
12806 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12807 .channel_mode = alc262_modes,
12808 .input_mux = &alc262_hp_rp5700_capture_source,
12810 [ALC262_BENQ_ED8] = {
12811 .mixers = { alc262_base_mixer },
12812 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12813 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12814 .dac_nids = alc262_dac_nids,
12816 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12817 .channel_mode = alc262_modes,
12818 .input_mux = &alc262_capture_source,
12820 [ALC262_SONY_ASSAMD] = {
12821 .mixers = { alc262_sony_mixer },
12822 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12823 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12824 .dac_nids = alc262_dac_nids,
12826 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12827 .channel_mode = alc262_modes,
12828 .input_mux = &alc262_capture_source,
12829 .unsol_event = alc262_hippo_unsol_event,
12830 .setup = alc262_hippo_setup,
12831 .init_hook = alc262_hippo_automute,
12833 [ALC262_BENQ_T31] = {
12834 .mixers = { alc262_benq_t31_mixer },
12835 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12836 alc_hp15_unsol_verbs },
12837 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12838 .dac_nids = alc262_dac_nids,
12840 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12841 .channel_mode = alc262_modes,
12842 .input_mux = &alc262_capture_source,
12843 .unsol_event = alc262_hippo_unsol_event,
12844 .setup = alc262_hippo_setup,
12845 .init_hook = alc262_hippo_automute,
12848 .mixers = { alc262_ultra_mixer },
12849 .cap_mixer = alc262_ultra_capture_mixer,
12850 .init_verbs = { alc262_ultra_verbs },
12851 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12852 .dac_nids = alc262_dac_nids,
12853 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12854 .channel_mode = alc262_modes,
12855 .input_mux = &alc262_ultra_capture_source,
12856 .adc_nids = alc262_adc_nids, /* ADC0 */
12857 .capsrc_nids = alc262_capsrc_nids,
12858 .num_adc_nids = 1, /* single ADC */
12859 .unsol_event = alc262_ultra_unsol_event,
12860 .init_hook = alc262_ultra_automute,
12862 [ALC262_LENOVO_3000] = {
12863 .mixers = { alc262_lenovo_3000_mixer },
12864 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12865 alc262_lenovo_3000_unsol_verbs,
12866 alc262_lenovo_3000_init_verbs },
12867 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12868 .dac_nids = alc262_dac_nids,
12870 .dig_out_nid = ALC262_DIGOUT_NID,
12871 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12872 .channel_mode = alc262_modes,
12873 .input_mux = &alc262_fujitsu_capture_source,
12874 .unsol_event = alc262_lenovo_3000_unsol_event,
12877 .mixers = { alc262_nec_mixer },
12878 .init_verbs = { alc262_nec_verbs },
12879 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12880 .dac_nids = alc262_dac_nids,
12882 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12883 .channel_mode = alc262_modes,
12884 .input_mux = &alc262_capture_source,
12886 [ALC262_TOSHIBA_S06] = {
12887 .mixers = { alc262_toshiba_s06_mixer },
12888 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12889 alc262_eapd_verbs },
12890 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12891 .capsrc_nids = alc262_dmic_capsrc_nids,
12892 .dac_nids = alc262_dac_nids,
12893 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12894 .num_adc_nids = 1, /* single ADC */
12895 .dig_out_nid = ALC262_DIGOUT_NID,
12896 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12897 .channel_mode = alc262_modes,
12898 .unsol_event = alc_sku_unsol_event,
12899 .setup = alc262_toshiba_s06_setup,
12900 .init_hook = alc_inithook,
12902 [ALC262_TOSHIBA_RX1] = {
12903 .mixers = { alc262_toshiba_rx1_mixer },
12904 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12905 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12906 .dac_nids = alc262_dac_nids,
12908 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12909 .channel_mode = alc262_modes,
12910 .input_mux = &alc262_capture_source,
12911 .unsol_event = alc262_hippo_unsol_event,
12912 .setup = alc262_hippo_setup,
12913 .init_hook = alc262_hippo_automute,
12916 .mixers = { alc262_tyan_mixer },
12917 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12918 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12919 .dac_nids = alc262_dac_nids,
12921 .dig_out_nid = ALC262_DIGOUT_NID,
12922 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12923 .channel_mode = alc262_modes,
12924 .input_mux = &alc262_capture_source,
12925 .unsol_event = alc_automute_amp_unsol_event,
12926 .setup = alc262_tyan_setup,
12927 .init_hook = alc_automute_amp,
12931 static int patch_alc262(struct hda_codec *codec)
12933 struct alc_spec *spec;
12937 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12941 codec->spec = spec;
12943 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12948 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12949 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12950 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12951 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12954 alc_auto_parse_customize_define(codec);
12956 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12958 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12962 if (board_config < 0) {
12963 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12965 board_config = ALC262_AUTO;
12968 if (board_config == ALC262_AUTO) {
12969 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
12970 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
12973 if (board_config == ALC262_AUTO) {
12974 /* automatic parse from the BIOS config */
12975 err = alc262_parse_auto_config(codec);
12981 "hda_codec: Cannot set up configuration "
12982 "from BIOS. Using base mode...\n");
12983 board_config = ALC262_BASIC;
12987 if (!spec->no_analog && has_cdefine_beep(codec)) {
12988 err = snd_hda_attach_beep_device(codec, 0x1);
12995 if (board_config != ALC262_AUTO)
12996 setup_preset(codec, &alc262_presets[board_config]);
12998 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12999 spec->stream_analog_capture = &alc262_pcm_analog_capture;
13001 spec->stream_digital_playback = &alc262_pcm_digital_playback;
13002 spec->stream_digital_capture = &alc262_pcm_digital_capture;
13004 if (!spec->adc_nids && spec->input_mux) {
13006 /* check whether the digital-mic has to be supported */
13007 for (i = 0; i < spec->input_mux->num_items; i++) {
13008 if (spec->input_mux->items[i].index >= 9)
13011 if (i < spec->input_mux->num_items) {
13012 /* use only ADC0 */
13013 spec->adc_nids = alc262_dmic_adc_nids;
13014 spec->num_adc_nids = 1;
13015 spec->capsrc_nids = alc262_dmic_capsrc_nids;
13017 /* all analog inputs */
13018 /* check whether NID 0x07 is valid */
13019 unsigned int wcap = get_wcaps(codec, 0x07);
13022 wcap = get_wcaps_type(wcap);
13023 if (wcap != AC_WID_AUD_IN) {
13024 spec->adc_nids = alc262_adc_nids_alt;
13025 spec->num_adc_nids =
13026 ARRAY_SIZE(alc262_adc_nids_alt);
13027 spec->capsrc_nids = alc262_capsrc_nids_alt;
13029 spec->adc_nids = alc262_adc_nids;
13030 spec->num_adc_nids =
13031 ARRAY_SIZE(alc262_adc_nids);
13032 spec->capsrc_nids = alc262_capsrc_nids;
13036 if (!spec->cap_mixer && !spec->no_analog)
13037 set_capture_mixer(codec);
13038 if (!spec->no_analog && has_cdefine_beep(codec))
13039 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13041 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
13043 spec->vmaster_nid = 0x0c;
13045 codec->patch_ops = alc_patch_ops;
13046 if (board_config == ALC262_AUTO)
13047 spec->init_hook = alc262_auto_init;
13049 alc_init_jacks(codec);
13050 #ifdef CONFIG_SND_HDA_POWER_SAVE
13051 if (!spec->loopback.amplist)
13052 spec->loopback.amplist = alc262_loopbacks;
13059 * ALC268 channel source setting (2 channel)
13061 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13062 #define alc268_modes alc260_modes
13064 static hda_nid_t alc268_dac_nids[2] = {
13069 static hda_nid_t alc268_adc_nids[2] = {
13074 static hda_nid_t alc268_adc_nids_alt[1] = {
13079 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13081 static struct snd_kcontrol_new alc268_base_mixer[] = {
13082 /* output mixer control */
13083 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13084 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13085 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13086 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13087 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13088 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13089 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13093 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13094 /* output mixer control */
13095 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13096 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13097 ALC262_HIPPO_MASTER_SWITCH,
13098 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13099 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13100 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13104 /* bind Beep switches of both NID 0x0f and 0x10 */
13105 static struct hda_bind_ctls alc268_bind_beep_sw = {
13106 .ops = &snd_hda_bind_sw,
13108 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13109 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13114 static struct snd_kcontrol_new alc268_beep_mixer[] = {
13115 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13116 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13120 static struct hda_verb alc268_eapd_verbs[] = {
13121 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13122 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13126 /* Toshiba specific */
13127 static struct hda_verb alc268_toshiba_verbs[] = {
13128 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13132 /* Acer specific */
13133 /* bind volumes of both NID 0x02 and 0x03 */
13134 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13135 .ops = &snd_hda_bind_vol,
13137 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13138 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13143 /* mute/unmute internal speaker according to the hp jack and mute state */
13144 static void alc268_acer_automute(struct hda_codec *codec, int force)
13146 struct alc_spec *spec = codec->spec;
13149 if (force || !spec->sense_updated) {
13150 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13151 spec->sense_updated = 1;
13153 if (spec->jack_present)
13154 mute = HDA_AMP_MUTE; /* mute internal speaker */
13155 else /* unmute internal speaker if necessary */
13156 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13157 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13158 HDA_AMP_MUTE, mute);
13162 /* bind hp and internal speaker mute (with plug check) */
13163 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13164 struct snd_ctl_elem_value *ucontrol)
13166 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13167 long *valp = ucontrol->value.integer.value;
13170 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13172 alc268_acer_automute(codec, 0);
13176 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13177 /* output mixer control */
13178 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13180 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13181 .name = "Master Playback Switch",
13182 .subdevice = HDA_SUBDEV_AMP_FLAG,
13183 .info = snd_hda_mixer_amp_switch_info,
13184 .get = snd_hda_mixer_amp_switch_get,
13185 .put = alc268_acer_master_sw_put,
13186 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13188 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13192 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13193 /* output mixer control */
13194 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13196 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13197 .name = "Master Playback Switch",
13198 .subdevice = HDA_SUBDEV_AMP_FLAG,
13199 .info = snd_hda_mixer_amp_switch_info,
13200 .get = snd_hda_mixer_amp_switch_get,
13201 .put = alc268_acer_master_sw_put,
13202 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13204 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13205 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13206 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13210 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13211 /* output mixer control */
13212 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13214 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13215 .name = "Master Playback Switch",
13216 .subdevice = HDA_SUBDEV_AMP_FLAG,
13217 .info = snd_hda_mixer_amp_switch_info,
13218 .get = snd_hda_mixer_amp_switch_get,
13219 .put = alc268_acer_master_sw_put,
13220 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13222 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13223 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13227 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13228 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13229 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13230 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13231 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13232 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13233 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13237 static struct hda_verb alc268_acer_verbs[] = {
13238 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13239 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13240 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13241 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13242 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13243 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13244 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13248 /* unsolicited event for HP jack sensing */
13249 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13250 #define alc268_toshiba_setup alc262_hippo_setup
13251 #define alc268_toshiba_automute alc262_hippo_automute
13253 static void alc268_acer_unsol_event(struct hda_codec *codec,
13256 if ((res >> 26) != ALC880_HP_EVENT)
13258 alc268_acer_automute(codec, 1);
13261 static void alc268_acer_init_hook(struct hda_codec *codec)
13263 alc268_acer_automute(codec, 1);
13266 /* toggle speaker-output according to the hp-jack state */
13267 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13269 unsigned int present;
13270 unsigned char bits;
13272 present = snd_hda_jack_detect(codec, 0x15);
13273 bits = present ? HDA_AMP_MUTE : 0;
13274 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13275 HDA_AMP_MUTE, bits);
13276 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13277 HDA_AMP_MUTE, bits);
13280 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13283 switch (res >> 26) {
13284 case ALC880_HP_EVENT:
13285 alc268_aspire_one_speaker_automute(codec);
13287 case ALC880_MIC_EVENT:
13288 alc_mic_automute(codec);
13293 static void alc268_acer_lc_setup(struct hda_codec *codec)
13295 struct alc_spec *spec = codec->spec;
13296 spec->ext_mic.pin = 0x18;
13297 spec->ext_mic.mux_idx = 0;
13298 spec->int_mic.pin = 0x12;
13299 spec->int_mic.mux_idx = 6;
13300 spec->auto_mic = 1;
13303 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13305 alc268_aspire_one_speaker_automute(codec);
13306 alc_mic_automute(codec);
13309 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13310 /* output mixer control */
13311 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13312 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13313 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13314 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13315 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13316 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13320 static struct hda_verb alc268_dell_verbs[] = {
13321 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13322 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13323 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13324 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13328 /* mute/unmute internal speaker according to the hp jack and mute state */
13329 static void alc268_dell_setup(struct hda_codec *codec)
13331 struct alc_spec *spec = codec->spec;
13333 spec->autocfg.hp_pins[0] = 0x15;
13334 spec->autocfg.speaker_pins[0] = 0x14;
13335 spec->ext_mic.pin = 0x18;
13336 spec->ext_mic.mux_idx = 0;
13337 spec->int_mic.pin = 0x19;
13338 spec->int_mic.mux_idx = 1;
13339 spec->auto_mic = 1;
13342 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13343 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13344 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13345 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13346 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13347 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13348 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13349 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13350 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13354 static struct hda_verb alc267_quanta_il1_verbs[] = {
13355 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13356 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13360 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13362 struct alc_spec *spec = codec->spec;
13363 spec->autocfg.hp_pins[0] = 0x15;
13364 spec->autocfg.speaker_pins[0] = 0x14;
13365 spec->ext_mic.pin = 0x18;
13366 spec->ext_mic.mux_idx = 0;
13367 spec->int_mic.pin = 0x19;
13368 spec->int_mic.mux_idx = 1;
13369 spec->auto_mic = 1;
13373 * generic initialization of ADC, input mixers and output mixers
13375 static struct hda_verb alc268_base_init_verbs[] = {
13376 /* Unmute DAC0-1 and set vol = 0 */
13377 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13378 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13381 * Set up output mixers (0x0c - 0x0e)
13383 /* set vol=0 to output mixers */
13384 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13385 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13387 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13388 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13390 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13392 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13393 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13394 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13395 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13396 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13397 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13399 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13400 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13401 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13402 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13403 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13405 /* set PCBEEP vol = 0, mute connections */
13406 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13407 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13408 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13410 /* Unmute Selector 23h,24h and set the default input to mic-in */
13412 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13413 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13414 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13421 * generic initialization of ADC, input mixers and output mixers
13423 static struct hda_verb alc268_volume_init_verbs[] = {
13424 /* set output DAC */
13425 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13426 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13428 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13429 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13430 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13431 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13432 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13434 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13435 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13436 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13438 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13439 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13441 /* set PCBEEP vol = 0, mute connections */
13442 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13443 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13444 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13449 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13450 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13451 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13455 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13456 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13457 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13462 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13463 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13464 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13465 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13466 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13471 static struct hda_input_mux alc268_capture_source = {
13475 { "Front Mic", 0x1 },
13481 static struct hda_input_mux alc268_acer_capture_source = {
13485 { "Internal Mic", 0x1 },
13490 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13494 { "Internal Mic", 0x6 },
13499 #ifdef CONFIG_SND_DEBUG
13500 static struct snd_kcontrol_new alc268_test_mixer[] = {
13501 /* Volume widgets */
13502 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13503 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13504 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13505 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13506 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13507 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13508 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13509 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13510 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13511 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13512 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13513 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13514 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13515 /* The below appears problematic on some hardwares */
13516 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13517 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13518 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13519 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13520 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13522 /* Modes for retasking pin widgets */
13523 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13524 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13525 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13526 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13528 /* Controls for GPIO pins, assuming they are configured as outputs */
13529 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13530 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13531 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13532 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13534 /* Switches to allow the digital SPDIF output pin to be enabled.
13535 * The ALC268 does not have an SPDIF input.
13537 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13539 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13540 * this output to turn on an external amplifier.
13542 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13543 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13549 /* create input playback/capture controls for the given pin */
13550 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13551 const char *ctlname, int idx)
13562 case 0x1a: /* ALC259/269 only */
13563 case 0x1b: /* ALC259/269 only */
13564 case 0x21: /* ALC269vb has this pin, too */
13568 snd_printd(KERN_WARNING "hda_codec: "
13569 "ignoring pin 0x%x as unknown\n", nid);
13572 if (spec->multiout.dac_nids[0] != dac &&
13573 spec->multiout.dac_nids[1] != dac) {
13574 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13575 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13579 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13583 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13584 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13586 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13587 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13593 /* add playback controls from the parsed DAC table */
13594 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13595 const struct auto_pin_cfg *cfg)
13600 spec->multiout.dac_nids = spec->private_dac_nids;
13602 nid = cfg->line_out_pins[0];
13605 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13609 err = alc268_new_analog_output(spec, nid, name, 0);
13614 nid = cfg->speaker_pins[0];
13616 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13617 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13621 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13625 nid = cfg->hp_pins[0];
13627 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13632 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13634 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13635 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13642 /* create playback/capture controls for input pins */
13643 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13644 const struct auto_pin_cfg *cfg)
13646 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13649 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13650 hda_nid_t nid, int pin_type)
13654 alc_set_pin_output(codec, nid, pin_type);
13655 if (nid == 0x14 || nid == 0x16)
13659 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13662 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13664 struct alc_spec *spec = codec->spec;
13667 for (i = 0; i < spec->autocfg.line_outs; i++) {
13668 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13669 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13670 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13674 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13676 struct alc_spec *spec = codec->spec;
13680 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13681 pin = spec->autocfg.hp_pins[i];
13682 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13684 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13685 pin = spec->autocfg.speaker_pins[i];
13686 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13688 if (spec->autocfg.mono_out_pin)
13689 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13690 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13693 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13695 struct alc_spec *spec = codec->spec;
13696 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13697 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13698 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13699 unsigned int dac_vol1, dac_vol2;
13701 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13702 snd_hda_codec_write(codec, speaker_nid, 0,
13703 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13704 /* mute mixer inputs from 0x1d */
13705 snd_hda_codec_write(codec, 0x0f, 0,
13706 AC_VERB_SET_AMP_GAIN_MUTE,
13708 snd_hda_codec_write(codec, 0x10, 0,
13709 AC_VERB_SET_AMP_GAIN_MUTE,
13712 /* unmute mixer inputs from 0x1d */
13713 snd_hda_codec_write(codec, 0x0f, 0,
13714 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13715 snd_hda_codec_write(codec, 0x10, 0,
13716 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13719 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13720 if (line_nid == 0x14)
13721 dac_vol2 = AMP_OUT_ZERO;
13722 else if (line_nid == 0x15)
13723 dac_vol1 = AMP_OUT_ZERO;
13724 if (hp_nid == 0x14)
13725 dac_vol2 = AMP_OUT_ZERO;
13726 else if (hp_nid == 0x15)
13727 dac_vol1 = AMP_OUT_ZERO;
13728 if (line_nid != 0x16 || hp_nid != 0x16 ||
13729 spec->autocfg.line_out_pins[1] != 0x16 ||
13730 spec->autocfg.line_out_pins[2] != 0x16)
13731 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13733 snd_hda_codec_write(codec, 0x02, 0,
13734 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13735 snd_hda_codec_write(codec, 0x03, 0,
13736 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13739 /* pcm configuration: identical with ALC880 */
13740 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13741 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13742 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13743 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13746 * BIOS auto configuration
13748 static int alc268_parse_auto_config(struct hda_codec *codec)
13750 struct alc_spec *spec = codec->spec;
13752 static hda_nid_t alc268_ignore[] = { 0 };
13754 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13758 if (!spec->autocfg.line_outs) {
13759 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13760 spec->multiout.max_channels = 2;
13761 spec->no_analog = 1;
13764 return 0; /* can't find valid BIOS pin config */
13766 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13769 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13773 spec->multiout.max_channels = 2;
13776 /* digital only support output */
13777 alc_auto_parse_digital(codec);
13778 if (spec->kctls.list)
13779 add_mixer(spec, spec->kctls.list);
13781 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13782 add_mixer(spec, alc268_beep_mixer);
13784 add_verb(spec, alc268_volume_init_verbs);
13785 spec->num_mux_defs = 2;
13786 spec->input_mux = &spec->private_imux[0];
13788 err = alc_auto_add_mic_boost(codec);
13792 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13797 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13799 /* init callback for auto-configuration model -- overriding the default init */
13800 static void alc268_auto_init(struct hda_codec *codec)
13802 struct alc_spec *spec = codec->spec;
13803 alc268_auto_init_multi_out(codec);
13804 alc268_auto_init_hp_out(codec);
13805 alc268_auto_init_mono_speaker_out(codec);
13806 alc268_auto_init_analog_input(codec);
13807 alc_auto_init_digital(codec);
13808 if (spec->unsol_event)
13809 alc_inithook(codec);
13813 * configuration and preset
13815 static const char * const alc268_models[ALC268_MODEL_LAST] = {
13816 [ALC267_QUANTA_IL1] = "quanta-il1",
13817 [ALC268_3ST] = "3stack",
13818 [ALC268_TOSHIBA] = "toshiba",
13819 [ALC268_ACER] = "acer",
13820 [ALC268_ACER_DMIC] = "acer-dmic",
13821 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13822 [ALC268_DELL] = "dell",
13823 [ALC268_ZEPTO] = "zepto",
13824 #ifdef CONFIG_SND_DEBUG
13825 [ALC268_TEST] = "test",
13827 [ALC268_AUTO] = "auto",
13830 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13831 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13832 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13833 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13834 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13835 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13836 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13837 ALC268_ACER_ASPIRE_ONE),
13838 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13839 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13840 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13841 /* almost compatible with toshiba but with optional digital outs;
13842 * auto-probing seems working fine
13844 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13846 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13847 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13848 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13849 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13850 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13854 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13855 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13856 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13857 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13858 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13863 static struct alc_config_preset alc268_presets[] = {
13864 [ALC267_QUANTA_IL1] = {
13865 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13866 alc268_capture_nosrc_mixer },
13867 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13868 alc267_quanta_il1_verbs },
13869 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13870 .dac_nids = alc268_dac_nids,
13871 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13872 .adc_nids = alc268_adc_nids_alt,
13874 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13875 .channel_mode = alc268_modes,
13876 .unsol_event = alc_sku_unsol_event,
13877 .setup = alc267_quanta_il1_setup,
13878 .init_hook = alc_inithook,
13881 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13882 alc268_beep_mixer },
13883 .init_verbs = { alc268_base_init_verbs },
13884 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13885 .dac_nids = alc268_dac_nids,
13886 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13887 .adc_nids = alc268_adc_nids_alt,
13888 .capsrc_nids = alc268_capsrc_nids,
13890 .dig_out_nid = ALC268_DIGOUT_NID,
13891 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13892 .channel_mode = alc268_modes,
13893 .input_mux = &alc268_capture_source,
13895 [ALC268_TOSHIBA] = {
13896 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13897 alc268_beep_mixer },
13898 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13899 alc268_toshiba_verbs },
13900 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13901 .dac_nids = alc268_dac_nids,
13902 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13903 .adc_nids = alc268_adc_nids_alt,
13904 .capsrc_nids = alc268_capsrc_nids,
13906 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13907 .channel_mode = alc268_modes,
13908 .input_mux = &alc268_capture_source,
13909 .unsol_event = alc268_toshiba_unsol_event,
13910 .setup = alc268_toshiba_setup,
13911 .init_hook = alc268_toshiba_automute,
13914 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13915 alc268_beep_mixer },
13916 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13917 alc268_acer_verbs },
13918 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13919 .dac_nids = alc268_dac_nids,
13920 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13921 .adc_nids = alc268_adc_nids_alt,
13922 .capsrc_nids = alc268_capsrc_nids,
13924 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13925 .channel_mode = alc268_modes,
13926 .input_mux = &alc268_acer_capture_source,
13927 .unsol_event = alc268_acer_unsol_event,
13928 .init_hook = alc268_acer_init_hook,
13930 [ALC268_ACER_DMIC] = {
13931 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13932 alc268_beep_mixer },
13933 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13934 alc268_acer_verbs },
13935 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13936 .dac_nids = alc268_dac_nids,
13937 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13938 .adc_nids = alc268_adc_nids_alt,
13939 .capsrc_nids = alc268_capsrc_nids,
13941 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13942 .channel_mode = alc268_modes,
13943 .input_mux = &alc268_acer_dmic_capture_source,
13944 .unsol_event = alc268_acer_unsol_event,
13945 .init_hook = alc268_acer_init_hook,
13947 [ALC268_ACER_ASPIRE_ONE] = {
13948 .mixers = { alc268_acer_aspire_one_mixer,
13950 alc268_capture_nosrc_mixer },
13951 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13952 alc268_acer_aspire_one_verbs },
13953 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13954 .dac_nids = alc268_dac_nids,
13955 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13956 .adc_nids = alc268_adc_nids_alt,
13957 .capsrc_nids = alc268_capsrc_nids,
13959 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13960 .channel_mode = alc268_modes,
13961 .unsol_event = alc268_acer_lc_unsol_event,
13962 .setup = alc268_acer_lc_setup,
13963 .init_hook = alc268_acer_lc_init_hook,
13966 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13967 alc268_capture_nosrc_mixer },
13968 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13969 alc268_dell_verbs },
13970 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13971 .dac_nids = alc268_dac_nids,
13972 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13973 .adc_nids = alc268_adc_nids_alt,
13974 .capsrc_nids = alc268_capsrc_nids,
13976 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13977 .channel_mode = alc268_modes,
13978 .unsol_event = alc_sku_unsol_event,
13979 .setup = alc268_dell_setup,
13980 .init_hook = alc_inithook,
13983 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13984 alc268_beep_mixer },
13985 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13986 alc268_toshiba_verbs },
13987 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13988 .dac_nids = alc268_dac_nids,
13989 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13990 .adc_nids = alc268_adc_nids_alt,
13991 .capsrc_nids = alc268_capsrc_nids,
13993 .dig_out_nid = ALC268_DIGOUT_NID,
13994 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13995 .channel_mode = alc268_modes,
13996 .input_mux = &alc268_capture_source,
13997 .setup = alc268_toshiba_setup,
13998 .init_hook = alc268_toshiba_automute,
14000 #ifdef CONFIG_SND_DEBUG
14002 .mixers = { alc268_test_mixer, alc268_capture_mixer },
14003 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
14004 alc268_volume_init_verbs },
14005 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14006 .dac_nids = alc268_dac_nids,
14007 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14008 .adc_nids = alc268_adc_nids_alt,
14009 .capsrc_nids = alc268_capsrc_nids,
14011 .dig_out_nid = ALC268_DIGOUT_NID,
14012 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14013 .channel_mode = alc268_modes,
14014 .input_mux = &alc268_capture_source,
14019 static int patch_alc268(struct hda_codec *codec)
14021 struct alc_spec *spec;
14023 int i, has_beep, err;
14025 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14029 codec->spec = spec;
14031 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
14035 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
14036 board_config = snd_hda_check_board_codec_sid_config(codec,
14037 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
14039 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
14040 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14042 board_config = ALC268_AUTO;
14045 if (board_config == ALC268_AUTO) {
14046 /* automatic parse from the BIOS config */
14047 err = alc268_parse_auto_config(codec);
14053 "hda_codec: Cannot set up configuration "
14054 "from BIOS. Using base mode...\n");
14055 board_config = ALC268_3ST;
14059 if (board_config != ALC268_AUTO)
14060 setup_preset(codec, &alc268_presets[board_config]);
14062 spec->stream_analog_playback = &alc268_pcm_analog_playback;
14063 spec->stream_analog_capture = &alc268_pcm_analog_capture;
14064 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
14066 spec->stream_digital_playback = &alc268_pcm_digital_playback;
14069 for (i = 0; i < spec->num_mixers; i++) {
14070 if (spec->mixers[i] == alc268_beep_mixer) {
14077 err = snd_hda_attach_beep_device(codec, 0x1);
14082 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14083 /* override the amp caps for beep generator */
14084 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14085 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14086 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14087 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14088 (0 << AC_AMPCAP_MUTE_SHIFT));
14091 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14092 /* check whether NID 0x07 is valid */
14093 unsigned int wcap = get_wcaps(codec, 0x07);
14096 spec->capsrc_nids = alc268_capsrc_nids;
14098 wcap = get_wcaps_type(wcap);
14099 if (spec->auto_mic ||
14100 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14101 spec->adc_nids = alc268_adc_nids_alt;
14102 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14103 if (spec->auto_mic)
14104 fixup_automic_adc(codec);
14105 if (spec->auto_mic || spec->input_mux->num_items == 1)
14106 add_mixer(spec, alc268_capture_nosrc_mixer);
14108 add_mixer(spec, alc268_capture_alt_mixer);
14110 spec->adc_nids = alc268_adc_nids;
14111 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14112 add_mixer(spec, alc268_capture_mixer);
14114 /* set default input source */
14115 for (i = 0; i < spec->num_adc_nids; i++)
14116 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
14117 0, AC_VERB_SET_CONNECT_SEL,
14118 i < spec->num_mux_defs ?
14119 spec->input_mux[i].items[0].index :
14120 spec->input_mux->items[0].index);
14123 spec->vmaster_nid = 0x02;
14125 codec->patch_ops = alc_patch_ops;
14126 if (board_config == ALC268_AUTO)
14127 spec->init_hook = alc268_auto_init;
14129 alc_init_jacks(codec);
14135 * ALC269 channel source setting (2 channel)
14137 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14139 #define alc269_dac_nids alc260_dac_nids
14141 static hda_nid_t alc269_adc_nids[1] = {
14146 static hda_nid_t alc269_capsrc_nids[1] = {
14150 static hda_nid_t alc269vb_adc_nids[1] = {
14155 static hda_nid_t alc269vb_capsrc_nids[1] = {
14159 static hda_nid_t alc269_adc_candidates[] = {
14163 #define alc269_modes alc260_modes
14164 #define alc269_capture_source alc880_lg_lw_capture_source
14166 static struct snd_kcontrol_new alc269_base_mixer[] = {
14167 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14168 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14169 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14170 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14172 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14173 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14174 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14175 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14176 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14177 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14178 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14182 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14183 /* output mixer control */
14184 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14186 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14187 .name = "Master Playback Switch",
14188 .subdevice = HDA_SUBDEV_AMP_FLAG,
14189 .info = snd_hda_mixer_amp_switch_info,
14190 .get = snd_hda_mixer_amp_switch_get,
14191 .put = alc268_acer_master_sw_put,
14192 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14195 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14196 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14197 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14198 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14199 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14203 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14204 /* output mixer control */
14205 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14207 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14208 .name = "Master Playback Switch",
14209 .subdevice = HDA_SUBDEV_AMP_FLAG,
14210 .info = snd_hda_mixer_amp_switch_info,
14211 .get = snd_hda_mixer_amp_switch_get,
14212 .put = alc268_acer_master_sw_put,
14213 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14217 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14218 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14219 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14220 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14221 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14222 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14223 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14227 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14228 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14229 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14231 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14235 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14236 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14237 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14238 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14239 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14243 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14244 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14245 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14249 /* capture mixer elements */
14250 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14251 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14252 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14253 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14254 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14258 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14259 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14260 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14261 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14265 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14266 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14267 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14268 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14269 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14273 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14274 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14275 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14276 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14281 #define alc269_fujitsu_mixer alc269_laptop_mixer
14283 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14284 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14285 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14286 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14287 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14288 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14289 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14293 static struct hda_verb alc269_lifebook_verbs[] = {
14294 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14295 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14296 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14297 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14298 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14299 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14300 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14301 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14302 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14303 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14307 /* toggle speaker-output according to the hp-jack state */
14308 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14310 unsigned int present;
14311 unsigned char bits;
14313 present = snd_hda_jack_detect(codec, 0x15);
14314 bits = present ? HDA_AMP_MUTE : 0;
14315 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14316 HDA_AMP_MUTE, bits);
14317 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14318 HDA_AMP_MUTE, bits);
14320 snd_hda_codec_write(codec, 0x20, 0,
14321 AC_VERB_SET_COEF_INDEX, 0x0c);
14322 snd_hda_codec_write(codec, 0x20, 0,
14323 AC_VERB_SET_PROC_COEF, 0x680);
14325 snd_hda_codec_write(codec, 0x20, 0,
14326 AC_VERB_SET_COEF_INDEX, 0x0c);
14327 snd_hda_codec_write(codec, 0x20, 0,
14328 AC_VERB_SET_PROC_COEF, 0x480);
14331 /* toggle speaker-output according to the hp-jacks state */
14332 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14334 unsigned int present;
14335 unsigned char bits;
14337 /* Check laptop headphone socket */
14338 present = snd_hda_jack_detect(codec, 0x15);
14340 /* Check port replicator headphone socket */
14341 present |= snd_hda_jack_detect(codec, 0x1a);
14343 bits = present ? HDA_AMP_MUTE : 0;
14344 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14345 HDA_AMP_MUTE, bits);
14346 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14347 HDA_AMP_MUTE, bits);
14349 snd_hda_codec_write(codec, 0x20, 0,
14350 AC_VERB_SET_COEF_INDEX, 0x0c);
14351 snd_hda_codec_write(codec, 0x20, 0,
14352 AC_VERB_SET_PROC_COEF, 0x680);
14354 snd_hda_codec_write(codec, 0x20, 0,
14355 AC_VERB_SET_COEF_INDEX, 0x0c);
14356 snd_hda_codec_write(codec, 0x20, 0,
14357 AC_VERB_SET_PROC_COEF, 0x480);
14360 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14362 unsigned int present_laptop;
14363 unsigned int present_dock;
14365 present_laptop = snd_hda_jack_detect(codec, 0x18);
14366 present_dock = snd_hda_jack_detect(codec, 0x1b);
14368 /* Laptop mic port overrides dock mic port, design decision */
14370 snd_hda_codec_write(codec, 0x23, 0,
14371 AC_VERB_SET_CONNECT_SEL, 0x3);
14372 if (present_laptop)
14373 snd_hda_codec_write(codec, 0x23, 0,
14374 AC_VERB_SET_CONNECT_SEL, 0x0);
14375 if (!present_dock && !present_laptop)
14376 snd_hda_codec_write(codec, 0x23, 0,
14377 AC_VERB_SET_CONNECT_SEL, 0x1);
14380 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14383 switch (res >> 26) {
14384 case ALC880_HP_EVENT:
14385 alc269_quanta_fl1_speaker_automute(codec);
14387 case ALC880_MIC_EVENT:
14388 alc_mic_automute(codec);
14393 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14396 if ((res >> 26) == ALC880_HP_EVENT)
14397 alc269_lifebook_speaker_automute(codec);
14398 if ((res >> 26) == ALC880_MIC_EVENT)
14399 alc269_lifebook_mic_autoswitch(codec);
14402 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14404 struct alc_spec *spec = codec->spec;
14405 spec->autocfg.hp_pins[0] = 0x15;
14406 spec->autocfg.speaker_pins[0] = 0x14;
14407 spec->ext_mic.pin = 0x18;
14408 spec->ext_mic.mux_idx = 0;
14409 spec->int_mic.pin = 0x19;
14410 spec->int_mic.mux_idx = 1;
14411 spec->auto_mic = 1;
14414 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14416 alc269_quanta_fl1_speaker_automute(codec);
14417 alc_mic_automute(codec);
14420 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14422 alc269_lifebook_speaker_automute(codec);
14423 alc269_lifebook_mic_autoswitch(codec);
14426 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14427 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14428 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14429 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14430 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14431 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14432 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14433 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14437 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14438 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14439 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14440 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14441 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14442 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14443 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14447 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14448 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14449 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14450 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14451 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14452 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14453 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14454 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14458 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14459 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14460 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14461 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14462 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14463 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14464 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14465 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14469 static struct hda_verb alc271_acer_dmic_verbs[] = {
14470 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14471 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14472 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14473 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14474 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14475 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14476 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14477 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14478 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14479 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14483 /* toggle speaker-output according to the hp-jack state */
14484 static void alc269_speaker_automute(struct hda_codec *codec)
14486 struct alc_spec *spec = codec->spec;
14487 unsigned int nid = spec->autocfg.hp_pins[0];
14488 unsigned int present;
14489 unsigned char bits;
14491 present = snd_hda_jack_detect(codec, nid);
14492 bits = present ? HDA_AMP_MUTE : 0;
14493 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14494 HDA_AMP_MUTE, bits);
14495 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14496 HDA_AMP_MUTE, bits);
14497 alc_report_jack(codec, nid);
14500 /* unsolicited event for HP jack sensing */
14501 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14504 switch (res >> 26) {
14505 case ALC880_HP_EVENT:
14506 alc269_speaker_automute(codec);
14508 case ALC880_MIC_EVENT:
14509 alc_mic_automute(codec);
14514 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14516 struct alc_spec *spec = codec->spec;
14517 spec->autocfg.hp_pins[0] = 0x15;
14518 spec->autocfg.speaker_pins[0] = 0x14;
14519 spec->ext_mic.pin = 0x18;
14520 spec->ext_mic.mux_idx = 0;
14521 spec->int_mic.pin = 0x19;
14522 spec->int_mic.mux_idx = 1;
14523 spec->auto_mic = 1;
14526 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14528 struct alc_spec *spec = codec->spec;
14529 spec->autocfg.hp_pins[0] = 0x15;
14530 spec->autocfg.speaker_pins[0] = 0x14;
14531 spec->ext_mic.pin = 0x18;
14532 spec->ext_mic.mux_idx = 0;
14533 spec->int_mic.pin = 0x12;
14534 spec->int_mic.mux_idx = 5;
14535 spec->auto_mic = 1;
14538 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14540 struct alc_spec *spec = codec->spec;
14541 spec->autocfg.hp_pins[0] = 0x21;
14542 spec->autocfg.speaker_pins[0] = 0x14;
14543 spec->ext_mic.pin = 0x18;
14544 spec->ext_mic.mux_idx = 0;
14545 spec->int_mic.pin = 0x19;
14546 spec->int_mic.mux_idx = 1;
14547 spec->auto_mic = 1;
14550 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14552 struct alc_spec *spec = codec->spec;
14553 spec->autocfg.hp_pins[0] = 0x21;
14554 spec->autocfg.speaker_pins[0] = 0x14;
14555 spec->ext_mic.pin = 0x18;
14556 spec->ext_mic.mux_idx = 0;
14557 spec->int_mic.pin = 0x12;
14558 spec->int_mic.mux_idx = 6;
14559 spec->auto_mic = 1;
14562 static void alc269_laptop_inithook(struct hda_codec *codec)
14564 alc269_speaker_automute(codec);
14565 alc_mic_automute(codec);
14569 * generic initialization of ADC, input mixers and output mixers
14571 static struct hda_verb alc269_init_verbs[] = {
14573 * Unmute ADC0 and set the default input to mic-in
14575 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14578 * Set up output mixers (0x02 - 0x03)
14580 /* set vol=0 to output mixers */
14581 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14582 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14584 /* set up input amps for analog loopback */
14585 /* Amp Indices: DAC = 0, mixer = 1 */
14586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14588 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14590 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14591 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14593 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14594 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14595 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14596 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14597 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14598 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14599 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14601 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14602 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14604 /* FIXME: use Mux-type input source selection */
14605 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14606 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14607 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14610 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14614 static struct hda_verb alc269vb_init_verbs[] = {
14616 * Unmute ADC0 and set the default input to mic-in
14618 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14621 * Set up output mixers (0x02 - 0x03)
14623 /* set vol=0 to output mixers */
14624 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14625 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14627 /* set up input amps for analog loopback */
14628 /* Amp Indices: DAC = 0, mixer = 1 */
14629 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14630 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14631 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14632 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14633 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14634 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14636 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14637 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14638 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14639 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14640 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14641 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14642 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14644 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14645 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14647 /* FIXME: use Mux-type input source selection */
14648 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14649 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14650 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14653 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14657 #define alc269_auto_create_multi_out_ctls \
14658 alc268_auto_create_multi_out_ctls
14659 #define alc269_auto_create_input_ctls \
14660 alc268_auto_create_input_ctls
14662 #ifdef CONFIG_SND_HDA_POWER_SAVE
14663 #define alc269_loopbacks alc880_loopbacks
14666 /* pcm configuration: identical with ALC880 */
14667 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14668 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14669 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14670 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14672 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14676 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14677 /* NID is set in alc_build_pcms */
14679 .open = alc880_playback_pcm_open,
14680 .prepare = alc880_playback_pcm_prepare,
14681 .cleanup = alc880_playback_pcm_cleanup
14685 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14689 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14690 /* NID is set in alc_build_pcms */
14693 #ifdef CONFIG_SND_HDA_POWER_SAVE
14694 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14696 switch (codec->subsystem_id) {
14703 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14705 /* update mute-LED according to the speaker mute state */
14706 if (nid == 0x01 || nid == 0x14) {
14708 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14713 /* mic2 vref pin is used for mute LED control */
14714 snd_hda_codec_update_cache(codec, 0x19, 0,
14715 AC_VERB_SET_PIN_WIDGET_CONTROL,
14718 return alc_check_power_status(codec, nid);
14720 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14722 static int alc275_setup_dual_adc(struct hda_codec *codec)
14724 struct alc_spec *spec = codec->spec;
14726 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14728 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14729 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14730 if (spec->ext_mic.pin <= 0x12) {
14731 spec->private_adc_nids[0] = 0x08;
14732 spec->private_adc_nids[1] = 0x11;
14733 spec->private_capsrc_nids[0] = 0x23;
14734 spec->private_capsrc_nids[1] = 0x22;
14736 spec->private_adc_nids[0] = 0x11;
14737 spec->private_adc_nids[1] = 0x08;
14738 spec->private_capsrc_nids[0] = 0x22;
14739 spec->private_capsrc_nids[1] = 0x23;
14741 spec->adc_nids = spec->private_adc_nids;
14742 spec->capsrc_nids = spec->private_capsrc_nids;
14743 spec->num_adc_nids = 2;
14744 spec->dual_adc_switch = 1;
14745 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14746 spec->adc_nids[0], spec->adc_nids[1]);
14752 /* different alc269-variants */
14754 ALC269_TYPE_NORMAL,
14755 ALC269_TYPE_ALC258,
14756 ALC269_TYPE_ALC259,
14757 ALC269_TYPE_ALC269VB,
14758 ALC269_TYPE_ALC270,
14759 ALC269_TYPE_ALC271X,
14763 * BIOS auto configuration
14765 static int alc269_parse_auto_config(struct hda_codec *codec)
14767 struct alc_spec *spec = codec->spec;
14769 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14771 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14776 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14779 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14780 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14782 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14787 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14789 alc_auto_parse_digital(codec);
14791 if (spec->kctls.list)
14792 add_mixer(spec, spec->kctls.list);
14794 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14795 add_verb(spec, alc269vb_init_verbs);
14796 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14798 add_verb(spec, alc269_init_verbs);
14799 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14802 spec->num_mux_defs = 1;
14803 spec->input_mux = &spec->private_imux[0];
14805 if (!alc275_setup_dual_adc(codec))
14806 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14807 sizeof(alc269_adc_candidates));
14809 /* set default input source */
14810 if (!spec->dual_adc_switch)
14811 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14812 spec->input_mux->items[0].index);
14814 err = alc_auto_add_mic_boost(codec);
14818 if (!spec->cap_mixer && !spec->no_analog)
14819 set_capture_mixer(codec);
14824 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14825 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14826 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14829 /* init callback for auto-configuration model -- overriding the default init */
14830 static void alc269_auto_init(struct hda_codec *codec)
14832 struct alc_spec *spec = codec->spec;
14833 alc269_auto_init_multi_out(codec);
14834 alc269_auto_init_hp_out(codec);
14835 alc269_auto_init_analog_input(codec);
14836 alc_auto_init_digital(codec);
14837 if (spec->unsol_event)
14838 alc_inithook(codec);
14841 #ifdef SND_HDA_NEEDS_RESUME
14842 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14844 int val = alc_read_coef_idx(codec, 0x04);
14849 alc_write_coef_idx(codec, 0x04, val);
14852 #ifdef CONFIG_SND_HDA_POWER_SAVE
14853 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14855 struct alc_spec *spec = codec->spec;
14857 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14858 alc269_toggle_power_output(codec, 0);
14859 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14860 alc269_toggle_power_output(codec, 0);
14865 if (spec && spec->power_hook)
14866 spec->power_hook(codec);
14869 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14871 static int alc269_resume(struct hda_codec *codec)
14873 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14874 alc269_toggle_power_output(codec, 0);
14878 codec->patch_ops.init(codec);
14880 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14881 alc269_toggle_power_output(codec, 1);
14885 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14886 alc269_toggle_power_output(codec, 1);
14888 snd_hda_codec_resume_amp(codec);
14889 snd_hda_codec_resume_cache(codec);
14890 hda_call_check_power_status(codec, 0x01);
14893 #endif /* SND_HDA_NEEDS_RESUME */
14895 static void alc269_fixup_hweq(struct hda_codec *codec,
14896 const struct alc_fixup *fix, int action)
14900 if (action != ALC_FIXUP_ACT_INIT)
14902 coef = alc_read_coef_idx(codec, 0x1e);
14903 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14907 ALC269_FIXUP_SONY_VAIO,
14908 ALC275_FIXUP_SONY_VAIO_GPIO2,
14909 ALC269_FIXUP_DELL_M101Z,
14910 ALC269_FIXUP_SKU_IGNORE,
14911 ALC269_FIXUP_ASUS_G73JW,
14912 ALC269_FIXUP_LENOVO_EAPD,
14913 ALC275_FIXUP_SONY_HWEQ,
14916 static const struct alc_fixup alc269_fixups[] = {
14917 [ALC269_FIXUP_SONY_VAIO] = {
14918 .type = ALC_FIXUP_VERBS,
14919 .v.verbs = (const struct hda_verb[]) {
14920 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14924 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14925 .type = ALC_FIXUP_VERBS,
14926 .v.verbs = (const struct hda_verb[]) {
14927 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14928 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14929 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14933 .chain_id = ALC269_FIXUP_SONY_VAIO
14935 [ALC269_FIXUP_DELL_M101Z] = {
14936 .type = ALC_FIXUP_VERBS,
14937 .v.verbs = (const struct hda_verb[]) {
14938 /* Enables internal speaker */
14939 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14940 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14944 [ALC269_FIXUP_SKU_IGNORE] = {
14945 .type = ALC_FIXUP_SKU,
14946 .v.sku = ALC_FIXUP_SKU_IGNORE,
14948 [ALC269_FIXUP_ASUS_G73JW] = {
14949 .type = ALC_FIXUP_PINS,
14950 .v.pins = (const struct alc_pincfg[]) {
14951 { 0x17, 0x99130111 }, /* subwoofer */
14955 [ALC269_FIXUP_LENOVO_EAPD] = {
14956 .type = ALC_FIXUP_VERBS,
14957 .v.verbs = (const struct hda_verb[]) {
14958 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14962 [ALC275_FIXUP_SONY_HWEQ] = {
14963 .type = ALC_FIXUP_FUNC,
14964 .v.func = alc269_fixup_hweq,
14966 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14970 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14971 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14972 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14973 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14974 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14975 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14976 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14977 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
14978 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14979 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
14980 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
14981 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14982 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
14988 * configuration and preset
14990 static const char * const alc269_models[ALC269_MODEL_LAST] = {
14991 [ALC269_BASIC] = "basic",
14992 [ALC269_QUANTA_FL1] = "quanta",
14993 [ALC269_AMIC] = "laptop-amic",
14994 [ALC269_DMIC] = "laptop-dmic",
14995 [ALC269_FUJITSU] = "fujitsu",
14996 [ALC269_LIFEBOOK] = "lifebook",
14997 [ALC269_AUTO] = "auto",
15000 static struct snd_pci_quirk alc269_cfg_tbl[] = {
15001 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
15002 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
15003 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
15005 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
15006 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
15007 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
15008 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
15009 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
15010 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
15011 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
15012 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
15013 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
15014 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC),
15015 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
15016 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
15017 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
15018 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
15019 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
15020 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
15021 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
15022 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
15023 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
15024 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
15025 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
15026 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
15027 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
15028 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
15029 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
15030 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
15031 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
15032 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
15033 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
15034 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
15035 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
15036 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
15037 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
15038 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
15039 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
15040 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
15041 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
15043 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
15045 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
15046 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
15047 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
15048 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
15049 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
15050 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
15051 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
15052 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
15053 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
15054 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
15058 static struct alc_config_preset alc269_presets[] = {
15060 .mixers = { alc269_base_mixer },
15061 .init_verbs = { alc269_init_verbs },
15062 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15063 .dac_nids = alc269_dac_nids,
15065 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15066 .channel_mode = alc269_modes,
15067 .input_mux = &alc269_capture_source,
15069 [ALC269_QUANTA_FL1] = {
15070 .mixers = { alc269_quanta_fl1_mixer },
15071 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
15072 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15073 .dac_nids = alc269_dac_nids,
15075 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15076 .channel_mode = alc269_modes,
15077 .input_mux = &alc269_capture_source,
15078 .unsol_event = alc269_quanta_fl1_unsol_event,
15079 .setup = alc269_quanta_fl1_setup,
15080 .init_hook = alc269_quanta_fl1_init_hook,
15083 .mixers = { alc269_laptop_mixer },
15084 .cap_mixer = alc269_laptop_analog_capture_mixer,
15085 .init_verbs = { alc269_init_verbs,
15086 alc269_laptop_amic_init_verbs },
15087 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15088 .dac_nids = alc269_dac_nids,
15090 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15091 .channel_mode = alc269_modes,
15092 .unsol_event = alc269_laptop_unsol_event,
15093 .setup = alc269_laptop_amic_setup,
15094 .init_hook = alc269_laptop_inithook,
15097 .mixers = { alc269_laptop_mixer },
15098 .cap_mixer = alc269_laptop_digital_capture_mixer,
15099 .init_verbs = { alc269_init_verbs,
15100 alc269_laptop_dmic_init_verbs },
15101 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15102 .dac_nids = alc269_dac_nids,
15104 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15105 .channel_mode = alc269_modes,
15106 .unsol_event = alc269_laptop_unsol_event,
15107 .setup = alc269_laptop_dmic_setup,
15108 .init_hook = alc269_laptop_inithook,
15110 [ALC269VB_AMIC] = {
15111 .mixers = { alc269vb_laptop_mixer },
15112 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
15113 .init_verbs = { alc269vb_init_verbs,
15114 alc269vb_laptop_amic_init_verbs },
15115 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15116 .dac_nids = alc269_dac_nids,
15118 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15119 .channel_mode = alc269_modes,
15120 .unsol_event = alc269_laptop_unsol_event,
15121 .setup = alc269vb_laptop_amic_setup,
15122 .init_hook = alc269_laptop_inithook,
15124 [ALC269VB_DMIC] = {
15125 .mixers = { alc269vb_laptop_mixer },
15126 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15127 .init_verbs = { alc269vb_init_verbs,
15128 alc269vb_laptop_dmic_init_verbs },
15129 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15130 .dac_nids = alc269_dac_nids,
15132 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15133 .channel_mode = alc269_modes,
15134 .unsol_event = alc269_laptop_unsol_event,
15135 .setup = alc269vb_laptop_dmic_setup,
15136 .init_hook = alc269_laptop_inithook,
15138 [ALC269_FUJITSU] = {
15139 .mixers = { alc269_fujitsu_mixer },
15140 .cap_mixer = alc269_laptop_digital_capture_mixer,
15141 .init_verbs = { alc269_init_verbs,
15142 alc269_laptop_dmic_init_verbs },
15143 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15144 .dac_nids = alc269_dac_nids,
15146 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15147 .channel_mode = alc269_modes,
15148 .unsol_event = alc269_laptop_unsol_event,
15149 .setup = alc269_laptop_dmic_setup,
15150 .init_hook = alc269_laptop_inithook,
15152 [ALC269_LIFEBOOK] = {
15153 .mixers = { alc269_lifebook_mixer },
15154 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15155 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15156 .dac_nids = alc269_dac_nids,
15158 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15159 .channel_mode = alc269_modes,
15160 .input_mux = &alc269_capture_source,
15161 .unsol_event = alc269_lifebook_unsol_event,
15162 .init_hook = alc269_lifebook_init_hook,
15165 .mixers = { alc269_asus_mixer },
15166 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15167 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15168 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15169 .dac_nids = alc269_dac_nids,
15170 .adc_nids = alc262_dmic_adc_nids,
15171 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15172 .capsrc_nids = alc262_dmic_capsrc_nids,
15173 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15174 .channel_mode = alc269_modes,
15175 .input_mux = &alc269_capture_source,
15176 .dig_out_nid = ALC880_DIGOUT_NID,
15177 .unsol_event = alc_sku_unsol_event,
15178 .setup = alc269vb_laptop_dmic_setup,
15179 .init_hook = alc_inithook,
15183 static int alc269_fill_coef(struct hda_codec *codec)
15187 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15188 alc_write_coef_idx(codec, 0xf, 0x960b);
15189 alc_write_coef_idx(codec, 0xe, 0x8817);
15192 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15193 alc_write_coef_idx(codec, 0xf, 0x960b);
15194 alc_write_coef_idx(codec, 0xe, 0x8814);
15197 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15198 val = alc_read_coef_idx(codec, 0x04);
15199 /* Power up output pin */
15200 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15203 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15204 val = alc_read_coef_idx(codec, 0xd);
15205 if ((val & 0x0c00) >> 10 != 0x1) {
15206 /* Capless ramp up clock control */
15207 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15209 val = alc_read_coef_idx(codec, 0x17);
15210 if ((val & 0x01c0) >> 6 != 0x4) {
15211 /* Class D power on reset */
15212 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15218 static int patch_alc269(struct hda_codec *codec)
15220 struct alc_spec *spec;
15221 int board_config, coef;
15224 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15228 codec->spec = spec;
15230 alc_auto_parse_customize_define(codec);
15232 if (codec->vendor_id == 0x10ec0269) {
15233 coef = alc_read_coef_idx(codec, 0);
15234 if ((coef & 0x00f0) == 0x0010) {
15235 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15236 spec->cdefine.platform_type == 1) {
15237 alc_codec_rename(codec, "ALC271X");
15238 spec->codec_variant = ALC269_TYPE_ALC271X;
15239 } else if ((coef & 0xf000) == 0x1000) {
15240 spec->codec_variant = ALC269_TYPE_ALC270;
15241 } else if ((coef & 0xf000) == 0x2000) {
15242 alc_codec_rename(codec, "ALC259");
15243 spec->codec_variant = ALC269_TYPE_ALC259;
15244 } else if ((coef & 0xf000) == 0x3000) {
15245 alc_codec_rename(codec, "ALC258");
15246 spec->codec_variant = ALC269_TYPE_ALC258;
15248 alc_codec_rename(codec, "ALC269VB");
15249 spec->codec_variant = ALC269_TYPE_ALC269VB;
15252 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15253 alc269_fill_coef(codec);
15256 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15260 if (board_config < 0) {
15261 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15263 board_config = ALC269_AUTO;
15266 if (board_config == ALC269_AUTO) {
15267 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15268 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15271 if (board_config == ALC269_AUTO) {
15272 /* automatic parse from the BIOS config */
15273 err = alc269_parse_auto_config(codec);
15279 "hda_codec: Cannot set up configuration "
15280 "from BIOS. Using base mode...\n");
15281 board_config = ALC269_BASIC;
15285 if (has_cdefine_beep(codec)) {
15286 err = snd_hda_attach_beep_device(codec, 0x1);
15293 if (board_config != ALC269_AUTO)
15294 setup_preset(codec, &alc269_presets[board_config]);
15296 if (board_config == ALC269_QUANTA_FL1) {
15297 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15298 * fix the sample rate of analog I/O to 44.1kHz
15300 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15301 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15302 } else if (spec->dual_adc_switch) {
15303 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15304 /* switch ADC dynamically */
15305 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15307 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15308 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15310 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15311 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15313 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15314 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15315 spec->adc_nids = alc269_adc_nids;
15316 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15317 spec->capsrc_nids = alc269_capsrc_nids;
15319 spec->adc_nids = alc269vb_adc_nids;
15320 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15321 spec->capsrc_nids = alc269vb_capsrc_nids;
15325 if (!spec->cap_mixer)
15326 set_capture_mixer(codec);
15327 if (has_cdefine_beep(codec))
15328 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15330 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15332 spec->vmaster_nid = 0x02;
15334 codec->patch_ops = alc_patch_ops;
15335 #ifdef CONFIG_SND_HDA_POWER_SAVE
15336 codec->patch_ops.suspend = alc269_suspend;
15338 #ifdef SND_HDA_NEEDS_RESUME
15339 codec->patch_ops.resume = alc269_resume;
15341 if (board_config == ALC269_AUTO)
15342 spec->init_hook = alc269_auto_init;
15344 alc_init_jacks(codec);
15345 #ifdef CONFIG_SND_HDA_POWER_SAVE
15346 if (!spec->loopback.amplist)
15347 spec->loopback.amplist = alc269_loopbacks;
15348 if (alc269_mic2_for_mute_led(codec))
15349 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15356 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15360 * set the path ways for 2 channel output
15361 * need to set the codec line out and mic 1 pin widgets to inputs
15363 static struct hda_verb alc861_threestack_ch2_init[] = {
15364 /* set pin widget 1Ah (line in) for input */
15365 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15366 /* set pin widget 18h (mic1/2) for input, for mic also enable
15369 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15371 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15373 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15374 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15380 * need to set the codec line out and mic 1 pin widgets to outputs
15382 static struct hda_verb alc861_threestack_ch6_init[] = {
15383 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15384 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15385 /* set pin widget 18h (mic1) for output (CLFE)*/
15386 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15388 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15389 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15391 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15393 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15394 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15399 static struct hda_channel_mode alc861_threestack_modes[2] = {
15400 { 2, alc861_threestack_ch2_init },
15401 { 6, alc861_threestack_ch6_init },
15403 /* Set mic1 as input and unmute the mixer */
15404 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15405 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15406 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15409 /* Set mic1 as output and mute mixer */
15410 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15411 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15412 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15416 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15417 { 2, alc861_uniwill_m31_ch2_init },
15418 { 4, alc861_uniwill_m31_ch4_init },
15421 /* Set mic1 and line-in as input and unmute the mixer */
15422 static struct hda_verb alc861_asus_ch2_init[] = {
15423 /* set pin widget 1Ah (line in) for input */
15424 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15425 /* set pin widget 18h (mic1/2) for input, for mic also enable
15428 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15430 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15432 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15433 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15437 /* Set mic1 nad line-in as output and mute mixer */
15438 static struct hda_verb alc861_asus_ch6_init[] = {
15439 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15440 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15441 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15442 /* set pin widget 18h (mic1) for output (CLFE)*/
15443 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15444 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15445 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15446 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15448 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15450 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15451 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15456 static struct hda_channel_mode alc861_asus_modes[2] = {
15457 { 2, alc861_asus_ch2_init },
15458 { 6, alc861_asus_ch6_init },
15463 static struct snd_kcontrol_new alc861_base_mixer[] = {
15464 /* output mixer control */
15465 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15466 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15467 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15468 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15469 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15471 /*Input mixer control */
15472 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15473 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15474 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15475 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15476 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15477 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15478 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15479 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15480 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15481 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15486 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15487 /* output mixer control */
15488 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15489 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15490 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15491 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15492 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15494 /* Input mixer control */
15495 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15496 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15497 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15498 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15499 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15500 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15502 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15503 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15504 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15507 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15508 .name = "Channel Mode",
15509 .info = alc_ch_mode_info,
15510 .get = alc_ch_mode_get,
15511 .put = alc_ch_mode_put,
15512 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15517 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15518 /* output mixer control */
15519 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15521 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15526 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15527 /* output mixer control */
15528 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15529 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15530 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15531 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15532 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15534 /* Input mixer control */
15535 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15536 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15537 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15538 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15539 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15540 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15541 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15542 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15543 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15544 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15547 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15548 .name = "Channel Mode",
15549 .info = alc_ch_mode_info,
15550 .get = alc_ch_mode_get,
15551 .put = alc_ch_mode_put,
15552 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15557 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15558 /* output mixer control */
15559 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15560 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15561 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15562 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15563 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15565 /* Input mixer control */
15566 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15567 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15568 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15569 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15570 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15571 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15573 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15574 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15575 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15578 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15579 .name = "Channel Mode",
15580 .info = alc_ch_mode_info,
15581 .get = alc_ch_mode_get,
15582 .put = alc_ch_mode_put,
15583 .private_value = ARRAY_SIZE(alc861_asus_modes),
15588 /* additional mixer */
15589 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15590 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15591 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15596 * generic initialization of ADC, input mixers and output mixers
15598 static struct hda_verb alc861_base_init_verbs[] = {
15600 * Unmute ADC0 and set the default input to mic-in
15602 /* port-A for surround (rear panel) */
15603 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15604 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15605 /* port-B for mic-in (rear panel) with vref */
15606 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15607 /* port-C for line-in (rear panel) */
15608 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15609 /* port-D for Front */
15610 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15611 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15612 /* port-E for HP out (front panel) */
15613 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15614 /* route front PCM to HP */
15615 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15616 /* port-F for mic-in (front panel) with vref */
15617 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15618 /* port-G for CLFE (rear panel) */
15619 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15620 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15621 /* port-H for side (rear panel) */
15622 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15623 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15625 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15626 /* route front mic to ADC1*/
15627 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15628 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15630 /* Unmute DAC0~3 & spdif out*/
15631 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15632 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15633 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15634 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15637 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15638 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15639 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15640 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15641 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15643 /* Unmute Stereo Mixer 15 */
15644 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15645 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15646 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15647 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15649 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15650 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15651 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15652 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15653 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15654 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15655 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15656 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15657 /* hp used DAC 3 (Front) */
15658 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15659 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15664 static struct hda_verb alc861_threestack_init_verbs[] = {
15666 * Unmute ADC0 and set the default input to mic-in
15668 /* port-A for surround (rear panel) */
15669 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15670 /* port-B for mic-in (rear panel) with vref */
15671 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15672 /* port-C for line-in (rear panel) */
15673 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15674 /* port-D for Front */
15675 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15676 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15677 /* port-E for HP out (front panel) */
15678 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15679 /* route front PCM to HP */
15680 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15681 /* port-F for mic-in (front panel) with vref */
15682 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15683 /* port-G for CLFE (rear panel) */
15684 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15685 /* port-H for side (rear panel) */
15686 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15688 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15689 /* route front mic to ADC1*/
15690 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15691 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15692 /* Unmute DAC0~3 & spdif out*/
15693 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15694 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15695 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15696 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15697 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15699 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15700 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15701 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15702 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15703 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15705 /* Unmute Stereo Mixer 15 */
15706 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15707 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15708 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15709 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15711 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15712 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15713 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15714 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15715 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15716 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15717 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15718 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15719 /* hp used DAC 3 (Front) */
15720 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15721 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15725 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15727 * Unmute ADC0 and set the default input to mic-in
15729 /* port-A for surround (rear panel) */
15730 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15731 /* port-B for mic-in (rear panel) with vref */
15732 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15733 /* port-C for line-in (rear panel) */
15734 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15735 /* port-D for Front */
15736 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15737 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15738 /* port-E for HP out (front panel) */
15739 /* this has to be set to VREF80 */
15740 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15741 /* route front PCM to HP */
15742 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15743 /* port-F for mic-in (front panel) with vref */
15744 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15745 /* port-G for CLFE (rear panel) */
15746 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15747 /* port-H for side (rear panel) */
15748 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15750 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15751 /* route front mic to ADC1*/
15752 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15753 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15754 /* Unmute DAC0~3 & spdif out*/
15755 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15756 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15757 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15758 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15759 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15761 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15762 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15763 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15764 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15765 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15767 /* Unmute Stereo Mixer 15 */
15768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15769 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15771 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15773 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15774 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15775 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15776 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15777 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15778 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15779 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15780 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15781 /* hp used DAC 3 (Front) */
15782 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15783 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15787 static struct hda_verb alc861_asus_init_verbs[] = {
15789 * Unmute ADC0 and set the default input to mic-in
15791 /* port-A for surround (rear panel)
15792 * according to codec#0 this is the HP jack
15794 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15795 /* route front PCM to HP */
15796 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15797 /* port-B for mic-in (rear panel) with vref */
15798 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15799 /* port-C for line-in (rear panel) */
15800 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15801 /* port-D for Front */
15802 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15803 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15804 /* port-E for HP out (front panel) */
15805 /* this has to be set to VREF80 */
15806 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15807 /* route front PCM to HP */
15808 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15809 /* port-F for mic-in (front panel) with vref */
15810 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15811 /* port-G for CLFE (rear panel) */
15812 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15813 /* port-H for side (rear panel) */
15814 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15816 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15817 /* route front mic to ADC1*/
15818 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15819 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15820 /* Unmute DAC0~3 & spdif out*/
15821 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15822 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15823 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15824 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15826 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15827 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15828 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15829 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15830 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15832 /* Unmute Stereo Mixer 15 */
15833 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15834 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15835 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15836 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15838 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15839 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15840 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15841 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15842 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15843 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15844 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15845 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15846 /* hp used DAC 3 (Front) */
15847 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15848 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15852 /* additional init verbs for ASUS laptops */
15853 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15854 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15855 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15860 * generic initialization of ADC, input mixers and output mixers
15862 static struct hda_verb alc861_auto_init_verbs[] = {
15864 * Unmute ADC0 and set the default input to mic-in
15866 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15867 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15869 /* Unmute DAC0~3 & spdif out*/
15870 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15871 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15872 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15873 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15874 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15876 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15877 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15878 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15879 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15880 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15882 /* Unmute Stereo Mixer 15 */
15883 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15884 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15885 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15886 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15888 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15889 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15890 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15891 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15892 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15893 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15894 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15895 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15897 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15898 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15899 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15900 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15901 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15902 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15903 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15904 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15906 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15911 static struct hda_verb alc861_toshiba_init_verbs[] = {
15912 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15917 /* toggle speaker-output according to the hp-jack state */
15918 static void alc861_toshiba_automute(struct hda_codec *codec)
15920 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15922 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15923 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15924 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15925 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15928 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15931 if ((res >> 26) == ALC880_HP_EVENT)
15932 alc861_toshiba_automute(codec);
15935 /* pcm configuration: identical with ALC880 */
15936 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15937 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15938 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15939 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15942 #define ALC861_DIGOUT_NID 0x07
15944 static struct hda_channel_mode alc861_8ch_modes[1] = {
15948 static hda_nid_t alc861_dac_nids[4] = {
15949 /* front, surround, clfe, side */
15950 0x03, 0x06, 0x05, 0x04
15953 static hda_nid_t alc660_dac_nids[3] = {
15954 /* front, clfe, surround */
15958 static hda_nid_t alc861_adc_nids[1] = {
15963 static struct hda_input_mux alc861_capture_source = {
15967 { "Front Mic", 0x3 },
15974 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15976 struct alc_spec *spec = codec->spec;
15977 hda_nid_t mix, srcs[5];
15980 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15982 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15985 for (i = 0; i < num; i++) {
15987 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15988 if (type != AC_WID_AUD_OUT)
15990 for (j = 0; j < spec->multiout.num_dacs; j++)
15991 if (spec->multiout.dac_nids[j] == srcs[i])
15993 if (j >= spec->multiout.num_dacs)
15999 /* fill in the dac_nids table from the parsed pin configuration */
16000 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
16001 const struct auto_pin_cfg *cfg)
16003 struct alc_spec *spec = codec->spec;
16005 hda_nid_t nid, dac;
16007 spec->multiout.dac_nids = spec->private_dac_nids;
16008 for (i = 0; i < cfg->line_outs; i++) {
16009 nid = cfg->line_out_pins[i];
16010 dac = alc861_look_for_dac(codec, nid);
16013 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
16018 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
16019 hda_nid_t nid, int idx, unsigned int chs)
16021 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
16022 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
16025 #define alc861_create_out_sw(codec, pfx, nid, chs) \
16026 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
16028 /* add playback controls from the parsed DAC table */
16029 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
16030 const struct auto_pin_cfg *cfg)
16032 struct alc_spec *spec = codec->spec;
16033 static const char * const chname[4] = {
16034 "Front", "Surround", NULL /*CLFE*/, "Side"
16036 const char *pfx = alc_get_line_out_pfx(cfg, true);
16040 for (i = 0; i < cfg->line_outs; i++) {
16041 nid = spec->multiout.dac_nids[i];
16044 if (!pfx && i == 2) {
16046 err = alc861_create_out_sw(codec, "Center", nid, 1);
16049 err = alc861_create_out_sw(codec, "LFE", nid, 2);
16053 const char *name = pfx;
16056 err = __alc861_create_out_sw(codec, name, nid, i, 3);
16064 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
16066 struct alc_spec *spec = codec->spec;
16073 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
16074 nid = alc861_look_for_dac(codec, pin);
16076 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
16079 spec->multiout.hp_nid = nid;
16085 /* create playback/capture controls for input pins */
16086 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
16087 const struct auto_pin_cfg *cfg)
16089 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
16092 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
16094 int pin_type, hda_nid_t dac)
16096 hda_nid_t mix, srcs[5];
16099 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
16101 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16103 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
16105 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16108 for (i = 0; i < num; i++) {
16110 if (srcs[i] == dac || srcs[i] == 0x15)
16111 mute = AMP_IN_UNMUTE(i);
16113 mute = AMP_IN_MUTE(i);
16114 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16119 static void alc861_auto_init_multi_out(struct hda_codec *codec)
16121 struct alc_spec *spec = codec->spec;
16124 for (i = 0; i < spec->autocfg.line_outs; i++) {
16125 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16126 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16128 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
16129 spec->multiout.dac_nids[i]);
16133 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16135 struct alc_spec *spec = codec->spec;
16137 if (spec->autocfg.hp_outs)
16138 alc861_auto_set_output_and_unmute(codec,
16139 spec->autocfg.hp_pins[0],
16141 spec->multiout.hp_nid);
16142 if (spec->autocfg.speaker_outs)
16143 alc861_auto_set_output_and_unmute(codec,
16144 spec->autocfg.speaker_pins[0],
16146 spec->multiout.dac_nids[0]);
16149 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16151 struct alc_spec *spec = codec->spec;
16152 struct auto_pin_cfg *cfg = &spec->autocfg;
16155 for (i = 0; i < cfg->num_inputs; i++) {
16156 hda_nid_t nid = cfg->inputs[i].pin;
16157 if (nid >= 0x0c && nid <= 0x11)
16158 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16162 /* parse the BIOS configuration and set up the alc_spec */
16163 /* return 1 if successful, 0 if the proper config is not found,
16164 * or a negative error code
16166 static int alc861_parse_auto_config(struct hda_codec *codec)
16168 struct alc_spec *spec = codec->spec;
16170 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16172 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16176 if (!spec->autocfg.line_outs)
16177 return 0; /* can't find valid BIOS pin config */
16179 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16182 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16185 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16188 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16192 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16194 alc_auto_parse_digital(codec);
16196 if (spec->kctls.list)
16197 add_mixer(spec, spec->kctls.list);
16199 add_verb(spec, alc861_auto_init_verbs);
16201 spec->num_mux_defs = 1;
16202 spec->input_mux = &spec->private_imux[0];
16204 spec->adc_nids = alc861_adc_nids;
16205 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16206 set_capture_mixer(codec);
16208 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16213 /* additional initialization for auto-configuration model */
16214 static void alc861_auto_init(struct hda_codec *codec)
16216 struct alc_spec *spec = codec->spec;
16217 alc861_auto_init_multi_out(codec);
16218 alc861_auto_init_hp_out(codec);
16219 alc861_auto_init_analog_input(codec);
16220 alc_auto_init_digital(codec);
16221 if (spec->unsol_event)
16222 alc_inithook(codec);
16225 #ifdef CONFIG_SND_HDA_POWER_SAVE
16226 static struct hda_amp_list alc861_loopbacks[] = {
16227 { 0x15, HDA_INPUT, 0 },
16228 { 0x15, HDA_INPUT, 1 },
16229 { 0x15, HDA_INPUT, 2 },
16230 { 0x15, HDA_INPUT, 3 },
16237 * configuration and preset
16239 static const char * const alc861_models[ALC861_MODEL_LAST] = {
16240 [ALC861_3ST] = "3stack",
16241 [ALC660_3ST] = "3stack-660",
16242 [ALC861_3ST_DIG] = "3stack-dig",
16243 [ALC861_6ST_DIG] = "6stack-dig",
16244 [ALC861_UNIWILL_M31] = "uniwill-m31",
16245 [ALC861_TOSHIBA] = "toshiba",
16246 [ALC861_ASUS] = "asus",
16247 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16248 [ALC861_AUTO] = "auto",
16251 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16252 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16253 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16254 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16255 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16256 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16257 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16258 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16259 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16260 * Any other models that need this preset?
16262 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16263 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16264 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16265 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16266 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16267 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16268 /* FIXME: the below seems conflict */
16269 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16270 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16271 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16275 static struct alc_config_preset alc861_presets[] = {
16277 .mixers = { alc861_3ST_mixer },
16278 .init_verbs = { alc861_threestack_init_verbs },
16279 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16280 .dac_nids = alc861_dac_nids,
16281 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16282 .channel_mode = alc861_threestack_modes,
16284 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16285 .adc_nids = alc861_adc_nids,
16286 .input_mux = &alc861_capture_source,
16288 [ALC861_3ST_DIG] = {
16289 .mixers = { alc861_base_mixer },
16290 .init_verbs = { alc861_threestack_init_verbs },
16291 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16292 .dac_nids = alc861_dac_nids,
16293 .dig_out_nid = ALC861_DIGOUT_NID,
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_6ST_DIG] = {
16302 .mixers = { alc861_base_mixer },
16303 .init_verbs = { alc861_base_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_8ch_modes),
16308 .channel_mode = alc861_8ch_modes,
16309 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16310 .adc_nids = alc861_adc_nids,
16311 .input_mux = &alc861_capture_source,
16314 .mixers = { alc861_3ST_mixer },
16315 .init_verbs = { alc861_threestack_init_verbs },
16316 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16317 .dac_nids = alc660_dac_nids,
16318 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16319 .channel_mode = alc861_threestack_modes,
16321 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16322 .adc_nids = alc861_adc_nids,
16323 .input_mux = &alc861_capture_source,
16325 [ALC861_UNIWILL_M31] = {
16326 .mixers = { alc861_uniwill_m31_mixer },
16327 .init_verbs = { alc861_uniwill_m31_init_verbs },
16328 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16329 .dac_nids = alc861_dac_nids,
16330 .dig_out_nid = ALC861_DIGOUT_NID,
16331 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16332 .channel_mode = alc861_uniwill_m31_modes,
16334 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16335 .adc_nids = alc861_adc_nids,
16336 .input_mux = &alc861_capture_source,
16338 [ALC861_TOSHIBA] = {
16339 .mixers = { alc861_toshiba_mixer },
16340 .init_verbs = { alc861_base_init_verbs,
16341 alc861_toshiba_init_verbs },
16342 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16343 .dac_nids = alc861_dac_nids,
16344 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16345 .channel_mode = alc883_3ST_2ch_modes,
16346 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16347 .adc_nids = alc861_adc_nids,
16348 .input_mux = &alc861_capture_source,
16349 .unsol_event = alc861_toshiba_unsol_event,
16350 .init_hook = alc861_toshiba_automute,
16353 .mixers = { alc861_asus_mixer },
16354 .init_verbs = { alc861_asus_init_verbs },
16355 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16356 .dac_nids = alc861_dac_nids,
16357 .dig_out_nid = ALC861_DIGOUT_NID,
16358 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16359 .channel_mode = alc861_asus_modes,
16362 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16363 .adc_nids = alc861_adc_nids,
16364 .input_mux = &alc861_capture_source,
16366 [ALC861_ASUS_LAPTOP] = {
16367 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16368 .init_verbs = { alc861_asus_init_verbs,
16369 alc861_asus_laptop_init_verbs },
16370 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16371 .dac_nids = alc861_dac_nids,
16372 .dig_out_nid = ALC861_DIGOUT_NID,
16373 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16374 .channel_mode = alc883_3ST_2ch_modes,
16376 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16377 .adc_nids = alc861_adc_nids,
16378 .input_mux = &alc861_capture_source,
16382 /* Pin config fixes */
16384 PINFIX_FSC_AMILO_PI1505,
16387 static const struct alc_fixup alc861_fixups[] = {
16388 [PINFIX_FSC_AMILO_PI1505] = {
16389 .type = ALC_FIXUP_PINS,
16390 .v.pins = (const struct alc_pincfg[]) {
16391 { 0x0b, 0x0221101f }, /* HP */
16392 { 0x0f, 0x90170310 }, /* speaker */
16398 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16399 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16403 static int patch_alc861(struct hda_codec *codec)
16405 struct alc_spec *spec;
16409 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16413 codec->spec = spec;
16415 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16419 if (board_config < 0) {
16420 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16422 board_config = ALC861_AUTO;
16425 if (board_config == ALC861_AUTO) {
16426 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16427 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16430 if (board_config == ALC861_AUTO) {
16431 /* automatic parse from the BIOS config */
16432 err = alc861_parse_auto_config(codec);
16438 "hda_codec: Cannot set up configuration "
16439 "from BIOS. Using base mode...\n");
16440 board_config = ALC861_3ST_DIG;
16444 err = snd_hda_attach_beep_device(codec, 0x23);
16450 if (board_config != ALC861_AUTO)
16451 setup_preset(codec, &alc861_presets[board_config]);
16453 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16454 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16456 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16457 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16459 if (!spec->cap_mixer)
16460 set_capture_mixer(codec);
16461 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16463 spec->vmaster_nid = 0x03;
16465 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16467 codec->patch_ops = alc_patch_ops;
16468 if (board_config == ALC861_AUTO) {
16469 spec->init_hook = alc861_auto_init;
16470 #ifdef CONFIG_SND_HDA_POWER_SAVE
16471 spec->power_hook = alc_power_eapd;
16474 #ifdef CONFIG_SND_HDA_POWER_SAVE
16475 if (!spec->loopback.amplist)
16476 spec->loopback.amplist = alc861_loopbacks;
16483 * ALC861-VD support
16487 * In addition, an independent DAC
16489 #define ALC861VD_DIGOUT_NID 0x06
16491 static hda_nid_t alc861vd_dac_nids[4] = {
16492 /* front, surr, clfe, side surr */
16493 0x02, 0x03, 0x04, 0x05
16496 /* dac_nids for ALC660vd are in a different order - according to
16497 * Realtek's driver.
16498 * This should probably result in a different mixer for 6stack models
16499 * of ALC660vd codecs, but for now there is only 3stack mixer
16500 * - and it is the same as in 861vd.
16501 * adc_nids in ALC660vd are (is) the same as in 861vd
16503 static hda_nid_t alc660vd_dac_nids[3] = {
16504 /* front, rear, clfe, rear_surr */
16508 static hda_nid_t alc861vd_adc_nids[1] = {
16513 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16516 /* FIXME: should be a matrix-type input source selection */
16517 static struct hda_input_mux alc861vd_capture_source = {
16521 { "Front Mic", 0x1 },
16527 static struct hda_input_mux alc861vd_dallas_capture_source = {
16531 { "Internal Mic", 0x1 },
16535 static struct hda_input_mux alc861vd_hp_capture_source = {
16538 { "Front Mic", 0x0 },
16539 { "ATAPI Mic", 0x1 },
16546 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16553 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16554 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16555 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16556 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16557 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16564 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16565 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16566 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16567 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16568 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16572 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16573 { 6, alc861vd_6stack_ch6_init },
16574 { 8, alc861vd_6stack_ch8_init },
16577 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16579 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16580 .name = "Channel Mode",
16581 .info = alc_ch_mode_info,
16582 .get = alc_ch_mode_get,
16583 .put = alc_ch_mode_put,
16588 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16589 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16591 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16592 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16593 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16595 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16596 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16598 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16600 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16602 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16603 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16605 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16606 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16608 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16610 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16611 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16612 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16614 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16615 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16616 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16618 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16619 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16621 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16622 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16627 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16628 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16629 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16631 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16633 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16634 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16635 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16637 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16638 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16639 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16641 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16642 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16644 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16645 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16650 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16651 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16652 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16653 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16655 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16657 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16658 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16659 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16661 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16662 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16663 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16665 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16666 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16671 /* Pin assignment: Speaker=0x14, HP = 0x15,
16672 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16674 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16675 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16676 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16677 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16678 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16679 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16680 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16681 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16682 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16683 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16684 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16688 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16689 * Front Mic=0x18, ATAPI Mic = 0x19,
16691 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16692 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16693 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16694 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16695 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16696 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16697 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16698 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16699 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16705 * generic initialization of ADC, input mixers and output mixers
16707 static struct hda_verb alc861vd_volume_init_verbs[] = {
16709 * Unmute ADC0 and set the default input to mic-in
16711 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16712 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16714 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16715 * the analog-loopback mixer widget
16717 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16718 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16719 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16720 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16721 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16722 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16724 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16725 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16726 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16727 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16728 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16731 * Set up output mixers (0x02 - 0x05)
16733 /* set vol=0 to output mixers */
16734 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16735 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16736 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16737 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16739 /* set up input amps for analog loopback */
16740 /* Amp Indices: DAC = 0, mixer = 1 */
16741 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16743 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16744 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16745 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16746 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16747 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16748 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16754 * 3-stack pin configuration:
16755 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16757 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16759 * Set pin mode and muting
16761 /* set front pin widgets 0x14 for output */
16762 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16764 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16766 /* Mic (rear) pin: input vref at 80% */
16767 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16768 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16769 /* Front Mic pin: input vref at 80% */
16770 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16771 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16772 /* Line In pin: input */
16773 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16774 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16775 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16776 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16777 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16778 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16779 /* CD pin widget for input */
16780 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16786 * 6-stack pin configuration:
16788 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16790 * Set pin mode and muting
16792 /* set front pin widgets 0x14 for output */
16793 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16794 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16795 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16797 /* Rear Pin: output 1 (0x0d) */
16798 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16799 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16800 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16801 /* CLFE Pin: output 2 (0x0e) */
16802 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16803 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16804 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16805 /* Side Pin: output 3 (0x0f) */
16806 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16807 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16808 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16810 /* Mic (rear) pin: input vref at 80% */
16811 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16812 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16813 /* Front Mic pin: input vref at 80% */
16814 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16815 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16816 /* Line In pin: input */
16817 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16818 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16819 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16820 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16821 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16822 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16823 /* CD pin widget for input */
16824 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16829 static struct hda_verb alc861vd_eapd_verbs[] = {
16830 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16834 static struct hda_verb alc660vd_eapd_verbs[] = {
16835 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16836 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16840 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16843 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16844 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16845 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16849 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16851 struct alc_spec *spec = codec->spec;
16852 spec->autocfg.hp_pins[0] = 0x1b;
16853 spec->autocfg.speaker_pins[0] = 0x14;
16856 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16858 alc_automute_amp(codec);
16859 alc88x_simple_mic_automute(codec);
16862 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16865 switch (res >> 26) {
16866 case ALC880_MIC_EVENT:
16867 alc88x_simple_mic_automute(codec);
16870 alc_automute_amp_unsol_event(codec, res);
16875 static struct hda_verb alc861vd_dallas_verbs[] = {
16876 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16877 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16878 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16879 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16883 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16884 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16885 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16886 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16887 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16888 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16890 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16891 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16892 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16893 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16894 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16895 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16896 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16897 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16899 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16900 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16901 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16902 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16903 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16904 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16905 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16906 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16908 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16909 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16910 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16913 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16914 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16915 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16920 /* toggle speaker-output according to the hp-jack state */
16921 static void alc861vd_dallas_setup(struct hda_codec *codec)
16923 struct alc_spec *spec = codec->spec;
16925 spec->autocfg.hp_pins[0] = 0x15;
16926 spec->autocfg.speaker_pins[0] = 0x14;
16929 #ifdef CONFIG_SND_HDA_POWER_SAVE
16930 #define alc861vd_loopbacks alc880_loopbacks
16933 /* pcm configuration: identical with ALC880 */
16934 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16935 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16936 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16937 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16940 * configuration and preset
16942 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16943 [ALC660VD_3ST] = "3stack-660",
16944 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16945 [ALC660VD_ASUS_V1S] = "asus-v1s",
16946 [ALC861VD_3ST] = "3stack",
16947 [ALC861VD_3ST_DIG] = "3stack-digout",
16948 [ALC861VD_6ST_DIG] = "6stack-digout",
16949 [ALC861VD_LENOVO] = "lenovo",
16950 [ALC861VD_DALLAS] = "dallas",
16951 [ALC861VD_HP] = "hp",
16952 [ALC861VD_AUTO] = "auto",
16955 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16956 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16957 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16958 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16959 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16960 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16961 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16962 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16963 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16964 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16965 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16966 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16967 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16968 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16969 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16970 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16974 static struct alc_config_preset alc861vd_presets[] = {
16976 .mixers = { alc861vd_3st_mixer },
16977 .init_verbs = { alc861vd_volume_init_verbs,
16978 alc861vd_3stack_init_verbs },
16979 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16980 .dac_nids = alc660vd_dac_nids,
16981 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16982 .channel_mode = alc861vd_3stack_2ch_modes,
16983 .input_mux = &alc861vd_capture_source,
16985 [ALC660VD_3ST_DIG] = {
16986 .mixers = { alc861vd_3st_mixer },
16987 .init_verbs = { alc861vd_volume_init_verbs,
16988 alc861vd_3stack_init_verbs },
16989 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16990 .dac_nids = alc660vd_dac_nids,
16991 .dig_out_nid = ALC861VD_DIGOUT_NID,
16992 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16993 .channel_mode = alc861vd_3stack_2ch_modes,
16994 .input_mux = &alc861vd_capture_source,
16997 .mixers = { alc861vd_3st_mixer },
16998 .init_verbs = { alc861vd_volume_init_verbs,
16999 alc861vd_3stack_init_verbs },
17000 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17001 .dac_nids = alc861vd_dac_nids,
17002 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17003 .channel_mode = alc861vd_3stack_2ch_modes,
17004 .input_mux = &alc861vd_capture_source,
17006 [ALC861VD_3ST_DIG] = {
17007 .mixers = { alc861vd_3st_mixer },
17008 .init_verbs = { alc861vd_volume_init_verbs,
17009 alc861vd_3stack_init_verbs },
17010 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17011 .dac_nids = alc861vd_dac_nids,
17012 .dig_out_nid = ALC861VD_DIGOUT_NID,
17013 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17014 .channel_mode = alc861vd_3stack_2ch_modes,
17015 .input_mux = &alc861vd_capture_source,
17017 [ALC861VD_6ST_DIG] = {
17018 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
17019 .init_verbs = { alc861vd_volume_init_verbs,
17020 alc861vd_6stack_init_verbs },
17021 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17022 .dac_nids = alc861vd_dac_nids,
17023 .dig_out_nid = ALC861VD_DIGOUT_NID,
17024 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
17025 .channel_mode = alc861vd_6stack_modes,
17026 .input_mux = &alc861vd_capture_source,
17028 [ALC861VD_LENOVO] = {
17029 .mixers = { alc861vd_lenovo_mixer },
17030 .init_verbs = { alc861vd_volume_init_verbs,
17031 alc861vd_3stack_init_verbs,
17032 alc861vd_eapd_verbs,
17033 alc861vd_lenovo_unsol_verbs },
17034 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17035 .dac_nids = alc660vd_dac_nids,
17036 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17037 .channel_mode = alc861vd_3stack_2ch_modes,
17038 .input_mux = &alc861vd_capture_source,
17039 .unsol_event = alc861vd_lenovo_unsol_event,
17040 .setup = alc861vd_lenovo_setup,
17041 .init_hook = alc861vd_lenovo_init_hook,
17043 [ALC861VD_DALLAS] = {
17044 .mixers = { alc861vd_dallas_mixer },
17045 .init_verbs = { alc861vd_dallas_verbs },
17046 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17047 .dac_nids = alc861vd_dac_nids,
17048 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17049 .channel_mode = alc861vd_3stack_2ch_modes,
17050 .input_mux = &alc861vd_dallas_capture_source,
17051 .unsol_event = alc_automute_amp_unsol_event,
17052 .setup = alc861vd_dallas_setup,
17053 .init_hook = alc_automute_amp,
17056 .mixers = { alc861vd_hp_mixer },
17057 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
17058 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17059 .dac_nids = alc861vd_dac_nids,
17060 .dig_out_nid = ALC861VD_DIGOUT_NID,
17061 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17062 .channel_mode = alc861vd_3stack_2ch_modes,
17063 .input_mux = &alc861vd_hp_capture_source,
17064 .unsol_event = alc_automute_amp_unsol_event,
17065 .setup = alc861vd_dallas_setup,
17066 .init_hook = alc_automute_amp,
17068 [ALC660VD_ASUS_V1S] = {
17069 .mixers = { alc861vd_lenovo_mixer },
17070 .init_verbs = { alc861vd_volume_init_verbs,
17071 alc861vd_3stack_init_verbs,
17072 alc861vd_eapd_verbs,
17073 alc861vd_lenovo_unsol_verbs },
17074 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17075 .dac_nids = alc660vd_dac_nids,
17076 .dig_out_nid = ALC861VD_DIGOUT_NID,
17077 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17078 .channel_mode = alc861vd_3stack_2ch_modes,
17079 .input_mux = &alc861vd_capture_source,
17080 .unsol_event = alc861vd_lenovo_unsol_event,
17081 .setup = alc861vd_lenovo_setup,
17082 .init_hook = alc861vd_lenovo_init_hook,
17087 * BIOS auto configuration
17089 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
17090 const struct auto_pin_cfg *cfg)
17092 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
17096 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
17097 hda_nid_t nid, int pin_type, int dac_idx)
17099 alc_set_pin_output(codec, nid, pin_type);
17102 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
17104 struct alc_spec *spec = codec->spec;
17107 for (i = 0; i <= HDA_SIDE; i++) {
17108 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17109 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17111 alc861vd_auto_set_output_and_unmute(codec, nid,
17117 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
17119 struct alc_spec *spec = codec->spec;
17122 pin = spec->autocfg.hp_pins[0];
17123 if (pin) /* connect to front and use dac 0 */
17124 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17125 pin = spec->autocfg.speaker_pins[0];
17127 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17130 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17132 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17134 struct alc_spec *spec = codec->spec;
17135 struct auto_pin_cfg *cfg = &spec->autocfg;
17138 for (i = 0; i < cfg->num_inputs; i++) {
17139 hda_nid_t nid = cfg->inputs[i].pin;
17140 if (alc_is_input_pin(codec, nid)) {
17141 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17142 if (nid != ALC861VD_PIN_CD_NID &&
17143 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17144 snd_hda_codec_write(codec, nid, 0,
17145 AC_VERB_SET_AMP_GAIN_MUTE,
17151 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17153 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17154 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17156 /* add playback controls from the parsed DAC table */
17157 /* Based on ALC880 version. But ALC861VD has separate,
17158 * different NIDs for mute/unmute switch and volume control */
17159 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17160 const struct auto_pin_cfg *cfg)
17162 static const char * const chname[4] = {
17163 "Front", "Surround", "CLFE", "Side"
17165 const char *pfx = alc_get_line_out_pfx(cfg, true);
17166 hda_nid_t nid_v, nid_s;
17169 for (i = 0; i < cfg->line_outs; i++) {
17170 if (!spec->multiout.dac_nids[i])
17172 nid_v = alc861vd_idx_to_mixer_vol(
17174 spec->multiout.dac_nids[i]));
17175 nid_s = alc861vd_idx_to_mixer_switch(
17177 spec->multiout.dac_nids[i]));
17179 if (!pfx && i == 2) {
17181 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17183 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17187 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17189 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17193 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17195 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17199 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17201 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17206 const char *name = pfx;
17209 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17211 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17215 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17217 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17226 /* add playback controls for speaker and HP outputs */
17227 /* Based on ALC880 version. But ALC861VD has separate,
17228 * different NIDs for mute/unmute switch and volume control */
17229 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17230 hda_nid_t pin, const char *pfx)
17232 hda_nid_t nid_v, nid_s;
17238 if (alc880_is_fixed_pin(pin)) {
17239 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17240 /* specify the DAC as the extra output */
17241 if (!spec->multiout.hp_nid)
17242 spec->multiout.hp_nid = nid_v;
17244 spec->multiout.extra_out_nid[0] = nid_v;
17245 /* control HP volume/switch on the output mixer amp */
17246 nid_v = alc861vd_idx_to_mixer_vol(
17247 alc880_fixed_pin_idx(pin));
17248 nid_s = alc861vd_idx_to_mixer_switch(
17249 alc880_fixed_pin_idx(pin));
17251 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17252 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17255 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17256 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17259 } else if (alc880_is_multi_pin(pin)) {
17260 /* set manual connection */
17261 /* we have only a switch on HP-out PIN */
17262 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17263 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17270 /* parse the BIOS configuration and set up the alc_spec
17271 * return 1 if successful, 0 if the proper config is not found,
17272 * or a negative error code
17273 * Based on ALC880 version - had to change it to override
17274 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17275 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17277 struct alc_spec *spec = codec->spec;
17279 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17281 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17285 if (!spec->autocfg.line_outs)
17286 return 0; /* can't find valid BIOS pin config */
17288 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17291 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17294 err = alc861vd_auto_create_extra_out(spec,
17295 spec->autocfg.speaker_pins[0],
17299 err = alc861vd_auto_create_extra_out(spec,
17300 spec->autocfg.hp_pins[0],
17304 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17308 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17310 alc_auto_parse_digital(codec);
17312 if (spec->kctls.list)
17313 add_mixer(spec, spec->kctls.list);
17315 add_verb(spec, alc861vd_volume_init_verbs);
17317 spec->num_mux_defs = 1;
17318 spec->input_mux = &spec->private_imux[0];
17320 err = alc_auto_add_mic_boost(codec);
17324 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17329 /* additional initialization for auto-configuration model */
17330 static void alc861vd_auto_init(struct hda_codec *codec)
17332 struct alc_spec *spec = codec->spec;
17333 alc861vd_auto_init_multi_out(codec);
17334 alc861vd_auto_init_hp_out(codec);
17335 alc861vd_auto_init_analog_input(codec);
17336 alc861vd_auto_init_input_src(codec);
17337 alc_auto_init_digital(codec);
17338 if (spec->unsol_event)
17339 alc_inithook(codec);
17343 ALC660VD_FIX_ASUS_GPIO1
17347 static const struct alc_fixup alc861vd_fixups[] = {
17348 [ALC660VD_FIX_ASUS_GPIO1] = {
17349 .type = ALC_FIXUP_VERBS,
17350 .v.verbs = (const struct hda_verb[]) {
17351 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17352 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17353 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17359 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17360 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17364 static int patch_alc861vd(struct hda_codec *codec)
17366 struct alc_spec *spec;
17367 int err, board_config;
17369 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17373 codec->spec = spec;
17375 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17379 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17380 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17382 board_config = ALC861VD_AUTO;
17385 if (board_config == ALC861VD_AUTO) {
17386 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17387 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17390 if (board_config == ALC861VD_AUTO) {
17391 /* automatic parse from the BIOS config */
17392 err = alc861vd_parse_auto_config(codec);
17398 "hda_codec: Cannot set up configuration "
17399 "from BIOS. Using base mode...\n");
17400 board_config = ALC861VD_3ST;
17404 err = snd_hda_attach_beep_device(codec, 0x23);
17410 if (board_config != ALC861VD_AUTO)
17411 setup_preset(codec, &alc861vd_presets[board_config]);
17413 if (codec->vendor_id == 0x10ec0660) {
17414 /* always turn on EAPD */
17415 add_verb(spec, alc660vd_eapd_verbs);
17418 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17419 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17421 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17422 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17424 if (!spec->adc_nids) {
17425 spec->adc_nids = alc861vd_adc_nids;
17426 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17428 if (!spec->capsrc_nids)
17429 spec->capsrc_nids = alc861vd_capsrc_nids;
17431 set_capture_mixer(codec);
17432 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17434 spec->vmaster_nid = 0x02;
17436 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17438 codec->patch_ops = alc_patch_ops;
17440 if (board_config == ALC861VD_AUTO)
17441 spec->init_hook = alc861vd_auto_init;
17442 #ifdef CONFIG_SND_HDA_POWER_SAVE
17443 if (!spec->loopback.amplist)
17444 spec->loopback.amplist = alc861vd_loopbacks;
17453 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17454 * configuration. Each pin widget can choose any input DACs and a mixer.
17455 * Each ADC is connected from a mixer of all inputs. This makes possible
17456 * 6-channel independent captures.
17458 * In addition, an independent DAC for the multi-playback (not used in this
17461 #define ALC662_DIGOUT_NID 0x06
17462 #define ALC662_DIGIN_NID 0x0a
17464 static hda_nid_t alc662_dac_nids[4] = {
17465 /* front, rear, clfe, rear_surr */
17469 static hda_nid_t alc272_dac_nids[2] = {
17473 static hda_nid_t alc662_adc_nids[2] = {
17478 static hda_nid_t alc272_adc_nids[1] = {
17483 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17484 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17488 /* FIXME: should be a matrix-type input source selection */
17489 static struct hda_input_mux alc662_capture_source = {
17493 { "Front Mic", 0x1 },
17499 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17507 static struct hda_input_mux alc663_capture_source = {
17511 { "Front Mic", 0x1 },
17516 #if 0 /* set to 1 for testing other input sources below */
17517 static struct hda_input_mux alc272_nc10_capture_source = {
17520 { "Autoselect Mic", 0x0 },
17521 { "Internal Mic", 0x1 },
17522 { "In-0x02", 0x2 },
17523 { "In-0x03", 0x3 },
17524 { "In-0x04", 0x4 },
17525 { "In-0x05", 0x5 },
17526 { "In-0x06", 0x6 },
17527 { "In-0x07", 0x7 },
17528 { "In-0x08", 0x8 },
17529 { "In-0x09", 0x9 },
17530 { "In-0x0a", 0x0a },
17531 { "In-0x0b", 0x0b },
17532 { "In-0x0c", 0x0c },
17533 { "In-0x0d", 0x0d },
17534 { "In-0x0e", 0x0e },
17535 { "In-0x0f", 0x0f },
17543 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17550 static struct hda_verb alc662_3ST_ch2_init[] = {
17551 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17552 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17553 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17554 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17561 static struct hda_verb alc662_3ST_ch6_init[] = {
17562 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17563 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17564 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17565 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17566 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17567 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17571 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17572 { 2, alc662_3ST_ch2_init },
17573 { 6, alc662_3ST_ch6_init },
17579 static struct hda_verb alc662_sixstack_ch6_init[] = {
17580 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17581 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17582 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17589 static struct hda_verb alc662_sixstack_ch8_init[] = {
17590 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17591 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17592 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17596 static struct hda_channel_mode alc662_5stack_modes[2] = {
17597 { 2, alc662_sixstack_ch6_init },
17598 { 6, alc662_sixstack_ch8_init },
17601 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17602 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17605 static struct snd_kcontrol_new alc662_base_mixer[] = {
17606 /* output mixer control */
17607 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17608 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17609 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17610 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17611 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17612 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17613 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17614 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17615 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17617 /*Input mixer control */
17618 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17619 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17620 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17621 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17622 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17623 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17624 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17625 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17629 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17630 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17631 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17632 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17633 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17634 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17635 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17636 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17637 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17639 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17640 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17644 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17645 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17646 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17647 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17648 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17649 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17650 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17651 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17652 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17653 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17654 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17655 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17656 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17657 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17658 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17659 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17660 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17661 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17665 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17666 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17667 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17668 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17669 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17670 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17671 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17672 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17673 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17674 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17678 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17679 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17680 ALC262_HIPPO_MASTER_SWITCH,
17682 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17683 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17684 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17686 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17687 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17688 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17692 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17693 ALC262_HIPPO_MASTER_SWITCH,
17694 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17695 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17696 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17697 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17698 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17699 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17700 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17701 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17702 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17706 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17707 .ops = &snd_hda_bind_vol,
17709 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17710 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17715 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17716 .ops = &snd_hda_bind_sw,
17718 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17719 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17724 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17725 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17726 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17727 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17728 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17732 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17733 .ops = &snd_hda_bind_sw,
17735 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17736 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17737 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17742 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17743 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17744 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17745 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17746 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17747 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17748 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17753 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17754 .ops = &snd_hda_bind_sw,
17756 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17757 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17758 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17763 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17764 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17765 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17766 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17767 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17768 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17769 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17773 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17774 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17775 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17776 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17778 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17779 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17780 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17784 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17785 .ops = &snd_hda_bind_vol,
17787 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17788 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17793 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17794 .ops = &snd_hda_bind_sw,
17796 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17797 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17802 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17803 HDA_BIND_VOL("Master Playback Volume",
17804 &alc663_asus_two_bind_master_vol),
17805 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17806 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17807 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17809 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17813 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17814 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17815 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17816 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17817 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17819 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17823 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17824 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17825 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17826 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17827 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17828 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17830 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17831 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17832 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17833 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17837 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17838 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17839 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17840 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17843 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17844 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17845 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17846 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17847 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17851 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17852 .ops = &snd_hda_bind_sw,
17854 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17855 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17856 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17857 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17858 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17863 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17864 .ops = &snd_hda_bind_sw,
17866 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17867 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17872 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17873 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17874 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17875 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17876 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17877 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17878 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17879 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17880 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17881 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17885 static struct snd_kcontrol_new alc663_mode8_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", 0x15, 0x0, HDA_OUTPUT),
17890 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17897 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17899 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17900 .name = "Channel Mode",
17901 .info = alc_ch_mode_info,
17902 .get = alc_ch_mode_get,
17903 .put = alc_ch_mode_put,
17908 static struct hda_verb alc662_init_verbs[] = {
17909 /* ADC: mute amp left and right */
17910 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17911 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17913 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17914 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17915 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17916 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17917 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17918 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17920 /* Front Pin: output 0 (0x0c) */
17921 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17922 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17924 /* Rear Pin: output 1 (0x0d) */
17925 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17926 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17928 /* CLFE Pin: output 2 (0x0e) */
17929 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17930 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17932 /* Mic (rear) pin: input vref at 80% */
17933 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17934 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17935 /* Front Mic pin: input vref at 80% */
17936 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17937 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17938 /* Line In pin: input */
17939 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17940 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17941 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17942 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17943 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17944 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17945 /* CD pin widget for input */
17946 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17948 /* FIXME: use matrix-type input source selection */
17949 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17951 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17952 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17954 /* always trun on EAPD */
17955 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17956 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17961 static struct hda_verb alc663_init_verbs[] = {
17962 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17963 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17964 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17965 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17966 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17967 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17971 static struct hda_verb alc272_init_verbs[] = {
17972 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17973 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17974 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17975 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17976 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17977 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17978 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17979 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17983 static struct hda_verb alc662_sue_init_verbs[] = {
17984 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17985 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17989 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17990 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17991 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17995 /* Set Unsolicited Event*/
17996 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17997 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17998 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18002 static struct hda_verb alc663_m51va_init_verbs[] = {
18003 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18004 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18005 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18006 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18007 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18008 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18010 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18011 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18015 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
18016 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18017 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18018 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18019 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18021 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18022 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18026 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
18027 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18028 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18029 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18030 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18031 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18033 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18034 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18038 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
18039 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18040 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18041 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18042 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18043 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18044 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18045 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18049 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
18050 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18051 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18052 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18053 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18054 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18056 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18057 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18059 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18060 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18061 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18065 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
18066 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18067 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18068 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18069 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18070 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18071 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18072 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18073 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18074 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18075 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18076 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18077 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18081 static struct hda_verb alc663_g71v_init_verbs[] = {
18082 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18083 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18084 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
18086 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18087 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18088 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18090 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18091 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
18092 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18096 static struct hda_verb alc663_g50v_init_verbs[] = {
18097 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18098 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18099 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18101 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18102 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18106 static struct hda_verb alc662_ecs_init_verbs[] = {
18107 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
18108 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18109 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18110 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18114 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
18115 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18116 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18117 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18118 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18119 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18120 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18121 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18122 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18123 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18124 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18125 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18129 static struct hda_verb alc272_dell_init_verbs[] = {
18130 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18131 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18132 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18133 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18134 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18135 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18136 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18137 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18138 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18139 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18140 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18144 static struct hda_verb alc663_mode7_init_verbs[] = {
18145 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18146 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18147 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18148 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18149 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18150 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18151 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18152 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18153 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18154 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18155 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18156 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18157 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18158 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18159 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18163 static struct hda_verb alc663_mode8_init_verbs[] = {
18164 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18165 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18166 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18167 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18168 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18169 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18170 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18171 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18172 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18173 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18174 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18175 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18177 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18178 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18179 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18183 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18184 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18185 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18189 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18190 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18191 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18195 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18197 unsigned int present;
18198 unsigned char bits;
18200 present = snd_hda_jack_detect(codec, 0x14);
18201 bits = present ? HDA_AMP_MUTE : 0;
18203 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18204 HDA_AMP_MUTE, bits);
18207 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18209 unsigned int present;
18210 unsigned char bits;
18212 present = snd_hda_jack_detect(codec, 0x1b);
18213 bits = present ? HDA_AMP_MUTE : 0;
18215 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18216 HDA_AMP_MUTE, bits);
18217 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18218 HDA_AMP_MUTE, bits);
18221 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18224 if ((res >> 26) == ALC880_HP_EVENT)
18225 alc662_lenovo_101e_all_automute(codec);
18226 if ((res >> 26) == ALC880_FRONT_EVENT)
18227 alc662_lenovo_101e_ispeaker_automute(codec);
18230 /* unsolicited event for HP jack sensing */
18231 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18234 if ((res >> 26) == ALC880_MIC_EVENT)
18235 alc_mic_automute(codec);
18237 alc262_hippo_unsol_event(codec, res);
18240 static void alc662_eeepc_setup(struct hda_codec *codec)
18242 struct alc_spec *spec = codec->spec;
18244 alc262_hippo1_setup(codec);
18245 spec->ext_mic.pin = 0x18;
18246 spec->ext_mic.mux_idx = 0;
18247 spec->int_mic.pin = 0x19;
18248 spec->int_mic.mux_idx = 1;
18249 spec->auto_mic = 1;
18252 static void alc662_eeepc_inithook(struct hda_codec *codec)
18254 alc262_hippo_automute(codec);
18255 alc_mic_automute(codec);
18258 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18260 struct alc_spec *spec = codec->spec;
18262 spec->autocfg.hp_pins[0] = 0x14;
18263 spec->autocfg.speaker_pins[0] = 0x1b;
18266 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18268 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18270 unsigned int present;
18271 unsigned char bits;
18273 present = snd_hda_jack_detect(codec, 0x21);
18274 bits = present ? HDA_AMP_MUTE : 0;
18275 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18276 HDA_AMP_MUTE, bits);
18277 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18278 HDA_AMP_MUTE, bits);
18281 static void alc663_21jd_two_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);
18292 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18293 HDA_AMP_MUTE, bits);
18294 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18295 HDA_AMP_MUTE, bits);
18298 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18300 unsigned int present;
18301 unsigned char bits;
18303 present = snd_hda_jack_detect(codec, 0x15);
18304 bits = present ? HDA_AMP_MUTE : 0;
18305 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18306 HDA_AMP_MUTE, bits);
18307 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18308 HDA_AMP_MUTE, bits);
18309 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18310 HDA_AMP_MUTE, bits);
18311 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18312 HDA_AMP_MUTE, bits);
18315 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18317 unsigned int present;
18318 unsigned char bits;
18320 present = snd_hda_jack_detect(codec, 0x1b);
18321 bits = present ? 0 : PIN_OUT;
18322 snd_hda_codec_write(codec, 0x14, 0,
18323 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18326 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18328 unsigned int present1, present2;
18330 present1 = snd_hda_jack_detect(codec, 0x21);
18331 present2 = snd_hda_jack_detect(codec, 0x15);
18333 if (present1 || present2) {
18334 snd_hda_codec_write_cache(codec, 0x14, 0,
18335 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18337 snd_hda_codec_write_cache(codec, 0x14, 0,
18338 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18342 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18344 unsigned int present1, present2;
18346 present1 = snd_hda_jack_detect(codec, 0x1b);
18347 present2 = snd_hda_jack_detect(codec, 0x15);
18349 if (present1 || present2) {
18350 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18351 HDA_AMP_MUTE, HDA_AMP_MUTE);
18352 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18353 HDA_AMP_MUTE, HDA_AMP_MUTE);
18355 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18357 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18362 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18364 unsigned int present1, present2;
18366 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18367 AC_VERB_GET_PIN_SENSE, 0)
18368 & AC_PINSENSE_PRESENCE;
18369 present2 = snd_hda_codec_read(codec, 0x21, 0,
18370 AC_VERB_GET_PIN_SENSE, 0)
18371 & AC_PINSENSE_PRESENCE;
18373 if (present1 || present2) {
18374 snd_hda_codec_write_cache(codec, 0x14, 0,
18375 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18376 snd_hda_codec_write_cache(codec, 0x17, 0,
18377 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18379 snd_hda_codec_write_cache(codec, 0x14, 0,
18380 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18381 snd_hda_codec_write_cache(codec, 0x17, 0,
18382 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18386 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18388 unsigned int present1, present2;
18390 present1 = snd_hda_codec_read(codec, 0x21, 0,
18391 AC_VERB_GET_PIN_SENSE, 0)
18392 & AC_PINSENSE_PRESENCE;
18393 present2 = snd_hda_codec_read(codec, 0x15, 0,
18394 AC_VERB_GET_PIN_SENSE, 0)
18395 & AC_PINSENSE_PRESENCE;
18397 if (present1 || present2) {
18398 snd_hda_codec_write_cache(codec, 0x14, 0,
18399 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18400 snd_hda_codec_write_cache(codec, 0x17, 0,
18401 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18403 snd_hda_codec_write_cache(codec, 0x14, 0,
18404 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18405 snd_hda_codec_write_cache(codec, 0x17, 0,
18406 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18410 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18413 switch (res >> 26) {
18414 case ALC880_HP_EVENT:
18415 alc663_m51va_speaker_automute(codec);
18417 case ALC880_MIC_EVENT:
18418 alc_mic_automute(codec);
18423 static void alc663_m51va_setup(struct hda_codec *codec)
18425 struct alc_spec *spec = codec->spec;
18426 spec->ext_mic.pin = 0x18;
18427 spec->ext_mic.mux_idx = 0;
18428 spec->int_mic.pin = 0x12;
18429 spec->int_mic.mux_idx = 9;
18430 spec->auto_mic = 1;
18433 static void alc663_m51va_inithook(struct hda_codec *codec)
18435 alc663_m51va_speaker_automute(codec);
18436 alc_mic_automute(codec);
18439 /* ***************** Mode1 ******************************/
18440 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18442 static void alc663_mode1_setup(struct hda_codec *codec)
18444 struct alc_spec *spec = codec->spec;
18445 spec->ext_mic.pin = 0x18;
18446 spec->ext_mic.mux_idx = 0;
18447 spec->int_mic.pin = 0x19;
18448 spec->int_mic.mux_idx = 1;
18449 spec->auto_mic = 1;
18452 #define alc663_mode1_inithook alc663_m51va_inithook
18454 /* ***************** Mode2 ******************************/
18455 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18458 switch (res >> 26) {
18459 case ALC880_HP_EVENT:
18460 alc662_f5z_speaker_automute(codec);
18462 case ALC880_MIC_EVENT:
18463 alc_mic_automute(codec);
18468 #define alc662_mode2_setup alc663_mode1_setup
18470 static void alc662_mode2_inithook(struct hda_codec *codec)
18472 alc662_f5z_speaker_automute(codec);
18473 alc_mic_automute(codec);
18475 /* ***************** Mode3 ******************************/
18476 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18479 switch (res >> 26) {
18480 case ALC880_HP_EVENT:
18481 alc663_two_hp_m1_speaker_automute(codec);
18483 case ALC880_MIC_EVENT:
18484 alc_mic_automute(codec);
18489 #define alc663_mode3_setup alc663_mode1_setup
18491 static void alc663_mode3_inithook(struct hda_codec *codec)
18493 alc663_two_hp_m1_speaker_automute(codec);
18494 alc_mic_automute(codec);
18496 /* ***************** Mode4 ******************************/
18497 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18500 switch (res >> 26) {
18501 case ALC880_HP_EVENT:
18502 alc663_21jd_two_speaker_automute(codec);
18504 case ALC880_MIC_EVENT:
18505 alc_mic_automute(codec);
18510 #define alc663_mode4_setup alc663_mode1_setup
18512 static void alc663_mode4_inithook(struct hda_codec *codec)
18514 alc663_21jd_two_speaker_automute(codec);
18515 alc_mic_automute(codec);
18517 /* ***************** Mode5 ******************************/
18518 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18521 switch (res >> 26) {
18522 case ALC880_HP_EVENT:
18523 alc663_15jd_two_speaker_automute(codec);
18525 case ALC880_MIC_EVENT:
18526 alc_mic_automute(codec);
18531 #define alc663_mode5_setup alc663_mode1_setup
18533 static void alc663_mode5_inithook(struct hda_codec *codec)
18535 alc663_15jd_two_speaker_automute(codec);
18536 alc_mic_automute(codec);
18538 /* ***************** Mode6 ******************************/
18539 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18542 switch (res >> 26) {
18543 case ALC880_HP_EVENT:
18544 alc663_two_hp_m2_speaker_automute(codec);
18546 case ALC880_MIC_EVENT:
18547 alc_mic_automute(codec);
18552 #define alc663_mode6_setup alc663_mode1_setup
18554 static void alc663_mode6_inithook(struct hda_codec *codec)
18556 alc663_two_hp_m2_speaker_automute(codec);
18557 alc_mic_automute(codec);
18560 /* ***************** Mode7 ******************************/
18561 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18564 switch (res >> 26) {
18565 case ALC880_HP_EVENT:
18566 alc663_two_hp_m7_speaker_automute(codec);
18568 case ALC880_MIC_EVENT:
18569 alc_mic_automute(codec);
18574 #define alc663_mode7_setup alc663_mode1_setup
18576 static void alc663_mode7_inithook(struct hda_codec *codec)
18578 alc663_two_hp_m7_speaker_automute(codec);
18579 alc_mic_automute(codec);
18582 /* ***************** Mode8 ******************************/
18583 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18586 switch (res >> 26) {
18587 case ALC880_HP_EVENT:
18588 alc663_two_hp_m8_speaker_automute(codec);
18590 case ALC880_MIC_EVENT:
18591 alc_mic_automute(codec);
18596 #define alc663_mode8_setup alc663_m51va_setup
18598 static void alc663_mode8_inithook(struct hda_codec *codec)
18600 alc663_two_hp_m8_speaker_automute(codec);
18601 alc_mic_automute(codec);
18604 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18606 unsigned int present;
18607 unsigned char bits;
18609 present = snd_hda_jack_detect(codec, 0x21);
18610 bits = present ? HDA_AMP_MUTE : 0;
18611 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18612 HDA_AMP_MUTE, bits);
18613 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18614 HDA_AMP_MUTE, bits);
18617 static void alc663_g71v_front_automute(struct hda_codec *codec)
18619 unsigned int present;
18620 unsigned char bits;
18622 present = snd_hda_jack_detect(codec, 0x15);
18623 bits = present ? HDA_AMP_MUTE : 0;
18624 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18625 HDA_AMP_MUTE, bits);
18628 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18631 switch (res >> 26) {
18632 case ALC880_HP_EVENT:
18633 alc663_g71v_hp_automute(codec);
18635 case ALC880_FRONT_EVENT:
18636 alc663_g71v_front_automute(codec);
18638 case ALC880_MIC_EVENT:
18639 alc_mic_automute(codec);
18644 #define alc663_g71v_setup alc663_m51va_setup
18646 static void alc663_g71v_inithook(struct hda_codec *codec)
18648 alc663_g71v_front_automute(codec);
18649 alc663_g71v_hp_automute(codec);
18650 alc_mic_automute(codec);
18653 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18656 switch (res >> 26) {
18657 case ALC880_HP_EVENT:
18658 alc663_m51va_speaker_automute(codec);
18660 case ALC880_MIC_EVENT:
18661 alc_mic_automute(codec);
18666 #define alc663_g50v_setup alc663_m51va_setup
18668 static void alc663_g50v_inithook(struct hda_codec *codec)
18670 alc663_m51va_speaker_automute(codec);
18671 alc_mic_automute(codec);
18674 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18675 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18676 ALC262_HIPPO_MASTER_SWITCH,
18678 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18679 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18680 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18682 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18683 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18684 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18688 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18689 /* Master Playback automatically created from Speaker and Headphone */
18690 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18691 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18692 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18693 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18697 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18699 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18700 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18701 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18705 #ifdef CONFIG_SND_HDA_POWER_SAVE
18706 #define alc662_loopbacks alc880_loopbacks
18710 /* pcm configuration: identical with ALC880 */
18711 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18712 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18713 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18714 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18717 * configuration and preset
18719 static const char * const alc662_models[ALC662_MODEL_LAST] = {
18720 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18721 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18722 [ALC662_3ST_6ch] = "3stack-6ch",
18723 [ALC662_5ST_DIG] = "6stack-dig",
18724 [ALC662_LENOVO_101E] = "lenovo-101e",
18725 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18726 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18727 [ALC662_ECS] = "ecs",
18728 [ALC663_ASUS_M51VA] = "m51va",
18729 [ALC663_ASUS_G71V] = "g71v",
18730 [ALC663_ASUS_H13] = "h13",
18731 [ALC663_ASUS_G50V] = "g50v",
18732 [ALC663_ASUS_MODE1] = "asus-mode1",
18733 [ALC662_ASUS_MODE2] = "asus-mode2",
18734 [ALC663_ASUS_MODE3] = "asus-mode3",
18735 [ALC663_ASUS_MODE4] = "asus-mode4",
18736 [ALC663_ASUS_MODE5] = "asus-mode5",
18737 [ALC663_ASUS_MODE6] = "asus-mode6",
18738 [ALC663_ASUS_MODE7] = "asus-mode7",
18739 [ALC663_ASUS_MODE8] = "asus-mode8",
18740 [ALC272_DELL] = "dell",
18741 [ALC272_DELL_ZM1] = "dell-zm1",
18742 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18743 [ALC662_AUTO] = "auto",
18746 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18747 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18748 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18749 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18750 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18751 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18752 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18753 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18754 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18755 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18756 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18757 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18758 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18759 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18760 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18761 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18762 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18763 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18764 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18765 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18766 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18767 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18768 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18769 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18770 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18771 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18772 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18773 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18774 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18775 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18776 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18777 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18778 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18779 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18780 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18781 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18782 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18783 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18784 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18785 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18786 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18787 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18788 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18789 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18790 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18791 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18792 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18793 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18794 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18795 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18796 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18797 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18798 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18799 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18800 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18801 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18802 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18803 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18804 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18805 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18806 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18807 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18808 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18809 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18810 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18811 ALC662_3ST_6ch_DIG),
18812 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18813 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18814 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18815 ALC662_3ST_6ch_DIG),
18816 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18817 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18818 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18819 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18820 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18821 ALC662_3ST_6ch_DIG),
18822 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18824 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E),
18828 static struct alc_config_preset alc662_presets[] = {
18829 [ALC662_3ST_2ch_DIG] = {
18830 .mixers = { alc662_3ST_2ch_mixer },
18831 .init_verbs = { alc662_init_verbs },
18832 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18833 .dac_nids = alc662_dac_nids,
18834 .dig_out_nid = ALC662_DIGOUT_NID,
18835 .dig_in_nid = ALC662_DIGIN_NID,
18836 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18837 .channel_mode = alc662_3ST_2ch_modes,
18838 .input_mux = &alc662_capture_source,
18840 [ALC662_3ST_6ch_DIG] = {
18841 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18842 .init_verbs = { alc662_init_verbs },
18843 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18844 .dac_nids = alc662_dac_nids,
18845 .dig_out_nid = ALC662_DIGOUT_NID,
18846 .dig_in_nid = ALC662_DIGIN_NID,
18847 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18848 .channel_mode = alc662_3ST_6ch_modes,
18850 .input_mux = &alc662_capture_source,
18852 [ALC662_3ST_6ch] = {
18853 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18854 .init_verbs = { alc662_init_verbs },
18855 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18856 .dac_nids = alc662_dac_nids,
18857 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18858 .channel_mode = alc662_3ST_6ch_modes,
18860 .input_mux = &alc662_capture_source,
18862 [ALC662_5ST_DIG] = {
18863 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18864 .init_verbs = { alc662_init_verbs },
18865 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18866 .dac_nids = alc662_dac_nids,
18867 .dig_out_nid = ALC662_DIGOUT_NID,
18868 .dig_in_nid = ALC662_DIGIN_NID,
18869 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18870 .channel_mode = alc662_5stack_modes,
18871 .input_mux = &alc662_capture_source,
18873 [ALC662_LENOVO_101E] = {
18874 .mixers = { alc662_lenovo_101e_mixer },
18875 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18876 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18877 .dac_nids = alc662_dac_nids,
18878 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18879 .channel_mode = alc662_3ST_2ch_modes,
18880 .input_mux = &alc662_lenovo_101e_capture_source,
18881 .unsol_event = alc662_lenovo_101e_unsol_event,
18882 .init_hook = alc662_lenovo_101e_all_automute,
18884 [ALC662_ASUS_EEEPC_P701] = {
18885 .mixers = { alc662_eeepc_p701_mixer },
18886 .init_verbs = { alc662_init_verbs,
18887 alc662_eeepc_sue_init_verbs },
18888 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18889 .dac_nids = alc662_dac_nids,
18890 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18891 .channel_mode = alc662_3ST_2ch_modes,
18892 .unsol_event = alc662_eeepc_unsol_event,
18893 .setup = alc662_eeepc_setup,
18894 .init_hook = alc662_eeepc_inithook,
18896 [ALC662_ASUS_EEEPC_EP20] = {
18897 .mixers = { alc662_eeepc_ep20_mixer,
18898 alc662_chmode_mixer },
18899 .init_verbs = { alc662_init_verbs,
18900 alc662_eeepc_ep20_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_6ch_modes),
18904 .channel_mode = alc662_3ST_6ch_modes,
18905 .input_mux = &alc662_lenovo_101e_capture_source,
18906 .unsol_event = alc662_eeepc_unsol_event,
18907 .setup = alc662_eeepc_ep20_setup,
18908 .init_hook = alc662_eeepc_ep20_inithook,
18911 .mixers = { alc662_ecs_mixer },
18912 .init_verbs = { alc662_init_verbs,
18913 alc662_ecs_init_verbs },
18914 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18915 .dac_nids = alc662_dac_nids,
18916 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18917 .channel_mode = alc662_3ST_2ch_modes,
18918 .unsol_event = alc662_eeepc_unsol_event,
18919 .setup = alc662_eeepc_setup,
18920 .init_hook = alc662_eeepc_inithook,
18922 [ALC663_ASUS_M51VA] = {
18923 .mixers = { alc663_m51va_mixer },
18924 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18925 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18926 .dac_nids = alc662_dac_nids,
18927 .dig_out_nid = ALC662_DIGOUT_NID,
18928 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18929 .channel_mode = alc662_3ST_2ch_modes,
18930 .unsol_event = alc663_m51va_unsol_event,
18931 .setup = alc663_m51va_setup,
18932 .init_hook = alc663_m51va_inithook,
18934 [ALC663_ASUS_G71V] = {
18935 .mixers = { alc663_g71v_mixer },
18936 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18937 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18938 .dac_nids = alc662_dac_nids,
18939 .dig_out_nid = ALC662_DIGOUT_NID,
18940 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18941 .channel_mode = alc662_3ST_2ch_modes,
18942 .unsol_event = alc663_g71v_unsol_event,
18943 .setup = alc663_g71v_setup,
18944 .init_hook = alc663_g71v_inithook,
18946 [ALC663_ASUS_H13] = {
18947 .mixers = { alc663_m51va_mixer },
18948 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18949 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18950 .dac_nids = alc662_dac_nids,
18951 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18952 .channel_mode = alc662_3ST_2ch_modes,
18953 .unsol_event = alc663_m51va_unsol_event,
18954 .init_hook = alc663_m51va_inithook,
18956 [ALC663_ASUS_G50V] = {
18957 .mixers = { alc663_g50v_mixer },
18958 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18959 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18960 .dac_nids = alc662_dac_nids,
18961 .dig_out_nid = ALC662_DIGOUT_NID,
18962 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18963 .channel_mode = alc662_3ST_6ch_modes,
18964 .input_mux = &alc663_capture_source,
18965 .unsol_event = alc663_g50v_unsol_event,
18966 .setup = alc663_g50v_setup,
18967 .init_hook = alc663_g50v_inithook,
18969 [ALC663_ASUS_MODE1] = {
18970 .mixers = { alc663_m51va_mixer },
18971 .cap_mixer = alc662_auto_capture_mixer,
18972 .init_verbs = { alc662_init_verbs,
18973 alc663_21jd_amic_init_verbs },
18974 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18976 .dac_nids = alc662_dac_nids,
18977 .dig_out_nid = ALC662_DIGOUT_NID,
18978 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18979 .channel_mode = alc662_3ST_2ch_modes,
18980 .unsol_event = alc663_mode1_unsol_event,
18981 .setup = alc663_mode1_setup,
18982 .init_hook = alc663_mode1_inithook,
18984 [ALC662_ASUS_MODE2] = {
18985 .mixers = { alc662_1bjd_mixer },
18986 .cap_mixer = alc662_auto_capture_mixer,
18987 .init_verbs = { alc662_init_verbs,
18988 alc662_1bjd_amic_init_verbs },
18989 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18990 .dac_nids = alc662_dac_nids,
18991 .dig_out_nid = ALC662_DIGOUT_NID,
18992 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18993 .channel_mode = alc662_3ST_2ch_modes,
18994 .unsol_event = alc662_mode2_unsol_event,
18995 .setup = alc662_mode2_setup,
18996 .init_hook = alc662_mode2_inithook,
18998 [ALC663_ASUS_MODE3] = {
18999 .mixers = { alc663_two_hp_m1_mixer },
19000 .cap_mixer = alc662_auto_capture_mixer,
19001 .init_verbs = { alc662_init_verbs,
19002 alc663_two_hp_amic_m1_init_verbs },
19003 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19005 .dac_nids = alc662_dac_nids,
19006 .dig_out_nid = ALC662_DIGOUT_NID,
19007 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19008 .channel_mode = alc662_3ST_2ch_modes,
19009 .unsol_event = alc663_mode3_unsol_event,
19010 .setup = alc663_mode3_setup,
19011 .init_hook = alc663_mode3_inithook,
19013 [ALC663_ASUS_MODE4] = {
19014 .mixers = { alc663_asus_21jd_clfe_mixer },
19015 .cap_mixer = alc662_auto_capture_mixer,
19016 .init_verbs = { alc662_init_verbs,
19017 alc663_21jd_amic_init_verbs},
19018 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19020 .dac_nids = alc662_dac_nids,
19021 .dig_out_nid = ALC662_DIGOUT_NID,
19022 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19023 .channel_mode = alc662_3ST_2ch_modes,
19024 .unsol_event = alc663_mode4_unsol_event,
19025 .setup = alc663_mode4_setup,
19026 .init_hook = alc663_mode4_inithook,
19028 [ALC663_ASUS_MODE5] = {
19029 .mixers = { alc663_asus_15jd_clfe_mixer },
19030 .cap_mixer = alc662_auto_capture_mixer,
19031 .init_verbs = { alc662_init_verbs,
19032 alc663_15jd_amic_init_verbs },
19033 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19035 .dac_nids = alc662_dac_nids,
19036 .dig_out_nid = ALC662_DIGOUT_NID,
19037 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19038 .channel_mode = alc662_3ST_2ch_modes,
19039 .unsol_event = alc663_mode5_unsol_event,
19040 .setup = alc663_mode5_setup,
19041 .init_hook = alc663_mode5_inithook,
19043 [ALC663_ASUS_MODE6] = {
19044 .mixers = { alc663_two_hp_m2_mixer },
19045 .cap_mixer = alc662_auto_capture_mixer,
19046 .init_verbs = { alc662_init_verbs,
19047 alc663_two_hp_amic_m2_init_verbs },
19048 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19050 .dac_nids = alc662_dac_nids,
19051 .dig_out_nid = ALC662_DIGOUT_NID,
19052 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19053 .channel_mode = alc662_3ST_2ch_modes,
19054 .unsol_event = alc663_mode6_unsol_event,
19055 .setup = alc663_mode6_setup,
19056 .init_hook = alc663_mode6_inithook,
19058 [ALC663_ASUS_MODE7] = {
19059 .mixers = { alc663_mode7_mixer },
19060 .cap_mixer = alc662_auto_capture_mixer,
19061 .init_verbs = { alc662_init_verbs,
19062 alc663_mode7_init_verbs },
19063 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19065 .dac_nids = alc662_dac_nids,
19066 .dig_out_nid = ALC662_DIGOUT_NID,
19067 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19068 .channel_mode = alc662_3ST_2ch_modes,
19069 .unsol_event = alc663_mode7_unsol_event,
19070 .setup = alc663_mode7_setup,
19071 .init_hook = alc663_mode7_inithook,
19073 [ALC663_ASUS_MODE8] = {
19074 .mixers = { alc663_mode8_mixer },
19075 .cap_mixer = alc662_auto_capture_mixer,
19076 .init_verbs = { alc662_init_verbs,
19077 alc663_mode8_init_verbs },
19078 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19080 .dac_nids = alc662_dac_nids,
19081 .dig_out_nid = ALC662_DIGOUT_NID,
19082 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19083 .channel_mode = alc662_3ST_2ch_modes,
19084 .unsol_event = alc663_mode8_unsol_event,
19085 .setup = alc663_mode8_setup,
19086 .init_hook = alc663_mode8_inithook,
19089 .mixers = { alc663_m51va_mixer },
19090 .cap_mixer = alc272_auto_capture_mixer,
19091 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
19092 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19093 .dac_nids = alc662_dac_nids,
19094 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19095 .adc_nids = alc272_adc_nids,
19096 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
19097 .capsrc_nids = alc272_capsrc_nids,
19098 .channel_mode = alc662_3ST_2ch_modes,
19099 .unsol_event = alc663_m51va_unsol_event,
19100 .setup = alc663_m51va_setup,
19101 .init_hook = alc663_m51va_inithook,
19103 [ALC272_DELL_ZM1] = {
19104 .mixers = { alc663_m51va_mixer },
19105 .cap_mixer = alc662_auto_capture_mixer,
19106 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
19107 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19108 .dac_nids = alc662_dac_nids,
19109 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19110 .adc_nids = alc662_adc_nids,
19112 .capsrc_nids = alc662_capsrc_nids,
19113 .channel_mode = alc662_3ST_2ch_modes,
19114 .unsol_event = alc663_m51va_unsol_event,
19115 .setup = alc663_m51va_setup,
19116 .init_hook = alc663_m51va_inithook,
19118 [ALC272_SAMSUNG_NC10] = {
19119 .mixers = { alc272_nc10_mixer },
19120 .init_verbs = { alc662_init_verbs,
19121 alc663_21jd_amic_init_verbs },
19122 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19123 .dac_nids = alc272_dac_nids,
19124 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19125 .channel_mode = alc662_3ST_2ch_modes,
19126 /*.input_mux = &alc272_nc10_capture_source,*/
19127 .unsol_event = alc663_mode4_unsol_event,
19128 .setup = alc663_mode4_setup,
19129 .init_hook = alc663_mode4_inithook,
19135 * BIOS auto configuration
19138 /* convert from MIX nid to DAC */
19139 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19143 else if (nid >= 0x0c && nid <= 0x0e)
19144 return nid - 0x0c + 0x02;
19145 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19151 /* get MIX nid connected to the given pin targeted to DAC */
19152 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19158 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19159 for (i = 0; i < num; i++) {
19160 if (alc662_mix_to_dac(mix[i]) == dac)
19166 /* look for an empty DAC slot */
19167 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19169 struct alc_spec *spec = codec->spec;
19173 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19176 for (i = 0; i < num; i++) {
19177 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19180 for (j = 0; j < spec->multiout.num_dacs; j++)
19181 if (spec->multiout.dac_nids[j] == nid)
19183 if (j >= spec->multiout.num_dacs)
19189 /* fill in the dac_nids table from the parsed pin configuration */
19190 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19191 const struct auto_pin_cfg *cfg)
19193 struct alc_spec *spec = codec->spec;
19197 spec->multiout.dac_nids = spec->private_dac_nids;
19198 for (i = 0; i < cfg->line_outs; i++) {
19199 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19202 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19207 static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19208 hda_nid_t nid, int idx, unsigned int chs)
19210 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx,
19211 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19214 static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19215 hda_nid_t nid, int idx, unsigned int chs)
19217 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
19218 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19221 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19222 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19223 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19224 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19225 #define alc662_add_stereo_vol(spec, pfx, nid) \
19226 alc662_add_vol_ctl(spec, pfx, nid, 3)
19227 #define alc662_add_stereo_sw(spec, pfx, nid) \
19228 alc662_add_sw_ctl(spec, pfx, nid, 3)
19230 /* add playback controls from the parsed DAC table */
19231 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19232 const struct auto_pin_cfg *cfg)
19234 struct alc_spec *spec = codec->spec;
19235 static const char * const chname[4] = {
19236 "Front", "Surround", NULL /*CLFE*/, "Side"
19238 const char *pfx = alc_get_line_out_pfx(cfg, true);
19239 hda_nid_t nid, mix;
19242 for (i = 0; i < cfg->line_outs; i++) {
19243 nid = spec->multiout.dac_nids[i];
19246 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19249 if (!pfx && i == 2) {
19251 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19254 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19257 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19260 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19264 const char *name = pfx;
19267 err = __alc662_add_vol_ctl(spec, name, nid, i, 3);
19270 err = __alc662_add_sw_ctl(spec, name, mix, i, 3);
19278 /* add playback controls for speaker and HP outputs */
19279 /* return DAC nid if any new DAC is assigned */
19280 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19283 struct alc_spec *spec = codec->spec;
19284 hda_nid_t nid, mix;
19289 nid = alc662_look_for_dac(codec, pin);
19291 /* the corresponding DAC is already occupied */
19292 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19293 return 0; /* no way */
19294 /* create a switch only */
19295 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19296 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19299 mix = alc662_dac_to_mix(codec, pin, nid);
19302 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19305 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19311 /* create playback/capture controls for input pins */
19312 #define alc662_auto_create_input_ctls \
19313 alc882_auto_create_input_ctls
19315 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19316 hda_nid_t nid, int pin_type,
19320 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19322 alc_set_pin_output(codec, nid, pin_type);
19323 /* need the manual connection? */
19324 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19327 for (i = 0; i < num; i++) {
19328 if (alc662_mix_to_dac(srcs[i]) != dac)
19330 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19335 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19337 struct alc_spec *spec = codec->spec;
19338 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19341 for (i = 0; i <= HDA_SIDE; i++) {
19342 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19344 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19345 spec->multiout.dac_nids[i]);
19349 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19351 struct alc_spec *spec = codec->spec;
19354 pin = spec->autocfg.hp_pins[0];
19356 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19357 spec->multiout.hp_nid);
19358 pin = spec->autocfg.speaker_pins[0];
19360 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19361 spec->multiout.extra_out_nid[0]);
19364 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19366 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19368 struct alc_spec *spec = codec->spec;
19369 struct auto_pin_cfg *cfg = &spec->autocfg;
19372 for (i = 0; i < cfg->num_inputs; i++) {
19373 hda_nid_t nid = cfg->inputs[i].pin;
19374 if (alc_is_input_pin(codec, nid)) {
19375 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19376 if (nid != ALC662_PIN_CD_NID &&
19377 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19378 snd_hda_codec_write(codec, nid, 0,
19379 AC_VERB_SET_AMP_GAIN_MUTE,
19385 #define alc662_auto_init_input_src alc882_auto_init_input_src
19387 static int alc662_parse_auto_config(struct hda_codec *codec)
19389 struct alc_spec *spec = codec->spec;
19391 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19393 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19397 if (!spec->autocfg.line_outs)
19398 return 0; /* can't find valid BIOS pin config */
19400 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19403 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19406 err = alc662_auto_create_extra_out(codec,
19407 spec->autocfg.speaker_pins[0],
19412 spec->multiout.extra_out_nid[0] = err;
19413 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19418 spec->multiout.hp_nid = err;
19419 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19423 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19425 alc_auto_parse_digital(codec);
19427 if (spec->kctls.list)
19428 add_mixer(spec, spec->kctls.list);
19430 spec->num_mux_defs = 1;
19431 spec->input_mux = &spec->private_imux[0];
19433 add_verb(spec, alc662_init_verbs);
19434 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19435 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19436 add_verb(spec, alc663_init_verbs);
19438 if (codec->vendor_id == 0x10ec0272)
19439 add_verb(spec, alc272_init_verbs);
19441 err = alc_auto_add_mic_boost(codec);
19445 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19446 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19447 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19449 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19454 /* additional initialization for auto-configuration model */
19455 static void alc662_auto_init(struct hda_codec *codec)
19457 struct alc_spec *spec = codec->spec;
19458 alc662_auto_init_multi_out(codec);
19459 alc662_auto_init_hp_out(codec);
19460 alc662_auto_init_analog_input(codec);
19461 alc662_auto_init_input_src(codec);
19462 alc_auto_init_digital(codec);
19463 if (spec->unsol_event)
19464 alc_inithook(codec);
19467 static void alc272_fixup_mario(struct hda_codec *codec,
19468 const struct alc_fixup *fix, int action)
19470 if (action != ALC_FIXUP_ACT_PROBE)
19472 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19473 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19474 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19475 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19476 (0 << AC_AMPCAP_MUTE_SHIFT)))
19477 printk(KERN_WARNING
19478 "hda_codec: failed to override amp caps for NID 0x2\n");
19482 ALC662_FIXUP_ASPIRE,
19483 ALC662_FIXUP_IDEAPAD,
19484 ALC272_FIXUP_MARIO,
19485 ALC662_FIXUP_CZC_P10T,
19488 static const struct alc_fixup alc662_fixups[] = {
19489 [ALC662_FIXUP_ASPIRE] = {
19490 .type = ALC_FIXUP_PINS,
19491 .v.pins = (const struct alc_pincfg[]) {
19492 { 0x15, 0x99130112 }, /* subwoofer */
19496 [ALC662_FIXUP_IDEAPAD] = {
19497 .type = ALC_FIXUP_PINS,
19498 .v.pins = (const struct alc_pincfg[]) {
19499 { 0x17, 0x99130112 }, /* subwoofer */
19503 [ALC272_FIXUP_MARIO] = {
19504 .type = ALC_FIXUP_FUNC,
19505 .v.func = alc272_fixup_mario,
19507 [ALC662_FIXUP_CZC_P10T] = {
19508 .type = ALC_FIXUP_VERBS,
19509 .v.verbs = (const struct hda_verb[]) {
19510 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19516 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19517 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19518 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19519 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19520 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19521 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19522 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19526 static const struct alc_model_fixup alc662_fixup_models[] = {
19527 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19532 static int patch_alc662(struct hda_codec *codec)
19534 struct alc_spec *spec;
19535 int err, board_config;
19538 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19542 codec->spec = spec;
19544 alc_auto_parse_customize_define(codec);
19546 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19548 coef = alc_read_coef_idx(codec, 0);
19549 if (coef == 0x8020 || coef == 0x8011)
19550 alc_codec_rename(codec, "ALC661");
19551 else if (coef & (1 << 14) &&
19552 codec->bus->pci->subsystem_vendor == 0x1025 &&
19553 spec->cdefine.platform_type == 1)
19554 alc_codec_rename(codec, "ALC272X");
19555 else if (coef == 0x4011)
19556 alc_codec_rename(codec, "ALC656");
19558 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19561 if (board_config < 0) {
19562 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19564 board_config = ALC662_AUTO;
19567 if (board_config == ALC662_AUTO) {
19568 alc_pick_fixup(codec, alc662_fixup_models,
19569 alc662_fixup_tbl, alc662_fixups);
19570 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19571 /* automatic parse from the BIOS config */
19572 err = alc662_parse_auto_config(codec);
19578 "hda_codec: Cannot set up configuration "
19579 "from BIOS. Using base mode...\n");
19580 board_config = ALC662_3ST_2ch_DIG;
19584 if (has_cdefine_beep(codec)) {
19585 err = snd_hda_attach_beep_device(codec, 0x1);
19592 if (board_config != ALC662_AUTO)
19593 setup_preset(codec, &alc662_presets[board_config]);
19595 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19596 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19598 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19599 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19601 if (!spec->adc_nids) {
19602 spec->adc_nids = alc662_adc_nids;
19603 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19605 if (!spec->capsrc_nids)
19606 spec->capsrc_nids = alc662_capsrc_nids;
19608 if (!spec->cap_mixer)
19609 set_capture_mixer(codec);
19611 if (has_cdefine_beep(codec)) {
19612 switch (codec->vendor_id) {
19614 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19619 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19622 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19626 spec->vmaster_nid = 0x02;
19628 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19630 codec->patch_ops = alc_patch_ops;
19631 if (board_config == ALC662_AUTO)
19632 spec->init_hook = alc662_auto_init;
19634 alc_init_jacks(codec);
19636 #ifdef CONFIG_SND_HDA_POWER_SAVE
19637 if (!spec->loopback.amplist)
19638 spec->loopback.amplist = alc662_loopbacks;
19644 static int patch_alc888(struct hda_codec *codec)
19646 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19647 kfree(codec->chip_name);
19648 if (codec->vendor_id == 0x10ec0887)
19649 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19651 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19652 if (!codec->chip_name) {
19656 return patch_alc662(codec);
19658 return patch_alc882(codec);
19664 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19665 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19666 #define alc680_modes alc260_modes
19668 static hda_nid_t alc680_dac_nids[3] = {
19669 /* Lout1, Lout2, hp */
19673 static hda_nid_t alc680_adc_nids[3] = {
19675 /* DMIC, MIC, Line-in*/
19680 * Analog capture ADC cgange
19682 static void alc680_rec_autoswitch(struct hda_codec *codec)
19684 struct alc_spec *spec = codec->spec;
19685 struct auto_pin_cfg *cfg = &spec->autocfg;
19687 int type_found = AUTO_PIN_LAST;
19691 for (i = 0; i < cfg->num_inputs; i++) {
19692 nid = cfg->inputs[i].pin;
19693 if (!(snd_hda_query_pin_caps(codec, nid) &
19694 AC_PINCAP_PRES_DETECT))
19696 if (snd_hda_jack_detect(codec, nid)) {
19697 if (cfg->inputs[i].type < type_found) {
19698 type_found = cfg->inputs[i].type;
19706 snd_hda_get_connections(codec, pin_found, &nid, 1);
19708 if (nid != spec->cur_adc)
19709 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19710 spec->cur_adc = nid;
19711 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19712 spec->cur_adc_format);
19715 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19716 struct hda_codec *codec,
19717 unsigned int stream_tag,
19718 unsigned int format,
19719 struct snd_pcm_substream *substream)
19721 struct alc_spec *spec = codec->spec;
19723 spec->cur_adc = 0x07;
19724 spec->cur_adc_stream_tag = stream_tag;
19725 spec->cur_adc_format = format;
19727 alc680_rec_autoswitch(codec);
19731 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19732 struct hda_codec *codec,
19733 struct snd_pcm_substream *substream)
19735 snd_hda_codec_cleanup_stream(codec, 0x07);
19736 snd_hda_codec_cleanup_stream(codec, 0x08);
19737 snd_hda_codec_cleanup_stream(codec, 0x09);
19741 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19742 .substreams = 1, /* can be overridden */
19745 /* NID is set in alc_build_pcms */
19747 .prepare = alc680_capture_pcm_prepare,
19748 .cleanup = alc680_capture_pcm_cleanup
19752 static struct snd_kcontrol_new alc680_base_mixer[] = {
19753 /* output mixer control */
19754 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19755 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19756 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19757 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19758 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19759 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19760 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19764 static struct hda_bind_ctls alc680_bind_cap_vol = {
19765 .ops = &snd_hda_bind_vol,
19767 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19768 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19769 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19774 static struct hda_bind_ctls alc680_bind_cap_switch = {
19775 .ops = &snd_hda_bind_sw,
19777 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19778 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19779 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19784 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19785 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19786 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19791 * generic initialization of ADC, input mixers and output mixers
19793 static struct hda_verb alc680_init_verbs[] = {
19794 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19795 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19796 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19798 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19799 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19800 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19801 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19802 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19803 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19805 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19806 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19807 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19808 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19809 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19811 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19812 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19813 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19818 /* toggle speaker-output according to the hp-jack state */
19819 static void alc680_base_setup(struct hda_codec *codec)
19821 struct alc_spec *spec = codec->spec;
19823 spec->autocfg.hp_pins[0] = 0x16;
19824 spec->autocfg.speaker_pins[0] = 0x14;
19825 spec->autocfg.speaker_pins[1] = 0x15;
19826 spec->autocfg.num_inputs = 2;
19827 spec->autocfg.inputs[0].pin = 0x18;
19828 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19829 spec->autocfg.inputs[1].pin = 0x19;
19830 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19833 static void alc680_unsol_event(struct hda_codec *codec,
19836 if ((res >> 26) == ALC880_HP_EVENT)
19837 alc_automute_amp(codec);
19838 if ((res >> 26) == ALC880_MIC_EVENT)
19839 alc680_rec_autoswitch(codec);
19842 static void alc680_inithook(struct hda_codec *codec)
19844 alc_automute_amp(codec);
19845 alc680_rec_autoswitch(codec);
19848 /* create input playback/capture controls for the given pin */
19849 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19850 const char *ctlname, int idx)
19868 if (spec->multiout.dac_nids[0] != dac &&
19869 spec->multiout.dac_nids[1] != dac) {
19870 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19871 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19876 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19877 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19881 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19887 /* add playback controls from the parsed DAC table */
19888 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19889 const struct auto_pin_cfg *cfg)
19894 spec->multiout.dac_nids = spec->private_dac_nids;
19896 nid = cfg->line_out_pins[0];
19899 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19903 err = alc680_new_analog_output(spec, nid, name, 0);
19908 nid = cfg->speaker_pins[0];
19910 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19914 nid = cfg->hp_pins[0];
19916 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19924 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19925 hda_nid_t nid, int pin_type)
19927 alc_set_pin_output(codec, nid, pin_type);
19930 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19932 struct alc_spec *spec = codec->spec;
19933 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19935 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19936 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19940 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19942 struct alc_spec *spec = codec->spec;
19945 pin = spec->autocfg.hp_pins[0];
19947 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19948 pin = spec->autocfg.speaker_pins[0];
19950 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19953 /* pcm configuration: identical with ALC880 */
19954 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19955 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19956 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19957 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19958 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19961 * BIOS auto configuration
19963 static int alc680_parse_auto_config(struct hda_codec *codec)
19965 struct alc_spec *spec = codec->spec;
19967 static hda_nid_t alc680_ignore[] = { 0 };
19969 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19974 if (!spec->autocfg.line_outs) {
19975 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19976 spec->multiout.max_channels = 2;
19977 spec->no_analog = 1;
19980 return 0; /* can't find valid BIOS pin config */
19982 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19986 spec->multiout.max_channels = 2;
19989 /* digital only support output */
19990 alc_auto_parse_digital(codec);
19991 if (spec->kctls.list)
19992 add_mixer(spec, spec->kctls.list);
19994 add_verb(spec, alc680_init_verbs);
19996 err = alc_auto_add_mic_boost(codec);
20003 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
20005 /* init callback for auto-configuration model -- overriding the default init */
20006 static void alc680_auto_init(struct hda_codec *codec)
20008 struct alc_spec *spec = codec->spec;
20009 alc680_auto_init_multi_out(codec);
20010 alc680_auto_init_hp_out(codec);
20011 alc680_auto_init_analog_input(codec);
20012 alc_auto_init_digital(codec);
20013 if (spec->unsol_event)
20014 alc_inithook(codec);
20018 * configuration and preset
20020 static const char * const alc680_models[ALC680_MODEL_LAST] = {
20021 [ALC680_BASE] = "base",
20022 [ALC680_AUTO] = "auto",
20025 static struct snd_pci_quirk alc680_cfg_tbl[] = {
20026 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
20030 static struct alc_config_preset alc680_presets[] = {
20032 .mixers = { alc680_base_mixer },
20033 .cap_mixer = alc680_master_capture_mixer,
20034 .init_verbs = { alc680_init_verbs },
20035 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
20036 .dac_nids = alc680_dac_nids,
20037 .dig_out_nid = ALC680_DIGOUT_NID,
20038 .num_channel_mode = ARRAY_SIZE(alc680_modes),
20039 .channel_mode = alc680_modes,
20040 .unsol_event = alc680_unsol_event,
20041 .setup = alc680_base_setup,
20042 .init_hook = alc680_inithook,
20047 static int patch_alc680(struct hda_codec *codec)
20049 struct alc_spec *spec;
20053 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
20057 codec->spec = spec;
20059 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
20063 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
20064 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
20066 board_config = ALC680_AUTO;
20069 if (board_config == ALC680_AUTO) {
20070 /* automatic parse from the BIOS config */
20071 err = alc680_parse_auto_config(codec);
20077 "hda_codec: Cannot set up configuration "
20078 "from BIOS. Using base mode...\n");
20079 board_config = ALC680_BASE;
20083 if (board_config != ALC680_AUTO)
20084 setup_preset(codec, &alc680_presets[board_config]);
20086 spec->stream_analog_playback = &alc680_pcm_analog_playback;
20087 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
20088 spec->stream_digital_playback = &alc680_pcm_digital_playback;
20089 spec->stream_digital_capture = &alc680_pcm_digital_capture;
20091 if (!spec->adc_nids) {
20092 spec->adc_nids = alc680_adc_nids;
20093 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
20096 if (!spec->cap_mixer)
20097 set_capture_mixer(codec);
20099 spec->vmaster_nid = 0x02;
20101 codec->patch_ops = alc_patch_ops;
20102 if (board_config == ALC680_AUTO)
20103 spec->init_hook = alc680_auto_init;
20111 static struct hda_codec_preset snd_hda_preset_realtek[] = {
20112 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
20113 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
20114 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
20115 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
20116 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
20117 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
20118 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
20119 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
20120 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
20121 .patch = patch_alc861 },
20122 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
20123 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
20124 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
20125 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
20126 .patch = patch_alc882 },
20127 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
20128 .patch = patch_alc662 },
20129 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
20130 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
20131 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
20132 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
20133 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
20134 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
20135 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
20136 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
20137 .patch = patch_alc882 },
20138 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
20139 .patch = patch_alc882 },
20140 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
20141 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
20142 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
20143 .patch = patch_alc882 },
20144 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20145 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20146 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20147 {} /* terminator */
20150 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20152 MODULE_LICENSE("GPL");
20153 MODULE_DESCRIPTION("Realtek HD-audio codec");
20155 static struct hda_codec_preset_list realtek_list = {
20156 .preset = snd_hda_preset_realtek,
20157 .owner = THIS_MODULE,
20160 static int __init patch_realtek_init(void)
20162 return snd_hda_add_codec_preset(&realtek_list);
20165 static void __exit patch_realtek_exit(void)
20167 snd_hda_delete_codec_preset(&realtek_list);
20170 module_init(patch_realtek_init)
20171 module_exit(patch_realtek_exit)